History

Merge tag 'asoc-fix-v3.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v3.19 A few last minute fixes for v3.19, all driver specific. None of them stand out particularly - it's all the standard people who are affected will care stuff. The Samsung fix is a DT only fix for the audio controller, it's being merged via the ASoC tree due to process messups (the submitter sent it at the end of a tangentally related series rather than separately to the ARM folks) in order to make sure that it gets to people sooner.

Takashi Iwai committed 11 years ago

Commit 08c191d2 parents 4161b45 c503ca5226 files · +2384 −1312Browse files

Unified · Split

226 files
  1. Documentation/devicetree/bindings/i2c/i2c-st.txt +1 −1
  2. Documentation/devicetree/bindings/i2c/trivial-devices.txt +1 −0
  3. MAINTAINERS +21 −0
  4. Makefile +1 −1
  5. arch/alpha/mm/fault.c +2 −0
  6. arch/arc/mm/fault.c +2 −0
  7. arch/arm/boot/dts/exynos4.dtsi +2 −2
  8. arch/arm/boot/dts/imx6sx-sdb.dts +4 −4
  9. arch/arm/boot/dts/sun4i-a10.dtsi +10 −10
  10. arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts +6 −0
  11. arch/arm/boot/dts/sun5i-a10s.dtsi +2 −6
  12. arch/arm/boot/dts/sun5i-a13-hsg-h702.dts +4 −0
  13. arch/arm/boot/dts/sun5i-a13-olinuxino-micro.dts +4 −0
  14. arch/arm/boot/dts/sun5i-a13-olinuxino.dts +4 −0
  15. arch/arm/boot/dts/sun5i-a13.dtsi +2 −7
  16. arch/arm/boot/dts/sun6i-a31.dtsi +0 −6
  17. arch/arm/boot/dts/sun7i-a20-bananapi.dts +6 −0
  18. arch/arm/boot/dts/sun7i-a20-hummingbird.dts +8 −0
  19. arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts +3 −0
  20. arch/arm/boot/dts/sun7i-a20.dtsi +0 −8
  21. arch/arm/boot/dts/sun8i-a23-ippo-q8h-v5.dts +4 −0
  22. arch/arm/boot/dts/sun8i-a23.dtsi +0 −9
  23. arch/arm/boot/dts/sun9i-a80-optimus.dts +5 −0
  24. arch/arm/boot/dts/sun9i-a80.dtsi +0 −10
  25. arch/arm/include/asm/kvm_emulate.h +10 −0
  26. arch/arm/include/asm/kvm_host.h +0 −3
  27. arch/arm/include/asm/kvm_mmu.h +67 −10
  28. arch/arm/kvm/arm.c +0 −10
  29. arch/arm/kvm/coproc.c +14 −56
  30. arch/arm/kvm/coproc.h +3 −3
  31. arch/arm/kvm/coproc_a15.c +1 −1
  32. arch/arm/kvm/coproc_a7.c +1 −1
  33. arch/arm/kvm/mmu.c +144 −20
  34. arch/arm/kvm/trace.h +39 −0
  35. arch/arm/mach-mvebu/coherency.c +7 −0
  36. arch/arm/mach-shmobile/board-ape6evm.c +20 −0
  37. arch/arm/mach-shmobile/board-lager.c +13 −0
  38. arch/arm/mach-shmobile/setup-rcar-gen2.c +2 −0
  39. arch/arm/mach-shmobile/timer.c +12 −0
  40. arch/arm/mm/dma-mapping.c +38 −15
  41. arch/arm64/include/asm/kvm_emulate.h +10 −0
  42. arch/arm64/include/asm/kvm_host.h +0 −3
  43. arch/arm64/include/asm/kvm_mmu.h +28 −6
  44. arch/arm64/kvm/sys_regs.c +10 −65
  45. arch/avr32/mm/fault.c +2 −0
  46. arch/cris/mm/fault.c +2 −0
  47. arch/frv/mm/fault.c +2 −0
  48. arch/ia64/mm/fault.c +2 −0
  49. arch/m32r/mm/fault.c +2 −0
  50. arch/m68k/mm/fault.c +2 −0
  51. arch/metag/mm/fault.c +2 −0
  52. arch/microblaze/mm/fault.c +2 −0
  53. arch/mips/mm/fault.c +2 −0
  54. arch/mn10300/mm/fault.c +2 −0
  55. arch/nios2/mm/fault.c +2 −0
  56. arch/openrisc/mm/fault.c +2 −0
  57. arch/parisc/mm/fault.c +2 −0
  58. arch/powerpc/mm/copro_fault.c +1 −1
  59. arch/powerpc/mm/fault.c +2 −0
  60. arch/powerpc/platforms/powernv/setup.c +1 −1
  61. arch/powerpc/xmon/xmon.c +1 −0
  62. arch/s390/mm/fault.c +6 −0
  63. arch/score/mm/fault.c +2 −0
  64. arch/sh/mm/fault.c +2 −0
  65. arch/sparc/mm/fault_32.c +2 −0
  66. arch/sparc/mm/fault_64.c +2 −0
  67. arch/tile/mm/fault.c +2 −0
  68. arch/um/kernel/trap.c +2 −0
  69. arch/x86/boot/compressed/Makefile +1 −1
  70. arch/x86/kernel/cpu/perf_event_intel.c +1 −0
  71. arch/x86/kernel/cpu/perf_event_intel_rapl.c +1 −1
  72. arch/x86/kernel/cpu/perf_event_intel_uncore.c +2 −7
  73. arch/x86/kernel/cpu/perf_event_intel_uncore.h +10 −8
  74. arch/x86/kvm/lapic.c +3 −0
  75. arch/x86/mm/fault.c +2 −0
  76. arch/x86/tools/calc_run_size.pl +0 −39
  77. arch/x86/tools/calc_run_size.sh +42 −0
  78. arch/xtensa/mm/fault.c +2 −0
  79. drivers/Kconfig +0 −2
  80. drivers/block/rbd.c +7 −18
  81. drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 −3
  82. drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +76 −2
  83. drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +1 −0
  84. drivers/gpu/drm/amd/amdkfd/kfd_module.c +8 −19
  85. drivers/gpu/drm/amd/amdkfd/kfd_pasid.c +1 −1
  86. drivers/gpu/drm/amd/amdkfd/kfd_priv.h +8 −9
  87. drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +8 −4
  88. drivers/gpu/drm/drm_fb_helper.c +30 −0
  89. drivers/gpu/drm/i2c/tda998x_drv.c +42 −10
  90. drivers/gpu/drm/i915/i915_drv.c +4 −10
  91. drivers/gpu/drm/i915/i915_drv.h +1 −2
  92. drivers/gpu/drm/i915/i915_gem.c +13 −13
  93. drivers/gpu/drm/i915/intel_panel.c +1 −1
  94. drivers/gpu/drm/radeon/cik_sdma.c +0 −1
  95. drivers/gpu/drm/radeon/ni_dma.c +0 −1
  96. drivers/gpu/drm/radeon/r100.c +8 −2
  97. drivers/gpu/drm/radeon/r300.c +11 −5
  98. drivers/gpu/drm/radeon/radeon.h +6 −3
  99. drivers/gpu/drm/radeon/radeon_asic.c +24 −0
  100. drivers/gpu/drm/radeon/radeon_asic.h +8 −4
  101. drivers/gpu/drm/radeon/radeon_device.c +2 −0
  102. drivers/gpu/drm/radeon/radeon_gart.c +32 −22
  103. drivers/gpu/drm/radeon/radeon_kfd.c +1 −1
  104. drivers/gpu/drm/radeon/radeon_vm.c +2 −4
  105. drivers/gpu/drm/radeon/rs400.c +9 −5
  106. drivers/gpu/drm/radeon/rs600.c +9 −5
  107. drivers/gpu/drm/radeon/si_dma.c +0 −1
  108. drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +5 −23
  109. drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +21 −4
  110. drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +2 −16
  111. drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +15 −21
  112. drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +4 −4
  113. drivers/gpu/drm/vmwgfx/vmwgfx_irq.c +9 −16
  114. drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +0 −2
  115. drivers/i2c/busses/Kconfig +1 −0
  116. drivers/i2c/busses/i2c-s3c2410.c +17 −6
  117. drivers/i2c/busses/i2c-sh_mobile.c +11 −1
  118. drivers/i2c/i2c-core.c +2 −0
  119. drivers/i2c/i2c-slave-eeprom.c +2 −2
  120. drivers/input/mouse/elantech.c +16 −0
  121. drivers/input/mouse/synaptics.c +4 −3
  122. drivers/input/serio/i8042-x86ia64io.h +8 −0
  123. drivers/iommu/tegra-gart.c +2 −1
  124. drivers/md/dm-cache-metadata.c +5 −4
  125. drivers/md/dm-thin.c +6 −0
  126. drivers/net/can/c_can/c_can.c +3 −0
  127. drivers/net/can/usb/kvaser_usb.c +15 −13
  128. drivers/net/ethernet/amd/xgbe/xgbe-common.h +5 −4
  129. drivers/net/ethernet/amd/xgbe/xgbe-dev.c +2 −2
  130. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 −1
  131. drivers/net/ethernet/cisco/enic/enic_main.c +1 −1
  132. drivers/net/ethernet/marvell/mv643xx_eth.c +49 −10
  133. drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +4 −1
  134. drivers/net/ethernet/renesas/sh_eth.c +113 −51
  135. drivers/net/ethernet/renesas/sh_eth.h +1 −0
  136. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4 −1
  137. drivers/net/ethernet/ti/cpsw.c +22 −0
  138. drivers/net/ipvlan/ipvlan_core.c +4 −2
  139. drivers/net/wireless/ath/ath9k/main.c +3 −4
  140. drivers/net/wireless/iwlwifi/iwl-fw-file.h +2 −0
  141. drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h +5 −2
  142. drivers/net/wireless/iwlwifi/mvm/mac80211.c +9 −11
  143. drivers/net/wireless/iwlwifi/mvm/scan.c +41 −12
  144. drivers/net/wireless/iwlwifi/mvm/tx.c +9 −2
  145. drivers/pinctrl/pinctrl-at91.c +55 −53
  146. drivers/regulator/core.c +3 −1
  147. drivers/regulator/s2mps11.c +38 −4
  148. drivers/rtc/rtc-s5m.c +1 −0
  149. drivers/s390/net/qeth_core_main.c +101 −16
  150. drivers/s390/net/qeth_l2_main.c +108 −112
  151. drivers/s390/net/qeth_l3_main.c +39 −11
  152. drivers/scsi/scsi.c +3 −10
  153. drivers/spi/spi-dw-mid.c +0 −1
  154. drivers/spi/spi-dw.c +3 −3
  155. drivers/spi/spi-pxa2xx.c +1 −1
  156. drivers/spi/spi-sh-msiof.c +1 −1
  157. drivers/staging/lustre/lustre/llite/vvp_io.c +1 −1
  158. drivers/staging/nvec/nvec.c +3 −6
  159. drivers/usb/core/otg_whitelist.h +5 −0
  160. drivers/usb/core/quirks.c +4 −0
  161. drivers/usb/dwc2/core_intr.c +3 −3
  162. drivers/usb/phy/phy.c +1 −1
  163. drivers/usb/storage/unusual_devs.h +8 −1
  164. drivers/usb/storage/unusual_uas.h +7 −0
  165. fs/btrfs/scrub.c +2 −0
  166. fs/gfs2/quota.c +23 −26
  167. fs/nfs/direct.c +6 −0
  168. fs/nfs/inode.c +3 −2
  169. fs/nfs/internal.h +0 −2
  170. fs/nfs/nfs4client.c +1 −1
  171. fs/quota/dquot.c +39 −44
  172. fs/quota/quota.c +137 −25
  173. fs/udf/file.c +1 −1
  174. fs/xfs/xfs_qm.h +2 −2
  175. fs/xfs/xfs_qm_syscalls.c +66 −90
  176. fs/xfs/xfs_quotaops.c +4 −4
  177. include/linux/i2c.h +6 −0
  178. include/linux/kernel.h +1 −1
  179. include/linux/mfd/samsung/s2mps13.h +2 −0
  180. include/linux/mm.h +4 −2
  181. include/linux/oom.h +0 −5
  182. include/linux/perf_event.h +0 −6
  183. include/linux/printk.h +12 −3
  184. include/linux/quota.h +45 −2
  185. include/linux/quotaops.h +2 −2
  186. include/net/ip.h +6 −5
  187. kernel/bpf/syscall.c +17 −8
  188. kernel/cgroup.c +1 −1
  189. kernel/events/core.c +13 −2
  190. kernel/sched/core.c +2 −3
  191. mm/gup.c +2 −2
  192. mm/ksm.c +1 −1
  193. mm/memcontrol.c +2 −2
  194. mm/memory.c +1 −1
  195. mm/page_alloc.c +35 −47
  196. mm/vmscan.c +1 −1
  197. net/dsa/slave.c +1 −0
  198. net/ipv4/ip_forward.c +2 −1
  199. net/ipv4/ping.c +4 −1
  200. net/ipv4/route.c +5 −4
  201. net/ipv4/udp_diag.c +3 −1
  202. net/ipv6/ip6_fib.c +26 −19
  203. net/ipv6/route.c +5 −1
  204. net/ipv6/xfrm6_policy.c +8 −2
  205. net/llc/sysctl_net_llc.c +4 −4
  206. net/mac80211/pm.c +15 −14
  207. net/mac80211/rx.c +1 −1
  208. net/sched/cls_bpf.c +13 −2
  209. net/sctp/associola.c +0 −1
  210. net/socket.c +0 −3
  211. net/wireless/nl80211.c +4 −5
  212. net/wireless/util.c +6 −0
  213. samples/bpf/test_maps.c +2 −2
  214. sound/soc/atmel/atmel_ssc_dai.c +7 −17
  215. sound/soc/codecs/rt5640.c +1 −0
  216. sound/soc/codecs/sgtl5000.c +8 −5
  217. sound/soc/codecs/tlv320aic3x.c +1 −1
  218. sound/soc/codecs/wm8731.c +2 −0
  219. sound/soc/intel/sst-haswell-ipc.c +2 −2
  220. tools/perf/scripts/perl/Perf-Trace-Util/Context.c +4 −1
  221. tools/perf/util/annotate.c +14 −4
  222. tools/perf/util/evlist.c +1 −1
  223. tools/perf/util/map.h +16 −0
  224. tools/perf/util/probe-event.c +16 −18
  225. tools/perf/util/symbol.c +28 −3
  226. tools/perf/util/symbol.h +1 −0
Documentation/devicetree/bindings/i2c/i2c-st.txt+1−1
@@ -31,7 +31,7 @@ i2c0: i2c@fed40000 { · 30 unmodified lines
3131 compatible = "st,comms-ssc4-i2c";
3232 reg = <0xfed40000 0x110>;
3333 interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>;
34− clocks = <&CLK_S_ICN_REG_0>;
34+ clocks = <&clk_s_a0_ls CLK_ICN_REG>;
3535 clock-names = "ssc";
3636 clock-frequency = <400000>;
3737 pinctrl-names = "default";
Documentation/devicetree/bindings/i2c/trivial-devices.txt+1−0
@@ -47,6 +47,7 @@ dallas,ds3232 Extremely Accurate I²C RTC with Integrated Crystal and SRAM · 46 unmodified lines
4747 dallas,ds4510 CPU Supervisor with Nonvolatile Memory and Programmable I/O
4848 dallas,ds75 Digital Thermometer and Thermostat
4949 dlg,da9053 DA9053: flexible system level PMIC with multicore support
50+dlg,da9063 DA9063: system PMIC for quad-core application processors
5051 epson,rx8025 High-Stability. I2C-Bus INTERFACE REAL TIME CLOCK MODULE
5152 epson,rx8581 I2C-BUS INTERFACE REAL TIME CLOCK MODULE
5253 fsl,mag3110 MAG3110: Xtrinsic High Accuracy, 3D Magnetometer
MAINTAINERS+21−0
@@ -708,6 +708,16 @@ X: drivers/iio/*/adjd* · 707 unmodified lines
708708 F: drivers/staging/iio/*/ad*
709709 F: staging/iio/trigger/iio-trig-bfin-timer.c
710710
711+ANDROID DRIVERS
712+M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
713+M: Arve Hj�nnev�g <arve@android.com>
714+M: Riley Andrews <riandrews@android.com>
715+T: git git://git.kernel.org/pub/scm/linux/kernel/gregkh/staging.git
716+L: devel@driverdev.osuosl.org
717+S: Supported
718+F: drivers/android/
719+F: drivers/staging/android/
720+
711721 AOA (Apple Onboard Audio) ALSA DRIVER
712722 M: Johannes Berg <johannes@sipsolutions.net>
713723 L: linuxppc-dev@lists.ozlabs.org
@@ -4943,6 +4953,16 @@ F: Documentation/input/multi-touch-protocol.txt · 4229 unmodified lines
49434953 F: drivers/input/input-mt.c
49444954 K: \b(ABS|SYN)_MT_
49454955
4956+INTEL ASoC BDW/HSW DRIVERS
4957+M: Jie Yang <yang.jie@linux.intel.com>
4958+L: alsa-devel@alsa-project.org
4959+S: Supported
4960+F: sound/soc/intel/sst-haswell*
4961+F: sound/soc/intel/sst-dsp*
4962+F: sound/soc/intel/sst-firmware.c
4963+F: sound/soc/intel/broadwell.c
4964+F: sound/soc/intel/haswell.c
4965+
49464966 INTEL C600 SERIES SAS CONTROLLER DRIVER
49474967 M: Intel SCU Linux support <intel-linux-scu@intel.com>
49484968 M: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
@@ -10166,6 +10186,7 @@ USERSPACE I/O (UIO) · 5217 unmodified lines
1016610186 M: "Hans J. Koch" <hjk@hansjkoch.de>
1016710187 M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1016810188 S: Maintained
10189+T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
1016910190 F: Documentation/DocBook/uio-howto.tmpl
1017010191 F: drivers/uio/
1017110192 F: include/linux/uio*.h
Makefile+1−1
@@ -1,7 +1,7 @@
11 VERSION = 3
22 PATCHLEVEL = 19
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc6
4+EXTRAVERSION = -rc7
55 NAME = Diseased Newt
66
77 # *DOCUMENTATION*
arch/alpha/mm/fault.c+2−0
@@ -156,6 +156,8 @@ retry: · 155 unmodified lines
156156 if (unlikely(fault & VM_FAULT_ERROR)) {
157157 if (fault & VM_FAULT_OOM)
158158 goto out_of_memory;
159+ else if (fault & VM_FAULT_SIGSEGV)
160+ goto bad_area;
159161 else if (fault & VM_FAULT_SIGBUS)
160162 goto do_sigbus;
161163 BUG();
arch/arc/mm/fault.c+2−0
@@ -161,6 +161,8 @@ good_area: · 160 unmodified lines
161161
162162 if (fault & VM_FAULT_OOM)
163163 goto out_of_memory;
164+ else if (fault & VM_FAULT_SIGSEGV)
165+ goto bad_area;
164166 else if (fault & VM_FAULT_SIGBUS)
165167 goto do_sigbus;
166168
arch/arm/boot/dts/exynos4.dtsi+2−2
@@ -368,7 +368,7 @@ · 367 unmodified lines
368368 };
369369
370370 i2s1: i2s@13960000 {
371− compatible = "samsung,s5pv210-i2s";
371+ compatible = "samsung,s3c6410-i2s";
372372 reg = <0x13960000 0x100>;
373373 clocks = <&clock CLK_I2S1>;
374374 clock-names = "iis";
@@ -378,7 +378,7 @@ · 3 unmodified lines
378378 };
379379
380380 i2s2: i2s@13970000 {
381− compatible = "samsung,s5pv210-i2s";
381+ compatible = "samsung,s3c6410-i2s";
382382 reg = <0x13970000 0x100>;
383383 clocks = <&clock CLK_I2S2>;
384384 clock-names = "iis";
arch/arm/boot/dts/imx6sx-sdb.dts+4−4
@@ -166,12 +166,12 @@ · 165 unmodified lines
166166 #address-cells = <1>;
167167 #size-cells = <0>;
168168
169− ethphy1: ethernet-phy@0 {
170− reg = <0>;
169+ ethphy1: ethernet-phy@1 {
170+ reg = <1>;
171171 };
172172
173− ethphy2: ethernet-phy@1 {
174− reg = <1>;
173+ ethphy2: ethernet-phy@2 {
174+ reg = <2>;
175175 };
176176 };
177177 };
arch/arm/boot/dts/sun4i-a10.dtsi+10−10
@@ -17,14 +17,6 @@ · 16 unmodified lines
1717
1818 aliases {
1919 ethernet0 = &emac;
20− serial0 = &uart0;
21− serial1 = &uart1;
22− serial2 = &uart2;
23− serial3 = &uart3;
24− serial4 = &uart4;
25− serial5 = &uart5;
26− serial6 = &uart6;
27− serial7 = &uart7;
2820 };
2921
3022 chosen {
@@ -39,6 +31,14 @@ · 8 unmodified lines
3931 <&ahb_gates 44>;
4032 status = "disabled";
4133 };
34+
35+ framebuffer@1 {
36+ compatible = "allwinner,simple-framebuffer", "simple-framebuffer";
37+ allwinner,pipeline = "de_fe0-de_be0-lcd0-hdmi";
38+ clocks = <&pll5 1>, <&ahb_gates 36>, <&ahb_gates 43>,
39+ <&ahb_gates 44>, <&ahb_gates 46>;
40+ status = "disabled";
41+ };
4242 };
4343
4444 cpus {
@@ -438,8 +438,8 @@ · 393 unmodified lines
438438 reg-names = "phy_ctrl", "pmu1", "pmu2";
439439 clocks = <&usb_clk 8>;
440440 clock-names = "usb_phy";
441− resets = <&usb_clk 1>, <&usb_clk 2>;
442− reset-names = "usb1_reset", "usb2_reset";
441+ resets = <&usb_clk 0>, <&usb_clk 1>, <&usb_clk 2>;
442+ reset-names = "usb0_reset", "usb1_reset", "usb2_reset";
443443 status = "disabled";
444444 };
445445
arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts+6−0
@@ -55,6 +55,12 @@ · 54 unmodified lines
5555 model = "Olimex A10s-Olinuxino Micro";
5656 compatible = "olimex,a10s-olinuxino-micro", "allwinner,sun5i-a10s";
5757
58+ aliases {
59+ serial0 = &uart0;
60+ serial1 = &uart2;
61+ serial2 = &uart3;
62+ };
63+
5864 soc@01c00000 {
5965 emac: ethernet@01c0b000 {
6066 pinctrl-names = "default";
arch/arm/boot/dts/sun5i-a10s.dtsi+2−6
@@ -18,10 +18,6 @@ · 17 unmodified lines
1818
1919 aliases {
2020 ethernet0 = &emac;
21− serial0 = &uart0;
22− serial1 = &uart1;
23− serial2 = &uart2;
24− serial3 = &uart3;
2521 };
2622
2723 chosen {
@@ -390,8 +386,8 @@ · 362 unmodified lines
390386 reg-names = "phy_ctrl", "pmu1";
391387 clocks = <&usb_clk 8>;
392388 clock-names = "usb_phy";
393− resets = <&usb_clk 1>;
394− reset-names = "usb1_reset";
389+ resets = <&usb_clk 0>, <&usb_clk 1>;
390+ reset-names = "usb0_reset", "usb1_reset";
395391 status = "disabled";
396392 };
397393
arch/arm/boot/dts/sun5i-a13-hsg-h702.dts+4−0
@@ -53,6 +53,10 @@ · 52 unmodified lines
5353 model = "HSG H702";
5454 compatible = "hsg,h702", "allwinner,sun5i-a13";
5555
56+ aliases {
57+ serial0 = &uart1;
58+ };
59+
5660 soc@01c00000 {
5761 mmc0: mmc@01c0f000 {
5862 pinctrl-names = "default";
arch/arm/boot/dts/sun5i-a13-olinuxino-micro.dts+4−0
@@ -54,6 +54,10 @@ · 53 unmodified lines
5454 model = "Olimex A13-Olinuxino Micro";
5555 compatible = "olimex,a13-olinuxino-micro", "allwinner,sun5i-a13";
5656
57+ aliases {
58+ serial0 = &uart1;
59+ };
60+
5761 soc@01c00000 {
5862 mmc0: mmc@01c0f000 {
5963 pinctrl-names = "default";
arch/arm/boot/dts/sun5i-a13-olinuxino.dts+4−0
@@ -55,6 +55,10 @@ · 54 unmodified lines
5555 model = "Olimex A13-Olinuxino";
5656 compatible = "olimex,a13-olinuxino", "allwinner,sun5i-a13";
5757
58+ aliases {
59+ serial0 = &uart1;
60+ };
61+
5862 soc@01c00000 {
5963 mmc0: mmc@01c0f000 {
6064 pinctrl-names = "default";
arch/arm/boot/dts/sun5i-a13.dtsi+2−7
@@ -16,11 +16,6 @@ · 15 unmodified lines
1616 / {
1717 interrupt-parent = <&intc>;
1818
19− aliases {
20− serial0 = &uart1;
21− serial1 = &uart3;
22− };
23−
2419 cpus {
2520 #address-cells = <1>;
2621 #size-cells = <0>;
@@ -349,8 +344,8 @@ · 322 unmodified lines
349344 reg-names = "phy_ctrl", "pmu1";
350345 clocks = <&usb_clk 8>;
351346 clock-names = "usb_phy";
352− resets = <&usb_clk 1>;
353− reset-names = "usb1_reset";
347+ resets = <&usb_clk 0>, <&usb_clk 1>;
348+ reset-names = "usb0_reset", "usb1_reset";
354349 status = "disabled";
355350 };
356351
arch/arm/boot/dts/sun6i-a31.dtsi+0−6
@@ -53,12 +53,6 @@ · 52 unmodified lines
5353 interrupt-parent = <&gic>;
5454
5555 aliases {
56− serial0 = &uart0;
57− serial1 = &uart1;
58− serial2 = &uart2;
59− serial3 = &uart3;
60− serial4 = &uart4;
61− serial5 = &uart5;
6256 ethernet0 = &gmac;
6357 };
6458
arch/arm/boot/dts/sun7i-a20-bananapi.dts+6−0
@@ -55,6 +55,12 @@ · 54 unmodified lines
5555 model = "LeMaker Banana Pi";
5656 compatible = "lemaker,bananapi", "allwinner,sun7i-a20";
5757
58+ aliases {
59+ serial0 = &uart0;
60+ serial1 = &uart3;
61+ serial2 = &uart7;
62+ };
63+
5864 soc@01c00000 {
5965 spi0: spi@01c05000 {
6066 pinctrl-names = "default";
arch/arm/boot/dts/sun7i-a20-hummingbird.dts+8−0
@@ -19,6 +19,14 @@ · 18 unmodified lines
1919 model = "Merrii A20 Hummingbird";
2020 compatible = "merrii,a20-hummingbird", "allwinner,sun7i-a20";
2121
22+ aliases {
23+ serial0 = &uart0;
24+ serial1 = &uart2;
25+ serial2 = &uart3;
26+ serial3 = &uart4;
27+ serial4 = &uart5;
28+ };
29+
2230 soc@01c00000 {
2331 mmc0: mmc@01c0f000 {
2432 pinctrl-names = "default";
arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts+3−0
@@ -20,6 +20,9 @@ · 19 unmodified lines
2020 compatible = "olimex,a20-olinuxino-micro", "allwinner,sun7i-a20";
2121
2222 aliases {
23+ serial0 = &uart0;
24+ serial1 = &uart6;
25+ serial2 = &uart7;
2326 spi0 = &spi1;
2427 spi1 = &spi2;
2528 };
arch/arm/boot/dts/sun7i-a20.dtsi+0−8
@@ -54,14 +54,6 @@ · 53 unmodified lines
5454
5555 aliases {
5656 ethernet0 = &gmac;
57− serial0 = &uart0;
58− serial1 = &uart1;
59− serial2 = &uart2;
60− serial3 = &uart3;
61− serial4 = &uart4;
62− serial5 = &uart5;
63− serial6 = &uart6;
64− serial7 = &uart7;
6557 };
6658
6759 chosen {
arch/arm/boot/dts/sun8i-a23-ippo-q8h-v5.dts+4−0
@@ -55,6 +55,10 @@ · 54 unmodified lines
5555 model = "Ippo Q8H Dual Core Tablet (v5)";
5656 compatible = "ippo,q8h-v5", "allwinner,sun8i-a23";
5757
58+ aliases {
59+ serial0 = &r_uart;
60+ };
61+
5862 chosen {
5963 bootargs = "earlyprintk console=ttyS0,115200";
6064 };
arch/arm/boot/dts/sun8i-a23.dtsi+0−9
@@ -52,15 +52,6 @@ · 51 unmodified lines
5252 / {
5353 interrupt-parent = <&gic>;
5454
55− aliases {
56− serial0 = &uart0;
57− serial1 = &uart1;
58− serial2 = &uart2;
59− serial3 = &uart3;
60− serial4 = &uart4;
61− serial5 = &r_uart;
62− };
63−
6455 cpus {
6556 #address-cells = <1>;
6657 #size-cells = <0>;
arch/arm/boot/dts/sun9i-a80-optimus.dts+5−0
@@ -54,6 +54,11 @@ · 53 unmodified lines
5454 model = "Merrii A80 Optimus Board";
5555 compatible = "merrii,a80-optimus", "allwinner,sun9i-a80";
5656
57+ aliases {
58+ serial0 = &uart0;
59+ serial1 = &uart4;
60+ };
61+
5762 chosen {
5863 bootargs = "earlyprintk console=ttyS0,115200";
5964 };
arch/arm/boot/dts/sun9i-a80.dtsi+0−10
@@ -52,16 +52,6 @@ · 51 unmodified lines
5252 / {
5353 interrupt-parent = <&gic>;
5454
55− aliases {
56− serial0 = &uart0;
57− serial1 = &uart1;
58− serial2 = &uart2;
59− serial3 = &uart3;
60− serial4 = &uart4;
61− serial5 = &uart5;
62− serial6 = &r_uart;
63− };
64−
6555 cpus {
6656 #address-cells = <1>;
6757 #size-cells = <0>;
arch/arm/include/asm/kvm_emulate.h+10−0
@@ -38,6 +38,16 @@ static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu) · 37 unmodified lines
3838 vcpu->arch.hcr = HCR_GUEST_MASK;
3939 }
4040
41+static inline unsigned long vcpu_get_hcr(struct kvm_vcpu *vcpu)
42+{
43+ return vcpu->arch.hcr;
44+}
45+
46+static inline void vcpu_set_hcr(struct kvm_vcpu *vcpu, unsigned long hcr)
47+{
48+ vcpu->arch.hcr = hcr;
49+}
50+
4151 static inline bool vcpu_mode_is_32bit(struct kvm_vcpu *vcpu)
4252 {
4353 return 1;
arch/arm/include/asm/kvm_host.h+0−3
@@ -125,9 +125,6 @@ struct kvm_vcpu_arch { · 124 unmodified lines
125125 * Anything that is not used directly from assembly code goes
126126 * here.
127127 */
128− /* dcache set/way operation pending */
129− int last_pcpu;
130− cpumask_t require_dcache_flush;
131128
132129 /* Don't run the guest on this vcpu */
133130 bool pause;
arch/arm/include/asm/kvm_mmu.h+67−10
@@ -44,6 +44,7 @@ · 43 unmodified lines
4444
4545 #ifndef __ASSEMBLY__
4646
47+#include <linux/highmem.h>
4748 #include <asm/cacheflush.h>
4849 #include <asm/pgalloc.h>
4950
@@ -161,13 +162,10 @@ static inline bool vcpu_has_cache_enabled(struct kvm_vcpu *vcpu) · 111 unmodified lines
161162 return (vcpu->arch.cp15[c1_SCTLR] & 0b101) == 0b101;
162163 }
163164
164−static inline void coherent_cache_guest_page(struct kvm_vcpu *vcpu, hva_t hva,
165− unsigned long size,
166− bool ipa_uncached)
165+static inline void __coherent_cache_guest_page(struct kvm_vcpu *vcpu, pfn_t pfn,
166+ unsigned long size,
167+ bool ipa_uncached)
167168 {
168− if (!vcpu_has_cache_enabled(vcpu) || ipa_uncached)
169− kvm_flush_dcache_to_poc((void *)hva, size);
170−
171169 /*
172170 * If we are going to insert an instruction page and the icache is
173171 * either VIPT or PIPT, there is a potential problem where the host
@@ -179,18 +177,77 @@ static inline void coherent_cache_guest_page(struct kvm_vcpu *vcpu, hva_t hva, · 5 unmodified lines
179177 *
180178 * VIVT caches are tagged using both the ASID and the VMID and doesn't
181179 * need any kind of flushing (DDI 0406C.b - Page B3-1392).
180+ *
181+ * We need to do this through a kernel mapping (using the
182+ * user-space mapping has proved to be the wrong
183+ * solution). For that, we need to kmap one page at a time,
184+ * and iterate over the range.
182185 */
183− if (icache_is_pipt()) {
184− __cpuc_coherent_user_range(hva, hva + size);
185− } else if (!icache_is_vivt_asid_tagged()) {
186+
187+ bool need_flush = !vcpu_has_cache_enabled(vcpu) || ipa_uncached;
188+
189+ VM_BUG_ON(size & PAGE_MASK);
190+
191+ if (!need_flush && !icache_is_pipt())
192+ goto vipt_cache;
193+
194+ while (size) {
195+ void *va = kmap_atomic_pfn(pfn);
196+
197+ if (need_flush)
198+ kvm_flush_dcache_to_poc(va, PAGE_SIZE);
199+
200+ if (icache_is_pipt())
201+ __cpuc_coherent_user_range((unsigned long)va,
202+ (unsigned long)va + PAGE_SIZE);
203+
204+ size -= PAGE_SIZE;
205+ pfn++;
206+
207+ kunmap_atomic(va);
208+ }
209+
210+vipt_cache:
211+ if (!icache_is_pipt() && !icache_is_vivt_asid_tagged()) {
186212 /* any kind of VIPT cache */
187213 __flush_icache_all();
188214 }
189215 }
190216
217+static inline void __kvm_flush_dcache_pte(pte_t pte)
218+{
219+ void *va = kmap_atomic(pte_page(pte));
220+
221+ kvm_flush_dcache_to_poc(va, PAGE_SIZE);
222+
223+ kunmap_atomic(va);
224+}
225+
226+static inline void __kvm_flush_dcache_pmd(pmd_t pmd)
227+{
228+ unsigned long size = PMD_SIZE;
229+ pfn_t pfn = pmd_pfn(pmd);
230+
231+ while (size) {
232+ void *va = kmap_atomic_pfn(pfn);
233+
234+ kvm_flush_dcache_to_poc(va, PAGE_SIZE);
235+
236+ pfn++;
237+ size -= PAGE_SIZE;
238+
239+ kunmap_atomic(va);
240+ }
241+}
242+
243+static inline void __kvm_flush_dcache_pud(pud_t pud)
244+{
245+}
246+
191247 #define kvm_virt_to_phys(x) virt_to_idmap((unsigned long)(x))
192248
193−void stage2_flush_vm(struct kvm *kvm);
249+void kvm_set_way_flush(struct kvm_vcpu *vcpu);
250+void kvm_toggle_cache(struct kvm_vcpu *vcpu, bool was_enabled);
194251
195252 #endif /* !__ASSEMBLY__ */
196253
arch/arm/kvm/arm.c+0−10
@@ -281,15 +281,6 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) · 280 unmodified lines
281281 vcpu->cpu = cpu;
282282 vcpu->arch.host_cpu_context = this_cpu_ptr(kvm_host_cpu_state);
283283
284− /*
285− * Check whether this vcpu requires the cache to be flushed on
286− * this physical CPU. This is a consequence of doing dcache
287− * operations by set/way on this vcpu. We do it here to be in
288− * a non-preemptible section.
289− */
290− if (cpumask_test_and_clear_cpu(cpu, &vcpu->arch.require_dcache_flush))
291− flush_cache_all(); /* We'd really want v7_flush_dcache_all() */
292−
293284 kvm_arm_set_running_vcpu(vcpu);
294285 }
295286
@@ -541,7 +532,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) · 245 unmodified lines
541532 ret = kvm_call_hyp(__kvm_vcpu_run, vcpu);
542533
543534 vcpu->mode = OUTSIDE_GUEST_MODE;
544− vcpu->arch.last_pcpu = smp_processor_id();
545535 kvm_guest_exit();
546536 trace_kvm_exit(*vcpu_pc(vcpu));
547537 /*
arch/arm/kvm/coproc.c+14−56
@@ -189,82 +189,40 @@ static bool access_l2ectlr(struct kvm_vcpu *vcpu, · 188 unmodified lines
189189 return true;
190190 }
191191
192−/* See note at ARM ARM B1.14.4 */
192+/*
193+ * See note at ARMv7 ARM B1.14.4 (TL;DR: S/W ops are not easily virtualized).
194+ */
193195 static bool access_dcsw(struct kvm_vcpu *vcpu,
194196 const struct coproc_params *p,
195197 const struct coproc_reg *r)
196198 {
197− unsigned long val;
198− int cpu;
199−
200199 if (!p->is_write)
201200 return read_from_write_only(vcpu, p);
202201
203− cpu = get_cpu();
204−
205− cpumask_setall(&vcpu->arch.require_dcache_flush);
206− cpumask_clear_cpu(cpu, &vcpu->arch.require_dcache_flush);
207−
208− /* If we were already preempted, take the long way around */
209− if (cpu != vcpu->arch.last_pcpu) {
210− flush_cache_all();
211− goto done;
212− }
213−
214− val = *vcpu_reg(vcpu, p->Rt1);
215−
216− switch (p->CRm) {
217− case 6: /* Upgrade DCISW to DCCISW, as per HCR.SWIO */
218− case 14: /* DCCISW */
219− asm volatile("mcr p15, 0, %0, c7, c14, 2" : : "r" (val));
220− break;
221−
222− case 10: /* DCCSW */
223− asm volatile("mcr p15, 0, %0, c7, c10, 2" : : "r" (val));
224− break;
225− }
226−
227−done:
228− put_cpu();
229−
202+ kvm_set_way_flush(vcpu);
230203 return true;
231204 }
232205
233206 /*
234207 * Generic accessor for VM registers. Only called as long as HCR_TVM
235− * is set.
208+ * is set. If the guest enables the MMU, we stop trapping the VM
209+ * sys_regs and leave it in complete control of the caches.
210+ *
211+ * Used by the cpu-specific code.
236212 */
237−static bool access_vm_reg(struct kvm_vcpu *vcpu,
238− const struct coproc_params *p,
239− const struct coproc_reg *r)
213+bool access_vm_reg(struct kvm_vcpu *vcpu,
214+ const struct coproc_params *p,
215+ const struct coproc_reg *r)
240216 {
217+ bool was_enabled = vcpu_has_cache_enabled(vcpu);
218+
241219 BUG_ON(!p->is_write);
242220
243221 vcpu->arch.cp15[r->reg] = *vcpu_reg(vcpu, p->Rt1);
244222 if (p->is_64bit)
245223 vcpu->arch.cp15[r->reg + 1] = *vcpu_reg(vcpu, p->Rt2);
246224
247− return true;
248−}
249−
250−/*
251− * SCTLR accessor. Only called as long as HCR_TVM is set. If the
252− * guest enables the MMU, we stop trapping the VM sys_regs and leave
253− * it in complete control of the caches.
254− *
255− * Used by the cpu-specific code.
256− */
257−bool access_sctlr(struct kvm_vcpu *vcpu,
258− const struct coproc_params *p,
259− const struct coproc_reg *r)
260−{
261− access_vm_reg(vcpu, p, r);
262−
263− if (vcpu_has_cache_enabled(vcpu)) { /* MMU+Caches enabled? */
264− vcpu->arch.hcr &= ~HCR_TVM;
265− stage2_flush_vm(vcpu->kvm);
266− }
267−
225+ kvm_toggle_cache(vcpu, was_enabled);
268226 return true;
269227 }
270228
arch/arm/kvm/coproc.h+3−3
@@ -153,8 +153,8 @@ static inline int cmp_reg(const struct coproc_reg *i1, · 152 unmodified lines
153153 #define is64 .is_64 = true
154154 #define is32 .is_64 = false
155155
156−bool access_sctlr(struct kvm_vcpu *vcpu,
157− const struct coproc_params *p,
158− const struct coproc_reg *r);
156+bool access_vm_reg(struct kvm_vcpu *vcpu,
157+ const struct coproc_params *p,
158+ const struct coproc_reg *r);
159159
160160 #endif /* __ARM_KVM_COPROC_LOCAL_H__ */
arch/arm/kvm/coproc_a15.c+1−1
@@ -34,7 +34,7 @@ · 33 unmodified lines
3434 static const struct coproc_reg a15_regs[] = {
3535 /* SCTLR: swapped by interrupt.S. */
3636 { CRn( 1), CRm( 0), Op1( 0), Op2( 0), is32,
37− access_sctlr, reset_val, c1_SCTLR, 0x00C50078 },
37+ access_vm_reg, reset_val, c1_SCTLR, 0x00C50078 },
3838 };
3939
4040 static struct kvm_coproc_target_table a15_target_table = {
arch/arm/kvm/coproc_a7.c+1−1
@@ -37,7 +37,7 @@ · 36 unmodified lines
3737 static const struct coproc_reg a7_regs[] = {
3838 /* SCTLR: swapped by interrupt.S. */
3939 { CRn( 1), CRm( 0), Op1( 0), Op2( 0), is32,
40− access_sctlr, reset_val, c1_SCTLR, 0x00C50878 },
40+ access_vm_reg, reset_val, c1_SCTLR, 0x00C50878 },
4141 };
4242
4343 static struct kvm_coproc_target_table a7_target_table = {
arch/arm/kvm/mmu.c+144−20
@@ -58,6 +58,26 @@ static void kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) · 57 unmodified lines
5858 kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, kvm, ipa);
5959 }
6060
61+/*
62+ * D-Cache management functions. They take the page table entries by
63+ * value, as they are flushing the cache using the kernel mapping (or
64+ * kmap on 32bit).
65+ */
66+static void kvm_flush_dcache_pte(pte_t pte)
67+{
68+ __kvm_flush_dcache_pte(pte);
69+}
70+
71+static void kvm_flush_dcache_pmd(pmd_t pmd)
72+{
73+ __kvm_flush_dcache_pmd(pmd);
74+}
75+
76+static void kvm_flush_dcache_pud(pud_t pud)
77+{
78+ __kvm_flush_dcache_pud(pud);
79+}
80+
6181 static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache,
6282 int min, int max)
6383 {
@@ -119,6 +139,26 @@ static void clear_pmd_entry(struct kvm *kvm, pmd_t *pmd, phys_addr_t addr) · 55 unmodified lines
119139 put_page(virt_to_page(pmd));
120140 }
121141
142+/*
143+ * Unmapping vs dcache management:
144+ *
145+ * If a guest maps certain memory pages as uncached, all writes will
146+ * bypass the data cache and go directly to RAM. However, the CPUs
147+ * can still speculate reads (not writes) and fill cache lines with
148+ * data.
149+ *
150+ * Those cache lines will be *clean* cache lines though, so a
151+ * clean+invalidate operation is equivalent to an invalidate
152+ * operation, because no cache lines are marked dirty.
153+ *
154+ * Those clean cache lines could be filled prior to an uncached write
155+ * by the guest, and the cache coherent IO subsystem would therefore
156+ * end up writing old data to disk.
157+ *
158+ * This is why right after unmapping a page/section and invalidating
159+ * the corresponding TLBs, we call kvm_flush_dcache_p*() to make sure
160+ * the IO subsystem will never hit in the cache.
161+ */
122162 static void unmap_ptes(struct kvm *kvm, pmd_t *pmd,
123163 phys_addr_t addr, phys_addr_t end)
124164 {
@@ -128,9 +168,16 @@ static void unmap_ptes(struct kvm *kvm, pmd_t *pmd, · 3 unmodified lines
128168 start_pte = pte = pte_offset_kernel(pmd, addr);
129169 do {
130170 if (!pte_none(*pte)) {
171+ pte_t old_pte = *pte;
172+
131173 kvm_set_pte(pte, __pte(0));
132− put_page(virt_to_page(pte));
133174 kvm_tlb_flush_vmid_ipa(kvm, addr);
175+
176+ /* No need to invalidate the cache for device mappings */
177+ if ((pte_val(old_pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
178+ kvm_flush_dcache_pte(old_pte);
179+
180+ put_page(virt_to_page(pte));
134181 }
135182 } while (pte++, addr += PAGE_SIZE, addr != end);
136183
@@ -149,8 +196,13 @@ static void unmap_pmds(struct kvm *kvm, pud_t *pud, · 12 unmodified lines
149196 next = kvm_pmd_addr_end(addr, end);
150197 if (!pmd_none(*pmd)) {
151198 if (kvm_pmd_huge(*pmd)) {
199+ pmd_t old_pmd = *pmd;
200+
152201 pmd_clear(pmd);
153202 kvm_tlb_flush_vmid_ipa(kvm, addr);
203+
204+ kvm_flush_dcache_pmd(old_pmd);
205+
154206 put_page(virt_to_page(pmd));
155207 } else {
156208 unmap_ptes(kvm, pmd, addr, next);
@@ -173,8 +225,13 @@ static void unmap_puds(struct kvm *kvm, pgd_t *pgd, · 16 unmodified lines
173225 next = kvm_pud_addr_end(addr, end);
174226 if (!pud_none(*pud)) {
175227 if (pud_huge(*pud)) {
228+ pud_t old_pud = *pud;
229+
176230 pud_clear(pud);
177231 kvm_tlb_flush_vmid_ipa(kvm, addr);
232+
233+ kvm_flush_dcache_pud(old_pud);
234+
178235 put_page(virt_to_page(pud));
179236 } else {
180237 unmap_pmds(kvm, pud, addr, next);
@@ -209,10 +266,9 @@ static void stage2_flush_ptes(struct kvm *kvm, pmd_t *pmd, · 28 unmodified lines
209266
210267 pte = pte_offset_kernel(pmd, addr);
211268 do {
212− if (!pte_none(*pte)) {
213− hva_t hva = gfn_to_hva(kvm, addr >> PAGE_SHIFT);
214− kvm_flush_dcache_to_poc((void*)hva, PAGE_SIZE);
215− }
269+ if (!pte_none(*pte) &&
270+ (pte_val(*pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
271+ kvm_flush_dcache_pte(*pte);
216272 } while (pte++, addr += PAGE_SIZE, addr != end);
217273 }
218274
@@ -226,12 +282,10 @@ static void stage2_flush_pmds(struct kvm *kvm, pud_t *pud, · 7 unmodified lines
226282 do {
227283 next = kvm_pmd_addr_end(addr, end);
228284 if (!pmd_none(*pmd)) {
229− if (kvm_pmd_huge(*pmd)) {
230− hva_t hva = gfn_to_hva(kvm, addr >> PAGE_SHIFT);
231− kvm_flush_dcache_to_poc((void*)hva, PMD_SIZE);
232− } else {
285+ if (kvm_pmd_huge(*pmd))
286+ kvm_flush_dcache_pmd(*pmd);
287+ else
233288 stage2_flush_ptes(kvm, pmd, addr, next);
234− }
235289 }
236290 } while (pmd++, addr = next, addr != end);
237291 }
@@ -246,12 +300,10 @@ static void stage2_flush_puds(struct kvm *kvm, pgd_t *pgd, · 8 unmodified lines
246300 do {
247301 next = kvm_pud_addr_end(addr, end);
248302 if (!pud_none(*pud)) {
249− if (pud_huge(*pud)) {
250− hva_t hva = gfn_to_hva(kvm, addr >> PAGE_SHIFT);
251− kvm_flush_dcache_to_poc((void*)hva, PUD_SIZE);
252− } else {
303+ if (pud_huge(*pud))
304+ kvm_flush_dcache_pud(*pud);
305+ else
253306 stage2_flush_pmds(kvm, pud, addr, next);
254− }
255307 }
256308 } while (pud++, addr = next, addr != end);
257309 }
@@ -278,7 +330,7 @@ static void stage2_flush_memslot(struct kvm *kvm, · 20 unmodified lines
278330 * Go through the stage 2 page tables and invalidate any cache lines
279331 * backing memory already mapped to the VM.
280332 */
281−void stage2_flush_vm(struct kvm *kvm)
333+static void stage2_flush_vm(struct kvm *kvm)
282334 {
283335 struct kvm_memslots *slots;
284336 struct kvm_memory_slot *memslot;
@@ -905,6 +957,12 @@ static bool kvm_is_device_pfn(unsigned long pfn) · 620 unmodified lines
905957 return !pfn_valid(pfn);
906958 }
907959
960+static void coherent_cache_guest_page(struct kvm_vcpu *vcpu, pfn_t pfn,
961+ unsigned long size, bool uncached)
962+{
963+ __coherent_cache_guest_page(vcpu, pfn, size, uncached);
964+}
965+
908966 static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
909967 struct kvm_memory_slot *memslot, unsigned long hva,
910968 unsigned long fault_status)
@@ -994,8 +1052,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, · 83 unmodified lines
9941052 kvm_set_s2pmd_writable(&new_pmd);
9951053 kvm_set_pfn_dirty(pfn);
9961054 }
997− coherent_cache_guest_page(vcpu, hva & PMD_MASK, PMD_SIZE,
998− fault_ipa_uncached);
1055+ coherent_cache_guest_page(vcpu, pfn, PMD_SIZE, fault_ipa_uncached);
9991056 ret = stage2_set_pmd_huge(kvm, memcache, fault_ipa, &new_pmd);
10001057 } else {
10011058 pte_t new_pte = pfn_pte(pfn, mem_type);
@@ -1003,8 +1060,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, · 1 unmodified line
10031060 kvm_set_s2pte_writable(&new_pte);
10041061 kvm_set_pfn_dirty(pfn);
10051062 }
1006− coherent_cache_guest_page(vcpu, hva, PAGE_SIZE,
1007− fault_ipa_uncached);
1063+ coherent_cache_guest_page(vcpu, pfn, PAGE_SIZE, fault_ipa_uncached);
10081064 ret = stage2_set_pte(kvm, memcache, fault_ipa, &new_pte,
10091065 pgprot_val(mem_type) == pgprot_val(PAGE_S2_DEVICE));
10101066 }
@@ -1411,3 +1467,71 @@ void kvm_arch_flush_shadow_memslot(struct kvm *kvm, · 400 unmodified lines
14111467 unmap_stage2_range(kvm, gpa, size);
14121468 spin_unlock(&kvm->mmu_lock);
14131469 }
1470+
1471+/*
1472+ * See note at ARMv7 ARM B1.14.4 (TL;DR: S/W ops are not easily virtualized).
1473+ *
1474+ * Main problems:
1475+ * - S/W ops are local to a CPU (not broadcast)
1476+ * - We have line migration behind our back (speculation)
1477+ * - System caches don't support S/W at all (damn!)
1478+ *
1479+ * In the face of the above, the best we can do is to try and convert
1480+ * S/W ops to VA ops. Because the guest is not allowed to infer the
1481+ * S/W to PA mapping, it can only use S/W to nuke the whole cache,
1482+ * which is a rather good thing for us.
1483+ *
1484+ * Also, it is only used when turning caches on/off ("The expected
1485+ * usage of the cache maintenance instructions that operate by set/way
1486+ * is associated with the cache maintenance instructions associated
1487+ * with the powerdown and powerup of caches, if this is required by
1488+ * the implementation.").
1489+ *
1490+ * We use the following policy:
1491+ *
1492+ * - If we trap a S/W operation, we enable VM trapping to detect
1493+ * caches being turned on/off, and do a full clean.
1494+ *
1495+ * - We flush the caches on both caches being turned on and off.
1496+ *
1497+ * - Once the caches are enabled, we stop trapping VM ops.
1498+ */
1499+void kvm_set_way_flush(struct kvm_vcpu *vcpu)
1500+{
1501+ unsigned long hcr = vcpu_get_hcr(vcpu);
1502+
1503+ /*
1504+ * If this is the first time we do a S/W operation
1505+ * (i.e. HCR_TVM not set) flush the whole memory, and set the
1506+ * VM trapping.
1507+ *
1508+ * Otherwise, rely on the VM trapping to wait for the MMU +
1509+ * Caches to be turned off. At that point, we'll be able to
1510+ * clean the caches again.
1511+ */
1512+ if (!(hcr & HCR_TVM)) {
1513+ trace_kvm_set_way_flush(*vcpu_pc(vcpu),
1514+ vcpu_has_cache_enabled(vcpu));
1515+ stage2_flush_vm(vcpu->kvm);
1516+ vcpu_set_hcr(vcpu, hcr | HCR_TVM);
1517+ }
1518+}
1519+
1520+void kvm_toggle_cache(struct kvm_vcpu *vcpu, bool was_enabled)
1521+{
1522+ bool now_enabled = vcpu_has_cache_enabled(vcpu);
1523+
1524+ /*
1525+ * If switching the MMU+caches on, need to invalidate the caches.
1526+ * If switching it off, need to clean the caches.
1527+ * Clean + invalidate does the trick always.
1528+ */
1529+ if (now_enabled != was_enabled)
1530+ stage2_flush_vm(vcpu->kvm);
1531+
1532+ /* Caches are now on, stop trapping VM ops (until a S/W op) */
1533+ if (now_enabled)
1534+ vcpu_set_hcr(vcpu, vcpu_get_hcr(vcpu) & ~HCR_TVM);
1535+
1536+ trace_kvm_toggle_cache(*vcpu_pc(vcpu), was_enabled, now_enabled);
1537+}
arch/arm/kvm/trace.h+39−0
@@ -223,6 +223,45 @@ TRACE_EVENT(kvm_hvc, · 222 unmodified lines
223223 __entry->vcpu_pc, __entry->r0, __entry->imm)
224224 );
225225
226+TRACE_EVENT(kvm_set_way_flush,
227+ TP_PROTO(unsigned long vcpu_pc, bool cache),
228+ TP_ARGS(vcpu_pc, cache),
229+
230+ TP_STRUCT__entry(
231+ __field( unsigned long, vcpu_pc )
232+ __field( bool, cache )
233+ ),
234+
235+ TP_fast_assign(
236+ __entry->vcpu_pc = vcpu_pc;
237+ __entry->cache = cache;
238+ ),
239+
240+ TP_printk("S/W flush at 0x%016lx (cache %s)",
241+ __entry->vcpu_pc, __entry->cache ? "on" : "off")
242+);
243+
244+TRACE_EVENT(kvm_toggle_cache,
245+ TP_PROTO(unsigned long vcpu_pc, bool was, bool now),
246+ TP_ARGS(vcpu_pc, was, now),
247+
248+ TP_STRUCT__entry(
249+ __field( unsigned long, vcpu_pc )
250+ __field( bool, was )
251+ __field( bool, now )
252+ ),
253+
254+ TP_fast_assign(
255+ __entry->vcpu_pc = vcpu_pc;
256+ __entry->was = was;
257+ __entry->now = now;
258+ ),
259+
260+ TP_printk("VM op at 0x%016lx (cache was %s, now %s)",
261+ __entry->vcpu_pc, __entry->was ? "on" : "off",
262+ __entry->now ? "on" : "off")
263+);
264+
226265 #endif /* _TRACE_KVM_H */
227266
228267 #undef TRACE_INCLUDE_PATH
arch/arm/mach-mvebu/coherency.c+7−0
@@ -189,6 +189,13 @@ static void __init armada_375_380_coherency_init(struct device_node *np) · 188 unmodified lines
189189 coherency_cpu_base = of_iomap(np, 0);
190190 arch_ioremap_caller = armada_pcie_wa_ioremap_caller;
191191
192+ /*
193+ * We should switch the PL310 to I/O coherency mode only if
194+ * I/O coherency is actually enabled.
195+ */
196+ if (!coherency_available())
197+ return;
198+
192199 /*
193200 * Add the PL310 property "arm,io-coherent". This makes sure the
194201 * outer sync operation is not used, which allows to
arch/arm/mach-shmobile/board-ape6evm.c+20−0
@@ -18,6 +18,8 @@ · 17 unmodified lines
1818 #include <linux/gpio_keys.h>
1919 #include <linux/input.h>
2020 #include <linux/interrupt.h>
21+#include <linux/irqchip.h>
22+#include <linux/irqchip/arm-gic.h>
2123 #include <linux/kernel.h>
2224 #include <linux/mfd/tmio.h>
2325 #include <linux/mmc/host.h>
@@ -273,6 +275,22 @@ static void __init ape6evm_add_standard_devices(void) · 249 unmodified lines
273275 sizeof(ape6evm_leds_pdata));
274276 }
275277
278+static void __init ape6evm_legacy_init_time(void)
279+{
280+ /* Do not invoke DT-based timers via clocksource_of_init() */
281+}
282+
283+static void __init ape6evm_legacy_init_irq(void)
284+{
285+ void __iomem *gic_dist_base = ioremap_nocache(0xf1001000, 0x1000);
286+ void __iomem *gic_cpu_base = ioremap_nocache(0xf1002000, 0x1000);
287+
288+ gic_init(0, 29, gic_dist_base, gic_cpu_base);
289+
290+ /* Do not invoke DT-based interrupt code via irqchip_init() */
291+}
292+
293+
276294 static const char *ape6evm_boards_compat_dt[] __initdata = {
277295 "renesas,ape6evm",
278296 NULL,
@@ -280,7 +298,9 @@ static const char *ape6evm_boards_compat_dt[] __initdata = { · 1 unmodified line
280298
281299 DT_MACHINE_START(APE6EVM_DT, "ape6evm")
282300 .init_early = shmobile_init_delay,
301+ .init_irq = ape6evm_legacy_init_irq,
283302 .init_machine = ape6evm_add_standard_devices,
284303 .init_late = shmobile_init_late,
285304 .dt_compat = ape6evm_boards_compat_dt,
305+ .init_time = ape6evm_legacy_init_time,
286306 MACHINE_END
arch/arm/mach-shmobile/board-lager.c+13−0
@@ -21,6 +21,8 @@ · 20 unmodified lines
2121 #include <linux/input.h>
2222 #include <linux/interrupt.h>
2323 #include <linux/irq.h>
24+#include <linux/irqchip.h>
25+#include <linux/irqchip/arm-gic.h>
2426 #include <linux/kernel.h>
2527 #include <linux/leds.h>
2628 #include <linux/mfd/tmio.h>
@@ -811,6 +813,16 @@ static void __init lager_init(void) · 784 unmodified lines
811813 lager_ksz8041_fixup);
812814 }
813815
816+static void __init lager_legacy_init_irq(void)
817+{
818+ void __iomem *gic_dist_base = ioremap_nocache(0xf1001000, 0x1000);
819+ void __iomem *gic_cpu_base = ioremap_nocache(0xf1002000, 0x1000);
820+
821+ gic_init(0, 29, gic_dist_base, gic_cpu_base);
822+
823+ /* Do not invoke DT-based interrupt code via irqchip_init() */
824+}
825+
814826 static const char * const lager_boards_compat_dt[] __initconst = {
815827 "renesas,lager",
816828 NULL,
@@ -819,6 +831,7 @@ static const char * const lager_boards_compat_dt[] __initconst = { · 2 unmodified lines
819831 DT_MACHINE_START(LAGER_DT, "lager")
820832 .smp = smp_ops(r8a7790_smp_ops),
821833 .init_early = shmobile_init_delay,
834+ .init_irq = lager_legacy_init_irq,
822835 .init_time = rcar_gen2_timer_init,
823836 .init_machine = lager_init,
824837 .init_late = shmobile_init_late,
arch/arm/mach-shmobile/setup-rcar-gen2.c+2−0
@@ -133,7 +133,9 @@ void __init rcar_gen2_timer_init(void) · 132 unmodified lines
133133 #ifdef CONFIG_COMMON_CLK
134134 rcar_gen2_clocks_init(mode);
135135 #endif
136+#ifdef CONFIG_ARCH_SHMOBILE_MULTI
136137 clocksource_of_init();
138+#endif
137139 }
138140
139141 struct memory_reserve_config {
arch/arm/mach-shmobile/timer.c+12−0
@@ -70,6 +70,18 @@ void __init shmobile_init_delay(void) · 69 unmodified lines
7070 if (!max_freq)
7171 return;
7272
73+#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
74+ /* Non-multiplatform r8a73a4 SoC cannot use arch timer due
75+ * to GIC being initialized from C and arch timer via DT */
76+ if (of_machine_is_compatible("renesas,r8a73a4"))
77+ has_arch_timer = false;
78+
79+ /* Non-multiplatform r8a7790 SoC cannot use arch timer due
80+ * to GIC being initialized from C and arch timer via DT */
81+ if (of_machine_is_compatible("renesas,r8a7790"))
82+ has_arch_timer = false;
83+#endif
84+
7385 if (!has_arch_timer || !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) {
7486 if (is_a7_a8_a9)
7587 shmobile_setup_delay_hz(max_freq, 1, 3);
arch/arm/mm/dma-mapping.c+38−15
@@ -1940,13 +1940,32 @@ void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping) · 1939 unmodified lines
19401940 }
19411941 EXPORT_SYMBOL_GPL(arm_iommu_release_mapping);
19421942
1943+static int __arm_iommu_attach_device(struct device *dev,
1944+ struct dma_iommu_mapping *mapping)
1945+{
1946+ int err;
1947+
1948+ err = iommu_attach_device(mapping->domain, dev);
1949+ if (err)
1950+ return err;
1951+
1952+ kref_get(&mapping->kref);
1953+ dev->archdata.mapping = mapping;
1954+
1955+ pr_debug("Attached IOMMU controller to %s device.\n", dev_name(dev));
1956+ return 0;
1957+}
1958+
19431959 /**
19441960 * arm_iommu_attach_device
19451961 * @dev: valid struct device pointer
19461962 * @mapping: io address space mapping structure (returned from
19471963 * arm_iommu_create_mapping)
19481964 *
1949− * Attaches specified io address space mapping to the provided device,
1965+ * Attaches specified io address space mapping to the provided device.
1966+ * This replaces the dma operations (dma_map_ops pointer) with the
1967+ * IOMMU aware version.
1968+ *
19501969 * More than one client might be attached to the same io address space
19511970 * mapping.
19521971 */
@@ -1955,25 +1974,16 @@ int arm_iommu_attach_device(struct device *dev, · 2 unmodified lines
19551974 {
19561975 int err;
19571976
1958− err = iommu_attach_device(mapping->domain, dev);
1977+ err = __arm_iommu_attach_device(dev, mapping);
19591978 if (err)
19601979 return err;
19611980
1962− kref_get(&mapping->kref);
1963− dev->archdata.mapping = mapping;
1964−
1965− pr_debug("Attached IOMMU controller to %s device.\n", dev_name(dev));
1981+ set_dma_ops(dev, &iommu_ops);
19661982 return 0;
19671983 }
19681984 EXPORT_SYMBOL_GPL(arm_iommu_attach_device);
19691985
1970−/**
1971− * arm_iommu_detach_device
1972− * @dev: valid struct device pointer
1973− *
1974− * Detaches the provided device from a previously attached map.
1975− */
1976−void arm_iommu_detach_device(struct device *dev)
1986+static void __arm_iommu_detach_device(struct device *dev)
19771987 {
19781988 struct dma_iommu_mapping *mapping;
19791989
@@ -1989,6 +1999,19 @@ void arm_iommu_detach_device(struct device *dev) · 9 unmodified lines
19891999
19902000 pr_debug("Detached IOMMU controller from %s device.\n", dev_name(dev));
19912001 }
2002+
2003+/**
2004+ * arm_iommu_detach_device
2005+ * @dev: valid struct device pointer
2006+ *
2007+ * Detaches the provided device from a previously attached map.
2008+ * This voids the dma operations (dma_map_ops pointer)
2009+ */
2010+void arm_iommu_detach_device(struct device *dev)
2011+{
2012+ __arm_iommu_detach_device(dev);
2013+ set_dma_ops(dev, NULL);
2014+}
19922015 EXPORT_SYMBOL_GPL(arm_iommu_detach_device);
19932016
19942017 static struct dma_map_ops *arm_get_iommu_dma_map_ops(bool coherent)
@@ -2011,7 +2034,7 @@ static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size, · 16 unmodified lines
20112034 return false;
20122035 }
20132036
2014− if (arm_iommu_attach_device(dev, mapping)) {
2037+ if (__arm_iommu_attach_device(dev, mapping)) {
20152038 pr_warn("Failed to attached device %s to IOMMU_mapping\n",
20162039 dev_name(dev));
20172040 arm_iommu_release_mapping(mapping);
@@ -2025,7 +2048,7 @@ static void arm_teardown_iommu_dma_ops(struct device *dev) · 7 unmodified lines
20252048 {
20262049 struct dma_iommu_mapping *mapping = dev->archdata.mapping;
20272050
2028− arm_iommu_detach_device(dev);
2051+ __arm_iommu_detach_device(dev);
20292052 arm_iommu_release_mapping(mapping);
20302053 }
20312054
arch/arm64/include/asm/kvm_emulate.h+10−0
@@ -45,6 +45,16 @@ static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu) · 44 unmodified lines
4545 vcpu->arch.hcr_el2 &= ~HCR_RW;
4646 }
4747
48+static inline unsigned long vcpu_get_hcr(struct kvm_vcpu *vcpu)
49+{
50+ return vcpu->arch.hcr_el2;
51+}
52+
53+static inline void vcpu_set_hcr(struct kvm_vcpu *vcpu, unsigned long hcr)
54+{
55+ vcpu->arch.hcr_el2 = hcr;
56+}
57+
4858 static inline unsigned long *vcpu_pc(const struct kvm_vcpu *vcpu)
4959 {
5060 return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.pc;
arch/arm64/include/asm/kvm_host.h+0−3
@@ -116,9 +116,6 @@ struct kvm_vcpu_arch { · 115 unmodified lines
116116 * Anything that is not used directly from assembly code goes
117117 * here.
118118 */
119− /* dcache set/way operation pending */
120− int last_pcpu;
121− cpumask_t require_dcache_flush;
122119
123120 /* Don't run the guest */
124121 bool pause;
arch/arm64/include/asm/kvm_mmu.h+28−6
@@ -243,24 +243,46 @@ static inline bool vcpu_has_cache_enabled(struct kvm_vcpu *vcpu) · 242 unmodified lines
243243 return (vcpu_sys_reg(vcpu, SCTLR_EL1) & 0b101) == 0b101;
244244 }
245245
246−static inline void coherent_cache_guest_page(struct kvm_vcpu *vcpu, hva_t hva,
247− unsigned long size,
248− bool ipa_uncached)
246+static inline void __coherent_cache_guest_page(struct kvm_vcpu *vcpu, pfn_t pfn,
247+ unsigned long size,
248+ bool ipa_uncached)
249249 {
250+ void *va = page_address(pfn_to_page(pfn));
251+
250252 if (!vcpu_has_cache_enabled(vcpu) || ipa_uncached)
251− kvm_flush_dcache_to_poc((void *)hva, size);
253+ kvm_flush_dcache_to_poc(va, size);
252254
253255 if (!icache_is_aliasing()) { /* PIPT */
254− flush_icache_range(hva, hva + size);
256+ flush_icache_range((unsigned long)va,
257+ (unsigned long)va + size);
255258 } else if (!icache_is_aivivt()) { /* non ASID-tagged VIVT */
256259 /* any kind of VIPT cache */
257260 __flush_icache_all();
258261 }
259262 }
260263
264+static inline void __kvm_flush_dcache_pte(pte_t pte)
265+{
266+ struct page *page = pte_page(pte);
267+ kvm_flush_dcache_to_poc(page_address(page), PAGE_SIZE);
268+}
269+
270+static inline void __kvm_flush_dcache_pmd(pmd_t pmd)
271+{
272+ struct page *page = pmd_page(pmd);
273+ kvm_flush_dcache_to_poc(page_address(page), PMD_SIZE);
274+}
275+
276+static inline void __kvm_flush_dcache_pud(pud_t pud)
277+{
278+ struct page *page = pud_page(pud);
279+ kvm_flush_dcache_to_poc(page_address(page), PUD_SIZE);
280+}
281+
261282 #define kvm_virt_to_phys(x) __virt_to_phys((unsigned long)(x))
262283
263−void stage2_flush_vm(struct kvm *kvm);
284+void kvm_set_way_flush(struct kvm_vcpu *vcpu);
285+void kvm_toggle_cache(struct kvm_vcpu *vcpu, bool was_enabled);
264286
265287 #endif /* __ASSEMBLY__ */
266288 #endif /* __ARM64_KVM_MMU_H__ */
arch/arm64/kvm/sys_regs.c+10−65
@@ -69,68 +69,31 @@ static u32 get_ccsidr(u32 csselr) · 68 unmodified lines
6969 return ccsidr;
7070 }
7171
72−static void do_dc_cisw(u32 val)
73−{
74− asm volatile("dc cisw, %x0" : : "r" (val));
75− dsb(ish);
76−}
77−
78−static void do_dc_csw(u32 val)
79−{
80− asm volatile("dc csw, %x0" : : "r" (val));
81− dsb(ish);
82−}
83−
84−/* See note at ARM ARM B1.14.4 */
72+/*
73+ * See note at ARMv7 ARM B1.14.4 (TL;DR: S/W ops are not easily virtualized).
74+ */
8575 static bool access_dcsw(struct kvm_vcpu *vcpu,
8676 const struct sys_reg_params *p,
8777 const struct sys_reg_desc *r)
8878 {
89− unsigned long val;
90− int cpu;
91−
9279 if (!p->is_write)
9380 return read_from_write_only(vcpu, p);
9481
95− cpu = get_cpu();
96−
97− cpumask_setall(&vcpu->arch.require_dcache_flush);
98− cpumask_clear_cpu(cpu, &vcpu->arch.require_dcache_flush);
99−
100− /* If we were already preempted, take the long way around */
101− if (cpu != vcpu->arch.last_pcpu) {
102− flush_cache_all();
103− goto done;
104− }
105−
106− val = *vcpu_reg(vcpu, p->Rt);
107−
108− switch (p->CRm) {
109− case 6: /* Upgrade DCISW to DCCISW, as per HCR.SWIO */
110− case 14: /* DCCISW */
111− do_dc_cisw(val);
112− break;
113−
114− case 10: /* DCCSW */
115− do_dc_csw(val);
116− break;
117− }
118−
119−done:
120− put_cpu();
121−
82+ kvm_set_way_flush(vcpu);
12283 return true;
12384 }
12485
12586 /*
12687 * Generic accessor for VM registers. Only called as long as HCR_TVM
127− * is set.
88+ * is set. If the guest enables the MMU, we stop trapping the VM
89+ * sys_regs and leave it in complete control of the caches.
12890 */
12991 static bool access_vm_reg(struct kvm_vcpu *vcpu,
13092 const struct sys_reg_params *p,
13193 const struct sys_reg_desc *r)
13294 {
13395 unsigned long val;
96+ bool was_enabled = vcpu_has_cache_enabled(vcpu);
13497
13598 BUG_ON(!p->is_write);
13699
@@ -143,25 +106,7 @@ static bool access_vm_reg(struct kvm_vcpu *vcpu, · 6 unmodified lines
143106 vcpu_cp15_64_low(vcpu, r->reg) = val & 0xffffffffUL;
144107 }
145108
146− return true;
147−}
148−
149−/*
150− * SCTLR_EL1 accessor. Only called as long as HCR_TVM is set. If the
151− * guest enables the MMU, we stop trapping the VM sys_regs and leave
152− * it in complete control of the caches.
153− */
154−static bool access_sctlr(struct kvm_vcpu *vcpu,
155− const struct sys_reg_params *p,
156− const struct sys_reg_desc *r)
157−{
158− access_vm_reg(vcpu, p, r);
159−
160− if (vcpu_has_cache_enabled(vcpu)) { /* MMU+Caches enabled? */
161− vcpu->arch.hcr_el2 &= ~HCR_TVM;
162− stage2_flush_vm(vcpu->kvm);
163− }
164−
109+ kvm_toggle_cache(vcpu, was_enabled);
165110 return true;
166111 }
167112
@@ -377,7 +322,7 @@ static const struct sys_reg_desc sys_reg_descs[] = { · 209 unmodified lines
377322 NULL, reset_mpidr, MPIDR_EL1 },
378323 /* SCTLR_EL1 */
379324 { Op0(0b11), Op1(0b000), CRn(0b0001), CRm(0b0000), Op2(0b000),
380− access_sctlr, reset_val, SCTLR_EL1, 0x00C50078 },
325+ access_vm_reg, reset_val, SCTLR_EL1, 0x00C50078 },
381326 /* CPACR_EL1 */
382327 { Op0(0b11), Op1(0b000), CRn(0b0001), CRm(0b0000), Op2(0b010),
383328 NULL, reset_val, CPACR_EL1, 0 },
@@ -657,7 +602,7 @@ static const struct sys_reg_desc cp14_64_regs[] = { · 273 unmodified lines
657602 * register).
658603 */
659604 static const struct sys_reg_desc cp15_regs[] = {
660− { Op1( 0), CRn( 1), CRm( 0), Op2( 0), access_sctlr, NULL, c1_SCTLR },
605+ { Op1( 0), CRn( 1), CRm( 0), Op2( 0), access_vm_reg, NULL, c1_SCTLR },
661606 { Op1( 0), CRn( 2), CRm( 0), Op2( 0), access_vm_reg, NULL, c2_TTBR0 },
662607 { Op1( 0), CRn( 2), CRm( 0), Op2( 1), access_vm_reg, NULL, c2_TTBR1 },
663608 { Op1( 0), CRn( 2), CRm( 0), Op2( 2), access_vm_reg, NULL, c2_TTBCR },
arch/avr32/mm/fault.c+2−0
@@ -142,6 +142,8 @@ good_area: · 141 unmodified lines
142142 if (unlikely(fault & VM_FAULT_ERROR)) {
143143 if (fault & VM_FAULT_OOM)
144144 goto out_of_memory;
145+ else if (fault & VM_FAULT_SIGSEGV)
146+ goto bad_area;
145147 else if (fault & VM_FAULT_SIGBUS)
146148 goto do_sigbus;
147149 BUG();
arch/cris/mm/fault.c+2−0
@@ -176,6 +176,8 @@ retry: · 175 unmodified lines
176176 if (unlikely(fault & VM_FAULT_ERROR)) {
177177 if (fault & VM_FAULT_OOM)
178178 goto out_of_memory;
179+ else if (fault & VM_FAULT_SIGSEGV)
180+ goto bad_area;
179181 else if (fault & VM_FAULT_SIGBUS)
180182 goto do_sigbus;
181183 BUG();
arch/frv/mm/fault.c+2−0
@@ -168,6 +168,8 @@ asmlinkage void do_page_fault(int datammu, unsigned long esr0, unsigned long ear · 167 unmodified lines
168168 if (unlikely(fault & VM_FAULT_ERROR)) {
169169 if (fault & VM_FAULT_OOM)
170170 goto out_of_memory;
171+ else if (fault & VM_FAULT_SIGSEGV)
172+ goto bad_area;
171173 else if (fault & VM_FAULT_SIGBUS)
172174 goto do_sigbus;
173175 BUG();
arch/ia64/mm/fault.c+2−0
@@ -172,6 +172,8 @@ retry: · 171 unmodified lines
172172 */
173173 if (fault & VM_FAULT_OOM) {
174174 goto out_of_memory;
175+ } else if (fault & VM_FAULT_SIGSEGV) {
176+ goto bad_area;
175177 } else if (fault & VM_FAULT_SIGBUS) {
176178 signal = SIGBUS;
177179 goto bad_area;
arch/m32r/mm/fault.c+2−0
@@ -200,6 +200,8 @@ good_area: · 199 unmodified lines
200200 if (unlikely(fault & VM_FAULT_ERROR)) {
201201 if (fault & VM_FAULT_OOM)
202202 goto out_of_memory;
203+ else if (fault & VM_FAULT_SIGSEGV)
204+ goto bad_area;
203205 else if (fault & VM_FAULT_SIGBUS)
204206 goto do_sigbus;
205207 BUG();
arch/m68k/mm/fault.c+2−0
@@ -145,6 +145,8 @@ good_area: · 144 unmodified lines
145145 if (unlikely(fault & VM_FAULT_ERROR)) {
146146 if (fault & VM_FAULT_OOM)
147147 goto out_of_memory;
148+ else if (fault & VM_FAULT_SIGSEGV)
149+ goto map_err;
148150 else if (fault & VM_FAULT_SIGBUS)
149151 goto bus_err;
150152 BUG();
arch/metag/mm/fault.c+2−0
@@ -141,6 +141,8 @@ good_area: · 140 unmodified lines
141141 if (unlikely(fault & VM_FAULT_ERROR)) {
142142 if (fault & VM_FAULT_OOM)
143143 goto out_of_memory;
144+ else if (fault & VM_FAULT_SIGSEGV)
145+ goto bad_area;
144146 else if (fault & VM_FAULT_SIGBUS)
145147 goto do_sigbus;
146148 BUG();
arch/microblaze/mm/fault.c+2−0
@@ -224,6 +224,8 @@ good_area: · 223 unmodified lines
224224 if (unlikely(fault & VM_FAULT_ERROR)) {
225225 if (fault & VM_FAULT_OOM)
226226 goto out_of_memory;
227+ else if (fault & VM_FAULT_SIGSEGV)
228+ goto bad_area;
227229 else if (fault & VM_FAULT_SIGBUS)
228230 goto do_sigbus;
229231 BUG();
arch/mips/mm/fault.c+2−0
@@ -158,6 +158,8 @@ good_area: · 157 unmodified lines
158158 if (unlikely(fault & VM_FAULT_ERROR)) {
159159 if (fault & VM_FAULT_OOM)
160160 goto out_of_memory;
161+ else if (fault & VM_FAULT_SIGSEGV)
162+ goto bad_area;
161163 else if (fault & VM_FAULT_SIGBUS)
162164 goto do_sigbus;
163165 BUG();
arch/mn10300/mm/fault.c+2−0
@@ -262,6 +262,8 @@ good_area: · 261 unmodified lines
262262 if (unlikely(fault & VM_FAULT_ERROR)) {
263263 if (fault & VM_FAULT_OOM)
264264 goto out_of_memory;
265+ else if (fault & VM_FAULT_SIGSEGV)
266+ goto bad_area;
265267 else if (fault & VM_FAULT_SIGBUS)
266268 goto do_sigbus;
267269 BUG();
arch/nios2/mm/fault.c+2−0
@@ -135,6 +135,8 @@ survive: · 134 unmodified lines
135135 if (unlikely(fault & VM_FAULT_ERROR)) {
136136 if (fault & VM_FAULT_OOM)
137137 goto out_of_memory;
138+ else if (fault & VM_FAULT_SIGSEGV)
139+ goto bad_area;
138140 else if (fault & VM_FAULT_SIGBUS)
139141 goto do_sigbus;
140142 BUG();
arch/openrisc/mm/fault.c+2−0
@@ -171,6 +171,8 @@ good_area: · 170 unmodified lines
171171 if (unlikely(fault & VM_FAULT_ERROR)) {
172172 if (fault & VM_FAULT_OOM)
173173 goto out_of_memory;
174+ else if (fault & VM_FAULT_SIGSEGV)
175+ goto bad_area;
174176 else if (fault & VM_FAULT_SIGBUS)
175177 goto do_sigbus;
176178 BUG();
arch/parisc/mm/fault.c+2−0
@@ -256,6 +256,8 @@ good_area: · 255 unmodified lines
256256 */
257257 if (fault & VM_FAULT_OOM)
258258 goto out_of_memory;
259+ else if (fault & VM_FAULT_SIGSEGV)
260+ goto bad_area;
259261 else if (fault & VM_FAULT_SIGBUS)
260262 goto bad_area;
261263 BUG();
arch/powerpc/mm/copro_fault.c+1−1
@@ -76,7 +76,7 @@ int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea, · 75 unmodified lines
7676 if (*flt & VM_FAULT_OOM) {
7777 ret = -ENOMEM;
7878 goto out_unlock;
79− } else if (*flt & VM_FAULT_SIGBUS) {
79+ } else if (*flt & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV)) {
8080 ret = -EFAULT;
8181 goto out_unlock;
8282 }
arch/powerpc/mm/fault.c+2−0
@@ -437,6 +437,8 @@ good_area: · 436 unmodified lines
437437 */
438438 fault = handle_mm_fault(mm, vma, address, flags);
439439 if (unlikely(fault & (VM_FAULT_RETRY|VM_FAULT_ERROR))) {
440+ if (fault & VM_FAULT_SIGSEGV)
441+ goto bad_area;
440442 rc = mm_fault_error(regs, address, fault);
441443 if (rc >= MM_FAULT_RETURN)
442444 goto bail;
arch/powerpc/platforms/powernv/setup.c+1−1
@@ -304,7 +304,7 @@ int pnv_save_sprs_for_winkle(void) · 303 unmodified lines
304304 * all cpus at boot. Get these reg values of current cpu and use the
305305 * same accross all cpus.
306306 */
307− uint64_t lpcr_val = mfspr(SPRN_LPCR);
307+ uint64_t lpcr_val = mfspr(SPRN_LPCR) & ~(u64)LPCR_PECE1;
308308 uint64_t hid0_val = mfspr(SPRN_HID0);
309309 uint64_t hid1_val = mfspr(SPRN_HID1);
310310 uint64_t hid4_val = mfspr(SPRN_HID4);
arch/powerpc/xmon/xmon.c+1−0
@@ -337,6 +337,7 @@ static inline void disable_surveillance(void) · 336 unmodified lines
337337 args.token = rtas_token("set-indicator");
338338 if (args.token == RTAS_UNKNOWN_SERVICE)
339339 return;
340+ args.token = cpu_to_be32(args.token);
340341 args.nargs = cpu_to_be32(3);
341342 args.nret = cpu_to_be32(1);
342343 args.rets = &args.args[3];
arch/s390/mm/fault.c+6−0
@@ -374,6 +374,12 @@ static noinline void do_fault_error(struct pt_regs *regs, int fault) · 373 unmodified lines
374374 do_no_context(regs);
375375 else
376376 pagefault_out_of_memory();
377+ } else if (fault & VM_FAULT_SIGSEGV) {
378+ /* Kernel mode? Handle exceptions or die */
379+ if (!user_mode(regs))
380+ do_no_context(regs);
381+ else
382+ do_sigsegv(regs, SEGV_MAPERR);
377383 } else if (fault & VM_FAULT_SIGBUS) {
378384 /* Kernel mode? Handle exceptions or die */
379385 if (!user_mode(regs))
arch/score/mm/fault.c+2−0
@@ -114,6 +114,8 @@ good_area: · 113 unmodified lines
114114 if (unlikely(fault & VM_FAULT_ERROR)) {
115115 if (fault & VM_FAULT_OOM)
116116 goto out_of_memory;
117+ else if (fault & VM_FAULT_SIGSEGV)
118+ goto bad_area;
117119 else if (fault & VM_FAULT_SIGBUS)
118120 goto do_sigbus;
119121 BUG();
arch/sh/mm/fault.c+2−0
@@ -353,6 +353,8 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code, · 352 unmodified lines
353353 } else {
354354 if (fault & VM_FAULT_SIGBUS)
355355 do_sigbus(regs, error_code, address);
356+ else if (fault & VM_FAULT_SIGSEGV)
357+ bad_area(regs, error_code, address);
356358 else
357359 BUG();
358360 }
arch/sparc/mm/fault_32.c+2−0
@@ -249,6 +249,8 @@ good_area: · 248 unmodified lines
249249 if (unlikely(fault & VM_FAULT_ERROR)) {
250250 if (fault & VM_FAULT_OOM)
251251 goto out_of_memory;
252+ else if (fault & VM_FAULT_SIGSEGV)
253+ goto bad_area;
252254 else if (fault & VM_FAULT_SIGBUS)
253255 goto do_sigbus;
254256 BUG();
arch/sparc/mm/fault_64.c+2−0
@@ -446,6 +446,8 @@ good_area: · 445 unmodified lines
446446 if (unlikely(fault & VM_FAULT_ERROR)) {
447447 if (fault & VM_FAULT_OOM)
448448 goto out_of_memory;
449+ else if (fault & VM_FAULT_SIGSEGV)
450+ goto bad_area;
449451 else if (fault & VM_FAULT_SIGBUS)
450452 goto do_sigbus;
451453 BUG();
arch/tile/mm/fault.c+2−0
@@ -442,6 +442,8 @@ good_area: · 441 unmodified lines
442442 if (unlikely(fault & VM_FAULT_ERROR)) {
443443 if (fault & VM_FAULT_OOM)
444444 goto out_of_memory;
445+ else if (fault & VM_FAULT_SIGSEGV)
446+ goto bad_area;
445447 else if (fault & VM_FAULT_SIGBUS)
446448 goto do_sigbus;
447449 BUG();
arch/um/kernel/trap.c+2−0
@@ -80,6 +80,8 @@ good_area: · 79 unmodified lines
8080 if (unlikely(fault & VM_FAULT_ERROR)) {
8181 if (fault & VM_FAULT_OOM) {
8282 goto out_of_memory;
83+ } else if (fault & VM_FAULT_SIGSEGV) {
84+ goto out;
8385 } else if (fault & VM_FAULT_SIGBUS) {
8486 err = -EACCES;
8587 goto out;
arch/x86/boot/compressed/Makefile+1−1
@@ -90,7 +90,7 @@ suffix-$(CONFIG_KERNEL_LZO) := lzo · 89 unmodified lines
9090 suffix-$(CONFIG_KERNEL_LZ4) := lz4
9191
9292 RUN_SIZE = $(shell $(OBJDUMP) -h vmlinux | \
93− perl $(srctree)/arch/x86/tools/calc_run_size.pl)
93+ $(CONFIG_SHELL) $(srctree)/arch/x86/tools/calc_run_size.sh)
9494 quiet_cmd_mkpiggy = MKPIGGY $@
9595 cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false )
9696
arch/x86/kernel/cpu/perf_event_intel.c+1−0
@@ -2431,6 +2431,7 @@ __init int intel_pmu_init(void) · 2430 unmodified lines
24312431 break;
24322432
24332433 case 55: /* 22nm Atom "Silvermont" */
2434+ case 76: /* 14nm Atom "Airmont" */
24342435 case 77: /* 22nm Atom "Silvermont Avoton/Rangely" */
24352436 memcpy(hw_cache_event_ids, slm_hw_cache_event_ids,
24362437 sizeof(hw_cache_event_ids));
arch/x86/kernel/cpu/perf_event_intel_rapl.c+1−1
@@ -142,7 +142,7 @@ static inline u64 rapl_scale(u64 v) · 141 unmodified lines
142142 * or use ldexp(count, -32).
143143 * Watts = Joules/Time delta
144144 */
145− return v << (32 - __this_cpu_read(rapl_pmu->hw_unit));
145+ return v << (32 - __this_cpu_read(rapl_pmu)->hw_unit);
146146 }
147147
148148 static u64 rapl_event_update(struct perf_event *event)
arch/x86/kernel/cpu/perf_event_intel_uncore.c+2−7
@@ -840,7 +840,6 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id · 839 unmodified lines
840840 box->phys_id = phys_id;
841841 box->pci_dev = pdev;
842842 box->pmu = pmu;
843− uncore_box_init(box);
844843 pci_set_drvdata(pdev, box);
845844
846845 raw_spin_lock(&uncore_box_lock);
@@ -1004,10 +1003,8 @@ static int uncore_cpu_starting(int cpu) · 157 unmodified lines
10041003 pmu = &type->pmus[j];
10051004 box = *per_cpu_ptr(pmu->box, cpu);
10061005 /* called by uncore_cpu_init? */
1007− if (box && box->phys_id >= 0) {
1008− uncore_box_init(box);
1006+ if (box && box->phys_id >= 0)
10091007 continue;
1010− }
10111008
10121009 for_each_online_cpu(k) {
10131010 exist = *per_cpu_ptr(pmu->box, k);
@@ -1023,10 +1020,8 @@ static int uncore_cpu_starting(int cpu) · 9 unmodified lines
10231020 }
10241021 }
10251022
1026− if (box) {
1023+ if (box)
10271024 box->phys_id = phys_id;
1028− uncore_box_init(box);
1029− }
10301025 }
10311026 }
10321027 return 0;
arch/x86/kernel/cpu/perf_event_intel_uncore.h+10−8
@@ -257,6 +257,14 @@ static inline int uncore_num_counters(struct intel_uncore_box *box) · 256 unmodified lines
257257 return box->pmu->type->num_counters;
258258 }
259259
260+static inline void uncore_box_init(struct intel_uncore_box *box)
261+{
262+ if (!test_and_set_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) {
263+ if (box->pmu->type->ops->init_box)
264+ box->pmu->type->ops->init_box(box);
265+ }
266+}
267+
260268 static inline void uncore_disable_box(struct intel_uncore_box *box)
261269 {
262270 if (box->pmu->type->ops->disable_box)
@@ -265,6 +273,8 @@ static inline void uncore_disable_box(struct intel_uncore_box *box) · 2 unmodified lines
265273
266274 static inline void uncore_enable_box(struct intel_uncore_box *box)
267275 {
276+ uncore_box_init(box);
277+
268278 if (box->pmu->type->ops->enable_box)
269279 box->pmu->type->ops->enable_box(box);
270280 }
@@ -287,14 +297,6 @@ static inline u64 uncore_read_counter(struct intel_uncore_box *box, · 16 unmodified lines
287297 return box->pmu->type->ops->read_counter(box, event);
288298 }
289299
290−static inline void uncore_box_init(struct intel_uncore_box *box)
291−{
292− if (!test_and_set_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) {
293− if (box->pmu->type->ops->init_box)
294− box->pmu->type->ops->init_box(box);
295− }
296−}
297−
298300 static inline bool uncore_box_is_fake(struct intel_uncore_box *box)
299301 {
300302 return (box->phys_id < 0);
arch/x86/kvm/lapic.c+3−0
@@ -192,6 +192,9 @@ static void recalculate_apic_map(struct kvm *kvm) · 191 unmodified lines
192192 u16 cid, lid;
193193 u32 ldr, aid;
194194
195+ if (!kvm_apic_present(vcpu))
196+ continue;
197+
195198 aid = kvm_apic_id(apic);
196199 ldr = kvm_apic_get_reg(apic, APIC_LDR);
197200 cid = apic_cluster_id(new, ldr);
arch/x86/mm/fault.c+2−0
@@ -898,6 +898,8 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code, · 897 unmodified lines
898898 if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|
899899 VM_FAULT_HWPOISON_LARGE))
900900 do_sigbus(regs, error_code, address, fault);
901+ else if (fault & VM_FAULT_SIGSEGV)
902+ bad_area_nosemaphore(regs, error_code, address);
901903 else
902904 BUG();
903905 }
arch/x86/tools/calc_run_size.pl+0−39
@@ -1,39 +0,0 @@
1−#!/usr/bin/perl
2−#
3−# Calculate the amount of space needed to run the kernel, including room for
4−# the .bss and .brk sections.
5−#
6−# Usage:
7−# objdump -h a.out | perl calc_run_size.pl
8−use strict;
9−
10−my $mem_size = 0;
11−my $file_offset = 0;
12−
13−my $sections=" *[0-9]+ \.(?:bss|brk) +";
14−while (<>) {
15− if (/^$sections([0-9a-f]+) +(?:[0-9a-f]+ +){2}([0-9a-f]+)/) {
16− my $size = hex($1);
17− my $offset = hex($2);
18− $mem_size += $size;
19− if ($file_offset == 0) {
20− $file_offset = $offset;
21− } elsif ($file_offset != $offset) {
22− # BFD linker shows the same file offset in ELF.
23− # Gold linker shows them as consecutive.
24− next if ($file_offset + $mem_size == $offset + $size);
25−
26− printf STDERR "file_offset: 0x%lx\n", $file_offset;
27− printf STDERR "mem_size: 0x%lx\n", $mem_size;
28− printf STDERR "offset: 0x%lx\n", $offset;
29− printf STDERR "size: 0x%lx\n", $size;
30−
31− die ".bss and .brk are non-contiguous\n";
32− }
33− }
34−}
35−
36−if ($file_offset == 0) {
37− die "Never found .bss or .brk file offset\n";
38−}
39−printf("%d\n", $mem_size + $file_offset);
arch/x86/tools/calc_run_size.sh+42−0
@@ -0,0 +1,42 @@
1+#!/bin/sh
2+#
3+# Calculate the amount of space needed to run the kernel, including room for
4+# the .bss and .brk sections.
5+#
6+# Usage:
7+# objdump -h a.out | sh calc_run_size.sh
8+
9+NUM='\([0-9a-fA-F]*[ \t]*\)'
10+OUT=$(sed -n 's/^[ \t0-9]*.b[sr][sk][ \t]*'"$NUM$NUM$NUM$NUM"'.*/\1\4/p')
11+if [ -z "$OUT" ] ; then
12+ echo "Never found .bss or .brk file offset" >&2
13+ exit 1
14+fi
15+
16+OUT=$(echo ${OUT# })
17+sizeA=$(printf "%d" 0x${OUT%% *})
18+OUT=${OUT#* }
19+offsetA=$(printf "%d" 0x${OUT%% *})
20+OUT=${OUT#* }
21+sizeB=$(printf "%d" 0x${OUT%% *})
22+OUT=${OUT#* }
23+offsetB=$(printf "%d" 0x${OUT%% *})
24+
25+run_size=$(( $offsetA + $sizeA + $sizeB ))
26+
27+# BFD linker shows the same file offset in ELF.
28+if [ "$offsetA" -ne "$offsetB" ] ; then
29+ # Gold linker shows them as consecutive.
30+ endB=$(( $offsetB + $sizeB ))
31+ if [ "$endB" != "$run_size" ] ; then
32+ printf "sizeA: 0x%x\n" $sizeA >&2
33+ printf "offsetA: 0x%x\n" $offsetA >&2
34+ printf "sizeB: 0x%x\n" $sizeB >&2
35+ printf "offsetB: 0x%x\n" $offsetB >&2
36+ echo ".bss and .brk are non-contiguous" >&2
37+ exit 1
38+ fi
39+fi
40+
41+printf "%d\n" $run_size
42+exit 0
arch/xtensa/mm/fault.c+2−0
@@ -117,6 +117,8 @@ good_area: · 116 unmodified lines
117117 if (unlikely(fault & VM_FAULT_ERROR)) {
118118 if (fault & VM_FAULT_OOM)
119119 goto out_of_memory;
120+ else if (fault & VM_FAULT_SIGSEGV)
121+ goto bad_area;
120122 else if (fault & VM_FAULT_SIGBUS)
121123 goto do_sigbus;
122124 BUG();
drivers/Kconfig+0−2
@@ -134,8 +134,6 @@ source "drivers/staging/Kconfig" · 133 unmodified lines
134134
135135 source "drivers/platform/Kconfig"
136136
137−source "drivers/soc/Kconfig"
138−
139137 source "drivers/clk/Kconfig"
140138
141139 source "drivers/hwspinlock/Kconfig"
drivers/block/rbd.c+7−18
@@ -2098,32 +2098,26 @@ static void rbd_dev_parent_put(struct rbd_device *rbd_dev) · 2097 unmodified lines
20982098 * If an image has a non-zero parent overlap, get a reference to its
20992099 * parent.
21002100 *
2101− * We must get the reference before checking for the overlap to
2102− * coordinate properly with zeroing the parent overlap in
2103− * rbd_dev_v2_parent_info() when an image gets flattened. We
2104− * drop it again if there is no overlap.
2105− *
21062101 * Returns true if the rbd device has a parent with a non-zero
21072102 * overlap and a reference for it was successfully taken, or
21082103 * false otherwise.
21092104 */
21102105 static bool rbd_dev_parent_get(struct rbd_device *rbd_dev)
21112106 {
2112− int counter;
2107+ int counter = 0;
21132108
21142109 if (!rbd_dev->parent_spec)
21152110 return false;
21162111
2117− counter = atomic_inc_return_safe(&rbd_dev->parent_ref);
2118− if (counter > 0 && rbd_dev->parent_overlap)
2119− return true;
2120−
2121− /* Image was flattened, but parent is not yet torn down */
2112+ down_read(&rbd_dev->header_rwsem);
2113+ if (rbd_dev->parent_overlap)
2114+ counter = atomic_inc_return_safe(&rbd_dev->parent_ref);
2115+ up_read(&rbd_dev->header_rwsem);
21222116
21232117 if (counter < 0)
21242118 rbd_warn(rbd_dev, "parent reference overflow");
21252119
2126− return false;
2120+ return counter > 0;
21272121 }
21282122
21292123 /*
@@ -4239,7 +4233,6 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) · 2109 unmodified lines
42394233 */
42404234 if (rbd_dev->parent_overlap) {
42414235 rbd_dev->parent_overlap = 0;
4242− smp_mb();
42434236 rbd_dev_parent_put(rbd_dev);
42444237 pr_info("%s: clone image has been flattened\n",
42454238 rbd_dev->disk->disk_name);
@@ -4285,7 +4278,6 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) · 39 unmodified lines
42854278 * treat it specially.
42864279 */
42874280 rbd_dev->parent_overlap = overlap;
4288− smp_mb();
42894281 if (!overlap) {
42904282
42914283 /* A null parent_spec indicates it's the initial probe */
@@ -5114,10 +5106,7 @@ static void rbd_dev_unprobe(struct rbd_device *rbd_dev) · 822 unmodified lines
51145106 {
51155107 struct rbd_image_header *header;
51165108
5117− /* Drop parent reference unless it's already been done (or none) */
5118−
5119− if (rbd_dev->parent_overlap)
5120− rbd_dev_parent_put(rbd_dev);
5109+ rbd_dev_parent_put(rbd_dev);
51215110
51225111 /* Free dynamic fields from the header, then zero it out */
51235112
drivers/gpu/drm/amd/amdkfd/kfd_device.c+3−3
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include <linux/slab.h>
2727 #include "kfd_priv.h"
2828 #include "kfd_device_queue_manager.h"
29+#include "kfd_pm4_headers.h"
2930
3031 #define MQD_SIZE_ALIGNED 768
3132
@@ -169,9 +170,8 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, · 137 unmodified lines
169170 kfd->shared_resources = *gpu_resources;
170171
171172 /* calculate max size of mqds needed for queues */
172− size = max_num_of_processes *
173− max_num_of_queues_per_process *
174− kfd->device_info->mqd_size_aligned;
173+ size = max_num_of_queues_per_device *
174+ kfd->device_info->mqd_size_aligned;
175175
176176 /* add another 512KB for all other allocations on gart */
177177 size += 512 * 1024;
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c+76−2
@@ -183,6 +183,13 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm, · 182 unmodified lines
183183
184184 mutex_lock(&dqm->lock);
185185
186+ if (dqm->total_queue_count >= max_num_of_queues_per_device) {
187+ pr_warn("amdkfd: Can't create new usermode queue because %d queues were already created\n",
188+ dqm->total_queue_count);
189+ mutex_unlock(&dqm->lock);
190+ return -EPERM;
191+ }
192+
186193 if (list_empty(&qpd->queues_list)) {
187194 retval = allocate_vmid(dqm, qpd, q);
188195 if (retval != 0) {
@@ -207,6 +214,14 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm, · 18 unmodified lines
207214 list_add(&q->list, &qpd->queues_list);
208215 dqm->queue_count++;
209216
217+ /*
218+ * Unconditionally increment this counter, regardless of the queue's
219+ * type or whether the queue is active.
220+ */
221+ dqm->total_queue_count++;
222+ pr_debug("Total of %d queues are accountable so far\n",
223+ dqm->total_queue_count);
224+
210225 mutex_unlock(&dqm->lock);
211226 return 0;
212227 }
@@ -326,6 +341,15 @@ static int destroy_queue_nocpsch(struct device_queue_manager *dqm, · 113 unmodified lines
326341 if (list_empty(&qpd->queues_list))
327342 deallocate_vmid(dqm, qpd, q);
328343 dqm->queue_count--;
344+
345+ /*
346+ * Unconditionally decrement this counter, regardless of the queue's
347+ * type
348+ */
349+ dqm->total_queue_count--;
350+ pr_debug("Total of %d queues are accountable so far\n",
351+ dqm->total_queue_count);
352+
329353 out:
330354 mutex_unlock(&dqm->lock);
331355 return retval;
@@ -541,10 +565,14 @@ static int init_pipelines(struct device_queue_manager *dqm, · 209 unmodified lines
541565
542566 for (i = 0; i < pipes_num; i++) {
543567 inx = i + first_pipe;
568+ /*
569+ * HPD buffer on GTT is allocated by amdkfd, no need to waste
570+ * space in GTT for pipelines we don't initialize
571+ */
544572 pipe_hpd_addr = dqm->pipelines_addr + i * CIK_HPD_EOP_BYTES;
545573 pr_debug("kfd: pipeline address %llX\n", pipe_hpd_addr);
546574 /* = log2(bytes/4)-1 */
547− kfd2kgd->init_pipeline(dqm->dev->kgd, i,
575+ kfd2kgd->init_pipeline(dqm->dev->kgd, inx,
548576 CIK_HPD_EOP_BYTES_LOG2 - 3, pipe_hpd_addr);
549577 }
550578
@@ -560,7 +588,7 @@ static int init_scheduler(struct device_queue_manager *dqm) · 9 unmodified lines
560588
561589 pr_debug("kfd: In %s\n", __func__);
562590
563− retval = init_pipelines(dqm, get_pipes_num(dqm), KFD_DQM_FIRST_PIPE);
591+ retval = init_pipelines(dqm, get_pipes_num(dqm), get_first_pipe(dqm));
564592 if (retval != 0)
565593 return retval;
566594
@@ -752,6 +780,21 @@ static int create_kernel_queue_cpsch(struct device_queue_manager *dqm, · 185 unmodified lines
752780 pr_debug("kfd: In func %s\n", __func__);
753781
754782 mutex_lock(&dqm->lock);
783+ if (dqm->total_queue_count >= max_num_of_queues_per_device) {
784+ pr_warn("amdkfd: Can't create new kernel queue because %d queues were already created\n",
785+ dqm->total_queue_count);
786+ mutex_unlock(&dqm->lock);
787+ return -EPERM;
788+ }
789+
790+ /*
791+ * Unconditionally increment this counter, regardless of the queue's
792+ * type or whether the queue is active.
793+ */
794+ dqm->total_queue_count++;
795+ pr_debug("Total of %d queues are accountable so far\n",
796+ dqm->total_queue_count);
797+
755798 list_add(&kq->list, &qpd->priv_queue_list);
756799 dqm->queue_count++;
757800 qpd->is_debug = true;
@@ -775,6 +818,13 @@ static void destroy_kernel_queue_cpsch(struct device_queue_manager *dqm, · 17 unmodified lines
775818 dqm->queue_count--;
776819 qpd->is_debug = false;
777820 execute_queues_cpsch(dqm, false);
821+ /*
822+ * Unconditionally decrement this counter, regardless of the queue's
823+ * type.
824+ */
825+ dqm->total_queue_count++;
826+ pr_debug("Total of %d queues are accountable so far\n",
827+ dqm->total_queue_count);
778828 mutex_unlock(&dqm->lock);
779829 }
780830
@@ -793,6 +843,13 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q, · 12 unmodified lines
793843
794844 mutex_lock(&dqm->lock);
795845
846+ if (dqm->total_queue_count >= max_num_of_queues_per_device) {
847+ pr_warn("amdkfd: Can't create new usermode queue because %d queues were already created\n",
848+ dqm->total_queue_count);
849+ retval = -EPERM;
850+ goto out;
851+ }
852+
796853 mqd = dqm->get_mqd_manager(dqm, KFD_MQD_TYPE_CIK_CP);
797854 if (mqd == NULL) {
798855 mutex_unlock(&dqm->lock);
@@ -810,6 +867,15 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q, · 11 unmodified lines
810867 retval = execute_queues_cpsch(dqm, false);
811868 }
812869
870+ /*
871+ * Unconditionally increment this counter, regardless of the queue's
872+ * type or whether the queue is active.
873+ */
874+ dqm->total_queue_count++;
875+
876+ pr_debug("Total of %d queues are accountable so far\n",
877+ dqm->total_queue_count);
878+
813879 out:
814880 mutex_unlock(&dqm->lock);
815881 return retval;
@@ -930,6 +996,14 @@ static int destroy_queue_cpsch(struct device_queue_manager *dqm, · 114 unmodified lines
930996
931997 mqd->uninit_mqd(mqd, q->mqd, q->mqd_mem_obj);
932998
999+ /*
1000+ * Unconditionally decrement this counter, regardless of the queue's
1001+ * type
1002+ */
1003+ dqm->total_queue_count--;
1004+ pr_debug("Total of %d queues are accountable so far\n",
1005+ dqm->total_queue_count);
1006+
9331007 mutex_unlock(&dqm->lock);
9341008
9351009 return 0;
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h+1−0
@@ -130,6 +130,7 @@ struct device_queue_manager { · 129 unmodified lines
130130 struct list_head queues;
131131 unsigned int processes_count;
132132 unsigned int queue_count;
133+ unsigned int total_queue_count;
133134 unsigned int next_pipe_to_allocate;
134135 unsigned int *allocated_queues;
135136 unsigned int vmid_bitmap;
drivers/gpu/drm/amd/amdkfd/kfd_module.c+8−19
@@ -50,15 +50,10 @@ module_param(sched_policy, int, 0444); · 49 unmodified lines
5050 MODULE_PARM_DESC(sched_policy,
5151 "Kernel cmdline parameter that defines the amdkfd scheduling policy");
5252
53−int max_num_of_processes = KFD_MAX_NUM_OF_PROCESSES_DEFAULT;
54−module_param(max_num_of_processes, int, 0444);
55−MODULE_PARM_DESC(max_num_of_processes,
56− "Kernel cmdline parameter that defines the amdkfd maximum number of supported processes");
57−
58−int max_num_of_queues_per_process = KFD_MAX_NUM_OF_QUEUES_PER_PROCESS_DEFAULT;
59−module_param(max_num_of_queues_per_process, int, 0444);
60−MODULE_PARM_DESC(max_num_of_queues_per_process,
61− "Kernel cmdline parameter that defines the amdkfd maximum number of supported queues per process");
53+int max_num_of_queues_per_device = KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT;
54+module_param(max_num_of_queues_per_device, int, 0444);
55+MODULE_PARM_DESC(max_num_of_queues_per_device,
56+ "Maximum number of supported queues per device (1 = Minimum, 4096 = default)");
6257
6358 bool kgd2kfd_init(unsigned interface_version,
6459 const struct kfd2kgd_calls *f2g,
@@ -100,16 +95,10 @@ static int __init kfd_module_init(void) · 35 unmodified lines
10095 }
10196
10297 /* Verify module parameters */
103− if ((max_num_of_processes < 0) ||
104− (max_num_of_processes > KFD_MAX_NUM_OF_PROCESSES)) {
105− pr_err("kfd: max_num_of_processes must be between 0 to KFD_MAX_NUM_OF_PROCESSES\n");
106− return -1;
107− }
108−
109− if ((max_num_of_queues_per_process < 0) ||
110− (max_num_of_queues_per_process >
111− KFD_MAX_NUM_OF_QUEUES_PER_PROCESS)) {
112− pr_err("kfd: max_num_of_queues_per_process must be between 0 to KFD_MAX_NUM_OF_QUEUES_PER_PROCESS\n");
98+ if ((max_num_of_queues_per_device < 0) ||
99+ (max_num_of_queues_per_device >
100+ KFD_MAX_NUM_OF_QUEUES_PER_DEVICE)) {
101+ pr_err("kfd: max_num_of_queues_per_device must be between 0 to KFD_MAX_NUM_OF_QUEUES_PER_DEVICE\n");
113102 return -1;
114103 }
115104
drivers/gpu/drm/amd/amdkfd/kfd_pasid.c+1−1
@@ -30,7 +30,7 @@ static DEFINE_MUTEX(pasid_mutex); · 29 unmodified lines
3030
3131 int kfd_pasid_init(void)
3232 {
33− pasid_limit = max_num_of_processes;
33+ pasid_limit = KFD_MAX_NUM_OF_PROCESSES;
3434
3535 pasid_bitmap = kcalloc(BITS_TO_LONGS(pasid_limit), sizeof(long), GFP_KERNEL);
3636 if (!pasid_bitmap)
drivers/gpu/drm/amd/amdkfd/kfd_priv.h+8−9
@@ -52,20 +52,19 @@ · 51 unmodified lines
5252 #define kfd_alloc_struct(ptr_to_struct) \
5353 ((typeof(ptr_to_struct)) kzalloc(sizeof(*ptr_to_struct), GFP_KERNEL))
5454
55−/* Kernel module parameter to specify maximum number of supported processes */
56−extern int max_num_of_processes;
57−
58−#define KFD_MAX_NUM_OF_PROCESSES_DEFAULT 32
5955 #define KFD_MAX_NUM_OF_PROCESSES 512
56+#define KFD_MAX_NUM_OF_QUEUES_PER_PROCESS 1024
6057
6158 /*
62− * Kernel module parameter to specify maximum number of supported queues
63− * per process
59+ * Kernel module parameter to specify maximum number of supported queues per
60+ * device
6461 */
65−extern int max_num_of_queues_per_process;
62+extern int max_num_of_queues_per_device;
6663
67−#define KFD_MAX_NUM_OF_QUEUES_PER_PROCESS_DEFAULT 128
68−#define KFD_MAX_NUM_OF_QUEUES_PER_PROCESS 1024
64+#define KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT 4096
65+#define KFD_MAX_NUM_OF_QUEUES_PER_DEVICE \
66+ (KFD_MAX_NUM_OF_PROCESSES * \
67+ KFD_MAX_NUM_OF_QUEUES_PER_PROCESS)
6968
7069 #define KFD_KERNEL_QUEUE_SIZE 2048
7170
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c+8−4
@@ -54,11 +54,11 @@ static int find_available_queue_slot(struct process_queue_manager *pqm, · 53 unmodified lines
5454 pr_debug("kfd: in %s\n", __func__);
5555
5656 found = find_first_zero_bit(pqm->queue_slot_bitmap,
57− max_num_of_queues_per_process);
57+ KFD_MAX_NUM_OF_QUEUES_PER_PROCESS);
5858
5959 pr_debug("kfd: the new slot id %lu\n", found);
6060
61− if (found >= max_num_of_queues_per_process) {
61+ if (found >= KFD_MAX_NUM_OF_QUEUES_PER_PROCESS) {
6262 pr_info("amdkfd: Can not open more queues for process with pasid %d\n",
6363 pqm->process->pasid);
6464 return -ENOMEM;
@@ -76,7 +76,7 @@ int pqm_init(struct process_queue_manager *pqm, struct kfd_process *p) · 11 unmodified lines
7676
7777 INIT_LIST_HEAD(&pqm->queues);
7878 pqm->queue_slot_bitmap =
79− kzalloc(DIV_ROUND_UP(max_num_of_queues_per_process,
79+ kzalloc(DIV_ROUND_UP(KFD_MAX_NUM_OF_QUEUES_PER_PROCESS,
8080 BITS_PER_BYTE), GFP_KERNEL);
8181 if (pqm->queue_slot_bitmap == NULL)
8282 return -ENOMEM;
@@ -203,6 +203,7 @@ int pqm_create_queue(struct process_queue_manager *pqm, · 120 unmodified lines
203203 pqn->kq = NULL;
204204 retval = dev->dqm->create_queue(dev->dqm, q, &pdd->qpd,
205205 &q->properties.vmid);
206+ pr_debug("DQM returned %d for create_queue\n", retval);
206207 print_queue(q);
207208 break;
208209 case KFD_QUEUE_TYPE_DIQ:
@@ -222,7 +223,7 @@ int pqm_create_queue(struct process_queue_manager *pqm, · 13 unmodified lines
222223 }
223224
224225 if (retval != 0) {
225− pr_err("kfd: error dqm create queue\n");
226+ pr_debug("Error dqm create queue\n");
226227 goto err_create_queue;
227228 }
228229
@@ -241,7 +242,10 @@ int pqm_create_queue(struct process_queue_manager *pqm, · 12 unmodified lines
241242 err_create_queue:
242243 kfree(pqn);
243244 err_allocate_pqn:
245+ /* check if queues list is empty unregister process from device */
244246 clear_bit(*qid, pqm->queue_slot_bitmap);
247+ if (list_empty(&pqm->queues))
248+ dev->dqm->unregister_process(dev->dqm, &pdd->qpd);
245249 return retval;
246250 }
247251
drivers/gpu/drm/drm_fb_helper.c+30−0
@@ -145,6 +145,31 @@ int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_ · 144 unmodified lines
145145 }
146146 EXPORT_SYMBOL(drm_fb_helper_add_one_connector);
147147
148+static void remove_from_modeset(struct drm_mode_set *set,
149+ struct drm_connector *connector)
150+{
151+ int i, j;
152+
153+ for (i = 0; i < set->num_connectors; i++) {
154+ if (set->connectors[i] == connector)
155+ break;
156+ }
157+
158+ if (i == set->num_connectors)
159+ return;
160+
161+ for (j = i + 1; j < set->num_connectors; j++) {
162+ set->connectors[j - 1] = set->connectors[j];
163+ }
164+ set->num_connectors--;
165+
166+ /* because i915 is pissy about this..
167+ * TODO maybe need to makes sure we set it back to !=NULL somewhere?
168+ */
169+ if (set->num_connectors == 0)
170+ set->fb = NULL;
171+}
172+
148173 int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
149174 struct drm_connector *connector)
150175 {
@@ -167,6 +192,11 @@ int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, · 16 unmodified lines
167192 }
168193 fb_helper->connector_count--;
169194 kfree(fb_helper_connector);
195+
196+ /* also cleanup dangling references to the connector: */
197+ for (i = 0; i < fb_helper->crtc_count; i++)
198+ remove_from_modeset(&fb_helper->crtc_info[i].mode_set, connector);
199+
170200 return 0;
171201 }
172202 EXPORT_SYMBOL(drm_fb_helper_remove_one_connector);
drivers/gpu/drm/i2c/tda998x_drv.c+42−10
@@ -32,6 +32,8 @@ · 31 unmodified lines
3232 struct tda998x_priv {
3333 struct i2c_client *cec;
3434 struct i2c_client *hdmi;
35+ struct mutex mutex;
36+ struct delayed_work dwork;
3537 uint16_t rev;
3638 uint8_t current_page;
3739 int dpms;
@@ -402,9 +404,10 @@ reg_read_range(struct tda998x_priv *priv, uint16_t reg, char *buf, int cnt) · 364 unmodified lines
402404 uint8_t addr = REG2ADDR(reg);
403405 int ret;
404406
407+ mutex_lock(&priv->mutex);
405408 ret = set_page(priv, reg);
406409 if (ret < 0)
407− return ret;
410+ goto out;
408411
409412 ret = i2c_master_send(client, &addr, sizeof(addr));
410413 if (ret < 0)
@@ -414,10 +417,12 @@ reg_read_range(struct tda998x_priv *priv, uint16_t reg, char *buf, int cnt) · 3 unmodified lines
414417 if (ret < 0)
415418 goto fail;
416419
417− return ret;
420+ goto out;
418421
419422 fail:
420423 dev_err(&client->dev, "Error %d reading from 0x%x\n", ret, reg);
424+out:
425+ mutex_unlock(&priv->mutex);
421426 return ret;
422427 }
423428
@@ -431,13 +436,16 @@ reg_write_range(struct tda998x_priv *priv, uint16_t reg, uint8_t *p, int cnt) · 7 unmodified lines
431436 buf[0] = REG2ADDR(reg);
432437 memcpy(&buf[1], p, cnt);
433438
439+ mutex_lock(&priv->mutex);
434440 ret = set_page(priv, reg);
435441 if (ret < 0)
436− return;
442+ goto out;
437443
438444 ret = i2c_master_send(client, buf, cnt + 1);
439445 if (ret < 0)
440446 dev_err(&client->dev, "Error %d writing to 0x%x\n", ret, reg);
447+out:
448+ mutex_unlock(&priv->mutex);
441449 }
442450
443451 static int
@@ -459,13 +467,16 @@ reg_write(struct tda998x_priv *priv, uint16_t reg, uint8_t val) · 15 unmodified lines
459467 uint8_t buf[] = {REG2ADDR(reg), val};
460468 int ret;
461469
470+ mutex_lock(&priv->mutex);
462471 ret = set_page(priv, reg);
463472 if (ret < 0)
464− return;
473+ goto out;
465474
466475 ret = i2c_master_send(client, buf, sizeof(buf));
467476 if (ret < 0)
468477 dev_err(&client->dev, "Error %d writing to 0x%x\n", ret, reg);
478+out:
479+ mutex_unlock(&priv->mutex);
469480 }
470481
471482 static void
@@ -475,13 +486,16 @@ reg_write16(struct tda998x_priv *priv, uint16_t reg, uint16_t val) · 3 unmodified lines
475486 uint8_t buf[] = {REG2ADDR(reg), val >> 8, val};
476487 int ret;
477488
489+ mutex_lock(&priv->mutex);
478490 ret = set_page(priv, reg);
479491 if (ret < 0)
480− return;
492+ goto out;
481493
482494 ret = i2c_master_send(client, buf, sizeof(buf));
483495 if (ret < 0)
484496 dev_err(&client->dev, "Error %d writing to 0x%x\n", ret, reg);
497+out:
498+ mutex_unlock(&priv->mutex);
485499 }
486500
487501 static void
@@ -536,6 +550,17 @@ tda998x_reset(struct tda998x_priv *priv) · 48 unmodified lines
536550 reg_write(priv, REG_MUX_VP_VIP_OUT, 0x24);
537551 }
538552
553+/* handle HDMI connect/disconnect */
554+static void tda998x_hpd(struct work_struct *work)
555+{
556+ struct delayed_work *dwork = to_delayed_work(work);
557+ struct tda998x_priv *priv =
558+ container_of(dwork, struct tda998x_priv, dwork);
559+
560+ if (priv->encoder && priv->encoder->dev)
561+ drm_kms_helper_hotplug_event(priv->encoder->dev);
562+}
563+
539564 /*
540565 * only 2 interrupts may occur: screen plug/unplug and EDID read
541566 */
@@ -559,8 +584,7 @@ static irqreturn_t tda998x_irq_thread(int irq, void *data) · 17 unmodified lines
559584 priv->wq_edid_wait = 0;
560585 wake_up(&priv->wq_edid);
561586 } else if (cec != 0) { /* HPD change */
562− if (priv->encoder && priv->encoder->dev)
563− drm_helper_hpd_irq_event(priv->encoder->dev);
587+ schedule_delayed_work(&priv->dwork, HZ/10);
564588 }
565589 return IRQ_HANDLED;
566590 }
@@ -1170,8 +1194,10 @@ static void tda998x_destroy(struct tda998x_priv *priv) · 603 unmodified lines
11701194 /* disable all IRQs and free the IRQ handler */
11711195 cec_write(priv, REG_CEC_RXSHPDINTENA, 0);
11721196 reg_clear(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD);
1173− if (priv->hdmi->irq)
1197+ if (priv->hdmi->irq) {
11741198 free_irq(priv->hdmi->irq, priv);
1199+ cancel_delayed_work_sync(&priv->dwork);
1200+ }
11751201
11761202 i2c_unregister_device(priv->cec);
11771203 }
@@ -1255,6 +1281,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) · 77 unmodified lines
12551281 struct device_node *np = client->dev.of_node;
12561282 u32 video;
12571283 int rev_lo, rev_hi, ret;
1284+ unsigned short cec_addr;
12581285
12591286 priv->vip_cntrl_0 = VIP_CNTRL_0_SWAP_A(2) | VIP_CNTRL_0_SWAP_B(3);
12601287 priv->vip_cntrl_1 = VIP_CNTRL_1_SWAP_C(0) | VIP_CNTRL_1_SWAP_D(1);
@@ -1262,12 +1289,16 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) · 1 unmodified line
12621289
12631290 priv->current_page = 0xff;
12641291 priv->hdmi = client;
1265− priv->cec = i2c_new_dummy(client->adapter, 0x34);
1292+ /* CEC I2C address bound to TDA998x I2C addr by configuration pins */
1293+ cec_addr = 0x34 + (client->addr & 0x03);
1294+ priv->cec = i2c_new_dummy(client->adapter, cec_addr);
12661295 if (!priv->cec)
12671296 return -ENODEV;
12681297
12691298 priv->dpms = DRM_MODE_DPMS_OFF;
12701299
1300+ mutex_init(&priv->mutex); /* protect the page access */
1301+
12711302 /* wake up the device: */
12721303 cec_write(priv, REG_CEC_ENAMODS,
12731304 CEC_ENAMODS_EN_RXSENS | CEC_ENAMODS_EN_HDMI);
@@ -1323,8 +1354,9 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) · 49 unmodified lines
13231354 if (client->irq) {
13241355 int irqf_trigger;
13251356
1326− /* init read EDID waitqueue */
1357+ /* init read EDID waitqueue and HDP work */
13271358 init_waitqueue_head(&priv->wq_edid);
1359+ INIT_DELAYED_WORK(&priv->dwork, tda998x_hpd);
13281360
13291361 /* clear pending interrupts */
13301362 reg_read(priv, REG_INT_FLAGS_0);
drivers/gpu/drm/i915/i915_drv.c+4−10
@@ -462,19 +462,13 @@ void intel_detect_pch(struct drm_device *dev) · 461 unmodified lines
462462 } else if (id == INTEL_PCH_LPT_DEVICE_ID_TYPE) {
463463 dev_priv->pch_type = PCH_LPT;
464464 DRM_DEBUG_KMS("Found LynxPoint PCH\n");
465− WARN_ON(!IS_HASWELL(dev));
466− WARN_ON(IS_HSW_ULT(dev));
467− } else if (IS_BROADWELL(dev)) {
468− dev_priv->pch_type = PCH_LPT;
469− dev_priv->pch_id =
470− INTEL_PCH_LPT_LP_DEVICE_ID_TYPE;
471− DRM_DEBUG_KMS("This is Broadwell, assuming "
472− "LynxPoint LP PCH\n");
465+ WARN_ON(!IS_HASWELL(dev) && !IS_BROADWELL(dev));
466+ WARN_ON(IS_HSW_ULT(dev) || IS_BDW_ULT(dev));
473467 } else if (id == INTEL_PCH_LPT_LP_DEVICE_ID_TYPE) {
474468 dev_priv->pch_type = PCH_LPT;
475469 DRM_DEBUG_KMS("Found LynxPoint LP PCH\n");
476− WARN_ON(!IS_HASWELL(dev));
477− WARN_ON(!IS_HSW_ULT(dev));
470+ WARN_ON(!IS_HASWELL(dev) && !IS_BROADWELL(dev));
471+ WARN_ON(!IS_HSW_ULT(dev) && !IS_BDW_ULT(dev));
478472 } else if (id == INTEL_PCH_SPT_DEVICE_ID_TYPE) {
479473 dev_priv->pch_type = PCH_SPT;
480474 DRM_DEBUG_KMS("Found SunrisePoint PCH\n");
drivers/gpu/drm/i915/i915_drv.h+1−2
@@ -2159,8 +2159,7 @@ struct drm_i915_cmd_table { · 2158 unmodified lines
21592159 #define IS_HSW_EARLY_SDV(dev) (IS_HASWELL(dev) && \
21602160 (INTEL_DEVID(dev) & 0xFF00) == 0x0C00)
21612161 #define IS_BDW_ULT(dev) (IS_BROADWELL(dev) && \
2162− ((INTEL_DEVID(dev) & 0xf) == 0x2 || \
2163− (INTEL_DEVID(dev) & 0xf) == 0x6 || \
2162+ ((INTEL_DEVID(dev) & 0xf) == 0x6 || \
21642163 (INTEL_DEVID(dev) & 0xf) == 0xe))
21652164 #define IS_BDW_GT3(dev) (IS_BROADWELL(dev) && \
21662165 (INTEL_DEVID(dev) & 0x00F0) == 0x0020)
drivers/gpu/drm/i915/i915_gem.c+13−13
@@ -3148,6 +3148,13 @@ static void i965_write_fence_reg(struct drm_device *dev, int reg, · 3147 unmodified lines
31483148 u32 size = i915_gem_obj_ggtt_size(obj);
31493149 uint64_t val;
31503150
3151+ /* Adjust fence size to match tiled area */
3152+ if (obj->tiling_mode != I915_TILING_NONE) {
3153+ uint32_t row_size = obj->stride *
3154+ (obj->tiling_mode == I915_TILING_Y ? 32 : 8);
3155+ size = (size / row_size) * row_size;
3156+ }
3157+
31513158 val = (uint64_t)((i915_gem_obj_ggtt_offset(obj) + size - 4096) &
31523159 0xfffff000) << 32;
31533160 val |= i915_gem_obj_ggtt_offset(obj) & 0xfffff000;
@@ -4884,25 +4891,18 @@ i915_gem_init_hw(struct drm_device *dev) · 1730 unmodified lines
48844891 for (i = 0; i < NUM_L3_SLICES(dev); i++)
48854892 i915_gem_l3_remap(&dev_priv->ring[RCS], i);
48864893
4887− /*
4888− * XXX: Contexts should only be initialized once. Doing a switch to the
4889− * default context switch however is something we'd like to do after
4890− * reset or thaw (the latter may not actually be necessary for HW, but
4891− * goes with our code better). Context switching requires rings (for
4892− * the do_switch), but before enabling PPGTT. So don't move this.
4893− */
4894− ret = i915_gem_context_enable(dev_priv);
4894+ ret = i915_ppgtt_init_hw(dev);
48954895 if (ret && ret != -EIO) {
4896− DRM_ERROR("Context enable failed %d\n", ret);
4896+ DRM_ERROR("PPGTT enable failed %d\n", ret);
48974897 i915_gem_cleanup_ringbuffer(dev);
4898−
4899− return ret;
49004898 }
49014899
4902− ret = i915_ppgtt_init_hw(dev);
4900+ ret = i915_gem_context_enable(dev_priv);
49034901 if (ret && ret != -EIO) {
4904− DRM_ERROR("PPGTT enable failed %d\n", ret);
4902+ DRM_ERROR("Context enable failed %d\n", ret);
49054903 i915_gem_cleanup_ringbuffer(dev);
4904+
4905+ return ret;
49064906 }
49074907
49084908 return ret;
drivers/gpu/drm/i915/intel_panel.c+1−1
@@ -962,7 +962,7 @@ void intel_panel_enable_backlight(struct intel_connector *connector) · 961 unmodified lines
962962
963963 WARN_ON(panel->backlight.max == 0);
964964
965− if (panel->backlight.level == 0) {
965+ if (panel->backlight.level <= panel->backlight.min) {
966966 panel->backlight.level = panel->backlight.max;
967967 if (panel->backlight.device)
968968 panel->backlight.device->props.brightness =
drivers/gpu/drm/radeon/cik_sdma.c+0−1
@@ -816,7 +816,6 @@ void cik_sdma_vm_write_pages(struct radeon_device *rdev, · 815 unmodified lines
816816 for (; ndw > 0; ndw -= 2, --count, pe += 8) {
817817 if (flags & R600_PTE_SYSTEM) {
818818 value = radeon_vm_map_gart(rdev, addr);
819− value &= 0xFFFFFFFFFFFFF000ULL;
820819 } else if (flags & R600_PTE_VALID) {
821820 value = addr;
822821 } else {
drivers/gpu/drm/radeon/ni_dma.c+0−1
@@ -372,7 +372,6 @@ void cayman_dma_vm_write_pages(struct radeon_device *rdev, · 371 unmodified lines
372372 for (; ndw > 0; ndw -= 2, --count, pe += 8) {
373373 if (flags & R600_PTE_SYSTEM) {
374374 value = radeon_vm_map_gart(rdev, addr);
375− value &= 0xFFFFFFFFFFFFF000ULL;
376375 } else if (flags & R600_PTE_VALID) {
377376 value = addr;
378377 } else {
drivers/gpu/drm/radeon/r100.c+8−2
@@ -644,6 +644,7 @@ int r100_pci_gart_init(struct radeon_device *rdev) · 643 unmodified lines
644644 return r;
645645 rdev->gart.table_size = rdev->gart.num_gpu_pages * 4;
646646 rdev->asic->gart.tlb_flush = &r100_pci_gart_tlb_flush;
647+ rdev->asic->gart.get_page_entry = &r100_pci_gart_get_page_entry;
647648 rdev->asic->gart.set_page = &r100_pci_gart_set_page;
648649 return radeon_gart_table_ram_alloc(rdev);
649650 }
@@ -681,11 +682,16 @@ void r100_pci_gart_disable(struct radeon_device *rdev) · 31 unmodified lines
681682 WREG32(RADEON_AIC_HI_ADDR, 0);
682683 }
683684
685+uint64_t r100_pci_gart_get_page_entry(uint64_t addr, uint32_t flags)
686+{
687+ return addr;
688+}
689+
684690 void r100_pci_gart_set_page(struct radeon_device *rdev, unsigned i,
685− uint64_t addr, uint32_t flags)
691+ uint64_t entry)
686692 {
687693 u32 *gtt = rdev->gart.ptr;
688− gtt[i] = cpu_to_le32(lower_32_bits(addr));
694+ gtt[i] = cpu_to_le32(lower_32_bits(entry));
689695 }
690696
691697 void r100_pci_gart_fini(struct radeon_device *rdev)
drivers/gpu/drm/radeon/r300.c+11−5
@@ -73,11 +73,8 @@ void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev) · 72 unmodified lines
7373 #define R300_PTE_WRITEABLE (1 << 2)
7474 #define R300_PTE_READABLE (1 << 3)
7575
76−void rv370_pcie_gart_set_page(struct radeon_device *rdev, unsigned i,
77− uint64_t addr, uint32_t flags)
76+uint64_t rv370_pcie_gart_get_page_entry(uint64_t addr, uint32_t flags)
7877 {
79− void __iomem *ptr = rdev->gart.ptr;
80−
8178 addr = (lower_32_bits(addr) >> 8) |
8279 ((upper_32_bits(addr) & 0xff) << 24);
8380 if (flags & RADEON_GART_PAGE_READ)
@@ -86,10 +83,18 @@ void rv370_pcie_gart_set_page(struct radeon_device *rdev, unsigned i, · 2 unmodified lines
8683 addr |= R300_PTE_WRITEABLE;
8784 if (!(flags & RADEON_GART_PAGE_SNOOP))
8885 addr |= R300_PTE_UNSNOOPED;
86+ return addr;
87+}
88+
89+void rv370_pcie_gart_set_page(struct radeon_device *rdev, unsigned i,
90+ uint64_t entry)
91+{
92+ void __iomem *ptr = rdev->gart.ptr;
93+
8994 /* on x86 we want this to be CPU endian, on powerpc
9095 * on powerpc without HW swappers, it'll get swapped on way
9196 * into VRAM - so no need for cpu_to_le32 on VRAM tables */
92− writel(addr, ((void __iomem *)ptr) + (i * 4));
97+ writel(entry, ((void __iomem *)ptr) + (i * 4));
9398 }
9499
95100 int rv370_pcie_gart_init(struct radeon_device *rdev)
@@ -109,6 +114,7 @@ int rv370_pcie_gart_init(struct radeon_device *rdev) · 13 unmodified lines
109114 DRM_ERROR("Failed to register debugfs file for PCIE gart !\n");
110115 rdev->gart.table_size = rdev->gart.num_gpu_pages * 4;
111116 rdev->asic->gart.tlb_flush = &rv370_pcie_gart_tlb_flush;
117+ rdev->asic->gart.get_page_entry = &rv370_pcie_gart_get_page_entry;
112118 rdev->asic->gart.set_page = &rv370_pcie_gart_set_page;
113119 return radeon_gart_table_vram_alloc(rdev);
114120 }
drivers/gpu/drm/radeon/radeon.h+6−3
@@ -242,6 +242,7 @@ bool radeon_get_bios(struct radeon_device *rdev); · 241 unmodified lines
242242 * Dummy page
243243 */
244244 struct radeon_dummy_page {
245+ uint64_t entry;
245246 struct page *page;
246247 dma_addr_t addr;
247248 };
@@ -645,7 +646,7 @@ struct radeon_gart { · 397 unmodified lines
645646 unsigned num_cpu_pages;
646647 unsigned table_size;
647648 struct page **pages;
648− dma_addr_t *pages_addr;
649+ uint64_t *pages_entry;
649650 bool ready;
650651 };
651652
@@ -1847,8 +1848,9 @@ struct radeon_asic { · 1195 unmodified lines
18471848 /* gart */
18481849 struct {
18491850 void (*tlb_flush)(struct radeon_device *rdev);
1851+ uint64_t (*get_page_entry)(uint64_t addr, uint32_t flags);
18501852 void (*set_page)(struct radeon_device *rdev, unsigned i,
1851− uint64_t addr, uint32_t flags);
1853+ uint64_t entry);
18521854 } gart;
18531855 struct {
18541856 int (*init)(struct radeon_device *rdev);
@@ -2852,7 +2854,8 @@ static inline void radeon_ring_write(struct radeon_ring *ring, uint32_t v) · 997 unmodified lines
28522854 #define radeon_vga_set_state(rdev, state) (rdev)->asic->vga_set_state((rdev), (state))
28532855 #define radeon_asic_reset(rdev) (rdev)->asic->asic_reset((rdev))
28542856 #define radeon_gart_tlb_flush(rdev) (rdev)->asic->gart.tlb_flush((rdev))
2855−#define radeon_gart_set_page(rdev, i, p, f) (rdev)->asic->gart.set_page((rdev), (i), (p), (f))
2857+#define radeon_gart_get_page_entry(a, f) (rdev)->asic->gart.get_page_entry((a), (f))
2858+#define radeon_gart_set_page(rdev, i, e) (rdev)->asic->gart.set_page((rdev), (i), (e))
28562859 #define radeon_asic_vm_init(rdev) (rdev)->asic->vm.init((rdev))
28572860 #define radeon_asic_vm_fini(rdev) (rdev)->asic->vm.fini((rdev))
28582861 #define radeon_asic_vm_copy_pages(rdev, ib, pe, src, count) ((rdev)->asic->vm.copy_pages((rdev), (ib), (pe), (src), (count)))
drivers/gpu/drm/radeon/radeon_asic.c+24−0
@@ -159,11 +159,13 @@ void radeon_agp_disable(struct radeon_device *rdev) · 158 unmodified lines
159159 DRM_INFO("Forcing AGP to PCIE mode\n");
160160 rdev->flags |= RADEON_IS_PCIE;
161161 rdev->asic->gart.tlb_flush = &rv370_pcie_gart_tlb_flush;
162+ rdev->asic->gart.get_page_entry = &rv370_pcie_gart_get_page_entry;
162163 rdev->asic->gart.set_page = &rv370_pcie_gart_set_page;
163164 } else {
164165 DRM_INFO("Forcing AGP to PCI mode\n");
165166 rdev->flags |= RADEON_IS_PCI;
166167 rdev->asic->gart.tlb_flush = &r100_pci_gart_tlb_flush;
168+ rdev->asic->gart.get_page_entry = &r100_pci_gart_get_page_entry;
167169 rdev->asic->gart.set_page = &r100_pci_gart_set_page;
168170 }
169171 rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
@@ -199,6 +201,7 @@ static struct radeon_asic r100_asic = { · 29 unmodified lines
199201 .mc_wait_for_idle = &r100_mc_wait_for_idle,
200202 .gart = {
201203 .tlb_flush = &r100_pci_gart_tlb_flush,
204+ .get_page_entry = &r100_pci_gart_get_page_entry,
202205 .set_page = &r100_pci_gart_set_page,
203206 },
204207 .ring = {
@@ -265,6 +268,7 @@ static struct radeon_asic r200_asic = { · 60 unmodified lines
265268 .mc_wait_for_idle = &r100_mc_wait_for_idle,
266269 .gart = {
267270 .tlb_flush = &r100_pci_gart_tlb_flush,
271+ .get_page_entry = &r100_pci_gart_get_page_entry,
268272 .set_page = &r100_pci_gart_set_page,
269273 },
270274 .ring = {
@@ -359,6 +363,7 @@ static struct radeon_asic r300_asic = { · 88 unmodified lines
359363 .mc_wait_for_idle = &r300_mc_wait_for_idle,
360364 .gart = {
361365 .tlb_flush = &r100_pci_gart_tlb_flush,
366+ .get_page_entry = &r100_pci_gart_get_page_entry,
362367 .set_page = &r100_pci_gart_set_page,
363368 },
364369 .ring = {
@@ -425,6 +430,7 @@ static struct radeon_asic r300_asic_pcie = { · 60 unmodified lines
425430 .mc_wait_for_idle = &r300_mc_wait_for_idle,
426431 .gart = {
427432 .tlb_flush = &rv370_pcie_gart_tlb_flush,
433+ .get_page_entry = &rv370_pcie_gart_get_page_entry,
428434 .set_page = &rv370_pcie_gart_set_page,
429435 },
430436 .ring = {
@@ -491,6 +497,7 @@ static struct radeon_asic r420_asic = { · 60 unmodified lines
491497 .mc_wait_for_idle = &r300_mc_wait_for_idle,
492498 .gart = {
493499 .tlb_flush = &rv370_pcie_gart_tlb_flush,
500+ .get_page_entry = &rv370_pcie_gart_get_page_entry,
494501 .set_page = &rv370_pcie_gart_set_page,
495502 },
496503 .ring = {
@@ -557,6 +564,7 @@ static struct radeon_asic rs400_asic = { · 60 unmodified lines
557564 .mc_wait_for_idle = &rs400_mc_wait_for_idle,
558565 .gart = {
559566 .tlb_flush = &rs400_gart_tlb_flush,
567+ .get_page_entry = &rs400_gart_get_page_entry,
560568 .set_page = &rs400_gart_set_page,
561569 },
562570 .ring = {
@@ -623,6 +631,7 @@ static struct radeon_asic rs600_asic = { · 60 unmodified lines
623631 .mc_wait_for_idle = &rs600_mc_wait_for_idle,
624632 .gart = {
625633 .tlb_flush = &rs600_gart_tlb_flush,
634+ .get_page_entry = &rs600_gart_get_page_entry,
626635 .set_page = &rs600_gart_set_page,
627636 },
628637 .ring = {
@@ -691,6 +700,7 @@ static struct radeon_asic rs690_asic = { · 62 unmodified lines
691700 .mc_wait_for_idle = &rs690_mc_wait_for_idle,
692701 .gart = {
693702 .tlb_flush = &rs400_gart_tlb_flush,
703+ .get_page_entry = &rs400_gart_get_page_entry,
694704 .set_page = &rs400_gart_set_page,
695705 },
696706 .ring = {
@@ -759,6 +769,7 @@ static struct radeon_asic rv515_asic = { · 62 unmodified lines
759769 .mc_wait_for_idle = &rv515_mc_wait_for_idle,
760770 .gart = {
761771 .tlb_flush = &rv370_pcie_gart_tlb_flush,
772+ .get_page_entry = &rv370_pcie_gart_get_page_entry,
762773 .set_page = &rv370_pcie_gart_set_page,
763774 },
764775 .ring = {
@@ -825,6 +836,7 @@ static struct radeon_asic r520_asic = { · 60 unmodified lines
825836 .mc_wait_for_idle = &r520_mc_wait_for_idle,
826837 .gart = {
827838 .tlb_flush = &rv370_pcie_gart_tlb_flush,
839+ .get_page_entry = &rv370_pcie_gart_get_page_entry,
828840 .set_page = &rv370_pcie_gart_set_page,
829841 },
830842 .ring = {
@@ -919,6 +931,7 @@ static struct radeon_asic r600_asic = { · 88 unmodified lines
919931 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
920932 .gart = {
921933 .tlb_flush = &r600_pcie_gart_tlb_flush,
934+ .get_page_entry = &rs600_gart_get_page_entry,
922935 .set_page = &rs600_gart_set_page,
923936 },
924937 .ring = {
@@ -1004,6 +1017,7 @@ static struct radeon_asic rv6xx_asic = { · 79 unmodified lines
10041017 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
10051018 .gart = {
10061019 .tlb_flush = &r600_pcie_gart_tlb_flush,
1020+ .get_page_entry = &rs600_gart_get_page_entry,
10071021 .set_page = &rs600_gart_set_page,
10081022 },
10091023 .ring = {
@@ -1095,6 +1109,7 @@ static struct radeon_asic rs780_asic = { · 85 unmodified lines
10951109 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
10961110 .gart = {
10971111 .tlb_flush = &r600_pcie_gart_tlb_flush,
1112+ .get_page_entry = &rs600_gart_get_page_entry,
10981113 .set_page = &rs600_gart_set_page,
10991114 },
11001115 .ring = {
@@ -1199,6 +1214,7 @@ static struct radeon_asic rv770_asic = { · 98 unmodified lines
11991214 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
12001215 .gart = {
12011216 .tlb_flush = &r600_pcie_gart_tlb_flush,
1217+ .get_page_entry = &rs600_gart_get_page_entry,
12021218 .set_page = &rs600_gart_set_page,
12031219 },
12041220 .ring = {
@@ -1317,6 +1333,7 @@ static struct radeon_asic evergreen_asic = { · 112 unmodified lines
13171333 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
13181334 .gart = {
13191335 .tlb_flush = &evergreen_pcie_gart_tlb_flush,
1336+ .get_page_entry = &rs600_gart_get_page_entry,
13201337 .set_page = &rs600_gart_set_page,
13211338 },
13221339 .ring = {
@@ -1409,6 +1426,7 @@ static struct radeon_asic sumo_asic = { · 86 unmodified lines
14091426 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
14101427 .gart = {
14111428 .tlb_flush = &evergreen_pcie_gart_tlb_flush,
1429+ .get_page_entry = &rs600_gart_get_page_entry,
14121430 .set_page = &rs600_gart_set_page,
14131431 },
14141432 .ring = {
@@ -1500,6 +1518,7 @@ static struct radeon_asic btc_asic = { · 85 unmodified lines
15001518 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
15011519 .gart = {
15021520 .tlb_flush = &evergreen_pcie_gart_tlb_flush,
1521+ .get_page_entry = &rs600_gart_get_page_entry,
15031522 .set_page = &rs600_gart_set_page,
15041523 },
15051524 .ring = {
@@ -1635,6 +1654,7 @@ static struct radeon_asic cayman_asic = { · 129 unmodified lines
16351654 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
16361655 .gart = {
16371656 .tlb_flush = &cayman_pcie_gart_tlb_flush,
1657+ .get_page_entry = &rs600_gart_get_page_entry,
16381658 .set_page = &rs600_gart_set_page,
16391659 },
16401660 .vm = {
@@ -1738,6 +1758,7 @@ static struct radeon_asic trinity_asic = { · 97 unmodified lines
17381758 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
17391759 .gart = {
17401760 .tlb_flush = &cayman_pcie_gart_tlb_flush,
1761+ .get_page_entry = &rs600_gart_get_page_entry,
17411762 .set_page = &rs600_gart_set_page,
17421763 },
17431764 .vm = {
@@ -1871,6 +1892,7 @@ static struct radeon_asic si_asic = { · 127 unmodified lines
18711892 .get_gpu_clock_counter = &si_get_gpu_clock_counter,
18721893 .gart = {
18731894 .tlb_flush = &si_pcie_gart_tlb_flush,
1895+ .get_page_entry = &rs600_gart_get_page_entry,
18741896 .set_page = &rs600_gart_set_page,
18751897 },
18761898 .vm = {
@@ -2032,6 +2054,7 @@ static struct radeon_asic ci_asic = { · 155 unmodified lines
20322054 .get_gpu_clock_counter = &cik_get_gpu_clock_counter,
20332055 .gart = {
20342056 .tlb_flush = &cik_pcie_gart_tlb_flush,
2057+ .get_page_entry = &rs600_gart_get_page_entry,
20352058 .set_page = &rs600_gart_set_page,
20362059 },
20372060 .vm = {
@@ -2139,6 +2162,7 @@ static struct radeon_asic kv_asic = { · 101 unmodified lines
21392162 .get_gpu_clock_counter = &cik_get_gpu_clock_counter,
21402163 .gart = {
21412164 .tlb_flush = &cik_pcie_gart_tlb_flush,
2165+ .get_page_entry = &rs600_gart_get_page_entry,
21422166 .set_page = &rs600_gart_set_page,
21432167 },
21442168 .vm = {
drivers/gpu/drm/radeon/radeon_asic.h+8−4
@@ -67,8 +67,9 @@ bool r100_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp); · 66 unmodified lines
6767 int r100_asic_reset(struct radeon_device *rdev);
6868 u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc);
6969 void r100_pci_gart_tlb_flush(struct radeon_device *rdev);
70+uint64_t r100_pci_gart_get_page_entry(uint64_t addr, uint32_t flags);
7071 void r100_pci_gart_set_page(struct radeon_device *rdev, unsigned i,
71− uint64_t addr, uint32_t flags);
72+ uint64_t entry);
7273 void r100_ring_start(struct radeon_device *rdev, struct radeon_ring *ring);
7374 int r100_irq_set(struct radeon_device *rdev);
7475 int r100_irq_process(struct radeon_device *rdev);
@@ -172,8 +173,9 @@ extern void r300_fence_ring_emit(struct radeon_device *rdev, · 97 unmodified lines
172173 struct radeon_fence *fence);
173174 extern int r300_cs_parse(struct radeon_cs_parser *p);
174175 extern void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev);
176+extern uint64_t rv370_pcie_gart_get_page_entry(uint64_t addr, uint32_t flags);
175177 extern void rv370_pcie_gart_set_page(struct radeon_device *rdev, unsigned i,
176− uint64_t addr, uint32_t flags);
178+ uint64_t entry);
177179 extern void rv370_set_pcie_lanes(struct radeon_device *rdev, int lanes);
178180 extern int rv370_get_pcie_lanes(struct radeon_device *rdev);
179181 extern void r300_set_reg_safe(struct radeon_device *rdev);
@@ -208,8 +210,9 @@ extern void rs400_fini(struct radeon_device *rdev); · 28 unmodified lines
208210 extern int rs400_suspend(struct radeon_device *rdev);
209211 extern int rs400_resume(struct radeon_device *rdev);
210212 void rs400_gart_tlb_flush(struct radeon_device *rdev);
213+uint64_t rs400_gart_get_page_entry(uint64_t addr, uint32_t flags);
211214 void rs400_gart_set_page(struct radeon_device *rdev, unsigned i,
212− uint64_t addr, uint32_t flags);
215+ uint64_t entry);
213216 uint32_t rs400_mc_rreg(struct radeon_device *rdev, uint32_t reg);
214217 void rs400_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
215218 int rs400_gart_init(struct radeon_device *rdev);
@@ -232,8 +235,9 @@ int rs600_irq_process(struct radeon_device *rdev); · 16 unmodified lines
232235 void rs600_irq_disable(struct radeon_device *rdev);
233236 u32 rs600_get_vblank_counter(struct radeon_device *rdev, int crtc);
234237 void rs600_gart_tlb_flush(struct radeon_device *rdev);
238+uint64_t rs600_gart_get_page_entry(uint64_t addr, uint32_t flags);
235239 void rs600_gart_set_page(struct radeon_device *rdev, unsigned i,
236− uint64_t addr, uint32_t flags);
240+ uint64_t entry);
237241 uint32_t rs600_mc_rreg(struct radeon_device *rdev, uint32_t reg);
238242 void rs600_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
239243 void rs600_bandwidth_update(struct radeon_device *rdev);
drivers/gpu/drm/radeon/radeon_device.c+2−0
@@ -774,6 +774,8 @@ int radeon_dummy_page_init(struct radeon_device *rdev) · 773 unmodified lines
774774 rdev->dummy_page.page = NULL;
775775 return -ENOMEM;
776776 }
777+ rdev->dummy_page.entry = radeon_gart_get_page_entry(rdev->dummy_page.addr,
778+ RADEON_GART_PAGE_DUMMY);
777779 return 0;
778780 }
779781
drivers/gpu/drm/radeon/radeon_gart.c+32−22
@@ -165,6 +165,19 @@ int radeon_gart_table_vram_pin(struct radeon_device *rdev) · 164 unmodified lines
165165 radeon_bo_unpin(rdev->gart.robj);
166166 radeon_bo_unreserve(rdev->gart.robj);
167167 rdev->gart.table_addr = gpu_addr;
168+
169+ if (!r) {
170+ int i;
171+
172+ /* We might have dropped some GART table updates while it wasn't
173+ * mapped, restore all entries
174+ */
175+ for (i = 0; i < rdev->gart.num_gpu_pages; i++)
176+ radeon_gart_set_page(rdev, i, rdev->gart.pages_entry[i]);
177+ mb();
178+ radeon_gart_tlb_flush(rdev);
179+ }
180+
168181 return r;
169182 }
170183
@@ -228,7 +241,6 @@ void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset, · 57 unmodified lines
228241 unsigned t;
229242 unsigned p;
230243 int i, j;
231− u64 page_base;
232244
233245 if (!rdev->gart.ready) {
234246 WARN(1, "trying to unbind memory from uninitialized GART !\n");
@@ -239,14 +251,12 @@ void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset, · 4 unmodified lines
239251 for (i = 0; i < pages; i++, p++) {
240252 if (rdev->gart.pages[p]) {
241253 rdev->gart.pages[p] = NULL;
242− rdev->gart.pages_addr[p] = rdev->dummy_page.addr;
243− page_base = rdev->gart.pages_addr[p];
244254 for (j = 0; j < (PAGE_SIZE / RADEON_GPU_PAGE_SIZE); j++, t++) {
255+ rdev->gart.pages_entry[t] = rdev->dummy_page.entry;
245256 if (rdev->gart.ptr) {
246− radeon_gart_set_page(rdev, t, page_base,
247− RADEON_GART_PAGE_DUMMY);
257+ radeon_gart_set_page(rdev, t,
258+ rdev->dummy_page.entry);
248259 }
249− page_base += RADEON_GPU_PAGE_SIZE;
250260 }
251261 }
252262 }
@@ -274,7 +284,7 @@ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset, · 21 unmodified lines
274284 {
275285 unsigned t;
276286 unsigned p;
277− uint64_t page_base;
287+ uint64_t page_base, page_entry;
278288 int i, j;
279289
280290 if (!rdev->gart.ready) {
@@ -285,14 +295,15 @@ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset, · 4 unmodified lines
285295 p = t / (PAGE_SIZE / RADEON_GPU_PAGE_SIZE);
286296
287297 for (i = 0; i < pages; i++, p++) {
288− rdev->gart.pages_addr[p] = dma_addr[i];
289298 rdev->gart.pages[p] = pagelist[i];
290− if (rdev->gart.ptr) {
291− page_base = rdev->gart.pages_addr[p];
292− for (j = 0; j < (PAGE_SIZE / RADEON_GPU_PAGE_SIZE); j++, t++) {
293− radeon_gart_set_page(rdev, t, page_base, flags);
294− page_base += RADEON_GPU_PAGE_SIZE;
299+ page_base = dma_addr[i];
300+ for (j = 0; j < (PAGE_SIZE / RADEON_GPU_PAGE_SIZE); j++, t++) {
301+ page_entry = radeon_gart_get_page_entry(page_base, flags);
302+ rdev->gart.pages_entry[t] = page_entry;
303+ if (rdev->gart.ptr) {
304+ radeon_gart_set_page(rdev, t, page_entry);
295305 }
306+ page_base += RADEON_GPU_PAGE_SIZE;
296307 }
297308 }
298309 mb();
@@ -334,16 +345,15 @@ int radeon_gart_init(struct radeon_device *rdev) · 35 unmodified lines
334345 radeon_gart_fini(rdev);
335346 return -ENOMEM;
336347 }
337− rdev->gart.pages_addr = vzalloc(sizeof(dma_addr_t) *
338− rdev->gart.num_cpu_pages);
339− if (rdev->gart.pages_addr == NULL) {
348+ rdev->gart.pages_entry = vmalloc(sizeof(uint64_t) *
349+ rdev->gart.num_gpu_pages);
350+ if (rdev->gart.pages_entry == NULL) {
340351 radeon_gart_fini(rdev);
341352 return -ENOMEM;
342353 }
343354 /* set GART entry to point to the dummy page by default */
344− for (i = 0; i < rdev->gart.num_cpu_pages; i++) {
345− rdev->gart.pages_addr[i] = rdev->dummy_page.addr;
346− }
355+ for (i = 0; i < rdev->gart.num_gpu_pages; i++)
356+ rdev->gart.pages_entry[i] = rdev->dummy_page.entry;
347357 return 0;
348358 }
349359
@@ -356,15 +366,15 @@ int radeon_gart_init(struct radeon_device *rdev) · 6 unmodified lines
356366 */
357367 void radeon_gart_fini(struct radeon_device *rdev)
358368 {
359− if (rdev->gart.pages && rdev->gart.pages_addr && rdev->gart.ready) {
369+ if (rdev->gart.ready) {
360370 /* unbind pages */
361371 radeon_gart_unbind(rdev, 0, rdev->gart.num_cpu_pages);
362372 }
363373 rdev->gart.ready = false;
364374 vfree(rdev->gart.pages);
365− vfree(rdev->gart.pages_addr);
375+ vfree(rdev->gart.pages_entry);
366376 rdev->gart.pages = NULL;
367− rdev->gart.pages_addr = NULL;
377+ rdev->gart.pages_entry = NULL;
368378
369379 radeon_dummy_page_fini(rdev);
370380 }
drivers/gpu/drm/radeon/radeon_kfd.c+1−1
@@ -436,7 +436,7 @@ static int kgd_init_memory(struct kgd_dev *kgd) · 435 unmodified lines
436436 static int kgd_init_pipeline(struct kgd_dev *kgd, uint32_t pipe_id,
437437 uint32_t hpd_size, uint64_t hpd_gpu_addr)
438438 {
439− uint32_t mec = (++pipe_id / CIK_PIPE_PER_MEC) + 1;
439+ uint32_t mec = (pipe_id / CIK_PIPE_PER_MEC) + 1;
440440 uint32_t pipe = (pipe_id % CIK_PIPE_PER_MEC);
441441
442442 lock_srbm(kgd, mec, pipe, 0, 0);
drivers/gpu/drm/radeon/radeon_vm.c+2−4
@@ -587,10 +587,8 @@ uint64_t radeon_vm_map_gart(struct radeon_device *rdev, uint64_t addr) · 586 unmodified lines
587587 uint64_t result;
588588
589589 /* page table offset */
590− result = rdev->gart.pages_addr[addr >> PAGE_SHIFT];
591−
592− /* in case cpu page size != gpu page size*/
593− result |= addr & (~PAGE_MASK);
590+ result = rdev->gart.pages_entry[addr >> RADEON_GPU_PAGE_SHIFT];
591+ result &= ~RADEON_GPU_PAGE_MASK;
594592
595593 return result;
596594 }
drivers/gpu/drm/radeon/rs400.c+9−5
@@ -212,11 +212,9 @@ void rs400_gart_fini(struct radeon_device *rdev) · 211 unmodified lines
212212 #define RS400_PTE_WRITEABLE (1 << 2)
213213 #define RS400_PTE_READABLE (1 << 3)
214214
215−void rs400_gart_set_page(struct radeon_device *rdev, unsigned i,
216− uint64_t addr, uint32_t flags)
215+uint64_t rs400_gart_get_page_entry(uint64_t addr, uint32_t flags)
217216 {
218217 uint32_t entry;
219− u32 *gtt = rdev->gart.ptr;
220218
221219 entry = (lower_32_bits(addr) & PAGE_MASK) |
222220 ((upper_32_bits(addr) & 0xff) << 4);
@@ -226,8 +224,14 @@ void rs400_gart_set_page(struct radeon_device *rdev, unsigned i, · 3 unmodified lines
226224 entry |= RS400_PTE_WRITEABLE;
227225 if (!(flags & RADEON_GART_PAGE_SNOOP))
228226 entry |= RS400_PTE_UNSNOOPED;
229− entry = cpu_to_le32(entry);
230− gtt[i] = entry;
227+ return entry;
228+}
229+
230+void rs400_gart_set_page(struct radeon_device *rdev, unsigned i,
231+ uint64_t entry)
232+{
233+ u32 *gtt = rdev->gart.ptr;
234+ gtt[i] = cpu_to_le32(lower_32_bits(entry));
231235 }
232236
233237 int rs400_mc_wait_for_idle(struct radeon_device *rdev)
drivers/gpu/drm/radeon/rs600.c+9−5
@@ -625,11 +625,8 @@ static void rs600_gart_fini(struct radeon_device *rdev) · 624 unmodified lines
625625 radeon_gart_table_vram_free(rdev);
626626 }
627627
628−void rs600_gart_set_page(struct radeon_device *rdev, unsigned i,
629− uint64_t addr, uint32_t flags)
628+uint64_t rs600_gart_get_page_entry(uint64_t addr, uint32_t flags)
630629 {
631− void __iomem *ptr = (void *)rdev->gart.ptr;
632−
633630 addr = addr & 0xFFFFFFFFFFFFF000ULL;
634631 addr |= R600_PTE_SYSTEM;
635632 if (flags & RADEON_GART_PAGE_VALID)
@@ -640,7 +637,14 @@ void rs600_gart_set_page(struct radeon_device *rdev, unsigned i, · 4 unmodified lines
640637 addr |= R600_PTE_WRITEABLE;
641638 if (flags & RADEON_GART_PAGE_SNOOP)
642639 addr |= R600_PTE_SNOOPED;
643− writeq(addr, ptr + (i * 8));
640+ return addr;
641+}
642+
643+void rs600_gart_set_page(struct radeon_device *rdev, unsigned i,
644+ uint64_t entry)
645+{
646+ void __iomem *ptr = (void *)rdev->gart.ptr;
647+ writeq(entry, ptr + (i * 8));
644648 }
645649
646650 int rs600_irq_set(struct radeon_device *rdev)
drivers/gpu/drm/radeon/si_dma.c+0−1
@@ -123,7 +123,6 @@ void si_dma_vm_write_pages(struct radeon_device *rdev, · 122 unmodified lines
123123 for (; ndw > 0; ndw -= 2, --count, pe += 8) {
124124 if (flags & R600_PTE_SYSTEM) {
125125 value = radeon_vm_map_gart(rdev, addr);
126− value &= 0xFFFFFFFFFFFFF000ULL;
127126 } else if (flags & R600_PTE_VALID) {
128127 value = addr;
129128 } else {
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c+5−23
@@ -406,11 +406,9 @@ int vmw_3d_resource_inc(struct vmw_private *dev_priv, · 405 unmodified lines
406406 if (unlikely(ret != 0))
407407 --dev_priv->num_3d_resources;
408408 } else if (unhide_svga) {
409− mutex_lock(&dev_priv->hw_mutex);
410409 vmw_write(dev_priv, SVGA_REG_ENABLE,
411410 vmw_read(dev_priv, SVGA_REG_ENABLE) &
412411 ~SVGA_REG_ENABLE_HIDE);
413− mutex_unlock(&dev_priv->hw_mutex);
414412 }
415413
416414 mutex_unlock(&dev_priv->release_mutex);
@@ -433,13 +431,10 @@ void vmw_3d_resource_dec(struct vmw_private *dev_priv, · 16 unmodified lines
433431 mutex_lock(&dev_priv->release_mutex);
434432 if (unlikely(--dev_priv->num_3d_resources == 0))
435433 vmw_release_device(dev_priv);
436− else if (hide_svga) {
437− mutex_lock(&dev_priv->hw_mutex);
434+ else if (hide_svga)
438435 vmw_write(dev_priv, SVGA_REG_ENABLE,
439436 vmw_read(dev_priv, SVGA_REG_ENABLE) |
440437 SVGA_REG_ENABLE_HIDE);
441− mutex_unlock(&dev_priv->hw_mutex);
442− }
443438
444439 n3d = (int32_t) dev_priv->num_3d_resources;
445440 mutex_unlock(&dev_priv->release_mutex);
@@ -600,12 +595,14 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) · 154 unmodified lines
600595 dev_priv->dev = dev;
601596 dev_priv->vmw_chipset = chipset;
602597 dev_priv->last_read_seqno = (uint32_t) -100;
603− mutex_init(&dev_priv->hw_mutex);
604598 mutex_init(&dev_priv->cmdbuf_mutex);
605599 mutex_init(&dev_priv->release_mutex);
606600 mutex_init(&dev_priv->binding_mutex);
607601 rwlock_init(&dev_priv->resource_lock);
608602 ttm_lock_init(&dev_priv->reservation_sem);
603+ spin_lock_init(&dev_priv->hw_lock);
604+ spin_lock_init(&dev_priv->waiter_lock);
605+ spin_lock_init(&dev_priv->cap_lock);
609606
610607 for (i = vmw_res_context; i < vmw_res_max; ++i) {
611608 idr_init(&dev_priv->res_idr[i]);
@@ -626,14 +623,11 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) · 14 unmodified lines
626623
627624 dev_priv->enable_fb = enable_fbdev;
628625
629− mutex_lock(&dev_priv->hw_mutex);
630−
631626 vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);
632627 svga_id = vmw_read(dev_priv, SVGA_REG_ID);
633628 if (svga_id != SVGA_ID_2) {
634629 ret = -ENOSYS;
635630 DRM_ERROR("Unsupported SVGA ID 0x%x\n", svga_id);
636− mutex_unlock(&dev_priv->hw_mutex);
637631 goto out_err0;
638632 }
639633
@@ -683,10 +677,8 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) · 43 unmodified lines
683677 dev_priv->prim_bb_mem = dev_priv->vram_size;
684678
685679 ret = vmw_dma_masks(dev_priv);
686− if (unlikely(ret != 0)) {
687− mutex_unlock(&dev_priv->hw_mutex);
680+ if (unlikely(ret != 0))
688681 goto out_err0;
689− }
690682
691683 /*
692684 * Limit back buffer size to VRAM size. Remove this once
@@ -695,8 +687,6 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) · 2 unmodified lines
695687 if (dev_priv->prim_bb_mem > dev_priv->vram_size)
696688 dev_priv->prim_bb_mem = dev_priv->vram_size;
697689
698− mutex_unlock(&dev_priv->hw_mutex);
699−
700690 vmw_print_capabilities(dev_priv->capabilities);
701691
702692 if (dev_priv->capabilities & SVGA_CAP_GMR2) {
@@ -1160,9 +1150,7 @@ static int vmw_master_set(struct drm_device *dev, · 457 unmodified lines
11601150 if (unlikely(ret != 0))
11611151 return ret;
11621152 vmw_kms_save_vga(dev_priv);
1163− mutex_lock(&dev_priv->hw_mutex);
11641153 vmw_write(dev_priv, SVGA_REG_TRACES, 0);
1165− mutex_unlock(&dev_priv->hw_mutex);
11661154 }
11671155
11681156 if (active) {
@@ -1196,9 +1184,7 @@ out_no_active_lock: · 27 unmodified lines
11961184 if (!dev_priv->enable_fb) {
11971185 vmw_kms_restore_vga(dev_priv);
11981186 vmw_3d_resource_dec(dev_priv, true);
1199− mutex_lock(&dev_priv->hw_mutex);
12001187 vmw_write(dev_priv, SVGA_REG_TRACES, 1);
1201− mutex_unlock(&dev_priv->hw_mutex);
12021188 }
12031189 return ret;
12041190 }
@@ -1233,9 +1219,7 @@ static void vmw_master_drop(struct drm_device *dev, · 28 unmodified lines
12331219 DRM_ERROR("Unable to clean VRAM on master drop.\n");
12341220 vmw_kms_restore_vga(dev_priv);
12351221 vmw_3d_resource_dec(dev_priv, true);
1236− mutex_lock(&dev_priv->hw_mutex);
12371222 vmw_write(dev_priv, SVGA_REG_TRACES, 1);
1238− mutex_unlock(&dev_priv->hw_mutex);
12391223 }
12401224
12411225 dev_priv->active_master = &dev_priv->fbdev_master;
@@ -1367,10 +1351,8 @@ static void vmw_pm_complete(struct device *kdev) · 125 unmodified lines
13671351 struct drm_device *dev = pci_get_drvdata(pdev);
13681352 struct vmw_private *dev_priv = vmw_priv(dev);
13691353
1370− mutex_lock(&dev_priv->hw_mutex);
13711354 vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);
13721355 (void) vmw_read(dev_priv, SVGA_REG_ID);
1373− mutex_unlock(&dev_priv->hw_mutex);
13741356
13751357 /**
13761358 * Reclaim 3d reference held by fbdev and potentially
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h+21−4
@@ -399,7 +399,8 @@ struct vmw_private { · 398 unmodified lines
399399 uint32_t memory_size;
400400 bool has_gmr;
401401 bool has_mob;
402− struct mutex hw_mutex;
402+ spinlock_t hw_lock;
403+ spinlock_t cap_lock;
403404
404405 /*
405406 * VGA registers.
@@ -449,8 +450,9 @@ struct vmw_private { · 43 unmodified lines
449450 atomic_t marker_seq;
450451 wait_queue_head_t fence_queue;
451452 wait_queue_head_t fifo_queue;
452− int fence_queue_waiters; /* Protected by hw_mutex */
453− int goal_queue_waiters; /* Protected by hw_mutex */
453+ spinlock_t waiter_lock;
454+ int fence_queue_waiters; /* Protected by waiter_lock */
455+ int goal_queue_waiters; /* Protected by waiter_lock */
454456 atomic_t fifo_queue_waiters;
455457 uint32_t last_read_seqno;
456458 spinlock_t irq_lock;
@@ -553,20 +555,35 @@ static inline struct vmw_master *vmw_master(struct drm_master *master) · 96 unmodified lines
553555 return (struct vmw_master *) master->driver_priv;
554556 }
555557
558+/*
559+ * The locking here is fine-grained, so that it is performed once
560+ * for every read- and write operation. This is of course costly, but we
561+ * don't perform much register access in the timing critical paths anyway.
562+ * Instead we have the extra benefit of being sure that we don't forget
563+ * the hw lock around register accesses.
564+ */
556565 static inline void vmw_write(struct vmw_private *dev_priv,
557566 unsigned int offset, uint32_t value)
558567 {
568+ unsigned long irq_flags;
569+
570+ spin_lock_irqsave(&dev_priv->hw_lock, irq_flags);
559571 outl(offset, dev_priv->io_start + VMWGFX_INDEX_PORT);
560572 outl(value, dev_priv->io_start + VMWGFX_VALUE_PORT);
573+ spin_unlock_irqrestore(&dev_priv->hw_lock, irq_flags);
561574 }
562575
563576 static inline uint32_t vmw_read(struct vmw_private *dev_priv,
564577 unsigned int offset)
565578 {
566− uint32_t val;
579+ unsigned long irq_flags;
580+ u32 val;
567581
582+ spin_lock_irqsave(&dev_priv->hw_lock, irq_flags);
568583 outl(offset, dev_priv->io_start + VMWGFX_INDEX_PORT);
569584 val = inl(dev_priv->io_start + VMWGFX_VALUE_PORT);
585+ spin_unlock_irqrestore(&dev_priv->hw_lock, irq_flags);
586+
570587 return val;
571588 }
572589
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c+2−16
@@ -35,7 +35,7 @@ struct vmw_fence_manager { · 34 unmodified lines
3535 struct vmw_private *dev_priv;
3636 spinlock_t lock;
3737 struct list_head fence_list;
38− struct work_struct work, ping_work;
38+ struct work_struct work;
3939 u32 user_fence_size;
4040 u32 fence_size;
4141 u32 event_fence_action_size;
@@ -134,14 +134,6 @@ static const char *vmw_fence_get_timeline_name(struct fence *f) · 92 unmodified lines
134134 return "svga";
135135 }
136136
137−static void vmw_fence_ping_func(struct work_struct *work)
138−{
139− struct vmw_fence_manager *fman =
140− container_of(work, struct vmw_fence_manager, ping_work);
141−
142− vmw_fifo_ping_host(fman->dev_priv, SVGA_SYNC_GENERIC);
143−}
144−
145137 static bool vmw_fence_enable_signaling(struct fence *f)
146138 {
147139 struct vmw_fence_obj *fence =
@@ -155,11 +147,7 @@ static bool vmw_fence_enable_signaling(struct fence *f) · 7 unmodified lines
155147 if (seqno - fence->base.seqno < VMW_FENCE_WRAP)
156148 return false;
157149
158− if (mutex_trylock(&dev_priv->hw_mutex)) {
159− vmw_fifo_ping_host_locked(dev_priv, SVGA_SYNC_GENERIC);
160− mutex_unlock(&dev_priv->hw_mutex);
161− } else
162− schedule_work(&fman->ping_work);
150+ vmw_fifo_ping_host(dev_priv, SVGA_SYNC_GENERIC);
163151
164152 return true;
165153 }
@@ -305,7 +293,6 @@ struct vmw_fence_manager *vmw_fence_manager_init(struct vmw_private *dev_priv) · 139 unmodified lines
305293 INIT_LIST_HEAD(&fman->fence_list);
306294 INIT_LIST_HEAD(&fman->cleanup_list);
307295 INIT_WORK(&fman->work, &vmw_fence_work_func);
308− INIT_WORK(&fman->ping_work, &vmw_fence_ping_func);
309296 fman->fifo_down = true;
310297 fman->user_fence_size = ttm_round_pot(sizeof(struct vmw_user_fence));
311298 fman->fence_size = ttm_round_pot(sizeof(struct vmw_fence_obj));
@@ -323,7 +310,6 @@ void vmw_fence_manager_takedown(struct vmw_fence_manager *fman) · 11 unmodified lines
323310 bool lists_empty;
324311
325312 (void) cancel_work_sync(&fman->work);
326− (void) cancel_work_sync(&fman->ping_work);
327313
328314 spin_lock_irqsave(&fman->lock, irq_flags);
329315 lists_empty = list_empty(&fman->fence_list) &&
drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c+15−21
@@ -44,10 +44,10 @@ bool vmw_fifo_have_3d(struct vmw_private *dev_priv) · 43 unmodified lines
4444 if (!dev_priv->has_mob)
4545 return false;
4646
47− mutex_lock(&dev_priv->hw_mutex);
47+ spin_lock(&dev_priv->cap_lock);
4848 vmw_write(dev_priv, SVGA_REG_DEV_CAP, SVGA3D_DEVCAP_3D);
4949 result = vmw_read(dev_priv, SVGA_REG_DEV_CAP);
50− mutex_unlock(&dev_priv->hw_mutex);
50+ spin_unlock(&dev_priv->cap_lock);
5151
5252 return (result != 0);
5353 }
@@ -120,7 +120,6 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) · 66 unmodified lines
120120 DRM_INFO("height %d\n", vmw_read(dev_priv, SVGA_REG_HEIGHT));
121121 DRM_INFO("bpp %d\n", vmw_read(dev_priv, SVGA_REG_BITS_PER_PIXEL));
122122
123− mutex_lock(&dev_priv->hw_mutex);
124123 dev_priv->enable_state = vmw_read(dev_priv, SVGA_REG_ENABLE);
125124 dev_priv->config_done_state = vmw_read(dev_priv, SVGA_REG_CONFIG_DONE);
126125 dev_priv->traces_state = vmw_read(dev_priv, SVGA_REG_TRACES);
@@ -143,7 +142,6 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) · 16 unmodified lines
143142 mb();
144143
145144 vmw_write(dev_priv, SVGA_REG_CONFIG_DONE, 1);
146− mutex_unlock(&dev_priv->hw_mutex);
147145
148146 max = ioread32(fifo_mem + SVGA_FIFO_MAX);
149147 min = ioread32(fifo_mem + SVGA_FIFO_MIN);
@@ -160,31 +158,28 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) · 10 unmodified lines
160158 return vmw_fifo_send_fence(dev_priv, &dummy);
161159 }
162160
163−void vmw_fifo_ping_host_locked(struct vmw_private *dev_priv, uint32_t reason)
161+void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason)
164162 {
165163 __le32 __iomem *fifo_mem = dev_priv->mmio_virt;
164+ static DEFINE_SPINLOCK(ping_lock);
165+ unsigned long irq_flags;
166166
167+ /*
168+ * The ping_lock is needed because we don't have an atomic
169+ * test-and-set of the SVGA_FIFO_BUSY register.
170+ */
171+ spin_lock_irqsave(&ping_lock, irq_flags);
167172 if (unlikely(ioread32(fifo_mem + SVGA_FIFO_BUSY) == 0)) {
168173 iowrite32(1, fifo_mem + SVGA_FIFO_BUSY);
169174 vmw_write(dev_priv, SVGA_REG_SYNC, reason);
170175 }
171−}
172−
173−void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason)
174−{
175− mutex_lock(&dev_priv->hw_mutex);
176−
177− vmw_fifo_ping_host_locked(dev_priv, reason);
178−
179− mutex_unlock(&dev_priv->hw_mutex);
176+ spin_unlock_irqrestore(&ping_lock, irq_flags);
180177 }
181178
182179 void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
183180 {
184181 __le32 __iomem *fifo_mem = dev_priv->mmio_virt;
185182
186− mutex_lock(&dev_priv->hw_mutex);
187−
188183 vmw_write(dev_priv, SVGA_REG_SYNC, SVGA_SYNC_GENERIC);
189184 while (vmw_read(dev_priv, SVGA_REG_BUSY) != 0)
190185 ;
@@ -198,7 +193,6 @@ void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) · 7 unmodified lines
198193 vmw_write(dev_priv, SVGA_REG_TRACES,
199194 dev_priv->traces_state);
200195
201− mutex_unlock(&dev_priv->hw_mutex);
202196 vmw_marker_queue_takedown(&fifo->marker_queue);
203197
204198 if (likely(fifo->static_buffer != NULL)) {
@@ -271,7 +265,7 @@ static int vmw_fifo_wait(struct vmw_private *dev_priv, · 66 unmodified lines
271265 return vmw_fifo_wait_noirq(dev_priv, bytes,
272266 interruptible, timeout);
273267
274− mutex_lock(&dev_priv->hw_mutex);
268+ spin_lock(&dev_priv->waiter_lock);
275269 if (atomic_add_return(1, &dev_priv->fifo_queue_waiters) > 0) {
276270 spin_lock_irqsave(&dev_priv->irq_lock, irq_flags);
277271 outl(SVGA_IRQFLAG_FIFO_PROGRESS,
@@ -280,7 +274,7 @@ static int vmw_fifo_wait(struct vmw_private *dev_priv, · 2 unmodified lines
280274 vmw_write(dev_priv, SVGA_REG_IRQMASK, dev_priv->irq_mask);
281275 spin_unlock_irqrestore(&dev_priv->irq_lock, irq_flags);
282276 }
283− mutex_unlock(&dev_priv->hw_mutex);
277+ spin_unlock(&dev_priv->waiter_lock);
284278
285279 if (interruptible)
286280 ret = wait_event_interruptible_timeout
@@ -296,14 +290,14 @@ static int vmw_fifo_wait(struct vmw_private *dev_priv, · 9 unmodified lines
296290 else if (likely(ret > 0))
297291 ret = 0;
298292
299− mutex_lock(&dev_priv->hw_mutex);
293+ spin_lock(&dev_priv->waiter_lock);
300294 if (atomic_dec_and_test(&dev_priv->fifo_queue_waiters)) {
301295 spin_lock_irqsave(&dev_priv->irq_lock, irq_flags);
302296 dev_priv->irq_mask &= ~SVGA_IRQFLAG_FIFO_PROGRESS;
303297 vmw_write(dev_priv, SVGA_REG_IRQMASK, dev_priv->irq_mask);
304298 spin_unlock_irqrestore(&dev_priv->irq_lock, irq_flags);
305299 }
306− mutex_unlock(&dev_priv->hw_mutex);
300+ spin_unlock(&dev_priv->waiter_lock);
307301
308302 return ret;
309303 }
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c+4−4
@@ -135,13 +135,13 @@ static int vmw_fill_compat_cap(struct vmw_private *dev_priv, void *bounce, · 134 unmodified lines
135135 (pair_offset + max_size * sizeof(SVGA3dCapPair)) / sizeof(u32);
136136 compat_cap->header.type = SVGA3DCAPS_RECORD_DEVCAPS;
137137
138− mutex_lock(&dev_priv->hw_mutex);
138+ spin_lock(&dev_priv->cap_lock);
139139 for (i = 0; i < max_size; ++i) {
140140 vmw_write(dev_priv, SVGA_REG_DEV_CAP, i);
141141 compat_cap->pairs[i][0] = i;
142142 compat_cap->pairs[i][1] = vmw_read(dev_priv, SVGA_REG_DEV_CAP);
143143 }
144− mutex_unlock(&dev_priv->hw_mutex);
144+ spin_unlock(&dev_priv->cap_lock);
145145
146146 return 0;
147147 }
@@ -191,12 +191,12 @@ int vmw_get_cap_3d_ioctl(struct drm_device *dev, void *data, · 43 unmodified lines
191191 if (num > SVGA3D_DEVCAP_MAX)
192192 num = SVGA3D_DEVCAP_MAX;
193193
194− mutex_lock(&dev_priv->hw_mutex);
194+ spin_lock(&dev_priv->cap_lock);
195195 for (i = 0; i < num; ++i) {
196196 vmw_write(dev_priv, SVGA_REG_DEV_CAP, i);
197197 *bounce32++ = vmw_read(dev_priv, SVGA_REG_DEV_CAP);
198198 }
199− mutex_unlock(&dev_priv->hw_mutex);
199+ spin_unlock(&dev_priv->cap_lock);
200200 } else if (gb_objects) {
201201 ret = vmw_fill_compat_cap(dev_priv, bounce, size);
202202 if (unlikely(ret != 0))
drivers/gpu/drm/vmwgfx/vmwgfx_irq.c+9−16
@@ -62,13 +62,8 @@ irqreturn_t vmw_irq_handler(int irq, void *arg) · 61 unmodified lines
6262
6363 static bool vmw_fifo_idle(struct vmw_private *dev_priv, uint32_t seqno)
6464 {
65− uint32_t busy;
6665
67− mutex_lock(&dev_priv->hw_mutex);
68− busy = vmw_read(dev_priv, SVGA_REG_BUSY);
69− mutex_unlock(&dev_priv->hw_mutex);
70−
71− return (busy == 0);
66+ return (vmw_read(dev_priv, SVGA_REG_BUSY) == 0);
7267 }
7368
7469 void vmw_update_seqno(struct vmw_private *dev_priv,
@@ -184,7 +179,7 @@ int vmw_fallback_wait(struct vmw_private *dev_priv, · 109 unmodified lines
184179
185180 void vmw_seqno_waiter_add(struct vmw_private *dev_priv)
186181 {
187− mutex_lock(&dev_priv->hw_mutex);
182+ spin_lock(&dev_priv->waiter_lock);
188183 if (dev_priv->fence_queue_waiters++ == 0) {
189184 unsigned long irq_flags;
190185
@@ -195,12 +190,12 @@ void vmw_seqno_waiter_add(struct vmw_private *dev_priv) · 4 unmodified lines
195190 vmw_write(dev_priv, SVGA_REG_IRQMASK, dev_priv->irq_mask);
196191 spin_unlock_irqrestore(&dev_priv->irq_lock, irq_flags);
197192 }
198− mutex_unlock(&dev_priv->hw_mutex);
193+ spin_unlock(&dev_priv->waiter_lock);
199194 }
200195
201196 void vmw_seqno_waiter_remove(struct vmw_private *dev_priv)
202197 {
203− mutex_lock(&dev_priv->hw_mutex);
198+ spin_lock(&dev_priv->waiter_lock);
204199 if (--dev_priv->fence_queue_waiters == 0) {
205200 unsigned long irq_flags;
206201
@@ -209,13 +204,13 @@ void vmw_seqno_waiter_remove(struct vmw_private *dev_priv) · 2 unmodified lines
209204 vmw_write(dev_priv, SVGA_REG_IRQMASK, dev_priv->irq_mask);
210205 spin_unlock_irqrestore(&dev_priv->irq_lock, irq_flags);
211206 }
212− mutex_unlock(&dev_priv->hw_mutex);
207+ spin_unlock(&dev_priv->waiter_lock);
213208 }
214209
215210
216211 void vmw_goal_waiter_add(struct vmw_private *dev_priv)
217212 {
218− mutex_lock(&dev_priv->hw_mutex);
213+ spin_lock(&dev_priv->waiter_lock);
219214 if (dev_priv->goal_queue_waiters++ == 0) {
220215 unsigned long irq_flags;
221216
@@ -226,12 +221,12 @@ void vmw_goal_waiter_add(struct vmw_private *dev_priv) · 4 unmodified lines
226221 vmw_write(dev_priv, SVGA_REG_IRQMASK, dev_priv->irq_mask);
227222 spin_unlock_irqrestore(&dev_priv->irq_lock, irq_flags);
228223 }
229− mutex_unlock(&dev_priv->hw_mutex);
224+ spin_unlock(&dev_priv->waiter_lock);
230225 }
231226
232227 void vmw_goal_waiter_remove(struct vmw_private *dev_priv)
233228 {
234− mutex_lock(&dev_priv->hw_mutex);
229+ spin_lock(&dev_priv->waiter_lock);
235230 if (--dev_priv->goal_queue_waiters == 0) {
236231 unsigned long irq_flags;
237232
@@ -240,7 +235,7 @@ void vmw_goal_waiter_remove(struct vmw_private *dev_priv) · 2 unmodified lines
240235 vmw_write(dev_priv, SVGA_REG_IRQMASK, dev_priv->irq_mask);
241236 spin_unlock_irqrestore(&dev_priv->irq_lock, irq_flags);
242237 }
243− mutex_unlock(&dev_priv->hw_mutex);
238+ spin_unlock(&dev_priv->waiter_lock);
244239 }
245240
246241 int vmw_wait_seqno(struct vmw_private *dev_priv,
@@ -315,9 +310,7 @@ void vmw_irq_uninstall(struct drm_device *dev) · 68 unmodified lines
315310 if (!(dev_priv->capabilities & SVGA_CAP_IRQMASK))
316311 return;
317312
318− mutex_lock(&dev_priv->hw_mutex);
319313 vmw_write(dev_priv, SVGA_REG_IRQMASK, 0);
320− mutex_unlock(&dev_priv->hw_mutex);
321314
322315 status = inl(dev_priv->io_start + VMWGFX_IRQSTATUS_PORT);
323316 outl(status, dev_priv->io_start + VMWGFX_IRQSTATUS_PORT);
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c+0−2
@@ -1828,9 +1828,7 @@ vmw_du_connector_detect(struct drm_connector *connector, bool force) · 1827 unmodified lines
18281828 struct vmw_private *dev_priv = vmw_priv(dev);
18291829 struct vmw_display_unit *du = vmw_connector_to_du(connector);
18301830
1831− mutex_lock(&dev_priv->hw_mutex);
18321831 num_displays = vmw_read(dev_priv, SVGA_REG_NUM_DISPLAYS);
1833− mutex_unlock(&dev_priv->hw_mutex);
18341832
18351833 return ((vmw_connector_to_du(connector)->unit < num_displays &&
18361834 du->pref_active) ?
drivers/i2c/busses/Kconfig+1−0
@@ -881,6 +881,7 @@ config I2C_XLR · 880 unmodified lines
881881 config I2C_RCAR
882882 tristate "Renesas R-Car I2C Controller"
883883 depends on ARCH_SHMOBILE || COMPILE_TEST
884+ select I2C_SLAVE
884885 help
885886 If you say yes to this option, support will be included for the
886887 R-Car I2C controller.
drivers/i2c/busses/i2c-s3c2410.c+17−6
@@ -785,14 +785,16 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, · 784 unmodified lines
785785 int ret;
786786
787787 pm_runtime_get_sync(&adap->dev);
788− clk_prepare_enable(i2c->clk);
788+ ret = clk_enable(i2c->clk);
789+ if (ret)
790+ return ret;
789791
790792 for (retry = 0; retry < adap->retries; retry++) {
791793
792794 ret = s3c24xx_i2c_doxfer(i2c, msgs, num);
793795
794796 if (ret != -EAGAIN) {
795− clk_disable_unprepare(i2c->clk);
797+ clk_disable(i2c->clk);
796798 pm_runtime_put(&adap->dev);
797799 return ret;
798800 }
@@ -802,7 +804,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, · 3 unmodified lines
802804 udelay(100);
803805 }
804806
805− clk_disable_unprepare(i2c->clk);
807+ clk_disable(i2c->clk);
806808 pm_runtime_put(&adap->dev);
807809 return -EREMOTEIO;
808810 }
@@ -1197,7 +1199,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) · 388 unmodified lines
11971199
11981200 clk_prepare_enable(i2c->clk);
11991201 ret = s3c24xx_i2c_init(i2c);
1200− clk_disable_unprepare(i2c->clk);
1202+ clk_disable(i2c->clk);
12011203 if (ret != 0) {
12021204 dev_err(&pdev->dev, "I2C controller init failed\n");
12031205 return ret;
@@ -1210,6 +1212,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) · 6 unmodified lines
12101212 i2c->irq = ret = platform_get_irq(pdev, 0);
12111213 if (ret <= 0) {
12121214 dev_err(&pdev->dev, "cannot find IRQ\n");
1215+ clk_unprepare(i2c->clk);
12131216 return ret;
12141217 }
12151218
@@ -1218,6 +1221,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) · 2 unmodified lines
12181221
12191222 if (ret != 0) {
12201223 dev_err(&pdev->dev, "cannot claim IRQ %d\n", i2c->irq);
1224+ clk_unprepare(i2c->clk);
12211225 return ret;
12221226 }
12231227 }
@@ -1225,6 +1229,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) · 1 unmodified line
12251229 ret = s3c24xx_i2c_register_cpufreq(i2c);
12261230 if (ret < 0) {
12271231 dev_err(&pdev->dev, "failed to register cpufreq notifier\n");
1232+ clk_unprepare(i2c->clk);
12281233 return ret;
12291234 }
12301235
@@ -1241,6 +1246,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) · 10 unmodified lines
12411246 if (ret < 0) {
12421247 dev_err(&pdev->dev, "failed to add bus to i2c core\n");
12431248 s3c24xx_i2c_deregister_cpufreq(i2c);
1249+ clk_unprepare(i2c->clk);
12441250 return ret;
12451251 }
12461252
@@ -1262,6 +1268,8 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev) · 15 unmodified lines
12621268 {
12631269 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
12641270
1271+ clk_unprepare(i2c->clk);
1272+
12651273 pm_runtime_disable(&i2c->adap.dev);
12661274 pm_runtime_disable(&pdev->dev);
12671275
@@ -1293,13 +1301,16 @@ static int s3c24xx_i2c_resume_noirq(struct device *dev) · 25 unmodified lines
12931301 {
12941302 struct platform_device *pdev = to_platform_device(dev);
12951303 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
1304+ int ret;
12961305
12971306 if (!IS_ERR(i2c->sysreg))
12981307 regmap_write(i2c->sysreg, EXYNOS5_SYS_I2C_CFG, i2c->sys_i2c_cfg);
12991308
1300− clk_prepare_enable(i2c->clk);
1309+ ret = clk_enable(i2c->clk);
1310+ if (ret)
1311+ return ret;
13011312 s3c24xx_i2c_init(i2c);
1302− clk_disable_unprepare(i2c->clk);
1313+ clk_disable(i2c->clk);
13031314 i2c->suspended = 0;
13041315
13051316 return 0;
drivers/i2c/busses/i2c-sh_mobile.c+11−1
@@ -139,6 +139,7 @@ struct sh_mobile_i2c_data { · 138 unmodified lines
139139 int pos;
140140 int sr;
141141 bool send_stop;
142+ bool stop_after_dma;
142143
143144 struct resource *res;
144145 struct dma_chan *dma_tx;
@@ -407,7 +408,7 @@ static int sh_mobile_i2c_isr_tx(struct sh_mobile_i2c_data *pd) · 262 unmodified lines
407408
408409 if (pd->pos == pd->msg->len) {
409410 /* Send stop if we haven't yet (DMA case) */
410− if (pd->send_stop && (iic_rd(pd, ICCR) & ICCR_BBSY))
411+ if (pd->send_stop && pd->stop_after_dma)
411412 i2c_op(pd, OP_TX_STOP, 0);
412413 return 1;
413414 }
@@ -449,6 +450,13 @@ static int sh_mobile_i2c_isr_rx(struct sh_mobile_i2c_data *pd) · 35 unmodified lines
449450 real_pos = pd->pos - 2;
450451
451452 if (pd->pos == pd->msg->len) {
453+ if (pd->stop_after_dma) {
454+ /* Simulate PIO end condition after DMA transfer */
455+ i2c_op(pd, OP_RX_STOP, 0);
456+ pd->pos++;
457+ break;
458+ }
459+
452460 if (real_pos < 0) {
453461 i2c_op(pd, OP_RX_STOP, 0);
454462 break;
@@ -536,6 +544,7 @@ static void sh_mobile_i2c_dma_callback(void *data) · 81 unmodified lines
536544
537545 sh_mobile_i2c_dma_unmap(pd);
538546 pd->pos = pd->msg->len;
547+ pd->stop_after_dma = true;
539548
540549 iic_set_clr(pd, ICIC, 0, ICIC_TDMAE | ICIC_RDMAE);
541550 }
@@ -726,6 +735,7 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter, · 184 unmodified lines
726735 bool do_start = pd->send_stop || !i;
727736 msg = &msgs[i];
728737 pd->send_stop = i == num - 1 || msg->flags & I2C_M_STOP;
738+ pd->stop_after_dma = false;
729739
730740 err = start_ch(pd, msg, do_start);
731741 if (err)
drivers/i2c/i2c-core.c+2−0
@@ -2972,6 +2972,7 @@ trace: · 2971 unmodified lines
29722972 }
29732973 EXPORT_SYMBOL(i2c_smbus_xfer);
29742974
2975+#if IS_ENABLED(CONFIG_I2C_SLAVE)
29752976 int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb)
29762977 {
29772978 int ret;
@@ -3019,6 +3020,7 @@ int i2c_slave_unregister(struct i2c_client *client) · 41 unmodified lines
30193020 return ret;
30203021 }
30213022 EXPORT_SYMBOL_GPL(i2c_slave_unregister);
3023+#endif
30223024
30233025 MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
30243026 MODULE_DESCRIPTION("I2C-Bus main module");
drivers/i2c/i2c-slave-eeprom.c+2−2
@@ -74,7 +74,7 @@ static ssize_t i2c_slave_eeprom_bin_read(struct file *filp, struct kobject *kobj · 73 unmodified lines
7474 struct eeprom_data *eeprom;
7575 unsigned long flags;
7676
77− if (off + count >= attr->size)
77+ if (off + count > attr->size)
7878 return -EFBIG;
7979
8080 eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));
@@ -92,7 +92,7 @@ static ssize_t i2c_slave_eeprom_bin_write(struct file *filp, struct kobject *kob · 11 unmodified lines
9292 struct eeprom_data *eeprom;
9393 unsigned long flags;
9494
95− if (off + count >= attr->size)
95+ if (off + count > attr->size)
9696 return -EFBIG;
9797
9898 eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));
drivers/input/mouse/elantech.c+16−0
@@ -1097,6 +1097,8 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse, · 1096 unmodified lines
10971097 * Asus UX31 0x361f00 20, 15, 0e clickpad
10981098 * Asus UX32VD 0x361f02 00, 15, 0e clickpad
10991099 * Avatar AVIU-145A2 0x361f00 ? clickpad
1100+ * Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons
1101+ * Fujitsu LIFEBOOK E554 0x570f01 40, 14, 0c 2 hw buttons
11001102 * Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**)
11011103 * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons
11021104 * Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*)
@@ -1475,6 +1477,20 @@ static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = { · 372 unmodified lines
14751477 DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"),
14761478 },
14771479 },
1480+ {
1481+ /* Fujitsu LIFEBOOK E554 does not work with crc_enabled == 0 */
1482+ .matches = {
1483+ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
1484+ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E554"),
1485+ },
1486+ },
1487+ {
1488+ /* Fujitsu LIFEBOOK E544 does not work with crc_enabled == 0 */
1489+ .matches = {
1490+ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
1491+ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E544"),
1492+ },
1493+ },
14781494 #endif
14791495 { }
14801496 };
drivers/input/mouse/synaptics.c+4−3
@@ -135,8 +135,9 @@ static const struct min_max_quirk min_max_pnpid_table[] = { · 134 unmodified lines
135135 1232, 5710, 1156, 4696
136136 },
137137 {
138− (const char * const []){"LEN0034", "LEN0036", "LEN0039",
139− "LEN2002", "LEN2004", NULL},
138+ (const char * const []){"LEN0034", "LEN0036", "LEN0037",
139+ "LEN0039", "LEN2002", "LEN2004",
140+ NULL},
140141 1024, 5112, 2024, 4832
141142 },
142143 {
@@ -165,7 +166,7 @@ static const char * const topbuttonpad_pnp_ids[] = { · 22 unmodified lines
165166 "LEN0034", /* T431s, L440, L540, T540, W540, X1 Carbon 2nd */
166167 "LEN0035", /* X240 */
167168 "LEN0036", /* T440 */
168− "LEN0037",
169+ "LEN0037", /* X1 Carbon 2nd */
169170 "LEN0038",
170171 "LEN0039", /* T440s */
171172 "LEN0041",
drivers/input/serio/i8042-x86ia64io.h+8−0
@@ -151,6 +151,14 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = { · 150 unmodified lines
151151 DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
152152 },
153153 },
154+ {
155+ /* Medion Akoya E7225 */
156+ .matches = {
157+ DMI_MATCH(DMI_SYS_VENDOR, "Medion"),
158+ DMI_MATCH(DMI_PRODUCT_NAME, "Akoya E7225"),
159+ DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
160+ },
161+ },
154162 {
155163 /* Blue FB5601 */
156164 .matches = {
drivers/iommu/tegra-gart.c+2−1
@@ -315,6 +315,7 @@ static const struct iommu_ops gart_iommu_ops = { · 314 unmodified lines
315315 .attach_dev = gart_iommu_attach_dev,
316316 .detach_dev = gart_iommu_detach_dev,
317317 .map = gart_iommu_map,
318+ .map_sg = default_iommu_map_sg,
318319 .unmap = gart_iommu_unmap,
319320 .iova_to_phys = gart_iommu_iova_to_phys,
320321 .pgsize_bitmap = GART_IOMMU_PGSIZES,
@@ -395,7 +396,7 @@ static int tegra_gart_probe(struct platform_device *pdev) · 74 unmodified lines
395396 do_gart_setup(gart, NULL);
396397
397398 gart_handle = gart;
398− bus_set_iommu(&platform_bus_type, &gart_iommu_ops);
399+
399400 return 0;
400401 }
401402
drivers/md/dm-cache-metadata.c+5−4
@@ -683,7 +683,7 @@ static struct dm_cache_metadata *metadata_open(struct block_device *bdev, · 682 unmodified lines
683683 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
684684 if (!cmd) {
685685 DMERR("could not allocate metadata struct");
686− return NULL;
686+ return ERR_PTR(-ENOMEM);
687687 }
688688
689689 atomic_set(&cmd->ref_count, 1);
@@ -745,7 +745,7 @@ static struct dm_cache_metadata *lookup_or_open(struct block_device *bdev, · 55 unmodified lines
745745 return cmd;
746746
747747 cmd = metadata_open(bdev, data_block_size, may_format_device, policy_hint_size);
748− if (cmd) {
748+ if (!IS_ERR(cmd)) {
749749 mutex_lock(&table_lock);
750750 cmd2 = lookup(bdev);
751751 if (cmd2) {
@@ -780,9 +780,10 @@ struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev, · 28 unmodified lines
780780 {
781781 struct dm_cache_metadata *cmd = lookup_or_open(bdev, data_block_size,
782782 may_format_device, policy_hint_size);
783− if (cmd && !same_params(cmd, data_block_size)) {
783+
784+ if (!IS_ERR(cmd) && !same_params(cmd, data_block_size)) {
784785 dm_cache_metadata_close(cmd);
785− return NULL;
786+ return ERR_PTR(-EINVAL);
786787 }
787788
788789 return cmd;
drivers/md/dm-thin.c+6−0
@@ -3385,6 +3385,12 @@ static int pool_message(struct dm_target *ti, unsigned argc, char **argv) · 3384 unmodified lines
33853385 struct pool_c *pt = ti->private;
33863386 struct pool *pool = pt->pool;
33873387
3388+ if (get_pool_mode(pool) >= PM_READ_ONLY) {
3389+ DMERR("%s: unable to service pool target messages in READ_ONLY or FAIL mode",
3390+ dm_device_name(pool->pool_md));
3391+ return -EINVAL;
3392+ }
3393+
33883394 if (!strcasecmp(argv[0], "create_thin"))
33893395 r = process_create_thin_mesg(argc, argv, pool);
33903396
drivers/net/can/c_can/c_can.c+3−0
@@ -615,6 +615,9 @@ static void c_can_stop(struct net_device *dev) · 614 unmodified lines
615615
616616 c_can_irq_control(priv, false);
617617
618+ /* put ctrl to init on stop to end ongoing transmission */
619+ priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_INIT);
620+
618621 /* deactivate pins */
619622 pinctrl_pm_select_sleep_state(dev->dev.parent);
620623 priv->can.state = CAN_STATE_STOPPED;
drivers/net/can/usb/kvaser_usb.c+15−13
@@ -587,7 +587,7 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv, · 586 unmodified lines
587587 usb_sndbulkpipe(dev->udev,
588588 dev->bulk_out->bEndpointAddress),
589589 buf, msg->len,
590− kvaser_usb_simple_msg_callback, priv);
590+ kvaser_usb_simple_msg_callback, netdev);
591591 usb_anchor_urb(urb, &priv->tx_submitted);
592592
593593 err = usb_submit_urb(urb, GFP_ATOMIC);
@@ -662,11 +662,6 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev, · 68 unmodified lines
662662 priv = dev->nets[channel];
663663 stats = &priv->netdev->stats;
664664
665− if (status & M16C_STATE_BUS_RESET) {
666− kvaser_usb_unlink_tx_urbs(priv);
667− return;
668− }
669−
670665 skb = alloc_can_err_skb(priv->netdev, &cf);
671666 if (!skb) {
672667 stats->rx_dropped++;
@@ -677,7 +672,7 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev, · 4 unmodified lines
677672
678673 netdev_dbg(priv->netdev, "Error status: 0x%02x\n", status);
679674
680− if (status & M16C_STATE_BUS_OFF) {
675+ if (status & (M16C_STATE_BUS_OFF | M16C_STATE_BUS_RESET)) {
681676 cf->can_id |= CAN_ERR_BUSOFF;
682677
683678 priv->can.can_stats.bus_off++;
@@ -703,9 +698,7 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev, · 19 unmodified lines
703698 }
704699
705700 new_state = CAN_STATE_ERROR_PASSIVE;
706− }
707−
708− if (status == M16C_STATE_BUS_ERROR) {
701+ } else if (status & M16C_STATE_BUS_ERROR) {
709702 if ((priv->can.state < CAN_STATE_ERROR_WARNING) &&
710703 ((txerr >= 96) || (rxerr >= 96))) {
711704 cf->can_id |= CAN_ERR_CRTL;
@@ -715,7 +708,8 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev, · 3 unmodified lines
715708
716709 priv->can.can_stats.error_warning++;
717710 new_state = CAN_STATE_ERROR_WARNING;
718− } else if (priv->can.state > CAN_STATE_ERROR_ACTIVE) {
711+ } else if ((priv->can.state > CAN_STATE_ERROR_ACTIVE) &&
712+ ((txerr < 96) && (rxerr < 96))) {
719713 cf->can_id |= CAN_ERR_PROT;
720714 cf->data[2] = CAN_ERR_PROT_ACTIVE;
721715
@@ -1590,7 +1584,7 @@ static int kvaser_usb_probe(struct usb_interface *intf, · 868 unmodified lines
15901584 {
15911585 struct kvaser_usb *dev;
15921586 int err = -ENOMEM;
1593− int i;
1587+ int i, retry = 3;
15941588
15951589 dev = devm_kzalloc(&intf->dev, sizeof(*dev), GFP_KERNEL);
15961590 if (!dev)
@@ -1608,7 +1602,15 @@ static int kvaser_usb_probe(struct usb_interface *intf, · 11 unmodified lines
16081602
16091603 usb_set_intfdata(intf, dev);
16101604
1611− err = kvaser_usb_get_software_info(dev);
1605+ /* On some x86 laptops, plugging a Kvaser device again after
1606+ * an unplug makes the firmware always ignore the very first
1607+ * command. For such a case, provide some room for retries
1608+ * instead of completely exiting the driver.
1609+ */
1610+ do {
1611+ err = kvaser_usb_get_software_info(dev);
1612+ } while (--retry && err == -ETIMEDOUT);
1613+
16121614 if (err) {
16131615 dev_err(&intf->dev,
16141616 "Cannot get software infos, error %d\n", err);
drivers/net/ethernet/amd/xgbe/xgbe-common.h+5−4
@@ -767,16 +767,17 @@ · 766 unmodified lines
767767 #define MTL_Q_RQOMR 0x40
768768 #define MTL_Q_RQMPOCR 0x44
769769 #define MTL_Q_RQDR 0x4c
770+#define MTL_Q_RQFCR 0x50
770771 #define MTL_Q_IER 0x70
771772 #define MTL_Q_ISR 0x74
772773
773774 /* MTL queue register entry bit positions and sizes */
775+#define MTL_Q_RQFCR_RFA_INDEX 1
776+#define MTL_Q_RQFCR_RFA_WIDTH 6
777+#define MTL_Q_RQFCR_RFD_INDEX 17
778+#define MTL_Q_RQFCR_RFD_WIDTH 6
774779 #define MTL_Q_RQOMR_EHFC_INDEX 7
775780 #define MTL_Q_RQOMR_EHFC_WIDTH 1
776−#define MTL_Q_RQOMR_RFA_INDEX 8
777−#define MTL_Q_RQOMR_RFA_WIDTH 3
778−#define MTL_Q_RQOMR_RFD_INDEX 13
779−#define MTL_Q_RQOMR_RFD_WIDTH 3
780781 #define MTL_Q_RQOMR_RQS_INDEX 16
781782 #define MTL_Q_RQOMR_RQS_WIDTH 9
782783 #define MTL_Q_RQOMR_RSF_INDEX 5
drivers/net/ethernet/amd/xgbe/xgbe-dev.c+2−2
@@ -2079,10 +2079,10 @@ static void xgbe_config_flow_control_threshold(struct xgbe_prv_data *pdata) · 2078 unmodified lines
20792079
20802080 for (i = 0; i < pdata->rx_q_count; i++) {
20812081 /* Activate flow control when less than 4k left in fifo */
2082− XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, RFA, 2);
2082+ XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQFCR, RFA, 2);
20832083
20842084 /* De-activate flow control when more than 6k left in fifo */
2085− XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, RFD, 4);
2085+ XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQFCR, RFD, 4);
20862086 }
20872087 }
20882088
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c+1−1
@@ -3175,7 +3175,7 @@ static int bnx2x_poll(struct napi_struct *napi, int budget) · 3174 unmodified lines
31753175 }
31763176 #endif
31773177 if (!bnx2x_fp_lock_napi(fp))
3178− return work_done;
3178+ return budget;
31793179
31803180 for_each_cos_in_tx_queue(fp, cos)
31813181 if (bnx2x_tx_queue_has_work(fp->txdata_ptr[cos]))
drivers/net/ethernet/cisco/enic/enic_main.c+1−1
@@ -1335,7 +1335,7 @@ static int enic_poll_msix_rq(struct napi_struct *napi, int budget) · 1334 unmodified lines
13351335 int err;
13361336
13371337 if (!enic_poll_lock_napi(&enic->rq[rq]))
1338− return work_done;
1338+ return budget;
13391339 /* Service RQ
13401340 */
13411341
drivers/net/ethernet/marvell/mv643xx_eth.c+49−10
@@ -192,6 +192,10 @@ static char mv643xx_eth_driver_version[] = "1.4"; · 191 unmodified lines
192192 #define IS_TSO_HEADER(txq, addr) \
193193 ((addr >= txq->tso_hdrs_dma) && \
194194 (addr < txq->tso_hdrs_dma + txq->tx_ring_size * TSO_HEADER_SIZE))
195+
196+#define DESC_DMA_MAP_SINGLE 0
197+#define DESC_DMA_MAP_PAGE 1
198+
195199 /*
196200 * RX/TX descriptors.
197201 */
@@ -362,6 +366,7 @@ struct tx_queue { · 164 unmodified lines
362366 dma_addr_t tso_hdrs_dma;
363367
364368 struct tx_desc *tx_desc_area;
369+ char *tx_desc_mapping; /* array to track the type of the dma mapping */
365370 dma_addr_t tx_desc_dma;
366371 int tx_desc_area_size;
367372
@@ -750,6 +755,7 @@ txq_put_data_tso(struct net_device *dev, struct tx_queue *txq, · 382 unmodified lines
750755 if (txq->tx_curr_desc == txq->tx_ring_size)
751756 txq->tx_curr_desc = 0;
752757 desc = &txq->tx_desc_area[tx_index];
758+ txq->tx_desc_mapping[tx_index] = DESC_DMA_MAP_SINGLE;
753759
754760 desc->l4i_chk = 0;
755761 desc->byte_cnt = length;
@@ -879,14 +885,13 @@ static void txq_submit_frag_skb(struct tx_queue *txq, struct sk_buff *skb) · 123 unmodified lines
879885 skb_frag_t *this_frag;
880886 int tx_index;
881887 struct tx_desc *desc;
882− void *addr;
883888
884889 this_frag = &skb_shinfo(skb)->frags[frag];
885− addr = page_address(this_frag->page.p) + this_frag->page_offset;
886890 tx_index = txq->tx_curr_desc++;
887891 if (txq->tx_curr_desc == txq->tx_ring_size)
888892 txq->tx_curr_desc = 0;
889893 desc = &txq->tx_desc_area[tx_index];
894+ txq->tx_desc_mapping[tx_index] = DESC_DMA_MAP_PAGE;
890895
891896 /*
892897 * The last fragment will generate an interrupt
@@ -902,8 +907,9 @@ static void txq_submit_frag_skb(struct tx_queue *txq, struct sk_buff *skb) · 9 unmodified lines
902907
903908 desc->l4i_chk = 0;
904909 desc->byte_cnt = skb_frag_size(this_frag);
905− desc->buf_ptr = dma_map_single(mp->dev->dev.parent, addr,
906− desc->byte_cnt, DMA_TO_DEVICE);
910+ desc->buf_ptr = skb_frag_dma_map(mp->dev->dev.parent,
911+ this_frag, 0, desc->byte_cnt,
912+ DMA_TO_DEVICE);
907913 }
908914 }
909915
@@ -936,6 +942,7 @@ static int txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb, · 26 unmodified lines
936942 if (txq->tx_curr_desc == txq->tx_ring_size)
937943 txq->tx_curr_desc = 0;
938944 desc = &txq->tx_desc_area[tx_index];
945+ txq->tx_desc_mapping[tx_index] = DESC_DMA_MAP_SINGLE;
939946
940947 if (nr_frags) {
941948 txq_submit_frag_skb(txq, skb);
@@ -1047,9 +1054,12 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force) · 105 unmodified lines
10471054 int tx_index;
10481055 struct tx_desc *desc;
10491056 u32 cmd_sts;
1057+ char desc_dma_map;
10501058
10511059 tx_index = txq->tx_used_desc;
10521060 desc = &txq->tx_desc_area[tx_index];
1061+ desc_dma_map = txq->tx_desc_mapping[tx_index];
1062+
10531063 cmd_sts = desc->cmd_sts;
10541064
10551065 if (cmd_sts & BUFFER_OWNED_BY_DMA) {
@@ -1065,9 +1075,19 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force) · 9 unmodified lines
10651075 reclaimed++;
10661076 txq->tx_desc_count--;
10671077
1068− if (!IS_TSO_HEADER(txq, desc->buf_ptr))
1069− dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr,
1070− desc->byte_cnt, DMA_TO_DEVICE);
1078+ if (!IS_TSO_HEADER(txq, desc->buf_ptr)) {
1079+
1080+ if (desc_dma_map == DESC_DMA_MAP_PAGE)
1081+ dma_unmap_page(mp->dev->dev.parent,
1082+ desc->buf_ptr,
1083+ desc->byte_cnt,
1084+ DMA_TO_DEVICE);
1085+ else
1086+ dma_unmap_single(mp->dev->dev.parent,
1087+ desc->buf_ptr,
1088+ desc->byte_cnt,
1089+ DMA_TO_DEVICE);
1090+ }
10711091
10721092 if (cmd_sts & TX_ENABLE_INTERRUPT) {
10731093 struct sk_buff *skb = __skb_dequeue(&txq->tx_skb);
@@ -1996,6 +2016,7 @@ static int txq_init(struct mv643xx_eth_private *mp, int index) · 922 unmodified lines
19962016 struct tx_queue *txq = mp->txq + index;
19972017 struct tx_desc *tx_desc;
19982018 int size;
2019+ int ret;
19992020 int i;
20002021
20012022 txq->index = index;
@@ -2048,18 +2069,34 @@ static int txq_init(struct mv643xx_eth_private *mp, int index) · 46 unmodified lines
20482069 nexti * sizeof(struct tx_desc);
20492070 }
20502071
2072+ txq->tx_desc_mapping = kcalloc(txq->tx_ring_size, sizeof(char),
2073+ GFP_KERNEL);
2074+ if (!txq->tx_desc_mapping) {
2075+ ret = -ENOMEM;
2076+ goto err_free_desc_area;
2077+ }
2078+
20512079 /* Allocate DMA buffers for TSO MAC/IP/TCP headers */
20522080 txq->tso_hdrs = dma_alloc_coherent(mp->dev->dev.parent,
20532081 txq->tx_ring_size * TSO_HEADER_SIZE,
20542082 &txq->tso_hdrs_dma, GFP_KERNEL);
20552083 if (txq->tso_hdrs == NULL) {
2056− dma_free_coherent(mp->dev->dev.parent, txq->tx_desc_area_size,
2057− txq->tx_desc_area, txq->tx_desc_dma);
2058− return -ENOMEM;
2084+ ret = -ENOMEM;
2085+ goto err_free_desc_mapping;
20592086 }
20602087 skb_queue_head_init(&txq->tx_skb);
20612088
20622089 return 0;
2090+
2091+err_free_desc_mapping:
2092+ kfree(txq->tx_desc_mapping);
2093+err_free_desc_area:
2094+ if (index == 0 && size <= mp->tx_desc_sram_size)
2095+ iounmap(txq->tx_desc_area);
2096+ else
2097+ dma_free_coherent(mp->dev->dev.parent, txq->tx_desc_area_size,
2098+ txq->tx_desc_area, txq->tx_desc_dma);
2099+ return ret;
20632100 }
20642101
20652102 static void txq_deinit(struct tx_queue *txq)
@@ -2077,6 +2114,8 @@ static void txq_deinit(struct tx_queue *txq) · 11 unmodified lines
20772114 else
20782115 dma_free_coherent(mp->dev->dev.parent, txq->tx_desc_area_size,
20792116 txq->tx_desc_area, txq->tx_desc_dma);
2117+ kfree(txq->tx_desc_mapping);
2118+
20802119 if (txq->tso_hdrs)
20812120 dma_free_coherent(mp->dev->dev.parent,
20822121 txq->tx_ring_size * TSO_HEADER_SIZE,
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c+4−1
@@ -2388,7 +2388,10 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget) · 2387 unmodified lines
23882388
23892389 work_done = netxen_process_rcv_ring(sds_ring, budget);
23902390
2391− if ((work_done < budget) && tx_complete) {
2391+ if (!tx_complete)
2392+ work_done = budget;
2393+
2394+ if (work_done < budget) {
23922395 napi_complete(&sds_ring->napi);
23932396 if (test_bit(__NX_DEV_UP, &adapter->state))
23942397 netxen_nic_enable_int(sds_ring);
drivers/net/ethernet/renesas/sh_eth.c+113−51
@@ -396,6 +396,9 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = { · 395 unmodified lines
396396 [TSU_ADRL31] = 0x01fc,
397397 };
398398
399+static void sh_eth_rcv_snd_disable(struct net_device *ndev);
400+static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev);
401+
399402 static bool sh_eth_is_gether(struct sh_eth_private *mdp)
400403 {
401404 return mdp->reg_offset == sh_eth_offset_gigabit;
@@ -1120,6 +1123,7 @@ static void sh_eth_ring_format(struct net_device *ndev) · 718 unmodified lines
11201123 int rx_ringsize = sizeof(*rxdesc) * mdp->num_rx_ring;
11211124 int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring;
11221125 int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1;
1126+ dma_addr_t dma_addr;
11231127
11241128 mdp->cur_rx = 0;
11251129 mdp->cur_tx = 0;
@@ -1133,7 +1137,6 @@ static void sh_eth_ring_format(struct net_device *ndev) · 7 unmodified lines
11331137 /* skb */
11341138 mdp->rx_skbuff[i] = NULL;
11351139 skb = netdev_alloc_skb(ndev, skbuff_size);
1136− mdp->rx_skbuff[i] = skb;
11371140 if (skb == NULL)
11381141 break;
11391142 sh_eth_set_receive_align(skb);
@@ -1142,9 +1145,15 @@ static void sh_eth_ring_format(struct net_device *ndev) · 2 unmodified lines
11421145 rxdesc = &mdp->rx_ring[i];
11431146 /* The size of the buffer is a multiple of 16 bytes. */
11441147 rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16);
1145− dma_map_single(&ndev->dev, skb->data, rxdesc->buffer_length,
1146− DMA_FROM_DEVICE);
1147− rxdesc->addr = virt_to_phys(skb->data);
1148+ dma_addr = dma_map_single(&ndev->dev, skb->data,
1149+ rxdesc->buffer_length,
1150+ DMA_FROM_DEVICE);
1151+ if (dma_mapping_error(&ndev->dev, dma_addr)) {
1152+ kfree_skb(skb);
1153+ break;
1154+ }
1155+ mdp->rx_skbuff[i] = skb;
1156+ rxdesc->addr = dma_addr;
11481157 rxdesc->status = cpu_to_edmac(mdp, RD_RACT | RD_RFP);
11491158
11501159 /* Rx descriptor address set */
@@ -1316,8 +1325,10 @@ static int sh_eth_dev_init(struct net_device *ndev, bool start) · 165 unmodified lines
13161325 RFLR);
13171326
13181327 sh_eth_write(ndev, sh_eth_read(ndev, EESR), EESR);
1319− if (start)
1328+ if (start) {
1329+ mdp->irq_enabled = true;
13201330 sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
1331+ }
13211332
13221333 /* PAUSE Prohibition */
13231334 val = (sh_eth_read(ndev, ECMR) & ECMR_DM) |
@@ -1356,6 +1367,33 @@ static int sh_eth_dev_init(struct net_device *ndev, bool start) · 32 unmodified lines
13561367 return ret;
13571368 }
13581369
1370+static void sh_eth_dev_exit(struct net_device *ndev)
1371+{
1372+ struct sh_eth_private *mdp = netdev_priv(ndev);
1373+ int i;
1374+
1375+ /* Deactivate all TX descriptors, so DMA should stop at next
1376+ * packet boundary if it's currently running
1377+ */
1378+ for (i = 0; i < mdp->num_tx_ring; i++)
1379+ mdp->tx_ring[i].status &= ~cpu_to_edmac(mdp, TD_TACT);
1380+
1381+ /* Disable TX FIFO egress to MAC */
1382+ sh_eth_rcv_snd_disable(ndev);
1383+
1384+ /* Stop RX DMA at next packet boundary */
1385+ sh_eth_write(ndev, 0, EDRRR);
1386+
1387+ /* Aside from TX DMA, we can't tell when the hardware is
1388+ * really stopped, so we need to reset to make sure.
1389+ * Before doing that, wait for long enough to *probably*
1390+ * finish transmitting the last packet and poll stats.
1391+ */
1392+ msleep(2); /* max frame time at 10 Mbps < 1250 us */
1393+ sh_eth_get_stats(ndev);
1394+ sh_eth_reset(ndev);
1395+}
1396+
13591397 /* free Tx skb function */
13601398 static int sh_eth_txfree(struct net_device *ndev)
13611399 {
@@ -1400,6 +1438,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) · 38 unmodified lines
14001438 u16 pkt_len = 0;
14011439 u32 desc_status;
14021440 int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1;
1441+ dma_addr_t dma_addr;
14031442
14041443 boguscnt = min(boguscnt, *quota);
14051444 limit = boguscnt;
@@ -1447,9 +1486,9 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) · 41 unmodified lines
14471486 mdp->rx_skbuff[entry] = NULL;
14481487 if (mdp->cd->rpadir)
14491488 skb_reserve(skb, NET_IP_ALIGN);
1450− dma_sync_single_for_cpu(&ndev->dev, rxdesc->addr,
1451− ALIGN(mdp->rx_buf_sz, 16),
1452− DMA_FROM_DEVICE);
1489+ dma_unmap_single(&ndev->dev, rxdesc->addr,
1490+ ALIGN(mdp->rx_buf_sz, 16),
1491+ DMA_FROM_DEVICE);
14531492 skb_put(skb, pkt_len);
14541493 skb->protocol = eth_type_trans(skb, ndev);
14551494 netif_receive_skb(skb);
@@ -1469,15 +1508,20 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) · 13 unmodified lines
14691508
14701509 if (mdp->rx_skbuff[entry] == NULL) {
14711510 skb = netdev_alloc_skb(ndev, skbuff_size);
1472− mdp->rx_skbuff[entry] = skb;
14731511 if (skb == NULL)
14741512 break; /* Better luck next round. */
14751513 sh_eth_set_receive_align(skb);
1476− dma_map_single(&ndev->dev, skb->data,
1477− rxdesc->buffer_length, DMA_FROM_DEVICE);
1514+ dma_addr = dma_map_single(&ndev->dev, skb->data,
1515+ rxdesc->buffer_length,
1516+ DMA_FROM_DEVICE);
1517+ if (dma_mapping_error(&ndev->dev, dma_addr)) {
1518+ kfree_skb(skb);
1519+ break;
1520+ }
1521+ mdp->rx_skbuff[entry] = skb;
14781522
14791523 skb_checksum_none_assert(skb);
1480− rxdesc->addr = virt_to_phys(skb->data);
1524+ rxdesc->addr = dma_addr;
14811525 }
14821526 if (entry >= mdp->num_rx_ring - 1)
14831527 rxdesc->status |=
@@ -1573,7 +1617,6 @@ ignore_link: · 89 unmodified lines
15731617 if (intr_status & EESR_RFRMER) {
15741618 /* Receive Frame Overflow int */
15751619 ndev->stats.rx_frame_errors++;
1576− netif_err(mdp, rx_err, ndev, "Receive Abort\n");
15771620 }
15781621 }
15791622
@@ -1592,13 +1635,11 @@ ignore_link: · 12 unmodified lines
15921635 if (intr_status & EESR_RDE) {
15931636 /* Receive Descriptor Empty int */
15941637 ndev->stats.rx_over_errors++;
1595− netif_err(mdp, rx_err, ndev, "Receive Descriptor Empty\n");
15961638 }
15971639
15981640 if (intr_status & EESR_RFE) {
15991641 /* Receive FIFO Overflow int */
16001642 ndev->stats.rx_fifo_errors++;
1601− netif_err(mdp, rx_err, ndev, "Receive FIFO Overflow\n");
16021643 }
16031644
16041645 if (!mdp->cd->no_ade && (intr_status & EESR_ADE)) {
@@ -1653,7 +1694,12 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev) · 48 unmodified lines
16531694 if (intr_status & (EESR_RX_CHECK | cd->tx_check | cd->eesr_err_check))
16541695 ret = IRQ_HANDLED;
16551696 else
1656− goto other_irq;
1697+ goto out;
1698+
1699+ if (!likely(mdp->irq_enabled)) {
1700+ sh_eth_write(ndev, 0, EESIPR);
1701+ goto out;
1702+ }
16571703
16581704 if (intr_status & EESR_RX_CHECK) {
16591705 if (napi_schedule_prep(&mdp->napi)) {
@@ -1684,7 +1730,7 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev) · 24 unmodified lines
16841730 sh_eth_error(ndev, intr_status);
16851731 }
16861732
1687−other_irq:
1733+out:
16881734 spin_unlock(&mdp->lock);
16891735
16901736 return ret;
@@ -1712,7 +1758,8 @@ static int sh_eth_poll(struct napi_struct *napi, int budget) · 21 unmodified lines
17121758 napi_complete(napi);
17131759
17141760 /* Reenable Rx interrupts */
1715− sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
1761+ if (mdp->irq_enabled)
1762+ sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
17161763 out:
17171764 return budget - quota;
17181765 }
@@ -1968,40 +2015,50 @@ static int sh_eth_set_ringparam(struct net_device *ndev, · 249 unmodified lines
19682015 return -EINVAL;
19692016
19702017 if (netif_running(ndev)) {
2018+ netif_device_detach(ndev);
19712019 netif_tx_disable(ndev);
1972− /* Disable interrupts by clearing the interrupt mask. */
1973− sh_eth_write(ndev, 0x0000, EESIPR);
1974− /* Stop the chip's Tx and Rx processes. */
1975− sh_eth_write(ndev, 0, EDTRR);
1976− sh_eth_write(ndev, 0, EDRRR);
2020+
2021+ /* Serialise with the interrupt handler and NAPI, then
2022+ * disable interrupts. We have to clear the
2023+ * irq_enabled flag first to ensure that interrupts
2024+ * won't be re-enabled.
2025+ */
2026+ mdp->irq_enabled = false;
19772027 synchronize_irq(ndev->irq);
1978− }
2028+ napi_synchronize(&mdp->napi);
2029+ sh_eth_write(ndev, 0x0000, EESIPR);
19792030
1980− /* Free all the skbuffs in the Rx queue. */
1981− sh_eth_ring_free(ndev);
1982− /* Free DMA buffer */
1983− sh_eth_free_dma_buffer(mdp);
2031+ sh_eth_dev_exit(ndev);
2032+
2033+ /* Free all the skbuffs in the Rx queue. */
2034+ sh_eth_ring_free(ndev);
2035+ /* Free DMA buffer */
2036+ sh_eth_free_dma_buffer(mdp);
2037+ }
19842038
19852039 /* Set new parameters */
19862040 mdp->num_rx_ring = ring->rx_pending;
19872041 mdp->num_tx_ring = ring->tx_pending;
19882042
1989− ret = sh_eth_ring_init(ndev);
1990− if (ret < 0) {
1991− netdev_err(ndev, "%s: sh_eth_ring_init failed.\n", __func__);
1992− return ret;
1993− }
1994− ret = sh_eth_dev_init(ndev, false);
1995− if (ret < 0) {
1996− netdev_err(ndev, "%s: sh_eth_dev_init failed.\n", __func__);
1997− return ret;
1998− }
1999−
20002043 if (netif_running(ndev)) {
2044+ ret = sh_eth_ring_init(ndev);
2045+ if (ret < 0) {
2046+ netdev_err(ndev, "%s: sh_eth_ring_init failed.\n",
2047+ __func__);
2048+ return ret;
2049+ }
2050+ ret = sh_eth_dev_init(ndev, false);
2051+ if (ret < 0) {
2052+ netdev_err(ndev, "%s: sh_eth_dev_init failed.\n",
2053+ __func__);
2054+ return ret;
2055+ }
2056+
2057+ mdp->irq_enabled = true;
20012058 sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
20022059 /* Setting the Rx mode will start the Rx process. */
20032060 sh_eth_write(ndev, EDRRR_R, EDRRR);
2004− netif_wake_queue(ndev);
2061+ netif_device_attach(ndev);
20052062 }
20062063
20072064 return 0;
@@ -2117,6 +2174,9 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 109 unmodified lines
21172174 }
21182175 spin_unlock_irqrestore(&mdp->lock, flags);
21192176
2177+ if (skb_padto(skb, ETH_ZLEN))
2178+ return NETDEV_TX_OK;
2179+
21202180 entry = mdp->cur_tx % mdp->num_tx_ring;
21212181 mdp->tx_skbuff[entry] = skb;
21222182 txdesc = &mdp->tx_ring[entry];
@@ -2126,10 +2186,11 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 3 unmodified lines
21262186 skb->len + 2);
21272187 txdesc->addr = dma_map_single(&ndev->dev, skb->data, skb->len,
21282188 DMA_TO_DEVICE);
2129− if (skb->len < ETH_ZLEN)
2130− txdesc->buffer_length = ETH_ZLEN;
2131− else
2132− txdesc->buffer_length = skb->len;
2189+ if (dma_mapping_error(&ndev->dev, txdesc->addr)) {
2190+ kfree_skb(skb);
2191+ return NETDEV_TX_OK;
2192+ }
2193+ txdesc->buffer_length = skb->len;
21332194
21342195 if (entry >= mdp->num_tx_ring - 1)
21352196 txdesc->status |= cpu_to_edmac(mdp, TD_TACT | TD_TDLE);
@@ -2181,14 +2242,17 @@ static int sh_eth_close(struct net_device *ndev) · 45 unmodified lines
21812242
21822243 netif_stop_queue(ndev);
21832244
2184− /* Disable interrupts by clearing the interrupt mask. */
2245+ /* Serialise with the interrupt handler and NAPI, then disable
2246+ * interrupts. We have to clear the irq_enabled flag first to
2247+ * ensure that interrupts won't be re-enabled.
2248+ */
2249+ mdp->irq_enabled = false;
2250+ synchronize_irq(ndev->irq);
2251+ napi_disable(&mdp->napi);
21852252 sh_eth_write(ndev, 0x0000, EESIPR);
21862253
2187− /* Stop the chip's Tx and Rx processes. */
2188− sh_eth_write(ndev, 0, EDTRR);
2189− sh_eth_write(ndev, 0, EDRRR);
2254+ sh_eth_dev_exit(ndev);
21902255
2191− sh_eth_get_stats(ndev);
21922256 /* PHY Disconnect */
21932257 if (mdp->phydev) {
21942258 phy_stop(mdp->phydev);
@@ -2198,8 +2262,6 @@ static int sh_eth_close(struct net_device *ndev) · 3 unmodified lines
21982262
21992263 free_irq(ndev->irq, ndev);
22002264
2201− napi_disable(&mdp->napi);
2202−
22032265 /* Free all the skbuffs in the Rx queue. */
22042266 sh_eth_ring_free(ndev);
22052267
drivers/net/ethernet/renesas/sh_eth.h+1−0
@@ -513,6 +513,7 @@ struct sh_eth_private { · 512 unmodified lines
513513 u32 rx_buf_sz; /* Based on MTU+slack. */
514514 int edmac_endian;
515515 struct napi_struct napi;
516+ bool irq_enabled;
516517 /* MII transceiver section. */
517518 u32 phy_id; /* PHY ID */
518519 struct mii_bus *mii_bus; /* MDIO bus control */
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+4−1
@@ -2778,6 +2778,9 @@ static int stmmac_hw_init(struct stmmac_priv *priv) · 2777 unmodified lines
27782778 * @addr: iobase memory address
27792779 * Description: this is the main probe function used to
27802780 * call the alloc_etherdev, allocate the priv structure.
2781+ * Return:
2782+ * on success the new private structure is returned, otherwise the error
2783+ * pointer.
27812784 */
27822785 struct stmmac_priv *stmmac_dvr_probe(struct device *device,
27832786 struct plat_stmmacenet_data *plat_dat,
@@ -2789,7 +2792,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, · 5 unmodified lines
27892792
27902793 ndev = alloc_etherdev(sizeof(struct stmmac_priv));
27912794 if (!ndev)
2792− return NULL;
2795+ return ERR_PTR(-ENOMEM);
27932796
27942797 SET_NETDEV_DEV(ndev, device);
27952798
drivers/net/ethernet/ti/cpsw.c+22−0
@@ -1683,6 +1683,19 @@ static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev, · 1682 unmodified lines
16831683 if (vid == priv->data.default_vlan)
16841684 return 0;
16851685
1686+ if (priv->data.dual_emac) {
1687+ /* In dual EMAC, reserved VLAN id should not be used for
1688+ * creating VLAN interfaces as this can break the dual
1689+ * EMAC port separation
1690+ */
1691+ int i;
1692+
1693+ for (i = 0; i < priv->data.slaves; i++) {
1694+ if (vid == priv->slaves[i].port_vlan)
1695+ return -EINVAL;
1696+ }
1697+ }
1698+
16861699 dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid);
16871700 return cpsw_add_vlan_ale_entry(priv, vid);
16881701 }
@@ -1696,6 +1709,15 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, · 7 unmodified lines
16961709 if (vid == priv->data.default_vlan)
16971710 return 0;
16981711
1712+ if (priv->data.dual_emac) {
1713+ int i;
1714+
1715+ for (i = 0; i < priv->data.slaves; i++) {
1716+ if (vid == priv->slaves[i].port_vlan)
1717+ return -EINVAL;
1718+ }
1719+ }
1720+
16991721 dev_info(priv->dev, "removing vlanid %d from vlan filter\n", vid);
17001722 ret = cpsw_ale_del_vlan(priv->ale, vid, 0);
17011723 if (ret != 0)
drivers/net/ipvlan/ipvlan_core.c+4−2
@@ -377,9 +377,11 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb) · 376 unmodified lines
377377 };
378378
379379 dst = ip6_route_output(dev_net(dev), NULL, &fl6);
380− if (IS_ERR(dst))
380+ if (dst->error) {
381+ ret = dst->error;
382+ dst_release(dst);
381383 goto err;
382−
384+ }
383385 skb_dst_drop(skb);
384386 skb_dst_set(skb, dst);
385387 err = ip6_local_out(skb);
drivers/net/wireless/ath/ath9k/main.c+3−4
@@ -285,6 +285,7 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan) · 284 unmodified lines
285285
286286 __ath_cancel_work(sc);
287287
288+ disable_irq(sc->irq);
288289 tasklet_disable(&sc->intr_tq);
289290 tasklet_disable(&sc->bcon_tasklet);
290291 spin_lock_bh(&sc->sc_pcu_lock);
@@ -331,6 +332,7 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan) · 40 unmodified lines
331332 r = -EIO;
332333
333334 out:
335+ enable_irq(sc->irq);
334336 spin_unlock_bh(&sc->sc_pcu_lock);
335337 tasklet_enable(&sc->bcon_tasklet);
336338 tasklet_enable(&sc->intr_tq);
@@ -512,9 +514,6 @@ irqreturn_t ath_isr(int irq, void *dev) · 175 unmodified lines
512514 if (!ah || test_bit(ATH_OP_INVALID, &common->op_flags))
513515 return IRQ_NONE;
514516
515− if (!AR_SREV_9100(ah) && test_bit(ATH_OP_HW_RESET, &common->op_flags))
516− return IRQ_NONE;
517−
518517 /* shared irq, not for us */
519518 if (!ath9k_hw_intrpend(ah))
520519 return IRQ_NONE;
@@ -529,7 +528,7 @@ irqreturn_t ath_isr(int irq, void *dev) · 8 unmodified lines
529528 ath9k_debug_sync_cause(sc, sync_cause);
530529 status &= ah->imask; /* discard unasked-for bits */
531530
532− if (AR_SREV_9100(ah) && test_bit(ATH_OP_HW_RESET, &common->op_flags))
531+ if (test_bit(ATH_OP_HW_RESET, &common->op_flags))
533532 return IRQ_HANDLED;
534533
535534 /*
drivers/net/wireless/iwlwifi/iwl-fw-file.h+2−0
@@ -246,6 +246,7 @@ enum iwl_ucode_tlv_flag { · 245 unmodified lines
246246 * @IWL_UCODE_TLV_API_BASIC_DWELL: use only basic dwell time in scan command,
247247 * regardless of the band or the number of the probes. FW will calculate
248248 * the actual dwell time.
249+ * @IWL_UCODE_TLV_API_SINGLE_SCAN_EBS: EBS is supported for single scans too.
249250 */
250251 enum iwl_ucode_tlv_api {
251252 IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID = BIT(0),
@@ -257,6 +258,7 @@ enum iwl_ucode_tlv_api { · 5 unmodified lines
257258 IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF = BIT(7),
258259 IWL_UCODE_TLV_API_FRAGMENTED_SCAN = BIT(8),
259260 IWL_UCODE_TLV_API_BASIC_DWELL = BIT(13),
261+ IWL_UCODE_TLV_API_SINGLE_SCAN_EBS = BIT(16),
260262 };
261263
262264 /**
drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h+5−2
@@ -653,8 +653,11 @@ enum iwl_scan_channel_flags { · 652 unmodified lines
653653 };
654654
655655 /* iwl_scan_channel_opt - CHANNEL_OPTIMIZATION_API_S
656− * @flags: enum iwl_scan_channel_flgs
657− * @non_ebs_ratio: how many regular scan iteration before EBS
656+ * @flags: enum iwl_scan_channel_flags
657+ * @non_ebs_ratio: defines the ratio of number of scan iterations where EBS is
658+ * involved.
659+ * 1 - EBS is disabled.
660+ * 2 - every second scan will be full scan(and so on).
658661 */
659662 struct iwl_scan_channel_opt {
660663 __le16 flags;
drivers/net/wireless/iwlwifi/mvm/mac80211.c+9−11
@@ -3343,18 +3343,16 @@ static void iwl_mvm_mac_flush(struct ieee80211_hw *hw, · 3342 unmodified lines
33433343 msk |= mvmsta->tfd_queue_msk;
33443344 }
33453345
3346− if (drop) {
3347− if (iwl_mvm_flush_tx_path(mvm, msk, true))
3348− IWL_ERR(mvm, "flush request fail\n");
3349− mutex_unlock(&mvm->mutex);
3350− } else {
3351− mutex_unlock(&mvm->mutex);
3346+ msk &= ~BIT(vif->hw_queue[IEEE80211_AC_VO]);
33523347
3353− /* this can take a while, and we may need/want other operations
3354− * to succeed while doing this, so do it without the mutex held
3355− */
3356− iwl_trans_wait_tx_queue_empty(mvm->trans, msk);
3357− }
3348+ if (iwl_mvm_flush_tx_path(mvm, msk, true))
3349+ IWL_ERR(mvm, "flush request fail\n");
3350+ mutex_unlock(&mvm->mutex);
3351+
3352+ /* this can take a while, and we may need/want other operations
3353+ * to succeed while doing this, so do it without the mutex held
3354+ */
3355+ iwl_trans_wait_tx_queue_empty(mvm->trans, msk);
33583356 }
33593357
33603358 const struct ieee80211_ops iwl_mvm_hw_ops = {
drivers/net/wireless/iwlwifi/mvm/scan.c+41−12
@@ -72,6 +72,8 @@ · 71 unmodified lines
7272
7373 #define IWL_PLCP_QUIET_THRESH 1
7474 #define IWL_ACTIVE_QUIET_TIME 10
75+#define IWL_DENSE_EBS_SCAN_RATIO 5
76+#define IWL_SPARSE_EBS_SCAN_RATIO 1
7577
7678 struct iwl_mvm_scan_params {
7779 u32 max_out_time;
@@ -1105,6 +1107,12 @@ int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool notify) · 1027 unmodified lines
11051107 return iwl_umac_scan_stop(mvm, IWL_UMAC_SCAN_UID_SCHED_SCAN,
11061108 notify);
11071109
1110+ if (mvm->scan_status == IWL_MVM_SCAN_NONE)
1111+ return 0;
1112+
1113+ if (iwl_mvm_is_radio_killed(mvm))
1114+ goto out;
1115+
11081116 if (mvm->scan_status != IWL_MVM_SCAN_SCHED &&
11091117 (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN) ||
11101118 mvm->scan_status != IWL_MVM_SCAN_OS)) {
@@ -1141,6 +1149,7 @@ int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool notify) · 30 unmodified lines
11411149 if (mvm->scan_status == IWL_MVM_SCAN_OS)
11421150 iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
11431151
1152+out:
11441153 mvm->scan_status = IWL_MVM_SCAN_NONE;
11451154
11461155 if (notify) {
@@ -1297,18 +1306,6 @@ iwl_mvm_build_generic_unified_scan_cmd(struct iwl_mvm *mvm, · 150 unmodified lines
12971306 cmd->scan_prio = cpu_to_le32(IWL_SCAN_PRIORITY_HIGH);
12981307 cmd->iter_num = cpu_to_le32(1);
12991308
1300− if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_EBS_SUPPORT &&
1301− mvm->last_ebs_successful) {
1302− cmd->channel_opt[0].flags =
1303− cpu_to_le16(IWL_SCAN_CHANNEL_FLAG_EBS |
1304− IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE |
1305− IWL_SCAN_CHANNEL_FLAG_CACHE_ADD);
1306− cmd->channel_opt[1].flags =
1307− cpu_to_le16(IWL_SCAN_CHANNEL_FLAG_EBS |
1308− IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE |
1309− IWL_SCAN_CHANNEL_FLAG_CACHE_ADD);
1310− }
1311−
13121309 if (iwl_mvm_rrm_scan_needed(mvm))
13131310 cmd->scan_flags |=
13141311 cpu_to_le32(IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED);
@@ -1383,6 +1380,22 @@ int iwl_mvm_unified_scan_lmac(struct iwl_mvm *mvm, · 68 unmodified lines
13831380 cmd->schedule[1].iterations = 0;
13841381 cmd->schedule[1].full_scan_mul = 0;
13851382
1383+ if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_SINGLE_SCAN_EBS &&
1384+ mvm->last_ebs_successful) {
1385+ cmd->channel_opt[0].flags =
1386+ cpu_to_le16(IWL_SCAN_CHANNEL_FLAG_EBS |
1387+ IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE |
1388+ IWL_SCAN_CHANNEL_FLAG_CACHE_ADD);
1389+ cmd->channel_opt[0].non_ebs_ratio =
1390+ cpu_to_le16(IWL_DENSE_EBS_SCAN_RATIO);
1391+ cmd->channel_opt[1].flags =
1392+ cpu_to_le16(IWL_SCAN_CHANNEL_FLAG_EBS |
1393+ IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE |
1394+ IWL_SCAN_CHANNEL_FLAG_CACHE_ADD);
1395+ cmd->channel_opt[1].non_ebs_ratio =
1396+ cpu_to_le16(IWL_SPARSE_EBS_SCAN_RATIO);
1397+ }
1398+
13861399 for (i = 1; i <= req->req.n_ssids; i++)
13871400 ssid_bitmap |= BIT(i);
13881401
@@ -1483,6 +1496,22 @@ int iwl_mvm_unified_sched_scan_lmac(struct iwl_mvm *mvm, · 94 unmodified lines
14831496 cmd->schedule[1].iterations = 0xff;
14841497 cmd->schedule[1].full_scan_mul = IWL_FULL_SCAN_MULTIPLIER;
14851498
1499+ if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_EBS_SUPPORT &&
1500+ mvm->last_ebs_successful) {
1501+ cmd->channel_opt[0].flags =
1502+ cpu_to_le16(IWL_SCAN_CHANNEL_FLAG_EBS |
1503+ IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE |
1504+ IWL_SCAN_CHANNEL_FLAG_CACHE_ADD);
1505+ cmd->channel_opt[0].non_ebs_ratio =
1506+ cpu_to_le16(IWL_DENSE_EBS_SCAN_RATIO);
1507+ cmd->channel_opt[1].flags =
1508+ cpu_to_le16(IWL_SCAN_CHANNEL_FLAG_EBS |
1509+ IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE |
1510+ IWL_SCAN_CHANNEL_FLAG_CACHE_ADD);
1511+ cmd->channel_opt[1].non_ebs_ratio =
1512+ cpu_to_le16(IWL_SPARSE_EBS_SCAN_RATIO);
1513+ }
1514+
14861515 iwl_mvm_lmac_scan_cfg_channels(mvm, req->channels, req->n_channels,
14871516 ssid_bitmap, cmd);
14881517
drivers/net/wireless/iwlwifi/mvm/tx.c+9−2
@@ -90,8 +90,6 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb, · 89 unmodified lines
9090
9191 if (ieee80211_is_probe_resp(fc))
9292 tx_flags |= TX_CMD_FLG_TSF;
93− else if (ieee80211_is_back_req(fc))
94− tx_flags |= TX_CMD_FLG_ACK | TX_CMD_FLG_BAR;
9593
9694 if (ieee80211_has_morefrags(fc))
9795 tx_flags |= TX_CMD_FLG_MORE_FRAG;
@@ -100,6 +98,15 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb, · 2 unmodified lines
10098 u8 *qc = ieee80211_get_qos_ctl(hdr);
10199 tx_cmd->tid_tspec = qc[0] & 0xf;
102100 tx_flags &= ~TX_CMD_FLG_SEQ_CTL;
101+ } else if (ieee80211_is_back_req(fc)) {
102+ struct ieee80211_bar *bar = (void *)skb->data;
103+ u16 control = le16_to_cpu(bar->control);
104+
105+ tx_flags |= TX_CMD_FLG_ACK | TX_CMD_FLG_BAR;
106+ tx_cmd->tid_tspec = (control &
107+ IEEE80211_BAR_CTRL_TID_INFO_MASK) >>
108+ IEEE80211_BAR_CTRL_TID_INFO_SHIFT;
109+ WARN_ON_ONCE(tx_cmd->tid_tspec >= IWL_MAX_TID_COUNT);
103110 } else {
104111 tx_cmd->tid_tspec = IWL_TID_NON_QOS;
105112 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)
drivers/pinctrl/pinctrl-at91.c+55−53
@@ -177,7 +177,7 @@ struct at91_pinctrl { · 176 unmodified lines
177177 struct device *dev;
178178 struct pinctrl_dev *pctl;
179179
180− int nbanks;
180+ int nactive_banks;
181181
182182 uint32_t *mux_mask;
183183 int nmux;
@@ -653,12 +653,18 @@ static int pin_check_config(struct at91_pinctrl *info, const char *name, · 469 unmodified lines
653653 int mux;
654654
655655 /* check if it's a valid config */
656− if (pin->bank >= info->nbanks) {
656+ if (pin->bank >= gpio_banks) {
657657 dev_err(info->dev, "%s: pin conf %d bank_id %d >= nbanks %d\n",
658− name, index, pin->bank, info->nbanks);
658+ name, index, pin->bank, gpio_banks);
659659 return -EINVAL;
660660 }
661661
662+ if (!gpio_chips[pin->bank]) {
663+ dev_err(info->dev, "%s: pin conf %d bank_id %d not enabled\n",
664+ name, index, pin->bank);
665+ return -ENXIO;
666+ }
667+
662668 if (pin->pin >= MAX_NB_GPIO_PER_BANK) {
663669 dev_err(info->dev, "%s: pin conf %d pin_bank_id %d >= %d\n",
664670 name, index, pin->pin, MAX_NB_GPIO_PER_BANK);
@@ -981,7 +987,8 @@ static void at91_pinctrl_child_count(struct at91_pinctrl *info, · 316 unmodified lines
981987
982988 for_each_child_of_node(np, child) {
983989 if (of_device_is_compatible(child, gpio_compat)) {
984− info->nbanks++;
990+ if (of_device_is_available(child))
991+ info->nactive_banks++;
985992 } else {
986993 info->nfunctions++;
987994 info->ngroups += of_get_child_count(child);
@@ -1003,11 +1010,11 @@ static int at91_pinctrl_mux_mask(struct at91_pinctrl *info, · 15 unmodified lines
10031010 }
10041011
10051012 size /= sizeof(*list);
1006− if (!size || size % info->nbanks) {
1007− dev_err(info->dev, "wrong mux mask array should be by %d\n", info->nbanks);
1013+ if (!size || size % gpio_banks) {
1014+ dev_err(info->dev, "wrong mux mask array should be by %d\n", gpio_banks);
10081015 return -EINVAL;
10091016 }
1010− info->nmux = size / info->nbanks;
1017+ info->nmux = size / gpio_banks;
10111018
10121019 info->mux_mask = devm_kzalloc(info->dev, sizeof(u32) * size, GFP_KERNEL);
10131020 if (!info->mux_mask) {
@@ -1131,7 +1138,7 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev, · 117 unmodified lines
11311138 of_match_device(at91_pinctrl_of_match, &pdev->dev)->data;
11321139 at91_pinctrl_child_count(info, np);
11331140
1134− if (info->nbanks < 1) {
1141+ if (gpio_banks < 1) {
11351142 dev_err(&pdev->dev, "you need to specify at least one gpio-controller\n");
11361143 return -EINVAL;
11371144 }
@@ -1144,7 +1151,7 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev, · 6 unmodified lines
11441151
11451152 dev_dbg(&pdev->dev, "mux-mask\n");
11461153 tmp = info->mux_mask;
1147− for (i = 0; i < info->nbanks; i++) {
1154+ for (i = 0; i < gpio_banks; i++) {
11481155 for (j = 0; j < info->nmux; j++, tmp++) {
11491156 dev_dbg(&pdev->dev, "%d:%d\t0x%x\n", i, j, tmp[0]);
11501157 }
@@ -1162,7 +1169,7 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev, · 11 unmodified lines
11621169 if (!info->groups)
11631170 return -ENOMEM;
11641171
1165− dev_dbg(&pdev->dev, "nbanks = %d\n", info->nbanks);
1172+ dev_dbg(&pdev->dev, "nbanks = %d\n", gpio_banks);
11661173 dev_dbg(&pdev->dev, "nfunctions = %d\n", info->nfunctions);
11671174 dev_dbg(&pdev->dev, "ngroups = %d\n", info->ngroups);
11681175
@@ -1185,7 +1192,7 @@ static int at91_pinctrl_probe(struct platform_device *pdev) · 16 unmodified lines
11851192 {
11861193 struct at91_pinctrl *info;
11871194 struct pinctrl_pin_desc *pdesc;
1188− int ret, i, j, k;
1195+ int ret, i, j, k, ngpio_chips_enabled = 0;
11891196
11901197 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
11911198 if (!info)
@@ -1200,23 +1207,27 @@ static int at91_pinctrl_probe(struct platform_device *pdev) · 8 unmodified lines
12001207 * to obtain references to the struct gpio_chip * for them, and we
12011208 * need this to proceed.
12021209 */
1203− for (i = 0; i < info->nbanks; i++) {
1204− if (!gpio_chips[i]) {
1205− dev_warn(&pdev->dev, "GPIO chip %d not registered yet\n", i);
1206− devm_kfree(&pdev->dev, info);
1207− return -EPROBE_DEFER;
1208− }
1210+ for (i = 0; i < gpio_banks; i++)
1211+ if (gpio_chips[i])
1212+ ngpio_chips_enabled++;
1213+
1214+ if (ngpio_chips_enabled < info->nactive_banks) {
1215+ dev_warn(&pdev->dev,
1216+ "All GPIO chips are not registered yet (%d/%d)\n",
1217+ ngpio_chips_enabled, info->nactive_banks);
1218+ devm_kfree(&pdev->dev, info);
1219+ return -EPROBE_DEFER;
12091220 }
12101221
12111222 at91_pinctrl_desc.name = dev_name(&pdev->dev);
1212− at91_pinctrl_desc.npins = info->nbanks * MAX_NB_GPIO_PER_BANK;
1223+ at91_pinctrl_desc.npins = gpio_banks * MAX_NB_GPIO_PER_BANK;
12131224 at91_pinctrl_desc.pins = pdesc =
12141225 devm_kzalloc(&pdev->dev, sizeof(*pdesc) * at91_pinctrl_desc.npins, GFP_KERNEL);
12151226
12161227 if (!at91_pinctrl_desc.pins)
12171228 return -ENOMEM;
12181229
1219− for (i = 0 , k = 0; i < info->nbanks; i++) {
1230+ for (i = 0, k = 0; i < gpio_banks; i++) {
12201231 for (j = 0; j < MAX_NB_GPIO_PER_BANK; j++, k++) {
12211232 pdesc->number = k;
12221233 pdesc->name = kasprintf(GFP_KERNEL, "pio%c%d", i + 'A', j);
@@ -1234,8 +1245,9 @@ static int at91_pinctrl_probe(struct platform_device *pdev) · 11 unmodified lines
12341245 }
12351246
12361247 /* We will handle a range of GPIO pins */
1237− for (i = 0; i < info->nbanks; i++)
1238− pinctrl_add_gpio_range(info->pctl, &gpio_chips[i]->range);
1248+ for (i = 0; i < gpio_banks; i++)
1249+ if (gpio_chips[i])
1250+ pinctrl_add_gpio_range(info->pctl, &gpio_chips[i]->range);
12391251
12401252 dev_info(&pdev->dev, "initialized AT91 pinctrl driver\n");
12411253
@@ -1613,9 +1625,10 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc) · 371 unmodified lines
16131625 static int at91_gpio_of_irq_setup(struct platform_device *pdev,
16141626 struct at91_gpio_chip *at91_gpio)
16151627 {
1628+ struct gpio_chip *gpiochip_prev = NULL;
16161629 struct at91_gpio_chip *prev = NULL;
16171630 struct irq_data *d = irq_get_irq_data(at91_gpio->pioc_virq);
1618− int ret;
1631+ int ret, i;
16191632
16201633 at91_gpio->pioc_hwirq = irqd_to_hwirq(d);
16211634
@@ -1641,24 +1654,33 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev, · 19 unmodified lines
16411654 return ret;
16421655 }
16431656
1644− /* Setup chained handler */
1645− if (at91_gpio->pioc_idx)
1646− prev = gpio_chips[at91_gpio->pioc_idx - 1];
1647−
16481657 /* The top level handler handles one bank of GPIOs, except
16491658 * on some SoC it can handle up to three...
16501659 * We only set up the handler for the first of the list.
16511660 */
1652− if (prev && prev->next == at91_gpio)
1661+ gpiochip_prev = irq_get_handler_data(at91_gpio->pioc_virq);
1662+ if (!gpiochip_prev) {
1663+ /* Then register the chain on the parent IRQ */
1664+ gpiochip_set_chained_irqchip(&at91_gpio->chip,
1665+ &gpio_irqchip,
1666+ at91_gpio->pioc_virq,
1667+ gpio_irq_handler);
16531668 return 0;
1669+ }
16541670
1655− /* Then register the chain on the parent IRQ */
1656− gpiochip_set_chained_irqchip(&at91_gpio->chip,
1657− &gpio_irqchip,
1658− at91_gpio->pioc_virq,
1659− gpio_irq_handler);
1671+ prev = container_of(gpiochip_prev, struct at91_gpio_chip, chip);
16601672
1661− return 0;
1673+ /* we can only have 2 banks before */
1674+ for (i = 0; i < 2; i++) {
1675+ if (prev->next) {
1676+ prev = prev->next;
1677+ } else {
1678+ prev->next = at91_gpio;
1679+ return 0;
1680+ }
1681+ }
1682+
1683+ return -EINVAL;
16621684 }
16631685
16641686 /* This structure is replicated for each GPIO block allocated at probe time */
@@ -1675,24 +1697,6 @@ static struct gpio_chip at91_gpio_template = { · 10 unmodified lines
16751697 .ngpio = MAX_NB_GPIO_PER_BANK,
16761698 };
16771699
1678−static void at91_gpio_probe_fixup(void)
1679−{
1680− unsigned i;
1681− struct at91_gpio_chip *at91_gpio, *last = NULL;
1682−
1683− for (i = 0; i < gpio_banks; i++) {
1684− at91_gpio = gpio_chips[i];
1685−
1686− /*
1687− * GPIO controller are grouped on some SoC:
1688− * PIOC, PIOD and PIOE can share the same IRQ line
1689− */
1690− if (last && last->pioc_virq == at91_gpio->pioc_virq)
1691− last->next = at91_gpio;
1692− last = at91_gpio;
1693− }
1694−}
1695−
16961700 static struct of_device_id at91_gpio_of_match[] = {
16971701 { .compatible = "atmel,at91sam9x5-gpio", .data = &at91sam9x5_ops, },
16981702 { .compatible = "atmel,at91rm9200-gpio", .data = &at91rm9200_ops },
@@ -1805,8 +1809,6 @@ static int at91_gpio_probe(struct platform_device *pdev) · 106 unmodified lines
18051809 gpio_chips[alias_idx] = at91_chip;
18061810 gpio_banks = max(gpio_banks, alias_idx + 1);
18071811
1808− at91_gpio_probe_fixup();
1809−
18101812 ret = at91_gpio_of_irq_setup(pdev, at91_chip);
18111813 if (ret)
18121814 goto irq_setup_err;
drivers/regulator/core.c+3−1
@@ -1488,7 +1488,7 @@ struct regulator *regulator_get_optional(struct device *dev, const char *id) · 1487 unmodified lines
14881488 }
14891489 EXPORT_SYMBOL_GPL(regulator_get_optional);
14901490
1491−/* Locks held by regulator_put() */
1491+/* regulator_list_mutex lock held by regulator_put() */
14921492 static void _regulator_put(struct regulator *regulator)
14931493 {
14941494 struct regulator_dev *rdev;
@@ -1503,12 +1503,14 @@ static void _regulator_put(struct regulator *regulator) · 8 unmodified lines
15031503 /* remove any sysfs entries */
15041504 if (regulator->dev)
15051505 sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name);
1506+ mutex_lock(&rdev->mutex);
15061507 kfree(regulator->supply_name);
15071508 list_del(&regulator->list);
15081509 kfree(regulator);
15091510
15101511 rdev->open_count--;
15111512 rdev->exclusive = 0;
1513+ mutex_unlock(&rdev->mutex);
15121514
15131515 module_put(rdev->owner);
15141516 }
drivers/regulator/s2mps11.c+38−4
@@ -405,6 +405,40 @@ static struct regulator_ops s2mps14_reg_ops; · 404 unmodified lines
405405 .enable_mask = S2MPS14_ENABLE_MASK \
406406 }
407407
408+#define regulator_desc_s2mps13_buck7(num, min, step, min_sel) { \
409+ .name = "BUCK"#num, \
410+ .id = S2MPS13_BUCK##num, \
411+ .ops = &s2mps14_reg_ops, \
412+ .type = REGULATOR_VOLTAGE, \
413+ .owner = THIS_MODULE, \
414+ .min_uV = min, \
415+ .uV_step = step, \
416+ .linear_min_sel = min_sel, \
417+ .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \
418+ .ramp_delay = S2MPS13_BUCK_RAMP_DELAY, \
419+ .vsel_reg = S2MPS13_REG_B1OUT + (num) * 2 - 1, \
420+ .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \
421+ .enable_reg = S2MPS13_REG_B1CTRL + (num - 1) * 2, \
422+ .enable_mask = S2MPS14_ENABLE_MASK \
423+}
424+
425+#define regulator_desc_s2mps13_buck8_10(num, min, step, min_sel) { \
426+ .name = "BUCK"#num, \
427+ .id = S2MPS13_BUCK##num, \
428+ .ops = &s2mps14_reg_ops, \
429+ .type = REGULATOR_VOLTAGE, \
430+ .owner = THIS_MODULE, \
431+ .min_uV = min, \
432+ .uV_step = step, \
433+ .linear_min_sel = min_sel, \
434+ .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \
435+ .ramp_delay = S2MPS13_BUCK_RAMP_DELAY, \
436+ .vsel_reg = S2MPS13_REG_B1OUT + (num) * 2 - 1, \
437+ .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \
438+ .enable_reg = S2MPS13_REG_B1CTRL + (num) * 2 - 1, \
439+ .enable_mask = S2MPS14_ENABLE_MASK \
440+}
441+
408442 static const struct regulator_desc s2mps13_regulators[] = {
409443 regulator_desc_s2mps13_ldo(1, MIN_800_MV, STEP_12_5_MV, 0x00),
410444 regulator_desc_s2mps13_ldo(2, MIN_1400_MV, STEP_50_MV, 0x0C),
@@ -452,10 +486,10 @@ static const struct regulator_desc s2mps13_regulators[] = { · 41 unmodified lines
452486 regulator_desc_s2mps13_buck(4, MIN_500_MV, STEP_6_25_MV, 0x10),
453487 regulator_desc_s2mps13_buck(5, MIN_500_MV, STEP_6_25_MV, 0x10),
454488 regulator_desc_s2mps13_buck(6, MIN_500_MV, STEP_6_25_MV, 0x10),
455− regulator_desc_s2mps13_buck(7, MIN_500_MV, STEP_6_25_MV, 0x10),
456− regulator_desc_s2mps13_buck(8, MIN_1000_MV, STEP_12_5_MV, 0x20),
457− regulator_desc_s2mps13_buck(9, MIN_1000_MV, STEP_12_5_MV, 0x20),
458− regulator_desc_s2mps13_buck(10, MIN_500_MV, STEP_6_25_MV, 0x10),
489+ regulator_desc_s2mps13_buck7(7, MIN_500_MV, STEP_6_25_MV, 0x10),
490+ regulator_desc_s2mps13_buck8_10(8, MIN_1000_MV, STEP_12_5_MV, 0x20),
491+ regulator_desc_s2mps13_buck8_10(9, MIN_1000_MV, STEP_12_5_MV, 0x20),
492+ regulator_desc_s2mps13_buck8_10(10, MIN_500_MV, STEP_6_25_MV, 0x10),
459493 };
460494
461495 static int s2mps14_regulator_enable(struct regulator_dev *rdev)
drivers/rtc/rtc-s5m.c+1−0
@@ -832,6 +832,7 @@ static SIMPLE_DEV_PM_OPS(s5m_rtc_pm_ops, s5m_rtc_suspend, s5m_rtc_resume); · 831 unmodified lines
832832 static const struct platform_device_id s5m_rtc_id[] = {
833833 { "s5m-rtc", S5M8767X },
834834 { "s2mps14-rtc", S2MPS14X },
835+ { },
835836 };
836837
837838 static struct platform_driver s5m_rtc_driver = {
drivers/s390/net/qeth_core_main.c+101−16
@@ -1784,6 +1784,8 @@ static int qeth_idx_activate_get_answer(struct qeth_channel *channel, · 1783 unmodified lines
17841784 QETH_DBF_TEXT(SETUP, 2, "idxanswr");
17851785 card = CARD_FROM_CDEV(channel->ccwdev);
17861786 iob = qeth_get_buffer(channel);
1787+ if (!iob)
1788+ return -ENOMEM;
17871789 iob->callback = idx_reply_cb;
17881790 memcpy(&channel->ccw, READ_CCW, sizeof(struct ccw1));
17891791 channel->ccw.count = QETH_BUFSIZE;
@@ -1834,6 +1836,8 @@ static int qeth_idx_activate_channel(struct qeth_channel *channel, · 44 unmodified lines
18341836 QETH_DBF_TEXT(SETUP, 2, "idxactch");
18351837
18361838 iob = qeth_get_buffer(channel);
1839+ if (!iob)
1840+ return -ENOMEM;
18371841 iob->callback = idx_reply_cb;
18381842 memcpy(&channel->ccw, WRITE_CCW, sizeof(struct ccw1));
18391843 channel->ccw.count = IDX_ACTIVATE_SIZE;
@@ -2021,10 +2025,36 @@ void qeth_prepare_control_data(struct qeth_card *card, int len, · 181 unmodified lines
20212025 }
20222026 EXPORT_SYMBOL_GPL(qeth_prepare_control_data);
20232027
2028+/**
2029+ * qeth_send_control_data() - send control command to the card
2030+ * @card: qeth_card structure pointer
2031+ * @len: size of the command buffer
2032+ * @iob: qeth_cmd_buffer pointer
2033+ * @reply_cb: callback function pointer
2034+ * @cb_card: pointer to the qeth_card structure
2035+ * @cb_reply: pointer to the qeth_reply structure
2036+ * @cb_cmd: pointer to the original iob for non-IPA
2037+ * commands, or to the qeth_ipa_cmd structure
2038+ * for the IPA commands.
2039+ * @reply_param: private pointer passed to the callback
2040+ *
2041+ * Returns the value of the `return_code' field of the response
2042+ * block returned from the hardware, or other error indication.
2043+ * Value of zero indicates successful execution of the command.
2044+ *
2045+ * Callback function gets called one or more times, with cb_cmd
2046+ * pointing to the response returned by the hardware. Callback
2047+ * function must return non-zero if more reply blocks are expected,
2048+ * and zero if the last or only reply block is received. Callback
2049+ * function can get the value of the reply_param pointer from the
2050+ * field 'param' of the structure qeth_reply.
2051+ */
2052+
20242053 int qeth_send_control_data(struct qeth_card *card, int len,
20252054 struct qeth_cmd_buffer *iob,
2026− int (*reply_cb)(struct qeth_card *, struct qeth_reply *,
2027− unsigned long),
2055+ int (*reply_cb)(struct qeth_card *cb_card,
2056+ struct qeth_reply *cb_reply,
2057+ unsigned long cb_cmd),
20282058 void *reply_param)
20292059 {
20302060 int rc;
@@ -2914,9 +2944,16 @@ struct qeth_cmd_buffer *qeth_get_ipacmd_buffer(struct qeth_card *card, · 883 unmodified lines
29142944 struct qeth_cmd_buffer *iob;
29152945 struct qeth_ipa_cmd *cmd;
29162946
2917− iob = qeth_wait_for_buffer(&card->write);
2918− cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
2919− qeth_fill_ipacmd_header(card, cmd, ipacmd, prot);
2947+ iob = qeth_get_buffer(&card->write);
2948+ if (iob) {
2949+ cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
2950+ qeth_fill_ipacmd_header(card, cmd, ipacmd, prot);
2951+ } else {
2952+ dev_warn(&card->gdev->dev,
2953+ "The qeth driver ran out of channel command buffers\n");
2954+ QETH_DBF_MESSAGE(1, "%s The qeth driver ran out of channel command buffers",
2955+ dev_name(&card->gdev->dev));
2956+ }
29202957
29212958 return iob;
29222959 }
@@ -2932,6 +2969,12 @@ void qeth_prepare_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, · 9 unmodified lines
29322969 }
29332970 EXPORT_SYMBOL_GPL(qeth_prepare_ipa_cmd);
29342971
2972+/**
2973+ * qeth_send_ipa_cmd() - send an IPA command
2974+ *
2975+ * See qeth_send_control_data() for explanation of the arguments.
2976+ */
2977+
29352978 int qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob,
29362979 int (*reply_cb)(struct qeth_card *, struct qeth_reply*,
29372980 unsigned long),
@@ -2968,6 +3011,8 @@ int qeth_send_startlan(struct qeth_card *card) · 30 unmodified lines
29683011 QETH_DBF_TEXT(SETUP, 2, "strtlan");
29693012
29703013 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_STARTLAN, 0);
3014+ if (!iob)
3015+ return -ENOMEM;
29713016 rc = qeth_send_ipa_cmd(card, iob, NULL, NULL);
29723017 return rc;
29733018 }
@@ -3013,11 +3058,13 @@ static struct qeth_cmd_buffer *qeth_get_adapter_cmd(struct qeth_card *card, · 39 unmodified lines
30133058
30143059 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETADAPTERPARMS,
30153060 QETH_PROT_IPV4);
3016− cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
3017− cmd->data.setadapterparms.hdr.cmdlength = cmdlen;
3018− cmd->data.setadapterparms.hdr.command_code = command;
3019− cmd->data.setadapterparms.hdr.used_total = 1;
3020− cmd->data.setadapterparms.hdr.seq_no = 1;
3061+ if (iob) {
3062+ cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
3063+ cmd->data.setadapterparms.hdr.cmdlength = cmdlen;
3064+ cmd->data.setadapterparms.hdr.command_code = command;
3065+ cmd->data.setadapterparms.hdr.used_total = 1;
3066+ cmd->data.setadapterparms.hdr.seq_no = 1;
3067+ }
30213068
30223069 return iob;
30233070 }
@@ -3030,6 +3077,8 @@ int qeth_query_setadapterparms(struct qeth_card *card) · 6 unmodified lines
30303077 QETH_CARD_TEXT(card, 3, "queryadp");
30313078 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_COMMANDS_SUPPORTED,
30323079 sizeof(struct qeth_ipacmd_setadpparms));
3080+ if (!iob)
3081+ return -ENOMEM;
30333082 rc = qeth_send_ipa_cmd(card, iob, qeth_query_setadapterparms_cb, NULL);
30343083 return rc;
30353084 }
@@ -3080,6 +3129,8 @@ int qeth_query_ipassists(struct qeth_card *card, enum qeth_prot_versions prot) · 44 unmodified lines
30803129
30813130 QETH_DBF_TEXT_(SETUP, 2, "qipassi%i", prot);
30823131 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_QIPASSIST, prot);
3132+ if (!iob)
3133+ return -ENOMEM;
30833134 rc = qeth_send_ipa_cmd(card, iob, qeth_query_ipassists_cb, NULL);
30843135 return rc;
30853136 }
@@ -3119,6 +3170,8 @@ int qeth_query_switch_attributes(struct qeth_card *card, · 33 unmodified lines
31193170 return -ENOMEDIUM;
31203171 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_SWITCH_ATTRIBUTES,
31213172 sizeof(struct qeth_ipacmd_setadpparms_hdr));
3173+ if (!iob)
3174+ return -ENOMEM;
31223175 return qeth_send_ipa_cmd(card, iob,
31233176 qeth_query_switch_attributes_cb, sw_info);
31243177 }
@@ -3146,6 +3199,8 @@ static int qeth_query_setdiagass(struct qeth_card *card) · 21 unmodified lines
31463199
31473200 QETH_DBF_TEXT(SETUP, 2, "qdiagass");
31483201 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SET_DIAG_ASS, 0);
3202+ if (!iob)
3203+ return -ENOMEM;
31493204 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
31503205 cmd->data.diagass.subcmd_len = 16;
31513206 cmd->data.diagass.subcmd = QETH_DIAGS_CMD_QUERY;
@@ -3197,6 +3252,8 @@ int qeth_hw_trap(struct qeth_card *card, enum qeth_diags_trap_action action) · 45 unmodified lines
31973252
31983253 QETH_DBF_TEXT(SETUP, 2, "diagtrap");
31993254 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SET_DIAG_ASS, 0);
3255+ if (!iob)
3256+ return -ENOMEM;
32003257 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
32013258 cmd->data.diagass.subcmd_len = 80;
32023259 cmd->data.diagass.subcmd = QETH_DIAGS_CMD_TRAP;
@@ -4162,6 +4219,8 @@ void qeth_setadp_promisc_mode(struct qeth_card *card) · 959 unmodified lines
41624219
41634220 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_PROMISC_MODE,
41644221 sizeof(struct qeth_ipacmd_setadpparms));
4222+ if (!iob)
4223+ return;
41654224 cmd = (struct qeth_ipa_cmd *)(iob->data + IPA_PDU_HEADER_SIZE);
41664225 cmd->data.setadapterparms.data.mode = mode;
41674226 qeth_send_ipa_cmd(card, iob, qeth_setadp_promisc_mode_cb, NULL);
@@ -4232,6 +4291,8 @@ int qeth_setadpparms_change_macaddr(struct qeth_card *card) · 64 unmodified lines
42324291
42334292 iob = qeth_get_adapter_cmd(card, IPA_SETADP_ALTER_MAC_ADDRESS,
42344293 sizeof(struct qeth_ipacmd_setadpparms));
4294+ if (!iob)
4295+ return -ENOMEM;
42354296 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
42364297 cmd->data.setadapterparms.data.change_addr.cmd = CHANGE_ADDR_READ_MAC;
42374298 cmd->data.setadapterparms.data.change_addr.addr_size = OSA_ADDR_LEN;
@@ -4345,6 +4406,8 @@ static int qeth_setadpparms_set_access_ctrl(struct qeth_card *card, · 107 unmodified lines
43454406 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_ACCESS_CONTROL,
43464407 sizeof(struct qeth_ipacmd_setadpparms_hdr) +
43474408 sizeof(struct qeth_set_access_ctrl));
4409+ if (!iob)
4410+ return -ENOMEM;
43484411 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
43494412 access_ctrl_req = &cmd->data.setadapterparms.data.set_access_ctrl;
43504413 access_ctrl_req->subcmd_code = isolation;
@@ -4588,6 +4651,10 @@ int qeth_snmp_command(struct qeth_card *card, char __user *udata) · 237 unmodified lines
45884651
45894652 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_SNMP_CONTROL,
45904653 QETH_SNMP_SETADP_CMDLENGTH + req_len);
4654+ if (!iob) {
4655+ rc = -ENOMEM;
4656+ goto out;
4657+ }
45914658 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
45924659 memcpy(&cmd->data.setadapterparms.data.snmp, &ureq->cmd, req_len);
45934660 rc = qeth_send_ipa_snmp_cmd(card, iob, QETH_SETADP_BASE_LEN + req_len,
@@ -4599,7 +4666,7 @@ int qeth_snmp_command(struct qeth_card *card, char __user *udata) · 5 unmodified lines
45994666 if (copy_to_user(udata, qinfo.udata, qinfo.udata_len))
46004667 rc = -EFAULT;
46014668 }
4602−
4669+out:
46034670 kfree(ureq);
46044671 kfree(qinfo.udata);
46054672 return rc;
@@ -4670,6 +4737,10 @@ int qeth_query_oat_command(struct qeth_card *card, char __user *udata) · 64 unmodified lines
46704737 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_OAT,
46714738 sizeof(struct qeth_ipacmd_setadpparms_hdr) +
46724739 sizeof(struct qeth_query_oat));
4740+ if (!iob) {
4741+ rc = -ENOMEM;
4742+ goto out_free;
4743+ }
46734744 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
46744745 oat_req = &cmd->data.setadapterparms.data.query_oat;
46754746 oat_req->subcmd_code = oat_data.command;
@@ -4735,6 +4806,8 @@ static int qeth_query_card_info(struct qeth_card *card, · 59 unmodified lines
47354806 return -EOPNOTSUPP;
47364807 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_CARD_INFO,
47374808 sizeof(struct qeth_ipacmd_setadpparms_hdr));
4809+ if (!iob)
4810+ return -ENOMEM;
47384811 return qeth_send_ipa_cmd(card, iob, qeth_query_card_info_cb,
47394812 (void *)carrier_info);
47404813 }
@@ -5060,11 +5133,23 @@ retriable: · 319 unmodified lines
50605133 card->options.adp.supported_funcs = 0;
50615134 card->options.sbp.supported_funcs = 0;
50625135 card->info.diagass_support = 0;
5063− qeth_query_ipassists(card, QETH_PROT_IPV4);
5064− if (qeth_is_supported(card, IPA_SETADAPTERPARMS))
5065− qeth_query_setadapterparms(card);
5066− if (qeth_adp_supported(card, IPA_SETADP_SET_DIAG_ASSIST))
5067− qeth_query_setdiagass(card);
5136+ rc = qeth_query_ipassists(card, QETH_PROT_IPV4);
5137+ if (rc == -ENOMEM)
5138+ goto out;
5139+ if (qeth_is_supported(card, IPA_SETADAPTERPARMS)) {
5140+ rc = qeth_query_setadapterparms(card);
5141+ if (rc < 0) {
5142+ QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc);
5143+ goto out;
5144+ }
5145+ }
5146+ if (qeth_adp_supported(card, IPA_SETADP_SET_DIAG_ASSIST)) {
5147+ rc = qeth_query_setdiagass(card);
5148+ if (rc < 0) {
5149+ QETH_DBF_TEXT_(SETUP, 2, "7err%d", rc);
5150+ goto out;
5151+ }
5152+ }
50685153 return 0;
50695154 out:
50705155 dev_warn(&card->gdev->dev, "The qeth device driver failed to recover "
drivers/s390/net/qeth_l2_main.c+108−112
@@ -27,10 +27,7 @@ static int qeth_l2_set_offline(struct ccwgroup_device *); · 26 unmodified lines
2727 static int qeth_l2_stop(struct net_device *);
2828 static int qeth_l2_send_delmac(struct qeth_card *, __u8 *);
2929 static int qeth_l2_send_setdelmac(struct qeth_card *, __u8 *,
30− enum qeth_ipa_cmds,
31− int (*reply_cb) (struct qeth_card *,
32− struct qeth_reply*,
33− unsigned long));
30+ enum qeth_ipa_cmds);
3431 static void qeth_l2_set_multicast_list(struct net_device *);
3532 static int qeth_l2_recover(void *);
3633 static void qeth_bridgeport_query_support(struct qeth_card *card);
@@ -130,56 +127,71 @@ static struct net_device *qeth_l2_netdev_by_devno(unsigned char *read_dev_no) · 93 unmodified lines
130127 return ndev;
131128 }
132129
133−static int qeth_l2_send_setgroupmac_cb(struct qeth_card *card,
134− struct qeth_reply *reply,
135− unsigned long data)
130+static int qeth_setdel_makerc(struct qeth_card *card, int retcode)
136131 {
137− struct qeth_ipa_cmd *cmd;
138− __u8 *mac;
132+ int rc;
139133
140− QETH_CARD_TEXT(card, 2, "L2Sgmacb");
141− cmd = (struct qeth_ipa_cmd *) data;
142− mac = &cmd->data.setdelmac.mac[0];
143− /* MAC already registered, needed in couple/uncouple case */
144− if (cmd->hdr.return_code == IPA_RC_L2_DUP_MAC) {
145− QETH_DBF_MESSAGE(2, "Group MAC %pM already existing on %s \n",
146− mac, QETH_CARD_IFNAME(card));
147− cmd->hdr.return_code = 0;
134+ if (retcode)
135+ QETH_CARD_TEXT_(card, 2, "err%04x", retcode);
136+ switch (retcode) {
137+ case IPA_RC_SUCCESS:
138+ rc = 0;
139+ break;
140+ case IPA_RC_L2_UNSUPPORTED_CMD:
141+ rc = -ENOSYS;
142+ break;
143+ case IPA_RC_L2_ADDR_TABLE_FULL:
144+ rc = -ENOSPC;
145+ break;
146+ case IPA_RC_L2_DUP_MAC:
147+ case IPA_RC_L2_DUP_LAYER3_MAC:
148+ rc = -EEXIST;
149+ break;
150+ case IPA_RC_L2_MAC_NOT_AUTH_BY_HYP:
151+ case IPA_RC_L2_MAC_NOT_AUTH_BY_ADP:
152+ rc = -EPERM;
153+ break;
154+ case IPA_RC_L2_MAC_NOT_FOUND:
155+ rc = -ENOENT;
156+ break;
157+ case -ENOMEM:
158+ rc = -ENOMEM;
159+ break;
160+ default:
161+ rc = -EIO;
162+ break;
148163 }
149− if (cmd->hdr.return_code)
150− QETH_DBF_MESSAGE(2, "Could not set group MAC %pM on %s: %x\n",
151− mac, QETH_CARD_IFNAME(card), cmd->hdr.return_code);
152− return 0;
164+ return rc;
153165 }
154166
155167 static int qeth_l2_send_setgroupmac(struct qeth_card *card, __u8 *mac)
156168 {
157− QETH_CARD_TEXT(card, 2, "L2Sgmac");
158− return qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETGMAC,
159− qeth_l2_send_setgroupmac_cb);
160−}
161−
162−static int qeth_l2_send_delgroupmac_cb(struct qeth_card *card,
163− struct qeth_reply *reply,
164− unsigned long data)
165−{
166− struct qeth_ipa_cmd *cmd;
167− __u8 *mac;
169+ int rc;
168170
169− QETH_CARD_TEXT(card, 2, "L2Dgmacb");
170− cmd = (struct qeth_ipa_cmd *) data;
171− mac = &cmd->data.setdelmac.mac[0];
172− if (cmd->hdr.return_code)
173− QETH_DBF_MESSAGE(2, "Could not delete group MAC %pM on %s: %x\n",
174− mac, QETH_CARD_IFNAME(card), cmd->hdr.return_code);
175− return 0;
171+ QETH_CARD_TEXT(card, 2, "L2Sgmac");
172+ rc = qeth_setdel_makerc(card, qeth_l2_send_setdelmac(card, mac,
173+ IPA_CMD_SETGMAC));
174+ if (rc == -EEXIST)
175+ QETH_DBF_MESSAGE(2, "Group MAC %pM already existing on %s\n",
176+ mac, QETH_CARD_IFNAME(card));
177+ else if (rc)
178+ QETH_DBF_MESSAGE(2, "Could not set group MAC %pM on %s: %d\n",
179+ mac, QETH_CARD_IFNAME(card), rc);
180+ return rc;
176181 }
177182
178183 static int qeth_l2_send_delgroupmac(struct qeth_card *card, __u8 *mac)
179184 {
185+ int rc;
186+
180187 QETH_CARD_TEXT(card, 2, "L2Dgmac");
181− return qeth_l2_send_setdelmac(card, mac, IPA_CMD_DELGMAC,
182− qeth_l2_send_delgroupmac_cb);
188+ rc = qeth_setdel_makerc(card, qeth_l2_send_setdelmac(card, mac,
189+ IPA_CMD_DELGMAC));
190+ if (rc)
191+ QETH_DBF_MESSAGE(2,
192+ "Could not delete group MAC %pM on %s: %d\n",
193+ mac, QETH_CARD_IFNAME(card), rc);
194+ return rc;
183195 }
184196
185197 static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac, int vmac)
@@ -197,10 +209,11 @@ static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac, int vmac) · 11 unmodified lines
197209 mc->is_vmac = vmac;
198210
199211 if (vmac) {
200− rc = qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC,
201− NULL);
212+ rc = qeth_setdel_makerc(card,
213+ qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC));
202214 } else {
203− rc = qeth_l2_send_setgroupmac(card, mac);
215+ rc = qeth_setdel_makerc(card,
216+ qeth_l2_send_setgroupmac(card, mac));
204217 }
205218
206219 if (!rc)
@@ -218,7 +231,7 @@ static void qeth_l2_del_all_mc(struct qeth_card *card, int del) · 11 unmodified lines
218231 if (del) {
219232 if (mc->is_vmac)
220233 qeth_l2_send_setdelmac(card, mc->mc_addr,
221− IPA_CMD_DELVMAC, NULL);
234+ IPA_CMD_DELVMAC);
222235 else
223236 qeth_l2_send_delgroupmac(card, mc->mc_addr);
224237 }
@@ -291,6 +304,8 @@ static int qeth_l2_send_setdelvlan(struct qeth_card *card, __u16 i, · 66 unmodified lines
291304
292305 QETH_CARD_TEXT_(card, 4, "L2sdv%x", ipacmd);
293306 iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4);
307+ if (!iob)
308+ return -ENOMEM;
294309 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
295310 cmd->data.setdelvlan.vlan_id = i;
296311 return qeth_send_ipa_cmd(card, iob,
@@ -313,6 +328,7 @@ static int qeth_l2_vlan_rx_add_vid(struct net_device *dev, · 16 unmodified lines
313328 {
314329 struct qeth_card *card = dev->ml_priv;
315330 struct qeth_vlan_vid *id;
331+ int rc;
316332
317333 QETH_CARD_TEXT_(card, 4, "aid:%d", vid);
318334 if (!vid)
@@ -328,7 +344,11 @@ static int qeth_l2_vlan_rx_add_vid(struct net_device *dev, · 9 unmodified lines
328344 id = kmalloc(sizeof(struct qeth_vlan_vid), GFP_ATOMIC);
329345 if (id) {
330346 id->vid = vid;
331− qeth_l2_send_setdelvlan(card, vid, IPA_CMD_SETVLAN);
347+ rc = qeth_l2_send_setdelvlan(card, vid, IPA_CMD_SETVLAN);
348+ if (rc) {
349+ kfree(id);
350+ return rc;
351+ }
332352 spin_lock_bh(&card->vlanlock);
333353 list_add_tail(&id->list, &card->vid_list);
334354 spin_unlock_bh(&card->vlanlock);
@@ -343,6 +363,7 @@ static int qeth_l2_vlan_rx_kill_vid(struct net_device *dev, · 8 unmodified lines
343363 {
344364 struct qeth_vlan_vid *id, *tmpid = NULL;
345365 struct qeth_card *card = dev->ml_priv;
366+ int rc = 0;
346367
347368 QETH_CARD_TEXT_(card, 4, "kid:%d", vid);
348369 if (card->info.type == QETH_CARD_TYPE_OSM) {
@@ -363,11 +384,11 @@ static int qeth_l2_vlan_rx_kill_vid(struct net_device *dev, · 14 unmodified lines
363384 }
364385 spin_unlock_bh(&card->vlanlock);
365386 if (tmpid) {
366− qeth_l2_send_setdelvlan(card, vid, IPA_CMD_DELVLAN);
387+ rc = qeth_l2_send_setdelvlan(card, vid, IPA_CMD_DELVLAN);
367388 kfree(tmpid);
368389 }
369390 qeth_l2_set_multicast_list(card->dev);
370− return 0;
391+ return rc;
371392 }
372393
373394 static int qeth_l2_stop_card(struct qeth_card *card, int recovery_mode)
@@ -539,91 +560,62 @@ out: · 165 unmodified lines
539560 }
540561
541562 static int qeth_l2_send_setdelmac(struct qeth_card *card, __u8 *mac,
542− enum qeth_ipa_cmds ipacmd,
543− int (*reply_cb) (struct qeth_card *,
544− struct qeth_reply*,
545− unsigned long))
563+ enum qeth_ipa_cmds ipacmd)
546564 {
547565 struct qeth_ipa_cmd *cmd;
548566 struct qeth_cmd_buffer *iob;
549567
550568 QETH_CARD_TEXT(card, 2, "L2sdmac");
551569 iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4);
570+ if (!iob)
571+ return -ENOMEM;
552572 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
553573 cmd->data.setdelmac.mac_length = OSA_ADDR_LEN;
554574 memcpy(&cmd->data.setdelmac.mac, mac, OSA_ADDR_LEN);
555− return qeth_send_ipa_cmd(card, iob, reply_cb, NULL);
575+ return qeth_send_ipa_cmd(card, iob, NULL, NULL);
556576 }
557577
558−static int qeth_l2_send_setmac_cb(struct qeth_card *card,
559− struct qeth_reply *reply,
560− unsigned long data)
578+static int qeth_l2_send_setmac(struct qeth_card *card, __u8 *mac)
561579 {
562− struct qeth_ipa_cmd *cmd;
580+ int rc;
563581
564− QETH_CARD_TEXT(card, 2, "L2Smaccb");
565− cmd = (struct qeth_ipa_cmd *) data;
566− if (cmd->hdr.return_code) {
567− QETH_CARD_TEXT_(card, 2, "L2er%x", cmd->hdr.return_code);
582+ QETH_CARD_TEXT(card, 2, "L2Setmac");
583+ rc = qeth_setdel_makerc(card, qeth_l2_send_setdelmac(card, mac,
584+ IPA_CMD_SETVMAC));
585+ if (rc == 0) {
586+ card->info.mac_bits |= QETH_LAYER2_MAC_REGISTERED;
587+ memcpy(card->dev->dev_addr, mac, OSA_ADDR_LEN);
588+ dev_info(&card->gdev->dev,
589+ "MAC address %pM successfully registered on device %s\n",
590+ card->dev->dev_addr, card->dev->name);
591+ } else {
568592 card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED;
569− switch (cmd->hdr.return_code) {
570− case IPA_RC_L2_DUP_MAC:
571− case IPA_RC_L2_DUP_LAYER3_MAC:
593+ switch (rc) {
594+ case -EEXIST:
572595 dev_warn(&card->gdev->dev,
573− "MAC address %pM already exists\n",
574− cmd->data.setdelmac.mac);
596+ "MAC address %pM already exists\n", mac);
575597 break;
576− case IPA_RC_L2_MAC_NOT_AUTH_BY_HYP:
577− case IPA_RC_L2_MAC_NOT_AUTH_BY_ADP:
598+ case -EPERM:
578599 dev_warn(&card->gdev->dev,
579− "MAC address %pM is not authorized\n",
580− cmd->data.setdelmac.mac);
581− break;
582− default:
600+ "MAC address %pM is not authorized\n", mac);
583601 break;
584602 }
585− } else {
586− card->info.mac_bits |= QETH_LAYER2_MAC_REGISTERED;
587− memcpy(card->dev->dev_addr, cmd->data.setdelmac.mac,
588− OSA_ADDR_LEN);
589− dev_info(&card->gdev->dev,
590− "MAC address %pM successfully registered on device %s\n",
591− card->dev->dev_addr, card->dev->name);
592− }
593− return 0;
594−}
595−
596−static int qeth_l2_send_setmac(struct qeth_card *card, __u8 *mac)
597−{
598− QETH_CARD_TEXT(card, 2, "L2Setmac");
599− return qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC,
600− qeth_l2_send_setmac_cb);
601−}
602−
603−static int qeth_l2_send_delmac_cb(struct qeth_card *card,
604− struct qeth_reply *reply,
605− unsigned long data)
606−{
607− struct qeth_ipa_cmd *cmd;
608−
609− QETH_CARD_TEXT(card, 2, "L2Dmaccb");
610− cmd = (struct qeth_ipa_cmd *) data;
611− if (cmd->hdr.return_code) {
612− QETH_CARD_TEXT_(card, 2, "err%d", cmd->hdr.return_code);
613− return 0;
614603 }
615− card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED;
616−
617− return 0;
604+ return rc;
618605 }
619606
620607 static int qeth_l2_send_delmac(struct qeth_card *card, __u8 *mac)
621608 {
609+ int rc;
610+
622611 QETH_CARD_TEXT(card, 2, "L2Delmac");
623612 if (!(card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED))
624613 return 0;
625− return qeth_l2_send_setdelmac(card, mac, IPA_CMD_DELVMAC,
626− qeth_l2_send_delmac_cb);
614+ rc = qeth_setdel_makerc(card, qeth_l2_send_setdelmac(card, mac,
615+ IPA_CMD_DELVMAC));
616+ if (rc == 0)
617+ card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED;
618+ return rc;
627619 }
628620
629621 static int qeth_l2_request_initial_mac(struct qeth_card *card)
@@ -651,7 +643,7 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card) · 21 unmodified lines
651643 if (rc) {
652644 QETH_DBF_MESSAGE(2, "couldn't get MAC address on "
653645 "device %s: x%x\n", CARD_BUS_ID(card), rc);
654− QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);
646+ QETH_DBF_TEXT_(SETUP, 2, "1err%04x", rc);
655647 return rc;
656648 }
657649 QETH_DBF_HEX(SETUP, 2, card->dev->dev_addr, OSA_ADDR_LEN);
@@ -687,7 +679,7 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p) · 29 unmodified lines
687679 return -ERESTARTSYS;
688680 }
689681 rc = qeth_l2_send_delmac(card, &card->dev->dev_addr[0]);
690− if (!rc || (rc == IPA_RC_L2_MAC_NOT_FOUND))
682+ if (!rc || (rc == -ENOENT))
691683 rc = qeth_l2_send_setmac(card, addr->sa_data);
692684 return rc ? -EINVAL : 0;
693685 }
@@ -996,7 +988,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) · 302 unmodified lines
996988 recover_flag = card->state;
997989 rc = qeth_core_hardsetup_card(card);
998990 if (rc) {
999− QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc);
991+ QETH_DBF_TEXT_(SETUP, 2, "2err%04x", rc);
1000992 rc = -ENODEV;
1001993 goto out_remove;
1002994 }
@@ -1730,6 +1722,8 @@ static void qeth_bridgeport_query_support(struct qeth_card *card) · 727 unmodified lines
17301722
17311723 QETH_CARD_TEXT(card, 2, "brqsuppo");
17321724 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETBRIDGEPORT, 0);
1725+ if (!iob)
1726+ return;
17331727 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
17341728 cmd->data.sbp.hdr.cmdlength =
17351729 sizeof(struct qeth_ipacmd_sbp_hdr) +
@@ -1805,6 +1799,8 @@ int qeth_bridgeport_query_ports(struct qeth_card *card, · 69 unmodified lines
18051799 if (!(card->options.sbp.supported_funcs & IPA_SBP_QUERY_BRIDGE_PORTS))
18061800 return -EOPNOTSUPP;
18071801 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETBRIDGEPORT, 0);
1802+ if (!iob)
1803+ return -ENOMEM;
18081804 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
18091805 cmd->data.sbp.hdr.cmdlength =
18101806 sizeof(struct qeth_ipacmd_sbp_hdr);
@@ -1817,9 +1813,7 @@ int qeth_bridgeport_query_ports(struct qeth_card *card, · 6 unmodified lines
18171813 if (rc)
18181814 return rc;
18191815 rc = qeth_bridgeport_makerc(card, &cbctl, IPA_SBP_QUERY_BRIDGE_PORTS);
1820− if (rc)
1821− return rc;
1822− return 0;
1816+ return rc;
18231817 }
18241818 EXPORT_SYMBOL_GPL(qeth_bridgeport_query_ports);
18251819
@@ -1873,6 +1867,8 @@ int qeth_bridgeport_setrole(struct qeth_card *card, enum qeth_sbp_roles role) · 47 unmodified lines
18731867 if (!(card->options.sbp.supported_funcs & setcmd))
18741868 return -EOPNOTSUPP;
18751869 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETBRIDGEPORT, 0);
1870+ if (!iob)
1871+ return -ENOMEM;
18761872 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
18771873 cmd->data.sbp.hdr.cmdlength = cmdlength;
18781874 cmd->data.sbp.hdr.command_code = setcmd;
drivers/s390/net/qeth_l3_main.c+39−11
@@ -549,6 +549,8 @@ static int qeth_l3_send_setdelmc(struct qeth_card *card, · 548 unmodified lines
549549 QETH_CARD_TEXT(card, 4, "setdelmc");
550550
551551 iob = qeth_get_ipacmd_buffer(card, ipacmd, addr->proto);
552+ if (!iob)
553+ return -ENOMEM;
552554 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
553555 memcpy(&cmd->data.setdelipm.mac, addr->mac, OSA_ADDR_LEN);
554556 if (addr->proto == QETH_PROT_IPV6)
@@ -588,6 +590,8 @@ static int qeth_l3_send_setdelip(struct qeth_card *card, · 33 unmodified lines
588590 QETH_CARD_TEXT_(card, 4, "flags%02X", flags);
589591
590592 iob = qeth_get_ipacmd_buffer(card, ipacmd, addr->proto);
593+ if (!iob)
594+ return -ENOMEM;
591595 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
592596 if (addr->proto == QETH_PROT_IPV6) {
593597 memcpy(cmd->data.setdelip6.ip_addr, &addr->u.a6.addr,
@@ -616,6 +620,8 @@ static int qeth_l3_send_setrouting(struct qeth_card *card, · 22 unmodified lines
616620
617621 QETH_CARD_TEXT(card, 4, "setroutg");
618622 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETRTG, prot);
623+ if (!iob)
624+ return -ENOMEM;
619625 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
620626 cmd->data.setrtg.type = (type);
621627 rc = qeth_send_ipa_cmd(card, iob, NULL, NULL);
@@ -1049,12 +1055,14 @@ static struct qeth_cmd_buffer *qeth_l3_get_setassparms_cmd( · 427 unmodified lines
10491055 QETH_CARD_TEXT(card, 4, "getasscm");
10501056 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETASSPARMS, prot);
10511057
1052− cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
1053− cmd->data.setassparms.hdr.assist_no = ipa_func;
1054− cmd->data.setassparms.hdr.length = 8 + len;
1055− cmd->data.setassparms.hdr.command_code = cmd_code;
1056− cmd->data.setassparms.hdr.return_code = 0;
1057− cmd->data.setassparms.hdr.seq_no = 0;
1058+ if (iob) {
1059+ cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
1060+ cmd->data.setassparms.hdr.assist_no = ipa_func;
1061+ cmd->data.setassparms.hdr.length = 8 + len;
1062+ cmd->data.setassparms.hdr.command_code = cmd_code;
1063+ cmd->data.setassparms.hdr.return_code = 0;
1064+ cmd->data.setassparms.hdr.seq_no = 0;
1065+ }
10581066
10591067 return iob;
10601068 }
@@ -1090,6 +1098,8 @@ static int qeth_l3_send_simple_setassparms_ipv6(struct qeth_card *card, · 29 unmodified lines
10901098 QETH_CARD_TEXT(card, 4, "simassp6");
10911099 iob = qeth_l3_get_setassparms_cmd(card, ipa_func, cmd_code,
10921100 0, QETH_PROT_IPV6);
1101+ if (!iob)
1102+ return -ENOMEM;
10931103 rc = qeth_l3_send_setassparms(card, iob, 0, 0,
10941104 qeth_l3_default_setassparms_cb, NULL);
10951105 return rc;
@@ -1108,6 +1118,8 @@ static int qeth_l3_send_simple_setassparms(struct qeth_card *card, · 12 unmodified lines
11081118 length = sizeof(__u32);
11091119 iob = qeth_l3_get_setassparms_cmd(card, ipa_func, cmd_code,
11101120 length, QETH_PROT_IPV4);
1121+ if (!iob)
1122+ return -ENOMEM;
11111123 rc = qeth_l3_send_setassparms(card, iob, length, data,
11121124 qeth_l3_default_setassparms_cb, NULL);
11131125 return rc;
@@ -1494,6 +1506,8 @@ static int qeth_l3_iqd_read_initial_mac(struct qeth_card *card) · 380 unmodified lines
14941506
14951507 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_CREATE_ADDR,
14961508 QETH_PROT_IPV6);
1509+ if (!iob)
1510+ return -ENOMEM;
14971511 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
14981512 *((__u16 *) &cmd->data.create_destroy_addr.unique_id[6]) =
14991513 card->info.unique_id;
@@ -1537,6 +1551,8 @@ static int qeth_l3_get_unique_id(struct qeth_card *card) · 37 unmodified lines
15371551
15381552 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_CREATE_ADDR,
15391553 QETH_PROT_IPV6);
1554+ if (!iob)
1555+ return -ENOMEM;
15401556 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
15411557 *((__u16 *) &cmd->data.create_destroy_addr.unique_id[6]) =
15421558 card->info.unique_id;
@@ -1611,6 +1627,8 @@ qeth_diags_trace(struct qeth_card *card, enum qeth_diags_trace_cmds diags_cmd) · 68 unmodified lines
16111627 QETH_DBF_TEXT(SETUP, 2, "diagtrac");
16121628
16131629 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SET_DIAG_ASS, 0);
1630+ if (!iob)
1631+ return -ENOMEM;
16141632 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
16151633 cmd->data.diagass.subcmd_len = 16;
16161634 cmd->data.diagass.subcmd = QETH_DIAGS_CMD_TRACE;
@@ -2442,6 +2460,8 @@ static int qeth_l3_query_arp_cache_info(struct qeth_card *card, · 825 unmodified lines
24422460 IPA_CMD_ASS_ARP_QUERY_INFO,
24432461 sizeof(struct qeth_arp_query_data) - sizeof(char),
24442462 prot);
2463+ if (!iob)
2464+ return -ENOMEM;
24452465 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
24462466 cmd->data.setassparms.data.query_arp.request_bits = 0x000F;
24472467 cmd->data.setassparms.data.query_arp.reply_bits = 0;
@@ -2535,6 +2555,8 @@ static int qeth_l3_arp_add_entry(struct qeth_card *card, · 87 unmodified lines
25352555 IPA_CMD_ASS_ARP_ADD_ENTRY,
25362556 sizeof(struct qeth_arp_cache_entry),
25372557 QETH_PROT_IPV4);
2558+ if (!iob)
2559+ return -ENOMEM;
25382560 rc = qeth_l3_send_setassparms(card, iob,
25392561 sizeof(struct qeth_arp_cache_entry),
25402562 (unsigned long) entry,
@@ -2574,6 +2596,8 @@ static int qeth_l3_arp_remove_entry(struct qeth_card *card, · 33 unmodified lines
25742596 IPA_CMD_ASS_ARP_REMOVE_ENTRY,
25752597 12,
25762598 QETH_PROT_IPV4);
2599+ if (!iob)
2600+ return -ENOMEM;
25772601 rc = qeth_l3_send_setassparms(card, iob,
25782602 12, (unsigned long)buf,
25792603 qeth_l3_default_setassparms_cb, NULL);
@@ -3262,6 +3286,8 @@ static const struct net_device_ops qeth_l3_osa_netdev_ops = { · 682 unmodified lines
32623286
32633287 static int qeth_l3_setup_netdev(struct qeth_card *card)
32643288 {
3289+ int rc;
3290+
32653291 if (card->info.type == QETH_CARD_TYPE_OSD ||
32663292 card->info.type == QETH_CARD_TYPE_OSX) {
32673293 if ((card->info.link_type == QETH_LINK_TYPE_LANE_TR) ||
@@ -3293,7 +3319,9 @@ static int qeth_l3_setup_netdev(struct qeth_card *card) · 25 unmodified lines
32933319 return -ENODEV;
32943320 card->dev->flags |= IFF_NOARP;
32953321 card->dev->netdev_ops = &qeth_l3_netdev_ops;
3296− qeth_l3_iqd_read_initial_mac(card);
3322+ rc = qeth_l3_iqd_read_initial_mac(card);
3323+ if (rc)
3324+ return rc;
32973325 if (card->options.hsuid[0])
32983326 memcpy(card->dev->perm_addr, card->options.hsuid, 9);
32993327 } else
@@ -3360,7 +3388,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) · 60 unmodified lines
33603388 recover_flag = card->state;
33613389 rc = qeth_core_hardsetup_card(card);
33623390 if (rc) {
3363− QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc);
3391+ QETH_DBF_TEXT_(SETUP, 2, "2err%04x", rc);
33643392 rc = -ENODEV;
33653393 goto out_remove;
33663394 }
@@ -3401,7 +3429,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) · 34 unmodified lines
34013429 contin:
34023430 rc = qeth_l3_setadapter_parms(card);
34033431 if (rc)
3404− QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc);
3432+ QETH_DBF_TEXT_(SETUP, 2, "2err%04x", rc);
34053433 if (!card->options.sniffer) {
34063434 rc = qeth_l3_start_ipassists(card);
34073435 if (rc) {
@@ -3410,10 +3438,10 @@ contin: · 2 unmodified lines
34103438 }
34113439 rc = qeth_l3_setrouting_v4(card);
34123440 if (rc)
3413− QETH_DBF_TEXT_(SETUP, 2, "4err%d", rc);
3441+ QETH_DBF_TEXT_(SETUP, 2, "4err%04x", rc);
34143442 rc = qeth_l3_setrouting_v6(card);
34153443 if (rc)
3416− QETH_DBF_TEXT_(SETUP, 2, "5err%d", rc);
3444+ QETH_DBF_TEXT_(SETUP, 2, "5err%04x", rc);
34173445 }
34183446 netif_tx_disable(card->dev);
34193447
drivers/scsi/scsi.c+3−10
@@ -986,9 +986,9 @@ int scsi_device_get(struct scsi_device *sdev) · 985 unmodified lines
986986 return -ENXIO;
987987 if (!get_device(&sdev->sdev_gendev))
988988 return -ENXIO;
989− /* We can fail this if we're doing SCSI operations
989+ /* We can fail try_module_get if we're doing SCSI operations
990990 * from module exit (like cache flush) */
991− try_module_get(sdev->host->hostt->module);
991+ __module_get(sdev->host->hostt->module);
992992
993993 return 0;
994994 }
@@ -1004,14 +1004,7 @@ EXPORT_SYMBOL(scsi_device_get); · 9 unmodified lines
10041004 */
10051005 void scsi_device_put(struct scsi_device *sdev)
10061006 {
1007−#ifdef CONFIG_MODULE_UNLOAD
1008− struct module *module = sdev->host->hostt->module;
1009−
1010− /* The module refcount will be zero if scsi_device_get()
1011− * was called from a module removal routine */
1012− if (module && module_refcount(module) != 0)
1013− module_put(module);
1014−#endif
1007+ module_put(sdev->host->hostt->module);
10151008 put_device(&sdev->sdev_gendev);
10161009 }
10171010 EXPORT_SYMBOL(scsi_device_put);
drivers/spi/spi-dw-mid.c+0−1
@@ -271,7 +271,6 @@ int dw_spi_mid_init(struct dw_spi *dws) · 270 unmodified lines
271271 iounmap(clk_reg);
272272
273273 dws->num_cs = 16;
274− dws->fifo_len = 40; /* FIFO has 40 words buffer */
275274
276275 #ifdef CONFIG_SPI_DW_MID_DMA
277276 dws->dma_priv = kzalloc(sizeof(struct mid_dma), GFP_KERNEL);
drivers/spi/spi-dw.c+3−3
@@ -621,13 +621,13 @@ static void spi_hw_init(struct dw_spi *dws) · 620 unmodified lines
621621 if (!dws->fifo_len) {
622622 u32 fifo;
623623
624− for (fifo = 2; fifo <= 257; fifo++) {
624+ for (fifo = 2; fifo <= 256; fifo++) {
625625 dw_writew(dws, DW_SPI_TXFLTR, fifo);
626626 if (fifo != dw_readw(dws, DW_SPI_TXFLTR))
627627 break;
628628 }
629629
630− dws->fifo_len = (fifo == 257) ? 0 : fifo;
630+ dws->fifo_len = (fifo == 2) ? 0 : fifo - 1;
631631 dw_writew(dws, DW_SPI_TXFLTR, 0);
632632 }
633633 }
@@ -673,7 +673,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) · 39 unmodified lines
673673 if (dws->dma_ops && dws->dma_ops->dma_init) {
674674 ret = dws->dma_ops->dma_init(dws);
675675 if (ret) {
676− dev_warn(&master->dev, "DMA init failed\n");
676+ dev_warn(dev, "DMA init failed\n");
677677 dws->dma_inited = 0;
678678 }
679679 }
drivers/spi/spi-pxa2xx.c+1−1
@@ -546,8 +546,8 @@ static void giveback(struct driver_data *drv_data) · 545 unmodified lines
546546 cs_deassert(drv_data);
547547 }
548548
549− spi_finalize_current_message(drv_data->master);
550549 drv_data->cur_chip = NULL;
550+ spi_finalize_current_message(drv_data->master);
551551 }
552552
553553 static void reset_sccr1(struct driver_data *drv_data)
drivers/spi/spi-sh-msiof.c+1−1
@@ -82,7 +82,7 @@ struct sh_msiof_spi_priv { · 81 unmodified lines
8282 #define MDR1_SYNCMD_LR 0x30000000 /* L/R mode */
8383 #define MDR1_SYNCAC_SHIFT 25 /* Sync Polarity (1 = Active-low) */
8484 #define MDR1_BITLSB_SHIFT 24 /* MSB/LSB First (1 = LSB first) */
85−#define MDR1_FLD_MASK 0x000000c0 /* Frame Sync Signal Interval (0-3) */
85+#define MDR1_FLD_MASK 0x0000000c /* Frame Sync Signal Interval (0-3) */
8686 #define MDR1_FLD_SHIFT 2
8787 #define MDR1_XXSTP 0x00000001 /* Transmission/Reception Stop on FIFO */
8888 /* TMDR1 */
drivers/staging/lustre/lustre/llite/vvp_io.c+1−1
@@ -632,7 +632,7 @@ static int vvp_io_kernel_fault(struct vvp_fault_io *cfio) · 631 unmodified lines
632632 return 0;
633633 }
634634
635− if (cfio->fault.ft_flags & VM_FAULT_SIGBUS) {
635+ if (cfio->fault.ft_flags & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV)) {
636636 CDEBUG(D_PAGE, "got addr %p - SIGBUS\n", vmf->virtual_address);
637637 return -EFAULT;
638638 }
drivers/staging/nvec/nvec.c+3−6
@@ -85,23 +85,20 @@ static struct nvec_chip *nvec_power_handle; · 84 unmodified lines
8585 static const struct mfd_cell nvec_devices[] = {
8686 {
8787 .name = "nvec-kbd",
88− .id = 1,
8988 },
9089 {
9190 .name = "nvec-mouse",
92− .id = 1,
9391 },
9492 {
9593 .name = "nvec-power",
96− .id = 1,
94+ .id = 0,
9795 },
9896 {
9997 .name = "nvec-power",
100− .id = 2,
98+ .id = 1,
10199 },
102100 {
103101 .name = "nvec-paz00",
104− .id = 1,
105102 },
106103 };
107104
@@ -891,7 +888,7 @@ static int tegra_nvec_probe(struct platform_device *pdev) · 783 unmodified lines
891888 nvec_msg_free(nvec, msg);
892889 }
893890
894− ret = mfd_add_devices(nvec->dev, -1, nvec_devices,
891+ ret = mfd_add_devices(nvec->dev, 0, nvec_devices,
895892 ARRAY_SIZE(nvec_devices), NULL, 0, NULL);
896893 if (ret)
897894 dev_err(nvec->dev, "error adding subdevices\n");
drivers/usb/core/otg_whitelist.h+5−0
@@ -55,6 +55,11 @@ static int is_targeted(struct usb_device *dev) · 54 unmodified lines
5555 le16_to_cpu(dev->descriptor.idProduct) == 0xbadd))
5656 return 0;
5757
58+ /* OTG PET device is always targeted (see OTG 2.0 ECN 6.4.2) */
59+ if ((le16_to_cpu(dev->descriptor.idVendor) == 0x1a0a &&
60+ le16_to_cpu(dev->descriptor.idProduct) == 0x0200))
61+ return 1;
62+
5863 /* NOTE: can't use usb_match_id() since interface caches
5964 * aren't set up yet. this is cut/paste from that code.
6065 */
drivers/usb/core/quirks.c+4−0
@@ -179,6 +179,10 @@ static const struct usb_device_id usb_quirk_list[] = { · 178 unmodified lines
179179 { USB_DEVICE(0x0b05, 0x17e0), .driver_info =
180180 USB_QUIRK_IGNORE_REMOTE_WAKEUP },
181181
182+ /* Protocol and OTG Electrical Test Device */
183+ { USB_DEVICE(0x1a0a, 0x0200), .driver_info =
184+ USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL },
185+
182186 { } /* terminating entry must be last */
183187 };
184188
drivers/usb/dwc2/core_intr.c+3−3
@@ -476,13 +476,13 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev) · 475 unmodified lines
476476 u32 gintsts;
477477 irqreturn_t retval = IRQ_NONE;
478478
479+ spin_lock(&hsotg->lock);
480+
479481 if (!dwc2_is_controller_alive(hsotg)) {
480482 dev_warn(hsotg->dev, "Controller is dead\n");
481483 goto out;
482484 }
483485
484− spin_lock(&hsotg->lock);
485−
486486 gintsts = dwc2_read_common_intr(hsotg);
487487 if (gintsts & ~GINTSTS_PRTINT)
488488 retval = IRQ_HANDLED;
@@ -515,8 +515,8 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev) · 26 unmodified lines
515515 }
516516 }
517517
518− spin_unlock(&hsotg->lock);
519518 out:
519+ spin_unlock(&hsotg->lock);
520520 return retval;
521521 }
522522 EXPORT_SYMBOL_GPL(dwc2_handle_common_intr);
drivers/usb/phy/phy.c+1−1
@@ -34,7 +34,7 @@ static struct usb_phy *__usb_find_phy(struct list_head *list, · 33 unmodified lines
3434 return phy;
3535 }
3636
37− return ERR_PTR(-EPROBE_DEFER);
37+ return ERR_PTR(-ENODEV);
3838 }
3939
4040 static struct usb_phy *__usb_find_phy_dev(struct device *dev,
drivers/usb/storage/unusual_devs.h+8−1
@@ -507,7 +507,7 @@ UNUSUAL_DEV( 0x04e6, 0x000c, 0x0100, 0x0100, · 506 unmodified lines
507507 UNUSUAL_DEV( 0x04e6, 0x000f, 0x0000, 0x9999,
508508 "SCM Microsystems",
509509 "eUSB SCSI Adapter (Bus Powered)",
510− USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init,
510+ USB_SC_SCSI, USB_PR_BULK, usb_stor_euscsi_init,
511511 US_FL_SCM_MULT_TARG ),
512512
513513 UNUSUAL_DEV( 0x04e6, 0x0101, 0x0200, 0x0200,
@@ -1995,6 +1995,13 @@ UNUSUAL_DEV( 0x152d, 0x2329, 0x0100, 0x0100, · 1481 unmodified lines
19951995 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
19961996 US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ),
19971997
1998+/* Reported by Dmitry Nezhevenko <dion@dion.org.ua> */
1999+UNUSUAL_DEV( 0x152d, 0x2566, 0x0114, 0x0114,
2000+ "JMicron",
2001+ "USB to ATA/ATAPI Bridge",
2002+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2003+ US_FL_BROKEN_FUA ),
2004+
19982005 /* Entrega Technologies U1-SC25 (later Xircom PortGear PGSCSI)
19992006 * and Mac USB Dock USB-SCSI */
20002007 UNUSUAL_DEV( 0x1645, 0x0007, 0x0100, 0x0133,
drivers/usb/storage/unusual_uas.h+7−0
@@ -140,3 +140,10 @@ UNUSUAL_DEV(0x4971, 0x1012, 0x0000, 0x9999, · 139 unmodified lines
140140 "External HDD",
141141 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
142142 US_FL_IGNORE_UAS),
143+
144+/* Reported-by: Richard Henderson <rth@redhat.com> */
145+UNUSUAL_DEV(0x4971, 0x8017, 0x0000, 0x9999,
146+ "SimpleTech",
147+ "External HDD",
148+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
149+ US_FL_NO_REPORT_OPCODES),
fs/btrfs/scrub.c+2−0
@@ -3065,6 +3065,8 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, · 3064 unmodified lines
30653065 path->search_commit_root = 1;
30663066 path->skip_locking = 1;
30673067
3068+ ppath->search_commit_root = 1;
3069+ ppath->skip_locking = 1;
30683070 /*
30693071 * trigger the readahead for extent tree csum tree and wait for
30703072 * completion. During readahead, the scrub is officially paused
fs/gfs2/quota.c+23−26
@@ -667,7 +667,7 @@ static void do_qc(struct gfs2_quota_data *qd, s64 change) · 666 unmodified lines
667667
668668 static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
669669 s64 change, struct gfs2_quota_data *qd,
670− struct fs_disk_quota *fdq)
670+ struct qc_dqblk *fdq)
671671 {
672672 struct inode *inode = &ip->i_inode;
673673 struct gfs2_sbd *sdp = GFS2_SB(inode);
@@ -697,16 +697,16 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, · 23 unmodified lines
697697 be64_add_cpu(&q.qu_value, change);
698698 qd->qd_qb.qb_value = q.qu_value;
699699 if (fdq) {
700− if (fdq->d_fieldmask & FS_DQ_BSOFT) {
701− q.qu_warn = cpu_to_be64(fdq->d_blk_softlimit >> sdp->sd_fsb2bb_shift);
700+ if (fdq->d_fieldmask & QC_SPC_SOFT) {
701+ q.qu_warn = cpu_to_be64(fdq->d_spc_softlimit >> sdp->sd_sb.sb_bsize_shift);
702702 qd->qd_qb.qb_warn = q.qu_warn;
703703 }
704− if (fdq->d_fieldmask & FS_DQ_BHARD) {
705− q.qu_limit = cpu_to_be64(fdq->d_blk_hardlimit >> sdp->sd_fsb2bb_shift);
704+ if (fdq->d_fieldmask & QC_SPC_HARD) {
705+ q.qu_limit = cpu_to_be64(fdq->d_spc_hardlimit >> sdp->sd_sb.sb_bsize_shift);
706706 qd->qd_qb.qb_limit = q.qu_limit;
707707 }
708− if (fdq->d_fieldmask & FS_DQ_BCOUNT) {
709− q.qu_value = cpu_to_be64(fdq->d_bcount >> sdp->sd_fsb2bb_shift);
708+ if (fdq->d_fieldmask & QC_SPACE) {
709+ q.qu_value = cpu_to_be64(fdq->d_space >> sdp->sd_sb.sb_bsize_shift);
710710 qd->qd_qb.qb_value = q.qu_value;
711711 }
712712 }
@@ -1497,7 +1497,7 @@ static int gfs2_quota_get_xstate(struct super_block *sb, · 784 unmodified lines
14971497 }
14981498
14991499 static int gfs2_get_dqblk(struct super_block *sb, struct kqid qid,
1500− struct fs_disk_quota *fdq)
1500+ struct qc_dqblk *fdq)
15011501 {
15021502 struct gfs2_sbd *sdp = sb->s_fs_info;
15031503 struct gfs2_quota_lvb *qlvb;
@@ -1505,7 +1505,7 @@ static int gfs2_get_dqblk(struct super_block *sb, struct kqid qid, · 1 unmodified line
15051505 struct gfs2_holder q_gh;
15061506 int error;
15071507
1508− memset(fdq, 0, sizeof(struct fs_disk_quota));
1508+ memset(fdq, 0, sizeof(*fdq));
15091509
15101510 if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
15111511 return -ESRCH; /* Crazy XFS error code */
@@ -1522,12 +1522,9 @@ static int gfs2_get_dqblk(struct super_block *sb, struct kqid qid, · 10 unmodified lines
15221522 goto out;
15231523
15241524 qlvb = (struct gfs2_quota_lvb *)qd->qd_gl->gl_lksb.sb_lvbptr;
1525− fdq->d_version = FS_DQUOT_VERSION;
1526− fdq->d_flags = (qid.type == USRQUOTA) ? FS_USER_QUOTA : FS_GROUP_QUOTA;
1527− fdq->d_id = from_kqid_munged(current_user_ns(), qid);
1528− fdq->d_blk_hardlimit = be64_to_cpu(qlvb->qb_limit) << sdp->sd_fsb2bb_shift;
1529− fdq->d_blk_softlimit = be64_to_cpu(qlvb->qb_warn) << sdp->sd_fsb2bb_shift;
1530− fdq->d_bcount = be64_to_cpu(qlvb->qb_value) << sdp->sd_fsb2bb_shift;
1525+ fdq->d_spc_hardlimit = be64_to_cpu(qlvb->qb_limit) << sdp->sd_sb.sb_bsize_shift;
1526+ fdq->d_spc_softlimit = be64_to_cpu(qlvb->qb_warn) << sdp->sd_sb.sb_bsize_shift;
1527+ fdq->d_space = be64_to_cpu(qlvb->qb_value) << sdp->sd_sb.sb_bsize_shift;
15311528
15321529 gfs2_glock_dq_uninit(&q_gh);
15331530 out:
@@ -1536,10 +1533,10 @@ out: · 2 unmodified lines
15361533 }
15371534
15381535 /* GFS2 only supports a subset of the XFS fields */
1539−#define GFS2_FIELDMASK (FS_DQ_BSOFT|FS_DQ_BHARD|FS_DQ_BCOUNT)
1536+#define GFS2_FIELDMASK (QC_SPC_SOFT|QC_SPC_HARD|QC_SPACE)
15401537
15411538 static int gfs2_set_dqblk(struct super_block *sb, struct kqid qid,
1542− struct fs_disk_quota *fdq)
1539+ struct qc_dqblk *fdq)
15431540 {
15441541 struct gfs2_sbd *sdp = sb->s_fs_info;
15451542 struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode);
@@ -1583,17 +1580,17 @@ static int gfs2_set_dqblk(struct super_block *sb, struct kqid qid, · 37 unmodified lines
15831580 goto out_i;
15841581
15851582 /* If nothing has changed, this is a no-op */
1586− if ((fdq->d_fieldmask & FS_DQ_BSOFT) &&
1587− ((fdq->d_blk_softlimit >> sdp->sd_fsb2bb_shift) == be64_to_cpu(qd->qd_qb.qb_warn)))
1588− fdq->d_fieldmask ^= FS_DQ_BSOFT;
1583+ if ((fdq->d_fieldmask & QC_SPC_SOFT) &&
1584+ ((fdq->d_spc_softlimit >> sdp->sd_sb.sb_bsize_shift) == be64_to_cpu(qd->qd_qb.qb_warn)))
1585+ fdq->d_fieldmask ^= QC_SPC_SOFT;
15891586
1590− if ((fdq->d_fieldmask & FS_DQ_BHARD) &&
1591− ((fdq->d_blk_hardlimit >> sdp->sd_fsb2bb_shift) == be64_to_cpu(qd->qd_qb.qb_limit)))
1592− fdq->d_fieldmask ^= FS_DQ_BHARD;
1587+ if ((fdq->d_fieldmask & QC_SPC_HARD) &&
1588+ ((fdq->d_spc_hardlimit >> sdp->sd_sb.sb_bsize_shift) == be64_to_cpu(qd->qd_qb.qb_limit)))
1589+ fdq->d_fieldmask ^= QC_SPC_HARD;
15931590
1594− if ((fdq->d_fieldmask & FS_DQ_BCOUNT) &&
1595− ((fdq->d_bcount >> sdp->sd_fsb2bb_shift) == be64_to_cpu(qd->qd_qb.qb_value)))
1596− fdq->d_fieldmask ^= FS_DQ_BCOUNT;
1591+ if ((fdq->d_fieldmask & QC_SPACE) &&
1592+ ((fdq->d_space >> sdp->sd_sb.sb_bsize_shift) == be64_to_cpu(qd->qd_qb.qb_value)))
1593+ fdq->d_fieldmask ^= QC_SPACE;
15971594
15981595 if (fdq->d_fieldmask == 0)
15991596 goto out_i;
fs/nfs/direct.c+6−0
@@ -212,6 +212,12 @@ static int nfs_direct_cmp_commit_data_verf(struct nfs_direct_req *dreq, · 211 unmodified lines
212212 */
213213 ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, loff_t pos)
214214 {
215+ struct inode *inode = iocb->ki_filp->f_mapping->host;
216+
217+ /* we only support swap file calling nfs_direct_IO */
218+ if (!IS_SWAPFILE(inode))
219+ return 0;
220+
215221 #ifndef CONFIG_NFS_SWAP
216222 dprintk("NFS: nfs_direct_IO (%pD) off/no(%Ld/%lu) EINVAL\n",
217223 iocb->ki_filp, (long long) pos, iter->nr_segs);
fs/nfs/inode.c+3−2
@@ -352,8 +352,9 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st · 351 unmodified lines
352352
353353 nfs_attr_check_mountpoint(sb, fattr);
354354
355− if (((fattr->valid & NFS_ATTR_FATTR_FILEID) == 0) &&
356− !nfs_attr_use_mounted_on_fileid(fattr))
355+ if (nfs_attr_use_mounted_on_fileid(fattr))
356+ fattr->fileid = fattr->mounted_on_fileid;
357+ else if ((fattr->valid & NFS_ATTR_FATTR_FILEID) == 0)
357358 goto out_no_inode;
358359 if ((fattr->valid & NFS_ATTR_FATTR_TYPE) == 0)
359360 goto out_no_inode;
fs/nfs/internal.h+0−2
@@ -31,8 +31,6 @@ static inline int nfs_attr_use_mounted_on_fileid(struct nfs_fattr *fattr) · 30 unmodified lines
3131 (((fattr->valid & NFS_ATTR_FATTR_MOUNTPOINT) == 0) &&
3232 ((fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) == 0)))
3333 return 0;
34−
35− fattr->fileid = fattr->mounted_on_fileid;
3634 return 1;
3735 }
3836
fs/nfs/nfs4client.c+1−1
@@ -639,7 +639,7 @@ int nfs41_walk_client_list(struct nfs_client *new, · 638 unmodified lines
639639 prev = pos;
640640
641641 status = nfs_wait_client_init_complete(pos);
642− if (status == 0) {
642+ if (pos->cl_cons_state == NFS_CS_SESSION_INITING) {
643643 nfs4_schedule_lease_recovery(pos);
644644 status = nfs4_wait_clnt_recover(pos);
645645 }
fs/quota/dquot.c+39−44
@@ -2396,30 +2396,25 @@ static inline qsize_t stoqb(qsize_t space) · 2395 unmodified lines
23962396 }
23972397
23982398 /* Generic routine for getting common part of quota structure */
2399−static void do_get_dqblk(struct dquot *dquot, struct fs_disk_quota *di)
2399+static void do_get_dqblk(struct dquot *dquot, struct qc_dqblk *di)
24002400 {
24012401 struct mem_dqblk *dm = &dquot->dq_dqb;
24022402
24032403 memset(di, 0, sizeof(*di));
2404− di->d_version = FS_DQUOT_VERSION;
2405− di->d_flags = dquot->dq_id.type == USRQUOTA ?
2406− FS_USER_QUOTA : FS_GROUP_QUOTA;
2407− di->d_id = from_kqid_munged(current_user_ns(), dquot->dq_id);
2408−
24092404 spin_lock(&dq_data_lock);
2410− di->d_blk_hardlimit = stoqb(dm->dqb_bhardlimit);
2411− di->d_blk_softlimit = stoqb(dm->dqb_bsoftlimit);
2405+ di->d_spc_hardlimit = dm->dqb_bhardlimit;
2406+ di->d_spc_softlimit = dm->dqb_bsoftlimit;
24122407 di->d_ino_hardlimit = dm->dqb_ihardlimit;
24132408 di->d_ino_softlimit = dm->dqb_isoftlimit;
2414− di->d_bcount = dm->dqb_curspace + dm->dqb_rsvspace;
2415− di->d_icount = dm->dqb_curinodes;
2416− di->d_btimer = dm->dqb_btime;
2417− di->d_itimer = dm->dqb_itime;
2409+ di->d_space = dm->dqb_curspace + dm->dqb_rsvspace;
2410+ di->d_ino_count = dm->dqb_curinodes;
2411+ di->d_spc_timer = dm->dqb_btime;
2412+ di->d_ino_timer = dm->dqb_itime;
24182413 spin_unlock(&dq_data_lock);
24192414 }
24202415
24212416 int dquot_get_dqblk(struct super_block *sb, struct kqid qid,
2422− struct fs_disk_quota *di)
2417+ struct qc_dqblk *di)
24232418 {
24242419 struct dquot *dquot;
24252420
@@ -2433,70 +2428,70 @@ int dquot_get_dqblk(struct super_block *sb, struct kqid qid, · 7 unmodified lines
24332428 }
24342429 EXPORT_SYMBOL(dquot_get_dqblk);
24352430
2436−#define VFS_FS_DQ_MASK \
2437− (FS_DQ_BCOUNT | FS_DQ_BSOFT | FS_DQ_BHARD | \
2438− FS_DQ_ICOUNT | FS_DQ_ISOFT | FS_DQ_IHARD | \
2439− FS_DQ_BTIMER | FS_DQ_ITIMER)
2431+#define VFS_QC_MASK \
2432+ (QC_SPACE | QC_SPC_SOFT | QC_SPC_HARD | \
2433+ QC_INO_COUNT | QC_INO_SOFT | QC_INO_HARD | \
2434+ QC_SPC_TIMER | QC_INO_TIMER)
24402435
24412436 /* Generic routine for setting common part of quota structure */
2442−static int do_set_dqblk(struct dquot *dquot, struct fs_disk_quota *di)
2437+static int do_set_dqblk(struct dquot *dquot, struct qc_dqblk *di)
24432438 {
24442439 struct mem_dqblk *dm = &dquot->dq_dqb;
24452440 int check_blim = 0, check_ilim = 0;
24462441 struct mem_dqinfo *dqi = &sb_dqopt(dquot->dq_sb)->info[dquot->dq_id.type];
24472442
2448− if (di->d_fieldmask & ~VFS_FS_DQ_MASK)
2443+ if (di->d_fieldmask & ~VFS_QC_MASK)
24492444 return -EINVAL;
24502445
2451− if (((di->d_fieldmask & FS_DQ_BSOFT) &&
2452− (di->d_blk_softlimit > dqi->dqi_maxblimit)) ||
2453− ((di->d_fieldmask & FS_DQ_BHARD) &&
2454− (di->d_blk_hardlimit > dqi->dqi_maxblimit)) ||
2455− ((di->d_fieldmask & FS_DQ_ISOFT) &&
2446+ if (((di->d_fieldmask & QC_SPC_SOFT) &&
2447+ stoqb(di->d_spc_softlimit) > dqi->dqi_maxblimit) ||
2448+ ((di->d_fieldmask & QC_SPC_HARD) &&
2449+ stoqb(di->d_spc_hardlimit) > dqi->dqi_maxblimit) ||
2450+ ((di->d_fieldmask & QC_INO_SOFT) &&
24562451 (di->d_ino_softlimit > dqi->dqi_maxilimit)) ||
2457− ((di->d_fieldmask & FS_DQ_IHARD) &&
2452+ ((di->d_fieldmask & QC_INO_HARD) &&
24582453 (di->d_ino_hardlimit > dqi->dqi_maxilimit)))
24592454 return -ERANGE;
24602455
24612456 spin_lock(&dq_data_lock);
2462− if (di->d_fieldmask & FS_DQ_BCOUNT) {
2463− dm->dqb_curspace = di->d_bcount - dm->dqb_rsvspace;
2457+ if (di->d_fieldmask & QC_SPACE) {
2458+ dm->dqb_curspace = di->d_space - dm->dqb_rsvspace;
24642459 check_blim = 1;
24652460 set_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags);
24662461 }
24672462
2468− if (di->d_fieldmask & FS_DQ_BSOFT)
2469− dm->dqb_bsoftlimit = qbtos(di->d_blk_softlimit);
2470− if (di->d_fieldmask & FS_DQ_BHARD)
2471− dm->dqb_bhardlimit = qbtos(di->d_blk_hardlimit);
2472− if (di->d_fieldmask & (FS_DQ_BSOFT | FS_DQ_BHARD)) {
2463+ if (di->d_fieldmask & QC_SPC_SOFT)
2464+ dm->dqb_bsoftlimit = di->d_spc_softlimit;
2465+ if (di->d_fieldmask & QC_SPC_HARD)
2466+ dm->dqb_bhardlimit = di->d_spc_hardlimit;
2467+ if (di->d_fieldmask & (QC_SPC_SOFT | QC_SPC_HARD)) {
24732468 check_blim = 1;
24742469 set_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags);
24752470 }
24762471
2477− if (di->d_fieldmask & FS_DQ_ICOUNT) {
2478− dm->dqb_curinodes = di->d_icount;
2472+ if (di->d_fieldmask & QC_INO_COUNT) {
2473+ dm->dqb_curinodes = di->d_ino_count;
24792474 check_ilim = 1;
24802475 set_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags);
24812476 }
24822477
2483− if (di->d_fieldmask & FS_DQ_ISOFT)
2478+ if (di->d_fieldmask & QC_INO_SOFT)
24842479 dm->dqb_isoftlimit = di->d_ino_softlimit;
2485− if (di->d_fieldmask & FS_DQ_IHARD)
2480+ if (di->d_fieldmask & QC_INO_HARD)
24862481 dm->dqb_ihardlimit = di->d_ino_hardlimit;
2487− if (di->d_fieldmask & (FS_DQ_ISOFT | FS_DQ_IHARD)) {
2482+ if (di->d_fieldmask & (QC_INO_SOFT | QC_INO_HARD)) {
24882483 check_ilim = 1;
24892484 set_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags);
24902485 }
24912486
2492− if (di->d_fieldmask & FS_DQ_BTIMER) {
2493− dm->dqb_btime = di->d_btimer;
2487+ if (di->d_fieldmask & QC_SPC_TIMER) {
2488+ dm->dqb_btime = di->d_spc_timer;
24942489 check_blim = 1;
24952490 set_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags);
24962491 }
24972492
2498− if (di->d_fieldmask & FS_DQ_ITIMER) {
2499− dm->dqb_itime = di->d_itimer;
2493+ if (di->d_fieldmask & QC_INO_TIMER) {
2494+ dm->dqb_itime = di->d_ino_timer;
25002495 check_ilim = 1;
25012496 set_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags);
25022497 }
@@ -2506,7 +2501,7 @@ static int do_set_dqblk(struct dquot *dquot, struct fs_disk_quota *di) · 3 unmodified lines
25062501 dm->dqb_curspace < dm->dqb_bsoftlimit) {
25072502 dm->dqb_btime = 0;
25082503 clear_bit(DQ_BLKS_B, &dquot->dq_flags);
2509− } else if (!(di->d_fieldmask & FS_DQ_BTIMER))
2504+ } else if (!(di->d_fieldmask & QC_SPC_TIMER))
25102505 /* Set grace only if user hasn't provided his own... */
25112506 dm->dqb_btime = get_seconds() + dqi->dqi_bgrace;
25122507 }
@@ -2515,7 +2510,7 @@ static int do_set_dqblk(struct dquot *dquot, struct fs_disk_quota *di) · 2 unmodified lines
25152510 dm->dqb_curinodes < dm->dqb_isoftlimit) {
25162511 dm->dqb_itime = 0;
25172512 clear_bit(DQ_INODES_B, &dquot->dq_flags);
2518− } else if (!(di->d_fieldmask & FS_DQ_ITIMER))
2513+ } else if (!(di->d_fieldmask & QC_INO_TIMER))
25192514 /* Set grace only if user hasn't provided his own... */
25202515 dm->dqb_itime = get_seconds() + dqi->dqi_igrace;
25212516 }
@@ -2531,7 +2526,7 @@ static int do_set_dqblk(struct dquot *dquot, struct fs_disk_quota *di) · 9 unmodified lines
25312526 }
25322527
25332528 int dquot_set_dqblk(struct super_block *sb, struct kqid qid,
2534− struct fs_disk_quota *di)
2529+ struct qc_dqblk *di)
25352530 {
25362531 struct dquot *dquot;
25372532 int rc;
fs/quota/quota.c+137−25
@@ -118,17 +118,27 @@ static int quota_setinfo(struct super_block *sb, int type, void __user *addr) · 117 unmodified lines
118118 return sb->s_qcop->set_info(sb, type, &info);
119119 }
120120
121−static void copy_to_if_dqblk(struct if_dqblk *dst, struct fs_disk_quota *src)
121+static inline qsize_t qbtos(qsize_t blocks)
122+{
123+ return blocks << QIF_DQBLKSIZE_BITS;
124+}
125+
126+static inline qsize_t stoqb(qsize_t space)
127+{
128+ return (space + QIF_DQBLKSIZE - 1) >> QIF_DQBLKSIZE_BITS;
129+}
130+
131+static void copy_to_if_dqblk(struct if_dqblk *dst, struct qc_dqblk *src)
122132 {
123133 memset(dst, 0, sizeof(*dst));
124− dst->dqb_bhardlimit = src->d_blk_hardlimit;
125− dst->dqb_bsoftlimit = src->d_blk_softlimit;
126− dst->dqb_curspace = src->d_bcount;
134+ dst->dqb_bhardlimit = stoqb(src->d_spc_hardlimit);
135+ dst->dqb_bsoftlimit = stoqb(src->d_spc_softlimit);
136+ dst->dqb_curspace = src->d_space;
127137 dst->dqb_ihardlimit = src->d_ino_hardlimit;
128138 dst->dqb_isoftlimit = src->d_ino_softlimit;
129− dst->dqb_curinodes = src->d_icount;
130− dst->dqb_btime = src->d_btimer;
131− dst->dqb_itime = src->d_itimer;
139+ dst->dqb_curinodes = src->d_ino_count;
140+ dst->dqb_btime = src->d_spc_timer;
141+ dst->dqb_itime = src->d_ino_timer;
132142 dst->dqb_valid = QIF_ALL;
133143 }
134144
@@ -136,7 +146,7 @@ static int quota_getquota(struct super_block *sb, int type, qid_t id, · 1 unmodified line
136146 void __user *addr)
137147 {
138148 struct kqid qid;
139− struct fs_disk_quota fdq;
149+ struct qc_dqblk fdq;
140150 struct if_dqblk idq;
141151 int ret;
142152
@@ -154,36 +164,36 @@ static int quota_getquota(struct super_block *sb, int type, qid_t id, · 11 unmodified lines
154164 return 0;
155165 }
156166
157−static void copy_from_if_dqblk(struct fs_disk_quota *dst, struct if_dqblk *src)
167+static void copy_from_if_dqblk(struct qc_dqblk *dst, struct if_dqblk *src)
158168 {
159− dst->d_blk_hardlimit = src->dqb_bhardlimit;
160− dst->d_blk_softlimit = src->dqb_bsoftlimit;
161− dst->d_bcount = src->dqb_curspace;
169+ dst->d_spc_hardlimit = qbtos(src->dqb_bhardlimit);
170+ dst->d_spc_softlimit = qbtos(src->dqb_bsoftlimit);
171+ dst->d_space = src->dqb_curspace;
162172 dst->d_ino_hardlimit = src->dqb_ihardlimit;
163173 dst->d_ino_softlimit = src->dqb_isoftlimit;
164− dst->d_icount = src->dqb_curinodes;
165− dst->d_btimer = src->dqb_btime;
166− dst->d_itimer = src->dqb_itime;
174+ dst->d_ino_count = src->dqb_curinodes;
175+ dst->d_spc_timer = src->dqb_btime;
176+ dst->d_ino_timer = src->dqb_itime;
167177
168178 dst->d_fieldmask = 0;
169179 if (src->dqb_valid & QIF_BLIMITS)
170− dst->d_fieldmask |= FS_DQ_BSOFT | FS_DQ_BHARD;
180+ dst->d_fieldmask |= QC_SPC_SOFT | QC_SPC_HARD;
171181 if (src->dqb_valid & QIF_SPACE)
172− dst->d_fieldmask |= FS_DQ_BCOUNT;
182+ dst->d_fieldmask |= QC_SPACE;
173183 if (src->dqb_valid & QIF_ILIMITS)
174− dst->d_fieldmask |= FS_DQ_ISOFT | FS_DQ_IHARD;
184+ dst->d_fieldmask |= QC_INO_SOFT | QC_INO_HARD;
175185 if (src->dqb_valid & QIF_INODES)
176− dst->d_fieldmask |= FS_DQ_ICOUNT;
186+ dst->d_fieldmask |= QC_INO_COUNT;
177187 if (src->dqb_valid & QIF_BTIME)
178− dst->d_fieldmask |= FS_DQ_BTIMER;
188+ dst->d_fieldmask |= QC_SPC_TIMER;
179189 if (src->dqb_valid & QIF_ITIME)
180− dst->d_fieldmask |= FS_DQ_ITIMER;
190+ dst->d_fieldmask |= QC_INO_TIMER;
181191 }
182192
183193 static int quota_setquota(struct super_block *sb, int type, qid_t id,
184194 void __user *addr)
185195 {
186− struct fs_disk_quota fdq;
196+ struct qc_dqblk fdq;
187197 struct if_dqblk idq;
188198 struct kqid qid;
189199
@@ -247,10 +257,78 @@ static int quota_getxstatev(struct super_block *sb, void __user *addr) · 57 unmodified lines
247257 return ret;
248258 }
249259
260+/*
261+ * XFS defines BBTOB and BTOBB macros inside fs/xfs/ and we cannot move them
262+ * out of there as xfsprogs rely on definitions being in that header file. So
263+ * just define same functions here for quota purposes.
264+ */
265+#define XFS_BB_SHIFT 9
266+
267+static inline u64 quota_bbtob(u64 blocks)
268+{
269+ return blocks << XFS_BB_SHIFT;
270+}
271+
272+static inline u64 quota_btobb(u64 bytes)
273+{
274+ return (bytes + (1 << XFS_BB_SHIFT) - 1) >> XFS_BB_SHIFT;
275+}
276+
277+static void copy_from_xfs_dqblk(struct qc_dqblk *dst, struct fs_disk_quota *src)
278+{
279+ dst->d_spc_hardlimit = quota_bbtob(src->d_blk_hardlimit);
280+ dst->d_spc_softlimit = quota_bbtob(src->d_blk_softlimit);
281+ dst->d_ino_hardlimit = src->d_ino_hardlimit;
282+ dst->d_ino_softlimit = src->d_ino_softlimit;
283+ dst->d_space = quota_bbtob(src->d_bcount);
284+ dst->d_ino_count = src->d_icount;
285+ dst->d_ino_timer = src->d_itimer;
286+ dst->d_spc_timer = src->d_btimer;
287+ dst->d_ino_warns = src->d_iwarns;
288+ dst->d_spc_warns = src->d_bwarns;
289+ dst->d_rt_spc_hardlimit = quota_bbtob(src->d_rtb_hardlimit);
290+ dst->d_rt_spc_softlimit = quota_bbtob(src->d_rtb_softlimit);
291+ dst->d_rt_space = quota_bbtob(src->d_rtbcount);
292+ dst->d_rt_spc_timer = src->d_rtbtimer;
293+ dst->d_rt_spc_warns = src->d_rtbwarns;
294+ dst->d_fieldmask = 0;
295+ if (src->d_fieldmask & FS_DQ_ISOFT)
296+ dst->d_fieldmask |= QC_INO_SOFT;
297+ if (src->d_fieldmask & FS_DQ_IHARD)
298+ dst->d_fieldmask |= QC_INO_HARD;
299+ if (src->d_fieldmask & FS_DQ_BSOFT)
300+ dst->d_fieldmask |= QC_SPC_SOFT;
301+ if (src->d_fieldmask & FS_DQ_BHARD)
302+ dst->d_fieldmask |= QC_SPC_HARD;
303+ if (src->d_fieldmask & FS_DQ_RTBSOFT)
304+ dst->d_fieldmask |= QC_RT_SPC_SOFT;
305+ if (src->d_fieldmask & FS_DQ_RTBHARD)
306+ dst->d_fieldmask |= QC_RT_SPC_HARD;
307+ if (src->d_fieldmask & FS_DQ_BTIMER)
308+ dst->d_fieldmask |= QC_SPC_TIMER;
309+ if (src->d_fieldmask & FS_DQ_ITIMER)
310+ dst->d_fieldmask |= QC_INO_TIMER;
311+ if (src->d_fieldmask & FS_DQ_RTBTIMER)
312+ dst->d_fieldmask |= QC_RT_SPC_TIMER;
313+ if (src->d_fieldmask & FS_DQ_BWARNS)
314+ dst->d_fieldmask |= QC_SPC_WARNS;
315+ if (src->d_fieldmask & FS_DQ_IWARNS)
316+ dst->d_fieldmask |= QC_INO_WARNS;
317+ if (src->d_fieldmask & FS_DQ_RTBWARNS)
318+ dst->d_fieldmask |= QC_RT_SPC_WARNS;
319+ if (src->d_fieldmask & FS_DQ_BCOUNT)
320+ dst->d_fieldmask |= QC_SPACE;
321+ if (src->d_fieldmask & FS_DQ_ICOUNT)
322+ dst->d_fieldmask |= QC_INO_COUNT;
323+ if (src->d_fieldmask & FS_DQ_RTBCOUNT)
324+ dst->d_fieldmask |= QC_RT_SPACE;
325+}
326+
250327 static int quota_setxquota(struct super_block *sb, int type, qid_t id,
251328 void __user *addr)
252329 {
253330 struct fs_disk_quota fdq;
331+ struct qc_dqblk qdq;
254332 struct kqid qid;
255333
256334 if (copy_from_user(&fdq, addr, sizeof(fdq)))
@@ -260,13 +338,44 @@ static int quota_setxquota(struct super_block *sb, int type, qid_t id, · 3 unmodified lines
260338 qid = make_kqid(current_user_ns(), type, id);
261339 if (!qid_valid(qid))
262340 return -EINVAL;
263− return sb->s_qcop->set_dqblk(sb, qid, &fdq);
341+ copy_from_xfs_dqblk(&qdq, &fdq);
342+ return sb->s_qcop->set_dqblk(sb, qid, &qdq);
343+}
344+
345+static void copy_to_xfs_dqblk(struct fs_disk_quota *dst, struct qc_dqblk *src,
346+ int type, qid_t id)
347+{
348+ memset(dst, 0, sizeof(*dst));
349+ dst->d_version = FS_DQUOT_VERSION;
350+ dst->d_id = id;
351+ if (type == USRQUOTA)
352+ dst->d_flags = FS_USER_QUOTA;
353+ else if (type == PRJQUOTA)
354+ dst->d_flags = FS_PROJ_QUOTA;
355+ else
356+ dst->d_flags = FS_GROUP_QUOTA;
357+ dst->d_blk_hardlimit = quota_btobb(src->d_spc_hardlimit);
358+ dst->d_blk_softlimit = quota_btobb(src->d_spc_softlimit);
359+ dst->d_ino_hardlimit = src->d_ino_hardlimit;
360+ dst->d_ino_softlimit = src->d_ino_softlimit;
361+ dst->d_bcount = quota_btobb(src->d_space);
362+ dst->d_icount = src->d_ino_count;
363+ dst->d_itimer = src->d_ino_timer;
364+ dst->d_btimer = src->d_spc_timer;
365+ dst->d_iwarns = src->d_ino_warns;
366+ dst->d_bwarns = src->d_spc_warns;
367+ dst->d_rtb_hardlimit = quota_btobb(src->d_rt_spc_hardlimit);
368+ dst->d_rtb_softlimit = quota_btobb(src->d_rt_spc_softlimit);
369+ dst->d_rtbcount = quota_btobb(src->d_rt_space);
370+ dst->d_rtbtimer = src->d_rt_spc_timer;
371+ dst->d_rtbwarns = src->d_rt_spc_warns;
264372 }
265373
266374 static int quota_getxquota(struct super_block *sb, int type, qid_t id,
267375 void __user *addr)
268376 {
269377 struct fs_disk_quota fdq;
378+ struct qc_dqblk qdq;
270379 struct kqid qid;
271380 int ret;
272381
@@ -275,8 +384,11 @@ static int quota_getxquota(struct super_block *sb, int type, qid_t id, · 2 unmodified lines
275384 qid = make_kqid(current_user_ns(), type, id);
276385 if (!qid_valid(qid))
277386 return -EINVAL;
278− ret = sb->s_qcop->get_dqblk(sb, qid, &fdq);
279− if (!ret && copy_to_user(addr, &fdq, sizeof(fdq)))
387+ ret = sb->s_qcop->get_dqblk(sb, qid, &qdq);
388+ if (ret)
389+ return ret;
390+ copy_to_xfs_dqblk(&fdq, &qdq, type, id);
391+ if (copy_to_user(addr, &fdq, sizeof(fdq)))
280392 return -EFAULT;
281393 return ret;
282394 }
fs/udf/file.c+1−1
@@ -224,7 +224,7 @@ out: · 223 unmodified lines
224224 static int udf_release_file(struct inode *inode, struct file *filp)
225225 {
226226 if (filp->f_mode & FMODE_WRITE &&
227− atomic_read(&inode->i_writecount) > 1) {
227+ atomic_read(&inode->i_writecount) == 1) {
228228 /*
229229 * Grab i_mutex to avoid races with writes changing i_size
230230 * while we are running.
fs/xfs/xfs_qm.h+2−2
@@ -166,9 +166,9 @@ extern void xfs_qm_dqrele_all_inodes(struct xfs_mount *, uint); · 165 unmodified lines
166166 /* quota ops */
167167 extern int xfs_qm_scall_trunc_qfiles(struct xfs_mount *, uint);
168168 extern int xfs_qm_scall_getquota(struct xfs_mount *, xfs_dqid_t,
169− uint, struct fs_disk_quota *);
169+ uint, struct qc_dqblk *);
170170 extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint,
171− struct fs_disk_quota *);
171+ struct qc_dqblk *);
172172 extern int xfs_qm_scall_getqstat(struct xfs_mount *,
173173 struct fs_quota_stat *);
174174 extern int xfs_qm_scall_getqstatv(struct xfs_mount *,
fs/xfs/xfs_qm_syscalls.c+66−90
@@ -39,7 +39,6 @@ STATIC int xfs_qm_log_quotaoff(xfs_mount_t *, xfs_qoff_logitem_t **, uint); · 38 unmodified lines
3939 STATIC int xfs_qm_log_quotaoff_end(xfs_mount_t *, xfs_qoff_logitem_t *,
4040 uint);
4141 STATIC uint xfs_qm_export_flags(uint);
42−STATIC uint xfs_qm_export_qtype_flags(uint);
4342
4443 /*
4544 * Turn off quota accounting and/or enforcement for all udquots and/or
@@ -573,8 +572,8 @@ xfs_qm_scall_getqstatv( · 527 unmodified lines
573572 return 0;
574573 }
575574
576−#define XFS_DQ_MASK \
577− (FS_DQ_LIMIT_MASK | FS_DQ_TIMER_MASK | FS_DQ_WARNS_MASK)
575+#define XFS_QC_MASK \
576+ (QC_LIMIT_MASK | QC_TIMER_MASK | QC_WARNS_MASK)
578577
579578 /*
580579 * Adjust quota limits, and start/stop timers accordingly.
@@ -584,7 +583,7 @@ xfs_qm_scall_setqlim( · 3 unmodified lines
584583 struct xfs_mount *mp,
585584 xfs_dqid_t id,
586585 uint type,
587− fs_disk_quota_t *newlim)
586+ struct qc_dqblk *newlim)
588587 {
589588 struct xfs_quotainfo *q = mp->m_quotainfo;
590589 struct xfs_disk_dquot *ddq;
@@ -593,9 +592,9 @@ xfs_qm_scall_setqlim( · 2 unmodified lines
593592 int error;
594593 xfs_qcnt_t hard, soft;
595594
596− if (newlim->d_fieldmask & ~XFS_DQ_MASK)
595+ if (newlim->d_fieldmask & ~XFS_QC_MASK)
597596 return -EINVAL;
598− if ((newlim->d_fieldmask & XFS_DQ_MASK) == 0)
597+ if ((newlim->d_fieldmask & XFS_QC_MASK) == 0)
599598 return 0;
600599
601600 /*
@@ -633,11 +632,11 @@ xfs_qm_scall_setqlim( · 31 unmodified lines
633632 /*
634633 * Make sure that hardlimits are >= soft limits before changing.
635634 */
636− hard = (newlim->d_fieldmask & FS_DQ_BHARD) ?
637− (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_hardlimit) :
635+ hard = (newlim->d_fieldmask & QC_SPC_HARD) ?
636+ (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_spc_hardlimit) :
638637 be64_to_cpu(ddq->d_blk_hardlimit);
639− soft = (newlim->d_fieldmask & FS_DQ_BSOFT) ?
640− (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_softlimit) :
638+ soft = (newlim->d_fieldmask & QC_SPC_SOFT) ?
639+ (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_spc_softlimit) :
641640 be64_to_cpu(ddq->d_blk_softlimit);
642641 if (hard == 0 || hard >= soft) {
643642 ddq->d_blk_hardlimit = cpu_to_be64(hard);
@@ -650,11 +649,11 @@ xfs_qm_scall_setqlim( · 6 unmodified lines
650649 } else {
651650 xfs_debug(mp, "blkhard %Ld < blksoft %Ld", hard, soft);
652651 }
653− hard = (newlim->d_fieldmask & FS_DQ_RTBHARD) ?
654− (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_hardlimit) :
652+ hard = (newlim->d_fieldmask & QC_RT_SPC_HARD) ?
653+ (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_rt_spc_hardlimit) :
655654 be64_to_cpu(ddq->d_rtb_hardlimit);
656− soft = (newlim->d_fieldmask & FS_DQ_RTBSOFT) ?
657− (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_softlimit) :
655+ soft = (newlim->d_fieldmask & QC_RT_SPC_SOFT) ?
656+ (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_rt_spc_softlimit) :
658657 be64_to_cpu(ddq->d_rtb_softlimit);
659658 if (hard == 0 || hard >= soft) {
660659 ddq->d_rtb_hardlimit = cpu_to_be64(hard);
@@ -667,10 +666,10 @@ xfs_qm_scall_setqlim( · 6 unmodified lines
667666 xfs_debug(mp, "rtbhard %Ld < rtbsoft %Ld", hard, soft);
668667 }
669668
670− hard = (newlim->d_fieldmask & FS_DQ_IHARD) ?
669+ hard = (newlim->d_fieldmask & QC_INO_HARD) ?
671670 (xfs_qcnt_t) newlim->d_ino_hardlimit :
672671 be64_to_cpu(ddq->d_ino_hardlimit);
673− soft = (newlim->d_fieldmask & FS_DQ_ISOFT) ?
672+ soft = (newlim->d_fieldmask & QC_INO_SOFT) ?
674673 (xfs_qcnt_t) newlim->d_ino_softlimit :
675674 be64_to_cpu(ddq->d_ino_softlimit);
676675 if (hard == 0 || hard >= soft) {
@@ -687,12 +686,12 @@ xfs_qm_scall_setqlim( · 10 unmodified lines
687686 /*
688687 * Update warnings counter(s) if requested
689688 */
690− if (newlim->d_fieldmask & FS_DQ_BWARNS)
691− ddq->d_bwarns = cpu_to_be16(newlim->d_bwarns);
692− if (newlim->d_fieldmask & FS_DQ_IWARNS)
693− ddq->d_iwarns = cpu_to_be16(newlim->d_iwarns);
694− if (newlim->d_fieldmask & FS_DQ_RTBWARNS)
695− ddq->d_rtbwarns = cpu_to_be16(newlim->d_rtbwarns);
689+ if (newlim->d_fieldmask & QC_SPC_WARNS)
690+ ddq->d_bwarns = cpu_to_be16(newlim->d_spc_warns);
691+ if (newlim->d_fieldmask & QC_INO_WARNS)
692+ ddq->d_iwarns = cpu_to_be16(newlim->d_ino_warns);
693+ if (newlim->d_fieldmask & QC_RT_SPC_WARNS)
694+ ddq->d_rtbwarns = cpu_to_be16(newlim->d_rt_spc_warns);
696695
697696 if (id == 0) {
698697 /*
@@ -702,24 +701,24 @@ xfs_qm_scall_setqlim( · 3 unmodified lines
702701 * soft and hard limit values (already done, above), and
703702 * for warnings.
704703 */
705− if (newlim->d_fieldmask & FS_DQ_BTIMER) {
706− q->qi_btimelimit = newlim->d_btimer;
707− ddq->d_btimer = cpu_to_be32(newlim->d_btimer);
704+ if (newlim->d_fieldmask & QC_SPC_TIMER) {
705+ q->qi_btimelimit = newlim->d_spc_timer;
706+ ddq->d_btimer = cpu_to_be32(newlim->d_spc_timer);
708707 }
709− if (newlim->d_fieldmask & FS_DQ_ITIMER) {
710− q->qi_itimelimit = newlim->d_itimer;
711− ddq->d_itimer = cpu_to_be32(newlim->d_itimer);
708+ if (newlim->d_fieldmask & QC_INO_TIMER) {
709+ q->qi_itimelimit = newlim->d_ino_timer;
710+ ddq->d_itimer = cpu_to_be32(newlim->d_ino_timer);
712711 }
713− if (newlim->d_fieldmask & FS_DQ_RTBTIMER) {
714− q->qi_rtbtimelimit = newlim->d_rtbtimer;
715− ddq->d_rtbtimer = cpu_to_be32(newlim->d_rtbtimer);
712+ if (newlim->d_fieldmask & QC_RT_SPC_TIMER) {
713+ q->qi_rtbtimelimit = newlim->d_rt_spc_timer;
714+ ddq->d_rtbtimer = cpu_to_be32(newlim->d_rt_spc_timer);
716715 }
717− if (newlim->d_fieldmask & FS_DQ_BWARNS)
718− q->qi_bwarnlimit = newlim->d_bwarns;
719− if (newlim->d_fieldmask & FS_DQ_IWARNS)
720− q->qi_iwarnlimit = newlim->d_iwarns;
721− if (newlim->d_fieldmask & FS_DQ_RTBWARNS)
722− q->qi_rtbwarnlimit = newlim->d_rtbwarns;
716+ if (newlim->d_fieldmask & QC_SPC_WARNS)
717+ q->qi_bwarnlimit = newlim->d_spc_warns;
718+ if (newlim->d_fieldmask & QC_INO_WARNS)
719+ q->qi_iwarnlimit = newlim->d_ino_warns;
720+ if (newlim->d_fieldmask & QC_RT_SPC_WARNS)
721+ q->qi_rtbwarnlimit = newlim->d_rt_spc_warns;
723722 } else {
724723 /*
725724 * If the user is now over quota, start the timelimit.
@@ -824,7 +823,7 @@ xfs_qm_scall_getquota( · 98 unmodified lines
824823 struct xfs_mount *mp,
825824 xfs_dqid_t id,
826825 uint type,
827− struct fs_disk_quota *dst)
826+ struct qc_dqblk *dst)
828827 {
829828 struct xfs_dquot *dqp;
830829 int error;
@@ -848,28 +847,25 @@ xfs_qm_scall_getquota( · 17 unmodified lines
848847 }
849848
850849 memset(dst, 0, sizeof(*dst));
851− dst->d_version = FS_DQUOT_VERSION;
852− dst->d_flags = xfs_qm_export_qtype_flags(dqp->q_core.d_flags);
853− dst->d_id = be32_to_cpu(dqp->q_core.d_id);
854− dst->d_blk_hardlimit =
855− XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_blk_hardlimit));
856− dst->d_blk_softlimit =
857− XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_blk_softlimit));
850+ dst->d_spc_hardlimit =
851+ XFS_FSB_TO_B(mp, be64_to_cpu(dqp->q_core.d_blk_hardlimit));
852+ dst->d_spc_softlimit =
853+ XFS_FSB_TO_B(mp, be64_to_cpu(dqp->q_core.d_blk_softlimit));
858854 dst->d_ino_hardlimit = be64_to_cpu(dqp->q_core.d_ino_hardlimit);
859855 dst->d_ino_softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit);
860− dst->d_bcount = XFS_FSB_TO_BB(mp, dqp->q_res_bcount);
861− dst->d_icount = dqp->q_res_icount;
862− dst->d_btimer = be32_to_cpu(dqp->q_core.d_btimer);
863− dst->d_itimer = be32_to_cpu(dqp->q_core.d_itimer);
864− dst->d_iwarns = be16_to_cpu(dqp->q_core.d_iwarns);
865− dst->d_bwarns = be16_to_cpu(dqp->q_core.d_bwarns);
866− dst->d_rtb_hardlimit =
867− XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_rtb_hardlimit));
868− dst->d_rtb_softlimit =
869− XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_rtb_softlimit));
870− dst->d_rtbcount = XFS_FSB_TO_BB(mp, dqp->q_res_rtbcount);
871− dst->d_rtbtimer = be32_to_cpu(dqp->q_core.d_rtbtimer);
872− dst->d_rtbwarns = be16_to_cpu(dqp->q_core.d_rtbwarns);
856+ dst->d_space = XFS_FSB_TO_B(mp, dqp->q_res_bcount);
857+ dst->d_ino_count = dqp->q_res_icount;
858+ dst->d_spc_timer = be32_to_cpu(dqp->q_core.d_btimer);
859+ dst->d_ino_timer = be32_to_cpu(dqp->q_core.d_itimer);
860+ dst->d_ino_warns = be16_to_cpu(dqp->q_core.d_iwarns);
861+ dst->d_spc_warns = be16_to_cpu(dqp->q_core.d_bwarns);
862+ dst->d_rt_spc_hardlimit =
863+ XFS_FSB_TO_B(mp, be64_to_cpu(dqp->q_core.d_rtb_hardlimit));
864+ dst->d_rt_spc_softlimit =
865+ XFS_FSB_TO_B(mp, be64_to_cpu(dqp->q_core.d_rtb_softlimit));
866+ dst->d_rt_space = XFS_FSB_TO_B(mp, dqp->q_res_rtbcount);
867+ dst->d_rt_spc_timer = be32_to_cpu(dqp->q_core.d_rtbtimer);
868+ dst->d_rt_spc_warns = be16_to_cpu(dqp->q_core.d_rtbwarns);
873869
874870 /*
875871 * Internally, we don't reset all the timers when quota enforcement
@@ -882,23 +878,23 @@ xfs_qm_scall_getquota( · 6 unmodified lines
882878 dqp->q_core.d_flags == XFS_DQ_GROUP) ||
883879 (!XFS_IS_PQUOTA_ENFORCED(mp) &&
884880 dqp->q_core.d_flags == XFS_DQ_PROJ)) {
885− dst->d_btimer = 0;
886− dst->d_itimer = 0;
887− dst->d_rtbtimer = 0;
881+ dst->d_spc_timer = 0;
882+ dst->d_ino_timer = 0;
883+ dst->d_rt_spc_timer = 0;
888884 }
889885
890886 #ifdef DEBUG
891− if (((XFS_IS_UQUOTA_ENFORCED(mp) && dst->d_flags == FS_USER_QUOTA) ||
892− (XFS_IS_GQUOTA_ENFORCED(mp) && dst->d_flags == FS_GROUP_QUOTA) ||
893− (XFS_IS_PQUOTA_ENFORCED(mp) && dst->d_flags == FS_PROJ_QUOTA)) &&
894− dst->d_id != 0) {
895− if ((dst->d_bcount > dst->d_blk_softlimit) &&
896− (dst->d_blk_softlimit > 0)) {
897− ASSERT(dst->d_btimer != 0);
887+ if (((XFS_IS_UQUOTA_ENFORCED(mp) && type == XFS_DQ_USER) ||
888+ (XFS_IS_GQUOTA_ENFORCED(mp) && type == XFS_DQ_GROUP) ||
889+ (XFS_IS_PQUOTA_ENFORCED(mp) && type == XFS_DQ_PROJ)) &&
890+ id != 0) {
891+ if ((dst->d_space > dst->d_spc_softlimit) &&
892+ (dst->d_spc_softlimit > 0)) {
893+ ASSERT(dst->d_spc_timer != 0);
898894 }
899− if ((dst->d_icount > dst->d_ino_softlimit) &&
895+ if ((dst->d_ino_count > dst->d_ino_softlimit) &&
900896 (dst->d_ino_softlimit > 0)) {
901− ASSERT(dst->d_itimer != 0);
897+ ASSERT(dst->d_ino_timer != 0);
902898 }
903899 }
904900 #endif
@@ -907,26 +903,6 @@ out_put: · 2 unmodified lines
907903 return error;
908904 }
909905
910−STATIC uint
911−xfs_qm_export_qtype_flags(
912− uint flags)
913−{
914− /*
915− * Can't be more than one, or none.
916− */
917− ASSERT((flags & (FS_PROJ_QUOTA | FS_USER_QUOTA)) !=
918− (FS_PROJ_QUOTA | FS_USER_QUOTA));
919− ASSERT((flags & (FS_PROJ_QUOTA | FS_GROUP_QUOTA)) !=
920− (FS_PROJ_QUOTA | FS_GROUP_QUOTA));
921− ASSERT((flags & (FS_USER_QUOTA | FS_GROUP_QUOTA)) !=
922− (FS_USER_QUOTA | FS_GROUP_QUOTA));
923− ASSERT((flags & (FS_PROJ_QUOTA|FS_USER_QUOTA|FS_GROUP_QUOTA)) != 0);
924−
925− return (flags & XFS_DQ_USER) ?
926− FS_USER_QUOTA : (flags & XFS_DQ_PROJ) ?
927− FS_PROJ_QUOTA : FS_GROUP_QUOTA;
928−}
929−
930906 STATIC uint
931907 xfs_qm_export_flags(
932908 uint flags)
fs/xfs/xfs_quotaops.c+4−4
@@ -131,7 +131,7 @@ STATIC int · 130 unmodified lines
131131 xfs_fs_get_dqblk(
132132 struct super_block *sb,
133133 struct kqid qid,
134− struct fs_disk_quota *fdq)
134+ struct qc_dqblk *qdq)
135135 {
136136 struct xfs_mount *mp = XFS_M(sb);
137137
@@ -141,14 +141,14 @@ xfs_fs_get_dqblk( · 3 unmodified lines
141141 return -ESRCH;
142142
143143 return xfs_qm_scall_getquota(mp, from_kqid(&init_user_ns, qid),
144− xfs_quota_type(qid.type), fdq);
144+ xfs_quota_type(qid.type), qdq);
145145 }
146146
147147 STATIC int
148148 xfs_fs_set_dqblk(
149149 struct super_block *sb,
150150 struct kqid qid,
151− struct fs_disk_quota *fdq)
151+ struct qc_dqblk *qdq)
152152 {
153153 struct xfs_mount *mp = XFS_M(sb);
154154
@@ -160,7 +160,7 @@ xfs_fs_set_dqblk( · 5 unmodified lines
160160 return -ESRCH;
161161
162162 return xfs_qm_scall_setqlim(mp, from_kqid(&init_user_ns, qid),
163− xfs_quota_type(qid.type), fdq);
163+ xfs_quota_type(qid.type), qdq);
164164 }
165165
166166 const struct quotactl_ops xfs_quotactl_operations = {
include/linux/i2c.h+6−0
@@ -228,7 +228,9 @@ struct i2c_client { · 227 unmodified lines
228228 struct device dev; /* the device structure */
229229 int irq; /* irq issued by device */
230230 struct list_head detected;
231+#if IS_ENABLED(CONFIG_I2C_SLAVE)
231232 i2c_slave_cb_t slave_cb; /* callback for slave mode */
233+#endif
232234 };
233235 #define to_i2c_client(d) container_of(d, struct i2c_client, dev)
234236
@@ -253,6 +255,7 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data) · 18 unmodified lines
253255
254256 /* I2C slave support */
255257
258+#if IS_ENABLED(CONFIG_I2C_SLAVE)
256259 enum i2c_slave_event {
257260 I2C_SLAVE_REQ_READ_START,
258261 I2C_SLAVE_REQ_READ_END,
@@ -269,6 +272,7 @@ static inline int i2c_slave_event(struct i2c_client *client, · 10 unmodified lines
269272 {
270273 return client->slave_cb(client, event, val);
271274 }
275+#endif
272276
273277 /**
274278 * struct i2c_board_info - template for device creation
@@ -404,8 +408,10 @@ struct i2c_algorithm { · 129 unmodified lines
404408 /* To determine what the adapter supports */
405409 u32 (*functionality) (struct i2c_adapter *);
406410
411+#if IS_ENABLED(CONFIG_I2C_SLAVE)
407412 int (*reg_slave)(struct i2c_client *client);
408413 int (*unreg_slave)(struct i2c_client *client);
414+#endif
409415 };
410416
411417 /**
include/linux/kernel.h+1−1
@@ -176,7 +176,7 @@ extern int _cond_resched(void); · 175 unmodified lines
176176 */
177177 # define might_sleep() \
178178 do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0)
179−# define sched_annotate_sleep() __set_current_state(TASK_RUNNING)
179+# define sched_annotate_sleep() (current->task_state_change = 0)
180180 #else
181181 static inline void ___might_sleep(const char *file, int line,
182182 int preempt_offset) { }
include/linux/mfd/samsung/s2mps13.h+2−0
@@ -59,6 +59,7 @@ enum s2mps13_reg { · 58 unmodified lines
5959 S2MPS13_REG_B6CTRL,
6060 S2MPS13_REG_B6OUT,
6161 S2MPS13_REG_B7CTRL,
62+ S2MPS13_REG_B7SW,
6263 S2MPS13_REG_B7OUT,
6364 S2MPS13_REG_B8CTRL,
6465 S2MPS13_REG_B8OUT,
@@ -102,6 +103,7 @@ enum s2mps13_reg { · 37 unmodified lines
102103 S2MPS13_REG_L26CTRL,
103104 S2MPS13_REG_L27CTRL,
104105 S2MPS13_REG_L28CTRL,
106+ S2MPS13_REG_L29CTRL,
105107 S2MPS13_REG_L30CTRL,
106108 S2MPS13_REG_L31CTRL,
107109 S2MPS13_REG_L32CTRL,
include/linux/mm.h+4−2
@@ -1070,6 +1070,7 @@ static inline int page_mapped(struct page *page) · 1069 unmodified lines
10701070 #define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */
10711071 #define VM_FAULT_HWPOISON 0x0010 /* Hit poisoned small page */
10721072 #define VM_FAULT_HWPOISON_LARGE 0x0020 /* Hit poisoned large page. Index encoded in upper bits */
1073+#define VM_FAULT_SIGSEGV 0x0040
10731074
10741075 #define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */
10751076 #define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */
@@ -1078,8 +1079,9 @@ static inline int page_mapped(struct page *page) · 2 unmodified lines
10781079
10791080 #define VM_FAULT_HWPOISON_LARGE_MASK 0xf000 /* encodes hpage index for large hwpoison */
10801081
1081−#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON | \
1082− VM_FAULT_FALLBACK | VM_FAULT_HWPOISON_LARGE)
1082+#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | \
1083+ VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE | \
1084+ VM_FAULT_FALLBACK)
10831085
10841086 /* Encode hstate index for a hwpoisoned large page */
10851087 #define VM_FAULT_SET_HINDEX(x) ((x) << 12)
include/linux/oom.h+0−5
@@ -85,11 +85,6 @@ static inline void oom_killer_enable(void) · 84 unmodified lines
8585 oom_killer_disabled = false;
8686 }
8787
88−static inline bool oom_gfp_allowed(gfp_t gfp_mask)
89−{
90− return (gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY);
91−}
92−
9388 extern struct task_struct *find_lock_task_mm(struct task_struct *p);
9489
9590 static inline bool task_will_free_mem(struct task_struct *task)
include/linux/perf_event.h+0−6
@@ -450,11 +450,6 @@ struct perf_event { · 449 unmodified lines
450450 #endif /* CONFIG_PERF_EVENTS */
451451 };
452452
453−enum perf_event_context_type {
454− task_context,
455− cpu_context,
456−};
457−
458453 /**
459454 * struct perf_event_context - event context structure
460455 *
@@ -462,7 +457,6 @@ enum perf_event_context_type { · 1 unmodified line
462457 */
463458 struct perf_event_context {
464459 struct pmu *pmu;
465− enum perf_event_context_type type;
466460 /*
467461 * Protect the states of the events in the list,
468462 * nr_active, and the list:
include/linux/printk.h+12−3
@@ -10,9 +10,6 @@ · 9 unmodified lines
1010 extern const char linux_banner[];
1111 extern const char linux_proc_banner[];
1212
13−extern char *log_buf_addr_get(void);
14−extern u32 log_buf_len_get(void);
15−
1613 static inline int printk_get_level(const char *buffer)
1714 {
1815 if (buffer[0] == KERN_SOH_ASCII && buffer[1]) {
@@ -163,6 +160,8 @@ extern int kptr_restrict; · 144 unmodified lines
163160
164161 extern void wake_up_klogd(void);
165162
163+char *log_buf_addr_get(void);
164+u32 log_buf_len_get(void);
166165 void log_buf_kexec_setup(void);
167166 void __init setup_log_buf(int early);
168167 void dump_stack_set_arch_desc(const char *fmt, ...);
@@ -198,6 +197,16 @@ static inline void wake_up_klogd(void) · 29 unmodified lines
198197 {
199198 }
200199
200+static inline char *log_buf_addr_get(void)
201+{
202+ return NULL;
203+}
204+
205+static inline u32 log_buf_len_get(void)
206+{
207+ return 0;
208+}
209+
201210 static inline void log_buf_kexec_setup(void)
202211 {
203212 }
include/linux/quota.h+45−2
@@ -321,6 +321,49 @@ struct dquot_operations { · 320 unmodified lines
321321
322322 struct path;
323323
324+/* Structure for communicating via ->get_dqblk() & ->set_dqblk() */
325+struct qc_dqblk {
326+ int d_fieldmask; /* mask of fields to change in ->set_dqblk() */
327+ u64 d_spc_hardlimit; /* absolute limit on used space */
328+ u64 d_spc_softlimit; /* preferred limit on used space */
329+ u64 d_ino_hardlimit; /* maximum # allocated inodes */
330+ u64 d_ino_softlimit; /* preferred inode limit */
331+ u64 d_space; /* Space owned by the user */
332+ u64 d_ino_count; /* # inodes owned by the user */
333+ s64 d_ino_timer; /* zero if within inode limits */
334+ /* if not, we refuse service */
335+ s64 d_spc_timer; /* similar to above; for space */
336+ int d_ino_warns; /* # warnings issued wrt num inodes */
337+ int d_spc_warns; /* # warnings issued wrt used space */
338+ u64 d_rt_spc_hardlimit; /* absolute limit on realtime space */
339+ u64 d_rt_spc_softlimit; /* preferred limit on RT space */
340+ u64 d_rt_space; /* realtime space owned */
341+ s64 d_rt_spc_timer; /* similar to above; for RT space */
342+ int d_rt_spc_warns; /* # warnings issued wrt RT space */
343+};
344+
345+/* Field specifiers for ->set_dqblk() in struct qc_dqblk */
346+#define QC_INO_SOFT (1<<0)
347+#define QC_INO_HARD (1<<1)
348+#define QC_SPC_SOFT (1<<2)
349+#define QC_SPC_HARD (1<<3)
350+#define QC_RT_SPC_SOFT (1<<4)
351+#define QC_RT_SPC_HARD (1<<5)
352+#define QC_LIMIT_MASK (QC_INO_SOFT | QC_INO_HARD | QC_SPC_SOFT | QC_SPC_HARD | \
353+ QC_RT_SPC_SOFT | QC_RT_SPC_HARD)
354+#define QC_SPC_TIMER (1<<6)
355+#define QC_INO_TIMER (1<<7)
356+#define QC_RT_SPC_TIMER (1<<8)
357+#define QC_TIMER_MASK (QC_SPC_TIMER | QC_INO_TIMER | QC_RT_SPC_TIMER)
358+#define QC_SPC_WARNS (1<<9)
359+#define QC_INO_WARNS (1<<10)
360+#define QC_RT_SPC_WARNS (1<<11)
361+#define QC_WARNS_MASK (QC_SPC_WARNS | QC_INO_WARNS | QC_RT_SPC_WARNS)
362+#define QC_SPACE (1<<12)
363+#define QC_INO_COUNT (1<<13)
364+#define QC_RT_SPACE (1<<14)
365+#define QC_ACCT_MASK (QC_SPACE | QC_INO_COUNT | QC_RT_SPACE)
366+
324367 /* Operations handling requests from userspace */
325368 struct quotactl_ops {
326369 int (*quota_on)(struct super_block *, int, int, struct path *);
@@ -329,8 +372,8 @@ struct quotactl_ops { · 2 unmodified lines
329372 int (*quota_sync)(struct super_block *, int);
330373 int (*get_info)(struct super_block *, int, struct if_dqinfo *);
331374 int (*set_info)(struct super_block *, int, struct if_dqinfo *);
332− int (*get_dqblk)(struct super_block *, struct kqid, struct fs_disk_quota *);
333− int (*set_dqblk)(struct super_block *, struct kqid, struct fs_disk_quota *);
375+ int (*get_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *);
376+ int (*set_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *);
334377 int (*get_xstate)(struct super_block *, struct fs_quota_stat *);
335378 int (*set_xstate)(struct super_block *, unsigned int, int);
336379 int (*get_xstatev)(struct super_block *, struct fs_quota_statv *);
include/linux/quotaops.h+2−2
@@ -98,9 +98,9 @@ int dquot_quota_sync(struct super_block *sb, int type); · 97 unmodified lines
9898 int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
9999 int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
100100 int dquot_get_dqblk(struct super_block *sb, struct kqid id,
101− struct fs_disk_quota *di);
101+ struct qc_dqblk *di);
102102 int dquot_set_dqblk(struct super_block *sb, struct kqid id,
103− struct fs_disk_quota *di);
103+ struct qc_dqblk *di);
104104
105105 int __dquot_transfer(struct inode *inode, struct dquot **transfer_to);
106106 int dquot_transfer(struct inode *inode, struct iattr *iattr);
include/net/ip.h+6−5
@@ -39,11 +39,12 @@ struct inet_skb_parm { · 38 unmodified lines
3939 struct ip_options opt; /* Compiled IP options */
4040 unsigned char flags;
4141
42−#define IPSKB_FORWARDED 1
43−#define IPSKB_XFRM_TUNNEL_SIZE 2
44−#define IPSKB_XFRM_TRANSFORMED 4
45−#define IPSKB_FRAG_COMPLETE 8
46−#define IPSKB_REROUTED 16
42+#define IPSKB_FORWARDED BIT(0)
43+#define IPSKB_XFRM_TUNNEL_SIZE BIT(1)
44+#define IPSKB_XFRM_TRANSFORMED BIT(2)
45+#define IPSKB_FRAG_COMPLETE BIT(3)
46+#define IPSKB_REROUTED BIT(4)
47+#define IPSKB_DOREDIRECT BIT(5)
4748
4849 u16 frag_max_size;
4950 };
kernel/bpf/syscall.c+17−8
@@ -150,7 +150,7 @@ static int map_lookup_elem(union bpf_attr *attr) · 149 unmodified lines
150150 int ufd = attr->map_fd;
151151 struct fd f = fdget(ufd);
152152 struct bpf_map *map;
153− void *key, *value;
153+ void *key, *value, *ptr;
154154 int err;
155155
156156 if (CHECK_ATTR(BPF_MAP_LOOKUP_ELEM))
@@ -169,20 +169,29 @@ static int map_lookup_elem(union bpf_attr *attr) · 12 unmodified lines
169169 if (copy_from_user(key, ukey, map->key_size) != 0)
170170 goto free_key;
171171
172− err = -ENOENT;
173− rcu_read_lock();
174− value = map->ops->map_lookup_elem(map, key);
172+ err = -ENOMEM;
173+ value = kmalloc(map->value_size, GFP_USER);
175174 if (!value)
176− goto err_unlock;
175+ goto free_key;
176+
177+ rcu_read_lock();
178+ ptr = map->ops->map_lookup_elem(map, key);
179+ if (ptr)
180+ memcpy(value, ptr, map->value_size);
181+ rcu_read_unlock();
182+
183+ err = -ENOENT;
184+ if (!ptr)
185+ goto free_value;
177186
178187 err = -EFAULT;
179188 if (copy_to_user(uvalue, value, map->value_size) != 0)
180− goto err_unlock;
189+ goto free_value;
181190
182191 err = 0;
183192
184−err_unlock:
185− rcu_read_unlock();
193+free_value:
194+ kfree(value);
186195 free_key:
187196 kfree(key);
188197 err_put:
kernel/cgroup.c+1−1
@@ -1909,7 +1909,7 @@ static void cgroup_kill_sb(struct super_block *sb) · 1908 unmodified lines
19091909 *
19101910 * And don't kill the default root.
19111911 */
1912− if (css_has_online_children(&root->cgrp.self) ||
1912+ if (!list_empty(&root->cgrp.self.children) ||
19131913 root == &cgrp_dfl_root)
19141914 cgroup_put(&root->cgrp);
19151915 else
kernel/events/core.c+13−2
@@ -6776,7 +6776,6 @@ skip_type: · 6775 unmodified lines
67766776 __perf_event_init_context(&cpuctx->ctx);
67776777 lockdep_set_class(&cpuctx->ctx.mutex, &cpuctx_mutex);
67786778 lockdep_set_class(&cpuctx->ctx.lock, &cpuctx_lock);
6779− cpuctx->ctx.type = cpu_context;
67806779 cpuctx->ctx.pmu = pmu;
67816780
67826781 __perf_cpu_hrtimer_init(cpuctx, cpu);
@@ -7420,7 +7419,19 @@ SYSCALL_DEFINE5(perf_event_open, · 637 unmodified lines
74207419 * task or CPU context:
74217420 */
74227421 if (move_group) {
7423− if (group_leader->ctx->type != ctx->type)
7422+ /*
7423+ * Make sure we're both on the same task, or both
7424+ * per-cpu events.
7425+ */
7426+ if (group_leader->ctx->task != ctx->task)
7427+ goto err_context;
7428+
7429+ /*
7430+ * Make sure we're both events for the same CPU;
7431+ * grouping events for different CPUs is broken; since
7432+ * you can never concurrently schedule them anyhow.
7433+ */
7434+ if (group_leader->cpu != event->cpu)
74247435 goto err_context;
74257436 } else {
74267437 if (group_leader->ctx != ctx)
kernel/sched/core.c+2−3
@@ -7292,13 +7292,12 @@ void __might_sleep(const char *file, int line, int preempt_offset) · 7291 unmodified lines
72927292 * since we will exit with TASK_RUNNING make sure we enter with it,
72937293 * otherwise we will destroy state.
72947294 */
7295− if (WARN_ONCE(current->state != TASK_RUNNING,
7295+ WARN_ONCE(current->state != TASK_RUNNING && current->task_state_change,
72967296 "do not call blocking ops when !TASK_RUNNING; "
72977297 "state=%lx set at [<%p>] %pS\n",
72987298 current->state,
72997299 (void *)current->task_state_change,
7300− (void *)current->task_state_change))
7301− __set_current_state(TASK_RUNNING);
7300+ (void *)current->task_state_change);
73027301
73037302 ___might_sleep(file, line, preempt_offset);
73047303 }
mm/gup.c+2−2
@@ -296,7 +296,7 @@ static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma, · 295 unmodified lines
296296 return -ENOMEM;
297297 if (ret & (VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE))
298298 return *flags & FOLL_HWPOISON ? -EHWPOISON : -EFAULT;
299− if (ret & VM_FAULT_SIGBUS)
299+ if (ret & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV))
300300 return -EFAULT;
301301 BUG();
302302 }
@@ -571,7 +571,7 @@ int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, · 268 unmodified lines
571571 return -ENOMEM;
572572 if (ret & (VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE))
573573 return -EHWPOISON;
574− if (ret & VM_FAULT_SIGBUS)
574+ if (ret & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV))
575575 return -EFAULT;
576576 BUG();
577577 }
mm/ksm.c+1−1
@@ -376,7 +376,7 @@ static int break_ksm(struct vm_area_struct *vma, unsigned long addr) · 375 unmodified lines
376376 else
377377 ret = VM_FAULT_WRITE;
378378 put_page(page);
379− } while (!(ret & (VM_FAULT_WRITE | VM_FAULT_SIGBUS | VM_FAULT_OOM)));
379+ } while (!(ret & (VM_FAULT_WRITE | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | VM_FAULT_OOM)));
380380 /*
381381 * We must loop because handle_mm_fault() may back out if there's
382382 * any difficulty e.g. if pte accessed bit gets updated concurrently.
mm/memcontrol.c+2−2
@@ -1477,9 +1477,9 @@ void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) · 1476 unmodified lines
14771477
14781478 pr_info("Task in ");
14791479 pr_cont_cgroup_path(task_cgroup(p, memory_cgrp_id));
1480− pr_info(" killed as a result of limit of ");
1480+ pr_cont(" killed as a result of limit of ");
14811481 pr_cont_cgroup_path(memcg->css.cgroup);
1482− pr_info("\n");
1482+ pr_cont("\n");
14831483
14841484 rcu_read_unlock();
14851485
mm/memory.c+1−1
@@ -2632,7 +2632,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, · 2631 unmodified lines
26322632
26332633 /* Check if we need to add a guard page to the stack */
26342634 if (check_stack_guard_page(vma, address) < 0)
2635− return VM_FAULT_SIGBUS;
2635+ return VM_FAULT_SIGSEGV;
26362636
26372637 /* Use the zero-page for reads */
26382638 if (!(flags & FAULT_FLAG_WRITE) && !mm_forbids_zeropage(mm)) {
mm/page_alloc.c+35−47
@@ -2332,12 +2332,21 @@ static inline struct page * · 2331 unmodified lines
23322332 __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
23332333 struct zonelist *zonelist, enum zone_type high_zoneidx,
23342334 nodemask_t *nodemask, struct zone *preferred_zone,
2335− int classzone_idx, int migratetype)
2335+ int classzone_idx, int migratetype, unsigned long *did_some_progress)
23362336 {
23372337 struct page *page;
23382338
2339− /* Acquire the per-zone oom lock for each zone */
2339+ *did_some_progress = 0;
2340+
2341+ if (oom_killer_disabled)
2342+ return NULL;
2343+
2344+ /*
2345+ * Acquire the per-zone oom lock for each zone. If that
2346+ * fails, somebody else is making progress for us.
2347+ */
23402348 if (!oom_zonelist_trylock(zonelist, gfp_mask)) {
2349+ *did_some_progress = 1;
23412350 schedule_timeout_uninterruptible(1);
23422351 return NULL;
23432352 }
@@ -2363,12 +2372,18 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, · 19 unmodified lines
23632372 goto out;
23642373
23652374 if (!(gfp_mask & __GFP_NOFAIL)) {
2375+ /* Coredumps can quickly deplete all memory reserves */
2376+ if (current->flags & PF_DUMPCORE)
2377+ goto out;
23662378 /* The OOM killer will not help higher order allocs */
23672379 if (order > PAGE_ALLOC_COSTLY_ORDER)
23682380 goto out;
23692381 /* The OOM killer does not needlessly kill tasks for lowmem */
23702382 if (high_zoneidx < ZONE_NORMAL)
23712383 goto out;
2384+ /* The OOM killer does not compensate for light reclaim */
2385+ if (!(gfp_mask & __GFP_FS))
2386+ goto out;
23722387 /*
23732388 * GFP_THISNODE contains __GFP_NORETRY and we never hit this.
23742389 * Sanity check for bare calls of __GFP_THISNODE, not real OOM.
@@ -2381,7 +2396,7 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, · 6 unmodified lines
23812396 }
23822397 /* Exhausted what can be done so it's blamo time */
23832398 out_of_memory(zonelist, gfp_mask, order, nodemask, false);
2384−
2399+ *did_some_progress = 1;
23852400 out:
23862401 oom_zonelist_unlock(zonelist, gfp_mask);
23872402 return page;
@@ -2658,7 +2673,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, · 270 unmodified lines
26582673 (gfp_mask & GFP_THISNODE) == GFP_THISNODE)
26592674 goto nopage;
26602675
2661−restart:
2676+retry:
26622677 if (!(gfp_mask & __GFP_NO_KSWAPD))
26632678 wake_all_kswapds(order, zonelist, high_zoneidx,
26642679 preferred_zone, nodemask);
@@ -2681,7 +2696,6 @@ restart: · 16 unmodified lines
26812696 classzone_idx = zonelist_zone_idx(preferred_zoneref);
26822697 }
26832698
2684−rebalance:
26852699 /* This is the last chance, in general, before the goto nopage. */
26862700 page = get_page_from_freelist(gfp_mask, nodemask, order, zonelist,
26872701 high_zoneidx, alloc_flags & ~ALLOC_NO_WATERMARKS,
@@ -2788,54 +2802,28 @@ rebalance: · 100 unmodified lines
27882802 if (page)
27892803 goto got_pg;
27902804
2791− /*
2792− * If we failed to make any progress reclaiming, then we are
2793− * running out of options and have to consider going OOM
2794− */
2795− if (!did_some_progress) {
2796− if (oom_gfp_allowed(gfp_mask)) {
2797− if (oom_killer_disabled)
2798− goto nopage;
2799− /* Coredumps can quickly deplete all memory reserves */
2800− if ((current->flags & PF_DUMPCORE) &&
2801− !(gfp_mask & __GFP_NOFAIL))
2802− goto nopage;
2803− page = __alloc_pages_may_oom(gfp_mask, order,
2804− zonelist, high_zoneidx,
2805− nodemask, preferred_zone,
2806− classzone_idx, migratetype);
2807− if (page)
2808− goto got_pg;
2809−
2810− if (!(gfp_mask & __GFP_NOFAIL)) {
2811− /*
2812− * The oom killer is not called for high-order
2813− * allocations that may fail, so if no progress
2814− * is being made, there are no other options and
2815− * retrying is unlikely to help.
2816− */
2817− if (order > PAGE_ALLOC_COSTLY_ORDER)
2818− goto nopage;
2819− /*
2820− * The oom killer is not called for lowmem
2821− * allocations to prevent needlessly killing
2822− * innocent tasks.
2823− */
2824− if (high_zoneidx < ZONE_NORMAL)
2825− goto nopage;
2826− }
2827−
2828− goto restart;
2829− }
2830− }
2831−
28322805 /* Check if we should retry the allocation */
28332806 pages_reclaimed += did_some_progress;
28342807 if (should_alloc_retry(gfp_mask, order, did_some_progress,
28352808 pages_reclaimed)) {
2809+ /*
2810+ * If we fail to make progress by freeing individual
2811+ * pages, but the allocation wants us to keep going,
2812+ * start OOM killing tasks.
2813+ */
2814+ if (!did_some_progress) {
2815+ page = __alloc_pages_may_oom(gfp_mask, order, zonelist,
2816+ high_zoneidx, nodemask,
2817+ preferred_zone, classzone_idx,
2818+ migratetype,&did_some_progress);
2819+ if (page)
2820+ goto got_pg;
2821+ if (!did_some_progress)
2822+ goto nopage;
2823+ }
28362824 /* Wait for some write requests to complete then retry */
28372825 wait_iff_congested(preferred_zone, BLK_RW_ASYNC, HZ/50);
2838− goto rebalance;
2826+ goto retry;
28392827 } else {
28402828 /*
28412829 * High-order allocations do not necessarily loop after
mm/vmscan.c+1−1
@@ -2656,7 +2656,7 @@ static bool throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist, · 2655 unmodified lines
26562656 * should make reasonable progress.
26572657 */
26582658 for_each_zone_zonelist_nodemask(zone, z, zonelist,
2659− gfp_mask, nodemask) {
2659+ gfp_zone(gfp_mask), nodemask) {
26602660 if (zone_idx(zone) > ZONE_NORMAL)
26612661 continue;
26622662
net/dsa/slave.c+1−0
@@ -46,6 +46,7 @@ void dsa_slave_mii_bus_init(struct dsa_switch *ds) · 45 unmodified lines
4646 snprintf(ds->slave_mii_bus->id, MII_BUS_ID_SIZE, "dsa-%d:%.2x",
4747 ds->index, ds->pd->sw_addr);
4848 ds->slave_mii_bus->parent = ds->master_dev;
49+ ds->slave_mii_bus->phy_mask = ~ds->phys_mii_mask;
4950 }
5051
5152
net/ipv4/ip_forward.c+2−1
@@ -129,7 +129,8 @@ int ip_forward(struct sk_buff *skb) · 128 unmodified lines
129129 * We now generate an ICMP HOST REDIRECT giving the route
130130 * we calculated.
131131 */
132− if (rt->rt_flags&RTCF_DOREDIRECT && !opt->srr && !skb_sec_path(skb))
132+ if (IPCB(skb)->flags & IPSKB_DOREDIRECT && !opt->srr &&
133+ !skb_sec_path(skb))
133134 ip_rt_send_redirect(skb);
134135
135136 skb->priority = rt_tos2priority(iph->tos);
net/ipv4/ping.c+4−1
@@ -966,8 +966,11 @@ bool ping_rcv(struct sk_buff *skb) · 965 unmodified lines
966966
967967 sk = ping_lookup(net, skb, ntohs(icmph->un.echo.id));
968968 if (sk != NULL) {
969+ struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
970+
969971 pr_debug("rcv on socket %p\n", sk);
970− ping_queue_rcv_skb(sk, skb_get(skb));
972+ if (skb2)
973+ ping_queue_rcv_skb(sk, skb2);
971974 sock_put(sk);
972975 return true;
973976 }
net/ipv4/route.c+5−4
@@ -1554,11 +1554,10 @@ static int __mkroute_input(struct sk_buff *skb, · 1553 unmodified lines
15541554
15551555 do_cache = res->fi && !itag;
15561556 if (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) &&
1557+ skb->protocol == htons(ETH_P_IP) &&
15571558 (IN_DEV_SHARED_MEDIA(out_dev) ||
1558− inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) {
1559− flags |= RTCF_DOREDIRECT;
1560− do_cache = false;
1561− }
1559+ inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res))))
1560+ IPCB(skb)->flags |= IPSKB_DOREDIRECT;
15621561
15631562 if (skb->protocol != htons(ETH_P_IP)) {
15641563 /* Not IP (i.e. ARP). Do not create route, if it is
@@ -2303,6 +2302,8 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src, · 738 unmodified lines
23032302 r->rtm_flags = (rt->rt_flags & ~0xFFFF) | RTM_F_CLONED;
23042303 if (rt->rt_flags & RTCF_NOTIFY)
23052304 r->rtm_flags |= RTM_F_NOTIFY;
2305+ if (IPCB(skb)->flags & IPSKB_DOREDIRECT)
2306+ r->rtm_flags |= RTCF_DOREDIRECT;
23062307
23072308 if (nla_put_be32(skb, RTA_DST, dst))
23082309 goto nla_put_failure;
net/ipv4/udp_diag.c+3−1
@@ -99,11 +99,13 @@ static void udp_dump(struct udp_table *table, struct sk_buff *skb, struct netlin · 98 unmodified lines
9999 s_slot = cb->args[0];
100100 num = s_num = cb->args[1];
101101
102− for (slot = s_slot; slot <= table->mask; num = s_num = 0, slot++) {
102+ for (slot = s_slot; slot <= table->mask; s_num = 0, slot++) {
103103 struct sock *sk;
104104 struct hlist_nulls_node *node;
105105 struct udp_hslot *hslot = &table->hash[slot];
106106
107+ num = 0;
108+
107109 if (hlist_nulls_empty(&hslot->head))
108110 continue;
109111
net/ipv6/ip6_fib.c+26−19
@@ -659,6 +659,29 @@ static int fib6_commit_metrics(struct dst_entry *dst, · 658 unmodified lines
659659 return 0;
660660 }
661661
662+static void fib6_purge_rt(struct rt6_info *rt, struct fib6_node *fn,
663+ struct net *net)
664+{
665+ if (atomic_read(&rt->rt6i_ref) != 1) {
666+ /* This route is used as dummy address holder in some split
667+ * nodes. It is not leaked, but it still holds other resources,
668+ * which must be released in time. So, scan ascendant nodes
669+ * and replace dummy references to this route with references
670+ * to still alive ones.
671+ */
672+ while (fn) {
673+ if (!(fn->fn_flags & RTN_RTINFO) && fn->leaf == rt) {
674+ fn->leaf = fib6_find_prefix(net, fn);
675+ atomic_inc(&fn->leaf->rt6i_ref);
676+ rt6_release(rt);
677+ }
678+ fn = fn->parent;
679+ }
680+ /* No more references are possible at this point. */
681+ BUG_ON(atomic_read(&rt->rt6i_ref) != 1);
682+ }
683+}
684+
662685 /*
663686 * Insert routing information in a node.
664687 */
@@ -807,11 +830,12 @@ add: · 142 unmodified lines
807830 rt->dst.rt6_next = iter->dst.rt6_next;
808831 atomic_inc(&rt->rt6i_ref);
809832 inet6_rt_notify(RTM_NEWROUTE, rt, info);
810− rt6_release(iter);
811833 if (!(fn->fn_flags & RTN_RTINFO)) {
812834 info->nl_net->ipv6.rt6_stats->fib_route_nodes++;
813835 fn->fn_flags |= RTN_RTINFO;
814836 }
837+ fib6_purge_rt(iter, fn, info->nl_net);
838+ rt6_release(iter);
815839 }
816840
817841 return 0;
@@ -1322,24 +1346,7 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp, · 504 unmodified lines
13221346 fn = fib6_repair_tree(net, fn);
13231347 }
13241348
1325− if (atomic_read(&rt->rt6i_ref) != 1) {
1326− /* This route is used as dummy address holder in some split
1327− * nodes. It is not leaked, but it still holds other resources,
1328− * which must be released in time. So, scan ascendant nodes
1329− * and replace dummy references to this route with references
1330− * to still alive ones.
1331− */
1332− while (fn) {
1333− if (!(fn->fn_flags & RTN_RTINFO) && fn->leaf == rt) {
1334− fn->leaf = fib6_find_prefix(net, fn);
1335− atomic_inc(&fn->leaf->rt6i_ref);
1336− rt6_release(rt);
1337− }
1338− fn = fn->parent;
1339− }
1340− /* No more references are possible at this point. */
1341− BUG_ON(atomic_read(&rt->rt6i_ref) != 1);
1342− }
1349+ fib6_purge_rt(rt, fn, net);
13431350
13441351 inet6_rt_notify(RTM_DELROUTE, rt, info);
13451352 rt6_release(rt);
net/ipv6/route.c+5−1
@@ -1242,12 +1242,16 @@ restart: · 1241 unmodified lines
12421242 rt = net->ipv6.ip6_null_entry;
12431243 else if (rt->dst.error) {
12441244 rt = net->ipv6.ip6_null_entry;
1245− } else if (rt == net->ipv6.ip6_null_entry) {
1245+ goto out;
1246+ }
1247+
1248+ if (rt == net->ipv6.ip6_null_entry) {
12461249 fn = fib6_backtrack(fn, &fl6->saddr);
12471250 if (fn)
12481251 goto restart;
12491252 }
12501253
1254+out:
12511255 dst_hold(&rt->dst);
12521256
12531257 read_unlock_bh(&table->tb6_lock);
net/ipv6/xfrm6_policy.c+8−2
@@ -130,12 +130,18 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) · 129 unmodified lines
130130 {
131131 struct flowi6 *fl6 = &fl->u.ip6;
132132 int onlyproto = 0;
133− u16 offset = skb_network_header_len(skb);
134133 const struct ipv6hdr *hdr = ipv6_hdr(skb);
134+ u16 offset = sizeof(*hdr);
135135 struct ipv6_opt_hdr *exthdr;
136136 const unsigned char *nh = skb_network_header(skb);
137− u8 nexthdr = nh[IP6CB(skb)->nhoff];
137+ u16 nhoff = IP6CB(skb)->nhoff;
138138 int oif = 0;
139+ u8 nexthdr;
140+
141+ if (!nhoff)
142+ nhoff = offsetof(struct ipv6hdr, nexthdr);
143+
144+ nexthdr = nh[nhoff];
139145
140146 if (skb_dst(skb))
141147 oif = skb_dst(skb)->dev->ifindex;
net/llc/sysctl_net_llc.c+4−4
@@ -18,28 +18,28 @@ static struct ctl_table llc2_timeout_table[] = { · 17 unmodified lines
1818 {
1919 .procname = "ack",
2020 .data = &sysctl_llc2_ack_timeout,
21− .maxlen = sizeof(long),
21+ .maxlen = sizeof(sysctl_llc2_ack_timeout),
2222 .mode = 0644,
2323 .proc_handler = proc_dointvec_jiffies,
2424 },
2525 {
2626 .procname = "busy",
2727 .data = &sysctl_llc2_busy_timeout,
28− .maxlen = sizeof(long),
28+ .maxlen = sizeof(sysctl_llc2_busy_timeout),
2929 .mode = 0644,
3030 .proc_handler = proc_dointvec_jiffies,
3131 },
3232 {
3333 .procname = "p",
3434 .data = &sysctl_llc2_p_timeout,
35− .maxlen = sizeof(long),
35+ .maxlen = sizeof(sysctl_llc2_p_timeout),
3636 .mode = 0644,
3737 .proc_handler = proc_dointvec_jiffies,
3838 },
3939 {
4040 .procname = "rej",
4141 .data = &sysctl_llc2_rej_timeout,
42− .maxlen = sizeof(long),
42+ .maxlen = sizeof(sysctl_llc2_rej_timeout),
4343 .mode = 0644,
4444 .proc_handler = proc_dointvec_jiffies,
4545 },
net/mac80211/pm.c+15−14
@@ -86,20 +86,6 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) · 85 unmodified lines
8686 }
8787 }
8888
89− /* tear down aggregation sessions and remove STAs */
90− mutex_lock(&local->sta_mtx);
91− list_for_each_entry(sta, &local->sta_list, list) {
92− if (sta->uploaded) {
93− enum ieee80211_sta_state state;
94−
95− state = sta->sta_state;
96− for (; state > IEEE80211_STA_NOTEXIST; state--)
97− WARN_ON(drv_sta_state(local, sta->sdata, sta,
98− state, state - 1));
99− }
100− }
101− mutex_unlock(&local->sta_mtx);
102−
10389 /* remove all interfaces that were created in the driver */
10490 list_for_each_entry(sdata, &local->interfaces, list) {
10591 if (!ieee80211_sdata_running(sdata))
@@ -111,6 +97,21 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) · 5 unmodified lines
11197 case NL80211_IFTYPE_STATION:
11298 ieee80211_mgd_quiesce(sdata);
11399 break;
100+ case NL80211_IFTYPE_WDS:
101+ /* tear down aggregation sessions and remove STAs */
102+ mutex_lock(&local->sta_mtx);
103+ sta = sdata->u.wds.sta;
104+ if (sta && sta->uploaded) {
105+ enum ieee80211_sta_state state;
106+
107+ state = sta->sta_state;
108+ for (; state > IEEE80211_STA_NOTEXIST; state--)
109+ WARN_ON(drv_sta_state(local, sta->sdata,
110+ sta, state,
111+ state - 1));
112+ }
113+ mutex_unlock(&local->sta_mtx);
114+ break;
114115 default:
115116 break;
116117 }
net/mac80211/rx.c+1−1
@@ -272,7 +272,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, · 271 unmodified lines
272272 else if (rate && rate->flags & IEEE80211_RATE_ERP_G)
273273 channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ;
274274 else if (rate)
275− channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ;
275+ channel_flags |= IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ;
276276 else
277277 channel_flags |= IEEE80211_CHAN_2GHZ;
278278 put_unaligned_le16(channel_flags, pos);
net/sched/cls_bpf.c+13−2
@@ -180,6 +180,11 @@ static int cls_bpf_modify_existing(struct net *net, struct tcf_proto *tp, · 179 unmodified lines
180180 }
181181
182182 bpf_size = bpf_len * sizeof(*bpf_ops);
183+ if (bpf_size != nla_len(tb[TCA_BPF_OPS])) {
184+ ret = -EINVAL;
185+ goto errout;
186+ }
187+
183188 bpf_ops = kzalloc(bpf_size, GFP_KERNEL);
184189 if (bpf_ops == NULL) {
185190 ret = -ENOMEM;
@@ -215,15 +220,21 @@ static u32 cls_bpf_grab_new_handle(struct tcf_proto *tp, · 29 unmodified lines
215220 struct cls_bpf_head *head)
216221 {
217222 unsigned int i = 0x80000000;
223+ u32 handle;
218224
219225 do {
220226 if (++head->hgen == 0x7FFFFFFF)
221227 head->hgen = 1;
222228 } while (--i > 0 && cls_bpf_get(tp, head->hgen));
223− if (i == 0)
229+
230+ if (unlikely(i == 0)) {
224231 pr_err("Insufficient number of handles\n");
232+ handle = 0;
233+ } else {
234+ handle = head->hgen;
235+ }
225236
226− return i;
237+ return handle;
227238 }
228239
229240 static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,
net/sctp/associola.c+0−1
@@ -1182,7 +1182,6 @@ void sctp_assoc_update(struct sctp_association *asoc, · 1181 unmodified lines
11821182 asoc->peer.peer_hmacs = new->peer.peer_hmacs;
11831183 new->peer.peer_hmacs = NULL;
11841184
1185− sctp_auth_key_put(asoc->asoc_shared_key);
11861185 sctp_auth_asoc_init_active_key(asoc, GFP_ATOMIC);
11871186 }
11881187
net/socket.c+0−3
@@ -869,9 +869,6 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos, · 868 unmodified lines
869869 static struct sock_iocb *alloc_sock_iocb(struct kiocb *iocb,
870870 struct sock_iocb *siocb)
871871 {
872− if (!is_sync_kiocb(iocb))
873− BUG();
874−
875872 siocb->kiocb = iocb;
876873 iocb->private = siocb;
877874 return siocb;
net/wireless/nl80211.c+4−5
@@ -2854,6 +2854,9 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info) · 2853 unmodified lines
28542854 if (!rdev->ops->get_key)
28552855 return -EOPNOTSUPP;
28562856
2857+ if (!pairwise && mac_addr && !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN))
2858+ return -ENOENT;
2859+
28572860 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
28582861 if (!msg)
28592862 return -ENOMEM;
@@ -2873,10 +2876,6 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info) · 13 unmodified lines
28732876 nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr))
28742877 goto nla_put_failure;
28752878
2876− if (pairwise && mac_addr &&
2877− !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN))
2878− return -ENOENT;
2879−
28802879 err = rdev_get_key(rdev, dev, key_idx, pairwise, mac_addr, &cookie,
28812880 get_key_callback);
28822881
@@ -3047,7 +3046,7 @@ static int nl80211_del_key(struct sk_buff *skb, struct genl_info *info) · 164 unmodified lines
30473046 wdev_lock(dev->ieee80211_ptr);
30483047 err = nl80211_key_allowed(dev->ieee80211_ptr);
30493048
3050− if (key.type == NL80211_KEYTYPE_PAIRWISE && mac_addr &&
3049+ if (key.type == NL80211_KEYTYPE_GROUP && mac_addr &&
30513050 !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN))
30523051 err = -ENOENT;
30533052
net/wireless/util.c+6−0
@@ -308,6 +308,12 @@ unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc) · 307 unmodified lines
308308 goto out;
309309 }
310310
311+ if (ieee80211_is_mgmt(fc)) {
312+ if (ieee80211_has_order(fc))
313+ hdrlen += IEEE80211_HT_CTL_LEN;
314+ goto out;
315+ }
316+
311317 if (ieee80211_is_ctl(fc)) {
312318 /*
313319 * ACK and CTS are 10 bytes, all others 16. To see how
samples/bpf/test_maps.c+2−2
@@ -69,9 +69,9 @@ static void test_hashmap_sanity(int i, void *data) · 68 unmodified lines
6969
7070 /* iterate over two elements */
7171 assert(bpf_get_next_key(map_fd, &key, &next_key) == 0 &&
72− next_key == 2);
72+ (next_key == 1 || next_key == 2));
7373 assert(bpf_get_next_key(map_fd, &next_key, &next_key) == 0 &&
74− next_key == 1);
74+ (next_key == 1 || next_key == 2));
7575 assert(bpf_get_next_key(map_fd, &next_key, &next_key) == -1 &&
7676 errno == ENOENT);
7777
sound/soc/atmel/atmel_ssc_dai.c+7−17
@@ -348,7 +348,6 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, · 347 unmodified lines
348348 struct atmel_pcm_dma_params *dma_params;
349349 int dir, channels, bits;
350350 u32 tfmr, rfmr, tcmr, rcmr;
351− int start_event;
352351 int ret;
353352 int fslen, fslen_ext;
354353
@@ -457,19 +456,10 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, · 102 unmodified lines
457456 * The SSC transmit clock is obtained from the BCLK signal on
458457 * on the TK line, and the SSC receive clock is
459458 * generated from the transmit clock.
460− *
461− * For single channel data, one sample is transferred
462− * on the falling edge of the LRC clock.
463− * For two channel data, one sample is
464− * transferred on both edges of the LRC clock.
465459 */
466− start_event = ((channels == 1)
467− ? SSC_START_FALLING_RF
468− : SSC_START_EDGE_RF);
469−
470460 rcmr = SSC_BF(RCMR_PERIOD, 0)
471461 | SSC_BF(RCMR_STTDLY, START_DELAY)
472− | SSC_BF(RCMR_START, start_event)
462+ | SSC_BF(RCMR_START, SSC_START_FALLING_RF)
473463 | SSC_BF(RCMR_CKI, SSC_CKI_RISING)
474464 | SSC_BF(RCMR_CKO, SSC_CKO_NONE)
475465 | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
@@ -478,14 +468,14 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, · 2 unmodified lines
478468 rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
479469 | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE)
480470 | SSC_BF(RFMR_FSLEN, 0)
481− | SSC_BF(RFMR_DATNB, 0)
471+ | SSC_BF(RFMR_DATNB, (channels - 1))
482472 | SSC_BIT(RFMR_MSBF)
483473 | SSC_BF(RFMR_LOOP, 0)
484474 | SSC_BF(RFMR_DATLEN, (bits - 1));
485475
486476 tcmr = SSC_BF(TCMR_PERIOD, 0)
487477 | SSC_BF(TCMR_STTDLY, START_DELAY)
488− | SSC_BF(TCMR_START, start_event)
478+ | SSC_BF(TCMR_START, SSC_START_FALLING_RF)
489479 | SSC_BF(TCMR_CKI, SSC_CKI_FALLING)
490480 | SSC_BF(TCMR_CKO, SSC_CKO_NONE)
491481 | SSC_BF(TCMR_CKS, ssc->clk_from_rk_pin ?
@@ -495,7 +485,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, · 3 unmodified lines
495485 | SSC_BF(TFMR_FSDEN, 0)
496486 | SSC_BF(TFMR_FSOS, SSC_FSOS_NONE)
497487 | SSC_BF(TFMR_FSLEN, 0)
498− | SSC_BF(TFMR_DATNB, 0)
488+ | SSC_BF(TFMR_DATNB, (channels - 1))
499489 | SSC_BIT(TFMR_MSBF)
500490 | SSC_BF(TFMR_DATDEF, 0)
501491 | SSC_BF(TFMR_DATLEN, (bits - 1));
@@ -512,7 +502,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, · 10 unmodified lines
512502 rcmr = SSC_BF(RCMR_PERIOD, ssc_p->rcmr_period)
513503 | SSC_BF(RCMR_STTDLY, 1)
514504 | SSC_BF(RCMR_START, SSC_START_RISING_RF)
515− | SSC_BF(RCMR_CKI, SSC_CKI_RISING)
505+ | SSC_BF(RCMR_CKI, SSC_CKI_FALLING)
516506 | SSC_BF(RCMR_CKO, SSC_CKO_NONE)
517507 | SSC_BF(RCMR_CKS, SSC_CKS_DIV);
518508
@@ -527,7 +517,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, · 8 unmodified lines
527517 tcmr = SSC_BF(TCMR_PERIOD, ssc_p->tcmr_period)
528518 | SSC_BF(TCMR_STTDLY, 1)
529519 | SSC_BF(TCMR_START, SSC_START_RISING_RF)
530− | SSC_BF(TCMR_CKI, SSC_CKI_RISING)
520+ | SSC_BF(TCMR_CKI, SSC_CKI_FALLING)
531521 | SSC_BF(TCMR_CKO, SSC_CKO_CONTINUOUS)
532522 | SSC_BF(TCMR_CKS, SSC_CKS_DIV);
533523
@@ -556,7 +546,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, · 22 unmodified lines
556546 rcmr = SSC_BF(RCMR_PERIOD, 0)
557547 | SSC_BF(RCMR_STTDLY, START_DELAY)
558548 | SSC_BF(RCMR_START, SSC_START_RISING_RF)
559− | SSC_BF(RCMR_CKI, SSC_CKI_RISING)
549+ | SSC_BF(RCMR_CKI, SSC_CKI_FALLING)
560550 | SSC_BF(RCMR_CKO, SSC_CKO_NONE)
561551 | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
562552 SSC_CKS_PIN : SSC_CKS_CLOCK);
sound/soc/codecs/rt5640.c+1−0
@@ -2124,6 +2124,7 @@ MODULE_DEVICE_TABLE(of, rt5640_of_match); · 2123 unmodified lines
21242124 static struct acpi_device_id rt5640_acpi_match[] = {
21252125 { "INT33CA", 0 },
21262126 { "10EC5640", 0 },
2127+ { "10EC5642", 0 },
21272128 { },
21282129 };
21292130 MODULE_DEVICE_TABLE(acpi, rt5640_acpi_match);
sound/soc/codecs/sgtl5000.c+8−5
@@ -483,21 +483,21 @@ static int sgtl5000_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) · 482 unmodified lines
483483 /* setting i2s data format */
484484 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
485485 case SND_SOC_DAIFMT_DSP_A:
486− i2sctl |= SGTL5000_I2S_MODE_PCM;
486+ i2sctl |= SGTL5000_I2S_MODE_PCM << SGTL5000_I2S_MODE_SHIFT;
487487 break;
488488 case SND_SOC_DAIFMT_DSP_B:
489− i2sctl |= SGTL5000_I2S_MODE_PCM;
489+ i2sctl |= SGTL5000_I2S_MODE_PCM << SGTL5000_I2S_MODE_SHIFT;
490490 i2sctl |= SGTL5000_I2S_LRALIGN;
491491 break;
492492 case SND_SOC_DAIFMT_I2S:
493− i2sctl |= SGTL5000_I2S_MODE_I2S_LJ;
493+ i2sctl |= SGTL5000_I2S_MODE_I2S_LJ << SGTL5000_I2S_MODE_SHIFT;
494494 break;
495495 case SND_SOC_DAIFMT_RIGHT_J:
496− i2sctl |= SGTL5000_I2S_MODE_RJ;
496+ i2sctl |= SGTL5000_I2S_MODE_RJ << SGTL5000_I2S_MODE_SHIFT;
497497 i2sctl |= SGTL5000_I2S_LRPOL;
498498 break;
499499 case SND_SOC_DAIFMT_LEFT_J:
500− i2sctl |= SGTL5000_I2S_MODE_I2S_LJ;
500+ i2sctl |= SGTL5000_I2S_MODE_I2S_LJ << SGTL5000_I2S_MODE_SHIFT;
501501 i2sctl |= SGTL5000_I2S_LRALIGN;
502502 break;
503503 default:
@@ -1462,6 +1462,9 @@ static int sgtl5000_i2c_probe(struct i2c_client *client, · 958 unmodified lines
14621462 if (ret)
14631463 return ret;
14641464
1465+ /* Need 8 clocks before I2C accesses */
1466+ udelay(1);
1467+
14651468 /* read chip information */
14661469 ret = regmap_read(sgtl5000->regmap, SGTL5000_CHIP_ID, &reg);
14671470 if (ret)
sound/soc/codecs/tlv320aic3x.c+1−1
@@ -1046,7 +1046,7 @@ static int aic3x_prepare(struct snd_pcm_substream *substream, · 1045 unmodified lines
10461046 delay += aic3x->tdm_delay;
10471047
10481048 /* Configure data delay */
1049− snd_soc_write(codec, AIC3X_ASD_INTF_CTRLC, aic3x->tdm_delay);
1049+ snd_soc_write(codec, AIC3X_ASD_INTF_CTRLC, delay);
10501050
10511051 return 0;
10521052 }
sound/soc/codecs/wm8731.c+2−0
@@ -717,6 +717,8 @@ static int wm8731_i2c_probe(struct i2c_client *i2c, · 716 unmodified lines
717717 if (wm8731 == NULL)
718718 return -ENOMEM;
719719
720+ mutex_init(&wm8731->lock);
721+
720722 wm8731->regmap = devm_regmap_init_i2c(i2c, &wm8731_regmap);
721723 if (IS_ERR(wm8731->regmap)) {
722724 ret = PTR_ERR(wm8731->regmap);
sound/soc/intel/sst-haswell-ipc.c+2−2
@@ -651,11 +651,11 @@ static void hsw_notification_work(struct work_struct *work) · 650 unmodified lines
651651 }
652652
653653 /* tell DSP that notification has been handled */
654− sst_dsp_shim_update_bits_unlocked(hsw->dsp, SST_IPCD,
654+ sst_dsp_shim_update_bits(hsw->dsp, SST_IPCD,
655655 SST_IPCD_BUSY | SST_IPCD_DONE, SST_IPCD_DONE);
656656
657657 /* unmask busy interrupt */
658− sst_dsp_shim_update_bits_unlocked(hsw->dsp, SST_IMRX, SST_IMRX_BUSY, 0);
658+ sst_dsp_shim_update_bits(hsw->dsp, SST_IMRX, SST_IMRX_BUSY, 0);
659659 }
660660
661661 static struct ipc_message *reply_find_msg(struct sst_hsw *hsw, u32 header)
tools/perf/scripts/perl/Perf-Trace-Util/Context.c+4−1
@@ -5,7 +5,10 @@ · 4 unmodified lines
55 * ANY CHANGES MADE HERE WILL BE LOST!
66 *
77 */
8−
8+#include <stdbool.h>
9+#ifndef HAS_BOOL
10+# define HAS_BOOL 1
11+#endif
912 #line 1 "Context.xs"
1013 /*
1114 * Context.xs. XS interfaces for perf script.
tools/perf/util/annotate.c+14−4
@@ -177,14 +177,17 @@ static int lock__parse(struct ins_operands *ops) · 176 unmodified lines
177177 goto out_free_ops;
178178
179179 ops->locked.ins = ins__find(name);
180+ free(name);
181+
180182 if (ops->locked.ins == NULL)
181183 goto out_free_ops;
182184
183185 if (!ops->locked.ins->ops)
184186 return 0;
185187
186− if (ops->locked.ins->ops->parse)
187− ops->locked.ins->ops->parse(ops->locked.ops);
188+ if (ops->locked.ins->ops->parse &&
189+ ops->locked.ins->ops->parse(ops->locked.ops) < 0)
190+ goto out_free_ops;
188191
189192 return 0;
190193
@@ -208,6 +211,13 @@ static int lock__scnprintf(struct ins *ins, char *bf, size_t size, · 17 unmodified lines
208211
209212 static void lock__delete(struct ins_operands *ops)
210213 {
214+ struct ins *ins = ops->locked.ins;
215+
216+ if (ins && ins->ops->free)
217+ ins->ops->free(ops->locked.ops);
218+ else
219+ ins__delete(ops->locked.ops);
220+
211221 zfree(&ops->locked.ops);
212222 zfree(&ops->target.raw);
213223 zfree(&ops->target.name);
@@ -531,8 +541,8 @@ static void disasm_line__init_ins(struct disasm_line *dl) · 317 unmodified lines
531541 if (!dl->ins->ops)
532542 return;
533543
534− if (dl->ins->ops->parse)
535− dl->ins->ops->parse(&dl->ops);
544+ if (dl->ins->ops->parse && dl->ins->ops->parse(&dl->ops) < 0)
545+ dl->ins = NULL;
536546 }
537547
538548 static int disasm_line__parse(char *line, char **namep, char **rawp)
tools/perf/util/evlist.c+1−1
@@ -1445,7 +1445,7 @@ int perf_evlist__strerror_tp(struct perf_evlist *evlist __maybe_unused, · 1444 unmodified lines
14451445 case ENOENT:
14461446 scnprintf(buf, size, "%s",
14471447 "Error:\tUnable to find debugfs\n"
1448− "Hint:\tWas your kernel was compiled with debugfs support?\n"
1448+ "Hint:\tWas your kernel compiled with debugfs support?\n"
14491449 "Hint:\tIs the debugfs filesystem mounted?\n"
14501450 "Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'");
14511451 break;
tools/perf/util/map.h+16−0
@@ -116,6 +116,22 @@ struct thread; · 115 unmodified lines
116116 #define map__for_each_symbol(map, pos, n) \
117117 dso__for_each_symbol(map->dso, pos, n, map->type)
118118
119+/* map__for_each_symbol_with_name - iterate over the symbols in the given map
120+ * that have the given name
121+ *
122+ * @map: the 'struct map *' in which symbols itereated
123+ * @sym_name: the symbol name
124+ * @pos: the 'struct symbol *' to use as a loop cursor
125+ * @filter: to use when loading the DSO
126+ */
127+#define __map__for_each_symbol_by_name(map, sym_name, pos, filter) \
128+ for (pos = map__find_symbol_by_name(map, sym_name, filter); \
129+ pos && strcmp(pos->name, sym_name) == 0; \
130+ pos = symbol__next_by_name(pos))
131+
132+#define map__for_each_symbol_by_name(map, sym_name, pos) \
133+ __map__for_each_symbol_by_name(map, sym_name, (pos), NULL)
134+
119135 typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
120136
121137 void map__init(struct map *map, enum map_type type,
tools/perf/util/probe-event.c+16−18
@@ -446,7 +446,7 @@ static int post_process_probe_trace_events(struct probe_trace_event *tevs, · 445 unmodified lines
446446 }
447447
448448 for (i = 0; i < ntevs; i++) {
449− if (tevs[i].point.address) {
449+ if (tevs[i].point.address && !tevs[i].point.retprobe) {
450450 tmp = strdup(reloc_sym->name);
451451 if (!tmp)
452452 return -ENOMEM;
@@ -2193,18 +2193,17 @@ static int __add_probe_trace_events(struct perf_probe_event *pev, · 1740 unmodified lines
21932193 return ret;
21942194 }
21952195
2196−static char *looking_function_name;
2197−static int num_matched_functions;
2198−
2199−static int probe_function_filter(struct map *map __maybe_unused,
2200− struct symbol *sym)
2196+static int find_probe_functions(struct map *map, char *name)
22012197 {
2202− if ((sym->binding == STB_GLOBAL || sym->binding == STB_LOCAL) &&
2203− strcmp(looking_function_name, sym->name) == 0) {
2204− num_matched_functions++;
2205− return 0;
2198+ int found = 0;
2199+ struct symbol *sym;
2200+
2201+ map__for_each_symbol_by_name(map, name, sym) {
2202+ if (sym->binding == STB_GLOBAL || sym->binding == STB_LOCAL)
2203+ found++;
22062204 }
2207− return 1;
2205+
2206+ return found;
22082207 }
22092208
22102209 #define strdup_or_goto(str, label) \
@@ -2222,10 +2221,10 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev, · 11 unmodified lines
22222221 struct kmap *kmap = NULL;
22232222 struct ref_reloc_sym *reloc_sym = NULL;
22242223 struct symbol *sym;
2225− struct rb_node *nd;
22262224 struct probe_trace_event *tev;
22272225 struct perf_probe_point *pp = &pev->point;
22282226 struct probe_trace_point *tp;
2227+ int num_matched_functions;
22292228 int ret, i;
22302229
22312230 /* Init maps of given executable or kernel */
@@ -2242,10 +2241,8 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev, · 10 unmodified lines
22422241 * Load matched symbols: Since the different local symbols may have
22432242 * same name but different addresses, this lists all the symbols.
22442243 */
2245− num_matched_functions = 0;
2246− looking_function_name = pp->function;
2247− ret = map__load(map, probe_function_filter);
2248− if (ret || num_matched_functions == 0) {
2244+ num_matched_functions = find_probe_functions(map, pp->function);
2245+ if (num_matched_functions == 0) {
22492246 pr_err("Failed to find symbol %s in %s\n", pp->function,
22502247 target ? : "kernel");
22512248 ret = -ENOENT;
@@ -2257,7 +2254,7 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev, · 5 unmodified lines
22572254 goto out;
22582255 }
22592256
2260− if (!pev->uprobes) {
2257+ if (!pev->uprobes && !pp->retprobe) {
22612258 kmap = map__kmap(map);
22622259 reloc_sym = kmap->ref_reloc_sym;
22632260 if (!reloc_sym) {
@@ -2275,7 +2272,8 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev, · 11 unmodified lines
22752272 }
22762273
22772274 ret = 0;
2278− map__for_each_symbol(map, sym, nd) {
2275+
2276+ map__for_each_symbol_by_name(map, pp->function, sym) {
22792277 tev = (*tevs) + ret;
22802278 tp = &tev->point;
22812279 if (ret == num_matched_functions) {
tools/perf/util/symbol.c+28−3
@@ -396,6 +396,7 @@ static struct symbol *symbols__find_by_name(struct rb_root *symbols, · 395 unmodified lines
396396 const char *name)
397397 {
398398 struct rb_node *n;
399+ struct symbol_name_rb_node *s;
399400
400401 if (symbols == NULL)
401402 return NULL;
@@ -403,7 +404,6 @@ static struct symbol *symbols__find_by_name(struct rb_root *symbols, · 1 unmodified line
403404 n = symbols->rb_node;
404405
405406 while (n) {
406− struct symbol_name_rb_node *s;
407407 int cmp;
408408
409409 s = rb_entry(n, struct symbol_name_rb_node, rb_node);
@@ -414,10 +414,24 @@ static struct symbol *symbols__find_by_name(struct rb_root *symbols, · 4 unmodified lines
414414 else if (cmp > 0)
415415 n = n->rb_right;
416416 else
417− return &s->sym;
417+ break;
418418 }
419419
420− return NULL;
420+ if (n == NULL)
421+ return NULL;
422+
423+ /* return first symbol that has same name (if any) */
424+ for (n = rb_prev(n); n; n = rb_prev(n)) {
425+ struct symbol_name_rb_node *tmp;
426+
427+ tmp = rb_entry(n, struct symbol_name_rb_node, rb_node);
428+ if (strcmp(tmp->sym.name, s->sym.name))
429+ break;
430+
431+ s = tmp;
432+ }
433+
434+ return &s->sym;
421435 }
422436
423437 struct symbol *dso__find_symbol(struct dso *dso,
@@ -436,6 +450,17 @@ struct symbol *dso__next_symbol(struct symbol *sym) · 12 unmodified lines
436450 return symbols__next(sym);
437451 }
438452
453+struct symbol *symbol__next_by_name(struct symbol *sym)
454+{
455+ struct symbol_name_rb_node *s = container_of(sym, struct symbol_name_rb_node, sym);
456+ struct rb_node *n = rb_next(&s->rb_node);
457+
458+ return n ? &rb_entry(n, struct symbol_name_rb_node, rb_node)->sym : NULL;
459+}
460+
461+ /*
462+ * Teturns first symbol that matched with @name.
463+ */
439464 struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type,
440465 const char *name)
441466 {
tools/perf/util/symbol.h+1−0
@@ -231,6 +231,7 @@ struct symbol *dso__find_symbol(struct dso *dso, enum map_type type, · 230 unmodified lines
231231 u64 addr);
232232 struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type,
233233 const char *name);
234+struct symbol *symbol__next_by_name(struct symbol *sym);
234235
235236 struct symbol *dso__first_symbol(struct dso *dso, enum map_type type);
236237 struct symbol *dso__next_symbol(struct symbol *sym);

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