diff options
964 files changed, 10692 insertions, 6149 deletions
@@ -116,6 +116,7 @@ Shiraz Hashim <shiraz.linux.kernel@gmail.com> <shiraz.hashim@st.com> | |||
116 | Simon Kelley <simon@thekelleys.org.uk> | 116 | Simon Kelley <simon@thekelleys.org.uk> |
117 | Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr> | 117 | Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr> |
118 | Stephen Hemminger <shemminger@osdl.org> | 118 | Stephen Hemminger <shemminger@osdl.org> |
119 | Sudeep Holla <sudeep.holla@arm.com> Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com> | ||
119 | Sumit Semwal <sumit.semwal@ti.com> | 120 | Sumit Semwal <sumit.semwal@ti.com> |
120 | Tejun Heo <htejun@gmail.com> | 121 | Tejun Heo <htejun@gmail.com> |
121 | Thomas Graf <tgraf@suug.ch> | 122 | Thomas Graf <tgraf@suug.ch> |
@@ -125,7 +126,9 @@ Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> | |||
125 | Uwe Kleine-König <ukl@pengutronix.de> | 126 | Uwe Kleine-König <ukl@pengutronix.de> |
126 | Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> | 127 | Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> |
127 | Valdis Kletnieks <Valdis.Kletnieks@vt.edu> | 128 | Valdis Kletnieks <Valdis.Kletnieks@vt.edu> |
128 | Viresh Kumar <viresh.linux@gmail.com> <viresh.kumar@st.com> | 129 | Viresh Kumar <vireshk@kernel.org> <viresh.kumar@st.com> |
130 | Viresh Kumar <vireshk@kernel.org> <viresh.linux@gmail.com> | ||
131 | Viresh Kumar <vireshk@kernel.org> <viresh.kumar2@arm.com> | ||
129 | Takashi YOSHII <takashi.yoshii.zj@renesas.com> | 132 | Takashi YOSHII <takashi.yoshii.zj@renesas.com> |
130 | Yusuke Goda <goda.yusuke@renesas.com> | 133 | Yusuke Goda <goda.yusuke@renesas.com> |
131 | Gustavo Padovan <gustavo@las.ic.unicamp.br> | 134 | Gustavo Padovan <gustavo@las.ic.unicamp.br> |
diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index bbed111c31b4..70c9b1ac66db 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio | |||
@@ -1234,10 +1234,8 @@ Description: | |||
1234 | object is near the sensor, usually be observing | 1234 | object is near the sensor, usually be observing |
1235 | reflectivity of infrared or ultrasound emitted. | 1235 | reflectivity of infrared or ultrasound emitted. |
1236 | Often these sensors are unit less and as such conversion | 1236 | Often these sensors are unit less and as such conversion |
1237 | to SI units is not possible. Where it is, the units should | 1237 | to SI units is not possible. Higher proximity measurements |
1238 | be meters. If such a conversion is not possible, the reported | 1238 | indicate closer objects, and vice versa. |
1239 | values should behave in the same way as a distance, i.e. lower | ||
1240 | values indicate something is closer to the sensor. | ||
1241 | 1239 | ||
1242 | What: /sys/.../iio:deviceX/in_illuminance_input | 1240 | What: /sys/.../iio:deviceX/in_illuminance_input |
1243 | What: /sys/.../iio:deviceX/in_illuminance_raw | 1241 | What: /sys/.../iio:deviceX/in_illuminance_raw |
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index c0312cbd023d..2fb9a5457522 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl | |||
@@ -3383,7 +3383,7 @@ void intel_crt_init(struct drm_device *dev) | |||
3383 | <td valign="top" >TBD</td> | 3383 | <td valign="top" >TBD</td> |
3384 | </tr> | 3384 | </tr> |
3385 | <tr> | 3385 | <tr> |
3386 | <td rowspan="2" valign="top" >omap</td> | 3386 | <td valign="top" >omap</td> |
3387 | <td valign="top" >Generic</td> | 3387 | <td valign="top" >Generic</td> |
3388 | <td valign="top" >“zorder”</td> | 3388 | <td valign="top" >“zorder”</td> |
3389 | <td valign="top" >RANGE</td> | 3389 | <td valign="top" >RANGE</td> |
diff --git a/Documentation/arm/SPEAr/overview.txt b/Documentation/arm/SPEAr/overview.txt index 65610bf52ebf..1b049be6c84f 100644 --- a/Documentation/arm/SPEAr/overview.txt +++ b/Documentation/arm/SPEAr/overview.txt | |||
@@ -60,4 +60,4 @@ Introduction | |||
60 | Document Author | 60 | Document Author |
61 | --------------- | 61 | --------------- |
62 | 62 | ||
63 | Viresh Kumar <viresh.linux@gmail.com>, (c) 2010-2012 ST Microelectronics | 63 | Viresh Kumar <vireshk@kernel.org>, (c) 2010-2012 ST Microelectronics |
diff --git a/Documentation/arm/sunxi/README b/Documentation/arm/sunxi/README index 1fe2d7fd4108..5e38e1582f95 100644 --- a/Documentation/arm/sunxi/README +++ b/Documentation/arm/sunxi/README | |||
@@ -36,7 +36,7 @@ SunXi family | |||
36 | + User Manual | 36 | + User Manual |
37 | http://dl.linux-sunxi.org/A20/A20%20User%20Manual%202013-03-22.pdf | 37 | http://dl.linux-sunxi.org/A20/A20%20User%20Manual%202013-03-22.pdf |
38 | 38 | ||
39 | - Allwinner A23 | 39 | - Allwinner A23 (sun8i) |
40 | + Datasheet | 40 | + Datasheet |
41 | http://dl.linux-sunxi.org/A23/A23%20Datasheet%20V1.0%2020130830.pdf | 41 | http://dl.linux-sunxi.org/A23/A23%20Datasheet%20V1.0%2020130830.pdf |
42 | + User Manual | 42 | + User Manual |
@@ -55,7 +55,23 @@ SunXi family | |||
55 | + User Manual | 55 | + User Manual |
56 | http://dl.linux-sunxi.org/A31/A3x_release_document/A31s/IC/A31s%20User%20Manual%20%20V1.0%2020130322.pdf | 56 | http://dl.linux-sunxi.org/A31/A3x_release_document/A31s/IC/A31s%20User%20Manual%20%20V1.0%2020130322.pdf |
57 | 57 | ||
58 | - Allwinner A33 (sun8i) | ||
59 | + Datasheet | ||
60 | http://dl.linux-sunxi.org/A33/A33%20Datasheet%20release%201.1.pdf | ||
61 | + User Manual | ||
62 | http://dl.linux-sunxi.org/A33/A33%20user%20manual%20release%201.1.pdf | ||
63 | |||
64 | - Allwinner H3 (sun8i) | ||
65 | + Datasheet | ||
66 | http://dl.linux-sunxi.org/H3/Allwinner_H3_Datasheet_V1.0.pdf | ||
67 | |||
58 | * Quad ARM Cortex-A15, Quad ARM Cortex-A7 based SoCs | 68 | * Quad ARM Cortex-A15, Quad ARM Cortex-A7 based SoCs |
59 | - Allwinner A80 | 69 | - Allwinner A80 |
60 | + Datasheet | 70 | + Datasheet |
61 | http://dl.linux-sunxi.org/A80/A80_Datasheet_Revision_1.0_0404.pdf | 71 | http://dl.linux-sunxi.org/A80/A80_Datasheet_Revision_1.0_0404.pdf |
72 | |||
73 | * Octa ARM Cortex-A7 based SoCs | ||
74 | - Allwinner A83T | ||
75 | + Not Supported | ||
76 | + Datasheet | ||
77 | http://dl.linux-sunxi.org/A83T/A83T_datasheet_Revision_1.1.pdf | ||
diff --git a/Documentation/device-mapper/cache.txt b/Documentation/device-mapper/cache.txt index 82960cffbad3..785eab87aa71 100644 --- a/Documentation/device-mapper/cache.txt +++ b/Documentation/device-mapper/cache.txt | |||
@@ -258,6 +258,12 @@ cache metadata mode : ro if read-only, rw if read-write | |||
258 | no further I/O will be permitted and the status will just | 258 | no further I/O will be permitted and the status will just |
259 | contain the string 'Fail'. The userspace recovery tools | 259 | contain the string 'Fail'. The userspace recovery tools |
260 | should then be used. | 260 | should then be used. |
261 | needs_check : 'needs_check' if set, '-' if not set | ||
262 | A metadata operation has failed, resulting in the needs_check | ||
263 | flag being set in the metadata's superblock. The metadata | ||
264 | device must be deactivated and checked/repaired before the | ||
265 | cache can be made fully operational again. '-' indicates | ||
266 | needs_check is not set. | ||
261 | 267 | ||
262 | Messages | 268 | Messages |
263 | -------- | 269 | -------- |
diff --git a/Documentation/device-mapper/thin-provisioning.txt b/Documentation/device-mapper/thin-provisioning.txt index 4f67578b2954..1699a55b7b70 100644 --- a/Documentation/device-mapper/thin-provisioning.txt +++ b/Documentation/device-mapper/thin-provisioning.txt | |||
@@ -296,7 +296,7 @@ ii) Status | |||
296 | underlying device. When this is enabled when loading the table, | 296 | underlying device. When this is enabled when loading the table, |
297 | it can get disabled if the underlying device doesn't support it. | 297 | it can get disabled if the underlying device doesn't support it. |
298 | 298 | ||
299 | ro|rw | 299 | ro|rw|out_of_data_space |
300 | If the pool encounters certain types of device failures it will | 300 | If the pool encounters certain types of device failures it will |
301 | drop into a read-only metadata mode in which no changes to | 301 | drop into a read-only metadata mode in which no changes to |
302 | the pool metadata (like allocating new blocks) are permitted. | 302 | the pool metadata (like allocating new blocks) are permitted. |
@@ -314,6 +314,13 @@ ii) Status | |||
314 | module parameter can be used to change this timeout -- it | 314 | module parameter can be used to change this timeout -- it |
315 | defaults to 60 seconds but may be disabled using a value of 0. | 315 | defaults to 60 seconds but may be disabled using a value of 0. |
316 | 316 | ||
317 | needs_check | ||
318 | A metadata operation has failed, resulting in the needs_check | ||
319 | flag being set in the metadata's superblock. The metadata | ||
320 | device must be deactivated and checked/repaired before the | ||
321 | thin-pool can be made fully operational again. '-' indicates | ||
322 | needs_check is not set. | ||
323 | |||
317 | iii) Messages | 324 | iii) Messages |
318 | 325 | ||
319 | create_thin <dev id> | 326 | create_thin <dev id> |
diff --git a/Documentation/devicetree/bindings/arm/sunxi.txt b/Documentation/devicetree/bindings/arm/sunxi.txt index 42941fdefb11..67da20539540 100644 --- a/Documentation/devicetree/bindings/arm/sunxi.txt +++ b/Documentation/devicetree/bindings/arm/sunxi.txt | |||
@@ -9,4 +9,6 @@ using one of the following compatible strings: | |||
9 | allwinner,sun6i-a31 | 9 | allwinner,sun6i-a31 |
10 | allwinner,sun7i-a20 | 10 | allwinner,sun7i-a20 |
11 | allwinner,sun8i-a23 | 11 | allwinner,sun8i-a23 |
12 | allwinner,sun8i-a33 | ||
13 | allwinner,sun8i-h3 | ||
12 | allwinner,sun9i-a80 | 14 | allwinner,sun9i-a80 |
diff --git a/Documentation/devicetree/bindings/drm/imx/fsl-imx-drm.txt b/Documentation/devicetree/bindings/drm/imx/fsl-imx-drm.txt index e75f0e549fff..971c3eedb1c7 100644 --- a/Documentation/devicetree/bindings/drm/imx/fsl-imx-drm.txt +++ b/Documentation/devicetree/bindings/drm/imx/fsl-imx-drm.txt | |||
@@ -65,8 +65,10 @@ Optional properties: | |||
65 | - edid: verbatim EDID data block describing attached display. | 65 | - edid: verbatim EDID data block describing attached display. |
66 | - ddc: phandle describing the i2c bus handling the display data | 66 | - ddc: phandle describing the i2c bus handling the display data |
67 | channel | 67 | channel |
68 | - port: A port node with endpoint definitions as defined in | 68 | - port@[0-1]: Port nodes with endpoint definitions as defined in |
69 | Documentation/devicetree/bindings/media/video-interfaces.txt. | 69 | Documentation/devicetree/bindings/media/video-interfaces.txt. |
70 | Port 0 is the input port connected to the IPU display interface, | ||
71 | port 1 is the output port connected to a panel. | ||
70 | 72 | ||
71 | example: | 73 | example: |
72 | 74 | ||
@@ -75,9 +77,29 @@ display@di0 { | |||
75 | edid = [edid-data]; | 77 | edid = [edid-data]; |
76 | interface-pix-fmt = "rgb24"; | 78 | interface-pix-fmt = "rgb24"; |
77 | 79 | ||
78 | port { | 80 | port@0 { |
81 | reg = <0>; | ||
82 | |||
79 | display_in: endpoint { | 83 | display_in: endpoint { |
80 | remote-endpoint = <&ipu_di0_disp0>; | 84 | remote-endpoint = <&ipu_di0_disp0>; |
81 | }; | 85 | }; |
82 | }; | 86 | }; |
87 | |||
88 | port@1 { | ||
89 | reg = <1>; | ||
90 | |||
91 | display_out: endpoint { | ||
92 | remote-endpoint = <&panel_in>; | ||
93 | }; | ||
94 | }; | ||
95 | }; | ||
96 | |||
97 | panel { | ||
98 | ... | ||
99 | |||
100 | port { | ||
101 | panel_in: endpoint { | ||
102 | remote-endpoint = <&display_out>; | ||
103 | }; | ||
104 | }; | ||
83 | }; | 105 | }; |
diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt b/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt index c03eec116872..3443e0f838df 100644 --- a/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt +++ b/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt | |||
@@ -35,3 +35,6 @@ the PCIe specification. | |||
35 | 35 | ||
36 | NOTE: this only applies to the SMMU itself, not | 36 | NOTE: this only applies to the SMMU itself, not |
37 | masters connected upstream of the SMMU. | 37 | masters connected upstream of the SMMU. |
38 | |||
39 | - hisilicon,broken-prefetch-cmd | ||
40 | : Avoid sending CMD_PREFETCH_* commands to the SMMU. | ||
diff --git a/Documentation/devicetree/bindings/memory-controllers/ti/emif.txt b/Documentation/devicetree/bindings/memory-controllers/ti/emif.txt index 938f8e1ba205..0db60470ebb6 100644 --- a/Documentation/devicetree/bindings/memory-controllers/ti/emif.txt +++ b/Documentation/devicetree/bindings/memory-controllers/ti/emif.txt | |||
@@ -8,6 +8,7 @@ of the EMIF IP and memory parts attached to it. | |||
8 | Required properties: | 8 | Required properties: |
9 | - compatible : Should be of the form "ti,emif-<ip-rev>" where <ip-rev> | 9 | - compatible : Should be of the form "ti,emif-<ip-rev>" where <ip-rev> |
10 | is the IP revision of the specific EMIF instance. | 10 | is the IP revision of the specific EMIF instance. |
11 | For am437x should be ti,emif-am4372. | ||
11 | 12 | ||
12 | - phy-type : <u32> indicating the DDR phy type. Following are the | 13 | - phy-type : <u32> indicating the DDR phy type. Following are the |
13 | allowed values | 14 | allowed values |
diff --git a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt index 5d0376b8f202..211e7785f4d2 100644 --- a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt +++ b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt | |||
@@ -17,7 +17,6 @@ Required properties: | |||
17 | "fsl,imx6sx-usdhc" | 17 | "fsl,imx6sx-usdhc" |
18 | 18 | ||
19 | Optional properties: | 19 | Optional properties: |
20 | - fsl,cd-controller : Indicate to use controller internal card detection | ||
21 | - fsl,wp-controller : Indicate to use controller internal write protection | 20 | - fsl,wp-controller : Indicate to use controller internal write protection |
22 | - fsl,delay-line : Specify the number of delay cells for override mode. | 21 | - fsl,delay-line : Specify the number of delay cells for override mode. |
23 | This is used to set the clock delay for DLL(Delay Line) on override mode | 22 | This is used to set the clock delay for DLL(Delay Line) on override mode |
@@ -35,7 +34,6 @@ esdhc@70004000 { | |||
35 | compatible = "fsl,imx51-esdhc"; | 34 | compatible = "fsl,imx51-esdhc"; |
36 | reg = <0x70004000 0x4000>; | 35 | reg = <0x70004000 0x4000>; |
37 | interrupts = <1>; | 36 | interrupts = <1>; |
38 | fsl,cd-controller; | ||
39 | fsl,wp-controller; | 37 | fsl,wp-controller; |
40 | }; | 38 | }; |
41 | 39 | ||
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index e63b446d973c..13f888a02a3d 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -952,6 +952,14 @@ When kbuild executes, the following steps are followed (roughly): | |||
952 | $(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic | 952 | $(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic |
953 | mode) if this option is supported by $(AR). | 953 | mode) if this option is supported by $(AR). |
954 | 954 | ||
955 | ARCH_CPPFLAGS, ARCH_AFLAGS, ARCH_CFLAGS Overrides the kbuild defaults | ||
956 | |||
957 | These variables are appended to the KBUILD_CPPFLAGS, | ||
958 | KBUILD_AFLAGS, and KBUILD_CFLAGS, respectively, after the | ||
959 | top-level Makefile has set any other flags. This provides a | ||
960 | means for an architecture to override the defaults. | ||
961 | |||
962 | |||
955 | --- 6.2 Add prerequisites to archheaders: | 963 | --- 6.2 Add prerequisites to archheaders: |
956 | 964 | ||
957 | The archheaders: rule is used to generate header files that | 965 | The archheaders: rule is used to generate header files that |
diff --git a/Documentation/power/swsusp.txt b/Documentation/power/swsusp.txt index f732a8321e8a..8cc17ca71813 100644 --- a/Documentation/power/swsusp.txt +++ b/Documentation/power/swsusp.txt | |||
@@ -410,8 +410,17 @@ Documentation/usb/persist.txt. | |||
410 | 410 | ||
411 | Q: Can I suspend-to-disk using a swap partition under LVM? | 411 | Q: Can I suspend-to-disk using a swap partition under LVM? |
412 | 412 | ||
413 | A: No. You can suspend successfully, but you'll not be able to | 413 | A: Yes and No. You can suspend successfully, but the kernel will not be able |
414 | resume. uswsusp should be able to work with LVM. See suspend.sf.net. | 414 | to resume on its own. You need an initramfs that can recognize the resume |
415 | situation, activate the logical volume containing the swap volume (but not | ||
416 | touch any filesystems!), and eventually call | ||
417 | |||
418 | echo -n "$major:$minor" > /sys/power/resume | ||
419 | |||
420 | where $major and $minor are the respective major and minor device numbers of | ||
421 | the swap volume. | ||
422 | |||
423 | uswsusp works with LVM, too. See http://suspend.sourceforge.net/ | ||
415 | 424 | ||
416 | Q: I upgraded the kernel from 2.6.15 to 2.6.16. Both kernels were | 425 | Q: I upgraded the kernel from 2.6.15 to 2.6.16. Both kernels were |
417 | compiled with the similar configuration files. Anyway I found that | 426 | compiled with the similar configuration files. Anyway I found that |
diff --git a/MAINTAINERS b/MAINTAINERS index 8133cefb6b6e..9289ecb57b68 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -361,11 +361,11 @@ S: Supported | |||
361 | F: drivers/input/touchscreen/ad7879.c | 361 | F: drivers/input/touchscreen/ad7879.c |
362 | 362 | ||
363 | ADDRESS SPACE LAYOUT RANDOMIZATION (ASLR) | 363 | ADDRESS SPACE LAYOUT RANDOMIZATION (ASLR) |
364 | M: Jiri Kosina <jkosina@suse.cz> | 364 | M: Jiri Kosina <jkosina@suse.com> |
365 | S: Maintained | 365 | S: Maintained |
366 | 366 | ||
367 | ADM1025 HARDWARE MONITOR DRIVER | 367 | ADM1025 HARDWARE MONITOR DRIVER |
368 | M: Jean Delvare <jdelvare@suse.de> | 368 | M: Jean Delvare <jdelvare@suse.com> |
369 | L: lm-sensors@lm-sensors.org | 369 | L: lm-sensors@lm-sensors.org |
370 | S: Maintained | 370 | S: Maintained |
371 | F: Documentation/hwmon/adm1025 | 371 | F: Documentation/hwmon/adm1025 |
@@ -430,7 +430,7 @@ S: Maintained | |||
430 | F: drivers/macintosh/therm_adt746x.c | 430 | F: drivers/macintosh/therm_adt746x.c |
431 | 431 | ||
432 | ADT7475 HARDWARE MONITOR DRIVER | 432 | ADT7475 HARDWARE MONITOR DRIVER |
433 | M: Jean Delvare <jdelvare@suse.de> | 433 | M: Jean Delvare <jdelvare@suse.com> |
434 | L: lm-sensors@lm-sensors.org | 434 | L: lm-sensors@lm-sensors.org |
435 | S: Maintained | 435 | S: Maintained |
436 | F: Documentation/hwmon/adt7475 | 436 | F: Documentation/hwmon/adt7475 |
@@ -445,7 +445,7 @@ F: drivers/input/misc/adxl34x.c | |||
445 | 445 | ||
446 | ADVANSYS SCSI DRIVER | 446 | ADVANSYS SCSI DRIVER |
447 | M: Matthew Wilcox <matthew@wil.cx> | 447 | M: Matthew Wilcox <matthew@wil.cx> |
448 | M: Hannes Reinecke <hare@suse.de> | 448 | M: Hannes Reinecke <hare@suse.com> |
449 | L: linux-scsi@vger.kernel.org | 449 | L: linux-scsi@vger.kernel.org |
450 | S: Maintained | 450 | S: Maintained |
451 | F: Documentation/scsi/advansys.txt | 451 | F: Documentation/scsi/advansys.txt |
@@ -506,7 +506,7 @@ F: drivers/scsi/aha152x* | |||
506 | F: drivers/scsi/pcmcia/aha152x* | 506 | F: drivers/scsi/pcmcia/aha152x* |
507 | 507 | ||
508 | AIC7XXX / AIC79XX SCSI DRIVER | 508 | AIC7XXX / AIC79XX SCSI DRIVER |
509 | M: Hannes Reinecke <hare@suse.de> | 509 | M: Hannes Reinecke <hare@suse.com> |
510 | L: linux-scsi@vger.kernel.org | 510 | L: linux-scsi@vger.kernel.org |
511 | S: Maintained | 511 | S: Maintained |
512 | F: drivers/scsi/aic7xxx/ | 512 | F: drivers/scsi/aic7xxx/ |
@@ -746,7 +746,7 @@ S: Maintained | |||
746 | F: sound/aoa/ | 746 | F: sound/aoa/ |
747 | 747 | ||
748 | APM DRIVER | 748 | APM DRIVER |
749 | M: Jiri Kosina <jkosina@suse.cz> | 749 | M: Jiri Kosina <jkosina@suse.com> |
750 | S: Odd fixes | 750 | S: Odd fixes |
751 | F: arch/x86/kernel/apm_32.c | 751 | F: arch/x86/kernel/apm_32.c |
752 | F: include/linux/apm_bios.h | 752 | F: include/linux/apm_bios.h |
@@ -1001,6 +1001,7 @@ ARM/CONEXANT DIGICOLOR MACHINE SUPPORT | |||
1001 | M: Baruch Siach <baruch@tkos.co.il> | 1001 | M: Baruch Siach <baruch@tkos.co.il> |
1002 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1002 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1003 | S: Maintained | 1003 | S: Maintained |
1004 | F: arch/arm/boot/dts/cx92755* | ||
1004 | N: digicolor | 1005 | N: digicolor |
1005 | 1006 | ||
1006 | ARM/EBSA110 MACHINE SUPPORT | 1007 | ARM/EBSA110 MACHINE SUPPORT |
@@ -1324,7 +1325,7 @@ F: arch/arm/mach-pxa/include/mach/palmtc.h | |||
1324 | F: arch/arm/mach-pxa/palmtc.c | 1325 | F: arch/arm/mach-pxa/palmtc.c |
1325 | 1326 | ||
1326 | ARM/PALM TREO SUPPORT | 1327 | ARM/PALM TREO SUPPORT |
1327 | M: Tomas Cech <sleep_walker@suse.cz> | 1328 | M: Tomas Cech <sleep_walker@suse.com> |
1328 | L: linux-arm-kernel@lists.infradead.org | 1329 | L: linux-arm-kernel@lists.infradead.org |
1329 | W: http://hackndev.com | 1330 | W: http://hackndev.com |
1330 | S: Maintained | 1331 | S: Maintained |
@@ -1614,6 +1615,7 @@ M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | |||
1614 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1615 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1615 | S: Maintained | 1616 | S: Maintained |
1616 | F: arch/arm/boot/dts/vexpress* | 1617 | F: arch/arm/boot/dts/vexpress* |
1618 | F: arch/arm64/boot/dts/arm/vexpress* | ||
1617 | F: arch/arm/mach-vexpress/ | 1619 | F: arch/arm/mach-vexpress/ |
1618 | F: */*/vexpress* | 1620 | F: */*/vexpress* |
1619 | F: */*/*/vexpress* | 1621 | F: */*/*/vexpress* |
@@ -2404,7 +2406,7 @@ F: drivers/gpio/gpio-bt8xx.c | |||
2404 | BTRFS FILE SYSTEM | 2406 | BTRFS FILE SYSTEM |
2405 | M: Chris Mason <clm@fb.com> | 2407 | M: Chris Mason <clm@fb.com> |
2406 | M: Josef Bacik <jbacik@fb.com> | 2408 | M: Josef Bacik <jbacik@fb.com> |
2407 | M: David Sterba <dsterba@suse.cz> | 2409 | M: David Sterba <dsterba@suse.com> |
2408 | L: linux-btrfs@vger.kernel.org | 2410 | L: linux-btrfs@vger.kernel.org |
2409 | W: http://btrfs.wiki.kernel.org/ | 2411 | W: http://btrfs.wiki.kernel.org/ |
2410 | Q: http://patchwork.kernel.org/project/linux-btrfs/list/ | 2412 | Q: http://patchwork.kernel.org/project/linux-btrfs/list/ |
@@ -2562,19 +2564,31 @@ F: arch/powerpc/include/uapi/asm/spu*.h | |||
2562 | F: arch/powerpc/oprofile/*cell* | 2564 | F: arch/powerpc/oprofile/*cell* |
2563 | F: arch/powerpc/platforms/cell/ | 2565 | F: arch/powerpc/platforms/cell/ |
2564 | 2566 | ||
2565 | CEPH DISTRIBUTED FILE SYSTEM CLIENT | 2567 | CEPH COMMON CODE (LIBCEPH) |
2568 | M: Ilya Dryomov <idryomov@gmail.com> | ||
2566 | M: "Yan, Zheng" <zyan@redhat.com> | 2569 | M: "Yan, Zheng" <zyan@redhat.com> |
2567 | M: Sage Weil <sage@redhat.com> | 2570 | M: Sage Weil <sage@redhat.com> |
2568 | L: ceph-devel@vger.kernel.org | 2571 | L: ceph-devel@vger.kernel.org |
2569 | W: http://ceph.com/ | 2572 | W: http://ceph.com/ |
2570 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git | 2573 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git |
2574 | T: git git://github.com/ceph/ceph-client.git | ||
2571 | S: Supported | 2575 | S: Supported |
2572 | F: Documentation/filesystems/ceph.txt | ||
2573 | F: fs/ceph/ | ||
2574 | F: net/ceph/ | 2576 | F: net/ceph/ |
2575 | F: include/linux/ceph/ | 2577 | F: include/linux/ceph/ |
2576 | F: include/linux/crush/ | 2578 | F: include/linux/crush/ |
2577 | 2579 | ||
2580 | CEPH DISTRIBUTED FILE SYSTEM CLIENT (CEPH) | ||
2581 | M: "Yan, Zheng" <zyan@redhat.com> | ||
2582 | M: Sage Weil <sage@redhat.com> | ||
2583 | M: Ilya Dryomov <idryomov@gmail.com> | ||
2584 | L: ceph-devel@vger.kernel.org | ||
2585 | W: http://ceph.com/ | ||
2586 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git | ||
2587 | T: git git://github.com/ceph/ceph-client.git | ||
2588 | S: Supported | ||
2589 | F: Documentation/filesystems/ceph.txt | ||
2590 | F: fs/ceph/ | ||
2591 | |||
2578 | CERTIFIED WIRELESS USB (WUSB) SUBSYSTEM: | 2592 | CERTIFIED WIRELESS USB (WUSB) SUBSYSTEM: |
2579 | L: linux-usb@vger.kernel.org | 2593 | L: linux-usb@vger.kernel.org |
2580 | S: Orphan | 2594 | S: Orphan |
@@ -2735,7 +2749,7 @@ COCCINELLE/Semantic Patches (SmPL) | |||
2735 | M: Julia Lawall <Julia.Lawall@lip6.fr> | 2749 | M: Julia Lawall <Julia.Lawall@lip6.fr> |
2736 | M: Gilles Muller <Gilles.Muller@lip6.fr> | 2750 | M: Gilles Muller <Gilles.Muller@lip6.fr> |
2737 | M: Nicolas Palix <nicolas.palix@imag.fr> | 2751 | M: Nicolas Palix <nicolas.palix@imag.fr> |
2738 | M: Michal Marek <mmarek@suse.cz> | 2752 | M: Michal Marek <mmarek@suse.com> |
2739 | L: cocci@systeme.lip6.fr (moderated for non-subscribers) | 2753 | L: cocci@systeme.lip6.fr (moderated for non-subscribers) |
2740 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git misc | 2754 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git misc |
2741 | W: http://coccinelle.lip6.fr/ | 2755 | W: http://coccinelle.lip6.fr/ |
@@ -2851,7 +2865,7 @@ F: kernel/cpuset.c | |||
2851 | 2865 | ||
2852 | CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG) | 2866 | CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG) |
2853 | M: Johannes Weiner <hannes@cmpxchg.org> | 2867 | M: Johannes Weiner <hannes@cmpxchg.org> |
2854 | M: Michal Hocko <mhocko@suse.cz> | 2868 | M: Michal Hocko <mhocko@kernel.org> |
2855 | L: cgroups@vger.kernel.org | 2869 | L: cgroups@vger.kernel.org |
2856 | L: linux-mm@kvack.org | 2870 | L: linux-mm@kvack.org |
2857 | S: Maintained | 2871 | S: Maintained |
@@ -2932,7 +2946,7 @@ F: arch/x86/kernel/cpuid.c | |||
2932 | F: arch/x86/kernel/msr.c | 2946 | F: arch/x86/kernel/msr.c |
2933 | 2947 | ||
2934 | CPU POWER MONITORING SUBSYSTEM | 2948 | CPU POWER MONITORING SUBSYSTEM |
2935 | M: Thomas Renninger <trenn@suse.de> | 2949 | M: Thomas Renninger <trenn@suse.com> |
2936 | L: linux-pm@vger.kernel.org | 2950 | L: linux-pm@vger.kernel.org |
2937 | S: Maintained | 2951 | S: Maintained |
2938 | F: tools/power/cpupower/ | 2952 | F: tools/power/cpupower/ |
@@ -3162,7 +3176,7 @@ F: Documentation/networking/dmfe.txt | |||
3162 | F: drivers/net/ethernet/dec/tulip/dmfe.c | 3176 | F: drivers/net/ethernet/dec/tulip/dmfe.c |
3163 | 3177 | ||
3164 | DC390/AM53C974 SCSI driver | 3178 | DC390/AM53C974 SCSI driver |
3165 | M: Hannes Reinecke <hare@suse.de> | 3179 | M: Hannes Reinecke <hare@suse.com> |
3166 | L: linux-scsi@vger.kernel.org | 3180 | L: linux-scsi@vger.kernel.org |
3167 | S: Maintained | 3181 | S: Maintained |
3168 | F: drivers/scsi/am53c974.c | 3182 | F: drivers/scsi/am53c974.c |
@@ -3366,7 +3380,7 @@ W: http://www.win.tue.nl/~aeb/partitions/partition_types-1.html | |||
3366 | S: Maintained | 3380 | S: Maintained |
3367 | 3381 | ||
3368 | DISKQUOTA | 3382 | DISKQUOTA |
3369 | M: Jan Kara <jack@suse.cz> | 3383 | M: Jan Kara <jack@suse.com> |
3370 | S: Maintained | 3384 | S: Maintained |
3371 | F: Documentation/filesystems/quota.txt | 3385 | F: Documentation/filesystems/quota.txt |
3372 | F: fs/quota/ | 3386 | F: fs/quota/ |
@@ -3422,7 +3436,7 @@ F: Documentation/hwmon/dme1737 | |||
3422 | F: drivers/hwmon/dme1737.c | 3436 | F: drivers/hwmon/dme1737.c |
3423 | 3437 | ||
3424 | DMI/SMBIOS SUPPORT | 3438 | DMI/SMBIOS SUPPORT |
3425 | M: Jean Delvare <jdelvare@suse.de> | 3439 | M: Jean Delvare <jdelvare@suse.com> |
3426 | S: Maintained | 3440 | S: Maintained |
3427 | T: quilt http://jdelvare.nerim.net/devel/linux/jdelvare-dmi/ | 3441 | T: quilt http://jdelvare.nerim.net/devel/linux/jdelvare-dmi/ |
3428 | F: Documentation/ABI/testing/sysfs-firmware-dmi-tables | 3442 | F: Documentation/ABI/testing/sysfs-firmware-dmi-tables |
@@ -4038,7 +4052,7 @@ F: drivers/of/of_mdio.c | |||
4038 | F: drivers/of/of_net.c | 4052 | F: drivers/of/of_net.c |
4039 | 4053 | ||
4040 | EXT2 FILE SYSTEM | 4054 | EXT2 FILE SYSTEM |
4041 | M: Jan Kara <jack@suse.cz> | 4055 | M: Jan Kara <jack@suse.com> |
4042 | L: linux-ext4@vger.kernel.org | 4056 | L: linux-ext4@vger.kernel.org |
4043 | S: Maintained | 4057 | S: Maintained |
4044 | F: Documentation/filesystems/ext2.txt | 4058 | F: Documentation/filesystems/ext2.txt |
@@ -4046,7 +4060,7 @@ F: fs/ext2/ | |||
4046 | F: include/linux/ext2* | 4060 | F: include/linux/ext2* |
4047 | 4061 | ||
4048 | EXT3 FILE SYSTEM | 4062 | EXT3 FILE SYSTEM |
4049 | M: Jan Kara <jack@suse.cz> | 4063 | M: Jan Kara <jack@suse.com> |
4050 | M: Andrew Morton <akpm@linux-foundation.org> | 4064 | M: Andrew Morton <akpm@linux-foundation.org> |
4051 | M: Andreas Dilger <adilger.kernel@dilger.ca> | 4065 | M: Andreas Dilger <adilger.kernel@dilger.ca> |
4052 | L: linux-ext4@vger.kernel.org | 4066 | L: linux-ext4@vger.kernel.org |
@@ -4096,7 +4110,7 @@ F: drivers/video/fbdev/exynos/exynos_mipi* | |||
4096 | F: include/video/exynos_mipi* | 4110 | F: include/video/exynos_mipi* |
4097 | 4111 | ||
4098 | F71805F HARDWARE MONITORING DRIVER | 4112 | F71805F HARDWARE MONITORING DRIVER |
4099 | M: Jean Delvare <jdelvare@suse.de> | 4113 | M: Jean Delvare <jdelvare@suse.com> |
4100 | L: lm-sensors@lm-sensors.org | 4114 | L: lm-sensors@lm-sensors.org |
4101 | S: Maintained | 4115 | S: Maintained |
4102 | F: Documentation/hwmon/f71805f | 4116 | F: Documentation/hwmon/f71805f |
@@ -4231,7 +4245,7 @@ S: Maintained | |||
4231 | F: drivers/block/rsxx/ | 4245 | F: drivers/block/rsxx/ |
4232 | 4246 | ||
4233 | FLOPPY DRIVER | 4247 | FLOPPY DRIVER |
4234 | M: Jiri Kosina <jkosina@suse.cz> | 4248 | M: Jiri Kosina <jkosina@suse.com> |
4235 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/floppy.git | 4249 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/floppy.git |
4236 | S: Odd fixes | 4250 | S: Odd fixes |
4237 | F: drivers/block/floppy.c | 4251 | F: drivers/block/floppy.c |
@@ -4652,7 +4666,7 @@ F: drivers/media/usb/stk1160/ | |||
4652 | 4666 | ||
4653 | H8/300 ARCHITECTURE | 4667 | H8/300 ARCHITECTURE |
4654 | M: Yoshinori Sato <ysato@users.sourceforge.jp> | 4668 | M: Yoshinori Sato <ysato@users.sourceforge.jp> |
4655 | L: uclinux-h8-devel@lists.sourceforge.jp | 4669 | L: uclinux-h8-devel@lists.sourceforge.jp (moderated for non-subscribers) |
4656 | W: http://uclinux-h8.sourceforge.jp | 4670 | W: http://uclinux-h8.sourceforge.jp |
4657 | T: git git://git.sourceforge.jp/gitroot/uclinux-h8/linux.git | 4671 | T: git git://git.sourceforge.jp/gitroot/uclinux-h8/linux.git |
4658 | S: Maintained | 4672 | S: Maintained |
@@ -4699,7 +4713,7 @@ S: Maintained | |||
4699 | F: drivers/media/usb/hackrf/ | 4713 | F: drivers/media/usb/hackrf/ |
4700 | 4714 | ||
4701 | HARDWARE MONITORING | 4715 | HARDWARE MONITORING |
4702 | M: Jean Delvare <jdelvare@suse.de> | 4716 | M: Jean Delvare <jdelvare@suse.com> |
4703 | M: Guenter Roeck <linux@roeck-us.net> | 4717 | M: Guenter Roeck <linux@roeck-us.net> |
4704 | L: lm-sensors@lm-sensors.org | 4718 | L: lm-sensors@lm-sensors.org |
4705 | W: http://www.lm-sensors.org/ | 4719 | W: http://www.lm-sensors.org/ |
@@ -4802,7 +4816,7 @@ F: include/linux/pm.h | |||
4802 | F: arch/*/include/asm/suspend*.h | 4816 | F: arch/*/include/asm/suspend*.h |
4803 | 4817 | ||
4804 | HID CORE LAYER | 4818 | HID CORE LAYER |
4805 | M: Jiri Kosina <jkosina@suse.cz> | 4819 | M: Jiri Kosina <jkosina@suse.com> |
4806 | L: linux-input@vger.kernel.org | 4820 | L: linux-input@vger.kernel.org |
4807 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git | 4821 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git |
4808 | S: Maintained | 4822 | S: Maintained |
@@ -4811,7 +4825,7 @@ F: include/linux/hid* | |||
4811 | F: include/uapi/linux/hid* | 4825 | F: include/uapi/linux/hid* |
4812 | 4826 | ||
4813 | HID SENSOR HUB DRIVERS | 4827 | HID SENSOR HUB DRIVERS |
4814 | M: Jiri Kosina <jkosina@suse.cz> | 4828 | M: Jiri Kosina <jkosina@suse.com> |
4815 | M: Jonathan Cameron <jic23@kernel.org> | 4829 | M: Jonathan Cameron <jic23@kernel.org> |
4816 | M: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | 4830 | M: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> |
4817 | L: linux-input@vger.kernel.org | 4831 | L: linux-input@vger.kernel.org |
@@ -4945,7 +4959,7 @@ F: include/linux/hyperv.h | |||
4945 | F: tools/hv/ | 4959 | F: tools/hv/ |
4946 | 4960 | ||
4947 | I2C OVER PARALLEL PORT | 4961 | I2C OVER PARALLEL PORT |
4948 | M: Jean Delvare <jdelvare@suse.de> | 4962 | M: Jean Delvare <jdelvare@suse.com> |
4949 | L: linux-i2c@vger.kernel.org | 4963 | L: linux-i2c@vger.kernel.org |
4950 | S: Maintained | 4964 | S: Maintained |
4951 | F: Documentation/i2c/busses/i2c-parport | 4965 | F: Documentation/i2c/busses/i2c-parport |
@@ -4954,7 +4968,7 @@ F: drivers/i2c/busses/i2c-parport.c | |||
4954 | F: drivers/i2c/busses/i2c-parport-light.c | 4968 | F: drivers/i2c/busses/i2c-parport-light.c |
4955 | 4969 | ||
4956 | I2C/SMBUS CONTROLLER DRIVERS FOR PC | 4970 | I2C/SMBUS CONTROLLER DRIVERS FOR PC |
4957 | M: Jean Delvare <jdelvare@suse.de> | 4971 | M: Jean Delvare <jdelvare@suse.com> |
4958 | L: linux-i2c@vger.kernel.org | 4972 | L: linux-i2c@vger.kernel.org |
4959 | S: Maintained | 4973 | S: Maintained |
4960 | F: Documentation/i2c/busses/i2c-ali1535 | 4974 | F: Documentation/i2c/busses/i2c-ali1535 |
@@ -4995,7 +5009,7 @@ F: drivers/i2c/busses/i2c-ismt.c | |||
4995 | F: Documentation/i2c/busses/i2c-ismt | 5009 | F: Documentation/i2c/busses/i2c-ismt |
4996 | 5010 | ||
4997 | I2C/SMBUS STUB DRIVER | 5011 | I2C/SMBUS STUB DRIVER |
4998 | M: Jean Delvare <jdelvare@suse.de> | 5012 | M: Jean Delvare <jdelvare@suse.com> |
4999 | L: linux-i2c@vger.kernel.org | 5013 | L: linux-i2c@vger.kernel.org |
5000 | S: Maintained | 5014 | S: Maintained |
5001 | F: drivers/i2c/i2c-stub.c | 5015 | F: drivers/i2c/i2c-stub.c |
@@ -5022,7 +5036,7 @@ L: linux-acpi@vger.kernel.org | |||
5022 | S: Maintained | 5036 | S: Maintained |
5023 | 5037 | ||
5024 | I2C-TAOS-EVM DRIVER | 5038 | I2C-TAOS-EVM DRIVER |
5025 | M: Jean Delvare <jdelvare@suse.de> | 5039 | M: Jean Delvare <jdelvare@suse.com> |
5026 | L: linux-i2c@vger.kernel.org | 5040 | L: linux-i2c@vger.kernel.org |
5027 | S: Maintained | 5041 | S: Maintained |
5028 | F: Documentation/i2c/busses/i2c-taos-evm | 5042 | F: Documentation/i2c/busses/i2c-taos-evm |
@@ -5551,8 +5565,8 @@ F: include/uapi/linux/ip_vs.h | |||
5551 | F: net/netfilter/ipvs/ | 5565 | F: net/netfilter/ipvs/ |
5552 | 5566 | ||
5553 | IPWIRELESS DRIVER | 5567 | IPWIRELESS DRIVER |
5554 | M: Jiri Kosina <jkosina@suse.cz> | 5568 | M: Jiri Kosina <jkosina@suse.com> |
5555 | M: David Sterba <dsterba@suse.cz> | 5569 | M: David Sterba <dsterba@suse.com> |
5556 | S: Odd Fixes | 5570 | S: Odd Fixes |
5557 | F: drivers/tty/ipwireless/ | 5571 | F: drivers/tty/ipwireless/ |
5558 | 5572 | ||
@@ -5672,7 +5686,7 @@ S: Maintained | |||
5672 | F: drivers/isdn/hardware/eicon/ | 5686 | F: drivers/isdn/hardware/eicon/ |
5673 | 5687 | ||
5674 | IT87 HARDWARE MONITORING DRIVER | 5688 | IT87 HARDWARE MONITORING DRIVER |
5675 | M: Jean Delvare <jdelvare@suse.de> | 5689 | M: Jean Delvare <jdelvare@suse.com> |
5676 | L: lm-sensors@lm-sensors.org | 5690 | L: lm-sensors@lm-sensors.org |
5677 | S: Maintained | 5691 | S: Maintained |
5678 | F: Documentation/hwmon/it87 | 5692 | F: Documentation/hwmon/it87 |
@@ -5739,7 +5753,7 @@ F: include/uapi/linux/jffs2.h | |||
5739 | 5753 | ||
5740 | JOURNALLING LAYER FOR BLOCK DEVICES (JBD) | 5754 | JOURNALLING LAYER FOR BLOCK DEVICES (JBD) |
5741 | M: Andrew Morton <akpm@linux-foundation.org> | 5755 | M: Andrew Morton <akpm@linux-foundation.org> |
5742 | M: Jan Kara <jack@suse.cz> | 5756 | M: Jan Kara <jack@suse.com> |
5743 | L: linux-ext4@vger.kernel.org | 5757 | L: linux-ext4@vger.kernel.org |
5744 | S: Maintained | 5758 | S: Maintained |
5745 | F: fs/jbd/ | 5759 | F: fs/jbd/ |
@@ -5803,7 +5817,7 @@ S: Maintained | |||
5803 | F: fs/autofs4/ | 5817 | F: fs/autofs4/ |
5804 | 5818 | ||
5805 | KERNEL BUILD + files below scripts/ (unless maintained elsewhere) | 5819 | KERNEL BUILD + files below scripts/ (unless maintained elsewhere) |
5806 | M: Michal Marek <mmarek@suse.cz> | 5820 | M: Michal Marek <mmarek@suse.com> |
5807 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git for-next | 5821 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git for-next |
5808 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git rc-fixes | 5822 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git rc-fixes |
5809 | L: linux-kbuild@vger.kernel.org | 5823 | L: linux-kbuild@vger.kernel.org |
@@ -5867,7 +5881,7 @@ F: arch/x86/include/asm/svm.h | |||
5867 | F: arch/x86/kvm/svm.c | 5881 | F: arch/x86/kvm/svm.c |
5868 | 5882 | ||
5869 | KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC | 5883 | KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC |
5870 | M: Alexander Graf <agraf@suse.de> | 5884 | M: Alexander Graf <agraf@suse.com> |
5871 | L: kvm-ppc@vger.kernel.org | 5885 | L: kvm-ppc@vger.kernel.org |
5872 | W: http://kvm.qumranet.com | 5886 | W: http://kvm.qumranet.com |
5873 | T: git git://github.com/agraf/linux-2.6.git | 5887 | T: git git://github.com/agraf/linux-2.6.git |
@@ -5885,7 +5899,6 @@ S: Supported | |||
5885 | F: Documentation/s390/kvm.txt | 5899 | F: Documentation/s390/kvm.txt |
5886 | F: arch/s390/include/asm/kvm* | 5900 | F: arch/s390/include/asm/kvm* |
5887 | F: arch/s390/kvm/ | 5901 | F: arch/s390/kvm/ |
5888 | F: drivers/s390/kvm/ | ||
5889 | 5902 | ||
5890 | KERNEL VIRTUAL MACHINE (KVM) FOR ARM | 5903 | KERNEL VIRTUAL MACHINE (KVM) FOR ARM |
5891 | M: Christoffer Dall <christoffer.dall@linaro.org> | 5904 | M: Christoffer Dall <christoffer.dall@linaro.org> |
@@ -6024,7 +6037,7 @@ F: drivers/leds/ | |||
6024 | F: include/linux/leds.h | 6037 | F: include/linux/leds.h |
6025 | 6038 | ||
6026 | LEGACY EEPROM DRIVER | 6039 | LEGACY EEPROM DRIVER |
6027 | M: Jean Delvare <jdelvare@suse.de> | 6040 | M: Jean Delvare <jdelvare@suse.com> |
6028 | S: Maintained | 6041 | S: Maintained |
6029 | F: Documentation/misc-devices/eeprom | 6042 | F: Documentation/misc-devices/eeprom |
6030 | F: drivers/misc/eeprom/eeprom.c | 6043 | F: drivers/misc/eeprom/eeprom.c |
@@ -6077,7 +6090,7 @@ F: include/linux/ata.h | |||
6077 | F: include/linux/libata.h | 6090 | F: include/linux/libata.h |
6078 | 6091 | ||
6079 | LIBATA PATA ARASAN COMPACT FLASH CONTROLLER | 6092 | LIBATA PATA ARASAN COMPACT FLASH CONTROLLER |
6080 | M: Viresh Kumar <viresh.linux@gmail.com> | 6093 | M: Viresh Kumar <vireshk@kernel.org> |
6081 | L: linux-ide@vger.kernel.org | 6094 | L: linux-ide@vger.kernel.org |
6082 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata.git | 6095 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata.git |
6083 | S: Maintained | 6096 | S: Maintained |
@@ -6147,6 +6160,7 @@ L: linux-nvdimm@lists.01.org | |||
6147 | Q: https://patchwork.kernel.org/project/linux-nvdimm/list/ | 6160 | Q: https://patchwork.kernel.org/project/linux-nvdimm/list/ |
6148 | S: Supported | 6161 | S: Supported |
6149 | F: drivers/nvdimm/pmem.c | 6162 | F: drivers/nvdimm/pmem.c |
6163 | F: include/linux/pmem.h | ||
6150 | 6164 | ||
6151 | LINUX FOR IBM pSERIES (RS/6000) | 6165 | LINUX FOR IBM pSERIES (RS/6000) |
6152 | M: Paul Mackerras <paulus@au.ibm.com> | 6166 | M: Paul Mackerras <paulus@au.ibm.com> |
@@ -6161,7 +6175,7 @@ M: Michael Ellerman <mpe@ellerman.id.au> | |||
6161 | W: http://www.penguinppc.org/ | 6175 | W: http://www.penguinppc.org/ |
6162 | L: linuxppc-dev@lists.ozlabs.org | 6176 | L: linuxppc-dev@lists.ozlabs.org |
6163 | Q: http://patchwork.ozlabs.org/project/linuxppc-dev/list/ | 6177 | Q: http://patchwork.ozlabs.org/project/linuxppc-dev/list/ |
6164 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git | 6178 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git |
6165 | S: Supported | 6179 | S: Supported |
6166 | F: Documentation/powerpc/ | 6180 | F: Documentation/powerpc/ |
6167 | F: arch/powerpc/ | 6181 | F: arch/powerpc/ |
@@ -6237,8 +6251,8 @@ F: drivers/platform/x86/hp_accel.c | |||
6237 | LIVE PATCHING | 6251 | LIVE PATCHING |
6238 | M: Josh Poimboeuf <jpoimboe@redhat.com> | 6252 | M: Josh Poimboeuf <jpoimboe@redhat.com> |
6239 | M: Seth Jennings <sjenning@redhat.com> | 6253 | M: Seth Jennings <sjenning@redhat.com> |
6240 | M: Jiri Kosina <jkosina@suse.cz> | 6254 | M: Jiri Kosina <jkosina@suse.com> |
6241 | M: Vojtech Pavlik <vojtech@suse.cz> | 6255 | M: Vojtech Pavlik <vojtech@suse.com> |
6242 | S: Maintained | 6256 | S: Maintained |
6243 | F: kernel/livepatch/ | 6257 | F: kernel/livepatch/ |
6244 | F: include/linux/livepatch.h | 6258 | F: include/linux/livepatch.h |
@@ -6264,21 +6278,21 @@ S: Maintained | |||
6264 | F: drivers/hwmon/lm73.c | 6278 | F: drivers/hwmon/lm73.c |
6265 | 6279 | ||
6266 | LM78 HARDWARE MONITOR DRIVER | 6280 | LM78 HARDWARE MONITOR DRIVER |
6267 | M: Jean Delvare <jdelvare@suse.de> | 6281 | M: Jean Delvare <jdelvare@suse.com> |
6268 | L: lm-sensors@lm-sensors.org | 6282 | L: lm-sensors@lm-sensors.org |
6269 | S: Maintained | 6283 | S: Maintained |
6270 | F: Documentation/hwmon/lm78 | 6284 | F: Documentation/hwmon/lm78 |
6271 | F: drivers/hwmon/lm78.c | 6285 | F: drivers/hwmon/lm78.c |
6272 | 6286 | ||
6273 | LM83 HARDWARE MONITOR DRIVER | 6287 | LM83 HARDWARE MONITOR DRIVER |
6274 | M: Jean Delvare <jdelvare@suse.de> | 6288 | M: Jean Delvare <jdelvare@suse.com> |
6275 | L: lm-sensors@lm-sensors.org | 6289 | L: lm-sensors@lm-sensors.org |
6276 | S: Maintained | 6290 | S: Maintained |
6277 | F: Documentation/hwmon/lm83 | 6291 | F: Documentation/hwmon/lm83 |
6278 | F: drivers/hwmon/lm83.c | 6292 | F: drivers/hwmon/lm83.c |
6279 | 6293 | ||
6280 | LM90 HARDWARE MONITOR DRIVER | 6294 | LM90 HARDWARE MONITOR DRIVER |
6281 | M: Jean Delvare <jdelvare@suse.de> | 6295 | M: Jean Delvare <jdelvare@suse.com> |
6282 | L: lm-sensors@lm-sensors.org | 6296 | L: lm-sensors@lm-sensors.org |
6283 | S: Maintained | 6297 | S: Maintained |
6284 | F: Documentation/hwmon/lm90 | 6298 | F: Documentation/hwmon/lm90 |
@@ -6824,6 +6838,12 @@ T: git git://linuxtv.org/anttip/media_tree.git | |||
6824 | S: Maintained | 6838 | S: Maintained |
6825 | F: drivers/media/usb/msi2500/ | 6839 | F: drivers/media/usb/msi2500/ |
6826 | 6840 | ||
6841 | MSYSTEMS DISKONCHIP G3 MTD DRIVER | ||
6842 | M: Robert Jarzmik <robert.jarzmik@free.fr> | ||
6843 | L: linux-mtd@lists.infradead.org | ||
6844 | S: Maintained | ||
6845 | F: drivers/mtd/devices/docg3* | ||
6846 | |||
6827 | MT9M032 APTINA SENSOR DRIVER | 6847 | MT9M032 APTINA SENSOR DRIVER |
6828 | M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 6848 | M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
6829 | L: linux-media@vger.kernel.org | 6849 | L: linux-media@vger.kernel.org |
@@ -7005,6 +7025,7 @@ F: include/uapi/linux/netfilter/ | |||
7005 | F: net/*/netfilter.c | 7025 | F: net/*/netfilter.c |
7006 | F: net/*/netfilter/ | 7026 | F: net/*/netfilter/ |
7007 | F: net/netfilter/ | 7027 | F: net/netfilter/ |
7028 | F: net/bridge/br_netfilter*.c | ||
7008 | 7029 | ||
7009 | NETLABEL | 7030 | NETLABEL |
7010 | M: Paul Moore <paul@paul-moore.com> | 7031 | M: Paul Moore <paul@paul-moore.com> |
@@ -7704,7 +7725,7 @@ S: Maintained | |||
7704 | F: drivers/char/pc8736x_gpio.c | 7725 | F: drivers/char/pc8736x_gpio.c |
7705 | 7726 | ||
7706 | PC87427 HARDWARE MONITORING DRIVER | 7727 | PC87427 HARDWARE MONITORING DRIVER |
7707 | M: Jean Delvare <jdelvare@suse.de> | 7728 | M: Jean Delvare <jdelvare@suse.com> |
7708 | L: lm-sensors@lm-sensors.org | 7729 | L: lm-sensors@lm-sensors.org |
7709 | S: Maintained | 7730 | S: Maintained |
7710 | F: Documentation/hwmon/pc87427 | 7731 | F: Documentation/hwmon/pc87427 |
@@ -7981,7 +8002,7 @@ S: Maintained | |||
7981 | F: drivers/pinctrl/samsung/ | 8002 | F: drivers/pinctrl/samsung/ |
7982 | 8003 | ||
7983 | PIN CONTROLLER - ST SPEAR | 8004 | PIN CONTROLLER - ST SPEAR |
7984 | M: Viresh Kumar <viresh.linux@gmail.com> | 8005 | M: Viresh Kumar <vireshk@kernel.org> |
7985 | L: spear-devel@list.st.com | 8006 | L: spear-devel@list.st.com |
7986 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 8007 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
7987 | W: http://www.st.com/spear | 8008 | W: http://www.st.com/spear |
@@ -7989,7 +8010,7 @@ S: Maintained | |||
7989 | F: drivers/pinctrl/spear/ | 8010 | F: drivers/pinctrl/spear/ |
7990 | 8011 | ||
7991 | PKTCDVD DRIVER | 8012 | PKTCDVD DRIVER |
7992 | M: Jiri Kosina <jkosina@suse.cz> | 8013 | M: Jiri Kosina <jkosina@suse.com> |
7993 | S: Maintained | 8014 | S: Maintained |
7994 | F: drivers/block/pktcdvd.c | 8015 | F: drivers/block/pktcdvd.c |
7995 | F: include/linux/pktcdvd.h | 8016 | F: include/linux/pktcdvd.h |
@@ -8366,10 +8387,12 @@ RADOS BLOCK DEVICE (RBD) | |||
8366 | M: Ilya Dryomov <idryomov@gmail.com> | 8387 | M: Ilya Dryomov <idryomov@gmail.com> |
8367 | M: Sage Weil <sage@redhat.com> | 8388 | M: Sage Weil <sage@redhat.com> |
8368 | M: Alex Elder <elder@kernel.org> | 8389 | M: Alex Elder <elder@kernel.org> |
8369 | M: ceph-devel@vger.kernel.org | 8390 | L: ceph-devel@vger.kernel.org |
8370 | W: http://ceph.com/ | 8391 | W: http://ceph.com/ |
8371 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git | 8392 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git |
8393 | T: git git://github.com/ceph/ceph-client.git | ||
8372 | S: Supported | 8394 | S: Supported |
8395 | F: Documentation/ABI/testing/sysfs-bus-rbd | ||
8373 | F: drivers/block/rbd.c | 8396 | F: drivers/block/rbd.c |
8374 | F: drivers/block/rbd_types.h | 8397 | F: drivers/block/rbd_types.h |
8375 | 8398 | ||
@@ -8878,7 +8901,7 @@ S: Maintained | |||
8878 | F: drivers/tty/serial/ | 8901 | F: drivers/tty/serial/ |
8879 | 8902 | ||
8880 | SYNOPSYS DESIGNWARE DMAC DRIVER | 8903 | SYNOPSYS DESIGNWARE DMAC DRIVER |
8881 | M: Viresh Kumar <viresh.linux@gmail.com> | 8904 | M: Viresh Kumar <vireshk@kernel.org> |
8882 | M: Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 8905 | M: Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
8883 | S: Maintained | 8906 | S: Maintained |
8884 | F: include/linux/dma/dw.h | 8907 | F: include/linux/dma/dw.h |
@@ -9045,7 +9068,7 @@ S: Maintained | |||
9045 | F: drivers/mmc/host/sdhci-s3c* | 9068 | F: drivers/mmc/host/sdhci-s3c* |
9046 | 9069 | ||
9047 | SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) ST SPEAR DRIVER | 9070 | SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) ST SPEAR DRIVER |
9048 | M: Viresh Kumar <viresh.linux@gmail.com> | 9071 | M: Viresh Kumar <vireshk@kernel.org> |
9049 | L: spear-devel@list.st.com | 9072 | L: spear-devel@list.st.com |
9050 | L: linux-mmc@vger.kernel.org | 9073 | L: linux-mmc@vger.kernel.org |
9051 | S: Maintained | 9074 | S: Maintained |
@@ -9407,7 +9430,7 @@ F: Documentation/hwmon/sch5627 | |||
9407 | F: drivers/hwmon/sch5627.c | 9430 | F: drivers/hwmon/sch5627.c |
9408 | 9431 | ||
9409 | SMSC47B397 HARDWARE MONITOR DRIVER | 9432 | SMSC47B397 HARDWARE MONITOR DRIVER |
9410 | M: Jean Delvare <jdelvare@suse.de> | 9433 | M: Jean Delvare <jdelvare@suse.com> |
9411 | L: lm-sensors@lm-sensors.org | 9434 | L: lm-sensors@lm-sensors.org |
9412 | S: Maintained | 9435 | S: Maintained |
9413 | F: Documentation/hwmon/smsc47b397 | 9436 | F: Documentation/hwmon/smsc47b397 |
@@ -9456,7 +9479,7 @@ S: Supported | |||
9456 | F: drivers/media/pci/solo6x10/ | 9479 | F: drivers/media/pci/solo6x10/ |
9457 | 9480 | ||
9458 | SOFTWARE RAID (Multiple Disks) SUPPORT | 9481 | SOFTWARE RAID (Multiple Disks) SUPPORT |
9459 | M: Neil Brown <neilb@suse.de> | 9482 | M: Neil Brown <neilb@suse.com> |
9460 | L: linux-raid@vger.kernel.org | 9483 | L: linux-raid@vger.kernel.org |
9461 | S: Supported | 9484 | S: Supported |
9462 | F: drivers/md/ | 9485 | F: drivers/md/ |
@@ -9499,7 +9522,7 @@ F: drivers/memstick/core/ms_block.* | |||
9499 | 9522 | ||
9500 | SOUND | 9523 | SOUND |
9501 | M: Jaroslav Kysela <perex@perex.cz> | 9524 | M: Jaroslav Kysela <perex@perex.cz> |
9502 | M: Takashi Iwai <tiwai@suse.de> | 9525 | M: Takashi Iwai <tiwai@suse.com> |
9503 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 9526 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
9504 | W: http://www.alsa-project.org/ | 9527 | W: http://www.alsa-project.org/ |
9505 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git | 9528 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git |
@@ -9583,7 +9606,7 @@ S: Maintained | |||
9583 | F: include/linux/compiler.h | 9606 | F: include/linux/compiler.h |
9584 | 9607 | ||
9585 | SPEAR PLATFORM SUPPORT | 9608 | SPEAR PLATFORM SUPPORT |
9586 | M: Viresh Kumar <viresh.linux@gmail.com> | 9609 | M: Viresh Kumar <vireshk@kernel.org> |
9587 | M: Shiraz Hashim <shiraz.linux.kernel@gmail.com> | 9610 | M: Shiraz Hashim <shiraz.linux.kernel@gmail.com> |
9588 | L: spear-devel@list.st.com | 9611 | L: spear-devel@list.st.com |
9589 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 9612 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
@@ -9592,7 +9615,7 @@ S: Maintained | |||
9592 | F: arch/arm/mach-spear/ | 9615 | F: arch/arm/mach-spear/ |
9593 | 9616 | ||
9594 | SPEAR CLOCK FRAMEWORK SUPPORT | 9617 | SPEAR CLOCK FRAMEWORK SUPPORT |
9595 | M: Viresh Kumar <viresh.linux@gmail.com> | 9618 | M: Viresh Kumar <vireshk@kernel.org> |
9596 | L: spear-devel@list.st.com | 9619 | L: spear-devel@list.st.com |
9597 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 9620 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
9598 | W: http://www.st.com/spear | 9621 | W: http://www.st.com/spear |
@@ -10382,7 +10405,7 @@ K: ^Subject:.*(?i)trivial | |||
10382 | 10405 | ||
10383 | TTY LAYER | 10406 | TTY LAYER |
10384 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 10407 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
10385 | M: Jiri Slaby <jslaby@suse.cz> | 10408 | M: Jiri Slaby <jslaby@suse.com> |
10386 | S: Supported | 10409 | S: Supported |
10387 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git | 10410 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git |
10388 | F: Documentation/serial/ | 10411 | F: Documentation/serial/ |
@@ -10456,7 +10479,7 @@ F: arch/m68k/*/*_no.* | |||
10456 | F: arch/m68k/include/asm/*_no.* | 10479 | F: arch/m68k/include/asm/*_no.* |
10457 | 10480 | ||
10458 | UDF FILESYSTEM | 10481 | UDF FILESYSTEM |
10459 | M: Jan Kara <jack@suse.cz> | 10482 | M: Jan Kara <jack@suse.com> |
10460 | S: Maintained | 10483 | S: Maintained |
10461 | F: Documentation/filesystems/udf.txt | 10484 | F: Documentation/filesystems/udf.txt |
10462 | F: fs/udf/ | 10485 | F: fs/udf/ |
@@ -10599,7 +10622,7 @@ F: drivers/usb/gadget/ | |||
10599 | F: include/linux/usb/gadget* | 10622 | F: include/linux/usb/gadget* |
10600 | 10623 | ||
10601 | USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...) | 10624 | USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...) |
10602 | M: Jiri Kosina <jkosina@suse.cz> | 10625 | M: Jiri Kosina <jkosina@suse.com> |
10603 | L: linux-usb@vger.kernel.org | 10626 | L: linux-usb@vger.kernel.org |
10604 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git | 10627 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git |
10605 | S: Maintained | 10628 | S: Maintained |
@@ -10724,7 +10747,7 @@ S: Maintained | |||
10724 | F: drivers/usb/host/uhci* | 10747 | F: drivers/usb/host/uhci* |
10725 | 10748 | ||
10726 | USB "USBNET" DRIVER FRAMEWORK | 10749 | USB "USBNET" DRIVER FRAMEWORK |
10727 | M: Oliver Neukum <oneukum@suse.de> | 10750 | M: Oliver Neukum <oneukum@suse.com> |
10728 | L: netdev@vger.kernel.org | 10751 | L: netdev@vger.kernel.org |
10729 | W: http://www.linux-usb.org/usbnet | 10752 | W: http://www.linux-usb.org/usbnet |
10730 | S: Maintained | 10753 | S: Maintained |
@@ -10878,6 +10901,15 @@ F: drivers/block/virtio_blk.c | |||
10878 | F: include/linux/virtio_*.h | 10901 | F: include/linux/virtio_*.h |
10879 | F: include/uapi/linux/virtio_*.h | 10902 | F: include/uapi/linux/virtio_*.h |
10880 | 10903 | ||
10904 | VIRTIO DRIVERS FOR S390 | ||
10905 | M: Christian Borntraeger <borntraeger@de.ibm.com> | ||
10906 | M: Cornelia Huck <cornelia.huck@de.ibm.com> | ||
10907 | L: linux-s390@vger.kernel.org | ||
10908 | L: virtualization@lists.linux-foundation.org | ||
10909 | L: kvm@vger.kernel.org | ||
10910 | S: Supported | ||
10911 | F: drivers/s390/virtio/ | ||
10912 | |||
10881 | VIRTIO GPU DRIVER | 10913 | VIRTIO GPU DRIVER |
10882 | M: David Airlie <airlied@linux.ie> | 10914 | M: David Airlie <airlied@linux.ie> |
10883 | M: Gerd Hoffmann <kraxel@redhat.com> | 10915 | M: Gerd Hoffmann <kraxel@redhat.com> |
@@ -11051,7 +11083,7 @@ F: Documentation/hwmon/w83793 | |||
11051 | F: drivers/hwmon/w83793.c | 11083 | F: drivers/hwmon/w83793.c |
11052 | 11084 | ||
11053 | W83795 HARDWARE MONITORING DRIVER | 11085 | W83795 HARDWARE MONITORING DRIVER |
11054 | M: Jean Delvare <jdelvare@suse.de> | 11086 | M: Jean Delvare <jdelvare@suse.com> |
11055 | L: lm-sensors@lm-sensors.org | 11087 | L: lm-sensors@lm-sensors.org |
11056 | S: Maintained | 11088 | S: Maintained |
11057 | F: drivers/hwmon/w83795.c | 11089 | F: drivers/hwmon/w83795.c |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 4 | 1 | VERSION = 4 |
2 | PATCHLEVEL = 2 | 2 | PATCHLEVEL = 2 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc1 | 4 | EXTRAVERSION = -rc4 |
5 | NAME = Hurr durr I'ma sheep | 5 | NAME = Hurr durr I'ma sheep |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
@@ -780,10 +780,11 @@ endif | |||
780 | include scripts/Makefile.kasan | 780 | include scripts/Makefile.kasan |
781 | include scripts/Makefile.extrawarn | 781 | include scripts/Makefile.extrawarn |
782 | 782 | ||
783 | # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments | 783 | # Add any arch overrides and user supplied CPPFLAGS, AFLAGS and CFLAGS as the |
784 | KBUILD_CPPFLAGS += $(KCPPFLAGS) | 784 | # last assignments |
785 | KBUILD_AFLAGS += $(KAFLAGS) | 785 | KBUILD_CPPFLAGS += $(ARCH_CPPFLAGS) $(KCPPFLAGS) |
786 | KBUILD_CFLAGS += $(KCFLAGS) | 786 | KBUILD_AFLAGS += $(ARCH_AFLAGS) $(KAFLAGS) |
787 | KBUILD_CFLAGS += $(ARCH_CFLAGS) $(KCFLAGS) | ||
787 | 788 | ||
788 | # Use --build-id when available. | 789 | # Use --build-id when available. |
789 | LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ | 790 | LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ |
diff --git a/arch/Kconfig b/arch/Kconfig index bec6666a3cc4..8a8ea7110de8 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
@@ -221,6 +221,10 @@ config ARCH_TASK_STRUCT_ALLOCATOR | |||
221 | config ARCH_THREAD_INFO_ALLOCATOR | 221 | config ARCH_THREAD_INFO_ALLOCATOR |
222 | bool | 222 | bool |
223 | 223 | ||
224 | # Select if arch wants to size task_struct dynamically via arch_task_struct_size: | ||
225 | config ARCH_WANTS_DYNAMIC_TASK_STRUCT | ||
226 | bool | ||
227 | |||
224 | config HAVE_REGS_AND_STACK_ACCESS_API | 228 | config HAVE_REGS_AND_STACK_ACCESS_API |
225 | bool | 229 | bool |
226 | help | 230 | help |
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild index cde23cd03609..ffd9cf5ec8c4 100644 --- a/arch/alpha/include/asm/Kbuild +++ b/arch/alpha/include/asm/Kbuild | |||
@@ -5,6 +5,7 @@ generic-y += cputime.h | |||
5 | generic-y += exec.h | 5 | generic-y += exec.h |
6 | generic-y += irq_work.h | 6 | generic-y += irq_work.h |
7 | generic-y += mcs_spinlock.h | 7 | generic-y += mcs_spinlock.h |
8 | generic-y += mm-arch-hooks.h | ||
8 | generic-y += preempt.h | 9 | generic-y += preempt.h |
9 | generic-y += sections.h | 10 | generic-y += sections.h |
10 | generic-y += trace_clock.h | 11 | generic-y += trace_clock.h |
diff --git a/arch/alpha/include/asm/mm-arch-hooks.h b/arch/alpha/include/asm/mm-arch-hooks.h deleted file mode 100644 index b07fd862fec3..000000000000 --- a/arch/alpha/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_ALPHA_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_ALPHA_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_ALPHA_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index e7cee0a5c56d..91cf4055acab 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig | |||
@@ -115,6 +115,7 @@ if ISA_ARCOMPACT | |||
115 | 115 | ||
116 | config ARC_CPU_750D | 116 | config ARC_CPU_750D |
117 | bool "ARC750D" | 117 | bool "ARC750D" |
118 | select ARC_CANT_LLSC | ||
118 | help | 119 | help |
119 | Support for ARC750 core | 120 | Support for ARC750 core |
120 | 121 | ||
@@ -362,7 +363,7 @@ config ARC_CANT_LLSC | |||
362 | config ARC_HAS_LLSC | 363 | config ARC_HAS_LLSC |
363 | bool "Insn: LLOCK/SCOND (efficient atomic ops)" | 364 | bool "Insn: LLOCK/SCOND (efficient atomic ops)" |
364 | default y | 365 | default y |
365 | depends on !ARC_CPU_750D && !ARC_CANT_LLSC | 366 | depends on !ARC_CANT_LLSC |
366 | 367 | ||
367 | config ARC_HAS_SWAPE | 368 | config ARC_HAS_SWAPE |
368 | bool "Insn: SWAPE (endian-swap)" | 369 | bool "Insn: SWAPE (endian-swap)" |
diff --git a/arch/arc/Makefile b/arch/arc/Makefile index 6107062c0111..46d87310220d 100644 --- a/arch/arc/Makefile +++ b/arch/arc/Makefile | |||
@@ -49,7 +49,8 @@ endif | |||
49 | 49 | ||
50 | ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE | 50 | ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE |
51 | # Generic build system uses -O2, we want -O3 | 51 | # Generic build system uses -O2, we want -O3 |
52 | cflags-y += -O3 | 52 | # Note: No need to add to cflags-y as that happens anyways |
53 | ARCH_CFLAGS += -O3 | ||
53 | endif | 54 | endif |
54 | 55 | ||
55 | # small data is default for elf32 tool-chain. If not usable, disable it | 56 | # small data is default for elf32 tool-chain. If not usable, disable it |
diff --git a/arch/arc/boot/dts/axc003.dtsi b/arch/arc/boot/dts/axc003.dtsi index 15c8d6226c9d..1cd5e82f5dc2 100644 --- a/arch/arc/boot/dts/axc003.dtsi +++ b/arch/arc/boot/dts/axc003.dtsi | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | / { | 13 | / { |
14 | compatible = "snps,arc"; | 14 | compatible = "snps,arc"; |
15 | clock-frequency = <75000000>; | 15 | clock-frequency = <90000000>; |
16 | #address-cells = <1>; | 16 | #address-cells = <1>; |
17 | #size-cells = <1>; | 17 | #size-cells = <1>; |
18 | 18 | ||
diff --git a/arch/arc/boot/dts/axc003_idu.dtsi b/arch/arc/boot/dts/axc003_idu.dtsi index 199d42820eca..2f0b33257db2 100644 --- a/arch/arc/boot/dts/axc003_idu.dtsi +++ b/arch/arc/boot/dts/axc003_idu.dtsi | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | / { | 13 | / { |
14 | compatible = "snps,arc"; | 14 | compatible = "snps,arc"; |
15 | clock-frequency = <75000000>; | 15 | clock-frequency = <90000000>; |
16 | #address-cells = <1>; | 16 | #address-cells = <1>; |
17 | #size-cells = <1>; | 17 | #size-cells = <1>; |
18 | 18 | ||
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild index 1a80cc91a03b..7611b10a2d23 100644 --- a/arch/arc/include/asm/Kbuild +++ b/arch/arc/include/asm/Kbuild | |||
@@ -22,6 +22,7 @@ generic-y += kvm_para.h | |||
22 | generic-y += local.h | 22 | generic-y += local.h |
23 | generic-y += local64.h | 23 | generic-y += local64.h |
24 | generic-y += mcs_spinlock.h | 24 | generic-y += mcs_spinlock.h |
25 | generic-y += mm-arch-hooks.h | ||
25 | generic-y += mman.h | 26 | generic-y += mman.h |
26 | generic-y += msgbuf.h | 27 | generic-y += msgbuf.h |
27 | generic-y += param.h | 28 | generic-y += param.h |
diff --git a/arch/arc/include/asm/bitops.h b/arch/arc/include/asm/bitops.h index 99fe118d3730..57c1f33844d4 100644 --- a/arch/arc/include/asm/bitops.h +++ b/arch/arc/include/asm/bitops.h | |||
@@ -50,8 +50,7 @@ static inline void op##_bit(unsigned long nr, volatile unsigned long *m)\ | |||
50 | * done for const @nr, but no code is generated due to gcc \ | 50 | * done for const @nr, but no code is generated due to gcc \ |
51 | * const prop. \ | 51 | * const prop. \ |
52 | */ \ | 52 | */ \ |
53 | if (__builtin_constant_p(nr)) \ | 53 | nr &= 0x1f; \ |
54 | nr &= 0x1f; \ | ||
55 | \ | 54 | \ |
56 | __asm__ __volatile__( \ | 55 | __asm__ __volatile__( \ |
57 | "1: llock %0, [%1] \n" \ | 56 | "1: llock %0, [%1] \n" \ |
@@ -82,8 +81,7 @@ static inline int test_and_##op##_bit(unsigned long nr, volatile unsigned long * | |||
82 | \ | 81 | \ |
83 | m += nr >> 5; \ | 82 | m += nr >> 5; \ |
84 | \ | 83 | \ |
85 | if (__builtin_constant_p(nr)) \ | 84 | nr &= 0x1f; \ |
86 | nr &= 0x1f; \ | ||
87 | \ | 85 | \ |
88 | /* \ | 86 | /* \ |
89 | * Explicit full memory barrier needed before/after as \ | 87 | * Explicit full memory barrier needed before/after as \ |
@@ -129,16 +127,13 @@ static inline void op##_bit(unsigned long nr, volatile unsigned long *m)\ | |||
129 | unsigned long temp, flags; \ | 127 | unsigned long temp, flags; \ |
130 | m += nr >> 5; \ | 128 | m += nr >> 5; \ |
131 | \ | 129 | \ |
132 | if (__builtin_constant_p(nr)) \ | ||
133 | nr &= 0x1f; \ | ||
134 | \ | ||
135 | /* \ | 130 | /* \ |
136 | * spin lock/unlock provide the needed smp_mb() before/after \ | 131 | * spin lock/unlock provide the needed smp_mb() before/after \ |
137 | */ \ | 132 | */ \ |
138 | bitops_lock(flags); \ | 133 | bitops_lock(flags); \ |
139 | \ | 134 | \ |
140 | temp = *m; \ | 135 | temp = *m; \ |
141 | *m = temp c_op (1UL << nr); \ | 136 | *m = temp c_op (1UL << (nr & 0x1f)); \ |
142 | \ | 137 | \ |
143 | bitops_unlock(flags); \ | 138 | bitops_unlock(flags); \ |
144 | } | 139 | } |
@@ -149,17 +144,14 @@ static inline int test_and_##op##_bit(unsigned long nr, volatile unsigned long * | |||
149 | unsigned long old, flags; \ | 144 | unsigned long old, flags; \ |
150 | m += nr >> 5; \ | 145 | m += nr >> 5; \ |
151 | \ | 146 | \ |
152 | if (__builtin_constant_p(nr)) \ | ||
153 | nr &= 0x1f; \ | ||
154 | \ | ||
155 | bitops_lock(flags); \ | 147 | bitops_lock(flags); \ |
156 | \ | 148 | \ |
157 | old = *m; \ | 149 | old = *m; \ |
158 | *m = old c_op (1 << nr); \ | 150 | *m = old c_op (1UL << (nr & 0x1f)); \ |
159 | \ | 151 | \ |
160 | bitops_unlock(flags); \ | 152 | bitops_unlock(flags); \ |
161 | \ | 153 | \ |
162 | return (old & (1 << nr)) != 0; \ | 154 | return (old & (1UL << (nr & 0x1f))) != 0; \ |
163 | } | 155 | } |
164 | 156 | ||
165 | #endif /* CONFIG_ARC_HAS_LLSC */ | 157 | #endif /* CONFIG_ARC_HAS_LLSC */ |
@@ -174,11 +166,8 @@ static inline void __##op##_bit(unsigned long nr, volatile unsigned long *m) \ | |||
174 | unsigned long temp; \ | 166 | unsigned long temp; \ |
175 | m += nr >> 5; \ | 167 | m += nr >> 5; \ |
176 | \ | 168 | \ |
177 | if (__builtin_constant_p(nr)) \ | ||
178 | nr &= 0x1f; \ | ||
179 | \ | ||
180 | temp = *m; \ | 169 | temp = *m; \ |
181 | *m = temp c_op (1UL << nr); \ | 170 | *m = temp c_op (1UL << (nr & 0x1f)); \ |
182 | } | 171 | } |
183 | 172 | ||
184 | #define __TEST_N_BIT_OP(op, c_op, asm_op) \ | 173 | #define __TEST_N_BIT_OP(op, c_op, asm_op) \ |
@@ -187,13 +176,10 @@ static inline int __test_and_##op##_bit(unsigned long nr, volatile unsigned long | |||
187 | unsigned long old; \ | 176 | unsigned long old; \ |
188 | m += nr >> 5; \ | 177 | m += nr >> 5; \ |
189 | \ | 178 | \ |
190 | if (__builtin_constant_p(nr)) \ | ||
191 | nr &= 0x1f; \ | ||
192 | \ | ||
193 | old = *m; \ | 179 | old = *m; \ |
194 | *m = old c_op (1 << nr); \ | 180 | *m = old c_op (1UL << (nr & 0x1f)); \ |
195 | \ | 181 | \ |
196 | return (old & (1 << nr)) != 0; \ | 182 | return (old & (1UL << (nr & 0x1f))) != 0; \ |
197 | } | 183 | } |
198 | 184 | ||
199 | #define BIT_OPS(op, c_op, asm_op) \ | 185 | #define BIT_OPS(op, c_op, asm_op) \ |
@@ -224,10 +210,7 @@ test_bit(unsigned int nr, const volatile unsigned long *addr) | |||
224 | 210 | ||
225 | addr += nr >> 5; | 211 | addr += nr >> 5; |
226 | 212 | ||
227 | if (__builtin_constant_p(nr)) | 213 | mask = 1UL << (nr & 0x1f); |
228 | nr &= 0x1f; | ||
229 | |||
230 | mask = 1 << nr; | ||
231 | 214 | ||
232 | return ((mask & *addr) != 0); | 215 | return ((mask & *addr) != 0); |
233 | } | 216 | } |
diff --git a/arch/arc/include/asm/futex.h b/arch/arc/include/asm/futex.h index 05b5aaf5b0f9..70cfe16b742d 100644 --- a/arch/arc/include/asm/futex.h +++ b/arch/arc/include/asm/futex.h | |||
@@ -16,12 +16,40 @@ | |||
16 | #include <linux/uaccess.h> | 16 | #include <linux/uaccess.h> |
17 | #include <asm/errno.h> | 17 | #include <asm/errno.h> |
18 | 18 | ||
19 | #ifdef CONFIG_ARC_HAS_LLSC | ||
20 | |||
21 | #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg)\ | ||
22 | \ | ||
23 | __asm__ __volatile__( \ | ||
24 | "1: llock %1, [%2] \n" \ | ||
25 | insn "\n" \ | ||
26 | "2: scond %0, [%2] \n" \ | ||
27 | " bnz 1b \n" \ | ||
28 | " mov %0, 0 \n" \ | ||
29 | "3: \n" \ | ||
30 | " .section .fixup,\"ax\" \n" \ | ||
31 | " .align 4 \n" \ | ||
32 | "4: mov %0, %4 \n" \ | ||
33 | " b 3b \n" \ | ||
34 | " .previous \n" \ | ||
35 | " .section __ex_table,\"a\" \n" \ | ||
36 | " .align 4 \n" \ | ||
37 | " .word 1b, 4b \n" \ | ||
38 | " .word 2b, 4b \n" \ | ||
39 | " .previous \n" \ | ||
40 | \ | ||
41 | : "=&r" (ret), "=&r" (oldval) \ | ||
42 | : "r" (uaddr), "r" (oparg), "ir" (-EFAULT) \ | ||
43 | : "cc", "memory") | ||
44 | |||
45 | #else /* !CONFIG_ARC_HAS_LLSC */ | ||
46 | |||
19 | #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg)\ | 47 | #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg)\ |
20 | \ | 48 | \ |
21 | __asm__ __volatile__( \ | 49 | __asm__ __volatile__( \ |
22 | "1: ld %1, [%2] \n" \ | 50 | "1: ld %1, [%2] \n" \ |
23 | insn "\n" \ | 51 | insn "\n" \ |
24 | "2: st %0, [%2] \n" \ | 52 | "2: st %0, [%2] \n" \ |
25 | " mov %0, 0 \n" \ | 53 | " mov %0, 0 \n" \ |
26 | "3: \n" \ | 54 | "3: \n" \ |
27 | " .section .fixup,\"ax\" \n" \ | 55 | " .section .fixup,\"ax\" \n" \ |
@@ -39,6 +67,8 @@ | |||
39 | : "r" (uaddr), "r" (oparg), "ir" (-EFAULT) \ | 67 | : "r" (uaddr), "r" (oparg), "ir" (-EFAULT) \ |
40 | : "cc", "memory") | 68 | : "cc", "memory") |
41 | 69 | ||
70 | #endif | ||
71 | |||
42 | static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr) | 72 | static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr) |
43 | { | 73 | { |
44 | int op = (encoded_op >> 28) & 7; | 74 | int op = (encoded_op >> 28) & 7; |
@@ -123,11 +153,17 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval, | |||
123 | 153 | ||
124 | pagefault_disable(); | 154 | pagefault_disable(); |
125 | 155 | ||
126 | /* TBD : can use llock/scond */ | ||
127 | __asm__ __volatile__( | 156 | __asm__ __volatile__( |
128 | "1: ld %0, [%3] \n" | 157 | #ifdef CONFIG_ARC_HAS_LLSC |
129 | " brne %0, %1, 3f \n" | 158 | "1: llock %0, [%3] \n" |
130 | "2: st %2, [%3] \n" | 159 | " brne %0, %1, 3f \n" |
160 | "2: scond %2, [%3] \n" | ||
161 | " bnz 1b \n" | ||
162 | #else | ||
163 | "1: ld %0, [%3] \n" | ||
164 | " brne %0, %1, 3f \n" | ||
165 | "2: st %2, [%3] \n" | ||
166 | #endif | ||
131 | "3: \n" | 167 | "3: \n" |
132 | " .section .fixup,\"ax\" \n" | 168 | " .section .fixup,\"ax\" \n" |
133 | "4: mov %0, %4 \n" | 169 | "4: mov %0, %4 \n" |
diff --git a/arch/arc/include/asm/mm-arch-hooks.h b/arch/arc/include/asm/mm-arch-hooks.h deleted file mode 100644 index c37541c5f8ba..000000000000 --- a/arch/arc/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_ARC_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_ARC_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_ARC_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h index 91755972b9a2..91694ec1ce95 100644 --- a/arch/arc/include/asm/ptrace.h +++ b/arch/arc/include/asm/ptrace.h | |||
@@ -106,7 +106,7 @@ struct callee_regs { | |||
106 | long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13; | 106 | long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13; |
107 | }; | 107 | }; |
108 | 108 | ||
109 | #define instruction_pointer(regs) ((regs)->ret) | 109 | #define instruction_pointer(regs) (unsigned long)((regs)->ret) |
110 | #define profile_pc(regs) instruction_pointer(regs) | 110 | #define profile_pc(regs) instruction_pointer(regs) |
111 | 111 | ||
112 | /* return 1 if user mode or 0 if kernel mode */ | 112 | /* return 1 if user mode or 0 if kernel mode */ |
diff --git a/arch/arc/kernel/intc-arcv2.c b/arch/arc/kernel/intc-arcv2.c index 6208c630abed..26c156827479 100644 --- a/arch/arc/kernel/intc-arcv2.c +++ b/arch/arc/kernel/intc-arcv2.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/of.h> | 12 | #include <linux/of.h> |
13 | #include <linux/irqdomain.h> | 13 | #include <linux/irqdomain.h> |
14 | #include <linux/irqchip.h> | 14 | #include <linux/irqchip.h> |
15 | #include "../../drivers/irqchip/irqchip.h" | ||
16 | #include <asm/irq.h> | 15 | #include <asm/irq.h> |
17 | 16 | ||
18 | /* | 17 | /* |
diff --git a/arch/arc/kernel/intc-compact.c b/arch/arc/kernel/intc-compact.c index fcdddb631766..039fac30b5c1 100644 --- a/arch/arc/kernel/intc-compact.c +++ b/arch/arc/kernel/intc-compact.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/of.h> | 12 | #include <linux/of.h> |
13 | #include <linux/irqdomain.h> | 13 | #include <linux/irqdomain.h> |
14 | #include <linux/irqchip.h> | 14 | #include <linux/irqchip.h> |
15 | #include "../../drivers/irqchip/irqchip.h" | ||
16 | #include <asm/irq.h> | 15 | #include <asm/irq.h> |
17 | 16 | ||
18 | /* | 17 | /* |
diff --git a/arch/arc/kernel/mcip.c b/arch/arc/kernel/mcip.c index 30284e8de6ff..2fb86589054d 100644 --- a/arch/arc/kernel/mcip.c +++ b/arch/arc/kernel/mcip.c | |||
@@ -175,7 +175,6 @@ void mcip_init_early_smp(void) | |||
175 | #include <linux/irqchip.h> | 175 | #include <linux/irqchip.h> |
176 | #include <linux/of.h> | 176 | #include <linux/of.h> |
177 | #include <linux/of_irq.h> | 177 | #include <linux/of_irq.h> |
178 | #include "../../drivers/irqchip/irqchip.h" | ||
179 | 178 | ||
180 | /* | 179 | /* |
181 | * Set the DEST for @cmn_irq to @cpu_mask (1 bit per core) | 180 | * Set the DEST for @cmn_irq to @cpu_mask (1 bit per core) |
@@ -218,11 +217,28 @@ static void idu_irq_unmask(struct irq_data *data) | |||
218 | raw_spin_unlock_irqrestore(&mcip_lock, flags); | 217 | raw_spin_unlock_irqrestore(&mcip_lock, flags); |
219 | } | 218 | } |
220 | 219 | ||
220 | #ifdef CONFIG_SMP | ||
221 | static int | 221 | static int |
222 | idu_irq_set_affinity(struct irq_data *d, const struct cpumask *cpumask, bool f) | 222 | idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask, |
223 | bool force) | ||
223 | { | 224 | { |
225 | unsigned long flags; | ||
226 | cpumask_t online; | ||
227 | |||
228 | /* errout if no online cpu per @cpumask */ | ||
229 | if (!cpumask_and(&online, cpumask, cpu_online_mask)) | ||
230 | return -EINVAL; | ||
231 | |||
232 | raw_spin_lock_irqsave(&mcip_lock, flags); | ||
233 | |||
234 | idu_set_dest(data->hwirq, cpumask_bits(&online)[0]); | ||
235 | idu_set_mode(data->hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_RR); | ||
236 | |||
237 | raw_spin_unlock_irqrestore(&mcip_lock, flags); | ||
238 | |||
224 | return IRQ_SET_MASK_OK; | 239 | return IRQ_SET_MASK_OK; |
225 | } | 240 | } |
241 | #endif | ||
226 | 242 | ||
227 | static struct irq_chip idu_irq_chip = { | 243 | static struct irq_chip idu_irq_chip = { |
228 | .name = "MCIP IDU Intc", | 244 | .name = "MCIP IDU Intc", |
@@ -330,8 +346,7 @@ idu_of_init(struct device_node *intc, struct device_node *parent) | |||
330 | if (!i) | 346 | if (!i) |
331 | idu_first_irq = irq; | 347 | idu_first_irq = irq; |
332 | 348 | ||
333 | irq_set_handler_data(irq, domain); | 349 | irq_set_chained_handler_and_data(irq, idu_cascade_isr, domain); |
334 | irq_set_chained_handler(irq, idu_cascade_isr); | ||
335 | } | 350 | } |
336 | 351 | ||
337 | __mcip_cmd(CMD_IDU_ENABLE, 0); | 352 | __mcip_cmd(CMD_IDU_ENABLE, 0); |
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c index a3d186211ed3..18cc01591c96 100644 --- a/arch/arc/kernel/setup.c +++ b/arch/arc/kernel/setup.c | |||
@@ -142,17 +142,22 @@ static void read_arc_build_cfg_regs(void) | |||
142 | } | 142 | } |
143 | 143 | ||
144 | static const struct cpuinfo_data arc_cpu_tbl[] = { | 144 | static const struct cpuinfo_data arc_cpu_tbl[] = { |
145 | #ifdef CONFIG_ISA_ARCOMPACT | ||
145 | { {0x20, "ARC 600" }, 0x2F}, | 146 | { {0x20, "ARC 600" }, 0x2F}, |
146 | { {0x30, "ARC 700" }, 0x33}, | 147 | { {0x30, "ARC 700" }, 0x33}, |
147 | { {0x34, "ARC 700 R4.10"}, 0x34}, | 148 | { {0x34, "ARC 700 R4.10"}, 0x34}, |
148 | { {0x35, "ARC 700 R4.11"}, 0x35}, | 149 | { {0x35, "ARC 700 R4.11"}, 0x35}, |
149 | { {0x50, "ARC HS38" }, 0x51}, | 150 | #else |
151 | { {0x50, "ARC HS38 R2.0"}, 0x51}, | ||
152 | { {0x52, "ARC HS38 R2.1"}, 0x52}, | ||
153 | #endif | ||
150 | { {0x00, NULL } } | 154 | { {0x00, NULL } } |
151 | }; | 155 | }; |
152 | 156 | ||
153 | #define IS_AVAIL1(v, str) ((v) ? str : "") | 157 | #define IS_AVAIL1(v, s) ((v) ? s : "") |
154 | #define IS_USED(cfg) (IS_ENABLED(cfg) ? "" : "(not used) ") | 158 | #define IS_USED_RUN(v) ((v) ? "" : "(not used) ") |
155 | #define IS_AVAIL2(v, str, cfg) IS_AVAIL1(v, str), IS_AVAIL1(v, IS_USED(cfg)) | 159 | #define IS_USED_CFG(cfg) IS_USED_RUN(IS_ENABLED(cfg)) |
160 | #define IS_AVAIL2(v, s, cfg) IS_AVAIL1(v, s), IS_AVAIL1(v, IS_USED_CFG(cfg)) | ||
156 | 161 | ||
157 | static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len) | 162 | static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len) |
158 | { | 163 | { |
@@ -226,7 +231,7 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len) | |||
226 | n += scnprintf(buf + n, len - n, "mpy[opt %d] ", opt); | 231 | n += scnprintf(buf + n, len - n, "mpy[opt %d] ", opt); |
227 | } | 232 | } |
228 | n += scnprintf(buf + n, len - n, "%s", | 233 | n += scnprintf(buf + n, len - n, "%s", |
229 | IS_USED(CONFIG_ARC_HAS_HW_MPY)); | 234 | IS_USED_CFG(CONFIG_ARC_HAS_HW_MPY)); |
230 | } | 235 | } |
231 | 236 | ||
232 | n += scnprintf(buf + n, len - n, "%s%s%s%s%s%s%s%s\n", | 237 | n += scnprintf(buf + n, len - n, "%s%s%s%s%s%s%s%s\n", |
diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c index 807f7d61d7a7..a6f91e88ce36 100644 --- a/arch/arc/kernel/troubleshoot.c +++ b/arch/arc/kernel/troubleshoot.c | |||
@@ -58,7 +58,6 @@ static void show_callee_regs(struct callee_regs *cregs) | |||
58 | 58 | ||
59 | static void print_task_path_n_nm(struct task_struct *tsk, char *buf) | 59 | static void print_task_path_n_nm(struct task_struct *tsk, char *buf) |
60 | { | 60 | { |
61 | struct path path; | ||
62 | char *path_nm = NULL; | 61 | char *path_nm = NULL; |
63 | struct mm_struct *mm; | 62 | struct mm_struct *mm; |
64 | struct file *exe_file; | 63 | struct file *exe_file; |
diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c index b29d62ed4f7e..1cd6695b6ab5 100644 --- a/arch/arc/mm/cache.c +++ b/arch/arc/mm/cache.c | |||
@@ -468,10 +468,18 @@ static void __ic_line_inv_vaddr(unsigned long paddr, unsigned long vaddr, | |||
468 | noinline void slc_op(unsigned long paddr, unsigned long sz, const int op) | 468 | noinline void slc_op(unsigned long paddr, unsigned long sz, const int op) |
469 | { | 469 | { |
470 | #ifdef CONFIG_ISA_ARCV2 | 470 | #ifdef CONFIG_ISA_ARCV2 |
471 | /* | ||
472 | * SLC is shared between all cores and concurrent aux operations from | ||
473 | * multiple cores need to be serialized using a spinlock | ||
474 | * A concurrent operation can be silently ignored and/or the old/new | ||
475 | * operation can remain incomplete forever (lockup in SLC_CTRL_BUSY loop | ||
476 | * below) | ||
477 | */ | ||
478 | static DEFINE_SPINLOCK(lock); | ||
471 | unsigned long flags; | 479 | unsigned long flags; |
472 | unsigned int ctrl; | 480 | unsigned int ctrl; |
473 | 481 | ||
474 | local_irq_save(flags); | 482 | spin_lock_irqsave(&lock, flags); |
475 | 483 | ||
476 | /* | 484 | /* |
477 | * The Region Flush operation is specified by CTRL.RGN_OP[11..9] | 485 | * The Region Flush operation is specified by CTRL.RGN_OP[11..9] |
@@ -504,7 +512,7 @@ noinline void slc_op(unsigned long paddr, unsigned long sz, const int op) | |||
504 | 512 | ||
505 | while (read_aux_reg(ARC_REG_SLC_CTRL) & SLC_CTRL_BUSY); | 513 | while (read_aux_reg(ARC_REG_SLC_CTRL) & SLC_CTRL_BUSY); |
506 | 514 | ||
507 | local_irq_restore(flags); | 515 | spin_unlock_irqrestore(&lock, flags); |
508 | #endif | 516 | #endif |
509 | } | 517 | } |
510 | 518 | ||
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c index 74a637a1cfc4..57706a9c6948 100644 --- a/arch/arc/mm/dma.c +++ b/arch/arc/mm/dma.c | |||
@@ -60,8 +60,8 @@ void *dma_alloc_coherent(struct device *dev, size_t size, | |||
60 | 60 | ||
61 | /* This is kernel Virtual address (0x7000_0000 based) */ | 61 | /* This is kernel Virtual address (0x7000_0000 based) */ |
62 | kvaddr = ioremap_nocache((unsigned long)paddr, size); | 62 | kvaddr = ioremap_nocache((unsigned long)paddr, size); |
63 | if (kvaddr != NULL) | 63 | if (kvaddr == NULL) |
64 | memset(kvaddr, 0, size); | 64 | return NULL; |
65 | 65 | ||
66 | /* This is bus address, platform dependent */ | 66 | /* This is bus address, platform dependent */ |
67 | *dma_handle = (dma_addr_t)paddr; | 67 | *dma_handle = (dma_addr_t)paddr; |
diff --git a/arch/arm/boot/dts/am335x-boneblack.dts b/arch/arm/boot/dts/am335x-boneblack.dts index 901739fcb85a..5c42d259fa68 100644 --- a/arch/arm/boot/dts/am335x-boneblack.dts +++ b/arch/arm/boot/dts/am335x-boneblack.dts | |||
@@ -80,3 +80,7 @@ | |||
80 | status = "okay"; | 80 | status = "okay"; |
81 | }; | 81 | }; |
82 | }; | 82 | }; |
83 | |||
84 | &rtc { | ||
85 | system-power-controller; | ||
86 | }; | ||
diff --git a/arch/arm/boot/dts/am335x-pepper.dts b/arch/arm/boot/dts/am335x-pepper.dts index 0d35ab64641c..7106114c7464 100644 --- a/arch/arm/boot/dts/am335x-pepper.dts +++ b/arch/arm/boot/dts/am335x-pepper.dts | |||
@@ -74,6 +74,7 @@ | |||
74 | audio_codec: tlv320aic3106@1b { | 74 | audio_codec: tlv320aic3106@1b { |
75 | compatible = "ti,tlv320aic3106"; | 75 | compatible = "ti,tlv320aic3106"; |
76 | reg = <0x1b>; | 76 | reg = <0x1b>; |
77 | ai3x-micbias-vg = <0x2>; | ||
77 | }; | 78 | }; |
78 | 79 | ||
79 | accel: lis331dlh@1d { | 80 | accel: lis331dlh@1d { |
@@ -153,7 +154,7 @@ | |||
153 | ti,audio-routing = | 154 | ti,audio-routing = |
154 | "Headphone Jack", "HPLOUT", | 155 | "Headphone Jack", "HPLOUT", |
155 | "Headphone Jack", "HPROUT", | 156 | "Headphone Jack", "HPROUT", |
156 | "LINE1L", "Line In"; | 157 | "MIC3L", "Mic3L Switch"; |
157 | }; | 158 | }; |
158 | 159 | ||
159 | &mcasp0 { | 160 | &mcasp0 { |
@@ -438,41 +439,50 @@ | |||
438 | regulators { | 439 | regulators { |
439 | dcdc1_reg: regulator@0 { | 440 | dcdc1_reg: regulator@0 { |
440 | /* VDD_1V8 system supply */ | 441 | /* VDD_1V8 system supply */ |
442 | regulator-always-on; | ||
441 | }; | 443 | }; |
442 | 444 | ||
443 | dcdc2_reg: regulator@1 { | 445 | dcdc2_reg: regulator@1 { |
444 | /* VDD_CORE voltage limits 0.95V - 1.26V with +/-4% tolerance */ | 446 | /* VDD_CORE voltage limits 0.95V - 1.26V with +/-4% tolerance */ |
445 | regulator-name = "vdd_core"; | 447 | regulator-name = "vdd_core"; |
446 | regulator-min-microvolt = <925000>; | 448 | regulator-min-microvolt = <925000>; |
447 | regulator-max-microvolt = <1325000>; | 449 | regulator-max-microvolt = <1150000>; |
448 | regulator-boot-on; | 450 | regulator-boot-on; |
451 | regulator-always-on; | ||
449 | }; | 452 | }; |
450 | 453 | ||
451 | dcdc3_reg: regulator@2 { | 454 | dcdc3_reg: regulator@2 { |
452 | /* VDD_MPU voltage limits 0.95V - 1.1V with +/-4% tolerance */ | 455 | /* VDD_MPU voltage limits 0.95V - 1.1V with +/-4% tolerance */ |
453 | regulator-name = "vdd_mpu"; | 456 | regulator-name = "vdd_mpu"; |
454 | regulator-min-microvolt = <925000>; | 457 | regulator-min-microvolt = <925000>; |
455 | regulator-max-microvolt = <1150000>; | 458 | regulator-max-microvolt = <1325000>; |
456 | regulator-boot-on; | 459 | regulator-boot-on; |
460 | regulator-always-on; | ||
457 | }; | 461 | }; |
458 | 462 | ||
459 | ldo1_reg: regulator@3 { | 463 | ldo1_reg: regulator@3 { |
460 | /* VRTC 1.8V always-on supply */ | 464 | /* VRTC 1.8V always-on supply */ |
465 | regulator-name = "vrtc,vdds"; | ||
461 | regulator-always-on; | 466 | regulator-always-on; |
462 | }; | 467 | }; |
463 | 468 | ||
464 | ldo2_reg: regulator@4 { | 469 | ldo2_reg: regulator@4 { |
465 | /* 3.3V rail */ | 470 | /* 3.3V rail */ |
471 | regulator-name = "vdd_3v3aux"; | ||
472 | regulator-always-on; | ||
466 | }; | 473 | }; |
467 | 474 | ||
468 | ldo3_reg: regulator@5 { | 475 | ldo3_reg: regulator@5 { |
469 | /* VDD_3V3A 3.3V rail */ | 476 | /* VDD_3V3A 3.3V rail */ |
477 | regulator-name = "vdd_3v3a"; | ||
470 | regulator-min-microvolt = <3300000>; | 478 | regulator-min-microvolt = <3300000>; |
471 | regulator-max-microvolt = <3300000>; | 479 | regulator-max-microvolt = <3300000>; |
472 | }; | 480 | }; |
473 | 481 | ||
474 | ldo4_reg: regulator@6 { | 482 | ldo4_reg: regulator@6 { |
475 | /* VDD_3V3B 3.3V rail */ | 483 | /* VDD_3V3B 3.3V rail */ |
484 | regulator-name = "vdd_3v3b"; | ||
485 | regulator-always-on; | ||
476 | }; | 486 | }; |
477 | }; | 487 | }; |
478 | }; | 488 | }; |
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi index c80a3e233792..ade28c790f4b 100644 --- a/arch/arm/boot/dts/am4372.dtsi +++ b/arch/arm/boot/dts/am4372.dtsi | |||
@@ -132,6 +132,12 @@ | |||
132 | }; | 132 | }; |
133 | }; | 133 | }; |
134 | 134 | ||
135 | emif: emif@4c000000 { | ||
136 | compatible = "ti,emif-am4372"; | ||
137 | reg = <0x4c000000 0x1000000>; | ||
138 | ti,hwmods = "emif"; | ||
139 | }; | ||
140 | |||
135 | edma: edma@49000000 { | 141 | edma: edma@49000000 { |
136 | compatible = "ti,edma3"; | 142 | compatible = "ti,edma3"; |
137 | ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; | 143 | ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; |
@@ -941,6 +947,7 @@ | |||
941 | ti,hwmods = "dss_rfbi"; | 947 | ti,hwmods = "dss_rfbi"; |
942 | clocks = <&disp_clk>; | 948 | clocks = <&disp_clk>; |
943 | clock-names = "fck"; | 949 | clock-names = "fck"; |
950 | status = "disabled"; | ||
944 | }; | 951 | }; |
945 | }; | 952 | }; |
946 | 953 | ||
diff --git a/arch/arm/boot/dts/am57xx-beagle-x15.dts b/arch/arm/boot/dts/am57xx-beagle-x15.dts index a42cc377a862..a63bf78191ea 100644 --- a/arch/arm/boot/dts/am57xx-beagle-x15.dts +++ b/arch/arm/boot/dts/am57xx-beagle-x15.dts | |||
@@ -605,6 +605,10 @@ | |||
605 | phy-supply = <&ldousb_reg>; | 605 | phy-supply = <&ldousb_reg>; |
606 | }; | 606 | }; |
607 | 607 | ||
608 | &usb2_phy2 { | ||
609 | phy-supply = <&ldousb_reg>; | ||
610 | }; | ||
611 | |||
608 | &usb1 { | 612 | &usb1 { |
609 | dr_mode = "host"; | 613 | dr_mode = "host"; |
610 | pinctrl-names = "default"; | 614 | pinctrl-names = "default"; |
diff --git a/arch/arm/boot/dts/atlas7.dtsi b/arch/arm/boot/dts/atlas7.dtsi index 5dfd3a44bf82..3e21311f9514 100644 --- a/arch/arm/boot/dts/atlas7.dtsi +++ b/arch/arm/boot/dts/atlas7.dtsi | |||
@@ -135,6 +135,1025 @@ | |||
135 | compatible = "sirf,atlas7-ioc"; | 135 | compatible = "sirf,atlas7-ioc"; |
136 | reg = <0x18880000 0x1000>, | 136 | reg = <0x18880000 0x1000>, |
137 | <0x10E40000 0x1000>; | 137 | <0x10E40000 0x1000>; |
138 | |||
139 | audio_ac97_pmx: audio_ac97@0 { | ||
140 | audio_ac97 { | ||
141 | groups = "audio_ac97_grp"; | ||
142 | function = "audio_ac97"; | ||
143 | }; | ||
144 | }; | ||
145 | |||
146 | audio_func_dbg_pmx: audio_func_dbg@0 { | ||
147 | audio_func_dbg { | ||
148 | groups = "audio_func_dbg_grp"; | ||
149 | function = "audio_func_dbg"; | ||
150 | }; | ||
151 | }; | ||
152 | |||
153 | audio_i2s_pmx: audio_i2s@0 { | ||
154 | audio_i2s { | ||
155 | groups = "audio_i2s_grp"; | ||
156 | function = "audio_i2s"; | ||
157 | }; | ||
158 | }; | ||
159 | |||
160 | audio_i2s_2ch_pmx: audio_i2s_2ch@0 { | ||
161 | audio_i2s_2ch { | ||
162 | groups = "audio_i2s_2ch_grp"; | ||
163 | function = "audio_i2s_2ch"; | ||
164 | }; | ||
165 | }; | ||
166 | |||
167 | audio_i2s_extclk_pmx: audio_i2s_extclk@0 { | ||
168 | audio_i2s_extclk { | ||
169 | groups = "audio_i2s_extclk_grp"; | ||
170 | function = "audio_i2s_extclk"; | ||
171 | }; | ||
172 | }; | ||
173 | |||
174 | audio_uart0_pmx: audio_uart0@0 { | ||
175 | audio_uart0 { | ||
176 | groups = "audio_uart0_grp"; | ||
177 | function = "audio_uart0"; | ||
178 | }; | ||
179 | }; | ||
180 | |||
181 | audio_uart1_pmx: audio_uart1@0 { | ||
182 | audio_uart1 { | ||
183 | groups = "audio_uart1_grp"; | ||
184 | function = "audio_uart1"; | ||
185 | }; | ||
186 | }; | ||
187 | |||
188 | audio_uart2_pmx0: audio_uart2@0 { | ||
189 | audio_uart2_0 { | ||
190 | groups = "audio_uart2_grp0"; | ||
191 | function = "audio_uart2_m0"; | ||
192 | }; | ||
193 | }; | ||
194 | |||
195 | audio_uart2_pmx1: audio_uart2@1 { | ||
196 | audio_uart2_1 { | ||
197 | groups = "audio_uart2_grp1"; | ||
198 | function = "audio_uart2_m1"; | ||
199 | }; | ||
200 | }; | ||
201 | |||
202 | c_can_trnsvr_pmx: c_can_trnsvr@0 { | ||
203 | c_can_trnsvr { | ||
204 | groups = "c_can_trnsvr_grp"; | ||
205 | function = "c_can_trnsvr"; | ||
206 | }; | ||
207 | }; | ||
208 | |||
209 | c0_can_pmx0: c0_can@0 { | ||
210 | c0_can_0 { | ||
211 | groups = "c0_can_grp0"; | ||
212 | function = "c0_can_m0"; | ||
213 | }; | ||
214 | }; | ||
215 | |||
216 | c0_can_pmx1: c0_can@1 { | ||
217 | c0_can_1 { | ||
218 | groups = "c0_can_grp1"; | ||
219 | function = "c0_can_m1"; | ||
220 | }; | ||
221 | }; | ||
222 | |||
223 | c1_can_pmx0: c1_can@0 { | ||
224 | c1_can_0 { | ||
225 | groups = "c1_can_grp0"; | ||
226 | function = "c1_can_m0"; | ||
227 | }; | ||
228 | }; | ||
229 | |||
230 | c1_can_pmx1: c1_can@1 { | ||
231 | c1_can_1 { | ||
232 | groups = "c1_can_grp1"; | ||
233 | function = "c1_can_m1"; | ||
234 | }; | ||
235 | }; | ||
236 | |||
237 | c1_can_pmx2: c1_can@2 { | ||
238 | c1_can_2 { | ||
239 | groups = "c1_can_grp2"; | ||
240 | function = "c1_can_m2"; | ||
241 | }; | ||
242 | }; | ||
243 | |||
244 | ca_audio_lpc_pmx: ca_audio_lpc@0 { | ||
245 | ca_audio_lpc { | ||
246 | groups = "ca_audio_lpc_grp"; | ||
247 | function = "ca_audio_lpc"; | ||
248 | }; | ||
249 | }; | ||
250 | |||
251 | ca_bt_lpc_pmx: ca_bt_lpc@0 { | ||
252 | ca_bt_lpc { | ||
253 | groups = "ca_bt_lpc_grp"; | ||
254 | function = "ca_bt_lpc"; | ||
255 | }; | ||
256 | }; | ||
257 | |||
258 | ca_coex_pmx: ca_coex@0 { | ||
259 | ca_coex { | ||
260 | groups = "ca_coex_grp"; | ||
261 | function = "ca_coex"; | ||
262 | }; | ||
263 | }; | ||
264 | |||
265 | ca_curator_lpc_pmx: ca_curator_lpc@0 { | ||
266 | ca_curator_lpc { | ||
267 | groups = "ca_curator_lpc_grp"; | ||
268 | function = "ca_curator_lpc"; | ||
269 | }; | ||
270 | }; | ||
271 | |||
272 | ca_pcm_debug_pmx: ca_pcm_debug@0 { | ||
273 | ca_pcm_debug { | ||
274 | groups = "ca_pcm_debug_grp"; | ||
275 | function = "ca_pcm_debug"; | ||
276 | }; | ||
277 | }; | ||
278 | |||
279 | ca_pio_pmx: ca_pio@0 { | ||
280 | ca_pio { | ||
281 | groups = "ca_pio_grp"; | ||
282 | function = "ca_pio"; | ||
283 | }; | ||
284 | }; | ||
285 | |||
286 | ca_sdio_debug_pmx: ca_sdio_debug@0 { | ||
287 | ca_sdio_debug { | ||
288 | groups = "ca_sdio_debug_grp"; | ||
289 | function = "ca_sdio_debug"; | ||
290 | }; | ||
291 | }; | ||
292 | |||
293 | ca_spi_pmx: ca_spi@0 { | ||
294 | ca_spi { | ||
295 | groups = "ca_spi_grp"; | ||
296 | function = "ca_spi"; | ||
297 | }; | ||
298 | }; | ||
299 | |||
300 | ca_trb_pmx: ca_trb@0 { | ||
301 | ca_trb { | ||
302 | groups = "ca_trb_grp"; | ||
303 | function = "ca_trb"; | ||
304 | }; | ||
305 | }; | ||
306 | |||
307 | ca_uart_debug_pmx: ca_uart_debug@0 { | ||
308 | ca_uart_debug { | ||
309 | groups = "ca_uart_debug_grp"; | ||
310 | function = "ca_uart_debug"; | ||
311 | }; | ||
312 | }; | ||
313 | |||
314 | clkc_pmx0: clkc@0 { | ||
315 | clkc_0 { | ||
316 | groups = "clkc_grp0"; | ||
317 | function = "clkc_m0"; | ||
318 | }; | ||
319 | }; | ||
320 | |||
321 | clkc_pmx1: clkc@1 { | ||
322 | clkc_1 { | ||
323 | groups = "clkc_grp1"; | ||
324 | function = "clkc_m1"; | ||
325 | }; | ||
326 | }; | ||
327 | |||
328 | gn_gnss_i2c_pmx: gn_gnss_i2c@0 { | ||
329 | gn_gnss_i2c { | ||
330 | groups = "gn_gnss_i2c_grp"; | ||
331 | function = "gn_gnss_i2c"; | ||
332 | }; | ||
333 | }; | ||
334 | |||
335 | gn_gnss_uart_nopause_pmx: gn_gnss_uart_nopause@0 { | ||
336 | gn_gnss_uart_nopause { | ||
337 | groups = "gn_gnss_uart_nopause_grp"; | ||
338 | function = "gn_gnss_uart_nopause"; | ||
339 | }; | ||
340 | }; | ||
341 | |||
342 | gn_gnss_uart_pmx: gn_gnss_uart@0 { | ||
343 | gn_gnss_uart { | ||
344 | groups = "gn_gnss_uart_grp"; | ||
345 | function = "gn_gnss_uart"; | ||
346 | }; | ||
347 | }; | ||
348 | |||
349 | gn_trg_spi_pmx0: gn_trg_spi@0 { | ||
350 | gn_trg_spi_0 { | ||
351 | groups = "gn_trg_spi_grp0"; | ||
352 | function = "gn_trg_spi_m0"; | ||
353 | }; | ||
354 | }; | ||
355 | |||
356 | gn_trg_spi_pmx1: gn_trg_spi@1 { | ||
357 | gn_trg_spi_1 { | ||
358 | groups = "gn_trg_spi_grp1"; | ||
359 | function = "gn_trg_spi_m1"; | ||
360 | }; | ||
361 | }; | ||
362 | |||
363 | cvbs_dbg_pmx: cvbs_dbg@0 { | ||
364 | cvbs_dbg { | ||
365 | groups = "cvbs_dbg_grp"; | ||
366 | function = "cvbs_dbg"; | ||
367 | }; | ||
368 | }; | ||
369 | |||
370 | cvbs_dbg_test_pmx0: cvbs_dbg_test@0 { | ||
371 | cvbs_dbg_test_0 { | ||
372 | groups = "cvbs_dbg_test_grp0"; | ||
373 | function = "cvbs_dbg_test_m0"; | ||
374 | }; | ||
375 | }; | ||
376 | |||
377 | cvbs_dbg_test_pmx1: cvbs_dbg_test@1 { | ||
378 | cvbs_dbg_test_1 { | ||
379 | groups = "cvbs_dbg_test_grp1"; | ||
380 | function = "cvbs_dbg_test_m1"; | ||
381 | }; | ||
382 | }; | ||
383 | |||
384 | cvbs_dbg_test_pmx2: cvbs_dbg_test@2 { | ||
385 | cvbs_dbg_test_2 { | ||
386 | groups = "cvbs_dbg_test_grp2"; | ||
387 | function = "cvbs_dbg_test_m2"; | ||
388 | }; | ||
389 | }; | ||
390 | |||
391 | cvbs_dbg_test_pmx3: cvbs_dbg_test@3 { | ||
392 | cvbs_dbg_test_3 { | ||
393 | groups = "cvbs_dbg_test_grp3"; | ||
394 | function = "cvbs_dbg_test_m3"; | ||
395 | }; | ||
396 | }; | ||
397 | |||
398 | cvbs_dbg_test_pmx4: cvbs_dbg_test@4 { | ||
399 | cvbs_dbg_test_4 { | ||
400 | groups = "cvbs_dbg_test_grp4"; | ||
401 | function = "cvbs_dbg_test_m4"; | ||
402 | }; | ||
403 | }; | ||
404 | |||
405 | cvbs_dbg_test_pmx5: cvbs_dbg_test@5 { | ||
406 | cvbs_dbg_test_5 { | ||
407 | groups = "cvbs_dbg_test_grp5"; | ||
408 | function = "cvbs_dbg_test_m5"; | ||
409 | }; | ||
410 | }; | ||
411 | |||
412 | cvbs_dbg_test_pmx6: cvbs_dbg_test@6 { | ||
413 | cvbs_dbg_test_6 { | ||
414 | groups = "cvbs_dbg_test_grp6"; | ||
415 | function = "cvbs_dbg_test_m6"; | ||
416 | }; | ||
417 | }; | ||
418 | |||
419 | cvbs_dbg_test_pmx7: cvbs_dbg_test@7 { | ||
420 | cvbs_dbg_test_7 { | ||
421 | groups = "cvbs_dbg_test_grp7"; | ||
422 | function = "cvbs_dbg_test_m7"; | ||
423 | }; | ||
424 | }; | ||
425 | |||
426 | cvbs_dbg_test_pmx8: cvbs_dbg_test@8 { | ||
427 | cvbs_dbg_test_8 { | ||
428 | groups = "cvbs_dbg_test_grp8"; | ||
429 | function = "cvbs_dbg_test_m8"; | ||
430 | }; | ||
431 | }; | ||
432 | |||
433 | cvbs_dbg_test_pmx9: cvbs_dbg_test@9 { | ||
434 | cvbs_dbg_test_9 { | ||
435 | groups = "cvbs_dbg_test_grp9"; | ||
436 | function = "cvbs_dbg_test_m9"; | ||
437 | }; | ||
438 | }; | ||
439 | |||
440 | cvbs_dbg_test_pmx10: cvbs_dbg_test@10 { | ||
441 | cvbs_dbg_test_10 { | ||
442 | groups = "cvbs_dbg_test_grp10"; | ||
443 | function = "cvbs_dbg_test_m10"; | ||
444 | }; | ||
445 | }; | ||
446 | |||
447 | cvbs_dbg_test_pmx11: cvbs_dbg_test@11 { | ||
448 | cvbs_dbg_test_11 { | ||
449 | groups = "cvbs_dbg_test_grp11"; | ||
450 | function = "cvbs_dbg_test_m11"; | ||
451 | }; | ||
452 | }; | ||
453 | |||
454 | cvbs_dbg_test_pmx12: cvbs_dbg_test@12 { | ||
455 | cvbs_dbg_test_12 { | ||
456 | groups = "cvbs_dbg_test_grp12"; | ||
457 | function = "cvbs_dbg_test_m12"; | ||
458 | }; | ||
459 | }; | ||
460 | |||
461 | cvbs_dbg_test_pmx13: cvbs_dbg_test@13 { | ||
462 | cvbs_dbg_test_13 { | ||
463 | groups = "cvbs_dbg_test_grp13"; | ||
464 | function = "cvbs_dbg_test_m13"; | ||
465 | }; | ||
466 | }; | ||
467 | |||
468 | cvbs_dbg_test_pmx14: cvbs_dbg_test@14 { | ||
469 | cvbs_dbg_test_14 { | ||
470 | groups = "cvbs_dbg_test_grp14"; | ||
471 | function = "cvbs_dbg_test_m14"; | ||
472 | }; | ||
473 | }; | ||
474 | |||
475 | cvbs_dbg_test_pmx15: cvbs_dbg_test@15 { | ||
476 | cvbs_dbg_test_15 { | ||
477 | groups = "cvbs_dbg_test_grp15"; | ||
478 | function = "cvbs_dbg_test_m15"; | ||
479 | }; | ||
480 | }; | ||
481 | |||
482 | gn_gnss_power_pmx: gn_gnss_power@0 { | ||
483 | gn_gnss_power { | ||
484 | groups = "gn_gnss_power_grp"; | ||
485 | function = "gn_gnss_power"; | ||
486 | }; | ||
487 | }; | ||
488 | |||
489 | gn_gnss_sw_status_pmx: gn_gnss_sw_status@0 { | ||
490 | gn_gnss_sw_status { | ||
491 | groups = "gn_gnss_sw_status_grp"; | ||
492 | function = "gn_gnss_sw_status"; | ||
493 | }; | ||
494 | }; | ||
495 | |||
496 | gn_gnss_eclk_pmx: gn_gnss_eclk@0 { | ||
497 | gn_gnss_eclk { | ||
498 | groups = "gn_gnss_eclk_grp"; | ||
499 | function = "gn_gnss_eclk"; | ||
500 | }; | ||
501 | }; | ||
502 | |||
503 | gn_gnss_irq1_pmx0: gn_gnss_irq1@0 { | ||
504 | gn_gnss_irq1_0 { | ||
505 | groups = "gn_gnss_irq1_grp0"; | ||
506 | function = "gn_gnss_irq1_m0"; | ||
507 | }; | ||
508 | }; | ||
509 | |||
510 | gn_gnss_irq2_pmx0: gn_gnss_irq2@0 { | ||
511 | gn_gnss_irq2_0 { | ||
512 | groups = "gn_gnss_irq2_grp0"; | ||
513 | function = "gn_gnss_irq2_m0"; | ||
514 | }; | ||
515 | }; | ||
516 | |||
517 | gn_gnss_tm_pmx: gn_gnss_tm@0 { | ||
518 | gn_gnss_tm { | ||
519 | groups = "gn_gnss_tm_grp"; | ||
520 | function = "gn_gnss_tm"; | ||
521 | }; | ||
522 | }; | ||
523 | |||
524 | gn_gnss_tsync_pmx: gn_gnss_tsync@0 { | ||
525 | gn_gnss_tsync { | ||
526 | groups = "gn_gnss_tsync_grp"; | ||
527 | function = "gn_gnss_tsync"; | ||
528 | }; | ||
529 | }; | ||
530 | |||
531 | gn_io_gnsssys_sw_cfg_pmx: gn_io_gnsssys_sw_cfg@0 { | ||
532 | gn_io_gnsssys_sw_cfg { | ||
533 | groups = "gn_io_gnsssys_sw_cfg_grp"; | ||
534 | function = "gn_io_gnsssys_sw_cfg"; | ||
535 | }; | ||
536 | }; | ||
537 | |||
538 | gn_trg_pmx0: gn_trg@0 { | ||
539 | gn_trg_0 { | ||
540 | groups = "gn_trg_grp0"; | ||
541 | function = "gn_trg_m0"; | ||
542 | }; | ||
543 | }; | ||
544 | |||
545 | gn_trg_pmx1: gn_trg@1 { | ||
546 | gn_trg_1 { | ||
547 | groups = "gn_trg_grp1"; | ||
548 | function = "gn_trg_m1"; | ||
549 | }; | ||
550 | }; | ||
551 | |||
552 | gn_trg_shutdown_pmx0: gn_trg_shutdown@0 { | ||
553 | gn_trg_shutdown_0 { | ||
554 | groups = "gn_trg_shutdown_grp0"; | ||
555 | function = "gn_trg_shutdown_m0"; | ||
556 | }; | ||
557 | }; | ||
558 | |||
559 | gn_trg_shutdown_pmx1: gn_trg_shutdown@1 { | ||
560 | gn_trg_shutdown_1 { | ||
561 | groups = "gn_trg_shutdown_grp1"; | ||
562 | function = "gn_trg_shutdown_m1"; | ||
563 | }; | ||
564 | }; | ||
565 | |||
566 | gn_trg_shutdown_pmx2: gn_trg_shutdown@2 { | ||
567 | gn_trg_shutdown_2 { | ||
568 | groups = "gn_trg_shutdown_grp2"; | ||
569 | function = "gn_trg_shutdown_m2"; | ||
570 | }; | ||
571 | }; | ||
572 | |||
573 | gn_trg_shutdown_pmx3: gn_trg_shutdown@3 { | ||
574 | gn_trg_shutdown_3 { | ||
575 | groups = "gn_trg_shutdown_grp3"; | ||
576 | function = "gn_trg_shutdown_m3"; | ||
577 | }; | ||
578 | }; | ||
579 | |||
580 | i2c0_pmx: i2c0@0 { | ||
581 | i2c0 { | ||
582 | groups = "i2c0_grp"; | ||
583 | function = "i2c0"; | ||
584 | }; | ||
585 | }; | ||
586 | |||
587 | i2c1_pmx: i2c1@0 { | ||
588 | i2c1 { | ||
589 | groups = "i2c1_grp"; | ||
590 | function = "i2c1"; | ||
591 | }; | ||
592 | }; | ||
593 | |||
594 | jtag_pmx0: jtag@0 { | ||
595 | jtag_0 { | ||
596 | groups = "jtag_grp0"; | ||
597 | function = "jtag_m0"; | ||
598 | }; | ||
599 | }; | ||
600 | |||
601 | ks_kas_spi_pmx0: ks_kas_spi@0 { | ||
602 | ks_kas_spi_0 { | ||
603 | groups = "ks_kas_spi_grp0"; | ||
604 | function = "ks_kas_spi_m0"; | ||
605 | }; | ||
606 | }; | ||
607 | |||
608 | ld_ldd_pmx: ld_ldd@0 { | ||
609 | ld_ldd { | ||
610 | groups = "ld_ldd_grp"; | ||
611 | function = "ld_ldd"; | ||
612 | }; | ||
613 | }; | ||
614 | |||
615 | ld_ldd_16bit_pmx: ld_ldd_16bit@0 { | ||
616 | ld_ldd_16bit { | ||
617 | groups = "ld_ldd_16bit_grp"; | ||
618 | function = "ld_ldd_16bit"; | ||
619 | }; | ||
620 | }; | ||
621 | |||
622 | ld_ldd_fck_pmx: ld_ldd_fck@0 { | ||
623 | ld_ldd_fck { | ||
624 | groups = "ld_ldd_fck_grp"; | ||
625 | function = "ld_ldd_fck"; | ||
626 | }; | ||
627 | }; | ||
628 | |||
629 | ld_ldd_lck_pmx: ld_ldd_lck@0 { | ||
630 | ld_ldd_lck { | ||
631 | groups = "ld_ldd_lck_grp"; | ||
632 | function = "ld_ldd_lck"; | ||
633 | }; | ||
634 | }; | ||
635 | |||
636 | lr_lcdrom_pmx: lr_lcdrom@0 { | ||
637 | lr_lcdrom { | ||
638 | groups = "lr_lcdrom_grp"; | ||
639 | function = "lr_lcdrom"; | ||
640 | }; | ||
641 | }; | ||
642 | |||
643 | lvds_analog_pmx: lvds_analog@0 { | ||
644 | lvds_analog { | ||
645 | groups = "lvds_analog_grp"; | ||
646 | function = "lvds_analog"; | ||
647 | }; | ||
648 | }; | ||
649 | |||
650 | nd_df_pmx: nd_df@0 { | ||
651 | nd_df { | ||
652 | groups = "nd_df_grp"; | ||
653 | function = "nd_df"; | ||
654 | }; | ||
655 | }; | ||
656 | |||
657 | nd_df_nowp_pmx: nd_df_nowp@0 { | ||
658 | nd_df_nowp { | ||
659 | groups = "nd_df_nowp_grp"; | ||
660 | function = "nd_df_nowp"; | ||
661 | }; | ||
662 | }; | ||
663 | |||
664 | ps_pmx: ps@0 { | ||
665 | ps { | ||
666 | groups = "ps_grp"; | ||
667 | function = "ps"; | ||
668 | }; | ||
669 | }; | ||
670 | |||
671 | pwc_core_on_pmx: pwc_core_on@0 { | ||
672 | pwc_core_on { | ||
673 | groups = "pwc_core_on_grp"; | ||
674 | function = "pwc_core_on"; | ||
675 | }; | ||
676 | }; | ||
677 | |||
678 | pwc_ext_on_pmx: pwc_ext_on@0 { | ||
679 | pwc_ext_on { | ||
680 | groups = "pwc_ext_on_grp"; | ||
681 | function = "pwc_ext_on"; | ||
682 | }; | ||
683 | }; | ||
684 | |||
685 | pwc_gpio3_clk_pmx: pwc_gpio3_clk@0 { | ||
686 | pwc_gpio3_clk { | ||
687 | groups = "pwc_gpio3_clk_grp"; | ||
688 | function = "pwc_gpio3_clk"; | ||
689 | }; | ||
690 | }; | ||
691 | |||
692 | pwc_io_on_pmx: pwc_io_on@0 { | ||
693 | pwc_io_on { | ||
694 | groups = "pwc_io_on_grp"; | ||
695 | function = "pwc_io_on"; | ||
696 | }; | ||
697 | }; | ||
698 | |||
699 | pwc_lowbatt_b_pmx0: pwc_lowbatt_b@0 { | ||
700 | pwc_lowbatt_b_0 { | ||
701 | groups = "pwc_lowbatt_b_grp0"; | ||
702 | function = "pwc_lowbatt_b_m0"; | ||
703 | }; | ||
704 | }; | ||
705 | |||
706 | pwc_mem_on_pmx: pwc_mem_on@0 { | ||
707 | pwc_mem_on { | ||
708 | groups = "pwc_mem_on_grp"; | ||
709 | function = "pwc_mem_on"; | ||
710 | }; | ||
711 | }; | ||
712 | |||
713 | pwc_on_key_b_pmx0: pwc_on_key_b@0 { | ||
714 | pwc_on_key_b_0 { | ||
715 | groups = "pwc_on_key_b_grp0"; | ||
716 | function = "pwc_on_key_b_m0"; | ||
717 | }; | ||
718 | }; | ||
719 | |||
720 | pwc_wakeup_src0_pmx: pwc_wakeup_src0@0 { | ||
721 | pwc_wakeup_src0 { | ||
722 | groups = "pwc_wakeup_src0_grp"; | ||
723 | function = "pwc_wakeup_src0"; | ||
724 | }; | ||
725 | }; | ||
726 | |||
727 | pwc_wakeup_src1_pmx: pwc_wakeup_src1@0 { | ||
728 | pwc_wakeup_src1 { | ||
729 | groups = "pwc_wakeup_src1_grp"; | ||
730 | function = "pwc_wakeup_src1"; | ||
731 | }; | ||
732 | }; | ||
733 | |||
734 | pwc_wakeup_src2_pmx: pwc_wakeup_src2@0 { | ||
735 | pwc_wakeup_src2 { | ||
736 | groups = "pwc_wakeup_src2_grp"; | ||
737 | function = "pwc_wakeup_src2"; | ||
738 | }; | ||
739 | }; | ||
740 | |||
741 | pwc_wakeup_src3_pmx: pwc_wakeup_src3@0 { | ||
742 | pwc_wakeup_src3 { | ||
743 | groups = "pwc_wakeup_src3_grp"; | ||
744 | function = "pwc_wakeup_src3"; | ||
745 | }; | ||
746 | }; | ||
747 | |||
748 | pw_cko0_pmx0: pw_cko0@0 { | ||
749 | pw_cko0_0 { | ||
750 | groups = "pw_cko0_grp0"; | ||
751 | function = "pw_cko0_m0"; | ||
752 | }; | ||
753 | }; | ||
754 | |||
755 | pw_cko0_pmx1: pw_cko0@1 { | ||
756 | pw_cko0_1 { | ||
757 | groups = "pw_cko0_grp1"; | ||
758 | function = "pw_cko0_m1"; | ||
759 | }; | ||
760 | }; | ||
761 | |||
762 | pw_cko0_pmx2: pw_cko0@2 { | ||
763 | pw_cko0_2 { | ||
764 | groups = "pw_cko0_grp2"; | ||
765 | function = "pw_cko0_m2"; | ||
766 | }; | ||
767 | }; | ||
768 | |||
769 | pw_cko1_pmx0: pw_cko1@0 { | ||
770 | pw_cko1_0 { | ||
771 | groups = "pw_cko1_grp0"; | ||
772 | function = "pw_cko1_m0"; | ||
773 | }; | ||
774 | }; | ||
775 | |||
776 | pw_cko1_pmx1: pw_cko1@1 { | ||
777 | pw_cko1_1 { | ||
778 | groups = "pw_cko1_grp1"; | ||
779 | function = "pw_cko1_m1"; | ||
780 | }; | ||
781 | }; | ||
782 | |||
783 | pw_i2s01_clk_pmx0: pw_i2s01_clk@0 { | ||
784 | pw_i2s01_clk_0 { | ||
785 | groups = "pw_i2s01_clk_grp0"; | ||
786 | function = "pw_i2s01_clk_m0"; | ||
787 | }; | ||
788 | }; | ||
789 | |||
790 | pw_i2s01_clk_pmx1: pw_i2s01_clk@1 { | ||
791 | pw_i2s01_clk_1 { | ||
792 | groups = "pw_i2s01_clk_grp1"; | ||
793 | function = "pw_i2s01_clk_m1"; | ||
794 | }; | ||
795 | }; | ||
796 | |||
797 | pw_pwm0_pmx: pw_pwm0@0 { | ||
798 | pw_pwm0 { | ||
799 | groups = "pw_pwm0_grp"; | ||
800 | function = "pw_pwm0"; | ||
801 | }; | ||
802 | }; | ||
803 | |||
804 | pw_pwm1_pmx: pw_pwm1@0 { | ||
805 | pw_pwm1 { | ||
806 | groups = "pw_pwm1_grp"; | ||
807 | function = "pw_pwm1"; | ||
808 | }; | ||
809 | }; | ||
810 | |||
811 | pw_pwm2_pmx0: pw_pwm2@0 { | ||
812 | pw_pwm2_0 { | ||
813 | groups = "pw_pwm2_grp0"; | ||
814 | function = "pw_pwm2_m0"; | ||
815 | }; | ||
816 | }; | ||
817 | |||
818 | pw_pwm2_pmx1: pw_pwm2@1 { | ||
819 | pw_pwm2_1 { | ||
820 | groups = "pw_pwm2_grp1"; | ||
821 | function = "pw_pwm2_m1"; | ||
822 | }; | ||
823 | }; | ||
824 | |||
825 | pw_pwm3_pmx0: pw_pwm3@0 { | ||
826 | pw_pwm3_0 { | ||
827 | groups = "pw_pwm3_grp0"; | ||
828 | function = "pw_pwm3_m0"; | ||
829 | }; | ||
830 | }; | ||
831 | |||
832 | pw_pwm3_pmx1: pw_pwm3@1 { | ||
833 | pw_pwm3_1 { | ||
834 | groups = "pw_pwm3_grp1"; | ||
835 | function = "pw_pwm3_m1"; | ||
836 | }; | ||
837 | }; | ||
838 | |||
839 | pw_pwm_cpu_vol_pmx0: pw_pwm_cpu_vol@0 { | ||
840 | pw_pwm_cpu_vol_0 { | ||
841 | groups = "pw_pwm_cpu_vol_grp0"; | ||
842 | function = "pw_pwm_cpu_vol_m0"; | ||
843 | }; | ||
844 | }; | ||
845 | |||
846 | pw_pwm_cpu_vol_pmx1: pw_pwm_cpu_vol@1 { | ||
847 | pw_pwm_cpu_vol_1 { | ||
848 | groups = "pw_pwm_cpu_vol_grp1"; | ||
849 | function = "pw_pwm_cpu_vol_m1"; | ||
850 | }; | ||
851 | }; | ||
852 | |||
853 | pw_backlight_pmx0: pw_backlight@0 { | ||
854 | pw_backlight_0 { | ||
855 | groups = "pw_backlight_grp0"; | ||
856 | function = "pw_backlight_m0"; | ||
857 | }; | ||
858 | }; | ||
859 | |||
860 | pw_backlight_pmx1: pw_backlight@1 { | ||
861 | pw_backlight_1 { | ||
862 | groups = "pw_backlight_grp1"; | ||
863 | function = "pw_backlight_m1"; | ||
864 | }; | ||
865 | }; | ||
866 | |||
867 | rg_eth_mac_pmx: rg_eth_mac@0 { | ||
868 | rg_eth_mac { | ||
869 | groups = "rg_eth_mac_grp"; | ||
870 | function = "rg_eth_mac"; | ||
871 | }; | ||
872 | }; | ||
873 | |||
874 | rg_gmac_phy_intr_n_pmx: rg_gmac_phy_intr_n@0 { | ||
875 | rg_gmac_phy_intr_n { | ||
876 | groups = "rg_gmac_phy_intr_n_grp"; | ||
877 | function = "rg_gmac_phy_intr_n"; | ||
878 | }; | ||
879 | }; | ||
880 | |||
881 | rg_rgmii_mac_pmx: rg_rgmii_mac@0 { | ||
882 | rg_rgmii_mac { | ||
883 | groups = "rg_rgmii_mac_grp"; | ||
884 | function = "rg_rgmii_mac"; | ||
885 | }; | ||
886 | }; | ||
887 | |||
888 | rg_rgmii_phy_ref_clk_pmx0: rg_rgmii_phy_ref_clk@0 { | ||
889 | rg_rgmii_phy_ref_clk_0 { | ||
890 | groups = | ||
891 | "rg_rgmii_phy_ref_clk_grp0"; | ||
892 | function = | ||
893 | "rg_rgmii_phy_ref_clk_m0"; | ||
894 | }; | ||
895 | }; | ||
896 | |||
897 | rg_rgmii_phy_ref_clk_pmx1: rg_rgmii_phy_ref_clk@1 { | ||
898 | rg_rgmii_phy_ref_clk_1 { | ||
899 | groups = | ||
900 | "rg_rgmii_phy_ref_clk_grp1"; | ||
901 | function = | ||
902 | "rg_rgmii_phy_ref_clk_m1"; | ||
903 | }; | ||
904 | }; | ||
905 | |||
906 | sd0_pmx: sd0@0 { | ||
907 | sd0 { | ||
908 | groups = "sd0_grp"; | ||
909 | function = "sd0"; | ||
910 | }; | ||
911 | }; | ||
912 | |||
913 | sd0_4bit_pmx: sd0_4bit@0 { | ||
914 | sd0_4bit { | ||
915 | groups = "sd0_4bit_grp"; | ||
916 | function = "sd0_4bit"; | ||
917 | }; | ||
918 | }; | ||
919 | |||
920 | sd1_pmx: sd1@0 { | ||
921 | sd1 { | ||
922 | groups = "sd1_grp"; | ||
923 | function = "sd1"; | ||
924 | }; | ||
925 | }; | ||
926 | |||
927 | sd1_4bit_pmx0: sd1_4bit@0 { | ||
928 | sd1_4bit_0 { | ||
929 | groups = "sd1_4bit_grp0"; | ||
930 | function = "sd1_4bit_m0"; | ||
931 | }; | ||
932 | }; | ||
933 | |||
934 | sd1_4bit_pmx1: sd1_4bit@1 { | ||
935 | sd1_4bit_1 { | ||
936 | groups = "sd1_4bit_grp1"; | ||
937 | function = "sd1_4bit_m1"; | ||
938 | }; | ||
939 | }; | ||
940 | |||
941 | sd2_pmx0: sd2@0 { | ||
942 | sd2_0 { | ||
943 | groups = "sd2_grp0"; | ||
944 | function = "sd2_m0"; | ||
945 | }; | ||
946 | }; | ||
947 | |||
948 | sd2_no_cdb_pmx0: sd2_no_cdb@0 { | ||
949 | sd2_no_cdb_0 { | ||
950 | groups = "sd2_no_cdb_grp0"; | ||
951 | function = "sd2_no_cdb_m0"; | ||
952 | }; | ||
953 | }; | ||
954 | |||
955 | sd3_pmx: sd3@0 { | ||
956 | sd3 { | ||
957 | groups = "sd3_grp"; | ||
958 | function = "sd3"; | ||
959 | }; | ||
960 | }; | ||
961 | |||
962 | sd5_pmx: sd5@0 { | ||
963 | sd5 { | ||
964 | groups = "sd5_grp"; | ||
965 | function = "sd5"; | ||
966 | }; | ||
967 | }; | ||
968 | |||
969 | sd6_pmx0: sd6@0 { | ||
970 | sd6_0 { | ||
971 | groups = "sd6_grp0"; | ||
972 | function = "sd6_m0"; | ||
973 | }; | ||
974 | }; | ||
975 | |||
976 | sd6_pmx1: sd6@1 { | ||
977 | sd6_1 { | ||
978 | groups = "sd6_grp1"; | ||
979 | function = "sd6_m1"; | ||
980 | }; | ||
981 | }; | ||
982 | |||
983 | sp0_ext_ldo_on_pmx: sp0_ext_ldo_on@0 { | ||
984 | sp0_ext_ldo_on { | ||
985 | groups = "sp0_ext_ldo_on_grp"; | ||
986 | function = "sp0_ext_ldo_on"; | ||
987 | }; | ||
988 | }; | ||
989 | |||
990 | sp0_qspi_pmx: sp0_qspi@0 { | ||
991 | sp0_qspi { | ||
992 | groups = "sp0_qspi_grp"; | ||
993 | function = "sp0_qspi"; | ||
994 | }; | ||
995 | }; | ||
996 | |||
997 | sp1_spi_pmx: sp1_spi@0 { | ||
998 | sp1_spi { | ||
999 | groups = "sp1_spi_grp"; | ||
1000 | function = "sp1_spi"; | ||
1001 | }; | ||
1002 | }; | ||
1003 | |||
1004 | tpiu_trace_pmx: tpiu_trace@0 { | ||
1005 | tpiu_trace { | ||
1006 | groups = "tpiu_trace_grp"; | ||
1007 | function = "tpiu_trace"; | ||
1008 | }; | ||
1009 | }; | ||
1010 | |||
1011 | uart0_pmx: uart0@0 { | ||
1012 | uart0 { | ||
1013 | groups = "uart0_grp"; | ||
1014 | function = "uart0"; | ||
1015 | }; | ||
1016 | }; | ||
1017 | |||
1018 | uart0_nopause_pmx: uart0_nopause@0 { | ||
1019 | uart0_nopause { | ||
1020 | groups = "uart0_nopause_grp"; | ||
1021 | function = "uart0_nopause"; | ||
1022 | }; | ||
1023 | }; | ||
1024 | |||
1025 | uart1_pmx: uart1@0 { | ||
1026 | uart1 { | ||
1027 | groups = "uart1_grp"; | ||
1028 | function = "uart1"; | ||
1029 | }; | ||
1030 | }; | ||
1031 | |||
1032 | uart2_pmx: uart2@0 { | ||
1033 | uart2 { | ||
1034 | groups = "uart2_grp"; | ||
1035 | function = "uart2"; | ||
1036 | }; | ||
1037 | }; | ||
1038 | |||
1039 | uart3_pmx0: uart3@0 { | ||
1040 | uart3_0 { | ||
1041 | groups = "uart3_grp0"; | ||
1042 | function = "uart3_m0"; | ||
1043 | }; | ||
1044 | }; | ||
1045 | |||
1046 | uart3_pmx1: uart3@1 { | ||
1047 | uart3_1 { | ||
1048 | groups = "uart3_grp1"; | ||
1049 | function = "uart3_m1"; | ||
1050 | }; | ||
1051 | }; | ||
1052 | |||
1053 | uart3_pmx2: uart3@2 { | ||
1054 | uart3_2 { | ||
1055 | groups = "uart3_grp2"; | ||
1056 | function = "uart3_m2"; | ||
1057 | }; | ||
1058 | }; | ||
1059 | |||
1060 | uart3_pmx3: uart3@3 { | ||
1061 | uart3_3 { | ||
1062 | groups = "uart3_grp3"; | ||
1063 | function = "uart3_m3"; | ||
1064 | }; | ||
1065 | }; | ||
1066 | |||
1067 | uart3_nopause_pmx0: uart3_nopause@0 { | ||
1068 | uart3_nopause_0 { | ||
1069 | groups = "uart3_nopause_grp0"; | ||
1070 | function = "uart3_nopause_m0"; | ||
1071 | }; | ||
1072 | }; | ||
1073 | |||
1074 | uart3_nopause_pmx1: uart3_nopause@1 { | ||
1075 | uart3_nopause_1 { | ||
1076 | groups = "uart3_nopause_grp1"; | ||
1077 | function = "uart3_nopause_m1"; | ||
1078 | }; | ||
1079 | }; | ||
1080 | |||
1081 | uart4_pmx0: uart4@0 { | ||
1082 | uart4_0 { | ||
1083 | groups = "uart4_grp0"; | ||
1084 | function = "uart4_m0"; | ||
1085 | }; | ||
1086 | }; | ||
1087 | |||
1088 | uart4_pmx1: uart4@1 { | ||
1089 | uart4_1 { | ||
1090 | groups = "uart4_grp1"; | ||
1091 | function = "uart4_m1"; | ||
1092 | }; | ||
1093 | }; | ||
1094 | |||
1095 | uart4_pmx2: uart4@2 { | ||
1096 | uart4_2 { | ||
1097 | groups = "uart4_grp2"; | ||
1098 | function = "uart4_m2"; | ||
1099 | }; | ||
1100 | }; | ||
1101 | |||
1102 | uart4_nopause_pmx: uart4_nopause@0 { | ||
1103 | uart4_nopause { | ||
1104 | groups = "uart4_nopause_grp"; | ||
1105 | function = "uart4_nopause"; | ||
1106 | }; | ||
1107 | }; | ||
1108 | |||
1109 | usb0_drvvbus_pmx: usb0_drvvbus@0 { | ||
1110 | usb0_drvvbus { | ||
1111 | groups = "usb0_drvvbus_grp"; | ||
1112 | function = "usb0_drvvbus"; | ||
1113 | }; | ||
1114 | }; | ||
1115 | |||
1116 | usb1_drvvbus_pmx: usb1_drvvbus@0 { | ||
1117 | usb1_drvvbus { | ||
1118 | groups = "usb1_drvvbus_grp"; | ||
1119 | function = "usb1_drvvbus"; | ||
1120 | }; | ||
1121 | }; | ||
1122 | |||
1123 | visbus_dout_pmx: visbus_dout@0 { | ||
1124 | visbus_dout { | ||
1125 | groups = "visbus_dout_grp"; | ||
1126 | function = "visbus_dout"; | ||
1127 | }; | ||
1128 | }; | ||
1129 | |||
1130 | vi_vip1_pmx: vi_vip1@0 { | ||
1131 | vi_vip1 { | ||
1132 | groups = "vi_vip1_grp"; | ||
1133 | function = "vi_vip1"; | ||
1134 | }; | ||
1135 | }; | ||
1136 | |||
1137 | vi_vip1_ext_pmx: vi_vip1_ext@0 { | ||
1138 | vi_vip1_ext { | ||
1139 | groups = "vi_vip1_ext_grp"; | ||
1140 | function = "vi_vip1_ext"; | ||
1141 | }; | ||
1142 | }; | ||
1143 | |||
1144 | vi_vip1_low8bit_pmx: vi_vip1_low8bit@0 { | ||
1145 | vi_vip1_low8bit { | ||
1146 | groups = "vi_vip1_low8bit_grp"; | ||
1147 | function = "vi_vip1_low8bit"; | ||
1148 | }; | ||
1149 | }; | ||
1150 | |||
1151 | vi_vip1_high8bit_pmx: vi_vip1_high8bit@0 { | ||
1152 | vi_vip1_high8bit { | ||
1153 | groups = "vi_vip1_high8bit_grp"; | ||
1154 | function = "vi_vip1_high8bit"; | ||
1155 | }; | ||
1156 | }; | ||
138 | }; | 1157 | }; |
139 | 1158 | ||
140 | pmipc { | 1159 | pmipc { |
@@ -356,6 +1375,12 @@ | |||
356 | clock-names = "gpio0_io"; | 1375 | clock-names = "gpio0_io"; |
357 | gpio-controller; | 1376 | gpio-controller; |
358 | interrupt-controller; | 1377 | interrupt-controller; |
1378 | |||
1379 | gpio-banks = <2>; | ||
1380 | gpio-ranges = <&pinctrl 0 0 0>, | ||
1381 | <&pinctrl 32 0 0>; | ||
1382 | gpio-ranges-group-names = "lvds_gpio_grp", | ||
1383 | "uart_nand_gpio_grp"; | ||
359 | }; | 1384 | }; |
360 | 1385 | ||
361 | nand@17050000 { | 1386 | nand@17050000 { |
@@ -461,11 +1486,22 @@ | |||
461 | #interrupt-cells = <2>; | 1486 | #interrupt-cells = <2>; |
462 | compatible = "sirf,atlas7-gpio"; | 1487 | compatible = "sirf,atlas7-gpio"; |
463 | reg = <0x13300000 0x1000>; | 1488 | reg = <0x13300000 0x1000>; |
464 | interrupts = <0 43 0>, <0 44 0>, <0 45 0>; | 1489 | interrupts = <0 43 0>, <0 44 0>, |
1490 | <0 45 0>, <0 46 0>; | ||
465 | clocks = <&car 84>; | 1491 | clocks = <&car 84>; |
466 | clock-names = "gpio1_io"; | 1492 | clock-names = "gpio1_io"; |
467 | gpio-controller; | 1493 | gpio-controller; |
468 | interrupt-controller; | 1494 | interrupt-controller; |
1495 | |||
1496 | gpio-banks = <4>; | ||
1497 | gpio-ranges = <&pinctrl 0 0 0>, | ||
1498 | <&pinctrl 32 0 0>, | ||
1499 | <&pinctrl 64 0 0>, | ||
1500 | <&pinctrl 96 0 0>; | ||
1501 | gpio-ranges-group-names = "gnss_gpio_grp", | ||
1502 | "lcd_vip_gpio_grp", | ||
1503 | "sdio_i2s_gpio_grp", | ||
1504 | "sp_rgmii_gpio_grp"; | ||
469 | }; | 1505 | }; |
470 | 1506 | ||
471 | sd2: sdhci@14200000 { | 1507 | sd2: sdhci@14200000 { |
@@ -744,6 +1780,10 @@ | |||
744 | interrupts = <0 47 0>; | 1780 | interrupts = <0 47 0>; |
745 | gpio-controller; | 1781 | gpio-controller; |
746 | interrupt-controller; | 1782 | interrupt-controller; |
1783 | |||
1784 | gpio-banks = <1>; | ||
1785 | gpio-ranges = <&pinctrl 0 0 0>; | ||
1786 | gpio-ranges-group-names = "rtc_gpio_grp"; | ||
747 | }; | 1787 | }; |
748 | 1788 | ||
749 | rtc-iobg@18840000 { | 1789 | rtc-iobg@18840000 { |
diff --git a/arch/arm/boot/dts/cros-ec-keyboard.dtsi b/arch/arm/boot/dts/cros-ec-keyboard.dtsi index 9c7fb0acae79..4e42f30cb318 100644 --- a/arch/arm/boot/dts/cros-ec-keyboard.dtsi +++ b/arch/arm/boot/dts/cros-ec-keyboard.dtsi | |||
@@ -22,6 +22,7 @@ | |||
22 | MATRIX_KEY(0x00, 0x02, KEY_F1) | 22 | MATRIX_KEY(0x00, 0x02, KEY_F1) |
23 | MATRIX_KEY(0x00, 0x03, KEY_B) | 23 | MATRIX_KEY(0x00, 0x03, KEY_B) |
24 | MATRIX_KEY(0x00, 0x04, KEY_F10) | 24 | MATRIX_KEY(0x00, 0x04, KEY_F10) |
25 | MATRIX_KEY(0x00, 0x05, KEY_RO) | ||
25 | MATRIX_KEY(0x00, 0x06, KEY_N) | 26 | MATRIX_KEY(0x00, 0x06, KEY_N) |
26 | MATRIX_KEY(0x00, 0x08, KEY_EQUAL) | 27 | MATRIX_KEY(0x00, 0x08, KEY_EQUAL) |
27 | MATRIX_KEY(0x00, 0x0a, KEY_RIGHTALT) | 28 | MATRIX_KEY(0x00, 0x0a, KEY_RIGHTALT) |
@@ -34,6 +35,7 @@ | |||
34 | MATRIX_KEY(0x01, 0x08, KEY_APOSTROPHE) | 35 | MATRIX_KEY(0x01, 0x08, KEY_APOSTROPHE) |
35 | MATRIX_KEY(0x01, 0x09, KEY_F9) | 36 | MATRIX_KEY(0x01, 0x09, KEY_F9) |
36 | MATRIX_KEY(0x01, 0x0b, KEY_BACKSPACE) | 37 | MATRIX_KEY(0x01, 0x0b, KEY_BACKSPACE) |
38 | MATRIX_KEY(0x01, 0x0c, KEY_HENKAN) | ||
37 | 39 | ||
38 | MATRIX_KEY(0x02, 0x00, KEY_LEFTCTRL) | 40 | MATRIX_KEY(0x02, 0x00, KEY_LEFTCTRL) |
39 | MATRIX_KEY(0x02, 0x01, KEY_TAB) | 41 | MATRIX_KEY(0x02, 0x01, KEY_TAB) |
@@ -45,6 +47,7 @@ | |||
45 | MATRIX_KEY(0x02, 0x07, KEY_102ND) | 47 | MATRIX_KEY(0x02, 0x07, KEY_102ND) |
46 | MATRIX_KEY(0x02, 0x08, KEY_LEFTBRACE) | 48 | MATRIX_KEY(0x02, 0x08, KEY_LEFTBRACE) |
47 | MATRIX_KEY(0x02, 0x09, KEY_F8) | 49 | MATRIX_KEY(0x02, 0x09, KEY_F8) |
50 | MATRIX_KEY(0x02, 0x0a, KEY_YEN) | ||
48 | 51 | ||
49 | MATRIX_KEY(0x03, 0x01, KEY_GRAVE) | 52 | MATRIX_KEY(0x03, 0x01, KEY_GRAVE) |
50 | MATRIX_KEY(0x03, 0x02, KEY_F2) | 53 | MATRIX_KEY(0x03, 0x02, KEY_F2) |
@@ -53,6 +56,7 @@ | |||
53 | MATRIX_KEY(0x03, 0x06, KEY_6) | 56 | MATRIX_KEY(0x03, 0x06, KEY_6) |
54 | MATRIX_KEY(0x03, 0x08, KEY_MINUS) | 57 | MATRIX_KEY(0x03, 0x08, KEY_MINUS) |
55 | MATRIX_KEY(0x03, 0x0b, KEY_BACKSLASH) | 58 | MATRIX_KEY(0x03, 0x0b, KEY_BACKSLASH) |
59 | MATRIX_KEY(0x03, 0x0c, KEY_MUHENKAN) | ||
56 | 60 | ||
57 | MATRIX_KEY(0x04, 0x00, KEY_RIGHTCTRL) | 61 | MATRIX_KEY(0x04, 0x00, KEY_RIGHTCTRL) |
58 | MATRIX_KEY(0x04, 0x01, KEY_A) | 62 | MATRIX_KEY(0x04, 0x01, KEY_A) |
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts index aa465904f6cc..096f68be99e2 100644 --- a/arch/arm/boot/dts/dra7-evm.dts +++ b/arch/arm/boot/dts/dra7-evm.dts | |||
@@ -686,7 +686,8 @@ | |||
686 | 686 | ||
687 | &dcan1 { | 687 | &dcan1 { |
688 | status = "ok"; | 688 | status = "ok"; |
689 | pinctrl-names = "default", "sleep"; | 689 | pinctrl-names = "default", "sleep", "active"; |
690 | pinctrl-0 = <&dcan1_pins_default>; | 690 | pinctrl-0 = <&dcan1_pins_sleep>; |
691 | pinctrl-1 = <&dcan1_pins_sleep>; | 691 | pinctrl-1 = <&dcan1_pins_sleep>; |
692 | pinctrl-2 = <&dcan1_pins_default>; | ||
692 | }; | 693 | }; |
diff --git a/arch/arm/boot/dts/dra72-evm.dts b/arch/arm/boot/dts/dra72-evm.dts index 4e1b60581782..803738414086 100644 --- a/arch/arm/boot/dts/dra72-evm.dts +++ b/arch/arm/boot/dts/dra72-evm.dts | |||
@@ -587,9 +587,10 @@ | |||
587 | 587 | ||
588 | &dcan1 { | 588 | &dcan1 { |
589 | status = "ok"; | 589 | status = "ok"; |
590 | pinctrl-names = "default", "sleep"; | 590 | pinctrl-names = "default", "sleep", "active"; |
591 | pinctrl-0 = <&dcan1_pins_default>; | 591 | pinctrl-0 = <&dcan1_pins_sleep>; |
592 | pinctrl-1 = <&dcan1_pins_sleep>; | 592 | pinctrl-1 = <&dcan1_pins_sleep>; |
593 | pinctrl-2 = <&dcan1_pins_default>; | ||
593 | }; | 594 | }; |
594 | 595 | ||
595 | &qspi { | 596 | &qspi { |
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi index c892d58e8dad..b995333ea22b 100644 --- a/arch/arm/boot/dts/imx23.dtsi +++ b/arch/arm/boot/dts/imx23.dtsi | |||
@@ -468,6 +468,7 @@ | |||
468 | interrupts = <36 37 38 39 40 41 42 43 44>; | 468 | interrupts = <36 37 38 39 40 41 42 43 44>; |
469 | status = "disabled"; | 469 | status = "disabled"; |
470 | clocks = <&clks 26>; | 470 | clocks = <&clks 26>; |
471 | #io-channel-cells = <1>; | ||
471 | }; | 472 | }; |
472 | 473 | ||
473 | spdif@80054000 { | 474 | spdif@80054000 { |
diff --git a/arch/arm/boot/dts/imx25-pdk.dts b/arch/arm/boot/dts/imx25-pdk.dts index dd45e6971bc3..9351296356dc 100644 --- a/arch/arm/boot/dts/imx25-pdk.dts +++ b/arch/arm/boot/dts/imx25-pdk.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | /dts-v1/; | 12 | /dts-v1/; |
13 | #include <dt-bindings/gpio/gpio.h> | ||
13 | #include <dt-bindings/input/input.h> | 14 | #include <dt-bindings/input/input.h> |
14 | #include "imx25.dtsi" | 15 | #include "imx25.dtsi" |
15 | 16 | ||
@@ -114,8 +115,8 @@ | |||
114 | &esdhc1 { | 115 | &esdhc1 { |
115 | pinctrl-names = "default"; | 116 | pinctrl-names = "default"; |
116 | pinctrl-0 = <&pinctrl_esdhc1>; | 117 | pinctrl-0 = <&pinctrl_esdhc1>; |
117 | cd-gpios = <&gpio2 1 0>; | 118 | cd-gpios = <&gpio2 1 GPIO_ACTIVE_LOW>; |
118 | wp-gpios = <&gpio2 0 0>; | 119 | wp-gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>; |
119 | status = "okay"; | 120 | status = "okay"; |
120 | }; | 121 | }; |
121 | 122 | ||
diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi index bc215e4b75fd..b69be5c499cf 100644 --- a/arch/arm/boot/dts/imx27.dtsi +++ b/arch/arm/boot/dts/imx27.dtsi | |||
@@ -108,7 +108,7 @@ | |||
108 | }; | 108 | }; |
109 | 109 | ||
110 | gpt1: timer@10003000 { | 110 | gpt1: timer@10003000 { |
111 | compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; | 111 | compatible = "fsl,imx27-gpt", "fsl,imx21-gpt"; |
112 | reg = <0x10003000 0x1000>; | 112 | reg = <0x10003000 0x1000>; |
113 | interrupts = <26>; | 113 | interrupts = <26>; |
114 | clocks = <&clks IMX27_CLK_GPT1_IPG_GATE>, | 114 | clocks = <&clks IMX27_CLK_GPT1_IPG_GATE>, |
@@ -117,7 +117,7 @@ | |||
117 | }; | 117 | }; |
118 | 118 | ||
119 | gpt2: timer@10004000 { | 119 | gpt2: timer@10004000 { |
120 | compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; | 120 | compatible = "fsl,imx27-gpt", "fsl,imx21-gpt"; |
121 | reg = <0x10004000 0x1000>; | 121 | reg = <0x10004000 0x1000>; |
122 | interrupts = <25>; | 122 | interrupts = <25>; |
123 | clocks = <&clks IMX27_CLK_GPT2_IPG_GATE>, | 123 | clocks = <&clks IMX27_CLK_GPT2_IPG_GATE>, |
@@ -126,7 +126,7 @@ | |||
126 | }; | 126 | }; |
127 | 127 | ||
128 | gpt3: timer@10005000 { | 128 | gpt3: timer@10005000 { |
129 | compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; | 129 | compatible = "fsl,imx27-gpt", "fsl,imx21-gpt"; |
130 | reg = <0x10005000 0x1000>; | 130 | reg = <0x10005000 0x1000>; |
131 | interrupts = <24>; | 131 | interrupts = <24>; |
132 | clocks = <&clks IMX27_CLK_GPT3_IPG_GATE>, | 132 | clocks = <&clks IMX27_CLK_GPT3_IPG_GATE>, |
@@ -376,7 +376,7 @@ | |||
376 | }; | 376 | }; |
377 | 377 | ||
378 | gpt4: timer@10019000 { | 378 | gpt4: timer@10019000 { |
379 | compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; | 379 | compatible = "fsl,imx27-gpt", "fsl,imx21-gpt"; |
380 | reg = <0x10019000 0x1000>; | 380 | reg = <0x10019000 0x1000>; |
381 | interrupts = <4>; | 381 | interrupts = <4>; |
382 | clocks = <&clks IMX27_CLK_GPT4_IPG_GATE>, | 382 | clocks = <&clks IMX27_CLK_GPT4_IPG_GATE>, |
@@ -385,7 +385,7 @@ | |||
385 | }; | 385 | }; |
386 | 386 | ||
387 | gpt5: timer@1001a000 { | 387 | gpt5: timer@1001a000 { |
388 | compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; | 388 | compatible = "fsl,imx27-gpt", "fsl,imx21-gpt"; |
389 | reg = <0x1001a000 0x1000>; | 389 | reg = <0x1001a000 0x1000>; |
390 | interrupts = <3>; | 390 | interrupts = <3>; |
391 | clocks = <&clks IMX27_CLK_GPT5_IPG_GATE>, | 391 | clocks = <&clks IMX27_CLK_GPT5_IPG_GATE>, |
@@ -436,7 +436,7 @@ | |||
436 | }; | 436 | }; |
437 | 437 | ||
438 | gpt6: timer@1001f000 { | 438 | gpt6: timer@1001f000 { |
439 | compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; | 439 | compatible = "fsl,imx27-gpt", "fsl,imx21-gpt"; |
440 | reg = <0x1001f000 0x1000>; | 440 | reg = <0x1001f000 0x1000>; |
441 | interrupts = <2>; | 441 | interrupts = <2>; |
442 | clocks = <&clks IMX27_CLK_GPT6_IPG_GATE>, | 442 | clocks = <&clks IMX27_CLK_GPT6_IPG_GATE>, |
diff --git a/arch/arm/boot/dts/imx51-apf51dev.dts b/arch/arm/boot/dts/imx51-apf51dev.dts index 93d3ea12328c..0f3fe29b816e 100644 --- a/arch/arm/boot/dts/imx51-apf51dev.dts +++ b/arch/arm/boot/dts/imx51-apf51dev.dts | |||
@@ -98,7 +98,7 @@ | |||
98 | &esdhc1 { | 98 | &esdhc1 { |
99 | pinctrl-names = "default"; | 99 | pinctrl-names = "default"; |
100 | pinctrl-0 = <&pinctrl_esdhc1>; | 100 | pinctrl-0 = <&pinctrl_esdhc1>; |
101 | cd-gpios = <&gpio2 29 GPIO_ACTIVE_HIGH>; | 101 | cd-gpios = <&gpio2 29 GPIO_ACTIVE_LOW>; |
102 | bus-width = <4>; | 102 | bus-width = <4>; |
103 | status = "okay"; | 103 | status = "okay"; |
104 | }; | 104 | }; |
diff --git a/arch/arm/boot/dts/imx53-ard.dts b/arch/arm/boot/dts/imx53-ard.dts index e9337ad52f59..3bc18835fb4b 100644 --- a/arch/arm/boot/dts/imx53-ard.dts +++ b/arch/arm/boot/dts/imx53-ard.dts | |||
@@ -103,8 +103,8 @@ | |||
103 | &esdhc1 { | 103 | &esdhc1 { |
104 | pinctrl-names = "default"; | 104 | pinctrl-names = "default"; |
105 | pinctrl-0 = <&pinctrl_esdhc1>; | 105 | pinctrl-0 = <&pinctrl_esdhc1>; |
106 | cd-gpios = <&gpio1 1 0>; | 106 | cd-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>; |
107 | wp-gpios = <&gpio1 9 0>; | 107 | wp-gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; |
108 | status = "okay"; | 108 | status = "okay"; |
109 | }; | 109 | }; |
110 | 110 | ||
diff --git a/arch/arm/boot/dts/imx53-m53evk.dts b/arch/arm/boot/dts/imx53-m53evk.dts index d0e0f57eb432..53f40885c530 100644 --- a/arch/arm/boot/dts/imx53-m53evk.dts +++ b/arch/arm/boot/dts/imx53-m53evk.dts | |||
@@ -124,8 +124,8 @@ | |||
124 | &esdhc1 { | 124 | &esdhc1 { |
125 | pinctrl-names = "default"; | 125 | pinctrl-names = "default"; |
126 | pinctrl-0 = <&pinctrl_esdhc1>; | 126 | pinctrl-0 = <&pinctrl_esdhc1>; |
127 | cd-gpios = <&gpio1 1 0>; | 127 | cd-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>; |
128 | wp-gpios = <&gpio1 9 0>; | 128 | wp-gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; |
129 | status = "okay"; | 129 | status = "okay"; |
130 | }; | 130 | }; |
131 | 131 | ||
diff --git a/arch/arm/boot/dts/imx53-qsb-common.dtsi b/arch/arm/boot/dts/imx53-qsb-common.dtsi index 181ae5ebf23f..b0d5542ac829 100644 --- a/arch/arm/boot/dts/imx53-qsb-common.dtsi +++ b/arch/arm/boot/dts/imx53-qsb-common.dtsi | |||
@@ -147,8 +147,8 @@ | |||
147 | &esdhc3 { | 147 | &esdhc3 { |
148 | pinctrl-names = "default"; | 148 | pinctrl-names = "default"; |
149 | pinctrl-0 = <&pinctrl_esdhc3>; | 149 | pinctrl-0 = <&pinctrl_esdhc3>; |
150 | cd-gpios = <&gpio3 11 0>; | 150 | cd-gpios = <&gpio3 11 GPIO_ACTIVE_LOW>; |
151 | wp-gpios = <&gpio3 12 0>; | 151 | wp-gpios = <&gpio3 12 GPIO_ACTIVE_HIGH>; |
152 | bus-width = <8>; | 152 | bus-width = <8>; |
153 | status = "okay"; | 153 | status = "okay"; |
154 | }; | 154 | }; |
@@ -295,9 +295,10 @@ | |||
295 | &tve { | 295 | &tve { |
296 | pinctrl-names = "default"; | 296 | pinctrl-names = "default"; |
297 | pinctrl-0 = <&pinctrl_vga_sync>; | 297 | pinctrl-0 = <&pinctrl_vga_sync>; |
298 | ddc-i2c-bus = <&i2c2>; | ||
298 | fsl,tve-mode = "vga"; | 299 | fsl,tve-mode = "vga"; |
299 | fsl,hsync-pin = <4>; | 300 | fsl,hsync-pin = <7>; /* IPU DI1 PIN7 via EIM_OE */ |
300 | fsl,vsync-pin = <6>; | 301 | fsl,vsync-pin = <8>; /* IPU DI1 PIN8 via EIM_RW */ |
301 | status = "okay"; | 302 | status = "okay"; |
302 | }; | 303 | }; |
303 | 304 | ||
diff --git a/arch/arm/boot/dts/imx53-smd.dts b/arch/arm/boot/dts/imx53-smd.dts index 1d325576bcc0..fc89ce1e5763 100644 --- a/arch/arm/boot/dts/imx53-smd.dts +++ b/arch/arm/boot/dts/imx53-smd.dts | |||
@@ -41,8 +41,8 @@ | |||
41 | &esdhc1 { | 41 | &esdhc1 { |
42 | pinctrl-names = "default"; | 42 | pinctrl-names = "default"; |
43 | pinctrl-0 = <&pinctrl_esdhc1>; | 43 | pinctrl-0 = <&pinctrl_esdhc1>; |
44 | cd-gpios = <&gpio3 13 0>; | 44 | cd-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>; |
45 | wp-gpios = <&gpio4 11 0>; | 45 | wp-gpios = <&gpio4 11 GPIO_ACTIVE_HIGH>; |
46 | status = "okay"; | 46 | status = "okay"; |
47 | }; | 47 | }; |
48 | 48 | ||
diff --git a/arch/arm/boot/dts/imx53-tqma53.dtsi b/arch/arm/boot/dts/imx53-tqma53.dtsi index 4f1f0e2868bf..e03373a58760 100644 --- a/arch/arm/boot/dts/imx53-tqma53.dtsi +++ b/arch/arm/boot/dts/imx53-tqma53.dtsi | |||
@@ -41,8 +41,8 @@ | |||
41 | pinctrl-0 = <&pinctrl_esdhc2>, | 41 | pinctrl-0 = <&pinctrl_esdhc2>, |
42 | <&pinctrl_esdhc2_cdwp>; | 42 | <&pinctrl_esdhc2_cdwp>; |
43 | vmmc-supply = <®_3p3v>; | 43 | vmmc-supply = <®_3p3v>; |
44 | wp-gpios = <&gpio1 2 0>; | 44 | wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; |
45 | cd-gpios = <&gpio1 4 0>; | 45 | cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; |
46 | status = "disabled"; | 46 | status = "disabled"; |
47 | }; | 47 | }; |
48 | 48 | ||
diff --git a/arch/arm/boot/dts/imx53-tx53.dtsi b/arch/arm/boot/dts/imx53-tx53.dtsi index 704bd72cbfec..d3e50b22064f 100644 --- a/arch/arm/boot/dts/imx53-tx53.dtsi +++ b/arch/arm/boot/dts/imx53-tx53.dtsi | |||
@@ -183,7 +183,7 @@ | |||
183 | }; | 183 | }; |
184 | 184 | ||
185 | &esdhc1 { | 185 | &esdhc1 { |
186 | cd-gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>; | 186 | cd-gpios = <&gpio3 24 GPIO_ACTIVE_LOW>; |
187 | fsl,wp-controller; | 187 | fsl,wp-controller; |
188 | pinctrl-names = "default"; | 188 | pinctrl-names = "default"; |
189 | pinctrl-0 = <&pinctrl_esdhc1>; | 189 | pinctrl-0 = <&pinctrl_esdhc1>; |
@@ -191,7 +191,7 @@ | |||
191 | }; | 191 | }; |
192 | 192 | ||
193 | &esdhc2 { | 193 | &esdhc2 { |
194 | cd-gpios = <&gpio3 25 GPIO_ACTIVE_HIGH>; | 194 | cd-gpios = <&gpio3 25 GPIO_ACTIVE_LOW>; |
195 | fsl,wp-controller; | 195 | fsl,wp-controller; |
196 | pinctrl-names = "default"; | 196 | pinctrl-names = "default"; |
197 | pinctrl-0 = <&pinctrl_esdhc2>; | 197 | pinctrl-0 = <&pinctrl_esdhc2>; |
diff --git a/arch/arm/boot/dts/imx53-voipac-bsb.dts b/arch/arm/boot/dts/imx53-voipac-bsb.dts index c17d3ad6dba5..fc51b87ad208 100644 --- a/arch/arm/boot/dts/imx53-voipac-bsb.dts +++ b/arch/arm/boot/dts/imx53-voipac-bsb.dts | |||
@@ -119,8 +119,8 @@ | |||
119 | &esdhc2 { | 119 | &esdhc2 { |
120 | pinctrl-names = "default"; | 120 | pinctrl-names = "default"; |
121 | pinctrl-0 = <&pinctrl_esdhc2>; | 121 | pinctrl-0 = <&pinctrl_esdhc2>; |
122 | cd-gpios = <&gpio3 25 0>; | 122 | cd-gpios = <&gpio3 25 GPIO_ACTIVE_LOW>; |
123 | wp-gpios = <&gpio2 19 0>; | 123 | wp-gpios = <&gpio2 19 GPIO_ACTIVE_HIGH>; |
124 | vmmc-supply = <®_3p3v>; | 124 | vmmc-supply = <®_3p3v>; |
125 | status = "okay"; | 125 | status = "okay"; |
126 | }; | 126 | }; |
diff --git a/arch/arm/boot/dts/imx6dl-riotboard.dts b/arch/arm/boot/dts/imx6dl-riotboard.dts index 43cb3fd76be7..5111f5170d53 100644 --- a/arch/arm/boot/dts/imx6dl-riotboard.dts +++ b/arch/arm/boot/dts/imx6dl-riotboard.dts | |||
@@ -305,8 +305,8 @@ | |||
305 | &usdhc2 { | 305 | &usdhc2 { |
306 | pinctrl-names = "default"; | 306 | pinctrl-names = "default"; |
307 | pinctrl-0 = <&pinctrl_usdhc2>; | 307 | pinctrl-0 = <&pinctrl_usdhc2>; |
308 | cd-gpios = <&gpio1 4 0>; | 308 | cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; |
309 | wp-gpios = <&gpio1 2 0>; | 309 | wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; |
310 | vmmc-supply = <®_3p3v>; | 310 | vmmc-supply = <®_3p3v>; |
311 | status = "okay"; | 311 | status = "okay"; |
312 | }; | 312 | }; |
@@ -314,8 +314,8 @@ | |||
314 | &usdhc3 { | 314 | &usdhc3 { |
315 | pinctrl-names = "default"; | 315 | pinctrl-names = "default"; |
316 | pinctrl-0 = <&pinctrl_usdhc3>; | 316 | pinctrl-0 = <&pinctrl_usdhc3>; |
317 | cd-gpios = <&gpio7 0 0>; | 317 | cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; |
318 | wp-gpios = <&gpio7 1 0>; | 318 | wp-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>; |
319 | vmmc-supply = <®_3p3v>; | 319 | vmmc-supply = <®_3p3v>; |
320 | status = "okay"; | 320 | status = "okay"; |
321 | }; | 321 | }; |
diff --git a/arch/arm/boot/dts/imx6q-arm2.dts b/arch/arm/boot/dts/imx6q-arm2.dts index 78df05e9d1ce..d6515f7a56c4 100644 --- a/arch/arm/boot/dts/imx6q-arm2.dts +++ b/arch/arm/boot/dts/imx6q-arm2.dts | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | /dts-v1/; | 13 | /dts-v1/; |
14 | #include <dt-bindings/gpio/gpio.h> | ||
14 | #include "imx6q.dtsi" | 15 | #include "imx6q.dtsi" |
15 | 16 | ||
16 | / { | 17 | / { |
@@ -196,8 +197,8 @@ | |||
196 | }; | 197 | }; |
197 | 198 | ||
198 | &usdhc3 { | 199 | &usdhc3 { |
199 | cd-gpios = <&gpio6 11 0>; | 200 | cd-gpios = <&gpio6 11 GPIO_ACTIVE_LOW>; |
200 | wp-gpios = <&gpio6 14 0>; | 201 | wp-gpios = <&gpio6 14 GPIO_ACTIVE_HIGH>; |
201 | vmmc-supply = <®_3p3v>; | 202 | vmmc-supply = <®_3p3v>; |
202 | pinctrl-names = "default"; | 203 | pinctrl-names = "default"; |
203 | pinctrl-0 = <&pinctrl_usdhc3 | 204 | pinctrl-0 = <&pinctrl_usdhc3 |
diff --git a/arch/arm/boot/dts/imx6q-gk802.dts b/arch/arm/boot/dts/imx6q-gk802.dts index 703539cf36d3..00bd63e63d0c 100644 --- a/arch/arm/boot/dts/imx6q-gk802.dts +++ b/arch/arm/boot/dts/imx6q-gk802.dts | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | /dts-v1/; | 9 | /dts-v1/; |
10 | #include <dt-bindings/gpio/gpio.h> | ||
10 | #include "imx6q.dtsi" | 11 | #include "imx6q.dtsi" |
11 | 12 | ||
12 | / { | 13 | / { |
@@ -161,7 +162,7 @@ | |||
161 | pinctrl-names = "default"; | 162 | pinctrl-names = "default"; |
162 | pinctrl-0 = <&pinctrl_usdhc3>; | 163 | pinctrl-0 = <&pinctrl_usdhc3>; |
163 | bus-width = <4>; | 164 | bus-width = <4>; |
164 | cd-gpios = <&gpio6 11 0>; | 165 | cd-gpios = <&gpio6 11 GPIO_ACTIVE_LOW>; |
165 | vmmc-supply = <®_3p3v>; | 166 | vmmc-supply = <®_3p3v>; |
166 | status = "okay"; | 167 | status = "okay"; |
167 | }; | 168 | }; |
diff --git a/arch/arm/boot/dts/imx6q-tbs2910.dts b/arch/arm/boot/dts/imx6q-tbs2910.dts index a43abfa21e33..5645d52850a7 100644 --- a/arch/arm/boot/dts/imx6q-tbs2910.dts +++ b/arch/arm/boot/dts/imx6q-tbs2910.dts | |||
@@ -251,7 +251,7 @@ | |||
251 | pinctrl-names = "default"; | 251 | pinctrl-names = "default"; |
252 | pinctrl-0 = <&pinctrl_usdhc2>; | 252 | pinctrl-0 = <&pinctrl_usdhc2>; |
253 | bus-width = <4>; | 253 | bus-width = <4>; |
254 | cd-gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>; | 254 | cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; |
255 | vmmc-supply = <®_3p3v>; | 255 | vmmc-supply = <®_3p3v>; |
256 | status = "okay"; | 256 | status = "okay"; |
257 | }; | 257 | }; |
@@ -260,7 +260,7 @@ | |||
260 | pinctrl-names = "default"; | 260 | pinctrl-names = "default"; |
261 | pinctrl-0 = <&pinctrl_usdhc3>; | 261 | pinctrl-0 = <&pinctrl_usdhc3>; |
262 | bus-width = <4>; | 262 | bus-width = <4>; |
263 | cd-gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>; | 263 | cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; |
264 | wp-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>; | 264 | wp-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>; |
265 | vmmc-supply = <®_3p3v>; | 265 | vmmc-supply = <®_3p3v>; |
266 | status = "okay"; | 266 | status = "okay"; |
diff --git a/arch/arm/boot/dts/imx6qdl-aristainetos.dtsi b/arch/arm/boot/dts/imx6qdl-aristainetos.dtsi index e6d9195a1da7..f4d6ae564ead 100644 --- a/arch/arm/boot/dts/imx6qdl-aristainetos.dtsi +++ b/arch/arm/boot/dts/imx6qdl-aristainetos.dtsi | |||
@@ -173,7 +173,7 @@ | |||
173 | pinctrl-names = "default"; | 173 | pinctrl-names = "default"; |
174 | pinctrl-0 = <&pinctrl_usdhc1>; | 174 | pinctrl-0 = <&pinctrl_usdhc1>; |
175 | vmmc-supply = <®_3p3v>; | 175 | vmmc-supply = <®_3p3v>; |
176 | cd-gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; | 176 | cd-gpios = <&gpio4 7 GPIO_ACTIVE_LOW>; |
177 | status = "okay"; | 177 | status = "okay"; |
178 | }; | 178 | }; |
179 | 179 | ||
@@ -181,7 +181,7 @@ | |||
181 | pinctrl-names = "default"; | 181 | pinctrl-names = "default"; |
182 | pinctrl-0 = <&pinctrl_usdhc2>; | 182 | pinctrl-0 = <&pinctrl_usdhc2>; |
183 | vmmc-supply = <®_3p3v>; | 183 | vmmc-supply = <®_3p3v>; |
184 | cd-gpios = <&gpio4 8 GPIO_ACTIVE_HIGH>; | 184 | cd-gpios = <&gpio4 8 GPIO_ACTIVE_LOW>; |
185 | status = "okay"; | 185 | status = "okay"; |
186 | }; | 186 | }; |
187 | 187 | ||
diff --git a/arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi b/arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi index 1d85de2befb3..a47a0399a172 100644 --- a/arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi +++ b/arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi | |||
@@ -392,7 +392,7 @@ | |||
392 | &usdhc1 { | 392 | &usdhc1 { |
393 | pinctrl-names = "default"; | 393 | pinctrl-names = "default"; |
394 | pinctrl-0 = <&pinctrl_usdhc1>; | 394 | pinctrl-0 = <&pinctrl_usdhc1>; |
395 | cd-gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>; | 395 | cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; |
396 | no-1-8-v; | 396 | no-1-8-v; |
397 | status = "okay"; | 397 | status = "okay"; |
398 | }; | 398 | }; |
@@ -400,7 +400,7 @@ | |||
400 | &usdhc2 { | 400 | &usdhc2 { |
401 | pinctrl-names = "default"; | 401 | pinctrl-names = "default"; |
402 | pinctrl-0 = <&pinctrl_usdhc2>; | 402 | pinctrl-0 = <&pinctrl_usdhc2>; |
403 | cd-gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>; | 403 | cd-gpios = <&gpio4 5 GPIO_ACTIVE_LOW>; |
404 | wp-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>; | 404 | wp-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>; |
405 | no-1-8-v; | 405 | no-1-8-v; |
406 | status = "okay"; | 406 | status = "okay"; |
diff --git a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi index 59e5d15e3ec4..ff41f83551de 100644 --- a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi +++ b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi | |||
@@ -258,6 +258,6 @@ | |||
258 | pinctrl-names = "default"; | 258 | pinctrl-names = "default"; |
259 | pinctrl-0 = <&pinctrl_cubox_i_usdhc2_aux &pinctrl_cubox_i_usdhc2>; | 259 | pinctrl-0 = <&pinctrl_cubox_i_usdhc2_aux &pinctrl_cubox_i_usdhc2>; |
260 | vmmc-supply = <®_3p3v>; | 260 | vmmc-supply = <®_3p3v>; |
261 | cd-gpios = <&gpio1 4 0>; | 261 | cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; |
262 | status = "okay"; | 262 | status = "okay"; |
263 | }; | 263 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-dfi-fs700-m60.dtsi b/arch/arm/boot/dts/imx6qdl-dfi-fs700-m60.dtsi index 2c253d6d20bd..45e7c39e80d5 100644 --- a/arch/arm/boot/dts/imx6qdl-dfi-fs700-m60.dtsi +++ b/arch/arm/boot/dts/imx6qdl-dfi-fs700-m60.dtsi | |||
@@ -1,3 +1,5 @@ | |||
1 | #include <dt-bindings/gpio/gpio.h> | ||
2 | |||
1 | / { | 3 | / { |
2 | regulators { | 4 | regulators { |
3 | compatible = "simple-bus"; | 5 | compatible = "simple-bus"; |
@@ -181,7 +183,7 @@ | |||
181 | &usdhc2 { /* module slot */ | 183 | &usdhc2 { /* module slot */ |
182 | pinctrl-names = "default"; | 184 | pinctrl-names = "default"; |
183 | pinctrl-0 = <&pinctrl_usdhc2>; | 185 | pinctrl-0 = <&pinctrl_usdhc2>; |
184 | cd-gpios = <&gpio2 2 0>; | 186 | cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; |
185 | status = "okay"; | 187 | status = "okay"; |
186 | }; | 188 | }; |
187 | 189 | ||
diff --git a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi index b5756c21ea1d..4493f6e99330 100644 --- a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi +++ b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi | |||
@@ -318,7 +318,7 @@ | |||
318 | &usdhc3 { | 318 | &usdhc3 { |
319 | pinctrl-names = "default"; | 319 | pinctrl-names = "default"; |
320 | pinctrl-0 = <&pinctrl_usdhc3>; | 320 | pinctrl-0 = <&pinctrl_usdhc3>; |
321 | cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>; | 321 | cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; |
322 | vmmc-supply = <®_3p3v>; | 322 | vmmc-supply = <®_3p3v>; |
323 | status = "okay"; | 323 | status = "okay"; |
324 | }; | 324 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi index 86f03c1b147c..a857d1294609 100644 --- a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi +++ b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi | |||
@@ -324,7 +324,7 @@ | |||
324 | &usdhc3 { | 324 | &usdhc3 { |
325 | pinctrl-names = "default"; | 325 | pinctrl-names = "default"; |
326 | pinctrl-0 = <&pinctrl_usdhc3>; | 326 | pinctrl-0 = <&pinctrl_usdhc3>; |
327 | cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>; | 327 | cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; |
328 | vmmc-supply = <®_3p3v>; | 328 | vmmc-supply = <®_3p3v>; |
329 | status = "okay"; | 329 | status = "okay"; |
330 | }; | 330 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi index 4a8d97f47759..1afe3385e2d2 100644 --- a/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi +++ b/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi | |||
@@ -417,7 +417,7 @@ | |||
417 | &usdhc3 { | 417 | &usdhc3 { |
418 | pinctrl-names = "default"; | 418 | pinctrl-names = "default"; |
419 | pinctrl-0 = <&pinctrl_usdhc3>; | 419 | pinctrl-0 = <&pinctrl_usdhc3>; |
420 | cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>; | 420 | cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; |
421 | vmmc-supply = <®_3p3v>; | 421 | vmmc-supply = <®_3p3v>; |
422 | status = "okay"; | 422 | status = "okay"; |
423 | }; | 423 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-hummingboard.dtsi b/arch/arm/boot/dts/imx6qdl-hummingboard.dtsi index 62a82f3eba88..6dd0b764e036 100644 --- a/arch/arm/boot/dts/imx6qdl-hummingboard.dtsi +++ b/arch/arm/boot/dts/imx6qdl-hummingboard.dtsi | |||
@@ -299,6 +299,6 @@ | |||
299 | &pinctrl_hummingboard_usdhc2 | 299 | &pinctrl_hummingboard_usdhc2 |
300 | >; | 300 | >; |
301 | vmmc-supply = <®_3p3v>; | 301 | vmmc-supply = <®_3p3v>; |
302 | cd-gpios = <&gpio1 4 0>; | 302 | cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; |
303 | status = "okay"; | 303 | status = "okay"; |
304 | }; | 304 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi index 3af16dfe417b..d7fe6672d00c 100644 --- a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi +++ b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi | |||
@@ -453,7 +453,7 @@ | |||
453 | &usdhc3 { | 453 | &usdhc3 { |
454 | pinctrl-names = "default"; | 454 | pinctrl-names = "default"; |
455 | pinctrl-0 = <&pinctrl_usdhc3>; | 455 | pinctrl-0 = <&pinctrl_usdhc3>; |
456 | cd-gpios = <&gpio7 0 0>; | 456 | cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; |
457 | vmmc-supply = <®_3p3v>; | 457 | vmmc-supply = <®_3p3v>; |
458 | status = "okay"; | 458 | status = "okay"; |
459 | }; | 459 | }; |
@@ -461,7 +461,7 @@ | |||
461 | &usdhc4 { | 461 | &usdhc4 { |
462 | pinctrl-names = "default"; | 462 | pinctrl-names = "default"; |
463 | pinctrl-0 = <&pinctrl_usdhc4>; | 463 | pinctrl-0 = <&pinctrl_usdhc4>; |
464 | cd-gpios = <&gpio2 6 0>; | 464 | cd-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>; |
465 | vmmc-supply = <®_3p3v>; | 465 | vmmc-supply = <®_3p3v>; |
466 | status = "okay"; | 466 | status = "okay"; |
467 | }; | 467 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi index 1ce6133b67f5..9e6ecd99b472 100644 --- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi +++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi | |||
@@ -409,8 +409,8 @@ | |||
409 | &usdhc2 { | 409 | &usdhc2 { |
410 | pinctrl-names = "default"; | 410 | pinctrl-names = "default"; |
411 | pinctrl-0 = <&pinctrl_usdhc2>; | 411 | pinctrl-0 = <&pinctrl_usdhc2>; |
412 | cd-gpios = <&gpio1 4 0>; | 412 | cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; |
413 | wp-gpios = <&gpio1 2 0>; | 413 | wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; |
414 | status = "disabled"; | 414 | status = "disabled"; |
415 | }; | 415 | }; |
416 | 416 | ||
@@ -418,7 +418,7 @@ | |||
418 | pinctrl-names = "default"; | 418 | pinctrl-names = "default"; |
419 | pinctrl-0 = <&pinctrl_usdhc3 | 419 | pinctrl-0 = <&pinctrl_usdhc3 |
420 | &pinctrl_usdhc3_cdwp>; | 420 | &pinctrl_usdhc3_cdwp>; |
421 | cd-gpios = <&gpio1 27 0>; | 421 | cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; |
422 | wp-gpios = <&gpio1 29 0>; | 422 | wp-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>; |
423 | status = "disabled"; | 423 | status = "disabled"; |
424 | }; | 424 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-rex.dtsi b/arch/arm/boot/dts/imx6qdl-rex.dtsi index 488a640796ac..3373fd958e95 100644 --- a/arch/arm/boot/dts/imx6qdl-rex.dtsi +++ b/arch/arm/boot/dts/imx6qdl-rex.dtsi | |||
@@ -342,7 +342,7 @@ | |||
342 | pinctrl-0 = <&pinctrl_usdhc2>; | 342 | pinctrl-0 = <&pinctrl_usdhc2>; |
343 | bus-width = <4>; | 343 | bus-width = <4>; |
344 | cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; | 344 | cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; |
345 | wp-gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; | 345 | wp-gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>; |
346 | status = "okay"; | 346 | status = "okay"; |
347 | }; | 347 | }; |
348 | 348 | ||
@@ -351,6 +351,6 @@ | |||
351 | pinctrl-0 = <&pinctrl_usdhc3>; | 351 | pinctrl-0 = <&pinctrl_usdhc3>; |
352 | bus-width = <4>; | 352 | bus-width = <4>; |
353 | cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; | 353 | cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; |
354 | wp-gpios = <&gpio2 1 GPIO_ACTIVE_LOW>; | 354 | wp-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>; |
355 | status = "okay"; | 355 | status = "okay"; |
356 | }; | 356 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi index 3b24b12651b2..e329ca5c3322 100644 --- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | |||
@@ -467,8 +467,8 @@ | |||
467 | pinctrl-0 = <&pinctrl_usdhc3>; | 467 | pinctrl-0 = <&pinctrl_usdhc3>; |
468 | pinctrl-1 = <&pinctrl_usdhc3_100mhz>; | 468 | pinctrl-1 = <&pinctrl_usdhc3_100mhz>; |
469 | pinctrl-2 = <&pinctrl_usdhc3_200mhz>; | 469 | pinctrl-2 = <&pinctrl_usdhc3_200mhz>; |
470 | cd-gpios = <&gpio6 15 0>; | 470 | cd-gpios = <&gpio6 15 GPIO_ACTIVE_LOW>; |
471 | wp-gpios = <&gpio1 13 0>; | 471 | wp-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; |
472 | status = "okay"; | 472 | status = "okay"; |
473 | }; | 473 | }; |
474 | 474 | ||
diff --git a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi index e00c44f6a0df..782379320517 100644 --- a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +++ b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi | |||
@@ -448,8 +448,8 @@ | |||
448 | &usdhc3 { | 448 | &usdhc3 { |
449 | pinctrl-names = "default"; | 449 | pinctrl-names = "default"; |
450 | pinctrl-0 = <&pinctrl_usdhc3>; | 450 | pinctrl-0 = <&pinctrl_usdhc3>; |
451 | cd-gpios = <&gpio7 0 0>; | 451 | cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; |
452 | wp-gpios = <&gpio7 1 0>; | 452 | wp-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>; |
453 | vmmc-supply = <®_3p3v>; | 453 | vmmc-supply = <®_3p3v>; |
454 | status = "okay"; | 454 | status = "okay"; |
455 | }; | 455 | }; |
@@ -457,7 +457,7 @@ | |||
457 | &usdhc4 { | 457 | &usdhc4 { |
458 | pinctrl-names = "default"; | 458 | pinctrl-names = "default"; |
459 | pinctrl-0 = <&pinctrl_usdhc4>; | 459 | pinctrl-0 = <&pinctrl_usdhc4>; |
460 | cd-gpios = <&gpio2 6 0>; | 460 | cd-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>; |
461 | vmmc-supply = <®_3p3v>; | 461 | vmmc-supply = <®_3p3v>; |
462 | status = "okay"; | 462 | status = "okay"; |
463 | }; | 463 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi index a626e6dd8022..944eb81cb2b8 100644 --- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi +++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi | |||
@@ -562,8 +562,8 @@ | |||
562 | pinctrl-names = "default"; | 562 | pinctrl-names = "default"; |
563 | pinctrl-0 = <&pinctrl_usdhc2>; | 563 | pinctrl-0 = <&pinctrl_usdhc2>; |
564 | bus-width = <8>; | 564 | bus-width = <8>; |
565 | cd-gpios = <&gpio2 2 0>; | 565 | cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; |
566 | wp-gpios = <&gpio2 3 0>; | 566 | wp-gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>; |
567 | status = "okay"; | 567 | status = "okay"; |
568 | }; | 568 | }; |
569 | 569 | ||
@@ -571,8 +571,8 @@ | |||
571 | pinctrl-names = "default"; | 571 | pinctrl-names = "default"; |
572 | pinctrl-0 = <&pinctrl_usdhc3>; | 572 | pinctrl-0 = <&pinctrl_usdhc3>; |
573 | bus-width = <8>; | 573 | bus-width = <8>; |
574 | cd-gpios = <&gpio2 0 0>; | 574 | cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; |
575 | wp-gpios = <&gpio2 1 0>; | 575 | wp-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>; |
576 | status = "okay"; | 576 | status = "okay"; |
577 | }; | 577 | }; |
578 | 578 | ||
diff --git a/arch/arm/boot/dts/imx6qdl-tx6.dtsi b/arch/arm/boot/dts/imx6qdl-tx6.dtsi index f02b80b41d4f..da08de324e9e 100644 --- a/arch/arm/boot/dts/imx6qdl-tx6.dtsi +++ b/arch/arm/boot/dts/imx6qdl-tx6.dtsi | |||
@@ -680,7 +680,7 @@ | |||
680 | pinctrl-0 = <&pinctrl_usdhc1>; | 680 | pinctrl-0 = <&pinctrl_usdhc1>; |
681 | bus-width = <4>; | 681 | bus-width = <4>; |
682 | no-1-8-v; | 682 | no-1-8-v; |
683 | cd-gpios = <&gpio7 2 0>; | 683 | cd-gpios = <&gpio7 2 GPIO_ACTIVE_LOW>; |
684 | fsl,wp-controller; | 684 | fsl,wp-controller; |
685 | status = "okay"; | 685 | status = "okay"; |
686 | }; | 686 | }; |
@@ -690,7 +690,7 @@ | |||
690 | pinctrl-0 = <&pinctrl_usdhc2>; | 690 | pinctrl-0 = <&pinctrl_usdhc2>; |
691 | bus-width = <4>; | 691 | bus-width = <4>; |
692 | no-1-8-v; | 692 | no-1-8-v; |
693 | cd-gpios = <&gpio7 3 0>; | 693 | cd-gpios = <&gpio7 3 GPIO_ACTIVE_LOW>; |
694 | fsl,wp-controller; | 694 | fsl,wp-controller; |
695 | status = "okay"; | 695 | status = "okay"; |
696 | }; | 696 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi index 5fb091675582..9e096d811bed 100644 --- a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi +++ b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi | |||
@@ -9,6 +9,8 @@ | |||
9 | * | 9 | * |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <dt-bindings/gpio/gpio.h> | ||
13 | |||
12 | / { | 14 | / { |
13 | regulators { | 15 | regulators { |
14 | compatible = "simple-bus"; | 16 | compatible = "simple-bus"; |
@@ -250,13 +252,13 @@ | |||
250 | &usdhc1 { | 252 | &usdhc1 { |
251 | pinctrl-names = "default"; | 253 | pinctrl-names = "default"; |
252 | pinctrl-0 = <&pinctrl_usdhc1>; | 254 | pinctrl-0 = <&pinctrl_usdhc1>; |
253 | cd-gpios = <&gpio1 2 0>; | 255 | cd-gpios = <&gpio1 2 GPIO_ACTIVE_LOW>; |
254 | status = "okay"; | 256 | status = "okay"; |
255 | }; | 257 | }; |
256 | 258 | ||
257 | &usdhc3 { | 259 | &usdhc3 { |
258 | pinctrl-names = "default"; | 260 | pinctrl-names = "default"; |
259 | pinctrl-0 = <&pinctrl_usdhc3>; | 261 | pinctrl-0 = <&pinctrl_usdhc3>; |
260 | cd-gpios = <&gpio3 9 0>; | 262 | cd-gpios = <&gpio3 9 GPIO_ACTIVE_LOW>; |
261 | status = "okay"; | 263 | status = "okay"; |
262 | }; | 264 | }; |
diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts index 945887d3fdb3..b84dff2e94ea 100644 --- a/arch/arm/boot/dts/imx6sl-evk.dts +++ b/arch/arm/boot/dts/imx6sl-evk.dts | |||
@@ -617,8 +617,8 @@ | |||
617 | pinctrl-1 = <&pinctrl_usdhc1_100mhz>; | 617 | pinctrl-1 = <&pinctrl_usdhc1_100mhz>; |
618 | pinctrl-2 = <&pinctrl_usdhc1_200mhz>; | 618 | pinctrl-2 = <&pinctrl_usdhc1_200mhz>; |
619 | bus-width = <8>; | 619 | bus-width = <8>; |
620 | cd-gpios = <&gpio4 7 0>; | 620 | cd-gpios = <&gpio4 7 GPIO_ACTIVE_LOW>; |
621 | wp-gpios = <&gpio4 6 0>; | 621 | wp-gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; |
622 | status = "okay"; | 622 | status = "okay"; |
623 | }; | 623 | }; |
624 | 624 | ||
@@ -627,8 +627,8 @@ | |||
627 | pinctrl-0 = <&pinctrl_usdhc2>; | 627 | pinctrl-0 = <&pinctrl_usdhc2>; |
628 | pinctrl-1 = <&pinctrl_usdhc2_100mhz>; | 628 | pinctrl-1 = <&pinctrl_usdhc2_100mhz>; |
629 | pinctrl-2 = <&pinctrl_usdhc2_200mhz>; | 629 | pinctrl-2 = <&pinctrl_usdhc2_200mhz>; |
630 | cd-gpios = <&gpio5 0 0>; | 630 | cd-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; |
631 | wp-gpios = <&gpio4 29 0>; | 631 | wp-gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>; |
632 | status = "okay"; | 632 | status = "okay"; |
633 | }; | 633 | }; |
634 | 634 | ||
@@ -637,6 +637,6 @@ | |||
637 | pinctrl-0 = <&pinctrl_usdhc3>; | 637 | pinctrl-0 = <&pinctrl_usdhc3>; |
638 | pinctrl-1 = <&pinctrl_usdhc3_100mhz>; | 638 | pinctrl-1 = <&pinctrl_usdhc3_100mhz>; |
639 | pinctrl-2 = <&pinctrl_usdhc3_200mhz>; | 639 | pinctrl-2 = <&pinctrl_usdhc3_200mhz>; |
640 | cd-gpios = <&gpio3 22 0>; | 640 | cd-gpios = <&gpio3 22 GPIO_ACTIVE_LOW>; |
641 | status = "okay"; | 641 | status = "okay"; |
642 | }; | 642 | }; |
diff --git a/arch/arm/boot/dts/imx6sx-sabreauto.dts b/arch/arm/boot/dts/imx6sx-sabreauto.dts index e3c0b63c2205..115f3fd78971 100644 --- a/arch/arm/boot/dts/imx6sx-sabreauto.dts +++ b/arch/arm/boot/dts/imx6sx-sabreauto.dts | |||
@@ -49,7 +49,7 @@ | |||
49 | pinctrl-1 = <&pinctrl_usdhc3_100mhz>; | 49 | pinctrl-1 = <&pinctrl_usdhc3_100mhz>; |
50 | pinctrl-2 = <&pinctrl_usdhc3_200mhz>; | 50 | pinctrl-2 = <&pinctrl_usdhc3_200mhz>; |
51 | bus-width = <8>; | 51 | bus-width = <8>; |
52 | cd-gpios = <&gpio7 10 GPIO_ACTIVE_HIGH>; | 52 | cd-gpios = <&gpio7 10 GPIO_ACTIVE_LOW>; |
53 | wp-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>; | 53 | wp-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>; |
54 | keep-power-in-suspend; | 54 | keep-power-in-suspend; |
55 | enable-sdio-wakeup; | 55 | enable-sdio-wakeup; |
@@ -61,7 +61,7 @@ | |||
61 | pinctrl-names = "default"; | 61 | pinctrl-names = "default"; |
62 | pinctrl-0 = <&pinctrl_usdhc4>; | 62 | pinctrl-0 = <&pinctrl_usdhc4>; |
63 | bus-width = <8>; | 63 | bus-width = <8>; |
64 | cd-gpios = <&gpio7 11 GPIO_ACTIVE_HIGH>; | 64 | cd-gpios = <&gpio7 11 GPIO_ACTIVE_LOW>; |
65 | no-1-8-v; | 65 | no-1-8-v; |
66 | keep-power-in-suspend; | 66 | keep-power-in-suspend; |
67 | enable-sdio-wakup; | 67 | enable-sdio-wakup; |
diff --git a/arch/arm/boot/dts/imx6sx-sdb.dtsi b/arch/arm/boot/dts/imx6sx-sdb.dtsi index cef04cef3a80..ac88c3467078 100644 --- a/arch/arm/boot/dts/imx6sx-sdb.dtsi +++ b/arch/arm/boot/dts/imx6sx-sdb.dtsi | |||
@@ -293,7 +293,7 @@ | |||
293 | pinctrl-1 = <&pinctrl_usdhc3_100mhz>; | 293 | pinctrl-1 = <&pinctrl_usdhc3_100mhz>; |
294 | pinctrl-2 = <&pinctrl_usdhc3_200mhz>; | 294 | pinctrl-2 = <&pinctrl_usdhc3_200mhz>; |
295 | bus-width = <8>; | 295 | bus-width = <8>; |
296 | cd-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>; | 296 | cd-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>; |
297 | wp-gpios = <&gpio2 15 GPIO_ACTIVE_HIGH>; | 297 | wp-gpios = <&gpio2 15 GPIO_ACTIVE_HIGH>; |
298 | keep-power-in-suspend; | 298 | keep-power-in-suspend; |
299 | enable-sdio-wakeup; | 299 | enable-sdio-wakeup; |
@@ -304,7 +304,7 @@ | |||
304 | &usdhc4 { | 304 | &usdhc4 { |
305 | pinctrl-names = "default"; | 305 | pinctrl-names = "default"; |
306 | pinctrl-0 = <&pinctrl_usdhc4>; | 306 | pinctrl-0 = <&pinctrl_usdhc4>; |
307 | cd-gpios = <&gpio6 21 GPIO_ACTIVE_HIGH>; | 307 | cd-gpios = <&gpio6 21 GPIO_ACTIVE_LOW>; |
308 | wp-gpios = <&gpio6 20 GPIO_ACTIVE_HIGH>; | 308 | wp-gpios = <&gpio6 20 GPIO_ACTIVE_HIGH>; |
309 | status = "okay"; | 309 | status = "okay"; |
310 | }; | 310 | }; |
diff --git a/arch/arm/boot/dts/imx7d-sdb.dts b/arch/arm/boot/dts/imx7d-sdb.dts index 4d1a4b977d84..fdd1d7c9a5cc 100644 --- a/arch/arm/boot/dts/imx7d-sdb.dts +++ b/arch/arm/boot/dts/imx7d-sdb.dts | |||
@@ -234,8 +234,8 @@ | |||
234 | &usdhc1 { | 234 | &usdhc1 { |
235 | pinctrl-names = "default"; | 235 | pinctrl-names = "default"; |
236 | pinctrl-0 = <&pinctrl_usdhc1>; | 236 | pinctrl-0 = <&pinctrl_usdhc1>; |
237 | cd-gpios = <&gpio5 0 0>; | 237 | cd-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; |
238 | wp-gpios = <&gpio5 1 0>; | 238 | wp-gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>; |
239 | enable-sdio-wakeup; | 239 | enable-sdio-wakeup; |
240 | keep-power-in-suspend; | 240 | keep-power-in-suspend; |
241 | status = "okay"; | 241 | status = "okay"; |
diff --git a/arch/arm/boot/dts/k2e.dtsi b/arch/arm/boot/dts/k2e.dtsi index 50e555eab50d..1b6494fbdb91 100644 --- a/arch/arm/boot/dts/k2e.dtsi +++ b/arch/arm/boot/dts/k2e.dtsi | |||
@@ -86,7 +86,7 @@ | |||
86 | gpio,syscon-dev = <&devctrl 0x240>; | 86 | gpio,syscon-dev = <&devctrl 0x240>; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | pcie@21020000 { | 89 | pcie1: pcie@21020000 { |
90 | compatible = "ti,keystone-pcie","snps,dw-pcie"; | 90 | compatible = "ti,keystone-pcie","snps,dw-pcie"; |
91 | clocks = <&clkpcie1>; | 91 | clocks = <&clkpcie1>; |
92 | clock-names = "pcie"; | 92 | clock-names = "pcie"; |
@@ -96,6 +96,7 @@ | |||
96 | ranges = <0x81000000 0 0 0x23260000 0x4000 0x4000 | 96 | ranges = <0x81000000 0 0 0x23260000 0x4000 0x4000 |
97 | 0x82000000 0 0x60000000 0x60000000 0 0x10000000>; | 97 | 0x82000000 0 0x60000000 0x60000000 0 0x10000000>; |
98 | 98 | ||
99 | status = "disabled"; | ||
99 | device_type = "pci"; | 100 | device_type = "pci"; |
100 | num-lanes = <2>; | 101 | num-lanes = <2>; |
101 | 102 | ||
diff --git a/arch/arm/boot/dts/keystone.dtsi b/arch/arm/boot/dts/keystone.dtsi index c06542b2c954..e7a6f6deabb6 100644 --- a/arch/arm/boot/dts/keystone.dtsi +++ b/arch/arm/boot/dts/keystone.dtsi | |||
@@ -286,7 +286,7 @@ | |||
286 | ti,syscon-dev = <&devctrl 0x2a0>; | 286 | ti,syscon-dev = <&devctrl 0x2a0>; |
287 | }; | 287 | }; |
288 | 288 | ||
289 | pcie@21800000 { | 289 | pcie0: pcie@21800000 { |
290 | compatible = "ti,keystone-pcie", "snps,dw-pcie"; | 290 | compatible = "ti,keystone-pcie", "snps,dw-pcie"; |
291 | clocks = <&clkpcie>; | 291 | clocks = <&clkpcie>; |
292 | clock-names = "pcie"; | 292 | clock-names = "pcie"; |
@@ -296,6 +296,7 @@ | |||
296 | ranges = <0x81000000 0 0 0x23250000 0 0x4000 | 296 | ranges = <0x81000000 0 0 0x23250000 0 0x4000 |
297 | 0x82000000 0 0x50000000 0x50000000 0 0x10000000>; | 297 | 0x82000000 0 0x50000000 0x50000000 0 0x10000000>; |
298 | 298 | ||
299 | status = "disabled"; | ||
299 | device_type = "pci"; | 300 | device_type = "pci"; |
300 | num-lanes = <2>; | 301 | num-lanes = <2>; |
301 | 302 | ||
diff --git a/arch/arm/boot/dts/omap3-overo-common-lcd35.dtsi b/arch/arm/boot/dts/omap3-overo-common-lcd35.dtsi index 233c69e50ae3..df8908adb0cb 100644 --- a/arch/arm/boot/dts/omap3-overo-common-lcd35.dtsi +++ b/arch/arm/boot/dts/omap3-overo-common-lcd35.dtsi | |||
@@ -120,7 +120,7 @@ | |||
120 | 120 | ||
121 | lcd0: display@0 { | 121 | lcd0: display@0 { |
122 | compatible = "lgphilips,lb035q02"; | 122 | compatible = "lgphilips,lb035q02"; |
123 | label = "lcd"; | 123 | label = "lcd35"; |
124 | 124 | ||
125 | reg = <1>; /* CS1 */ | 125 | reg = <1>; /* CS1 */ |
126 | spi-max-frequency = <10000000>; | 126 | spi-max-frequency = <10000000>; |
diff --git a/arch/arm/boot/dts/omap3-overo-common-lcd43.dtsi b/arch/arm/boot/dts/omap3-overo-common-lcd43.dtsi index f5395b7da912..048fd216970a 100644 --- a/arch/arm/boot/dts/omap3-overo-common-lcd43.dtsi +++ b/arch/arm/boot/dts/omap3-overo-common-lcd43.dtsi | |||
@@ -98,7 +98,7 @@ | |||
98 | 98 | ||
99 | lcd0: display@0 { | 99 | lcd0: display@0 { |
100 | compatible = "samsung,lte430wq-f0c", "panel-dpi"; | 100 | compatible = "samsung,lte430wq-f0c", "panel-dpi"; |
101 | label = "lcd"; | 101 | label = "lcd43"; |
102 | 102 | ||
103 | pinctrl-names = "default"; | 103 | pinctrl-names = "default"; |
104 | pinctrl-0 = <<e430_pins>; | 104 | pinctrl-0 = <<e430_pins>; |
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index f884d6adb71e..7d31c6ff246f 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi | |||
@@ -551,6 +551,7 @@ | |||
551 | reg = <0x4a066000 0x100>; | 551 | reg = <0x4a066000 0x100>; |
552 | interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>; | 552 | interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>; |
553 | ti,hwmods = "mmu_dsp"; | 553 | ti,hwmods = "mmu_dsp"; |
554 | #iommu-cells = <0>; | ||
554 | }; | 555 | }; |
555 | 556 | ||
556 | mmu_ipu: mmu@55082000 { | 557 | mmu_ipu: mmu@55082000 { |
@@ -558,6 +559,7 @@ | |||
558 | reg = <0x55082000 0x100>; | 559 | reg = <0x55082000 0x100>; |
559 | interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>; | 560 | interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>; |
560 | ti,hwmods = "mmu_ipu"; | 561 | ti,hwmods = "mmu_ipu"; |
562 | #iommu-cells = <0>; | ||
561 | ti,iommu-bus-err-back; | 563 | ti,iommu-bus-err-back; |
562 | }; | 564 | }; |
563 | 565 | ||
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi index 7d24ae0306b5..c8fd648a7108 100644 --- a/arch/arm/boot/dts/omap5.dtsi +++ b/arch/arm/boot/dts/omap5.dtsi | |||
@@ -612,6 +612,7 @@ | |||
612 | reg = <0x4a066000 0x100>; | 612 | reg = <0x4a066000 0x100>; |
613 | interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>; | 613 | interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>; |
614 | ti,hwmods = "mmu_dsp"; | 614 | ti,hwmods = "mmu_dsp"; |
615 | #iommu-cells = <0>; | ||
615 | }; | 616 | }; |
616 | 617 | ||
617 | mmu_ipu: mmu@55082000 { | 618 | mmu_ipu: mmu@55082000 { |
@@ -619,6 +620,7 @@ | |||
619 | reg = <0x55082000 0x100>; | 620 | reg = <0x55082000 0x100>; |
620 | interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>; | 621 | interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>; |
621 | ti,hwmods = "mmu_ipu"; | 622 | ti,hwmods = "mmu_ipu"; |
623 | #iommu-cells = <0>; | ||
622 | ti,iommu-bus-err-back; | 624 | ti,iommu-bus-err-back; |
623 | }; | 625 | }; |
624 | 626 | ||
diff --git a/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts b/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts index 71468a7eb28f..5e17fd147728 100644 --- a/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts +++ b/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts | |||
@@ -60,27 +60,27 @@ | |||
60 | rxc-skew-ps = <2000>; | 60 | rxc-skew-ps = <2000>; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | &mmc0 { | ||
64 | vmmc-supply = <®ulator_3_3v>; | ||
65 | vqmmc-supply = <®ulator_3_3v>; | ||
66 | }; | ||
67 | |||
68 | &usb1 { | ||
69 | status = "okay"; | ||
70 | }; | ||
71 | |||
72 | &gpio2 { | 63 | &gpio2 { |
73 | status = "okay"; | 64 | status = "okay"; |
74 | }; | 65 | }; |
75 | 66 | ||
76 | &i2c1{ | 67 | &i2c1 { |
77 | status = "okay"; | 68 | status = "okay"; |
78 | 69 | ||
79 | accel1: accel1@53{ | 70 | accel1: accelerometer@53 { |
80 | compatible = "adxl34x"; | 71 | compatible = "adi,adxl345"; |
81 | reg = <0x53>; | 72 | reg = <0x53>; |
82 | 73 | ||
83 | interrupt-parent = < &portc >; | 74 | interrupt-parent = <&portc>; |
84 | interrupts = <3 2>; | 75 | interrupts = <3 2>; |
85 | }; | 76 | }; |
86 | }; | 77 | }; |
78 | |||
79 | &mmc0 { | ||
80 | vmmc-supply = <®ulator_3_3v>; | ||
81 | vqmmc-supply = <®ulator_3_3v>; | ||
82 | }; | ||
83 | |||
84 | &usb1 { | ||
85 | status = "okay"; | ||
86 | }; | ||
diff --git a/arch/arm/boot/dts/spear1310-evb.dts b/arch/arm/boot/dts/spear1310-evb.dts index d42c84b1df8d..e48857249ce7 100644 --- a/arch/arm/boot/dts/spear1310-evb.dts +++ b/arch/arm/boot/dts/spear1310-evb.dts | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DTS file for SPEAr1310 Evaluation Baord | 2 | * DTS file for SPEAr1310 Evaluation Baord |
3 | * | 3 | * |
4 | * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> | 4 | * Copyright 2012 Viresh Kumar <vireshk@kernel.org> |
5 | * | 5 | * |
6 | * The code contained herein is licensed under the GNU General Public | 6 | * The code contained herein is licensed under the GNU General Public |
7 | * License. You may obtain a copy of the GNU General Public License | 7 | * License. You may obtain a copy of the GNU General Public License |
diff --git a/arch/arm/boot/dts/spear1310.dtsi b/arch/arm/boot/dts/spear1310.dtsi index 9d342920695a..54bc6d3cf290 100644 --- a/arch/arm/boot/dts/spear1310.dtsi +++ b/arch/arm/boot/dts/spear1310.dtsi | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DTS file for all SPEAr1310 SoCs | 2 | * DTS file for all SPEAr1310 SoCs |
3 | * | 3 | * |
4 | * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> | 4 | * Copyright 2012 Viresh Kumar <vireshk@kernel.org> |
5 | * | 5 | * |
6 | * The code contained herein is licensed under the GNU General Public | 6 | * The code contained herein is licensed under the GNU General Public |
7 | * License. You may obtain a copy of the GNU General Public License | 7 | * License. You may obtain a copy of the GNU General Public License |
diff --git a/arch/arm/boot/dts/spear1340-evb.dts b/arch/arm/boot/dts/spear1340-evb.dts index b23e05ed1d60..c611f5606dfe 100644 --- a/arch/arm/boot/dts/spear1340-evb.dts +++ b/arch/arm/boot/dts/spear1340-evb.dts | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DTS file for SPEAr1340 Evaluation Baord | 2 | * DTS file for SPEAr1340 Evaluation Baord |
3 | * | 3 | * |
4 | * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> | 4 | * Copyright 2012 Viresh Kumar <vireshk@kernel.org> |
5 | * | 5 | * |
6 | * The code contained herein is licensed under the GNU General Public | 6 | * The code contained herein is licensed under the GNU General Public |
7 | * License. You may obtain a copy of the GNU General Public License | 7 | * License. You may obtain a copy of the GNU General Public License |
diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi index 13e1aa33daa2..df2232d767ed 100644 --- a/arch/arm/boot/dts/spear1340.dtsi +++ b/arch/arm/boot/dts/spear1340.dtsi | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DTS file for all SPEAr1340 SoCs | 2 | * DTS file for all SPEAr1340 SoCs |
3 | * | 3 | * |
4 | * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> | 4 | * Copyright 2012 Viresh Kumar <vireshk@kernel.org> |
5 | * | 5 | * |
6 | * The code contained herein is licensed under the GNU General Public | 6 | * The code contained herein is licensed under the GNU General Public |
7 | * License. You may obtain a copy of the GNU General Public License | 7 | * License. You may obtain a copy of the GNU General Public License |
diff --git a/arch/arm/boot/dts/spear13xx.dtsi b/arch/arm/boot/dts/spear13xx.dtsi index 40accc87e3a2..14594ce8c18a 100644 --- a/arch/arm/boot/dts/spear13xx.dtsi +++ b/arch/arm/boot/dts/spear13xx.dtsi | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DTS file for all SPEAr13xx SoCs | 2 | * DTS file for all SPEAr13xx SoCs |
3 | * | 3 | * |
4 | * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> | 4 | * Copyright 2012 Viresh Kumar <vireshk@kernel.org> |
5 | * | 5 | * |
6 | * The code contained herein is licensed under the GNU General Public | 6 | * The code contained herein is licensed under the GNU General Public |
7 | * License. You may obtain a copy of the GNU General Public License | 7 | * License. You may obtain a copy of the GNU General Public License |
diff --git a/arch/arm/boot/dts/spear300-evb.dts b/arch/arm/boot/dts/spear300-evb.dts index 5de1431653e4..e859e8288bcd 100644 --- a/arch/arm/boot/dts/spear300-evb.dts +++ b/arch/arm/boot/dts/spear300-evb.dts | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DTS file for SPEAr300 Evaluation Baord | 2 | * DTS file for SPEAr300 Evaluation Baord |
3 | * | 3 | * |
4 | * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> | 4 | * Copyright 2012 Viresh Kumar <vireshk@kernel.org> |
5 | * | 5 | * |
6 | * The code contained herein is licensed under the GNU General Public | 6 | * The code contained herein is licensed under the GNU General Public |
7 | * License. You may obtain a copy of the GNU General Public License | 7 | * License. You may obtain a copy of the GNU General Public License |
diff --git a/arch/arm/boot/dts/spear300.dtsi b/arch/arm/boot/dts/spear300.dtsi index f79b3dfaabe6..f4e92e599729 100644 --- a/arch/arm/boot/dts/spear300.dtsi +++ b/arch/arm/boot/dts/spear300.dtsi | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DTS file for SPEAr300 SoC | 2 | * DTS file for SPEAr300 SoC |
3 | * | 3 | * |
4 | * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> | 4 | * Copyright 2012 Viresh Kumar <vireshk@kernel.org> |
5 | * | 5 | * |
6 | * The code contained herein is licensed under the GNU General Public | 6 | * The code contained herein is licensed under the GNU General Public |
7 | * License. You may obtain a copy of the GNU General Public License | 7 | * License. You may obtain a copy of the GNU General Public License |
diff --git a/arch/arm/boot/dts/spear310-evb.dts b/arch/arm/boot/dts/spear310-evb.dts index b09632963d15..070f2c1b7851 100644 --- a/arch/arm/boot/dts/spear310-evb.dts +++ b/arch/arm/boot/dts/spear310-evb.dts | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DTS file for SPEAr310 Evaluation Baord | 2 | * DTS file for SPEAr310 Evaluation Baord |
3 | * | 3 | * |
4 | * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> | 4 | * Copyright 2012 Viresh Kumar <vireshk@kernel.org> |
5 | * | 5 | * |
6 | * The code contained herein is licensed under the GNU General Public | 6 | * The code contained herein is licensed under the GNU General Public |
7 | * License. You may obtain a copy of the GNU General Public License | 7 | * License. You may obtain a copy of the GNU General Public License |
diff --git a/arch/arm/boot/dts/spear310.dtsi b/arch/arm/boot/dts/spear310.dtsi index 95372080eea6..da210b454753 100644 --- a/arch/arm/boot/dts/spear310.dtsi +++ b/arch/arm/boot/dts/spear310.dtsi | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DTS file for SPEAr310 SoC | 2 | * DTS file for SPEAr310 SoC |
3 | * | 3 | * |
4 | * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> | 4 | * Copyright 2012 Viresh Kumar <vireshk@kernel.org> |
5 | * | 5 | * |
6 | * The code contained herein is licensed under the GNU General Public | 6 | * The code contained herein is licensed under the GNU General Public |
7 | * License. You may obtain a copy of the GNU General Public License | 7 | * License. You may obtain a copy of the GNU General Public License |
diff --git a/arch/arm/boot/dts/spear320-evb.dts b/arch/arm/boot/dts/spear320-evb.dts index fdedbb514102..1b1034477923 100644 --- a/arch/arm/boot/dts/spear320-evb.dts +++ b/arch/arm/boot/dts/spear320-evb.dts | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DTS file for SPEAr320 Evaluation Baord | 2 | * DTS file for SPEAr320 Evaluation Baord |
3 | * | 3 | * |
4 | * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> | 4 | * Copyright 2012 Viresh Kumar <vireshk@kernel.org> |
5 | * | 5 | * |
6 | * The code contained herein is licensed under the GNU General Public | 6 | * The code contained herein is licensed under the GNU General Public |
7 | * License. You may obtain a copy of the GNU General Public License | 7 | * License. You may obtain a copy of the GNU General Public License |
diff --git a/arch/arm/boot/dts/spear320.dtsi b/arch/arm/boot/dts/spear320.dtsi index ffea342aeec9..22be6e5edaac 100644 --- a/arch/arm/boot/dts/spear320.dtsi +++ b/arch/arm/boot/dts/spear320.dtsi | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DTS file for SPEAr320 SoC | 2 | * DTS file for SPEAr320 SoC |
3 | * | 3 | * |
4 | * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> | 4 | * Copyright 2012 Viresh Kumar <vireshk@kernel.org> |
5 | * | 5 | * |
6 | * The code contained herein is licensed under the GNU General Public | 6 | * The code contained herein is licensed under the GNU General Public |
7 | * License. You may obtain a copy of the GNU General Public License | 7 | * License. You may obtain a copy of the GNU General Public License |
diff --git a/arch/arm/boot/dts/spear3xx.dtsi b/arch/arm/boot/dts/spear3xx.dtsi index f0e3fcf8e323..118135d75899 100644 --- a/arch/arm/boot/dts/spear3xx.dtsi +++ b/arch/arm/boot/dts/spear3xx.dtsi | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DTS file for all SPEAr3xx SoCs | 2 | * DTS file for all SPEAr3xx SoCs |
3 | * | 3 | * |
4 | * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> | 4 | * Copyright 2012 Viresh Kumar <vireshk@kernel.org> |
5 | * | 5 | * |
6 | * The code contained herein is licensed under the GNU General Public | 6 | * The code contained herein is licensed under the GNU General Public |
7 | * License. You may obtain a copy of the GNU General Public License | 7 | * License. You may obtain a copy of the GNU General Public License |
diff --git a/arch/arm/boot/dts/ste-ccu8540.dts b/arch/arm/boot/dts/ste-ccu8540.dts index 32dd55e5f4e6..6eaaf638e52e 100644 --- a/arch/arm/boot/dts/ste-ccu8540.dts +++ b/arch/arm/boot/dts/ste-ccu8540.dts | |||
@@ -17,6 +17,13 @@ | |||
17 | model = "ST-Ericsson U8540 platform with Device Tree"; | 17 | model = "ST-Ericsson U8540 platform with Device Tree"; |
18 | compatible = "st-ericsson,ccu8540", "st-ericsson,u8540"; | 18 | compatible = "st-ericsson,ccu8540", "st-ericsson,u8540"; |
19 | 19 | ||
20 | /* This stablilizes the serial port enumeration */ | ||
21 | aliases { | ||
22 | serial0 = &ux500_serial0; | ||
23 | serial1 = &ux500_serial1; | ||
24 | serial2 = &ux500_serial2; | ||
25 | }; | ||
26 | |||
20 | memory@0 { | 27 | memory@0 { |
21 | device_type = "memory"; | 28 | device_type = "memory"; |
22 | reg = <0x20000000 0x1f000000>, <0xc0000000 0x3f000000>; | 29 | reg = <0x20000000 0x1f000000>, <0xc0000000 0x3f000000>; |
diff --git a/arch/arm/boot/dts/ste-ccu9540.dts b/arch/arm/boot/dts/ste-ccu9540.dts index 651c56d400a4..c8b815819cfe 100644 --- a/arch/arm/boot/dts/ste-ccu9540.dts +++ b/arch/arm/boot/dts/ste-ccu9540.dts | |||
@@ -16,6 +16,13 @@ | |||
16 | model = "ST-Ericsson CCU9540 platform with Device Tree"; | 16 | model = "ST-Ericsson CCU9540 platform with Device Tree"; |
17 | compatible = "st-ericsson,ccu9540", "st-ericsson,u9540"; | 17 | compatible = "st-ericsson,ccu9540", "st-ericsson,u9540"; |
18 | 18 | ||
19 | /* This stablilizes the serial port enumeration */ | ||
20 | aliases { | ||
21 | serial0 = &ux500_serial0; | ||
22 | serial1 = &ux500_serial1; | ||
23 | serial2 = &ux500_serial2; | ||
24 | }; | ||
25 | |||
19 | memory { | 26 | memory { |
20 | reg = <0x00000000 0x20000000>; | 27 | reg = <0x00000000 0x20000000>; |
21 | }; | 28 | }; |
diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi index 853684ad7773..a75f3289e653 100644 --- a/arch/arm/boot/dts/ste-dbx5x0.dtsi +++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi | |||
@@ -971,7 +971,7 @@ | |||
971 | power-domains = <&pm_domains DOMAIN_VAPE>; | 971 | power-domains = <&pm_domains DOMAIN_VAPE>; |
972 | }; | 972 | }; |
973 | 973 | ||
974 | uart@80120000 { | 974 | ux500_serial0: uart@80120000 { |
975 | compatible = "arm,pl011", "arm,primecell"; | 975 | compatible = "arm,pl011", "arm,primecell"; |
976 | reg = <0x80120000 0x1000>; | 976 | reg = <0x80120000 0x1000>; |
977 | interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>; | 977 | interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>; |
@@ -986,7 +986,7 @@ | |||
986 | status = "disabled"; | 986 | status = "disabled"; |
987 | }; | 987 | }; |
988 | 988 | ||
989 | uart@80121000 { | 989 | ux500_serial1: uart@80121000 { |
990 | compatible = "arm,pl011", "arm,primecell"; | 990 | compatible = "arm,pl011", "arm,primecell"; |
991 | reg = <0x80121000 0x1000>; | 991 | reg = <0x80121000 0x1000>; |
992 | interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>; | 992 | interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>; |
@@ -1001,7 +1001,7 @@ | |||
1001 | status = "disabled"; | 1001 | status = "disabled"; |
1002 | }; | 1002 | }; |
1003 | 1003 | ||
1004 | uart@80007000 { | 1004 | ux500_serial2: uart@80007000 { |
1005 | compatible = "arm,pl011", "arm,primecell"; | 1005 | compatible = "arm,pl011", "arm,primecell"; |
1006 | reg = <0x80007000 0x1000>; | 1006 | reg = <0x80007000 0x1000>; |
1007 | interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>; | 1007 | interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>; |
diff --git a/arch/arm/boot/dts/ste-href.dtsi b/arch/arm/boot/dts/ste-href.dtsi index 744c1e3a744d..6d8ce154347e 100644 --- a/arch/arm/boot/dts/ste-href.dtsi +++ b/arch/arm/boot/dts/ste-href.dtsi | |||
@@ -32,11 +32,11 @@ | |||
32 | status = "okay"; | 32 | status = "okay"; |
33 | }; | 33 | }; |
34 | 34 | ||
35 | /* This UART is unused and thus left disabled */ | ||
35 | uart@80121000 { | 36 | uart@80121000 { |
36 | pinctrl-names = "default", "sleep"; | 37 | pinctrl-names = "default", "sleep"; |
37 | pinctrl-0 = <&uart1_default_mode>; | 38 | pinctrl-0 = <&uart1_default_mode>; |
38 | pinctrl-1 = <&uart1_sleep_mode>; | 39 | pinctrl-1 = <&uart1_sleep_mode>; |
39 | status = "okay"; | ||
40 | }; | 40 | }; |
41 | 41 | ||
42 | uart@80007000 { | 42 | uart@80007000 { |
diff --git a/arch/arm/boot/dts/ste-hrefprev60-stuib.dts b/arch/arm/boot/dts/ste-hrefprev60-stuib.dts index 2b1cb5b584b6..18e9795a94f9 100644 --- a/arch/arm/boot/dts/ste-hrefprev60-stuib.dts +++ b/arch/arm/boot/dts/ste-hrefprev60-stuib.dts | |||
@@ -17,6 +17,13 @@ | |||
17 | model = "ST-Ericsson HREF (pre-v60) and ST UIB"; | 17 | model = "ST-Ericsson HREF (pre-v60) and ST UIB"; |
18 | compatible = "st-ericsson,mop500", "st-ericsson,u8500"; | 18 | compatible = "st-ericsson,mop500", "st-ericsson,u8500"; |
19 | 19 | ||
20 | /* This stablilizes the serial port enumeration */ | ||
21 | aliases { | ||
22 | serial0 = &ux500_serial0; | ||
23 | serial1 = &ux500_serial1; | ||
24 | serial2 = &ux500_serial2; | ||
25 | }; | ||
26 | |||
20 | soc { | 27 | soc { |
21 | /* Reset line for the BU21013 touchscreen */ | 28 | /* Reset line for the BU21013 touchscreen */ |
22 | i2c@80110000 { | 29 | i2c@80110000 { |
diff --git a/arch/arm/boot/dts/ste-hrefprev60-tvk.dts b/arch/arm/boot/dts/ste-hrefprev60-tvk.dts index 59523f866812..24739914e689 100644 --- a/arch/arm/boot/dts/ste-hrefprev60-tvk.dts +++ b/arch/arm/boot/dts/ste-hrefprev60-tvk.dts | |||
@@ -16,4 +16,11 @@ | |||
16 | / { | 16 | / { |
17 | model = "ST-Ericsson HREF (pre-v60) and TVK1281618 UIB"; | 17 | model = "ST-Ericsson HREF (pre-v60) and TVK1281618 UIB"; |
18 | compatible = "st-ericsson,mop500", "st-ericsson,u8500"; | 18 | compatible = "st-ericsson,mop500", "st-ericsson,u8500"; |
19 | |||
20 | /* This stablilizes the serial port enumeration */ | ||
21 | aliases { | ||
22 | serial0 = &ux500_serial0; | ||
23 | serial1 = &ux500_serial1; | ||
24 | serial2 = &ux500_serial2; | ||
25 | }; | ||
19 | }; | 26 | }; |
diff --git a/arch/arm/boot/dts/ste-hrefprev60.dtsi b/arch/arm/boot/dts/ste-hrefprev60.dtsi index 7f3975b58d16..b0278f4c486c 100644 --- a/arch/arm/boot/dts/ste-hrefprev60.dtsi +++ b/arch/arm/boot/dts/ste-hrefprev60.dtsi | |||
@@ -23,6 +23,11 @@ | |||
23 | }; | 23 | }; |
24 | 24 | ||
25 | soc { | 25 | soc { |
26 | /* Enable UART1 on this board */ | ||
27 | uart@80121000 { | ||
28 | status = "okay"; | ||
29 | }; | ||
30 | |||
26 | i2c@80004000 { | 31 | i2c@80004000 { |
27 | tps61052@33 { | 32 | tps61052@33 { |
28 | compatible = "tps61052"; | 33 | compatible = "tps61052"; |
diff --git a/arch/arm/boot/dts/ste-hrefv60plus-stuib.dts b/arch/arm/boot/dts/ste-hrefv60plus-stuib.dts index 8c6a2de56cf1..c2e1ba019a2f 100644 --- a/arch/arm/boot/dts/ste-hrefv60plus-stuib.dts +++ b/arch/arm/boot/dts/ste-hrefv60plus-stuib.dts | |||
@@ -19,6 +19,13 @@ | |||
19 | model = "ST-Ericsson HREF (v60+) and ST UIB"; | 19 | model = "ST-Ericsson HREF (v60+) and ST UIB"; |
20 | compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500"; | 20 | compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500"; |
21 | 21 | ||
22 | /* This stablilizes the serial port enumeration */ | ||
23 | aliases { | ||
24 | serial0 = &ux500_serial0; | ||
25 | serial1 = &ux500_serial1; | ||
26 | serial2 = &ux500_serial2; | ||
27 | }; | ||
28 | |||
22 | soc { | 29 | soc { |
23 | /* Reset line for the BU21013 touchscreen */ | 30 | /* Reset line for the BU21013 touchscreen */ |
24 | i2c@80110000 { | 31 | i2c@80110000 { |
diff --git a/arch/arm/boot/dts/ste-hrefv60plus-tvk.dts b/arch/arm/boot/dts/ste-hrefv60plus-tvk.dts index d53cccdce776..ebd8547e98f1 100644 --- a/arch/arm/boot/dts/ste-hrefv60plus-tvk.dts +++ b/arch/arm/boot/dts/ste-hrefv60plus-tvk.dts | |||
@@ -18,4 +18,11 @@ | |||
18 | / { | 18 | / { |
19 | model = "ST-Ericsson HREF (v60+) and TVK1281618 UIB"; | 19 | model = "ST-Ericsson HREF (v60+) and TVK1281618 UIB"; |
20 | compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500"; | 20 | compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500"; |
21 | |||
22 | /* This stablilizes the serial port enumeration */ | ||
23 | aliases { | ||
24 | serial0 = &ux500_serial0; | ||
25 | serial1 = &ux500_serial1; | ||
26 | serial2 = &ux500_serial2; | ||
27 | }; | ||
21 | }; | 28 | }; |
diff --git a/arch/arm/boot/dts/ste-hrefv60plus.dtsi b/arch/arm/boot/dts/ste-hrefv60plus.dtsi index a4bc9e77d640..810cda743b6d 100644 --- a/arch/arm/boot/dts/ste-hrefv60plus.dtsi +++ b/arch/arm/boot/dts/ste-hrefv60plus.dtsi | |||
@@ -43,15 +43,26 @@ | |||
43 | <&vaudio_hf_hrefv60_mode>, | 43 | <&vaudio_hf_hrefv60_mode>, |
44 | <&gbf_hrefv60_mode>, | 44 | <&gbf_hrefv60_mode>, |
45 | <&hdtv_hrefv60_mode>, | 45 | <&hdtv_hrefv60_mode>, |
46 | <&touch_hrefv60_mode>; | 46 | <&touch_hrefv60_mode>, |
47 | <&gpios_hrefv60_mode>; | ||
47 | 48 | ||
48 | sdi0 { | 49 | sdi0 { |
49 | /* SD card detect GPIO pin, extend default state */ | ||
50 | sdi0_default_mode: sdi0_default { | 50 | sdi0_default_mode: sdi0_default { |
51 | /* SD card detect GPIO pin, extend default state */ | ||
51 | default_hrefv60_cfg1 { | 52 | default_hrefv60_cfg1 { |
52 | pins = "GPIO95_E8"; | 53 | pins = "GPIO95_E8"; |
53 | ste,config = <&gpio_in_pu>; | 54 | ste,config = <&gpio_in_pu>; |
54 | }; | 55 | }; |
56 | /* VMMCI level-shifter enable */ | ||
57 | default_hrefv60_cfg2 { | ||
58 | pins = "GPIO169_D22"; | ||
59 | ste,config = <&gpio_out_lo>; | ||
60 | }; | ||
61 | /* VMMCI level-shifter voltage select */ | ||
62 | default_hrefv60_cfg3 { | ||
63 | pins = "GPIO5_AG6"; | ||
64 | ste,config = <&gpio_out_hi>; | ||
65 | }; | ||
55 | }; | 66 | }; |
56 | }; | 67 | }; |
57 | ipgpio { | 68 | ipgpio { |
@@ -213,6 +224,16 @@ | |||
213 | }; | 224 | }; |
214 | }; | 225 | }; |
215 | }; | 226 | }; |
227 | gpios { | ||
228 | /* Dangling GPIO pins */ | ||
229 | gpios_hrefv60_mode: gpios_hrefv60 { | ||
230 | default_cfg1 { | ||
231 | /* Normally UART1 RXD, now dangling */ | ||
232 | pins = "GPIO4_AH6"; | ||
233 | ste,config = <&in_pu>; | ||
234 | }; | ||
235 | }; | ||
236 | }; | ||
216 | }; | 237 | }; |
217 | }; | 238 | }; |
218 | }; | 239 | }; |
diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts index 9edadc37719f..32a5ccb14e7e 100644 --- a/arch/arm/boot/dts/ste-snowball.dts +++ b/arch/arm/boot/dts/ste-snowball.dts | |||
@@ -18,6 +18,13 @@ | |||
18 | model = "Calao Systems Snowball platform with device tree"; | 18 | model = "Calao Systems Snowball platform with device tree"; |
19 | compatible = "calaosystems,snowball-a9500", "st-ericsson,u9500"; | 19 | compatible = "calaosystems,snowball-a9500", "st-ericsson,u9500"; |
20 | 20 | ||
21 | /* This stablilizes the serial port enumeration */ | ||
22 | aliases { | ||
23 | serial0 = &ux500_serial0; | ||
24 | serial1 = &ux500_serial1; | ||
25 | serial2 = &ux500_serial2; | ||
26 | }; | ||
27 | |||
21 | memory { | 28 | memory { |
22 | reg = <0x00000000 0x20000000>; | 29 | reg = <0x00000000 0x20000000>; |
23 | }; | 30 | }; |
@@ -223,11 +230,11 @@ | |||
223 | status = "okay"; | 230 | status = "okay"; |
224 | }; | 231 | }; |
225 | 232 | ||
233 | /* This UART is unused and thus left disabled */ | ||
226 | uart@80121000 { | 234 | uart@80121000 { |
227 | pinctrl-names = "default", "sleep"; | 235 | pinctrl-names = "default", "sleep"; |
228 | pinctrl-0 = <&uart1_default_mode>; | 236 | pinctrl-0 = <&uart1_default_mode>; |
229 | pinctrl-1 = <&uart1_sleep_mode>; | 237 | pinctrl-1 = <&uart1_sleep_mode>; |
230 | status = "okay"; | ||
231 | }; | 238 | }; |
232 | 239 | ||
233 | uart@80007000 { | 240 | uart@80007000 { |
@@ -452,7 +459,21 @@ | |||
452 | pins = "GPIO21_AB3"; /* DAT31DIR */ | 459 | pins = "GPIO21_AB3"; /* DAT31DIR */ |
453 | ste,config = <&out_hi>; | 460 | ste,config = <&out_hi>; |
454 | }; | 461 | }; |
455 | 462 | /* SD card detect GPIO pin, extend default state */ | |
463 | snowball_cfg2 { | ||
464 | pins = "GPIO218_AH11"; | ||
465 | ste,config = <&gpio_in_pu>; | ||
466 | }; | ||
467 | /* VMMCI level-shifter enable */ | ||
468 | snowball_cfg3 { | ||
469 | pins = "GPIO217_AH12"; | ||
470 | ste,config = <&gpio_out_lo>; | ||
471 | }; | ||
472 | /* VMMCI level-shifter voltage select */ | ||
473 | snowball_cfg4 { | ||
474 | pins = "GPIO228_AJ6"; | ||
475 | ste,config = <&gpio_out_hi>; | ||
476 | }; | ||
456 | }; | 477 | }; |
457 | }; | 478 | }; |
458 | ssp0 { | 479 | ssp0 { |
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts index 107395c32d82..17f63f7dfd9e 100644 --- a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts +++ b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts | |||
@@ -150,6 +150,16 @@ | |||
150 | interface-type = "ace"; | 150 | interface-type = "ace"; |
151 | reg = <0x5000 0x1000>; | 151 | reg = <0x5000 0x1000>; |
152 | }; | 152 | }; |
153 | |||
154 | pmu@9000 { | ||
155 | compatible = "arm,cci-400-pmu,r0"; | ||
156 | reg = <0x9000 0x5000>; | ||
157 | interrupts = <0 105 4>, | ||
158 | <0 101 4>, | ||
159 | <0 102 4>, | ||
160 | <0 103 4>, | ||
161 | <0 104 4>; | ||
162 | }; | ||
153 | }; | 163 | }; |
154 | 164 | ||
155 | memory-controller@7ffd0000 { | 165 | memory-controller@7ffd0000 { |
@@ -187,11 +197,22 @@ | |||
187 | <1 10 0xf08>; | 197 | <1 10 0xf08>; |
188 | }; | 198 | }; |
189 | 199 | ||
190 | pmu { | 200 | pmu_a15 { |
191 | compatible = "arm,cortex-a15-pmu"; | 201 | compatible = "arm,cortex-a15-pmu"; |
192 | interrupts = <0 68 4>, | 202 | interrupts = <0 68 4>, |
193 | <0 69 4>; | 203 | <0 69 4>; |
194 | interrupt-affinity = <&cpu0>, <&cpu1>; | 204 | interrupt-affinity = <&cpu0>, |
205 | <&cpu1>; | ||
206 | }; | ||
207 | |||
208 | pmu_a7 { | ||
209 | compatible = "arm,cortex-a7-pmu"; | ||
210 | interrupts = <0 128 4>, | ||
211 | <0 129 4>, | ||
212 | <0 130 4>; | ||
213 | interrupt-affinity = <&cpu2>, | ||
214 | <&cpu3>, | ||
215 | <&cpu4>; | ||
195 | }; | 216 | }; |
196 | 217 | ||
197 | oscclk6a: oscclk6a { | 218 | oscclk6a: oscclk6a { |
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 6d83a1bf0c74..5fd8df6f50ea 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig | |||
@@ -353,7 +353,6 @@ CONFIG_POWER_RESET_AS3722=y | |||
353 | CONFIG_POWER_RESET_GPIO=y | 353 | CONFIG_POWER_RESET_GPIO=y |
354 | CONFIG_POWER_RESET_GPIO_RESTART=y | 354 | CONFIG_POWER_RESET_GPIO_RESTART=y |
355 | CONFIG_POWER_RESET_KEYSTONE=y | 355 | CONFIG_POWER_RESET_KEYSTONE=y |
356 | CONFIG_POWER_RESET_SUN6I=y | ||
357 | CONFIG_POWER_RESET_RMOBILE=y | 356 | CONFIG_POWER_RESET_RMOBILE=y |
358 | CONFIG_SENSORS_LM90=y | 357 | CONFIG_SENSORS_LM90=y |
359 | CONFIG_SENSORS_LM95245=y | 358 | CONFIG_SENSORS_LM95245=y |
diff --git a/arch/arm/configs/sunxi_defconfig b/arch/arm/configs/sunxi_defconfig index 8ecba00dcd83..7ebc346bf9fa 100644 --- a/arch/arm/configs/sunxi_defconfig +++ b/arch/arm/configs/sunxi_defconfig | |||
@@ -2,6 +2,7 @@ CONFIG_NO_HZ=y | |||
2 | CONFIG_HIGH_RES_TIMERS=y | 2 | CONFIG_HIGH_RES_TIMERS=y |
3 | CONFIG_BLK_DEV_INITRD=y | 3 | CONFIG_BLK_DEV_INITRD=y |
4 | CONFIG_PERF_EVENTS=y | 4 | CONFIG_PERF_EVENTS=y |
5 | CONFIG_MODULES=y | ||
5 | CONFIG_ARCH_SUNXI=y | 6 | CONFIG_ARCH_SUNXI=y |
6 | CONFIG_SMP=y | 7 | CONFIG_SMP=y |
7 | CONFIG_NR_CPUS=8 | 8 | CONFIG_NR_CPUS=8 |
@@ -77,7 +78,6 @@ CONFIG_SPI_SUN6I=y | |||
77 | CONFIG_GPIO_SYSFS=y | 78 | CONFIG_GPIO_SYSFS=y |
78 | CONFIG_POWER_SUPPLY=y | 79 | CONFIG_POWER_SUPPLY=y |
79 | CONFIG_POWER_RESET=y | 80 | CONFIG_POWER_RESET=y |
80 | CONFIG_POWER_RESET_SUN6I=y | ||
81 | CONFIG_THERMAL=y | 81 | CONFIG_THERMAL=y |
82 | CONFIG_CPU_THERMAL=y | 82 | CONFIG_CPU_THERMAL=y |
83 | CONFIG_WATCHDOG=y | 83 | CONFIG_WATCHDOG=y |
@@ -87,6 +87,10 @@ CONFIG_REGULATOR=y | |||
87 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | 87 | CONFIG_REGULATOR_FIXED_VOLTAGE=y |
88 | CONFIG_REGULATOR_AXP20X=y | 88 | CONFIG_REGULATOR_AXP20X=y |
89 | CONFIG_REGULATOR_GPIO=y | 89 | CONFIG_REGULATOR_GPIO=y |
90 | CONFIG_FB=y | ||
91 | CONFIG_FB_SIMPLE=y | ||
92 | CONFIG_FRAMEBUFFER_CONSOLE=y | ||
93 | CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y | ||
90 | CONFIG_USB=y | 94 | CONFIG_USB=y |
91 | CONFIG_USB_EHCI_HCD=y | 95 | CONFIG_USB_EHCI_HCD=y |
92 | CONFIG_USB_EHCI_HCD_PLATFORM=y | 96 | CONFIG_USB_EHCI_HCD_PLATFORM=y |
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild index 83c50193626c..30b3bc1666d2 100644 --- a/arch/arm/include/asm/Kbuild +++ b/arch/arm/include/asm/Kbuild | |||
@@ -13,6 +13,7 @@ generic-y += kdebug.h | |||
13 | generic-y += local.h | 13 | generic-y += local.h |
14 | generic-y += local64.h | 14 | generic-y += local64.h |
15 | generic-y += mcs_spinlock.h | 15 | generic-y += mcs_spinlock.h |
16 | generic-y += mm-arch-hooks.h | ||
16 | generic-y += msgbuf.h | 17 | generic-y += msgbuf.h |
17 | generic-y += param.h | 18 | generic-y += param.h |
18 | generic-y += parport.h | 19 | generic-y += parport.h |
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index 6f225acc07c5..b7f6fb462ea0 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h | |||
@@ -286,7 +286,7 @@ extern phys_addr_t (*arch_virt_to_idmap)(unsigned long x); | |||
286 | */ | 286 | */ |
287 | static inline phys_addr_t __virt_to_idmap(unsigned long x) | 287 | static inline phys_addr_t __virt_to_idmap(unsigned long x) |
288 | { | 288 | { |
289 | if (arch_virt_to_idmap) | 289 | if (IS_ENABLED(CONFIG_MMU) && arch_virt_to_idmap) |
290 | return arch_virt_to_idmap(x); | 290 | return arch_virt_to_idmap(x); |
291 | else | 291 | else |
292 | return __virt_to_phys(x); | 292 | return __virt_to_phys(x); |
diff --git a/arch/arm/include/asm/mm-arch-hooks.h b/arch/arm/include/asm/mm-arch-hooks.h deleted file mode 100644 index 7056660c7cc4..000000000000 --- a/arch/arm/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_ARM_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_ARM_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_ARM_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index 357f57ea83f4..54272e0be713 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c | |||
@@ -818,12 +818,13 @@ static int of_pmu_irq_cfg(struct arm_pmu *pmu) | |||
818 | if (arch_find_n_match_cpu_physical_id(dn, cpu, NULL)) | 818 | if (arch_find_n_match_cpu_physical_id(dn, cpu, NULL)) |
819 | break; | 819 | break; |
820 | 820 | ||
821 | of_node_put(dn); | ||
822 | if (cpu >= nr_cpu_ids) { | 821 | if (cpu >= nr_cpu_ids) { |
823 | pr_warn("Failed to find logical CPU for %s\n", | 822 | pr_warn("Failed to find logical CPU for %s\n", |
824 | dn->name); | 823 | dn->name); |
824 | of_node_put(dn); | ||
825 | break; | 825 | break; |
826 | } | 826 | } |
827 | of_node_put(dn); | ||
827 | 828 | ||
828 | irqs[i] = cpu; | 829 | irqs[i] = cpu; |
829 | cpumask_set_cpu(cpu, &pmu->supported_cpus); | 830 | cpumask_set_cpu(cpu, &pmu->supported_cpus); |
diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c index 1a4d232796be..38269358fd25 100644 --- a/arch/arm/kernel/reboot.c +++ b/arch/arm/kernel/reboot.c | |||
@@ -50,7 +50,7 @@ static void __soft_restart(void *addr) | |||
50 | flush_cache_all(); | 50 | flush_cache_all(); |
51 | 51 | ||
52 | /* Switch to the identity mapping. */ | 52 | /* Switch to the identity mapping. */ |
53 | phys_reset = (phys_reset_t)(unsigned long)virt_to_phys(cpu_reset); | 53 | phys_reset = (phys_reset_t)(unsigned long)virt_to_idmap(cpu_reset); |
54 | phys_reset((unsigned long)addr); | 54 | phys_reset((unsigned long)addr); |
55 | 55 | ||
56 | /* Should never get here. */ | 56 | /* Should never get here. */ |
diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c index 80bad29d609a..8c4467fad837 100644 --- a/arch/arm/mach-imx/gpc.c +++ b/arch/arm/mach-imx/gpc.c | |||
@@ -291,8 +291,6 @@ void __init imx_gpc_check_dt(void) | |||
291 | } | 291 | } |
292 | } | 292 | } |
293 | 293 | ||
294 | #ifdef CONFIG_PM_GENERIC_DOMAINS | ||
295 | |||
296 | static void _imx6q_pm_pu_power_off(struct generic_pm_domain *genpd) | 294 | static void _imx6q_pm_pu_power_off(struct generic_pm_domain *genpd) |
297 | { | 295 | { |
298 | int iso, iso2sw; | 296 | int iso, iso2sw; |
@@ -399,7 +397,6 @@ static struct genpd_onecell_data imx_gpc_onecell_data = { | |||
399 | static int imx_gpc_genpd_init(struct device *dev, struct regulator *pu_reg) | 397 | static int imx_gpc_genpd_init(struct device *dev, struct regulator *pu_reg) |
400 | { | 398 | { |
401 | struct clk *clk; | 399 | struct clk *clk; |
402 | bool is_off; | ||
403 | int i; | 400 | int i; |
404 | 401 | ||
405 | imx6q_pu_domain.reg = pu_reg; | 402 | imx6q_pu_domain.reg = pu_reg; |
@@ -416,18 +413,13 @@ static int imx_gpc_genpd_init(struct device *dev, struct regulator *pu_reg) | |||
416 | } | 413 | } |
417 | imx6q_pu_domain.num_clks = i; | 414 | imx6q_pu_domain.num_clks = i; |
418 | 415 | ||
419 | is_off = IS_ENABLED(CONFIG_PM); | 416 | /* Enable power always in case bootloader disabled it. */ |
420 | if (is_off) { | 417 | imx6q_pm_pu_power_on(&imx6q_pu_domain.base); |
421 | _imx6q_pm_pu_power_off(&imx6q_pu_domain.base); | 418 | |
422 | } else { | 419 | if (!IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS)) |
423 | /* | 420 | return 0; |
424 | * Enable power if compiled without CONFIG_PM in case the | ||
425 | * bootloader disabled it. | ||
426 | */ | ||
427 | imx6q_pm_pu_power_on(&imx6q_pu_domain.base); | ||
428 | } | ||
429 | 421 | ||
430 | pm_genpd_init(&imx6q_pu_domain.base, NULL, is_off); | 422 | pm_genpd_init(&imx6q_pu_domain.base, NULL, false); |
431 | return of_genpd_add_provider_onecell(dev->of_node, | 423 | return of_genpd_add_provider_onecell(dev->of_node, |
432 | &imx_gpc_onecell_data); | 424 | &imx_gpc_onecell_data); |
433 | 425 | ||
@@ -437,13 +429,6 @@ clk_err: | |||
437 | return -EINVAL; | 429 | return -EINVAL; |
438 | } | 430 | } |
439 | 431 | ||
440 | #else | ||
441 | static inline int imx_gpc_genpd_init(struct device *dev, struct regulator *reg) | ||
442 | { | ||
443 | return 0; | ||
444 | } | ||
445 | #endif /* CONFIG_PM_GENERIC_DOMAINS */ | ||
446 | |||
447 | static int imx_gpc_probe(struct platform_device *pdev) | 432 | static int imx_gpc_probe(struct platform_device *pdev) |
448 | { | 433 | { |
449 | struct regulator *pu_reg; | 434 | struct regulator *pu_reg; |
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index ecc04ff13e95..4a023e8d1bdb 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
@@ -60,6 +60,7 @@ config SOC_AM43XX | |||
60 | select ARM_GIC | 60 | select ARM_GIC |
61 | select MACH_OMAP_GENERIC | 61 | select MACH_OMAP_GENERIC |
62 | select MIGHT_HAVE_CACHE_L2X0 | 62 | select MIGHT_HAVE_CACHE_L2X0 |
63 | select HAVE_ARM_SCU | ||
63 | 64 | ||
64 | config SOC_DRA7XX | 65 | config SOC_DRA7XX |
65 | bool "TI DRA7XX" | 66 | bool "TI DRA7XX" |
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c index e1a56d87599e..1ed4be184a29 100644 --- a/arch/arm/mach-omap2/dma.c +++ b/arch/arm/mach-omap2/dma.c | |||
@@ -117,7 +117,6 @@ static void omap2_show_dma_caps(void) | |||
117 | u8 revision = dma_read(REVISION, 0) & 0xff; | 117 | u8 revision = dma_read(REVISION, 0) & 0xff; |
118 | printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n", | 118 | printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n", |
119 | revision >> 4, revision & 0xf); | 119 | revision >> 4, revision & 0xf); |
120 | return; | ||
121 | } | 120 | } |
122 | 121 | ||
123 | static unsigned configure_dma_errata(void) | 122 | static unsigned configure_dma_errata(void) |
diff --git a/arch/arm/mach-prima2/Kconfig b/arch/arm/mach-prima2/Kconfig index e03d8b5c9ad0..9ab8932403e5 100644 --- a/arch/arm/mach-prima2/Kconfig +++ b/arch/arm/mach-prima2/Kconfig | |||
@@ -4,6 +4,7 @@ menuconfig ARCH_SIRF | |||
4 | select ARCH_REQUIRE_GPIOLIB | 4 | select ARCH_REQUIRE_GPIOLIB |
5 | select GENERIC_IRQ_CHIP | 5 | select GENERIC_IRQ_CHIP |
6 | select NO_IOPORT_MAP | 6 | select NO_IOPORT_MAP |
7 | select REGMAP | ||
7 | select PINCTRL | 8 | select PINCTRL |
8 | select PINCTRL_SIRF | 9 | select PINCTRL_SIRF |
9 | help | 10 | help |
diff --git a/arch/arm/mach-prima2/rtciobrg.c b/arch/arm/mach-prima2/rtciobrg.c index 8f66d8f7ca75..d4852d24dc7d 100644 --- a/arch/arm/mach-prima2/rtciobrg.c +++ b/arch/arm/mach-prima2/rtciobrg.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * RTC I/O Bridge interfaces for CSR SiRFprimaII | 2 | * RTC I/O Bridge interfaces for CSR SiRFprimaII/atlas7 |
3 | * ARM access the registers of SYSRTC, GPSRTC and PWRC through this module | 3 | * ARM access the registers of SYSRTC, GPSRTC and PWRC through this module |
4 | * | 4 | * |
5 | * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. | 5 | * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. |
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/io.h> | 12 | #include <linux/io.h> |
13 | #include <linux/regmap.h> | ||
13 | #include <linux/of.h> | 14 | #include <linux/of.h> |
14 | #include <linux/of_address.h> | 15 | #include <linux/of_address.h> |
15 | #include <linux/of_device.h> | 16 | #include <linux/of_device.h> |
@@ -66,6 +67,7 @@ u32 sirfsoc_rtc_iobrg_readl(u32 addr) | |||
66 | { | 67 | { |
67 | unsigned long flags, val; | 68 | unsigned long flags, val; |
68 | 69 | ||
70 | /* TODO: add hwspinlock to sync with M3 */ | ||
69 | spin_lock_irqsave(&rtciobrg_lock, flags); | 71 | spin_lock_irqsave(&rtciobrg_lock, flags); |
70 | 72 | ||
71 | val = __sirfsoc_rtc_iobrg_readl(addr); | 73 | val = __sirfsoc_rtc_iobrg_readl(addr); |
@@ -90,6 +92,7 @@ void sirfsoc_rtc_iobrg_writel(u32 val, u32 addr) | |||
90 | { | 92 | { |
91 | unsigned long flags; | 93 | unsigned long flags; |
92 | 94 | ||
95 | /* TODO: add hwspinlock to sync with M3 */ | ||
93 | spin_lock_irqsave(&rtciobrg_lock, flags); | 96 | spin_lock_irqsave(&rtciobrg_lock, flags); |
94 | 97 | ||
95 | sirfsoc_rtc_iobrg_pre_writel(val, addr); | 98 | sirfsoc_rtc_iobrg_pre_writel(val, addr); |
@@ -102,6 +105,45 @@ void sirfsoc_rtc_iobrg_writel(u32 val, u32 addr) | |||
102 | } | 105 | } |
103 | EXPORT_SYMBOL_GPL(sirfsoc_rtc_iobrg_writel); | 106 | EXPORT_SYMBOL_GPL(sirfsoc_rtc_iobrg_writel); |
104 | 107 | ||
108 | |||
109 | static int regmap_iobg_regwrite(void *context, unsigned int reg, | ||
110 | unsigned int val) | ||
111 | { | ||
112 | sirfsoc_rtc_iobrg_writel(val, reg); | ||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | static int regmap_iobg_regread(void *context, unsigned int reg, | ||
117 | unsigned int *val) | ||
118 | { | ||
119 | *val = (u32)sirfsoc_rtc_iobrg_readl(reg); | ||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | static struct regmap_bus regmap_iobg = { | ||
124 | .reg_write = regmap_iobg_regwrite, | ||
125 | .reg_read = regmap_iobg_regread, | ||
126 | }; | ||
127 | |||
128 | /** | ||
129 | * devm_regmap_init_iobg(): Initialise managed register map | ||
130 | * | ||
131 | * @iobg: Device that will be interacted with | ||
132 | * @config: Configuration for register map | ||
133 | * | ||
134 | * The return value will be an ERR_PTR() on error or a valid pointer | ||
135 | * to a struct regmap. The regmap will be automatically freed by the | ||
136 | * device management code. | ||
137 | */ | ||
138 | struct regmap *devm_regmap_init_iobg(struct device *dev, | ||
139 | const struct regmap_config *config) | ||
140 | { | ||
141 | const struct regmap_bus *bus = ®map_iobg; | ||
142 | |||
143 | return devm_regmap_init(dev, bus, dev, config); | ||
144 | } | ||
145 | EXPORT_SYMBOL_GPL(devm_regmap_init_iobg); | ||
146 | |||
105 | static const struct of_device_id rtciobrg_ids[] = { | 147 | static const struct of_device_id rtciobrg_ids[] = { |
106 | { .compatible = "sirf,prima2-rtciobg" }, | 148 | { .compatible = "sirf,prima2-rtciobg" }, |
107 | {} | 149 | {} |
@@ -132,7 +174,7 @@ static int __init sirfsoc_rtciobrg_init(void) | |||
132 | } | 174 | } |
133 | postcore_initcall(sirfsoc_rtciobrg_init); | 175 | postcore_initcall(sirfsoc_rtciobrg_init); |
134 | 176 | ||
135 | MODULE_AUTHOR("Zhiwu Song <zhiwu.song@csr.com>, " | 177 | MODULE_AUTHOR("Zhiwu Song <zhiwu.song@csr.com>"); |
136 | "Barry Song <baohua.song@csr.com>"); | 178 | MODULE_AUTHOR("Barry Song <baohua.song@csr.com>"); |
137 | MODULE_DESCRIPTION("CSR SiRFprimaII rtc io bridge"); | 179 | MODULE_DESCRIPTION("CSR SiRFprimaII rtc io bridge"); |
138 | MODULE_LICENSE("GPL v2"); | 180 | MODULE_LICENSE("GPL v2"); |
diff --git a/arch/arm/mach-pxa/capc7117.c b/arch/arm/mach-pxa/capc7117.c index c092730749b9..bf366b39fa61 100644 --- a/arch/arm/mach-pxa/capc7117.c +++ b/arch/arm/mach-pxa/capc7117.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/ata_platform.h> | 24 | #include <linux/ata_platform.h> |
25 | #include <linux/serial_8250.h> | 25 | #include <linux/serial_8250.h> |
26 | #include <linux/gpio.h> | 26 | #include <linux/gpio.h> |
27 | #include <linux/regulator/machine.h> | ||
27 | 28 | ||
28 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
29 | #include <asm/mach/arch.h> | 30 | #include <asm/mach/arch.h> |
@@ -144,6 +145,8 @@ static void __init capc7117_init(void) | |||
144 | 145 | ||
145 | capc7117_uarts_init(); | 146 | capc7117_uarts_init(); |
146 | capc7117_ide_init(); | 147 | capc7117_ide_init(); |
148 | |||
149 | regulator_has_full_constraints(); | ||
147 | } | 150 | } |
148 | 151 | ||
149 | MACHINE_START(CAPC7117, | 152 | MACHINE_START(CAPC7117, |
diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c index bb99f59a36d8..a17a91eb8e9a 100644 --- a/arch/arm/mach-pxa/cm-x2xx.c +++ b/arch/arm/mach-pxa/cm-x2xx.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/syscore_ops.h> | 13 | #include <linux/syscore_ops.h> |
14 | #include <linux/irq.h> | 14 | #include <linux/irq.h> |
15 | #include <linux/gpio.h> | 15 | #include <linux/gpio.h> |
16 | #include <linux/regulator/machine.h> | ||
16 | 17 | ||
17 | #include <linux/dm9000.h> | 18 | #include <linux/dm9000.h> |
18 | #include <linux/leds.h> | 19 | #include <linux/leds.h> |
@@ -466,6 +467,8 @@ static void __init cmx2xx_init(void) | |||
466 | cmx2xx_init_ac97(); | 467 | cmx2xx_init_ac97(); |
467 | cmx2xx_init_touchscreen(); | 468 | cmx2xx_init_touchscreen(); |
468 | cmx2xx_init_leds(); | 469 | cmx2xx_init_leds(); |
470 | |||
471 | regulator_has_full_constraints(); | ||
469 | } | 472 | } |
470 | 473 | ||
471 | static void __init cmx2xx_init_irq(void) | 474 | static void __init cmx2xx_init_irq(void) |
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c index 4d3588d26c2a..5851f4c254c1 100644 --- a/arch/arm/mach-pxa/cm-x300.c +++ b/arch/arm/mach-pxa/cm-x300.c | |||
@@ -835,6 +835,8 @@ static void __init cm_x300_init(void) | |||
835 | cm_x300_init_ac97(); | 835 | cm_x300_init_ac97(); |
836 | cm_x300_init_wi2wi(); | 836 | cm_x300_init_wi2wi(); |
837 | cm_x300_init_bl(); | 837 | cm_x300_init_bl(); |
838 | |||
839 | regulator_has_full_constraints(); | ||
838 | } | 840 | } |
839 | 841 | ||
840 | static void __init cm_x300_fixup(struct tag *tags, char **cmdline) | 842 | static void __init cm_x300_fixup(struct tag *tags, char **cmdline) |
diff --git a/arch/arm/mach-pxa/colibri-pxa270.c b/arch/arm/mach-pxa/colibri-pxa270.c index 5f9d9303b346..3503826333c7 100644 --- a/arch/arm/mach-pxa/colibri-pxa270.c +++ b/arch/arm/mach-pxa/colibri-pxa270.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/mtd/partitions.h> | 18 | #include <linux/mtd/partitions.h> |
19 | #include <linux/mtd/physmap.h> | 19 | #include <linux/mtd/physmap.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/regulator/machine.h> | ||
21 | #include <linux/ucb1400.h> | 22 | #include <linux/ucb1400.h> |
22 | 23 | ||
23 | #include <asm/mach/arch.h> | 24 | #include <asm/mach/arch.h> |
@@ -294,6 +295,8 @@ static void __init colibri_pxa270_init(void) | |||
294 | printk(KERN_ERR "Illegal colibri_pxa270_baseboard type %d\n", | 295 | printk(KERN_ERR "Illegal colibri_pxa270_baseboard type %d\n", |
295 | colibri_pxa270_baseboard); | 296 | colibri_pxa270_baseboard); |
296 | } | 297 | } |
298 | |||
299 | regulator_has_full_constraints(); | ||
297 | } | 300 | } |
298 | 301 | ||
299 | /* The "Income s.r.o. SH-Dmaster PXA270 SBC" board can be booted either | 302 | /* The "Income s.r.o. SH-Dmaster PXA270 SBC" board can be booted either |
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index 51531ecffca8..9d7072b04045 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c | |||
@@ -1306,6 +1306,8 @@ static void __init em_x270_init(void) | |||
1306 | em_x270_init_i2c(); | 1306 | em_x270_init_i2c(); |
1307 | em_x270_init_camera(); | 1307 | em_x270_init_camera(); |
1308 | em_x270_userspace_consumers_init(); | 1308 | em_x270_userspace_consumers_init(); |
1309 | |||
1310 | regulator_has_full_constraints(); | ||
1309 | } | 1311 | } |
1310 | 1312 | ||
1311 | MACHINE_START(EM_X270, "Compulab EM-X270") | 1313 | MACHINE_START(EM_X270, "Compulab EM-X270") |
diff --git a/arch/arm/mach-pxa/icontrol.c b/arch/arm/mach-pxa/icontrol.c index c98511c5abd1..9b0eb0252af6 100644 --- a/arch/arm/mach-pxa/icontrol.c +++ b/arch/arm/mach-pxa/icontrol.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/spi/spi.h> | 26 | #include <linux/spi/spi.h> |
27 | #include <linux/spi/pxa2xx_spi.h> | 27 | #include <linux/spi/pxa2xx_spi.h> |
28 | #include <linux/can/platform/mcp251x.h> | 28 | #include <linux/can/platform/mcp251x.h> |
29 | #include <linux/regulator/machine.h> | ||
29 | 30 | ||
30 | #include "generic.h" | 31 | #include "generic.h" |
31 | 32 | ||
@@ -185,6 +186,8 @@ static void __init icontrol_init(void) | |||
185 | mxm_8x10_mmc_init(); | 186 | mxm_8x10_mmc_init(); |
186 | 187 | ||
187 | icontrol_can_init(); | 188 | icontrol_can_init(); |
189 | |||
190 | regulator_has_full_constraints(); | ||
188 | } | 191 | } |
189 | 192 | ||
190 | MACHINE_START(ICONTROL, "iControl/SafeTcam boards using Embedian MXM-8x10 CoM") | 193 | MACHINE_START(ICONTROL, "iControl/SafeTcam boards using Embedian MXM-8x10 CoM") |
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c index 872dcb20e757..066e3a250ee0 100644 --- a/arch/arm/mach-pxa/trizeps4.c +++ b/arch/arm/mach-pxa/trizeps4.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/dm9000.h> | 26 | #include <linux/dm9000.h> |
27 | #include <linux/mtd/physmap.h> | 27 | #include <linux/mtd/physmap.h> |
28 | #include <linux/mtd/partitions.h> | 28 | #include <linux/mtd/partitions.h> |
29 | #include <linux/regulator/machine.h> | ||
29 | #include <linux/i2c/pxa-i2c.h> | 30 | #include <linux/i2c/pxa-i2c.h> |
30 | 31 | ||
31 | #include <asm/types.h> | 32 | #include <asm/types.h> |
@@ -534,6 +535,8 @@ static void __init trizeps4_init(void) | |||
534 | 535 | ||
535 | BCR_writew(trizeps_conxs_bcr); | 536 | BCR_writew(trizeps_conxs_bcr); |
536 | board_backlight_power(1); | 537 | board_backlight_power(1); |
538 | |||
539 | regulator_has_full_constraints(); | ||
537 | } | 540 | } |
538 | 541 | ||
539 | static void __init trizeps4_map_io(void) | 542 | static void __init trizeps4_map_io(void) |
diff --git a/arch/arm/mach-pxa/vpac270.c b/arch/arm/mach-pxa/vpac270.c index aa89488f961e..54122a983ae3 100644 --- a/arch/arm/mach-pxa/vpac270.c +++ b/arch/arm/mach-pxa/vpac270.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/dm9000.h> | 24 | #include <linux/dm9000.h> |
25 | #include <linux/ucb1400.h> | 25 | #include <linux/ucb1400.h> |
26 | #include <linux/ata_platform.h> | 26 | #include <linux/ata_platform.h> |
27 | #include <linux/regulator/machine.h> | ||
27 | #include <linux/regulator/max1586.h> | 28 | #include <linux/regulator/max1586.h> |
28 | #include <linux/i2c/pxa-i2c.h> | 29 | #include <linux/i2c/pxa-i2c.h> |
29 | 30 | ||
@@ -711,6 +712,8 @@ static void __init vpac270_init(void) | |||
711 | vpac270_ts_init(); | 712 | vpac270_ts_init(); |
712 | vpac270_rtc_init(); | 713 | vpac270_rtc_init(); |
713 | vpac270_ide_init(); | 714 | vpac270_ide_init(); |
715 | |||
716 | regulator_has_full_constraints(); | ||
714 | } | 717 | } |
715 | 718 | ||
716 | MACHINE_START(VPAC270, "Voipac PXA270") | 719 | MACHINE_START(VPAC270, "Voipac PXA270") |
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c index ac2ae5c71ab4..6158566fa0f7 100644 --- a/arch/arm/mach-pxa/zeus.c +++ b/arch/arm/mach-pxa/zeus.c | |||
@@ -868,6 +868,8 @@ static void __init zeus_init(void) | |||
868 | i2c_register_board_info(0, ARRAY_AND_SIZE(zeus_i2c_devices)); | 868 | i2c_register_board_info(0, ARRAY_AND_SIZE(zeus_i2c_devices)); |
869 | pxa2xx_set_spi_info(3, &pxa2xx_spi_ssp3_master_info); | 869 | pxa2xx_set_spi_info(3, &pxa2xx_spi_ssp3_master_info); |
870 | spi_register_board_info(zeus_spi_board_info, ARRAY_SIZE(zeus_spi_board_info)); | 870 | spi_register_board_info(zeus_spi_board_info, ARRAY_SIZE(zeus_spi_board_info)); |
871 | |||
872 | regulator_has_full_constraints(); | ||
871 | } | 873 | } |
872 | 874 | ||
873 | static struct map_desc zeus_io_desc[] __initdata = { | 875 | static struct map_desc zeus_io_desc[] __initdata = { |
diff --git a/arch/arm/mach-spear/generic.h b/arch/arm/mach-spear/generic.h index a99d90a4d09c..06640914d9a0 100644 --- a/arch/arm/mach-spear/generic.h +++ b/arch/arm/mach-spear/generic.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2009-2012 ST Microelectronics | 4 | * Copyright (C) 2009-2012 ST Microelectronics |
5 | * Rajeev Kumar <rajeev-dlh.kumar@st.com> | 5 | * Rajeev Kumar <rajeev-dlh.kumar@st.com> |
6 | * Viresh Kumar <viresh.linux@gmail.com> | 6 | * Viresh Kumar <vireshk@kernel.org> |
7 | * | 7 | * |
8 | * This file is licensed under the terms of the GNU General Public | 8 | * This file is licensed under the terms of the GNU General Public |
9 | * License version 2. This program is licensed "as is" without any | 9 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/arm/mach-spear/include/mach/irqs.h b/arch/arm/mach-spear/include/mach/irqs.h index 92da0a8c6bce..7058720c5278 100644 --- a/arch/arm/mach-spear/include/mach/irqs.h +++ b/arch/arm/mach-spear/include/mach/irqs.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2009-2012 ST Microelectronics | 4 | * Copyright (C) 2009-2012 ST Microelectronics |
5 | * Rajeev Kumar <rajeev-dlh.kumar@st.com> | 5 | * Rajeev Kumar <rajeev-dlh.kumar@st.com> |
6 | * Viresh Kumar <viresh.linux@gmail.com> | 6 | * Viresh Kumar <vireshk@kernel.org> |
7 | * | 7 | * |
8 | * This file is licensed under the terms of the GNU General Public | 8 | * This file is licensed under the terms of the GNU General Public |
9 | * License version 2. This program is licensed "as is" without any | 9 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/arm/mach-spear/include/mach/misc_regs.h b/arch/arm/mach-spear/include/mach/misc_regs.h index 935639ce59ba..cfaf7c665b58 100644 --- a/arch/arm/mach-spear/include/mach/misc_regs.h +++ b/arch/arm/mach-spear/include/mach/misc_regs.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * Miscellaneous registers definitions for SPEAr3xx machine family | 4 | * Miscellaneous registers definitions for SPEAr3xx machine family |
5 | * | 5 | * |
6 | * Copyright (C) 2009 ST Microelectronics | 6 | * Copyright (C) 2009 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/arm/mach-spear/include/mach/spear.h b/arch/arm/mach-spear/include/mach/spear.h index f2d6a0176575..5ed841ccf8a3 100644 --- a/arch/arm/mach-spear/include/mach/spear.h +++ b/arch/arm/mach-spear/include/mach/spear.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2009,2012 ST Microelectronics | 4 | * Copyright (C) 2009,2012 ST Microelectronics |
5 | * Rajeev Kumar<rajeev-dlh.kumar@st.com> | 5 | * Rajeev Kumar<rajeev-dlh.kumar@st.com> |
6 | * Viresh Kumar <viresh.linux@gmail.com> | 6 | * Viresh Kumar <vireshk@kernel.org> |
7 | * | 7 | * |
8 | * This file is licensed under the terms of the GNU General Public | 8 | * This file is licensed under the terms of the GNU General Public |
9 | * License version 2. This program is licensed "as is" without any | 9 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/arm/mach-spear/include/mach/uncompress.h b/arch/arm/mach-spear/include/mach/uncompress.h index 51b2dc93e4da..8439b9c12edb 100644 --- a/arch/arm/mach-spear/include/mach/uncompress.h +++ b/arch/arm/mach-spear/include/mach/uncompress.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * Serial port stubs for kernel decompress status messages | 4 | * Serial port stubs for kernel decompress status messages |
5 | * | 5 | * |
6 | * Copyright (C) 2009 ST Microelectronics | 6 | * Copyright (C) 2009 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/arm/mach-spear/pl080.c b/arch/arm/mach-spear/pl080.c index cfa1199d0f4a..b4529f3e0ee9 100644 --- a/arch/arm/mach-spear/pl080.c +++ b/arch/arm/mach-spear/pl080.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * DMAC pl080 definitions for SPEAr platform | 4 | * DMAC pl080 definitions for SPEAr platform |
5 | * | 5 | * |
6 | * Copyright (C) 2012 ST Microelectronics | 6 | * Copyright (C) 2012 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/arm/mach-spear/pl080.h b/arch/arm/mach-spear/pl080.h index eb6590ded40d..608dec6725ae 100644 --- a/arch/arm/mach-spear/pl080.h +++ b/arch/arm/mach-spear/pl080.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * DMAC pl080 definitions for SPEAr platform | 4 | * DMAC pl080 definitions for SPEAr platform |
5 | * | 5 | * |
6 | * Copyright (C) 2012 ST Microelectronics | 6 | * Copyright (C) 2012 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/arm/mach-spear/restart.c b/arch/arm/mach-spear/restart.c index ce5e098c4888..b4342155a783 100644 --- a/arch/arm/mach-spear/restart.c +++ b/arch/arm/mach-spear/restart.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * SPEAr platform specific restart functions | 4 | * SPEAr platform specific restart functions |
5 | * | 5 | * |
6 | * Copyright (C) 2009 ST Microelectronics | 6 | * Copyright (C) 2009 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/arm/mach-spear/spear1310.c b/arch/arm/mach-spear/spear1310.c index d9ce4d8000f0..cd5d375d91f0 100644 --- a/arch/arm/mach-spear/spear1310.c +++ b/arch/arm/mach-spear/spear1310.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * SPEAr1310 machine source file | 4 | * SPEAr1310 machine source file |
5 | * | 5 | * |
6 | * Copyright (C) 2012 ST Microelectronics | 6 | * Copyright (C) 2012 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/arm/mach-spear/spear1340.c b/arch/arm/mach-spear/spear1340.c index 3f3c0f124bd3..94594d5a446c 100644 --- a/arch/arm/mach-spear/spear1340.c +++ b/arch/arm/mach-spear/spear1340.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * SPEAr1340 machine source file | 4 | * SPEAr1340 machine source file |
5 | * | 5 | * |
6 | * Copyright (C) 2012 ST Microelectronics | 6 | * Copyright (C) 2012 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/arm/mach-spear/spear13xx.c b/arch/arm/mach-spear/spear13xx.c index 2e463a93468d..b7afce6795f4 100644 --- a/arch/arm/mach-spear/spear13xx.c +++ b/arch/arm/mach-spear/spear13xx.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * SPEAr13XX machines common source file | 4 | * SPEAr13XX machines common source file |
5 | * | 5 | * |
6 | * Copyright (C) 2012 ST Microelectronics | 6 | * Copyright (C) 2012 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/arm/mach-spear/spear300.c b/arch/arm/mach-spear/spear300.c index b52e48f342f4..5b32edda2276 100644 --- a/arch/arm/mach-spear/spear300.c +++ b/arch/arm/mach-spear/spear300.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * SPEAr300 machine source file | 4 | * SPEAr300 machine source file |
5 | * | 5 | * |
6 | * Copyright (C) 2009-2012 ST Microelectronics | 6 | * Copyright (C) 2009-2012 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/arm/mach-spear/spear310.c b/arch/arm/mach-spear/spear310.c index ed2029db391f..86a44ac7ff67 100644 --- a/arch/arm/mach-spear/spear310.c +++ b/arch/arm/mach-spear/spear310.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * SPEAr310 machine source file | 4 | * SPEAr310 machine source file |
5 | * | 5 | * |
6 | * Copyright (C) 2009-2012 ST Microelectronics | 6 | * Copyright (C) 2009-2012 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/arm/mach-spear/spear320.c b/arch/arm/mach-spear/spear320.c index bf634b32a930..d45d751926c5 100644 --- a/arch/arm/mach-spear/spear320.c +++ b/arch/arm/mach-spear/spear320.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * SPEAr320 machine source file | 4 | * SPEAr320 machine source file |
5 | * | 5 | * |
6 | * Copyright (C) 2009-2012 ST Microelectronics | 6 | * Copyright (C) 2009-2012 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/arm/mach-spear/spear3xx.c b/arch/arm/mach-spear/spear3xx.c index bf3b1fd8cb23..23394ac76cf2 100644 --- a/arch/arm/mach-spear/spear3xx.c +++ b/arch/arm/mach-spear/spear3xx.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * SPEAr3XX machines common source file | 4 | * SPEAr3XX machines common source file |
5 | * | 5 | * |
6 | * Copyright (C) 2009-2012 ST Microelectronics | 6 | * Copyright (C) 2009-2012 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 81502b90dd91..4efe2d43a126 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig | |||
@@ -35,7 +35,7 @@ config MACH_SUN7I | |||
35 | select SUN5I_HSTIMER | 35 | select SUN5I_HSTIMER |
36 | 36 | ||
37 | config MACH_SUN8I | 37 | config MACH_SUN8I |
38 | bool "Allwinner A23 (sun8i) SoCs support" | 38 | bool "Allwinner sun8i Family SoCs support" |
39 | default ARCH_SUNXI | 39 | default ARCH_SUNXI |
40 | select ARM_GIC | 40 | select ARM_GIC |
41 | select MFD_SUN6I_PRCM | 41 | select MFD_SUN6I_PRCM |
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c index 1bc811a74a9f..65bab2876343 100644 --- a/arch/arm/mach-sunxi/sunxi.c +++ b/arch/arm/mach-sunxi/sunxi.c | |||
@@ -67,10 +67,13 @@ MACHINE_END | |||
67 | 67 | ||
68 | static const char * const sun8i_board_dt_compat[] = { | 68 | static const char * const sun8i_board_dt_compat[] = { |
69 | "allwinner,sun8i-a23", | 69 | "allwinner,sun8i-a23", |
70 | "allwinner,sun8i-a33", | ||
71 | "allwinner,sun8i-h3", | ||
70 | NULL, | 72 | NULL, |
71 | }; | 73 | }; |
72 | 74 | ||
73 | DT_MACHINE_START(SUN8I_DT, "Allwinner sun8i (A23) Family") | 75 | DT_MACHINE_START(SUN8I_DT, "Allwinner sun8i Family") |
76 | .init_time = sun6i_timer_init, | ||
74 | .dt_compat = sun8i_board_dt_compat, | 77 | .dt_compat = sun8i_board_dt_compat, |
75 | .init_late = sunxi_dt_cpufreq_init, | 78 | .init_late = sunxi_dt_cpufreq_init, |
76 | MACHINE_END | 79 | MACHINE_END |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 1ced8a0f7a52..cba12f34ff77 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -1971,7 +1971,7 @@ static int extend_iommu_mapping(struct dma_iommu_mapping *mapping) | |||
1971 | { | 1971 | { |
1972 | int next_bitmap; | 1972 | int next_bitmap; |
1973 | 1973 | ||
1974 | if (mapping->nr_bitmaps > mapping->extensions) | 1974 | if (mapping->nr_bitmaps >= mapping->extensions) |
1975 | return -EINVAL; | 1975 | return -EINVAL; |
1976 | 1976 | ||
1977 | next_bitmap = mapping->nr_bitmaps; | 1977 | next_bitmap = mapping->nr_bitmaps; |
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index 0716bbe19872..de2b246fed38 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S | |||
@@ -274,7 +274,10 @@ __v7_ca15mp_setup: | |||
274 | __v7_b15mp_setup: | 274 | __v7_b15mp_setup: |
275 | __v7_ca17mp_setup: | 275 | __v7_ca17mp_setup: |
276 | mov r10, #0 | 276 | mov r10, #0 |
277 | 1: | 277 | 1: adr r12, __v7_setup_stack @ the local stack |
278 | stmia r12, {r0-r5, lr} @ v7_invalidate_l1 touches r0-r6 | ||
279 | bl v7_invalidate_l1 | ||
280 | ldmia r12, {r0-r5, lr} | ||
278 | #ifdef CONFIG_SMP | 281 | #ifdef CONFIG_SMP |
279 | ALT_SMP(mrc p15, 0, r0, c1, c0, 1) | 282 | ALT_SMP(mrc p15, 0, r0, c1, c0, 1) |
280 | ALT_UP(mov r0, #(1 << 6)) @ fake it for UP | 283 | ALT_UP(mov r0, #(1 << 6)) @ fake it for UP |
@@ -283,7 +286,7 @@ __v7_ca17mp_setup: | |||
283 | orreq r0, r0, r10 @ Enable CPU-specific SMP bits | 286 | orreq r0, r0, r10 @ Enable CPU-specific SMP bits |
284 | mcreq p15, 0, r0, c1, c0, 1 | 287 | mcreq p15, 0, r0, c1, c0, 1 |
285 | #endif | 288 | #endif |
286 | b __v7_setup | 289 | b __v7_setup_cont |
287 | 290 | ||
288 | /* | 291 | /* |
289 | * Errata: | 292 | * Errata: |
@@ -413,10 +416,11 @@ __v7_pj4b_setup: | |||
413 | 416 | ||
414 | __v7_setup: | 417 | __v7_setup: |
415 | adr r12, __v7_setup_stack @ the local stack | 418 | adr r12, __v7_setup_stack @ the local stack |
416 | stmia r12, {r0-r5, r7, r9, r11, lr} | 419 | stmia r12, {r0-r5, lr} @ v7_invalidate_l1 touches r0-r6 |
417 | bl v7_invalidate_l1 | 420 | bl v7_invalidate_l1 |
418 | ldmia r12, {r0-r5, r7, r9, r11, lr} | 421 | ldmia r12, {r0-r5, lr} |
419 | 422 | ||
423 | __v7_setup_cont: | ||
420 | and r0, r9, #0xff000000 @ ARM? | 424 | and r0, r9, #0xff000000 @ ARM? |
421 | teq r0, #0x41000000 | 425 | teq r0, #0x41000000 |
422 | bne __errata_finish | 426 | bne __errata_finish |
@@ -480,7 +484,7 @@ ENDPROC(__v7_setup) | |||
480 | 484 | ||
481 | .align 2 | 485 | .align 2 |
482 | __v7_setup_stack: | 486 | __v7_setup_stack: |
483 | .space 4 * 11 @ 11 registers | 487 | .space 4 * 7 @ 12 registers |
484 | 488 | ||
485 | __INITDATA | 489 | __INITDATA |
486 | 490 | ||
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c index 4550d247e308..c011e2296cb1 100644 --- a/arch/arm/net/bpf_jit_32.c +++ b/arch/arm/net/bpf_jit_32.c | |||
@@ -74,32 +74,52 @@ struct jit_ctx { | |||
74 | 74 | ||
75 | int bpf_jit_enable __read_mostly; | 75 | int bpf_jit_enable __read_mostly; |
76 | 76 | ||
77 | static u64 jit_get_skb_b(struct sk_buff *skb, unsigned offset) | 77 | static inline int call_neg_helper(struct sk_buff *skb, int offset, void *ret, |
78 | unsigned int size) | ||
79 | { | ||
80 | void *ptr = bpf_internal_load_pointer_neg_helper(skb, offset, size); | ||
81 | |||
82 | if (!ptr) | ||
83 | return -EFAULT; | ||
84 | memcpy(ret, ptr, size); | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | static u64 jit_get_skb_b(struct sk_buff *skb, int offset) | ||
78 | { | 89 | { |
79 | u8 ret; | 90 | u8 ret; |
80 | int err; | 91 | int err; |
81 | 92 | ||
82 | err = skb_copy_bits(skb, offset, &ret, 1); | 93 | if (offset < 0) |
94 | err = call_neg_helper(skb, offset, &ret, 1); | ||
95 | else | ||
96 | err = skb_copy_bits(skb, offset, &ret, 1); | ||
83 | 97 | ||
84 | return (u64)err << 32 | ret; | 98 | return (u64)err << 32 | ret; |
85 | } | 99 | } |
86 | 100 | ||
87 | static u64 jit_get_skb_h(struct sk_buff *skb, unsigned offset) | 101 | static u64 jit_get_skb_h(struct sk_buff *skb, int offset) |
88 | { | 102 | { |
89 | u16 ret; | 103 | u16 ret; |
90 | int err; | 104 | int err; |
91 | 105 | ||
92 | err = skb_copy_bits(skb, offset, &ret, 2); | 106 | if (offset < 0) |
107 | err = call_neg_helper(skb, offset, &ret, 2); | ||
108 | else | ||
109 | err = skb_copy_bits(skb, offset, &ret, 2); | ||
93 | 110 | ||
94 | return (u64)err << 32 | ntohs(ret); | 111 | return (u64)err << 32 | ntohs(ret); |
95 | } | 112 | } |
96 | 113 | ||
97 | static u64 jit_get_skb_w(struct sk_buff *skb, unsigned offset) | 114 | static u64 jit_get_skb_w(struct sk_buff *skb, int offset) |
98 | { | 115 | { |
99 | u32 ret; | 116 | u32 ret; |
100 | int err; | 117 | int err; |
101 | 118 | ||
102 | err = skb_copy_bits(skb, offset, &ret, 4); | 119 | if (offset < 0) |
120 | err = call_neg_helper(skb, offset, &ret, 4); | ||
121 | else | ||
122 | err = skb_copy_bits(skb, offset, &ret, 4); | ||
103 | 123 | ||
104 | return (u64)err << 32 | ntohl(ret); | 124 | return (u64)err << 32 | ntohl(ret); |
105 | } | 125 | } |
@@ -536,9 +556,6 @@ static int build_body(struct jit_ctx *ctx) | |||
536 | case BPF_LD | BPF_B | BPF_ABS: | 556 | case BPF_LD | BPF_B | BPF_ABS: |
537 | load_order = 0; | 557 | load_order = 0; |
538 | load: | 558 | load: |
539 | /* the interpreter will deal with the negative K */ | ||
540 | if ((int)k < 0) | ||
541 | return -ENOTSUPP; | ||
542 | emit_mov_i(r_off, k, ctx); | 559 | emit_mov_i(r_off, k, ctx); |
543 | load_common: | 560 | load_common: |
544 | ctx->seen |= SEEN_DATA | SEEN_CALL; | 561 | ctx->seen |= SEEN_DATA | SEEN_CALL; |
@@ -547,12 +564,24 @@ load_common: | |||
547 | emit(ARM_SUB_I(r_scratch, r_skb_hl, | 564 | emit(ARM_SUB_I(r_scratch, r_skb_hl, |
548 | 1 << load_order), ctx); | 565 | 1 << load_order), ctx); |
549 | emit(ARM_CMP_R(r_scratch, r_off), ctx); | 566 | emit(ARM_CMP_R(r_scratch, r_off), ctx); |
550 | condt = ARM_COND_HS; | 567 | condt = ARM_COND_GE; |
551 | } else { | 568 | } else { |
552 | emit(ARM_CMP_R(r_skb_hl, r_off), ctx); | 569 | emit(ARM_CMP_R(r_skb_hl, r_off), ctx); |
553 | condt = ARM_COND_HI; | 570 | condt = ARM_COND_HI; |
554 | } | 571 | } |
555 | 572 | ||
573 | /* | ||
574 | * test for negative offset, only if we are | ||
575 | * currently scheduled to take the fast | ||
576 | * path. this will update the flags so that | ||
577 | * the slowpath instruction are ignored if the | ||
578 | * offset is negative. | ||
579 | * | ||
580 | * for loard_order == 0 the HI condition will | ||
581 | * make loads at offset 0 take the slow path too. | ||
582 | */ | ||
583 | _emit(condt, ARM_CMP_I(r_off, 0), ctx); | ||
584 | |||
556 | _emit(condt, ARM_ADD_R(r_scratch, r_off, r_skb_data), | 585 | _emit(condt, ARM_ADD_R(r_scratch, r_off, r_skb_data), |
557 | ctx); | 586 | ctx); |
558 | 587 | ||
@@ -860,9 +889,11 @@ b_epilogue: | |||
860 | off = offsetof(struct sk_buff, vlan_tci); | 889 | off = offsetof(struct sk_buff, vlan_tci); |
861 | emit(ARM_LDRH_I(r_A, r_skb, off), ctx); | 890 | emit(ARM_LDRH_I(r_A, r_skb, off), ctx); |
862 | if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) | 891 | if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) |
863 | OP_IMM3(ARM_AND, r_A, r_A, VLAN_VID_MASK, ctx); | 892 | OP_IMM3(ARM_AND, r_A, r_A, ~VLAN_TAG_PRESENT, ctx); |
864 | else | 893 | else { |
865 | OP_IMM3(ARM_AND, r_A, r_A, VLAN_TAG_PRESENT, ctx); | 894 | OP_IMM3(ARM_LSR, r_A, r_A, 12, ctx); |
895 | OP_IMM3(ARM_AND, r_A, r_A, 0x1, ctx); | ||
896 | } | ||
866 | break; | 897 | break; |
867 | case BPF_ANC | SKF_AD_QUEUE: | 898 | case BPF_ANC | SKF_AD_QUEUE: |
868 | ctx->seen |= SEEN_SKB; | 899 | ctx->seen |= SEEN_SKB; |
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 0f6edb14b7e4..318175f62c24 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
@@ -23,9 +23,9 @@ config ARM64 | |||
23 | select BUILDTIME_EXTABLE_SORT | 23 | select BUILDTIME_EXTABLE_SORT |
24 | select CLONE_BACKWARDS | 24 | select CLONE_BACKWARDS |
25 | select COMMON_CLK | 25 | select COMMON_CLK |
26 | select EDAC_SUPPORT | ||
27 | select CPU_PM if (SUSPEND || CPU_IDLE) | 26 | select CPU_PM if (SUSPEND || CPU_IDLE) |
28 | select DCACHE_WORD_ACCESS | 27 | select DCACHE_WORD_ACCESS |
28 | select EDAC_SUPPORT | ||
29 | select GENERIC_ALLOCATOR | 29 | select GENERIC_ALLOCATOR |
30 | select GENERIC_CLOCKEVENTS | 30 | select GENERIC_CLOCKEVENTS |
31 | select GENERIC_CLOCKEVENTS_BROADCAST if SMP | 31 | select GENERIC_CLOCKEVENTS_BROADCAST if SMP |
diff --git a/arch/arm64/boot/dts/apm/apm-mustang.dts b/arch/arm64/boot/dts/apm/apm-mustang.dts index 83578e766b94..4c55833d8a41 100644 --- a/arch/arm64/boot/dts/apm/apm-mustang.dts +++ b/arch/arm64/boot/dts/apm/apm-mustang.dts | |||
@@ -23,6 +23,16 @@ | |||
23 | device_type = "memory"; | 23 | device_type = "memory"; |
24 | reg = < 0x1 0x00000000 0x0 0x80000000 >; /* Updated by bootloader */ | 24 | reg = < 0x1 0x00000000 0x0 0x80000000 >; /* Updated by bootloader */ |
25 | }; | 25 | }; |
26 | |||
27 | gpio-keys { | ||
28 | compatible = "gpio-keys"; | ||
29 | button@1 { | ||
30 | label = "POWER"; | ||
31 | linux,code = <116>; | ||
32 | linux,input-type = <0x1>; | ||
33 | interrupts = <0x0 0x2d 0x1>; | ||
34 | }; | ||
35 | }; | ||
26 | }; | 36 | }; |
27 | 37 | ||
28 | &pcie0clk { | 38 | &pcie0clk { |
diff --git a/arch/arm64/boot/dts/arm/Makefile b/arch/arm64/boot/dts/arm/Makefile index c5c98b91514e..bb3c07209676 100644 --- a/arch/arm64/boot/dts/arm/Makefile +++ b/arch/arm64/boot/dts/arm/Makefile | |||
@@ -1,6 +1,7 @@ | |||
1 | dtb-$(CONFIG_ARCH_VEXPRESS) += foundation-v8.dtb | 1 | dtb-$(CONFIG_ARCH_VEXPRESS) += foundation-v8.dtb |
2 | dtb-$(CONFIG_ARCH_VEXPRESS) += juno.dtb juno-r1.dtb | 2 | dtb-$(CONFIG_ARCH_VEXPRESS) += juno.dtb juno-r1.dtb |
3 | dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb | 3 | dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb |
4 | dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2f-1xv7-ca53x2.dtb | ||
4 | 5 | ||
5 | always := $(dtb-y) | 6 | always := $(dtb-y) |
6 | subdir-y := $(dts-dirs) | 7 | subdir-y := $(dts-dirs) |
diff --git a/arch/arm64/boot/dts/arm/vexpress-v2f-1xv7-ca53x2.dts b/arch/arm64/boot/dts/arm/vexpress-v2f-1xv7-ca53x2.dts new file mode 100644 index 000000000000..5b1d0181023b --- /dev/null +++ b/arch/arm64/boot/dts/arm/vexpress-v2f-1xv7-ca53x2.dts | |||
@@ -0,0 +1,191 @@ | |||
1 | /* | ||
2 | * ARM Ltd. Versatile Express | ||
3 | * | ||
4 | * LogicTile Express 20MG | ||
5 | * V2F-1XV7 | ||
6 | * | ||
7 | * Cortex-A53 (2 cores) Soft Macrocell Model | ||
8 | * | ||
9 | * HBI-0247C | ||
10 | */ | ||
11 | |||
12 | /dts-v1/; | ||
13 | |||
14 | #include <dt-bindings/interrupt-controller/arm-gic.h> | ||
15 | |||
16 | / { | ||
17 | model = "V2F-1XV7 Cortex-A53x2 SMM"; | ||
18 | arm,hbi = <0x247>; | ||
19 | arm,vexpress,site = <0xf>; | ||
20 | compatible = "arm,vexpress,v2f-1xv7,ca53x2", "arm,vexpress,v2f-1xv7", "arm,vexpress"; | ||
21 | interrupt-parent = <&gic>; | ||
22 | #address-cells = <2>; | ||
23 | #size-cells = <2>; | ||
24 | |||
25 | chosen { | ||
26 | stdout-path = "serial0:38400n8"; | ||
27 | }; | ||
28 | |||
29 | aliases { | ||
30 | serial0 = &v2m_serial0; | ||
31 | serial1 = &v2m_serial1; | ||
32 | serial2 = &v2m_serial2; | ||
33 | serial3 = &v2m_serial3; | ||
34 | i2c0 = &v2m_i2c_dvi; | ||
35 | i2c1 = &v2m_i2c_pcie; | ||
36 | }; | ||
37 | |||
38 | cpus { | ||
39 | #address-cells = <2>; | ||
40 | #size-cells = <0>; | ||
41 | |||
42 | cpu@0 { | ||
43 | device_type = "cpu"; | ||
44 | compatible = "arm,cortex-a53", "arm,armv8"; | ||
45 | reg = <0 0>; | ||
46 | next-level-cache = <&L2_0>; | ||
47 | }; | ||
48 | |||
49 | cpu@1 { | ||
50 | device_type = "cpu"; | ||
51 | compatible = "arm,cortex-a53", "arm,armv8"; | ||
52 | reg = <0 1>; | ||
53 | next-level-cache = <&L2_0>; | ||
54 | }; | ||
55 | |||
56 | L2_0: l2-cache0 { | ||
57 | compatible = "cache"; | ||
58 | }; | ||
59 | }; | ||
60 | |||
61 | memory@80000000 { | ||
62 | device_type = "memory"; | ||
63 | reg = <0 0x80000000 0 0x80000000>; /* 2GB @ 2GB */ | ||
64 | }; | ||
65 | |||
66 | gic: interrupt-controller@2c001000 { | ||
67 | compatible = "arm,gic-400"; | ||
68 | #interrupt-cells = <3>; | ||
69 | #address-cells = <0>; | ||
70 | interrupt-controller; | ||
71 | reg = <0 0x2c001000 0 0x1000>, | ||
72 | <0 0x2c002000 0 0x2000>, | ||
73 | <0 0x2c004000 0 0x2000>, | ||
74 | <0 0x2c006000 0 0x2000>; | ||
75 | interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>; | ||
76 | }; | ||
77 | |||
78 | timer { | ||
79 | compatible = "arm,armv8-timer"; | ||
80 | interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, | ||
81 | <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, | ||
82 | <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, | ||
83 | <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>; | ||
84 | }; | ||
85 | |||
86 | pmu { | ||
87 | compatible = "arm,armv8-pmuv3"; | ||
88 | interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>, | ||
89 | <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>; | ||
90 | }; | ||
91 | |||
92 | dcc { | ||
93 | compatible = "arm,vexpress,config-bus"; | ||
94 | arm,vexpress,config-bridge = <&v2m_sysreg>; | ||
95 | |||
96 | smbclk: osc@4 { | ||
97 | /* SMC clock */ | ||
98 | compatible = "arm,vexpress-osc"; | ||
99 | arm,vexpress-sysreg,func = <1 4>; | ||
100 | freq-range = <40000000 40000000>; | ||
101 | #clock-cells = <0>; | ||
102 | clock-output-names = "smclk"; | ||
103 | }; | ||
104 | |||
105 | volt@0 { | ||
106 | /* VIO to expansion board above */ | ||
107 | compatible = "arm,vexpress-volt"; | ||
108 | arm,vexpress-sysreg,func = <2 0>; | ||
109 | regulator-name = "VIO_UP"; | ||
110 | regulator-min-microvolt = <800000>; | ||
111 | regulator-max-microvolt = <1800000>; | ||
112 | regulator-always-on; | ||
113 | }; | ||
114 | |||
115 | volt@1 { | ||
116 | /* 12V from power connector J6 */ | ||
117 | compatible = "arm,vexpress-volt"; | ||
118 | arm,vexpress-sysreg,func = <2 1>; | ||
119 | regulator-name = "12"; | ||
120 | regulator-always-on; | ||
121 | }; | ||
122 | |||
123 | temp@0 { | ||
124 | /* FPGA temperature */ | ||
125 | compatible = "arm,vexpress-temp"; | ||
126 | arm,vexpress-sysreg,func = <4 0>; | ||
127 | label = "FPGA"; | ||
128 | }; | ||
129 | }; | ||
130 | |||
131 | smb { | ||
132 | compatible = "simple-bus"; | ||
133 | |||
134 | #address-cells = <2>; | ||
135 | #size-cells = <1>; | ||
136 | ranges = <0 0 0 0x08000000 0x04000000>, | ||
137 | <1 0 0 0x14000000 0x04000000>, | ||
138 | <2 0 0 0x18000000 0x04000000>, | ||
139 | <3 0 0 0x1c000000 0x04000000>, | ||
140 | <4 0 0 0x0c000000 0x04000000>, | ||
141 | <5 0 0 0x10000000 0x04000000>; | ||
142 | |||
143 | #interrupt-cells = <1>; | ||
144 | interrupt-map-mask = <0 0 63>; | ||
145 | interrupt-map = <0 0 0 &gic GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, | ||
146 | <0 0 1 &gic GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, | ||
147 | <0 0 2 &gic GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>, | ||
148 | <0 0 3 &gic GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>, | ||
149 | <0 0 4 &gic GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>, | ||
150 | <0 0 5 &gic GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>, | ||
151 | <0 0 6 &gic GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>, | ||
152 | <0 0 7 &gic GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>, | ||
153 | <0 0 8 &gic GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>, | ||
154 | <0 0 9 &gic GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, | ||
155 | <0 0 10 &gic GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>, | ||
156 | <0 0 11 &gic GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, | ||
157 | <0 0 12 &gic GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>, | ||
158 | <0 0 13 &gic GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>, | ||
159 | <0 0 14 &gic GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>, | ||
160 | <0 0 15 &gic GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>, | ||
161 | <0 0 16 &gic GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>, | ||
162 | <0 0 17 &gic GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>, | ||
163 | <0 0 18 &gic GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>, | ||
164 | <0 0 19 &gic GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, | ||
165 | <0 0 20 &gic GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>, | ||
166 | <0 0 21 &gic GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>, | ||
167 | <0 0 22 &gic GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>, | ||
168 | <0 0 23 &gic GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>, | ||
169 | <0 0 24 &gic GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>, | ||
170 | <0 0 25 &gic GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>, | ||
171 | <0 0 26 &gic GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>, | ||
172 | <0 0 27 &gic GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>, | ||
173 | <0 0 28 &gic GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>, | ||
174 | <0 0 29 &gic GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>, | ||
175 | <0 0 30 &gic GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>, | ||
176 | <0 0 31 &gic GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>, | ||
177 | <0 0 32 &gic GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>, | ||
178 | <0 0 33 &gic GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>, | ||
179 | <0 0 34 &gic GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>, | ||
180 | <0 0 35 &gic GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>, | ||
181 | <0 0 36 &gic GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>, | ||
182 | <0 0 37 &gic GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>, | ||
183 | <0 0 38 &gic GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>, | ||
184 | <0 0 39 &gic GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>, | ||
185 | <0 0 40 &gic GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>, | ||
186 | <0 0 41 &gic GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>, | ||
187 | <0 0 42 &gic GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; | ||
188 | |||
189 | /include/ "../../../../arm/boot/dts/vexpress-v2m-rs1.dtsi" | ||
190 | }; | ||
191 | }; | ||
diff --git a/arch/arm64/boot/dts/cavium/thunder-88xx.dtsi b/arch/arm64/boot/dts/cavium/thunder-88xx.dtsi index d8c0bdc51882..9cb7cf94284a 100644 --- a/arch/arm64/boot/dts/cavium/thunder-88xx.dtsi +++ b/arch/arm64/boot/dts/cavium/thunder-88xx.dtsi | |||
@@ -376,10 +376,19 @@ | |||
376 | gic0: interrupt-controller@8010,00000000 { | 376 | gic0: interrupt-controller@8010,00000000 { |
377 | compatible = "arm,gic-v3"; | 377 | compatible = "arm,gic-v3"; |
378 | #interrupt-cells = <3>; | 378 | #interrupt-cells = <3>; |
379 | #address-cells = <2>; | ||
380 | #size-cells = <2>; | ||
381 | ranges; | ||
379 | interrupt-controller; | 382 | interrupt-controller; |
380 | reg = <0x8010 0x00000000 0x0 0x010000>, /* GICD */ | 383 | reg = <0x8010 0x00000000 0x0 0x010000>, /* GICD */ |
381 | <0x8010 0x80000000 0x0 0x600000>; /* GICR */ | 384 | <0x8010 0x80000000 0x0 0x600000>; /* GICR */ |
382 | interrupts = <1 9 0xf04>; | 385 | interrupts = <1 9 0xf04>; |
386 | |||
387 | its: gic-its@8010,00020000 { | ||
388 | compatible = "arm,gic-v3-its"; | ||
389 | msi-controller; | ||
390 | reg = <0x8010 0x20000 0x0 0x200000>; | ||
391 | }; | ||
383 | }; | 392 | }; |
384 | 393 | ||
385 | uaa0: serial@87e0,24000000 { | 394 | uaa0: serial@87e0,24000000 { |
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index f38c94f1d898..4e17e7ede33d 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig | |||
@@ -83,6 +83,7 @@ CONFIG_BLK_DEV_SD=y | |||
83 | CONFIG_ATA=y | 83 | CONFIG_ATA=y |
84 | CONFIG_SATA_AHCI=y | 84 | CONFIG_SATA_AHCI=y |
85 | CONFIG_SATA_AHCI_PLATFORM=y | 85 | CONFIG_SATA_AHCI_PLATFORM=y |
86 | CONFIG_AHCI_CEVA=y | ||
86 | CONFIG_AHCI_XGENE=y | 87 | CONFIG_AHCI_XGENE=y |
87 | CONFIG_PATA_PLATFORM=y | 88 | CONFIG_PATA_PLATFORM=y |
88 | CONFIG_PATA_OF_PLATFORM=y | 89 | CONFIG_PATA_OF_PLATFORM=y |
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild index b112a39834d0..70fd9ffb58cf 100644 --- a/arch/arm64/include/asm/Kbuild +++ b/arch/arm64/include/asm/Kbuild | |||
@@ -25,6 +25,7 @@ generic-y += kvm_para.h | |||
25 | generic-y += local.h | 25 | generic-y += local.h |
26 | generic-y += local64.h | 26 | generic-y += local64.h |
27 | generic-y += mcs_spinlock.h | 27 | generic-y += mcs_spinlock.h |
28 | generic-y += mm-arch-hooks.h | ||
28 | generic-y += mman.h | 29 | generic-y += mman.h |
29 | generic-y += msgbuf.h | 30 | generic-y += msgbuf.h |
30 | generic-y += msi.h | 31 | generic-y += msi.h |
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index 39248d3adf5d..406485ed110a 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h | |||
@@ -19,6 +19,14 @@ | |||
19 | #include <asm/psci.h> | 19 | #include <asm/psci.h> |
20 | #include <asm/smp_plat.h> | 20 | #include <asm/smp_plat.h> |
21 | 21 | ||
22 | /* Macros for consistency checks of the GICC subtable of MADT */ | ||
23 | #define ACPI_MADT_GICC_LENGTH \ | ||
24 | (acpi_gbl_FADT.header.revision < 6 ? 76 : 80) | ||
25 | |||
26 | #define BAD_MADT_GICC_ENTRY(entry, end) \ | ||
27 | (!(entry) || (unsigned long)(entry) + sizeof(*(entry)) > (end) || \ | ||
28 | (entry)->header.length != ACPI_MADT_GICC_LENGTH) | ||
29 | |||
22 | /* Basic configuration for ACPI */ | 30 | /* Basic configuration for ACPI */ |
23 | #ifdef CONFIG_ACPI | 31 | #ifdef CONFIG_ACPI |
24 | /* ACPI table mapping after acpi_gbl_permanent_mmap is set */ | 32 | /* ACPI table mapping after acpi_gbl_permanent_mmap is set */ |
diff --git a/arch/arm64/include/asm/mm-arch-hooks.h b/arch/arm64/include/asm/mm-arch-hooks.h deleted file mode 100644 index 562b655f5ba9..000000000000 --- a/arch/arm64/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_ARM64_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_ARM64_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_ARM64_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index a7691a378668..e16351819fed 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S | |||
@@ -352,8 +352,8 @@ el1_inv: | |||
352 | // TODO: add support for undefined instructions in kernel mode | 352 | // TODO: add support for undefined instructions in kernel mode |
353 | enable_dbg | 353 | enable_dbg |
354 | mov x0, sp | 354 | mov x0, sp |
355 | mov x2, x1 | ||
355 | mov x1, #BAD_SYNC | 356 | mov x1, #BAD_SYNC |
356 | mrs x2, esr_el1 | ||
357 | b bad_mode | 357 | b bad_mode |
358 | ENDPROC(el1_sync) | 358 | ENDPROC(el1_sync) |
359 | 359 | ||
@@ -553,7 +553,7 @@ el0_inv: | |||
553 | ct_user_exit | 553 | ct_user_exit |
554 | mov x0, sp | 554 | mov x0, sp |
555 | mov x1, #BAD_SYNC | 555 | mov x1, #BAD_SYNC |
556 | mrs x2, esr_el1 | 556 | mov x2, x25 |
557 | bl bad_mode | 557 | bl bad_mode |
558 | b ret_to_user | 558 | b ret_to_user |
559 | ENDPROC(el0_sync) | 559 | ENDPROC(el0_sync) |
@@ -585,7 +585,8 @@ ENDPROC(el0_irq) | |||
585 | * | 585 | * |
586 | */ | 586 | */ |
587 | ENTRY(cpu_switch_to) | 587 | ENTRY(cpu_switch_to) |
588 | add x8, x0, #THREAD_CPU_CONTEXT | 588 | mov x10, #THREAD_CPU_CONTEXT |
589 | add x8, x0, x10 | ||
589 | mov x9, sp | 590 | mov x9, sp |
590 | stp x19, x20, [x8], #16 // store callee-saved registers | 591 | stp x19, x20, [x8], #16 // store callee-saved registers |
591 | stp x21, x22, [x8], #16 | 592 | stp x21, x22, [x8], #16 |
@@ -594,7 +595,7 @@ ENTRY(cpu_switch_to) | |||
594 | stp x27, x28, [x8], #16 | 595 | stp x27, x28, [x8], #16 |
595 | stp x29, x9, [x8], #16 | 596 | stp x29, x9, [x8], #16 |
596 | str lr, [x8] | 597 | str lr, [x8] |
597 | add x8, x1, #THREAD_CPU_CONTEXT | 598 | add x8, x1, x10 |
598 | ldp x19, x20, [x8], #16 // restore callee-saved registers | 599 | ldp x19, x20, [x8], #16 // restore callee-saved registers |
599 | ldp x21, x22, [x8], #16 | 600 | ldp x21, x22, [x8], #16 |
600 | ldp x23, x24, [x8], #16 | 601 | ldp x23, x24, [x8], #16 |
diff --git a/arch/arm64/kernel/entry32.S b/arch/arm64/kernel/entry32.S index bd9bfaa9269b..f332d5d1f6b4 100644 --- a/arch/arm64/kernel/entry32.S +++ b/arch/arm64/kernel/entry32.S | |||
@@ -32,13 +32,11 @@ | |||
32 | 32 | ||
33 | ENTRY(compat_sys_sigreturn_wrapper) | 33 | ENTRY(compat_sys_sigreturn_wrapper) |
34 | mov x0, sp | 34 | mov x0, sp |
35 | mov x27, #0 // prevent syscall restart handling (why) | ||
36 | b compat_sys_sigreturn | 35 | b compat_sys_sigreturn |
37 | ENDPROC(compat_sys_sigreturn_wrapper) | 36 | ENDPROC(compat_sys_sigreturn_wrapper) |
38 | 37 | ||
39 | ENTRY(compat_sys_rt_sigreturn_wrapper) | 38 | ENTRY(compat_sys_rt_sigreturn_wrapper) |
40 | mov x0, sp | 39 | mov x0, sp |
41 | mov x27, #0 // prevent syscall restart handling (why) | ||
42 | b compat_sys_rt_sigreturn | 40 | b compat_sys_rt_sigreturn |
43 | ENDPROC(compat_sys_rt_sigreturn_wrapper) | 41 | ENDPROC(compat_sys_rt_sigreturn_wrapper) |
44 | 42 | ||
diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c index 240b75c0e94f..463fa2e7e34c 100644 --- a/arch/arm64/kernel/irq.c +++ b/arch/arm64/kernel/irq.c | |||
@@ -61,7 +61,7 @@ void __init init_IRQ(void) | |||
61 | static bool migrate_one_irq(struct irq_desc *desc) | 61 | static bool migrate_one_irq(struct irq_desc *desc) |
62 | { | 62 | { |
63 | struct irq_data *d = irq_desc_get_irq_data(desc); | 63 | struct irq_data *d = irq_desc_get_irq_data(desc); |
64 | const struct cpumask *affinity = d->affinity; | 64 | const struct cpumask *affinity = irq_data_get_affinity_mask(d); |
65 | struct irq_chip *c; | 65 | struct irq_chip *c; |
66 | bool ret = false; | 66 | bool ret = false; |
67 | 67 | ||
@@ -81,7 +81,7 @@ static bool migrate_one_irq(struct irq_desc *desc) | |||
81 | if (!c->irq_set_affinity) | 81 | if (!c->irq_set_affinity) |
82 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); | 82 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); |
83 | else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret) | 83 | else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret) |
84 | cpumask_copy(d->affinity, affinity); | 84 | cpumask_copy(irq_data_get_affinity_mask(d), affinity); |
85 | 85 | ||
86 | return ret; | 86 | return ret; |
87 | } | 87 | } |
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 695801a54ca5..50fb4696654e 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c | |||
@@ -438,7 +438,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header, | |||
438 | struct acpi_madt_generic_interrupt *processor; | 438 | struct acpi_madt_generic_interrupt *processor; |
439 | 439 | ||
440 | processor = (struct acpi_madt_generic_interrupt *)header; | 440 | processor = (struct acpi_madt_generic_interrupt *)header; |
441 | if (BAD_MADT_ENTRY(processor, end)) | 441 | if (BAD_MADT_GICC_ENTRY(processor, end)) |
442 | return -EINVAL; | 442 | return -EINVAL; |
443 | 443 | ||
444 | acpi_table_print_madt_entry(header); | 444 | acpi_table_print_madt_entry(header); |
diff --git a/arch/arm64/mm/Makefile b/arch/arm64/mm/Makefile index 9d84feb41a16..773d37a14039 100644 --- a/arch/arm64/mm/Makefile +++ b/arch/arm64/mm/Makefile | |||
@@ -4,5 +4,3 @@ obj-y := dma-mapping.o extable.o fault.o init.o \ | |||
4 | context.o proc.o pageattr.o | 4 | context.o proc.o pageattr.o |
5 | obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o | 5 | obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o |
6 | obj-$(CONFIG_ARM64_PTDUMP) += dump.o | 6 | obj-$(CONFIG_ARM64_PTDUMP) += dump.o |
7 | |||
8 | CFLAGS_mmu.o := -I$(srctree)/scripts/dtc/libfdt/ | ||
diff --git a/arch/avr32/include/asm/Kbuild b/arch/avr32/include/asm/Kbuild index 1d66afdfac07..f61f2dd67464 100644 --- a/arch/avr32/include/asm/Kbuild +++ b/arch/avr32/include/asm/Kbuild | |||
@@ -12,6 +12,7 @@ generic-y += irq_work.h | |||
12 | generic-y += local.h | 12 | generic-y += local.h |
13 | generic-y += local64.h | 13 | generic-y += local64.h |
14 | generic-y += mcs_spinlock.h | 14 | generic-y += mcs_spinlock.h |
15 | generic-y += mm-arch-hooks.h | ||
15 | generic-y += param.h | 16 | generic-y += param.h |
16 | generic-y += percpu.h | 17 | generic-y += percpu.h |
17 | generic-y += preempt.h | 18 | generic-y += preempt.h |
diff --git a/arch/avr32/include/asm/mm-arch-hooks.h b/arch/avr32/include/asm/mm-arch-hooks.h deleted file mode 100644 index 145452ffbdad..000000000000 --- a/arch/avr32/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_AVR32_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_AVR32_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_AVR32_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c index d0f771be9e96..a124c55733db 100644 --- a/arch/avr32/kernel/time.c +++ b/arch/avr32/kernel/time.c | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | #include <mach/pm.h> | 19 | #include <mach/pm.h> |
20 | 20 | ||
21 | static bool disable_cpu_idle_poll; | ||
21 | 22 | ||
22 | static cycle_t read_cycle_count(struct clocksource *cs) | 23 | static cycle_t read_cycle_count(struct clocksource *cs) |
23 | { | 24 | { |
@@ -80,45 +81,45 @@ static int comparator_next_event(unsigned long delta, | |||
80 | return 0; | 81 | return 0; |
81 | } | 82 | } |
82 | 83 | ||
83 | static void comparator_mode(enum clock_event_mode mode, | 84 | static int comparator_shutdown(struct clock_event_device *evdev) |
84 | struct clock_event_device *evdev) | ||
85 | { | 85 | { |
86 | switch (mode) { | 86 | pr_debug("%s: %s\n", __func__, evdev->name); |
87 | case CLOCK_EVT_MODE_ONESHOT: | 87 | sysreg_write(COMPARE, 0); |
88 | pr_debug("%s: start\n", evdev->name); | 88 | |
89 | /* FALLTHROUGH */ | 89 | if (disable_cpu_idle_poll) { |
90 | case CLOCK_EVT_MODE_RESUME: | 90 | disable_cpu_idle_poll = false; |
91 | /* | 91 | /* |
92 | * If we're using the COUNT and COMPARE registers we | 92 | * Only disable idle poll if we have forced that |
93 | * need to force idle poll. | 93 | * in a previous call. |
94 | */ | 94 | */ |
95 | cpu_idle_poll_ctrl(true); | 95 | cpu_idle_poll_ctrl(false); |
96 | break; | ||
97 | case CLOCK_EVT_MODE_UNUSED: | ||
98 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
99 | sysreg_write(COMPARE, 0); | ||
100 | pr_debug("%s: stop\n", evdev->name); | ||
101 | if (evdev->mode == CLOCK_EVT_MODE_ONESHOT || | ||
102 | evdev->mode == CLOCK_EVT_MODE_RESUME) { | ||
103 | /* | ||
104 | * Only disable idle poll if we have forced that | ||
105 | * in a previous call. | ||
106 | */ | ||
107 | cpu_idle_poll_ctrl(false); | ||
108 | } | ||
109 | break; | ||
110 | default: | ||
111 | BUG(); | ||
112 | } | 96 | } |
97 | return 0; | ||
98 | } | ||
99 | |||
100 | static int comparator_set_oneshot(struct clock_event_device *evdev) | ||
101 | { | ||
102 | pr_debug("%s: %s\n", __func__, evdev->name); | ||
103 | |||
104 | disable_cpu_idle_poll = true; | ||
105 | /* | ||
106 | * If we're using the COUNT and COMPARE registers we | ||
107 | * need to force idle poll. | ||
108 | */ | ||
109 | cpu_idle_poll_ctrl(true); | ||
110 | |||
111 | return 0; | ||
113 | } | 112 | } |
114 | 113 | ||
115 | static struct clock_event_device comparator = { | 114 | static struct clock_event_device comparator = { |
116 | .name = "avr32_comparator", | 115 | .name = "avr32_comparator", |
117 | .features = CLOCK_EVT_FEAT_ONESHOT, | 116 | .features = CLOCK_EVT_FEAT_ONESHOT, |
118 | .shift = 16, | 117 | .shift = 16, |
119 | .rating = 50, | 118 | .rating = 50, |
120 | .set_next_event = comparator_next_event, | 119 | .set_next_event = comparator_next_event, |
121 | .set_mode = comparator_mode, | 120 | .set_state_shutdown = comparator_shutdown, |
121 | .set_state_oneshot = comparator_set_oneshot, | ||
122 | .tick_resume = comparator_set_oneshot, | ||
122 | }; | 123 | }; |
123 | 124 | ||
124 | void read_persistent_clock(struct timespec *ts) | 125 | void read_persistent_clock(struct timespec *ts) |
diff --git a/arch/blackfin/include/asm/Kbuild b/arch/blackfin/include/asm/Kbuild index 07051a63415d..61cd1e786a14 100644 --- a/arch/blackfin/include/asm/Kbuild +++ b/arch/blackfin/include/asm/Kbuild | |||
@@ -21,6 +21,7 @@ generic-y += kvm_para.h | |||
21 | generic-y += local.h | 21 | generic-y += local.h |
22 | generic-y += local64.h | 22 | generic-y += local64.h |
23 | generic-y += mcs_spinlock.h | 23 | generic-y += mcs_spinlock.h |
24 | generic-y += mm-arch-hooks.h | ||
24 | generic-y += mman.h | 25 | generic-y += mman.h |
25 | generic-y += msgbuf.h | 26 | generic-y += msgbuf.h |
26 | generic-y += mutex.h | 27 | generic-y += mutex.h |
diff --git a/arch/blackfin/include/asm/mm-arch-hooks.h b/arch/blackfin/include/asm/mm-arch-hooks.h deleted file mode 100644 index 1c5211ec338f..000000000000 --- a/arch/blackfin/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_BLACKFIN_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_BLACKFIN_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_BLACKFIN_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild index 7aeb32272975..f17c4dc6050c 100644 --- a/arch/c6x/include/asm/Kbuild +++ b/arch/c6x/include/asm/Kbuild | |||
@@ -26,6 +26,7 @@ generic-y += kdebug.h | |||
26 | generic-y += kmap_types.h | 26 | generic-y += kmap_types.h |
27 | generic-y += local.h | 27 | generic-y += local.h |
28 | generic-y += mcs_spinlock.h | 28 | generic-y += mcs_spinlock.h |
29 | generic-y += mm-arch-hooks.h | ||
29 | generic-y += mman.h | 30 | generic-y += mman.h |
30 | generic-y += mmu.h | 31 | generic-y += mmu.h |
31 | generic-y += mmu_context.h | 32 | generic-y += mmu_context.h |
diff --git a/arch/c6x/include/asm/mm-arch-hooks.h b/arch/c6x/include/asm/mm-arch-hooks.h deleted file mode 100644 index bb3c4a6ce8e9..000000000000 --- a/arch/c6x/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_C6X_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_C6X_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_C6X_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c index 4dda9bd6b8fb..e989cee77414 100644 --- a/arch/cris/arch-v32/drivers/sync_serial.c +++ b/arch/cris/arch-v32/drivers/sync_serial.c | |||
@@ -1464,7 +1464,7 @@ static inline void handle_rx_packet(struct sync_port *port) | |||
1464 | if (port->write_ts_idx == NBR_IN_DESCR) | 1464 | if (port->write_ts_idx == NBR_IN_DESCR) |
1465 | port->write_ts_idx = 0; | 1465 | port->write_ts_idx = 0; |
1466 | idx = port->write_ts_idx++; | 1466 | idx = port->write_ts_idx++; |
1467 | do_posix_clock_monotonic_gettime(&port->timestamp[idx]); | 1467 | ktime_get_ts(&port->timestamp[idx]); |
1468 | port->in_buffer_len += port->inbufchunk; | 1468 | port->in_buffer_len += port->inbufchunk; |
1469 | } | 1469 | } |
1470 | spin_unlock_irqrestore(&port->lock, flags); | 1470 | spin_unlock_irqrestore(&port->lock, flags); |
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild index d294f6aaff1d..ad2244f35bca 100644 --- a/arch/cris/include/asm/Kbuild +++ b/arch/cris/include/asm/Kbuild | |||
@@ -18,6 +18,7 @@ generic-y += linkage.h | |||
18 | generic-y += local.h | 18 | generic-y += local.h |
19 | generic-y += local64.h | 19 | generic-y += local64.h |
20 | generic-y += mcs_spinlock.h | 20 | generic-y += mcs_spinlock.h |
21 | generic-y += mm-arch-hooks.h | ||
21 | generic-y += module.h | 22 | generic-y += module.h |
22 | generic-y += percpu.h | 23 | generic-y += percpu.h |
23 | generic-y += preempt.h | 24 | generic-y += preempt.h |
diff --git a/arch/cris/include/asm/mm-arch-hooks.h b/arch/cris/include/asm/mm-arch-hooks.h deleted file mode 100644 index 314f774db2b0..000000000000 --- a/arch/cris/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_CRIS_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_CRIS_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_CRIS_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/frv/include/asm/Kbuild b/arch/frv/include/asm/Kbuild index 30edce31e5c2..8e47b832cc76 100644 --- a/arch/frv/include/asm/Kbuild +++ b/arch/frv/include/asm/Kbuild | |||
@@ -4,5 +4,6 @@ generic-y += cputime.h | |||
4 | generic-y += exec.h | 4 | generic-y += exec.h |
5 | generic-y += irq_work.h | 5 | generic-y += irq_work.h |
6 | generic-y += mcs_spinlock.h | 6 | generic-y += mcs_spinlock.h |
7 | generic-y += mm-arch-hooks.h | ||
7 | generic-y += preempt.h | 8 | generic-y += preempt.h |
8 | generic-y += trace_clock.h | 9 | generic-y += trace_clock.h |
diff --git a/arch/frv/include/asm/mm-arch-hooks.h b/arch/frv/include/asm/mm-arch-hooks.h deleted file mode 100644 index 51d13a870404..000000000000 --- a/arch/frv/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_FRV_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_FRV_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_FRV_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild index 00379d64f707..70e6ae1e7006 100644 --- a/arch/h8300/include/asm/Kbuild +++ b/arch/h8300/include/asm/Kbuild | |||
@@ -33,6 +33,7 @@ generic-y += linkage.h | |||
33 | generic-y += local.h | 33 | generic-y += local.h |
34 | generic-y += local64.h | 34 | generic-y += local64.h |
35 | generic-y += mcs_spinlock.h | 35 | generic-y += mcs_spinlock.h |
36 | generic-y += mm-arch-hooks.h | ||
36 | generic-y += mman.h | 37 | generic-y += mman.h |
37 | generic-y += mmu.h | 38 | generic-y += mmu.h |
38 | generic-y += mmu_context.h | 39 | generic-y += mmu_context.h |
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild index 5ade4a163558..daee37bd0999 100644 --- a/arch/hexagon/include/asm/Kbuild +++ b/arch/hexagon/include/asm/Kbuild | |||
@@ -28,6 +28,7 @@ generic-y += kmap_types.h | |||
28 | generic-y += local.h | 28 | generic-y += local.h |
29 | generic-y += local64.h | 29 | generic-y += local64.h |
30 | generic-y += mcs_spinlock.h | 30 | generic-y += mcs_spinlock.h |
31 | generic-y += mm-arch-hooks.h | ||
31 | generic-y += mman.h | 32 | generic-y += mman.h |
32 | generic-y += msgbuf.h | 33 | generic-y += msgbuf.h |
33 | generic-y += pci.h | 34 | generic-y += pci.h |
diff --git a/arch/hexagon/include/asm/mm-arch-hooks.h b/arch/hexagon/include/asm/mm-arch-hooks.h deleted file mode 100644 index 05e8b939e416..000000000000 --- a/arch/hexagon/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_HEXAGON_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_HEXAGON_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_HEXAGON_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild index ccff13d33fa2..9de3ba12f6b9 100644 --- a/arch/ia64/include/asm/Kbuild +++ b/arch/ia64/include/asm/Kbuild | |||
@@ -4,6 +4,7 @@ generic-y += exec.h | |||
4 | generic-y += irq_work.h | 4 | generic-y += irq_work.h |
5 | generic-y += kvm_para.h | 5 | generic-y += kvm_para.h |
6 | generic-y += mcs_spinlock.h | 6 | generic-y += mcs_spinlock.h |
7 | generic-y += mm-arch-hooks.h | ||
7 | generic-y += preempt.h | 8 | generic-y += preempt.h |
8 | generic-y += trace_clock.h | 9 | generic-y += trace_clock.h |
9 | generic-y += vtime.h | 10 | generic-y += vtime.h |
diff --git a/arch/ia64/include/asm/mm-arch-hooks.h b/arch/ia64/include/asm/mm-arch-hooks.h deleted file mode 100644 index ab4b5c698322..000000000000 --- a/arch/ia64/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_IA64_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_IA64_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_IA64_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild index ba1cdc018731..e0eb704ca1fa 100644 --- a/arch/m32r/include/asm/Kbuild +++ b/arch/m32r/include/asm/Kbuild | |||
@@ -4,6 +4,7 @@ generic-y += cputime.h | |||
4 | generic-y += exec.h | 4 | generic-y += exec.h |
5 | generic-y += irq_work.h | 5 | generic-y += irq_work.h |
6 | generic-y += mcs_spinlock.h | 6 | generic-y += mcs_spinlock.h |
7 | generic-y += mm-arch-hooks.h | ||
7 | generic-y += module.h | 8 | generic-y += module.h |
8 | generic-y += preempt.h | 9 | generic-y += preempt.h |
9 | generic-y += sections.h | 10 | generic-y += sections.h |
diff --git a/arch/m32r/include/asm/io.h b/arch/m32r/include/asm/io.h index 0c3f25ee3381..f8de767ce2bc 100644 --- a/arch/m32r/include/asm/io.h +++ b/arch/m32r/include/asm/io.h | |||
@@ -174,6 +174,11 @@ static inline void _writel(unsigned long l, unsigned long addr) | |||
174 | #define iowrite16 writew | 174 | #define iowrite16 writew |
175 | #define iowrite32 writel | 175 | #define iowrite32 writel |
176 | 176 | ||
177 | #define ioread16be(addr) be16_to_cpu(readw(addr)) | ||
178 | #define ioread32be(addr) be32_to_cpu(readl(addr)) | ||
179 | #define iowrite16be(v, addr) writew(cpu_to_be16(v), (addr)) | ||
180 | #define iowrite32be(v, addr) writel(cpu_to_be32(v), (addr)) | ||
181 | |||
177 | #define mmiowb() | 182 | #define mmiowb() |
178 | 183 | ||
179 | #define flush_write_buffers() do { } while (0) /* M32R_FIXME */ | 184 | #define flush_write_buffers() do { } while (0) /* M32R_FIXME */ |
diff --git a/arch/m32r/include/asm/mm-arch-hooks.h b/arch/m32r/include/asm/mm-arch-hooks.h deleted file mode 100644 index 6d60b4750f41..000000000000 --- a/arch/m32r/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_M32R_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_M32R_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_M32R_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu index 33013dfcd3e1..c496d48a8c8d 100644 --- a/arch/m68k/Kconfig.cpu +++ b/arch/m68k/Kconfig.cpu | |||
@@ -125,6 +125,13 @@ endif # M68KCLASSIC | |||
125 | 125 | ||
126 | if COLDFIRE | 126 | if COLDFIRE |
127 | 127 | ||
128 | choice | ||
129 | prompt "ColdFire SoC type" | ||
130 | default M520x | ||
131 | help | ||
132 | Select the type of ColdFire System-on-Chip (SoC) that you want | ||
133 | to build for. | ||
134 | |||
128 | config M5206 | 135 | config M5206 |
129 | bool "MCF5206" | 136 | bool "MCF5206" |
130 | depends on !MMU | 137 | depends on !MMU |
@@ -174,9 +181,6 @@ config M525x | |||
174 | help | 181 | help |
175 | Freescale (Motorola) Coldfire 5251/5253 processor support. | 182 | Freescale (Motorola) Coldfire 5251/5253 processor support. |
176 | 183 | ||
177 | config M527x | ||
178 | bool | ||
179 | |||
180 | config M5271 | 184 | config M5271 |
181 | bool "MCF5271" | 185 | bool "MCF5271" |
182 | depends on !MMU | 186 | depends on !MMU |
@@ -223,9 +227,6 @@ config M5307 | |||
223 | help | 227 | help |
224 | Motorola ColdFire 5307 processor support. | 228 | Motorola ColdFire 5307 processor support. |
225 | 229 | ||
226 | config M53xx | ||
227 | bool | ||
228 | |||
229 | config M532x | 230 | config M532x |
230 | bool "MCF532x" | 231 | bool "MCF532x" |
231 | depends on !MMU | 232 | depends on !MMU |
@@ -251,9 +252,6 @@ config M5407 | |||
251 | help | 252 | help |
252 | Motorola ColdFire 5407 processor support. | 253 | Motorola ColdFire 5407 processor support. |
253 | 254 | ||
254 | config M54xx | ||
255 | bool | ||
256 | |||
257 | config M547x | 255 | config M547x |
258 | bool "MCF547x" | 256 | bool "MCF547x" |
259 | select M54xx | 257 | select M54xx |
@@ -280,6 +278,17 @@ config M5441x | |||
280 | help | 278 | help |
281 | Freescale Coldfire 54410/54415/54416/54417/54418 processor support. | 279 | Freescale Coldfire 54410/54415/54416/54417/54418 processor support. |
282 | 280 | ||
281 | endchoice | ||
282 | |||
283 | config M527x | ||
284 | bool | ||
285 | |||
286 | config M53xx | ||
287 | bool | ||
288 | |||
289 | config M54xx | ||
290 | bool | ||
291 | |||
283 | endif # COLDFIRE | 292 | endif # COLDFIRE |
284 | 293 | ||
285 | 294 | ||
@@ -416,22 +425,18 @@ config HAVE_MBAR | |||
416 | config HAVE_IPSBAR | 425 | config HAVE_IPSBAR |
417 | bool | 426 | bool |
418 | 427 | ||
419 | config CLOCK_SET | ||
420 | bool "Enable setting the CPU clock frequency" | ||
421 | depends on COLDFIRE | ||
422 | default n | ||
423 | help | ||
424 | On some CPU's you do not need to know what the core CPU clock | ||
425 | frequency is. On these you can disable clock setting. On some | ||
426 | traditional 68K parts, and on all ColdFire parts you need to set | ||
427 | the appropriate CPU clock frequency. On these devices many of the | ||
428 | onboard peripherals derive their timing from the master CPU clock | ||
429 | frequency. | ||
430 | |||
431 | config CLOCK_FREQ | 428 | config CLOCK_FREQ |
432 | int "Set the core clock frequency" | 429 | int "Set the core clock frequency" |
430 | default "25000000" if M5206 | ||
431 | default "54000000" if M5206e | ||
432 | default "166666666" if M520x | ||
433 | default "140000000" if M5249 | ||
434 | default "150000000" if M527x || M523x | ||
435 | default "90000000" if M5307 | ||
436 | default "50000000" if M5407 | ||
437 | default "266000000" if M54xx | ||
433 | default "66666666" | 438 | default "66666666" |
434 | depends on CLOCK_SET | 439 | depends on COLDFIRE |
435 | help | 440 | help |
436 | Define the CPU clock frequency in use. This is the core clock | 441 | Define the CPU clock frequency in use. This is the core clock |
437 | frequency, it may or may not be the same as the external clock | 442 | frequency, it may or may not be the same as the external clock |
diff --git a/arch/m68k/configs/m5208evb_defconfig b/arch/m68k/configs/m5208evb_defconfig index e7292f460af4..4c7b7938d53a 100644 --- a/arch/m68k/configs/m5208evb_defconfig +++ b/arch/m68k/configs/m5208evb_defconfig | |||
@@ -1,10 +1,6 @@ | |||
1 | # CONFIG_MMU is not set | ||
2 | CONFIG_EXPERIMENTAL=y | ||
3 | CONFIG_LOG_BUF_SHIFT=14 | 1 | CONFIG_LOG_BUF_SHIFT=14 |
4 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | ||
5 | CONFIG_EXPERT=y | 2 | CONFIG_EXPERT=y |
6 | # CONFIG_KALLSYMS is not set | 3 | # CONFIG_KALLSYMS is not set |
7 | # CONFIG_HOTPLUG is not set | ||
8 | # CONFIG_FUTEX is not set | 4 | # CONFIG_FUTEX is not set |
9 | # CONFIG_EPOLL is not set | 5 | # CONFIG_EPOLL is not set |
10 | # CONFIG_SIGNALFD is not set | 6 | # CONFIG_SIGNALFD is not set |
@@ -16,17 +12,12 @@ CONFIG_EXPERT=y | |||
16 | # CONFIG_BLK_DEV_BSG is not set | 12 | # CONFIG_BLK_DEV_BSG is not set |
17 | # CONFIG_IOSCHED_DEADLINE is not set | 13 | # CONFIG_IOSCHED_DEADLINE is not set |
18 | # CONFIG_IOSCHED_CFQ is not set | 14 | # CONFIG_IOSCHED_CFQ is not set |
19 | CONFIG_M520x=y | 15 | # CONFIG_MMU is not set |
20 | CONFIG_CLOCK_SET=y | ||
21 | CONFIG_CLOCK_FREQ=166666666 | ||
22 | CONFIG_CLOCK_DIV=2 | ||
23 | CONFIG_M5208EVB=y | ||
24 | # CONFIG_4KSTACKS is not set | 16 | # CONFIG_4KSTACKS is not set |
25 | CONFIG_RAMBASE=0x40000000 | 17 | CONFIG_RAMBASE=0x40000000 |
26 | CONFIG_RAMSIZE=0x2000000 | 18 | CONFIG_RAMSIZE=0x2000000 |
27 | CONFIG_VECTORBASE=0x40000000 | 19 | CONFIG_VECTORBASE=0x40000000 |
28 | CONFIG_KERNELBASE=0x40020000 | 20 | CONFIG_KERNELBASE=0x40020000 |
29 | CONFIG_RAM16BIT=y | ||
30 | CONFIG_BINFMT_FLAT=y | 21 | CONFIG_BINFMT_FLAT=y |
31 | CONFIG_NET=y | 22 | CONFIG_NET=y |
32 | CONFIG_PACKET=y | 23 | CONFIG_PACKET=y |
@@ -40,24 +31,19 @@ CONFIG_INET=y | |||
40 | # CONFIG_IPV6 is not set | 31 | # CONFIG_IPV6 is not set |
41 | # CONFIG_FW_LOADER is not set | 32 | # CONFIG_FW_LOADER is not set |
42 | CONFIG_MTD=y | 33 | CONFIG_MTD=y |
43 | CONFIG_MTD_CHAR=y | ||
44 | CONFIG_MTD_BLOCK=y | 34 | CONFIG_MTD_BLOCK=y |
45 | CONFIG_MTD_RAM=y | 35 | CONFIG_MTD_RAM=y |
46 | CONFIG_MTD_UCLINUX=y | 36 | CONFIG_MTD_UCLINUX=y |
47 | CONFIG_BLK_DEV_RAM=y | 37 | CONFIG_BLK_DEV_RAM=y |
48 | # CONFIG_MISC_DEVICES is not set | ||
49 | CONFIG_NETDEVICES=y | 38 | CONFIG_NETDEVICES=y |
50 | CONFIG_NET_ETHERNET=y | ||
51 | CONFIG_FEC=y | 39 | CONFIG_FEC=y |
52 | # CONFIG_NETDEV_1000 is not set | ||
53 | # CONFIG_NETDEV_10000 is not set | ||
54 | # CONFIG_INPUT is not set | 40 | # CONFIG_INPUT is not set |
55 | # CONFIG_SERIO is not set | 41 | # CONFIG_SERIO is not set |
56 | # CONFIG_VT is not set | 42 | # CONFIG_VT is not set |
43 | # CONFIG_UNIX98_PTYS is not set | ||
57 | CONFIG_SERIAL_MCF=y | 44 | CONFIG_SERIAL_MCF=y |
58 | CONFIG_SERIAL_MCF_BAUDRATE=115200 | 45 | CONFIG_SERIAL_MCF_BAUDRATE=115200 |
59 | CONFIG_SERIAL_MCF_CONSOLE=y | 46 | CONFIG_SERIAL_MCF_CONSOLE=y |
60 | # CONFIG_UNIX98_PTYS is not set | ||
61 | # CONFIG_HW_RANDOM is not set | 47 | # CONFIG_HW_RANDOM is not set |
62 | # CONFIG_HWMON is not set | 48 | # CONFIG_HWMON is not set |
63 | # CONFIG_USB_SUPPORT is not set | 49 | # CONFIG_USB_SUPPORT is not set |
@@ -68,8 +54,6 @@ CONFIG_EXT2_FS=y | |||
68 | CONFIG_ROMFS_FS=y | 54 | CONFIG_ROMFS_FS=y |
69 | CONFIG_ROMFS_BACKED_BY_MTD=y | 55 | CONFIG_ROMFS_BACKED_BY_MTD=y |
70 | # CONFIG_NETWORK_FILESYSTEMS is not set | 56 | # CONFIG_NETWORK_FILESYSTEMS is not set |
71 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
72 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
73 | CONFIG_FULLDEBUG=y | ||
74 | CONFIG_BOOTPARAM=y | 57 | CONFIG_BOOTPARAM=y |
75 | CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" | 58 | CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" |
59 | CONFIG_FULLDEBUG=y | ||
diff --git a/arch/m68k/configs/m5249evb_defconfig b/arch/m68k/configs/m5249evb_defconfig index 0cd4b39f325b..a782f368650f 100644 --- a/arch/m68k/configs/m5249evb_defconfig +++ b/arch/m68k/configs/m5249evb_defconfig | |||
@@ -1,10 +1,6 @@ | |||
1 | # CONFIG_MMU is not set | ||
2 | CONFIG_EXPERIMENTAL=y | ||
3 | CONFIG_LOG_BUF_SHIFT=14 | 1 | CONFIG_LOG_BUF_SHIFT=14 |
4 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | ||
5 | CONFIG_EXPERT=y | 2 | CONFIG_EXPERT=y |
6 | # CONFIG_KALLSYMS is not set | 3 | # CONFIG_KALLSYMS is not set |
7 | # CONFIG_HOTPLUG is not set | ||
8 | # CONFIG_FUTEX is not set | 4 | # CONFIG_FUTEX is not set |
9 | # CONFIG_EPOLL is not set | 5 | # CONFIG_EPOLL is not set |
10 | # CONFIG_SIGNALFD is not set | 6 | # CONFIG_SIGNALFD is not set |
@@ -16,10 +12,8 @@ CONFIG_EXPERT=y | |||
16 | # CONFIG_BLK_DEV_BSG is not set | 12 | # CONFIG_BLK_DEV_BSG is not set |
17 | # CONFIG_IOSCHED_DEADLINE is not set | 13 | # CONFIG_IOSCHED_DEADLINE is not set |
18 | # CONFIG_IOSCHED_CFQ is not set | 14 | # CONFIG_IOSCHED_CFQ is not set |
15 | # CONFIG_MMU is not set | ||
19 | CONFIG_M5249=y | 16 | CONFIG_M5249=y |
20 | CONFIG_CLOCK_SET=y | ||
21 | CONFIG_CLOCK_FREQ=140000000 | ||
22 | CONFIG_CLOCK_DIV=2 | ||
23 | CONFIG_M5249C3=y | 17 | CONFIG_M5249C3=y |
24 | CONFIG_RAMBASE=0x00000000 | 18 | CONFIG_RAMBASE=0x00000000 |
25 | CONFIG_RAMSIZE=0x00800000 | 19 | CONFIG_RAMSIZE=0x00800000 |
@@ -38,23 +32,18 @@ CONFIG_INET=y | |||
38 | # CONFIG_IPV6 is not set | 32 | # CONFIG_IPV6 is not set |
39 | # CONFIG_FW_LOADER is not set | 33 | # CONFIG_FW_LOADER is not set |
40 | CONFIG_MTD=y | 34 | CONFIG_MTD=y |
41 | CONFIG_MTD_CHAR=y | ||
42 | CONFIG_MTD_BLOCK=y | 35 | CONFIG_MTD_BLOCK=y |
43 | CONFIG_MTD_RAM=y | 36 | CONFIG_MTD_RAM=y |
44 | CONFIG_MTD_UCLINUX=y | 37 | CONFIG_MTD_UCLINUX=y |
45 | CONFIG_BLK_DEV_RAM=y | 38 | CONFIG_BLK_DEV_RAM=y |
46 | # CONFIG_MISC_DEVICES is not set | ||
47 | CONFIG_NETDEVICES=y | 39 | CONFIG_NETDEVICES=y |
48 | CONFIG_NET_ETHERNET=y | ||
49 | # CONFIG_NETDEV_1000 is not set | ||
50 | # CONFIG_NETDEV_10000 is not set | ||
51 | CONFIG_PPP=y | 40 | CONFIG_PPP=y |
52 | # CONFIG_INPUT is not set | 41 | # CONFIG_INPUT is not set |
53 | # CONFIG_SERIO is not set | 42 | # CONFIG_SERIO is not set |
54 | # CONFIG_VT is not set | 43 | # CONFIG_VT is not set |
44 | # CONFIG_UNIX98_PTYS is not set | ||
55 | CONFIG_SERIAL_MCF=y | 45 | CONFIG_SERIAL_MCF=y |
56 | CONFIG_SERIAL_MCF_CONSOLE=y | 46 | CONFIG_SERIAL_MCF_CONSOLE=y |
57 | # CONFIG_UNIX98_PTYS is not set | ||
58 | # CONFIG_HWMON is not set | 47 | # CONFIG_HWMON is not set |
59 | # CONFIG_USB_SUPPORT is not set | 48 | # CONFIG_USB_SUPPORT is not set |
60 | CONFIG_EXT2_FS=y | 49 | CONFIG_EXT2_FS=y |
@@ -62,7 +51,5 @@ CONFIG_EXT2_FS=y | |||
62 | CONFIG_ROMFS_FS=y | 51 | CONFIG_ROMFS_FS=y |
63 | CONFIG_ROMFS_BACKED_BY_MTD=y | 52 | CONFIG_ROMFS_BACKED_BY_MTD=y |
64 | # CONFIG_NETWORK_FILESYSTEMS is not set | 53 | # CONFIG_NETWORK_FILESYSTEMS is not set |
65 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
66 | CONFIG_BOOTPARAM=y | 54 | CONFIG_BOOTPARAM=y |
67 | CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" | 55 | CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" |
68 | # CONFIG_CRC32 is not set | ||
diff --git a/arch/m68k/configs/m5272c3_defconfig b/arch/m68k/configs/m5272c3_defconfig index a60cb3509135..6f5fb92f5cbf 100644 --- a/arch/m68k/configs/m5272c3_defconfig +++ b/arch/m68k/configs/m5272c3_defconfig | |||
@@ -1,10 +1,6 @@ | |||
1 | # CONFIG_MMU is not set | ||
2 | CONFIG_EXPERIMENTAL=y | ||
3 | CONFIG_LOG_BUF_SHIFT=14 | 1 | CONFIG_LOG_BUF_SHIFT=14 |
4 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | ||
5 | CONFIG_EXPERT=y | 2 | CONFIG_EXPERT=y |
6 | # CONFIG_KALLSYMS is not set | 3 | # CONFIG_KALLSYMS is not set |
7 | # CONFIG_HOTPLUG is not set | ||
8 | # CONFIG_FUTEX is not set | 4 | # CONFIG_FUTEX is not set |
9 | # CONFIG_EPOLL is not set | 5 | # CONFIG_EPOLL is not set |
10 | # CONFIG_SIGNALFD is not set | 6 | # CONFIG_SIGNALFD is not set |
@@ -16,8 +12,8 @@ CONFIG_EXPERT=y | |||
16 | # CONFIG_BLK_DEV_BSG is not set | 12 | # CONFIG_BLK_DEV_BSG is not set |
17 | # CONFIG_IOSCHED_DEADLINE is not set | 13 | # CONFIG_IOSCHED_DEADLINE is not set |
18 | # CONFIG_IOSCHED_CFQ is not set | 14 | # CONFIG_IOSCHED_CFQ is not set |
15 | # CONFIG_MMU is not set | ||
19 | CONFIG_M5272=y | 16 | CONFIG_M5272=y |
20 | CONFIG_CLOCK_SET=y | ||
21 | CONFIG_M5272C3=y | 17 | CONFIG_M5272C3=y |
22 | CONFIG_RAMBASE=0x00000000 | 18 | CONFIG_RAMBASE=0x00000000 |
23 | CONFIG_RAMSIZE=0x00800000 | 19 | CONFIG_RAMSIZE=0x00800000 |
@@ -36,23 +32,18 @@ CONFIG_INET=y | |||
36 | # CONFIG_IPV6 is not set | 32 | # CONFIG_IPV6 is not set |
37 | # CONFIG_FW_LOADER is not set | 33 | # CONFIG_FW_LOADER is not set |
38 | CONFIG_MTD=y | 34 | CONFIG_MTD=y |
39 | CONFIG_MTD_CHAR=y | ||
40 | CONFIG_MTD_BLOCK=y | 35 | CONFIG_MTD_BLOCK=y |
41 | CONFIG_MTD_RAM=y | 36 | CONFIG_MTD_RAM=y |
42 | CONFIG_MTD_UCLINUX=y | 37 | CONFIG_MTD_UCLINUX=y |
43 | CONFIG_BLK_DEV_RAM=y | 38 | CONFIG_BLK_DEV_RAM=y |
44 | # CONFIG_MISC_DEVICES is not set | ||
45 | CONFIG_NETDEVICES=y | 39 | CONFIG_NETDEVICES=y |
46 | CONFIG_NET_ETHERNET=y | ||
47 | CONFIG_FEC=y | 40 | CONFIG_FEC=y |
48 | # CONFIG_NETDEV_1000 is not set | ||
49 | # CONFIG_NETDEV_10000 is not set | ||
50 | # CONFIG_INPUT is not set | 41 | # CONFIG_INPUT is not set |
51 | # CONFIG_SERIO is not set | 42 | # CONFIG_SERIO is not set |
52 | # CONFIG_VT is not set | 43 | # CONFIG_VT is not set |
44 | # CONFIG_UNIX98_PTYS is not set | ||
53 | CONFIG_SERIAL_MCF=y | 45 | CONFIG_SERIAL_MCF=y |
54 | CONFIG_SERIAL_MCF_CONSOLE=y | 46 | CONFIG_SERIAL_MCF_CONSOLE=y |
55 | # CONFIG_UNIX98_PTYS is not set | ||
56 | # CONFIG_HWMON is not set | 47 | # CONFIG_HWMON is not set |
57 | # CONFIG_USB_SUPPORT is not set | 48 | # CONFIG_USB_SUPPORT is not set |
58 | CONFIG_EXT2_FS=y | 49 | CONFIG_EXT2_FS=y |
@@ -61,6 +52,5 @@ CONFIG_EXT2_FS=y | |||
61 | CONFIG_ROMFS_FS=y | 52 | CONFIG_ROMFS_FS=y |
62 | CONFIG_ROMFS_BACKED_BY_MTD=y | 53 | CONFIG_ROMFS_BACKED_BY_MTD=y |
63 | # CONFIG_NETWORK_FILESYSTEMS is not set | 54 | # CONFIG_NETWORK_FILESYSTEMS is not set |
64 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
65 | CONFIG_BOOTPARAM=y | 55 | CONFIG_BOOTPARAM=y |
66 | CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" | 56 | CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" |
diff --git a/arch/m68k/configs/m5275evb_defconfig b/arch/m68k/configs/m5275evb_defconfig index e6502ab7cb2f..b5d7cd1ce856 100644 --- a/arch/m68k/configs/m5275evb_defconfig +++ b/arch/m68k/configs/m5275evb_defconfig | |||
@@ -1,10 +1,6 @@ | |||
1 | # CONFIG_MMU is not set | ||
2 | CONFIG_EXPERIMENTAL=y | ||
3 | CONFIG_LOG_BUF_SHIFT=14 | 1 | CONFIG_LOG_BUF_SHIFT=14 |
4 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | ||
5 | CONFIG_EXPERT=y | 2 | CONFIG_EXPERT=y |
6 | # CONFIG_KALLSYMS is not set | 3 | # CONFIG_KALLSYMS is not set |
7 | # CONFIG_HOTPLUG is not set | ||
8 | # CONFIG_FUTEX is not set | 4 | # CONFIG_FUTEX is not set |
9 | # CONFIG_EPOLL is not set | 5 | # CONFIG_EPOLL is not set |
10 | # CONFIG_SIGNALFD is not set | 6 | # CONFIG_SIGNALFD is not set |
@@ -16,11 +12,8 @@ CONFIG_EXPERT=y | |||
16 | # CONFIG_BLK_DEV_BSG is not set | 12 | # CONFIG_BLK_DEV_BSG is not set |
17 | # CONFIG_IOSCHED_DEADLINE is not set | 13 | # CONFIG_IOSCHED_DEADLINE is not set |
18 | # CONFIG_IOSCHED_CFQ is not set | 14 | # CONFIG_IOSCHED_CFQ is not set |
15 | # CONFIG_MMU is not set | ||
19 | CONFIG_M5275=y | 16 | CONFIG_M5275=y |
20 | CONFIG_CLOCK_SET=y | ||
21 | CONFIG_CLOCK_FREQ=150000000 | ||
22 | CONFIG_CLOCK_DIV=2 | ||
23 | CONFIG_M5275EVB=y | ||
24 | # CONFIG_4KSTACKS is not set | 17 | # CONFIG_4KSTACKS is not set |
25 | CONFIG_RAMBASE=0x00000000 | 18 | CONFIG_RAMBASE=0x00000000 |
26 | CONFIG_RAMSIZE=0x00000000 | 19 | CONFIG_RAMSIZE=0x00000000 |
@@ -39,24 +32,19 @@ CONFIG_INET=y | |||
39 | # CONFIG_IPV6 is not set | 32 | # CONFIG_IPV6 is not set |
40 | # CONFIG_FW_LOADER is not set | 33 | # CONFIG_FW_LOADER is not set |
41 | CONFIG_MTD=y | 34 | CONFIG_MTD=y |
42 | CONFIG_MTD_CHAR=y | ||
43 | CONFIG_MTD_BLOCK=y | 35 | CONFIG_MTD_BLOCK=y |
44 | CONFIG_MTD_RAM=y | 36 | CONFIG_MTD_RAM=y |
45 | CONFIG_MTD_UCLINUX=y | 37 | CONFIG_MTD_UCLINUX=y |
46 | CONFIG_BLK_DEV_RAM=y | 38 | CONFIG_BLK_DEV_RAM=y |
47 | # CONFIG_MISC_DEVICES is not set | ||
48 | CONFIG_NETDEVICES=y | 39 | CONFIG_NETDEVICES=y |
49 | CONFIG_NET_ETHERNET=y | ||
50 | CONFIG_FEC=y | 40 | CONFIG_FEC=y |
51 | # CONFIG_NETDEV_1000 is not set | ||
52 | # CONFIG_NETDEV_10000 is not set | ||
53 | CONFIG_PPP=y | 41 | CONFIG_PPP=y |
54 | # CONFIG_INPUT is not set | 42 | # CONFIG_INPUT is not set |
55 | # CONFIG_SERIO is not set | 43 | # CONFIG_SERIO is not set |
56 | # CONFIG_VT is not set | 44 | # CONFIG_VT is not set |
45 | # CONFIG_UNIX98_PTYS is not set | ||
57 | CONFIG_SERIAL_MCF=y | 46 | CONFIG_SERIAL_MCF=y |
58 | CONFIG_SERIAL_MCF_CONSOLE=y | 47 | CONFIG_SERIAL_MCF_CONSOLE=y |
59 | # CONFIG_UNIX98_PTYS is not set | ||
60 | # CONFIG_HWMON is not set | 48 | # CONFIG_HWMON is not set |
61 | # CONFIG_USB_SUPPORT is not set | 49 | # CONFIG_USB_SUPPORT is not set |
62 | CONFIG_EXT2_FS=y | 50 | CONFIG_EXT2_FS=y |
@@ -65,8 +53,5 @@ CONFIG_EXT2_FS=y | |||
65 | CONFIG_ROMFS_FS=y | 53 | CONFIG_ROMFS_FS=y |
66 | CONFIG_ROMFS_BACKED_BY_MTD=y | 54 | CONFIG_ROMFS_BACKED_BY_MTD=y |
67 | # CONFIG_NETWORK_FILESYSTEMS is not set | 55 | # CONFIG_NETWORK_FILESYSTEMS is not set |
68 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
69 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
70 | CONFIG_BOOTPARAM=y | 56 | CONFIG_BOOTPARAM=y |
71 | CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" | 57 | CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" |
72 | # CONFIG_CRC32 is not set | ||
diff --git a/arch/m68k/configs/m5307c3_defconfig b/arch/m68k/configs/m5307c3_defconfig index 023812abd2e6..1b4c09461c40 100644 --- a/arch/m68k/configs/m5307c3_defconfig +++ b/arch/m68k/configs/m5307c3_defconfig | |||
@@ -1,10 +1,6 @@ | |||
1 | # CONFIG_MMU is not set | ||
2 | CONFIG_EXPERIMENTAL=y | ||
3 | CONFIG_LOG_BUF_SHIFT=14 | 1 | CONFIG_LOG_BUF_SHIFT=14 |
4 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | ||
5 | CONFIG_EXPERT=y | 2 | CONFIG_EXPERT=y |
6 | # CONFIG_KALLSYMS is not set | 3 | # CONFIG_KALLSYMS is not set |
7 | # CONFIG_HOTPLUG is not set | ||
8 | # CONFIG_FUTEX is not set | 4 | # CONFIG_FUTEX is not set |
9 | # CONFIG_EPOLL is not set | 5 | # CONFIG_EPOLL is not set |
10 | # CONFIG_SIGNALFD is not set | 6 | # CONFIG_SIGNALFD is not set |
@@ -16,10 +12,8 @@ CONFIG_EXPERT=y | |||
16 | # CONFIG_BLK_DEV_BSG is not set | 12 | # CONFIG_BLK_DEV_BSG is not set |
17 | # CONFIG_IOSCHED_DEADLINE is not set | 13 | # CONFIG_IOSCHED_DEADLINE is not set |
18 | # CONFIG_IOSCHED_CFQ is not set | 14 | # CONFIG_IOSCHED_CFQ is not set |
15 | # CONFIG_MMU is not set | ||
19 | CONFIG_M5307=y | 16 | CONFIG_M5307=y |
20 | CONFIG_CLOCK_SET=y | ||
21 | CONFIG_CLOCK_FREQ=90000000 | ||
22 | CONFIG_CLOCK_DIV=2 | ||
23 | CONFIG_M5307C3=y | 17 | CONFIG_M5307C3=y |
24 | CONFIG_RAMBASE=0x00000000 | 18 | CONFIG_RAMBASE=0x00000000 |
25 | CONFIG_RAMSIZE=0x00800000 | 19 | CONFIG_RAMSIZE=0x00800000 |
@@ -38,16 +32,11 @@ CONFIG_INET=y | |||
38 | # CONFIG_IPV6 is not set | 32 | # CONFIG_IPV6 is not set |
39 | # CONFIG_FW_LOADER is not set | 33 | # CONFIG_FW_LOADER is not set |
40 | CONFIG_MTD=y | 34 | CONFIG_MTD=y |
41 | CONFIG_MTD_CHAR=y | ||
42 | CONFIG_MTD_BLOCK=y | 35 | CONFIG_MTD_BLOCK=y |
43 | CONFIG_MTD_RAM=y | 36 | CONFIG_MTD_RAM=y |
44 | CONFIG_MTD_UCLINUX=y | 37 | CONFIG_MTD_UCLINUX=y |
45 | CONFIG_BLK_DEV_RAM=y | 38 | CONFIG_BLK_DEV_RAM=y |
46 | # CONFIG_MISC_DEVICES is not set | ||
47 | CONFIG_NETDEVICES=y | 39 | CONFIG_NETDEVICES=y |
48 | CONFIG_NET_ETHERNET=y | ||
49 | # CONFIG_NETDEV_1000 is not set | ||
50 | # CONFIG_NETDEV_10000 is not set | ||
51 | CONFIG_PPP=y | 40 | CONFIG_PPP=y |
52 | CONFIG_SLIP=y | 41 | CONFIG_SLIP=y |
53 | CONFIG_SLIP_COMPRESSED=y | 42 | CONFIG_SLIP_COMPRESSED=y |
@@ -56,21 +45,17 @@ CONFIG_SLIP_COMPRESSED=y | |||
56 | # CONFIG_INPUT_MOUSE is not set | 45 | # CONFIG_INPUT_MOUSE is not set |
57 | # CONFIG_SERIO is not set | 46 | # CONFIG_SERIO is not set |
58 | # CONFIG_VT is not set | 47 | # CONFIG_VT is not set |
48 | # CONFIG_LEGACY_PTYS is not set | ||
59 | CONFIG_SERIAL_MCF=y | 49 | CONFIG_SERIAL_MCF=y |
60 | CONFIG_SERIAL_MCF_CONSOLE=y | 50 | CONFIG_SERIAL_MCF_CONSOLE=y |
61 | # CONFIG_LEGACY_PTYS is not set | ||
62 | # CONFIG_HW_RANDOM is not set | 51 | # CONFIG_HW_RANDOM is not set |
63 | # CONFIG_HWMON is not set | 52 | # CONFIG_HWMON is not set |
64 | # CONFIG_HID_SUPPORT is not set | ||
65 | # CONFIG_USB_SUPPORT is not set | 53 | # CONFIG_USB_SUPPORT is not set |
66 | CONFIG_EXT2_FS=y | 54 | CONFIG_EXT2_FS=y |
67 | # CONFIG_DNOTIFY is not set | 55 | # CONFIG_DNOTIFY is not set |
68 | CONFIG_ROMFS_FS=y | 56 | CONFIG_ROMFS_FS=y |
69 | CONFIG_ROMFS_BACKED_BY_MTD=y | 57 | CONFIG_ROMFS_BACKED_BY_MTD=y |
70 | # CONFIG_NETWORK_FILESYSTEMS is not set | 58 | # CONFIG_NETWORK_FILESYSTEMS is not set |
71 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
72 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
73 | CONFIG_FULLDEBUG=y | ||
74 | CONFIG_BOOTPARAM=y | 59 | CONFIG_BOOTPARAM=y |
75 | CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" | 60 | CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" |
76 | # CONFIG_CRC32 is not set | 61 | CONFIG_FULLDEBUG=y |
diff --git a/arch/m68k/configs/m5407c3_defconfig b/arch/m68k/configs/m5407c3_defconfig index 557b39f3be90..275ad543d4bc 100644 --- a/arch/m68k/configs/m5407c3_defconfig +++ b/arch/m68k/configs/m5407c3_defconfig | |||
@@ -1,10 +1,6 @@ | |||
1 | # CONFIG_MMU is not set | ||
2 | CONFIG_EXPERIMENTAL=y | ||
3 | CONFIG_LOG_BUF_SHIFT=14 | 1 | CONFIG_LOG_BUF_SHIFT=14 |
4 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | ||
5 | CONFIG_EXPERT=y | 2 | CONFIG_EXPERT=y |
6 | # CONFIG_KALLSYMS is not set | 3 | # CONFIG_KALLSYMS is not set |
7 | # CONFIG_HOTPLUG is not set | ||
8 | # CONFIG_FUTEX is not set | 4 | # CONFIG_FUTEX is not set |
9 | # CONFIG_EPOLL is not set | 5 | # CONFIG_EPOLL is not set |
10 | # CONFIG_SIGNALFD is not set | 6 | # CONFIG_SIGNALFD is not set |
@@ -17,9 +13,8 @@ CONFIG_MODULE_UNLOAD=y | |||
17 | # CONFIG_BLK_DEV_BSG is not set | 13 | # CONFIG_BLK_DEV_BSG is not set |
18 | # CONFIG_IOSCHED_DEADLINE is not set | 14 | # CONFIG_IOSCHED_DEADLINE is not set |
19 | # CONFIG_IOSCHED_CFQ is not set | 15 | # CONFIG_IOSCHED_CFQ is not set |
16 | # CONFIG_MMU is not set | ||
20 | CONFIG_M5407=y | 17 | CONFIG_M5407=y |
21 | CONFIG_CLOCK_SET=y | ||
22 | CONFIG_CLOCK_FREQ=50000000 | ||
23 | CONFIG_M5407C3=y | 18 | CONFIG_M5407C3=y |
24 | CONFIG_RAMBASE=0x00000000 | 19 | CONFIG_RAMBASE=0x00000000 |
25 | CONFIG_RAMSIZE=0x00000000 | 20 | CONFIG_RAMSIZE=0x00000000 |
@@ -38,22 +33,17 @@ CONFIG_INET=y | |||
38 | # CONFIG_IPV6 is not set | 33 | # CONFIG_IPV6 is not set |
39 | # CONFIG_FW_LOADER is not set | 34 | # CONFIG_FW_LOADER is not set |
40 | CONFIG_MTD=y | 35 | CONFIG_MTD=y |
41 | CONFIG_MTD_CHAR=y | ||
42 | CONFIG_MTD_BLOCK=y | 36 | CONFIG_MTD_BLOCK=y |
43 | CONFIG_MTD_RAM=y | 37 | CONFIG_MTD_RAM=y |
44 | CONFIG_MTD_UCLINUX=y | 38 | CONFIG_MTD_UCLINUX=y |
45 | CONFIG_BLK_DEV_RAM=y | 39 | CONFIG_BLK_DEV_RAM=y |
46 | # CONFIG_MISC_DEVICES is not set | ||
47 | CONFIG_NETDEVICES=y | 40 | CONFIG_NETDEVICES=y |
48 | CONFIG_NET_ETHERNET=y | ||
49 | # CONFIG_NETDEV_1000 is not set | ||
50 | # CONFIG_NETDEV_10000 is not set | ||
51 | CONFIG_PPP=y | 41 | CONFIG_PPP=y |
52 | # CONFIG_INPUT is not set | 42 | # CONFIG_INPUT is not set |
53 | # CONFIG_VT is not set | 43 | # CONFIG_VT is not set |
44 | # CONFIG_UNIX98_PTYS is not set | ||
54 | CONFIG_SERIAL_MCF=y | 45 | CONFIG_SERIAL_MCF=y |
55 | CONFIG_SERIAL_MCF_CONSOLE=y | 46 | CONFIG_SERIAL_MCF_CONSOLE=y |
56 | # CONFIG_UNIX98_PTYS is not set | ||
57 | # CONFIG_HW_RANDOM is not set | 47 | # CONFIG_HW_RANDOM is not set |
58 | # CONFIG_HWMON is not set | 48 | # CONFIG_HWMON is not set |
59 | # CONFIG_USB_SUPPORT is not set | 49 | # CONFIG_USB_SUPPORT is not set |
@@ -63,8 +53,5 @@ CONFIG_EXT2_FS=y | |||
63 | CONFIG_ROMFS_FS=y | 53 | CONFIG_ROMFS_FS=y |
64 | CONFIG_ROMFS_BACKED_BY_MTD=y | 54 | CONFIG_ROMFS_BACKED_BY_MTD=y |
65 | # CONFIG_NETWORK_FILESYSTEMS is not set | 55 | # CONFIG_NETWORK_FILESYSTEMS is not set |
66 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
67 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
68 | CONFIG_BOOTPARAM=y | 56 | CONFIG_BOOTPARAM=y |
69 | CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" | 57 | CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" |
70 | # CONFIG_CRC32 is not set | ||
diff --git a/arch/m68k/configs/m5475evb_defconfig b/arch/m68k/configs/m5475evb_defconfig index c5018a68819b..4f4ccd13c11b 100644 --- a/arch/m68k/configs/m5475evb_defconfig +++ b/arch/m68k/configs/m5475evb_defconfig | |||
@@ -1,11 +1,7 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | # CONFIG_SWAP is not set | 1 | # CONFIG_SWAP is not set |
3 | CONFIG_LOG_BUF_SHIFT=14 | 2 | CONFIG_LOG_BUF_SHIFT=14 |
4 | CONFIG_SYSFS_DEPRECATED=y | ||
5 | CONFIG_SYSFS_DEPRECATED_V2=y | ||
6 | CONFIG_SYSCTL_SYSCALL=y | 3 | CONFIG_SYSCTL_SYSCALL=y |
7 | # CONFIG_KALLSYMS is not set | 4 | # CONFIG_KALLSYMS is not set |
8 | # CONFIG_HOTPLUG is not set | ||
9 | # CONFIG_FUTEX is not set | 5 | # CONFIG_FUTEX is not set |
10 | # CONFIG_EPOLL is not set | 6 | # CONFIG_EPOLL is not set |
11 | # CONFIG_SIGNALFD is not set | 7 | # CONFIG_SIGNALFD is not set |
@@ -20,19 +16,16 @@ CONFIG_MODULES=y | |||
20 | # CONFIG_IOSCHED_DEADLINE is not set | 16 | # CONFIG_IOSCHED_DEADLINE is not set |
21 | # CONFIG_IOSCHED_CFQ is not set | 17 | # CONFIG_IOSCHED_CFQ is not set |
22 | CONFIG_COLDFIRE=y | 18 | CONFIG_COLDFIRE=y |
23 | CONFIG_M547x=y | ||
24 | CONFIG_CLOCK_SET=y | ||
25 | CONFIG_CLOCK_FREQ=266000000 | ||
26 | # CONFIG_4KSTACKS is not set | 19 | # CONFIG_4KSTACKS is not set |
27 | CONFIG_RAMBASE=0x0 | 20 | CONFIG_RAMBASE=0x0 |
28 | CONFIG_RAMSIZE=0x2000000 | 21 | CONFIG_RAMSIZE=0x2000000 |
29 | CONFIG_VECTORBASE=0x0 | 22 | CONFIG_VECTORBASE=0x0 |
30 | CONFIG_MBAR=0xff000000 | 23 | CONFIG_MBAR=0xff000000 |
31 | CONFIG_KERNELBASE=0x20000 | 24 | CONFIG_KERNELBASE=0x20000 |
25 | CONFIG_PCI=y | ||
32 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 26 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
33 | # CONFIG_FW_LOADER is not set | 27 | # CONFIG_FW_LOADER is not set |
34 | CONFIG_MTD=y | 28 | CONFIG_MTD=y |
35 | CONFIG_MTD_CHAR=y | ||
36 | CONFIG_MTD_BLOCK=y | 29 | CONFIG_MTD_BLOCK=y |
37 | CONFIG_MTD_CFI=y | 30 | CONFIG_MTD_CFI=y |
38 | CONFIG_MTD_JEDECPROBE=y | 31 | CONFIG_MTD_JEDECPROBE=y |
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild index 1555bc189c7d..eb85bd9c6180 100644 --- a/arch/m68k/include/asm/Kbuild +++ b/arch/m68k/include/asm/Kbuild | |||
@@ -18,6 +18,7 @@ generic-y += kvm_para.h | |||
18 | generic-y += local.h | 18 | generic-y += local.h |
19 | generic-y += local64.h | 19 | generic-y += local64.h |
20 | generic-y += mcs_spinlock.h | 20 | generic-y += mcs_spinlock.h |
21 | generic-y += mm-arch-hooks.h | ||
21 | generic-y += mman.h | 22 | generic-y += mman.h |
22 | generic-y += mutex.h | 23 | generic-y += mutex.h |
23 | generic-y += percpu.h | 24 | generic-y += percpu.h |
diff --git a/arch/m68k/include/asm/coldfire.h b/arch/m68k/include/asm/coldfire.h index c94557b91448..50aa4dac9ca2 100644 --- a/arch/m68k/include/asm/coldfire.h +++ b/arch/m68k/include/asm/coldfire.h | |||
@@ -19,7 +19,7 @@ | |||
19 | * in any case new boards come along from time to time that have yet | 19 | * in any case new boards come along from time to time that have yet |
20 | * another different clocking frequency. | 20 | * another different clocking frequency. |
21 | */ | 21 | */ |
22 | #ifdef CONFIG_CLOCK_SET | 22 | #ifdef CONFIG_CLOCK_FREQ |
23 | #define MCF_CLK CONFIG_CLOCK_FREQ | 23 | #define MCF_CLK CONFIG_CLOCK_FREQ |
24 | #else | 24 | #else |
25 | #error "Don't know what your ColdFire CPU clock frequency is??" | 25 | #error "Don't know what your ColdFire CPU clock frequency is??" |
diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h index 618c85d3c786..f55cad529400 100644 --- a/arch/m68k/include/asm/io_mm.h +++ b/arch/m68k/include/asm/io_mm.h | |||
@@ -413,7 +413,8 @@ static inline void isa_delay(void) | |||
413 | #define writew(val, addr) out_le16((addr), (val)) | 413 | #define writew(val, addr) out_le16((addr), (val)) |
414 | #endif /* CONFIG_ATARI_ROM_ISA */ | 414 | #endif /* CONFIG_ATARI_ROM_ISA */ |
415 | 415 | ||
416 | #if !defined(CONFIG_ISA) && !defined(CONFIG_ATARI_ROM_ISA) | 416 | #if !defined(CONFIG_ISA) && !defined(CONFIG_ATARI_ROM_ISA) && \ |
417 | !(defined(CONFIG_PCI) && defined(CONFIG_COLDFIRE)) | ||
417 | /* | 418 | /* |
418 | * We need to define dummy functions for GENERIC_IOMAP support. | 419 | * We need to define dummy functions for GENERIC_IOMAP support. |
419 | */ | 420 | */ |
diff --git a/arch/m68k/include/asm/mm-arch-hooks.h b/arch/m68k/include/asm/mm-arch-hooks.h deleted file mode 100644 index 7e8709bc90ae..000000000000 --- a/arch/m68k/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_M68K_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_M68K_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_M68K_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/metag/include/asm/Kbuild b/arch/metag/include/asm/Kbuild index 199320f3c345..df31353fd200 100644 --- a/arch/metag/include/asm/Kbuild +++ b/arch/metag/include/asm/Kbuild | |||
@@ -25,6 +25,7 @@ generic-y += kvm_para.h | |||
25 | generic-y += local.h | 25 | generic-y += local.h |
26 | generic-y += local64.h | 26 | generic-y += local64.h |
27 | generic-y += mcs_spinlock.h | 27 | generic-y += mcs_spinlock.h |
28 | generic-y += mm-arch-hooks.h | ||
28 | generic-y += msgbuf.h | 29 | generic-y += msgbuf.h |
29 | generic-y += mutex.h | 30 | generic-y += mutex.h |
30 | generic-y += param.h | 31 | generic-y += param.h |
diff --git a/arch/metag/include/asm/mm-arch-hooks.h b/arch/metag/include/asm/mm-arch-hooks.h deleted file mode 100644 index b0072b2eb0de..000000000000 --- a/arch/metag/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_METAG_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_METAG_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_METAG_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild index 9989ddb169ca..2f222f355c4b 100644 --- a/arch/microblaze/include/asm/Kbuild +++ b/arch/microblaze/include/asm/Kbuild | |||
@@ -6,6 +6,7 @@ generic-y += device.h | |||
6 | generic-y += exec.h | 6 | generic-y += exec.h |
7 | generic-y += irq_work.h | 7 | generic-y += irq_work.h |
8 | generic-y += mcs_spinlock.h | 8 | generic-y += mcs_spinlock.h |
9 | generic-y += mm-arch-hooks.h | ||
9 | generic-y += preempt.h | 10 | generic-y += preempt.h |
10 | generic-y += syscalls.h | 11 | generic-y += syscalls.h |
11 | generic-y += trace_clock.h | 12 | generic-y += trace_clock.h |
diff --git a/arch/microblaze/include/asm/mm-arch-hooks.h b/arch/microblaze/include/asm/mm-arch-hooks.h deleted file mode 100644 index 5c4065911bda..000000000000 --- a/arch/microblaze/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_MICROBLAZE_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_MICROBLAZE_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_MICROBLAZE_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 2a14585c90d2..cee5f93e5712 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -1427,6 +1427,7 @@ config CPU_MIPS64_R6 | |||
1427 | select CPU_SUPPORTS_HIGHMEM | 1427 | select CPU_SUPPORTS_HIGHMEM |
1428 | select CPU_SUPPORTS_MSA | 1428 | select CPU_SUPPORTS_MSA |
1429 | select GENERIC_CSUM | 1429 | select GENERIC_CSUM |
1430 | select MIPS_O32_FP64_SUPPORT if MIPS32_O32 | ||
1430 | help | 1431 | help |
1431 | Choose this option to build a kernel for release 6 or later of the | 1432 | Choose this option to build a kernel for release 6 or later of the |
1432 | MIPS64 architecture. New MIPS processors, starting with the Warrior | 1433 | MIPS64 architecture. New MIPS processors, starting with the Warrior |
@@ -2231,7 +2232,7 @@ config MIPS_CMP | |||
2231 | 2232 | ||
2232 | config MIPS_CPS | 2233 | config MIPS_CPS |
2233 | bool "MIPS Coherent Processing System support" | 2234 | bool "MIPS Coherent Processing System support" |
2234 | depends on SYS_SUPPORTS_MIPS_CPS && !64BIT | 2235 | depends on SYS_SUPPORTS_MIPS_CPS |
2235 | select MIPS_CM | 2236 | select MIPS_CM |
2236 | select MIPS_CPC | 2237 | select MIPS_CPC |
2237 | select MIPS_CPS_PM if HOTPLUG_CPU | 2238 | select MIPS_CPS_PM if HOTPLUG_CPU |
@@ -2262,11 +2263,6 @@ config MIPS_CM | |||
2262 | config MIPS_CPC | 2263 | config MIPS_CPC |
2263 | bool | 2264 | bool |
2264 | 2265 | ||
2265 | config SB1_PASS_1_WORKAROUNDS | ||
2266 | bool | ||
2267 | depends on CPU_SB1_PASS_1 | ||
2268 | default y | ||
2269 | |||
2270 | config SB1_PASS_2_WORKAROUNDS | 2266 | config SB1_PASS_2_WORKAROUNDS |
2271 | bool | 2267 | bool |
2272 | depends on CPU_SB1 && (CPU_SB1_PASS_2_2 || CPU_SB1_PASS_2) | 2268 | depends on CPU_SB1 && (CPU_SB1_PASS_2_2 || CPU_SB1_PASS_2) |
diff --git a/arch/mips/Makefile b/arch/mips/Makefile index ae2dd59050f7..252e347958f3 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile | |||
@@ -181,13 +181,6 @@ cflags-$(CONFIG_CPU_R4000_WORKAROUNDS) += $(call cc-option,-mfix-r4000,) | |||
181 | cflags-$(CONFIG_CPU_R4400_WORKAROUNDS) += $(call cc-option,-mfix-r4400,) | 181 | cflags-$(CONFIG_CPU_R4400_WORKAROUNDS) += $(call cc-option,-mfix-r4400,) |
182 | cflags-$(CONFIG_CPU_DADDI_WORKAROUNDS) += $(call cc-option,-mno-daddi,) | 182 | cflags-$(CONFIG_CPU_DADDI_WORKAROUNDS) += $(call cc-option,-mno-daddi,) |
183 | 183 | ||
184 | ifdef CONFIG_CPU_SB1 | ||
185 | ifdef CONFIG_SB1_PASS_1_WORKAROUNDS | ||
186 | KBUILD_AFLAGS_MODULE += -msb1-pass1-workarounds | ||
187 | KBUILD_CFLAGS_MODULE += -msb1-pass1-workarounds | ||
188 | endif | ||
189 | endif | ||
190 | |||
191 | # For smartmips configurations, there are hundreds of warnings due to ISA overrides | 184 | # For smartmips configurations, there are hundreds of warnings due to ISA overrides |
192 | # in assembly and header files. smartmips is only supported for MIPS32r1 onwards | 185 | # in assembly and header files. smartmips is only supported for MIPS32r1 onwards |
193 | # and there is no support for 64-bit. Various '.set mips2' or '.set mips3' or | 186 | # and there is no support for 64-bit. Various '.set mips2' or '.set mips3' or |
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild index 7fe5c61a3cb8..1f8546081d20 100644 --- a/arch/mips/include/asm/Kbuild +++ b/arch/mips/include/asm/Kbuild | |||
@@ -7,6 +7,7 @@ generic-y += emergency-restart.h | |||
7 | generic-y += irq_work.h | 7 | generic-y += irq_work.h |
8 | generic-y += local64.h | 8 | generic-y += local64.h |
9 | generic-y += mcs_spinlock.h | 9 | generic-y += mcs_spinlock.h |
10 | generic-y += mm-arch-hooks.h | ||
10 | generic-y += mutex.h | 11 | generic-y += mutex.h |
11 | generic-y += parport.h | 12 | generic-y += parport.h |
12 | generic-y += percpu.h | 13 | generic-y += percpu.h |
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h index 084780b355aa..1b0625189835 100644 --- a/arch/mips/include/asm/fpu.h +++ b/arch/mips/include/asm/fpu.h | |||
@@ -74,7 +74,7 @@ static inline int __enable_fpu(enum fpu_mode mode) | |||
74 | goto fr_common; | 74 | goto fr_common; |
75 | 75 | ||
76 | case FPU_64BIT: | 76 | case FPU_64BIT: |
77 | #if !(defined(CONFIG_CPU_MIPS32_R2) || defined(CONFIG_CPU_MIPS32_R6) \ | 77 | #if !(defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) \ |
78 | || defined(CONFIG_64BIT)) | 78 | || defined(CONFIG_64BIT)) |
79 | /* we only have a 32-bit FPU */ | 79 | /* we only have a 32-bit FPU */ |
80 | return SIGFPE; | 80 | return SIGFPE; |
diff --git a/arch/mips/include/asm/mach-loongson64/mmzone.h b/arch/mips/include/asm/mach-loongson64/mmzone.h index 37c08a27b4f0..c9f7e231e66b 100644 --- a/arch/mips/include/asm/mach-loongson64/mmzone.h +++ b/arch/mips/include/asm/mach-loongson64/mmzone.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2010 Loongson Inc. & Lemote Inc. & | 2 | * Copyright (C) 2010 Loongson Inc. & Lemote Inc. & |
3 | * Insititute of Computing Technology | 3 | * Institute of Computing Technology |
4 | * Author: Xiang Gao, gaoxiang@ict.ac.cn | 4 | * Author: Xiang Gao, gaoxiang@ict.ac.cn |
5 | * Huacai Chen, chenhc@lemote.com | 5 | * Huacai Chen, chenhc@lemote.com |
6 | * Xiaofu Meng, Shuangshuang Zhang | 6 | * Xiaofu Meng, Shuangshuang Zhang |
diff --git a/arch/mips/include/asm/mach-sibyte/war.h b/arch/mips/include/asm/mach-sibyte/war.h index 0a227d426b9c..520f8fc2c806 100644 --- a/arch/mips/include/asm/mach-sibyte/war.h +++ b/arch/mips/include/asm/mach-sibyte/war.h | |||
@@ -13,8 +13,7 @@ | |||
13 | #define R4600_V2_HIT_CACHEOP_WAR 0 | 13 | #define R4600_V2_HIT_CACHEOP_WAR 0 |
14 | #define R5432_CP0_INTERRUPT_WAR 0 | 14 | #define R5432_CP0_INTERRUPT_WAR 0 |
15 | 15 | ||
16 | #if defined(CONFIG_SB1_PASS_1_WORKAROUNDS) || \ | 16 | #if defined(CONFIG_SB1_PASS_2_WORKAROUNDS) |
17 | defined(CONFIG_SB1_PASS_2_WORKAROUNDS) | ||
18 | 17 | ||
19 | #ifndef __ASSEMBLY__ | 18 | #ifndef __ASSEMBLY__ |
20 | extern int sb1250_m3_workaround_needed(void); | 19 | extern int sb1250_m3_workaround_needed(void); |
diff --git a/arch/mips/include/asm/mm-arch-hooks.h b/arch/mips/include/asm/mm-arch-hooks.h deleted file mode 100644 index b5609fe8e475..000000000000 --- a/arch/mips/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_MIPS_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_MIPS_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_MIPS_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h index 2b25d1ba1ea0..16f1ea9ab191 100644 --- a/arch/mips/include/asm/smp.h +++ b/arch/mips/include/asm/smp.h | |||
@@ -23,6 +23,7 @@ | |||
23 | extern int smp_num_siblings; | 23 | extern int smp_num_siblings; |
24 | extern cpumask_t cpu_sibling_map[]; | 24 | extern cpumask_t cpu_sibling_map[]; |
25 | extern cpumask_t cpu_core_map[]; | 25 | extern cpumask_t cpu_core_map[]; |
26 | extern cpumask_t cpu_foreign_map; | ||
26 | 27 | ||
27 | #define raw_smp_processor_id() (current_thread_info()->cpu) | 28 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
28 | 29 | ||
diff --git a/arch/mips/include/uapi/asm/sigcontext.h b/arch/mips/include/uapi/asm/sigcontext.h index 6c9906f59c6e..9081d88ae44f 100644 --- a/arch/mips/include/uapi/asm/sigcontext.h +++ b/arch/mips/include/uapi/asm/sigcontext.h | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | /* | 17 | /* |
18 | * Keep this struct definition in sync with the sigcontext fragment | 18 | * Keep this struct definition in sync with the sigcontext fragment |
19 | * in arch/mips/tools/offset.c | 19 | * in arch/mips/kernel/asm-offsets.c |
20 | */ | 20 | */ |
21 | struct sigcontext { | 21 | struct sigcontext { |
22 | unsigned int sc_regmask; /* Unused */ | 22 | unsigned int sc_regmask; /* Unused */ |
@@ -46,7 +46,7 @@ struct sigcontext { | |||
46 | #include <linux/posix_types.h> | 46 | #include <linux/posix_types.h> |
47 | /* | 47 | /* |
48 | * Keep this struct definition in sync with the sigcontext fragment | 48 | * Keep this struct definition in sync with the sigcontext fragment |
49 | * in arch/mips/tools/offset.c | 49 | * in arch/mips/kernel/asm-offsets.c |
50 | * | 50 | * |
51 | * Warning: this structure illdefined with sc_badvaddr being just an unsigned | 51 | * Warning: this structure illdefined with sc_badvaddr being just an unsigned |
52 | * int so it was changed to unsigned long in 2.6.0-test1. This may break | 52 | * int so it was changed to unsigned long in 2.6.0-test1. This may break |
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c index beabe19ff8e5..072fab13645d 100644 --- a/arch/mips/kernel/asm-offsets.c +++ b/arch/mips/kernel/asm-offsets.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * offset.c: Calculate pt_regs and task_struct offsets. | 2 | * asm-offsets.c: Calculate pt_regs and task_struct offsets. |
3 | * | 3 | * |
4 | * Copyright (C) 1996 David S. Miller | 4 | * Copyright (C) 1996 David S. Miller |
5 | * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Ralf Baechle | 5 | * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Ralf Baechle |
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c index c0c5e5972256..d8f9b357b222 100644 --- a/arch/mips/kernel/branch.c +++ b/arch/mips/kernel/branch.c | |||
@@ -600,7 +600,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs, | |||
600 | break; | 600 | break; |
601 | 601 | ||
602 | case blezl_op: /* not really i_format */ | 602 | case blezl_op: /* not really i_format */ |
603 | if (NO_R6EMU) | 603 | if (!insn.i_format.rt && NO_R6EMU) |
604 | goto sigill_r6; | 604 | goto sigill_r6; |
605 | case blez_op: | 605 | case blez_op: |
606 | /* | 606 | /* |
@@ -635,7 +635,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs, | |||
635 | break; | 635 | break; |
636 | 636 | ||
637 | case bgtzl_op: | 637 | case bgtzl_op: |
638 | if (NO_R6EMU) | 638 | if (!insn.i_format.rt && NO_R6EMU) |
639 | goto sigill_r6; | 639 | goto sigill_r6; |
640 | case bgtz_op: | 640 | case bgtz_op: |
641 | /* | 641 | /* |
diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S index 55b759a0019e..1b6ca634e646 100644 --- a/arch/mips/kernel/cps-vec.S +++ b/arch/mips/kernel/cps-vec.S | |||
@@ -60,7 +60,7 @@ LEAF(mips_cps_core_entry) | |||
60 | nop | 60 | nop |
61 | 61 | ||
62 | /* This is an NMI */ | 62 | /* This is an NMI */ |
63 | la k0, nmi_handler | 63 | PTR_LA k0, nmi_handler |
64 | jr k0 | 64 | jr k0 |
65 | nop | 65 | nop |
66 | 66 | ||
@@ -107,10 +107,10 @@ not_nmi: | |||
107 | mul t1, t1, t0 | 107 | mul t1, t1, t0 |
108 | mul t1, t1, t2 | 108 | mul t1, t1, t2 |
109 | 109 | ||
110 | li a0, KSEG0 | 110 | li a0, CKSEG0 |
111 | add a1, a0, t1 | 111 | PTR_ADD a1, a0, t1 |
112 | 1: cache Index_Store_Tag_I, 0(a0) | 112 | 1: cache Index_Store_Tag_I, 0(a0) |
113 | add a0, a0, t0 | 113 | PTR_ADD a0, a0, t0 |
114 | bne a0, a1, 1b | 114 | bne a0, a1, 1b |
115 | nop | 115 | nop |
116 | icache_done: | 116 | icache_done: |
@@ -134,12 +134,12 @@ icache_done: | |||
134 | mul t1, t1, t0 | 134 | mul t1, t1, t0 |
135 | mul t1, t1, t2 | 135 | mul t1, t1, t2 |
136 | 136 | ||
137 | li a0, KSEG0 | 137 | li a0, CKSEG0 |
138 | addu a1, a0, t1 | 138 | PTR_ADDU a1, a0, t1 |
139 | subu a1, a1, t0 | 139 | PTR_SUBU a1, a1, t0 |
140 | 1: cache Index_Store_Tag_D, 0(a0) | 140 | 1: cache Index_Store_Tag_D, 0(a0) |
141 | bne a0, a1, 1b | 141 | bne a0, a1, 1b |
142 | add a0, a0, t0 | 142 | PTR_ADD a0, a0, t0 |
143 | dcache_done: | 143 | dcache_done: |
144 | 144 | ||
145 | /* Set Kseg0 CCA to that in s0 */ | 145 | /* Set Kseg0 CCA to that in s0 */ |
@@ -152,11 +152,11 @@ dcache_done: | |||
152 | 152 | ||
153 | /* Enter the coherent domain */ | 153 | /* Enter the coherent domain */ |
154 | li t0, 0xff | 154 | li t0, 0xff |
155 | sw t0, GCR_CL_COHERENCE_OFS(v1) | 155 | PTR_S t0, GCR_CL_COHERENCE_OFS(v1) |
156 | ehb | 156 | ehb |
157 | 157 | ||
158 | /* Jump to kseg0 */ | 158 | /* Jump to kseg0 */ |
159 | la t0, 1f | 159 | PTR_LA t0, 1f |
160 | jr t0 | 160 | jr t0 |
161 | nop | 161 | nop |
162 | 162 | ||
@@ -178,9 +178,9 @@ dcache_done: | |||
178 | nop | 178 | nop |
179 | 179 | ||
180 | /* Off we go! */ | 180 | /* Off we go! */ |
181 | lw t1, VPEBOOTCFG_PC(v0) | 181 | PTR_L t1, VPEBOOTCFG_PC(v0) |
182 | lw gp, VPEBOOTCFG_GP(v0) | 182 | PTR_L gp, VPEBOOTCFG_GP(v0) |
183 | lw sp, VPEBOOTCFG_SP(v0) | 183 | PTR_L sp, VPEBOOTCFG_SP(v0) |
184 | jr t1 | 184 | jr t1 |
185 | nop | 185 | nop |
186 | END(mips_cps_core_entry) | 186 | END(mips_cps_core_entry) |
@@ -217,7 +217,7 @@ LEAF(excep_intex) | |||
217 | 217 | ||
218 | .org 0x480 | 218 | .org 0x480 |
219 | LEAF(excep_ejtag) | 219 | LEAF(excep_ejtag) |
220 | la k0, ejtag_debug_handler | 220 | PTR_LA k0, ejtag_debug_handler |
221 | jr k0 | 221 | jr k0 |
222 | nop | 222 | nop |
223 | END(excep_ejtag) | 223 | END(excep_ejtag) |
@@ -229,7 +229,7 @@ LEAF(mips_cps_core_init) | |||
229 | nop | 229 | nop |
230 | 230 | ||
231 | .set push | 231 | .set push |
232 | .set mips32r2 | 232 | .set mips64r2 |
233 | .set mt | 233 | .set mt |
234 | 234 | ||
235 | /* Only allow 1 TC per VPE to execute... */ | 235 | /* Only allow 1 TC per VPE to execute... */ |
@@ -237,7 +237,7 @@ LEAF(mips_cps_core_init) | |||
237 | 237 | ||
238 | /* ...and for the moment only 1 VPE */ | 238 | /* ...and for the moment only 1 VPE */ |
239 | dvpe | 239 | dvpe |
240 | la t1, 1f | 240 | PTR_LA t1, 1f |
241 | jr.hb t1 | 241 | jr.hb t1 |
242 | nop | 242 | nop |
243 | 243 | ||
@@ -250,25 +250,25 @@ LEAF(mips_cps_core_init) | |||
250 | mfc0 t0, CP0_MVPCONF0 | 250 | mfc0 t0, CP0_MVPCONF0 |
251 | srl t0, t0, MVPCONF0_PVPE_SHIFT | 251 | srl t0, t0, MVPCONF0_PVPE_SHIFT |
252 | andi t0, t0, (MVPCONF0_PVPE >> MVPCONF0_PVPE_SHIFT) | 252 | andi t0, t0, (MVPCONF0_PVPE >> MVPCONF0_PVPE_SHIFT) |
253 | addiu t7, t0, 1 | 253 | addiu ta3, t0, 1 |
254 | 254 | ||
255 | /* If there's only 1, we're done */ | 255 | /* If there's only 1, we're done */ |
256 | beqz t0, 2f | 256 | beqz t0, 2f |
257 | nop | 257 | nop |
258 | 258 | ||
259 | /* Loop through each VPE within this core */ | 259 | /* Loop through each VPE within this core */ |
260 | li t5, 1 | 260 | li ta1, 1 |
261 | 261 | ||
262 | 1: /* Operate on the appropriate TC */ | 262 | 1: /* Operate on the appropriate TC */ |
263 | mtc0 t5, CP0_VPECONTROL | 263 | mtc0 ta1, CP0_VPECONTROL |
264 | ehb | 264 | ehb |
265 | 265 | ||
266 | /* Bind TC to VPE (1:1 TC:VPE mapping) */ | 266 | /* Bind TC to VPE (1:1 TC:VPE mapping) */ |
267 | mttc0 t5, CP0_TCBIND | 267 | mttc0 ta1, CP0_TCBIND |
268 | 268 | ||
269 | /* Set exclusive TC, non-active, master */ | 269 | /* Set exclusive TC, non-active, master */ |
270 | li t0, VPECONF0_MVP | 270 | li t0, VPECONF0_MVP |
271 | sll t1, t5, VPECONF0_XTC_SHIFT | 271 | sll t1, ta1, VPECONF0_XTC_SHIFT |
272 | or t0, t0, t1 | 272 | or t0, t0, t1 |
273 | mttc0 t0, CP0_VPECONF0 | 273 | mttc0 t0, CP0_VPECONF0 |
274 | 274 | ||
@@ -280,8 +280,8 @@ LEAF(mips_cps_core_init) | |||
280 | mttc0 t0, CP0_TCHALT | 280 | mttc0 t0, CP0_TCHALT |
281 | 281 | ||
282 | /* Next VPE */ | 282 | /* Next VPE */ |
283 | addiu t5, t5, 1 | 283 | addiu ta1, ta1, 1 |
284 | slt t0, t5, t7 | 284 | slt t0, ta1, ta3 |
285 | bnez t0, 1b | 285 | bnez t0, 1b |
286 | nop | 286 | nop |
287 | 287 | ||
@@ -298,19 +298,19 @@ LEAF(mips_cps_core_init) | |||
298 | 298 | ||
299 | LEAF(mips_cps_boot_vpes) | 299 | LEAF(mips_cps_boot_vpes) |
300 | /* Retrieve CM base address */ | 300 | /* Retrieve CM base address */ |
301 | la t0, mips_cm_base | 301 | PTR_LA t0, mips_cm_base |
302 | lw t0, 0(t0) | 302 | PTR_L t0, 0(t0) |
303 | 303 | ||
304 | /* Calculate a pointer to this cores struct core_boot_config */ | 304 | /* Calculate a pointer to this cores struct core_boot_config */ |
305 | lw t0, GCR_CL_ID_OFS(t0) | 305 | PTR_L t0, GCR_CL_ID_OFS(t0) |
306 | li t1, COREBOOTCFG_SIZE | 306 | li t1, COREBOOTCFG_SIZE |
307 | mul t0, t0, t1 | 307 | mul t0, t0, t1 |
308 | la t1, mips_cps_core_bootcfg | 308 | PTR_LA t1, mips_cps_core_bootcfg |
309 | lw t1, 0(t1) | 309 | PTR_L t1, 0(t1) |
310 | addu t0, t0, t1 | 310 | PTR_ADDU t0, t0, t1 |
311 | 311 | ||
312 | /* Calculate this VPEs ID. If the core doesn't support MT use 0 */ | 312 | /* Calculate this VPEs ID. If the core doesn't support MT use 0 */ |
313 | has_mt t6, 1f | 313 | has_mt ta2, 1f |
314 | li t9, 0 | 314 | li t9, 0 |
315 | 315 | ||
316 | /* Find the number of VPEs present in the core */ | 316 | /* Find the number of VPEs present in the core */ |
@@ -334,24 +334,24 @@ LEAF(mips_cps_boot_vpes) | |||
334 | 1: /* Calculate a pointer to this VPEs struct vpe_boot_config */ | 334 | 1: /* Calculate a pointer to this VPEs struct vpe_boot_config */ |
335 | li t1, VPEBOOTCFG_SIZE | 335 | li t1, VPEBOOTCFG_SIZE |
336 | mul v0, t9, t1 | 336 | mul v0, t9, t1 |
337 | lw t7, COREBOOTCFG_VPECONFIG(t0) | 337 | PTR_L ta3, COREBOOTCFG_VPECONFIG(t0) |
338 | addu v0, v0, t7 | 338 | PTR_ADDU v0, v0, ta3 |
339 | 339 | ||
340 | #ifdef CONFIG_MIPS_MT | 340 | #ifdef CONFIG_MIPS_MT |
341 | 341 | ||
342 | /* If the core doesn't support MT then return */ | 342 | /* If the core doesn't support MT then return */ |
343 | bnez t6, 1f | 343 | bnez ta2, 1f |
344 | nop | 344 | nop |
345 | jr ra | 345 | jr ra |
346 | nop | 346 | nop |
347 | 347 | ||
348 | .set push | 348 | .set push |
349 | .set mips32r2 | 349 | .set mips64r2 |
350 | .set mt | 350 | .set mt |
351 | 351 | ||
352 | 1: /* Enter VPE configuration state */ | 352 | 1: /* Enter VPE configuration state */ |
353 | dvpe | 353 | dvpe |
354 | la t1, 1f | 354 | PTR_LA t1, 1f |
355 | jr.hb t1 | 355 | jr.hb t1 |
356 | nop | 356 | nop |
357 | 1: mfc0 t1, CP0_MVPCONTROL | 357 | 1: mfc0 t1, CP0_MVPCONTROL |
@@ -360,12 +360,12 @@ LEAF(mips_cps_boot_vpes) | |||
360 | ehb | 360 | ehb |
361 | 361 | ||
362 | /* Loop through each VPE */ | 362 | /* Loop through each VPE */ |
363 | lw t6, COREBOOTCFG_VPEMASK(t0) | 363 | PTR_L ta2, COREBOOTCFG_VPEMASK(t0) |
364 | move t8, t6 | 364 | move t8, ta2 |
365 | li t5, 0 | 365 | li ta1, 0 |
366 | 366 | ||
367 | /* Check whether the VPE should be running. If not, skip it */ | 367 | /* Check whether the VPE should be running. If not, skip it */ |
368 | 1: andi t0, t6, 1 | 368 | 1: andi t0, ta2, 1 |
369 | beqz t0, 2f | 369 | beqz t0, 2f |
370 | nop | 370 | nop |
371 | 371 | ||
@@ -373,7 +373,7 @@ LEAF(mips_cps_boot_vpes) | |||
373 | mfc0 t0, CP0_VPECONTROL | 373 | mfc0 t0, CP0_VPECONTROL |
374 | ori t0, t0, VPECONTROL_TARGTC | 374 | ori t0, t0, VPECONTROL_TARGTC |
375 | xori t0, t0, VPECONTROL_TARGTC | 375 | xori t0, t0, VPECONTROL_TARGTC |
376 | or t0, t0, t5 | 376 | or t0, t0, ta1 |
377 | mtc0 t0, CP0_VPECONTROL | 377 | mtc0 t0, CP0_VPECONTROL |
378 | ehb | 378 | ehb |
379 | 379 | ||
@@ -384,8 +384,8 @@ LEAF(mips_cps_boot_vpes) | |||
384 | 384 | ||
385 | /* Calculate a pointer to the VPEs struct vpe_boot_config */ | 385 | /* Calculate a pointer to the VPEs struct vpe_boot_config */ |
386 | li t0, VPEBOOTCFG_SIZE | 386 | li t0, VPEBOOTCFG_SIZE |
387 | mul t0, t0, t5 | 387 | mul t0, t0, ta1 |
388 | addu t0, t0, t7 | 388 | addu t0, t0, ta3 |
389 | 389 | ||
390 | /* Set the TC restart PC */ | 390 | /* Set the TC restart PC */ |
391 | lw t1, VPEBOOTCFG_PC(t0) | 391 | lw t1, VPEBOOTCFG_PC(t0) |
@@ -423,9 +423,9 @@ LEAF(mips_cps_boot_vpes) | |||
423 | mttc0 t0, CP0_VPECONF0 | 423 | mttc0 t0, CP0_VPECONF0 |
424 | 424 | ||
425 | /* Next VPE */ | 425 | /* Next VPE */ |
426 | 2: srl t6, t6, 1 | 426 | 2: srl ta2, ta2, 1 |
427 | addiu t5, t5, 1 | 427 | addiu ta1, ta1, 1 |
428 | bnez t6, 1b | 428 | bnez ta2, 1b |
429 | nop | 429 | nop |
430 | 430 | ||
431 | /* Leave VPE configuration state */ | 431 | /* Leave VPE configuration state */ |
@@ -445,7 +445,7 @@ LEAF(mips_cps_boot_vpes) | |||
445 | /* This VPE should be offline, halt the TC */ | 445 | /* This VPE should be offline, halt the TC */ |
446 | li t0, TCHALT_H | 446 | li t0, TCHALT_H |
447 | mtc0 t0, CP0_TCHALT | 447 | mtc0 t0, CP0_TCHALT |
448 | la t0, 1f | 448 | PTR_LA t0, 1f |
449 | 1: jr.hb t0 | 449 | 1: jr.hb t0 |
450 | nop | 450 | nop |
451 | 451 | ||
@@ -466,10 +466,10 @@ LEAF(mips_cps_boot_vpes) | |||
466 | .set noat | 466 | .set noat |
467 | lw $1, TI_CPU(gp) | 467 | lw $1, TI_CPU(gp) |
468 | sll $1, $1, LONGLOG | 468 | sll $1, $1, LONGLOG |
469 | la \dest, __per_cpu_offset | 469 | PTR_LA \dest, __per_cpu_offset |
470 | addu $1, $1, \dest | 470 | addu $1, $1, \dest |
471 | lw $1, 0($1) | 471 | lw $1, 0($1) |
472 | la \dest, cps_cpu_state | 472 | PTR_LA \dest, cps_cpu_state |
473 | addu \dest, \dest, $1 | 473 | addu \dest, \dest, $1 |
474 | .set pop | 474 | .set pop |
475 | .endm | 475 | .endm |
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S index 6e8de80bb446..4cc13508d967 100644 --- a/arch/mips/kernel/scall32-o32.S +++ b/arch/mips/kernel/scall32-o32.S | |||
@@ -73,10 +73,11 @@ NESTED(handle_sys, PT_SIZE, sp) | |||
73 | .set noreorder | 73 | .set noreorder |
74 | .set nomacro | 74 | .set nomacro |
75 | 75 | ||
76 | 1: user_lw(t5, 16(t0)) # argument #5 from usp | 76 | load_a4: user_lw(t5, 16(t0)) # argument #5 from usp |
77 | 4: user_lw(t6, 20(t0)) # argument #6 from usp | 77 | load_a5: user_lw(t6, 20(t0)) # argument #6 from usp |
78 | 3: user_lw(t7, 24(t0)) # argument #7 from usp | 78 | load_a6: user_lw(t7, 24(t0)) # argument #7 from usp |
79 | 2: user_lw(t8, 28(t0)) # argument #8 from usp | 79 | load_a7: user_lw(t8, 28(t0)) # argument #8 from usp |
80 | loads_done: | ||
80 | 81 | ||
81 | sw t5, 16(sp) # argument #5 to ksp | 82 | sw t5, 16(sp) # argument #5 to ksp |
82 | sw t6, 20(sp) # argument #6 to ksp | 83 | sw t6, 20(sp) # argument #6 to ksp |
@@ -85,10 +86,10 @@ NESTED(handle_sys, PT_SIZE, sp) | |||
85 | .set pop | 86 | .set pop |
86 | 87 | ||
87 | .section __ex_table,"a" | 88 | .section __ex_table,"a" |
88 | PTR 1b,bad_stack | 89 | PTR load_a4, bad_stack_a4 |
89 | PTR 2b,bad_stack | 90 | PTR load_a5, bad_stack_a5 |
90 | PTR 3b,bad_stack | 91 | PTR load_a6, bad_stack_a6 |
91 | PTR 4b,bad_stack | 92 | PTR load_a7, bad_stack_a7 |
92 | .previous | 93 | .previous |
93 | 94 | ||
94 | lw t0, TI_FLAGS($28) # syscall tracing enabled? | 95 | lw t0, TI_FLAGS($28) # syscall tracing enabled? |
@@ -153,8 +154,8 @@ syscall_trace_entry: | |||
153 | /* ------------------------------------------------------------------------ */ | 154 | /* ------------------------------------------------------------------------ */ |
154 | 155 | ||
155 | /* | 156 | /* |
156 | * The stackpointer for a call with more than 4 arguments is bad. | 157 | * Our open-coded access area sanity test for the stack pointer |
157 | * We probably should handle this case a bit more drastic. | 158 | * failed. We probably should handle this case a bit more drastic. |
158 | */ | 159 | */ |
159 | bad_stack: | 160 | bad_stack: |
160 | li v0, EFAULT | 161 | li v0, EFAULT |
@@ -163,6 +164,22 @@ bad_stack: | |||
163 | sw t0, PT_R7(sp) | 164 | sw t0, PT_R7(sp) |
164 | j o32_syscall_exit | 165 | j o32_syscall_exit |
165 | 166 | ||
167 | bad_stack_a4: | ||
168 | li t5, 0 | ||
169 | b load_a5 | ||
170 | |||
171 | bad_stack_a5: | ||
172 | li t6, 0 | ||
173 | b load_a6 | ||
174 | |||
175 | bad_stack_a6: | ||
176 | li t7, 0 | ||
177 | b load_a7 | ||
178 | |||
179 | bad_stack_a7: | ||
180 | li t8, 0 | ||
181 | b loads_done | ||
182 | |||
166 | /* | 183 | /* |
167 | * The system call does not exist in this kernel | 184 | * The system call does not exist in this kernel |
168 | */ | 185 | */ |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index d07b210fbeff..f543ff4feef9 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
@@ -69,16 +69,17 @@ NESTED(handle_sys, PT_SIZE, sp) | |||
69 | daddu t1, t0, 32 | 69 | daddu t1, t0, 32 |
70 | bltz t1, bad_stack | 70 | bltz t1, bad_stack |
71 | 71 | ||
72 | 1: lw a4, 16(t0) # argument #5 from usp | 72 | load_a4: lw a4, 16(t0) # argument #5 from usp |
73 | 2: lw a5, 20(t0) # argument #6 from usp | 73 | load_a5: lw a5, 20(t0) # argument #6 from usp |
74 | 3: lw a6, 24(t0) # argument #7 from usp | 74 | load_a6: lw a6, 24(t0) # argument #7 from usp |
75 | 4: lw a7, 28(t0) # argument #8 from usp (for indirect syscalls) | 75 | load_a7: lw a7, 28(t0) # argument #8 from usp |
76 | loads_done: | ||
76 | 77 | ||
77 | .section __ex_table,"a" | 78 | .section __ex_table,"a" |
78 | PTR 1b, bad_stack | 79 | PTR load_a4, bad_stack_a4 |
79 | PTR 2b, bad_stack | 80 | PTR load_a5, bad_stack_a5 |
80 | PTR 3b, bad_stack | 81 | PTR load_a6, bad_stack_a6 |
81 | PTR 4b, bad_stack | 82 | PTR load_a7, bad_stack_a7 |
82 | .previous | 83 | .previous |
83 | 84 | ||
84 | li t1, _TIF_WORK_SYSCALL_ENTRY | 85 | li t1, _TIF_WORK_SYSCALL_ENTRY |
@@ -167,6 +168,22 @@ bad_stack: | |||
167 | sd t0, PT_R7(sp) | 168 | sd t0, PT_R7(sp) |
168 | j o32_syscall_exit | 169 | j o32_syscall_exit |
169 | 170 | ||
171 | bad_stack_a4: | ||
172 | li a4, 0 | ||
173 | b load_a5 | ||
174 | |||
175 | bad_stack_a5: | ||
176 | li a5, 0 | ||
177 | b load_a6 | ||
178 | |||
179 | bad_stack_a6: | ||
180 | li a6, 0 | ||
181 | b load_a7 | ||
182 | |||
183 | bad_stack_a7: | ||
184 | li a7, 0 | ||
185 | b loads_done | ||
186 | |||
170 | not_o32_scall: | 187 | not_o32_scall: |
171 | /* | 188 | /* |
172 | * This is not an o32 compatibility syscall, pass it on | 189 | * This is not an o32 compatibility syscall, pass it on |
@@ -383,7 +400,7 @@ EXPORT(sys32_call_table) | |||
383 | PTR sys_connect /* 4170 */ | 400 | PTR sys_connect /* 4170 */ |
384 | PTR sys_getpeername | 401 | PTR sys_getpeername |
385 | PTR sys_getsockname | 402 | PTR sys_getsockname |
386 | PTR sys_getsockopt | 403 | PTR compat_sys_getsockopt |
387 | PTR sys_listen | 404 | PTR sys_listen |
388 | PTR compat_sys_recv /* 4175 */ | 405 | PTR compat_sys_recv /* 4175 */ |
389 | PTR compat_sys_recvfrom | 406 | PTR compat_sys_recvfrom |
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index be73c491182b..008b3378653a 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -337,6 +337,11 @@ static void __init bootmem_init(void) | |||
337 | min_low_pfn = start; | 337 | min_low_pfn = start; |
338 | if (end <= reserved_end) | 338 | if (end <= reserved_end) |
339 | continue; | 339 | continue; |
340 | #ifdef CONFIG_BLK_DEV_INITRD | ||
341 | /* mapstart should be after initrd_end */ | ||
342 | if (initrd_end && end <= (unsigned long)PFN_UP(__pa(initrd_end))) | ||
343 | continue; | ||
344 | #endif | ||
340 | if (start >= mapstart) | 345 | if (start >= mapstart) |
341 | continue; | 346 | continue; |
342 | mapstart = max(reserved_end, start); | 347 | mapstart = max(reserved_end, start); |
@@ -366,14 +371,6 @@ static void __init bootmem_init(void) | |||
366 | max_low_pfn = PFN_DOWN(HIGHMEM_START); | 371 | max_low_pfn = PFN_DOWN(HIGHMEM_START); |
367 | } | 372 | } |
368 | 373 | ||
369 | #ifdef CONFIG_BLK_DEV_INITRD | ||
370 | /* | ||
371 | * mapstart should be after initrd_end | ||
372 | */ | ||
373 | if (initrd_end) | ||
374 | mapstart = max(mapstart, (unsigned long)PFN_UP(__pa(initrd_end))); | ||
375 | #endif | ||
376 | |||
377 | /* | 374 | /* |
378 | * Initialize the boot-time allocator with low memory only. | 375 | * Initialize the boot-time allocator with low memory only. |
379 | */ | 376 | */ |
diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c index 4251d390b5b6..c88937745b4e 100644 --- a/arch/mips/kernel/smp-cps.c +++ b/arch/mips/kernel/smp-cps.c | |||
@@ -133,7 +133,7 @@ static void __init cps_prepare_cpus(unsigned int max_cpus) | |||
133 | /* | 133 | /* |
134 | * Patch the start of mips_cps_core_entry to provide: | 134 | * Patch the start of mips_cps_core_entry to provide: |
135 | * | 135 | * |
136 | * v0 = CM base address | 136 | * v1 = CM base address |
137 | * s0 = kseg0 CCA | 137 | * s0 = kseg0 CCA |
138 | */ | 138 | */ |
139 | entry_code = (u32 *)&mips_cps_core_entry; | 139 | entry_code = (u32 *)&mips_cps_core_entry; |
@@ -369,7 +369,7 @@ void play_dead(void) | |||
369 | 369 | ||
370 | static void wait_for_sibling_halt(void *ptr_cpu) | 370 | static void wait_for_sibling_halt(void *ptr_cpu) |
371 | { | 371 | { |
372 | unsigned cpu = (unsigned)ptr_cpu; | 372 | unsigned cpu = (unsigned long)ptr_cpu; |
373 | unsigned vpe_id = cpu_vpe_id(&cpu_data[cpu]); | 373 | unsigned vpe_id = cpu_vpe_id(&cpu_data[cpu]); |
374 | unsigned halted; | 374 | unsigned halted; |
375 | unsigned long flags; | 375 | unsigned long flags; |
@@ -430,7 +430,7 @@ static void cps_cpu_die(unsigned int cpu) | |||
430 | */ | 430 | */ |
431 | err = smp_call_function_single(cpu_death_sibling, | 431 | err = smp_call_function_single(cpu_death_sibling, |
432 | wait_for_sibling_halt, | 432 | wait_for_sibling_halt, |
433 | (void *)cpu, 1); | 433 | (void *)(unsigned long)cpu, 1); |
434 | if (err) | 434 | if (err) |
435 | panic("Failed to call remote sibling CPU\n"); | 435 | panic("Failed to call remote sibling CPU\n"); |
436 | } | 436 | } |
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index faa46ebd9dda..d0744cc77ea7 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -63,6 +63,13 @@ EXPORT_SYMBOL(cpu_sibling_map); | |||
63 | cpumask_t cpu_core_map[NR_CPUS] __read_mostly; | 63 | cpumask_t cpu_core_map[NR_CPUS] __read_mostly; |
64 | EXPORT_SYMBOL(cpu_core_map); | 64 | EXPORT_SYMBOL(cpu_core_map); |
65 | 65 | ||
66 | /* | ||
67 | * A logcal cpu mask containing only one VPE per core to | ||
68 | * reduce the number of IPIs on large MT systems. | ||
69 | */ | ||
70 | cpumask_t cpu_foreign_map __read_mostly; | ||
71 | EXPORT_SYMBOL(cpu_foreign_map); | ||
72 | |||
66 | /* representing cpus for which sibling maps can be computed */ | 73 | /* representing cpus for which sibling maps can be computed */ |
67 | static cpumask_t cpu_sibling_setup_map; | 74 | static cpumask_t cpu_sibling_setup_map; |
68 | 75 | ||
@@ -103,6 +110,29 @@ static inline void set_cpu_core_map(int cpu) | |||
103 | } | 110 | } |
104 | } | 111 | } |
105 | 112 | ||
113 | /* | ||
114 | * Calculate a new cpu_foreign_map mask whenever a | ||
115 | * new cpu appears or disappears. | ||
116 | */ | ||
117 | static inline void calculate_cpu_foreign_map(void) | ||
118 | { | ||
119 | int i, k, core_present; | ||
120 | cpumask_t temp_foreign_map; | ||
121 | |||
122 | /* Re-calculate the mask */ | ||
123 | for_each_online_cpu(i) { | ||
124 | core_present = 0; | ||
125 | for_each_cpu(k, &temp_foreign_map) | ||
126 | if (cpu_data[i].package == cpu_data[k].package && | ||
127 | cpu_data[i].core == cpu_data[k].core) | ||
128 | core_present = 1; | ||
129 | if (!core_present) | ||
130 | cpumask_set_cpu(i, &temp_foreign_map); | ||
131 | } | ||
132 | |||
133 | cpumask_copy(&cpu_foreign_map, &temp_foreign_map); | ||
134 | } | ||
135 | |||
106 | struct plat_smp_ops *mp_ops; | 136 | struct plat_smp_ops *mp_ops; |
107 | EXPORT_SYMBOL(mp_ops); | 137 | EXPORT_SYMBOL(mp_ops); |
108 | 138 | ||
@@ -146,6 +176,8 @@ asmlinkage void start_secondary(void) | |||
146 | set_cpu_sibling_map(cpu); | 176 | set_cpu_sibling_map(cpu); |
147 | set_cpu_core_map(cpu); | 177 | set_cpu_core_map(cpu); |
148 | 178 | ||
179 | calculate_cpu_foreign_map(); | ||
180 | |||
149 | cpumask_set_cpu(cpu, &cpu_callin_map); | 181 | cpumask_set_cpu(cpu, &cpu_callin_map); |
150 | 182 | ||
151 | synchronise_count_slave(cpu); | 183 | synchronise_count_slave(cpu); |
@@ -173,9 +205,18 @@ void __irq_entry smp_call_function_interrupt(void) | |||
173 | static void stop_this_cpu(void *dummy) | 205 | static void stop_this_cpu(void *dummy) |
174 | { | 206 | { |
175 | /* | 207 | /* |
176 | * Remove this CPU: | 208 | * Remove this CPU. Be a bit slow here and |
209 | * set the bits for every online CPU so we don't miss | ||
210 | * any IPI whilst taking this VPE down. | ||
177 | */ | 211 | */ |
212 | |||
213 | cpumask_copy(&cpu_foreign_map, cpu_online_mask); | ||
214 | |||
215 | /* Make it visible to every other CPU */ | ||
216 | smp_mb(); | ||
217 | |||
178 | set_cpu_online(smp_processor_id(), false); | 218 | set_cpu_online(smp_processor_id(), false); |
219 | calculate_cpu_foreign_map(); | ||
179 | local_irq_disable(); | 220 | local_irq_disable(); |
180 | while (1); | 221 | while (1); |
181 | } | 222 | } |
@@ -197,6 +238,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
197 | mp_ops->prepare_cpus(max_cpus); | 238 | mp_ops->prepare_cpus(max_cpus); |
198 | set_cpu_sibling_map(0); | 239 | set_cpu_sibling_map(0); |
199 | set_cpu_core_map(0); | 240 | set_cpu_core_map(0); |
241 | calculate_cpu_foreign_map(); | ||
200 | #ifndef CONFIG_HOTPLUG_CPU | 242 | #ifndef CONFIG_HOTPLUG_CPU |
201 | init_cpu_present(cpu_possible_mask); | 243 | init_cpu_present(cpu_possible_mask); |
202 | #endif | 244 | #endif |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 2a7b38ed23f0..e207a43b5f8f 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -2130,10 +2130,10 @@ void per_cpu_trap_init(bool is_boot_cpu) | |||
2130 | BUG_ON(current->mm); | 2130 | BUG_ON(current->mm); |
2131 | enter_lazy_tlb(&init_mm, current); | 2131 | enter_lazy_tlb(&init_mm, current); |
2132 | 2132 | ||
2133 | /* Boot CPU's cache setup in setup_arch(). */ | 2133 | /* Boot CPU's cache setup in setup_arch(). */ |
2134 | if (!is_boot_cpu) | 2134 | if (!is_boot_cpu) |
2135 | cpu_cache_init(); | 2135 | cpu_cache_init(); |
2136 | tlb_init(); | 2136 | tlb_init(); |
2137 | TLBMISS_HANDLER_SETUP(); | 2137 | TLBMISS_HANDLER_SETUP(); |
2138 | } | 2138 | } |
2139 | 2139 | ||
diff --git a/arch/mips/loongson64/common/bonito-irq.c b/arch/mips/loongson64/common/bonito-irq.c index cc0e4fd548e6..4e116d23bab3 100644 --- a/arch/mips/loongson64/common/bonito-irq.c +++ b/arch/mips/loongson64/common/bonito-irq.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net | 3 | * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net |
4 | * Copyright (C) 2000, 2001 Ralf Baechle (ralf@gnu.org) | 4 | * Copyright (C) 2000, 2001 Ralf Baechle (ralf@gnu.org) |
5 | * | 5 | * |
6 | * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology | 6 | * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology |
7 | * Author: Fuxin Zhang, zhangfx@lemote.com | 7 | * Author: Fuxin Zhang, zhangfx@lemote.com |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify it | 9 | * This program is free software; you can redistribute it and/or modify it |
diff --git a/arch/mips/loongson64/common/cmdline.c b/arch/mips/loongson64/common/cmdline.c index 72fed003a536..01fbed137028 100644 --- a/arch/mips/loongson64/common/cmdline.c +++ b/arch/mips/loongson64/common/cmdline.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Copyright 2003 ICT CAS | 6 | * Copyright 2003 ICT CAS |
7 | * Author: Michael Guo <guoyi@ict.ac.cn> | 7 | * Author: Michael Guo <guoyi@ict.ac.cn> |
8 | * | 8 | * |
9 | * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology | 9 | * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology |
10 | * Author: Fuxin Zhang, zhangfx@lemote.com | 10 | * Author: Fuxin Zhang, zhangfx@lemote.com |
11 | * | 11 | * |
12 | * Copyright (C) 2009 Lemote Inc. | 12 | * Copyright (C) 2009 Lemote Inc. |
diff --git a/arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c b/arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c index 12c75db23420..875037063a80 100644 --- a/arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c +++ b/arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * CS5536 General timer functions | 2 | * CS5536 General timer functions |
3 | * | 3 | * |
4 | * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology | 4 | * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology |
5 | * Author: Yanhua, yanh@lemote.com | 5 | * Author: Yanhua, yanh@lemote.com |
6 | * | 6 | * |
7 | * Copyright (C) 2009 Lemote Inc. | 7 | * Copyright (C) 2009 Lemote Inc. |
diff --git a/arch/mips/loongson64/common/env.c b/arch/mips/loongson64/common/env.c index 22f04ca2ff3e..f6c44dd332e2 100644 --- a/arch/mips/loongson64/common/env.c +++ b/arch/mips/loongson64/common/env.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Copyright 2003 ICT CAS | 6 | * Copyright 2003 ICT CAS |
7 | * Author: Michael Guo <guoyi@ict.ac.cn> | 7 | * Author: Michael Guo <guoyi@ict.ac.cn> |
8 | * | 8 | * |
9 | * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology | 9 | * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology |
10 | * Author: Fuxin Zhang, zhangfx@lemote.com | 10 | * Author: Fuxin Zhang, zhangfx@lemote.com |
11 | * | 11 | * |
12 | * Copyright (C) 2009 Lemote Inc. | 12 | * Copyright (C) 2009 Lemote Inc. |
diff --git a/arch/mips/loongson64/common/irq.c b/arch/mips/loongson64/common/irq.c index 687003b19b45..d36d969a4a87 100644 --- a/arch/mips/loongson64/common/irq.c +++ b/arch/mips/loongson64/common/irq.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology | 2 | * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology |
3 | * Author: Fuxin Zhang, zhangfx@lemote.com | 3 | * Author: Fuxin Zhang, zhangfx@lemote.com |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or modify it |
diff --git a/arch/mips/loongson64/common/setup.c b/arch/mips/loongson64/common/setup.c index d477dd6bb326..2dc5122f0e09 100644 --- a/arch/mips/loongson64/common/setup.c +++ b/arch/mips/loongson64/common/setup.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology | 2 | * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology |
3 | * Author: Fuxin Zhang, zhangfx@lemote.com | 3 | * Author: Fuxin Zhang, zhangfx@lemote.com |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or modify it |
diff --git a/arch/mips/loongson64/fuloong-2e/irq.c b/arch/mips/loongson64/fuloong-2e/irq.c index ef5ec8f3de5f..892963f860b7 100644 --- a/arch/mips/loongson64/fuloong-2e/irq.c +++ b/arch/mips/loongson64/fuloong-2e/irq.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology | 2 | * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology |
3 | * Author: Fuxin Zhang, zhangfx@lemote.com | 3 | * Author: Fuxin Zhang, zhangfx@lemote.com |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or modify it |
diff --git a/arch/mips/loongson64/lemote-2f/clock.c b/arch/mips/loongson64/lemote-2f/clock.c index 462e34d46b4a..a78fb657068c 100644 --- a/arch/mips/loongson64/lemote-2f/clock.c +++ b/arch/mips/loongson64/lemote-2f/clock.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2006 - 2008 Lemote Inc. & Insititute of Computing Technology | 2 | * Copyright (C) 2006 - 2008 Lemote Inc. & Institute of Computing Technology |
3 | * Author: Yanhua, yanh@lemote.com | 3 | * Author: Yanhua, yanh@lemote.com |
4 | * | 4 | * |
5 | * This file is subject to the terms and conditions of the GNU General Public | 5 | * This file is subject to the terms and conditions of the GNU General Public |
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
16 | 16 | ||
17 | #include <asm/clock.h> | 17 | #include <asm/clock.h> |
18 | #include <asm/mach-loongson/loongson.h> | 18 | #include <asm/mach-loongson64/loongson.h> |
19 | 19 | ||
20 | static LIST_HEAD(clock_list); | 20 | static LIST_HEAD(clock_list); |
21 | static DEFINE_SPINLOCK(clock_lock); | 21 | static DEFINE_SPINLOCK(clock_lock); |
diff --git a/arch/mips/loongson64/loongson-3/numa.c b/arch/mips/loongson64/loongson-3/numa.c index 12d14ed48778..6f9e010cec4d 100644 --- a/arch/mips/loongson64/loongson-3/numa.c +++ b/arch/mips/loongson64/loongson-3/numa.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2010 Loongson Inc. & Lemote Inc. & | 2 | * Copyright (C) 2010 Loongson Inc. & Lemote Inc. & |
3 | * Insititute of Computing Technology | 3 | * Institute of Computing Technology |
4 | * Author: Xiang Gao, gaoxiang@ict.ac.cn | 4 | * Author: Xiang Gao, gaoxiang@ict.ac.cn |
5 | * Huacai Chen, chenhc@lemote.com | 5 | * Huacai Chen, chenhc@lemote.com |
6 | * Xiaofu Meng, Shuangshuang Zhang | 6 | * Xiaofu Meng, Shuangshuang Zhang |
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c index 22b9b2cb9219..712f17a2ecf2 100644 --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c | |||
@@ -451,7 +451,7 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, | |||
451 | /* Fall through */ | 451 | /* Fall through */ |
452 | case jr_op: | 452 | case jr_op: |
453 | /* For R6, JR already emulated in jalr_op */ | 453 | /* For R6, JR already emulated in jalr_op */ |
454 | if (NO_R6EMU && insn.r_format.opcode == jr_op) | 454 | if (NO_R6EMU && insn.r_format.func == jr_op) |
455 | break; | 455 | break; |
456 | *contpc = regs->regs[insn.r_format.rs]; | 456 | *contpc = regs->regs[insn.r_format.rs]; |
457 | return 1; | 457 | return 1; |
@@ -551,7 +551,7 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, | |||
551 | dec_insn.next_pc_inc; | 551 | dec_insn.next_pc_inc; |
552 | return 1; | 552 | return 1; |
553 | case blezl_op: | 553 | case blezl_op: |
554 | if (NO_R6EMU) | 554 | if (!insn.i_format.rt && NO_R6EMU) |
555 | break; | 555 | break; |
556 | case blez_op: | 556 | case blez_op: |
557 | 557 | ||
@@ -588,7 +588,7 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, | |||
588 | dec_insn.next_pc_inc; | 588 | dec_insn.next_pc_inc; |
589 | return 1; | 589 | return 1; |
590 | case bgtzl_op: | 590 | case bgtzl_op: |
591 | if (NO_R6EMU) | 591 | if (!insn.i_format.rt && NO_R6EMU) |
592 | break; | 592 | break; |
593 | case bgtz_op: | 593 | case bgtz_op: |
594 | /* | 594 | /* |
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index 7f660dc67596..fbea4432f3f2 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <asm/cacheflush.h> /* for run_uncached() */ | 37 | #include <asm/cacheflush.h> /* for run_uncached() */ |
38 | #include <asm/traps.h> | 38 | #include <asm/traps.h> |
39 | #include <asm/dma-coherence.h> | 39 | #include <asm/dma-coherence.h> |
40 | #include <asm/mips-cm.h> | ||
40 | 41 | ||
41 | /* | 42 | /* |
42 | * Special Variant of smp_call_function for use by cache functions: | 43 | * Special Variant of smp_call_function for use by cache functions: |
@@ -51,9 +52,16 @@ static inline void r4k_on_each_cpu(void (*func) (void *info), void *info) | |||
51 | { | 52 | { |
52 | preempt_disable(); | 53 | preempt_disable(); |
53 | 54 | ||
54 | #ifndef CONFIG_MIPS_MT_SMP | 55 | /* |
55 | smp_call_function(func, info, 1); | 56 | * The Coherent Manager propagates address-based cache ops to other |
56 | #endif | 57 | * cores but not index-based ops. However, r4k_on_each_cpu is used |
58 | * in both cases so there is no easy way to tell what kind of op is | ||
59 | * executed to the other cores. The best we can probably do is | ||
60 | * to restrict that call when a CM is not present because both | ||
61 | * CM-based SMP protocols (CMP & CPS) restrict index-based cache ops. | ||
62 | */ | ||
63 | if (!mips_cm_present()) | ||
64 | smp_call_function_many(&cpu_foreign_map, func, info, 1); | ||
57 | func(info); | 65 | func(info); |
58 | preempt_enable(); | 66 | preempt_enable(); |
59 | } | 67 | } |
@@ -937,7 +945,9 @@ static void b5k_instruction_hazard(void) | |||
937 | } | 945 | } |
938 | 946 | ||
939 | static char *way_string[] = { NULL, "direct mapped", "2-way", | 947 | static char *way_string[] = { NULL, "direct mapped", "2-way", |
940 | "3-way", "4-way", "5-way", "6-way", "7-way", "8-way" | 948 | "3-way", "4-way", "5-way", "6-way", "7-way", "8-way", |
949 | "9-way", "10-way", "11-way", "12-way", | ||
950 | "13-way", "14-way", "15-way", "16-way", | ||
941 | }; | 951 | }; |
942 | 952 | ||
943 | static void probe_pcache(void) | 953 | static void probe_pcache(void) |
diff --git a/arch/mips/mti-malta/malta-time.c b/arch/mips/mti-malta/malta-time.c index 185e68261f45..5625b190edc0 100644 --- a/arch/mips/mti-malta/malta-time.c +++ b/arch/mips/mti-malta/malta-time.c | |||
@@ -119,18 +119,24 @@ void read_persistent_clock(struct timespec *ts) | |||
119 | 119 | ||
120 | int get_c0_fdc_int(void) | 120 | int get_c0_fdc_int(void) |
121 | { | 121 | { |
122 | int mips_cpu_fdc_irq; | 122 | /* |
123 | * Some cores claim the FDC is routable through the GIC, but it doesn't | ||
124 | * actually seem to be connected for those Malta bitstreams. | ||
125 | */ | ||
126 | switch (current_cpu_type()) { | ||
127 | case CPU_INTERAPTIV: | ||
128 | case CPU_PROAPTIV: | ||
129 | return -1; | ||
130 | }; | ||
123 | 131 | ||
124 | if (cpu_has_veic) | 132 | if (cpu_has_veic) |
125 | mips_cpu_fdc_irq = -1; | 133 | return -1; |
126 | else if (gic_present) | 134 | else if (gic_present) |
127 | mips_cpu_fdc_irq = gic_get_c0_fdc_int(); | 135 | return gic_get_c0_fdc_int(); |
128 | else if (cp0_fdc_irq >= 0) | 136 | else if (cp0_fdc_irq >= 0) |
129 | mips_cpu_fdc_irq = MIPS_CPU_IRQ_BASE + cp0_fdc_irq; | 137 | return MIPS_CPU_IRQ_BASE + cp0_fdc_irq; |
130 | else | 138 | else |
131 | mips_cpu_fdc_irq = -1; | 139 | return -1; |
132 | |||
133 | return mips_cpu_fdc_irq; | ||
134 | } | 140 | } |
135 | 141 | ||
136 | int get_c0_perfcount_int(void) | 142 | int get_c0_perfcount_int(void) |
diff --git a/arch/mips/pistachio/init.c b/arch/mips/pistachio/init.c index d2dc836523a3..8bd8ebb20a72 100644 --- a/arch/mips/pistachio/init.c +++ b/arch/mips/pistachio/init.c | |||
@@ -63,13 +63,19 @@ void __init plat_mem_setup(void) | |||
63 | plat_setup_iocoherency(); | 63 | plat_setup_iocoherency(); |
64 | } | 64 | } |
65 | 65 | ||
66 | #define DEFAULT_CPC_BASE_ADDR 0x1bde0000 | 66 | #define DEFAULT_CPC_BASE_ADDR 0x1bde0000 |
67 | #define DEFAULT_CDMM_BASE_ADDR 0x1bdd0000 | ||
67 | 68 | ||
68 | phys_addr_t mips_cpc_default_phys_base(void) | 69 | phys_addr_t mips_cpc_default_phys_base(void) |
69 | { | 70 | { |
70 | return DEFAULT_CPC_BASE_ADDR; | 71 | return DEFAULT_CPC_BASE_ADDR; |
71 | } | 72 | } |
72 | 73 | ||
74 | phys_addr_t mips_cdmm_phys_base(void) | ||
75 | { | ||
76 | return DEFAULT_CDMM_BASE_ADDR; | ||
77 | } | ||
78 | |||
73 | static void __init mips_nmi_setup(void) | 79 | static void __init mips_nmi_setup(void) |
74 | { | 80 | { |
75 | void *base; | 81 | void *base; |
diff --git a/arch/mips/pistachio/time.c b/arch/mips/pistachio/time.c index 67889fcea8aa..7c73fcb92a10 100644 --- a/arch/mips/pistachio/time.c +++ b/arch/mips/pistachio/time.c | |||
@@ -27,6 +27,11 @@ int get_c0_perfcount_int(void) | |||
27 | return gic_get_c0_perfcount_int(); | 27 | return gic_get_c0_perfcount_int(); |
28 | } | 28 | } |
29 | 29 | ||
30 | int get_c0_fdc_int(void) | ||
31 | { | ||
32 | return gic_get_c0_fdc_int(); | ||
33 | } | ||
34 | |||
30 | void __init plat_time_init(void) | 35 | void __init plat_time_init(void) |
31 | { | 36 | { |
32 | struct device_node *np; | 37 | struct device_node *np; |
diff --git a/arch/mips/sibyte/Kconfig b/arch/mips/sibyte/Kconfig index a8bb972fd9fd..cb9a095f5c5e 100644 --- a/arch/mips/sibyte/Kconfig +++ b/arch/mips/sibyte/Kconfig | |||
@@ -81,11 +81,6 @@ choice | |||
81 | prompt "SiByte SOC Stepping" | 81 | prompt "SiByte SOC Stepping" |
82 | depends on SIBYTE_SB1xxx_SOC | 82 | depends on SIBYTE_SB1xxx_SOC |
83 | 83 | ||
84 | config CPU_SB1_PASS_1 | ||
85 | bool "1250 Pass1" | ||
86 | depends on SIBYTE_SB1250 | ||
87 | select CPU_HAS_PREFETCH | ||
88 | |||
89 | config CPU_SB1_PASS_2_1250 | 84 | config CPU_SB1_PASS_2_1250 |
90 | bool "1250 An" | 85 | bool "1250 An" |
91 | depends on SIBYTE_SB1250 | 86 | depends on SIBYTE_SB1250 |
diff --git a/arch/mips/sibyte/common/bus_watcher.c b/arch/mips/sibyte/common/bus_watcher.c index 5581844c9194..41a1d2242211 100644 --- a/arch/mips/sibyte/common/bus_watcher.c +++ b/arch/mips/sibyte/common/bus_watcher.c | |||
@@ -81,10 +81,7 @@ void check_bus_watcher(void) | |||
81 | { | 81 | { |
82 | u32 status, l2_err, memio_err; | 82 | u32 status, l2_err, memio_err; |
83 | 83 | ||
84 | #ifdef CONFIG_SB1_PASS_1_WORKAROUNDS | 84 | #if defined(CONFIG_SIBYTE_BCM112X) || defined(CONFIG_SIBYTE_SB1250) |
85 | /* Destructive read, clears register and interrupt */ | ||
86 | status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS)); | ||
87 | #elif defined(CONFIG_SIBYTE_BCM112X) || defined(CONFIG_SIBYTE_SB1250) | ||
88 | /* Use non-destructive register */ | 85 | /* Use non-destructive register */ |
89 | status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS_DEBUG)); | 86 | status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS_DEBUG)); |
90 | #elif defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) | 87 | #elif defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) |
diff --git a/arch/mips/sibyte/sb1250/setup.c b/arch/mips/sibyte/sb1250/setup.c index 3c02b2a77ae9..9d3c24efdf4a 100644 --- a/arch/mips/sibyte/sb1250/setup.c +++ b/arch/mips/sibyte/sb1250/setup.c | |||
@@ -202,12 +202,10 @@ void __init sb1250_setup(void) | |||
202 | 202 | ||
203 | switch (war_pass) { | 203 | switch (war_pass) { |
204 | case K_SYS_REVISION_BCM1250_PASS1: | 204 | case K_SYS_REVISION_BCM1250_PASS1: |
205 | #ifndef CONFIG_SB1_PASS_1_WORKAROUNDS | ||
206 | printk("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, " | 205 | printk("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, " |
207 | "and the kernel doesn't have the proper " | 206 | "and the kernel doesn't have the proper " |
208 | "workarounds compiled in. @@@@\n"); | 207 | "workarounds compiled in. @@@@\n"); |
209 | bad_config = 1; | 208 | bad_config = 1; |
210 | #endif | ||
211 | break; | 209 | break; |
212 | case K_SYS_REVISION_BCM1250_PASS2: | 210 | case K_SYS_REVISION_BCM1250_PASS2: |
213 | /* Pass 2 - easiest as default for now - so many numbers */ | 211 | /* Pass 2 - easiest as default for now - so many numbers */ |
diff --git a/arch/mn10300/include/asm/Kbuild b/arch/mn10300/include/asm/Kbuild index de30b0c88796..6edb9ee6128e 100644 --- a/arch/mn10300/include/asm/Kbuild +++ b/arch/mn10300/include/asm/Kbuild | |||
@@ -5,6 +5,7 @@ generic-y += cputime.h | |||
5 | generic-y += exec.h | 5 | generic-y += exec.h |
6 | generic-y += irq_work.h | 6 | generic-y += irq_work.h |
7 | generic-y += mcs_spinlock.h | 7 | generic-y += mcs_spinlock.h |
8 | generic-y += mm-arch-hooks.h | ||
8 | generic-y += preempt.h | 9 | generic-y += preempt.h |
9 | generic-y += sections.h | 10 | generic-y += sections.h |
10 | generic-y += trace_clock.h | 11 | generic-y += trace_clock.h |
diff --git a/arch/mn10300/include/asm/mm-arch-hooks.h b/arch/mn10300/include/asm/mm-arch-hooks.h deleted file mode 100644 index e2029a652f4c..000000000000 --- a/arch/mn10300/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_MN10300_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_MN10300_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_MN10300_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild index 434639d510b3..914864eb5a25 100644 --- a/arch/nios2/include/asm/Kbuild +++ b/arch/nios2/include/asm/Kbuild | |||
@@ -30,6 +30,7 @@ generic-y += kmap_types.h | |||
30 | generic-y += kvm_para.h | 30 | generic-y += kvm_para.h |
31 | generic-y += local.h | 31 | generic-y += local.h |
32 | generic-y += mcs_spinlock.h | 32 | generic-y += mcs_spinlock.h |
33 | generic-y += mm-arch-hooks.h | ||
33 | generic-y += mman.h | 34 | generic-y += mman.h |
34 | generic-y += module.h | 35 | generic-y += module.h |
35 | generic-y += msgbuf.h | 36 | generic-y += msgbuf.h |
diff --git a/arch/nios2/include/asm/mm-arch-hooks.h b/arch/nios2/include/asm/mm-arch-hooks.h deleted file mode 100644 index d7290dc68558..000000000000 --- a/arch/nios2/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_NIOS2_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_NIOS2_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_NIOS2_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig index e5a693b16da2..443f44de1020 100644 --- a/arch/openrisc/Kconfig +++ b/arch/openrisc/Kconfig | |||
@@ -17,6 +17,7 @@ config OPENRISC | |||
17 | select GENERIC_IRQ_SHOW | 17 | select GENERIC_IRQ_SHOW |
18 | select GENERIC_IOMAP | 18 | select GENERIC_IOMAP |
19 | select GENERIC_CPU_DEVICES | 19 | select GENERIC_CPU_DEVICES |
20 | select HAVE_UID16 | ||
20 | select GENERIC_ATOMIC64 | 21 | select GENERIC_ATOMIC64 |
21 | select GENERIC_CLOCKEVENTS | 22 | select GENERIC_CLOCKEVENTS |
22 | select GENERIC_STRNCPY_FROM_USER | 23 | select GENERIC_STRNCPY_FROM_USER |
@@ -31,9 +32,6 @@ config MMU | |||
31 | config HAVE_DMA_ATTRS | 32 | config HAVE_DMA_ATTRS |
32 | def_bool y | 33 | def_bool y |
33 | 34 | ||
34 | config UID16 | ||
35 | def_bool y | ||
36 | |||
37 | config RWSEM_GENERIC_SPINLOCK | 35 | config RWSEM_GENERIC_SPINLOCK |
38 | def_bool y | 36 | def_bool y |
39 | 37 | ||
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild index 2a2e39b8109a..2832f031fb11 100644 --- a/arch/openrisc/include/asm/Kbuild +++ b/arch/openrisc/include/asm/Kbuild | |||
@@ -36,6 +36,7 @@ generic-y += kmap_types.h | |||
36 | generic-y += kvm_para.h | 36 | generic-y += kvm_para.h |
37 | generic-y += local.h | 37 | generic-y += local.h |
38 | generic-y += mcs_spinlock.h | 38 | generic-y += mcs_spinlock.h |
39 | generic-y += mm-arch-hooks.h | ||
39 | generic-y += mman.h | 40 | generic-y += mman.h |
40 | generic-y += module.h | 41 | generic-y += module.h |
41 | generic-y += msgbuf.h | 42 | generic-y += msgbuf.h |
diff --git a/arch/openrisc/include/asm/mm-arch-hooks.h b/arch/openrisc/include/asm/mm-arch-hooks.h deleted file mode 100644 index 6d33cb555fe1..000000000000 --- a/arch/openrisc/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_OPENRISC_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_OPENRISC_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_OPENRISC_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild index 12b341d04f88..f9b3a81aefcd 100644 --- a/arch/parisc/include/asm/Kbuild +++ b/arch/parisc/include/asm/Kbuild | |||
@@ -15,6 +15,7 @@ generic-y += kvm_para.h | |||
15 | generic-y += local.h | 15 | generic-y += local.h |
16 | generic-y += local64.h | 16 | generic-y += local64.h |
17 | generic-y += mcs_spinlock.h | 17 | generic-y += mcs_spinlock.h |
18 | generic-y += mm-arch-hooks.h | ||
18 | generic-y += mutex.h | 19 | generic-y += mutex.h |
19 | generic-y += param.h | 20 | generic-y += param.h |
20 | generic-y += percpu.h | 21 | generic-y += percpu.h |
diff --git a/arch/parisc/include/asm/mm-arch-hooks.h b/arch/parisc/include/asm/mm-arch-hooks.h deleted file mode 100644 index 654ec63b0ee9..000000000000 --- a/arch/parisc/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_PARISC_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_PARISC_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_PARISC_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h index 3a08eae3318f..3edbb9fc91b4 100644 --- a/arch/parisc/include/asm/pgalloc.h +++ b/arch/parisc/include/asm/pgalloc.h | |||
@@ -72,7 +72,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) | |||
72 | 72 | ||
73 | static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) | 73 | static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) |
74 | { | 74 | { |
75 | if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED) | 75 | if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED) { |
76 | /* | 76 | /* |
77 | * This is the permanent pmd attached to the pgd; | 77 | * This is the permanent pmd attached to the pgd; |
78 | * cannot free it. | 78 | * cannot free it. |
@@ -81,6 +81,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) | |||
81 | */ | 81 | */ |
82 | mm_inc_nr_pmds(mm); | 82 | mm_inc_nr_pmds(mm); |
83 | return; | 83 | return; |
84 | } | ||
84 | free_pages((unsigned long)pmd, PMD_ORDER); | 85 | free_pages((unsigned long)pmd, PMD_ORDER); |
85 | } | 86 | } |
86 | 87 | ||
diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h index 0a183756d6ec..f93c4a4e6580 100644 --- a/arch/parisc/include/asm/pgtable.h +++ b/arch/parisc/include/asm/pgtable.h | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <asm/processor.h> | 16 | #include <asm/processor.h> |
17 | #include <asm/cache.h> | 17 | #include <asm/cache.h> |
18 | 18 | ||
19 | extern spinlock_t pa_dbit_lock; | 19 | extern spinlock_t pa_tlb_lock; |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel | 22 | * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel |
@@ -33,6 +33,19 @@ extern spinlock_t pa_dbit_lock; | |||
33 | */ | 33 | */ |
34 | #define kern_addr_valid(addr) (1) | 34 | #define kern_addr_valid(addr) (1) |
35 | 35 | ||
36 | /* Purge data and instruction TLB entries. Must be called holding | ||
37 | * the pa_tlb_lock. The TLB purge instructions are slow on SMP | ||
38 | * machines since the purge must be broadcast to all CPUs. | ||
39 | */ | ||
40 | |||
41 | static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr) | ||
42 | { | ||
43 | mtsp(mm->context, 1); | ||
44 | pdtlb(addr); | ||
45 | if (unlikely(split_tlb)) | ||
46 | pitlb(addr); | ||
47 | } | ||
48 | |||
36 | /* Certain architectures need to do special things when PTEs | 49 | /* Certain architectures need to do special things when PTEs |
37 | * within a page table are directly modified. Thus, the following | 50 | * within a page table are directly modified. Thus, the following |
38 | * hook is made available. | 51 | * hook is made available. |
@@ -42,15 +55,20 @@ extern spinlock_t pa_dbit_lock; | |||
42 | *(pteptr) = (pteval); \ | 55 | *(pteptr) = (pteval); \ |
43 | } while(0) | 56 | } while(0) |
44 | 57 | ||
45 | extern void purge_tlb_entries(struct mm_struct *, unsigned long); | 58 | #define pte_inserted(x) \ |
59 | ((pte_val(x) & (_PAGE_PRESENT|_PAGE_ACCESSED)) \ | ||
60 | == (_PAGE_PRESENT|_PAGE_ACCESSED)) | ||
46 | 61 | ||
47 | #define set_pte_at(mm, addr, ptep, pteval) \ | 62 | #define set_pte_at(mm, addr, ptep, pteval) \ |
48 | do { \ | 63 | do { \ |
64 | pte_t old_pte; \ | ||
49 | unsigned long flags; \ | 65 | unsigned long flags; \ |
50 | spin_lock_irqsave(&pa_dbit_lock, flags); \ | 66 | spin_lock_irqsave(&pa_tlb_lock, flags); \ |
51 | set_pte(ptep, pteval); \ | 67 | old_pte = *ptep; \ |
52 | purge_tlb_entries(mm, addr); \ | 68 | set_pte(ptep, pteval); \ |
53 | spin_unlock_irqrestore(&pa_dbit_lock, flags); \ | 69 | if (pte_inserted(old_pte)) \ |
70 | purge_tlb_entries(mm, addr); \ | ||
71 | spin_unlock_irqrestore(&pa_tlb_lock, flags); \ | ||
54 | } while (0) | 72 | } while (0) |
55 | 73 | ||
56 | #endif /* !__ASSEMBLY__ */ | 74 | #endif /* !__ASSEMBLY__ */ |
@@ -268,7 +286,7 @@ extern unsigned long *empty_zero_page; | |||
268 | 286 | ||
269 | #define pte_none(x) (pte_val(x) == 0) | 287 | #define pte_none(x) (pte_val(x) == 0) |
270 | #define pte_present(x) (pte_val(x) & _PAGE_PRESENT) | 288 | #define pte_present(x) (pte_val(x) & _PAGE_PRESENT) |
271 | #define pte_clear(mm,addr,xp) do { pte_val(*(xp)) = 0; } while (0) | 289 | #define pte_clear(mm, addr, xp) set_pte_at(mm, addr, xp, __pte(0)) |
272 | 290 | ||
273 | #define pmd_flag(x) (pmd_val(x) & PxD_FLAG_MASK) | 291 | #define pmd_flag(x) (pmd_val(x) & PxD_FLAG_MASK) |
274 | #define pmd_address(x) ((unsigned long)(pmd_val(x) &~ PxD_FLAG_MASK) << PxD_VALUE_SHIFT) | 292 | #define pmd_address(x) ((unsigned long)(pmd_val(x) &~ PxD_FLAG_MASK) << PxD_VALUE_SHIFT) |
@@ -435,15 +453,15 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned | |||
435 | if (!pte_young(*ptep)) | 453 | if (!pte_young(*ptep)) |
436 | return 0; | 454 | return 0; |
437 | 455 | ||
438 | spin_lock_irqsave(&pa_dbit_lock, flags); | 456 | spin_lock_irqsave(&pa_tlb_lock, flags); |
439 | pte = *ptep; | 457 | pte = *ptep; |
440 | if (!pte_young(pte)) { | 458 | if (!pte_young(pte)) { |
441 | spin_unlock_irqrestore(&pa_dbit_lock, flags); | 459 | spin_unlock_irqrestore(&pa_tlb_lock, flags); |
442 | return 0; | 460 | return 0; |
443 | } | 461 | } |
444 | set_pte(ptep, pte_mkold(pte)); | 462 | set_pte(ptep, pte_mkold(pte)); |
445 | purge_tlb_entries(vma->vm_mm, addr); | 463 | purge_tlb_entries(vma->vm_mm, addr); |
446 | spin_unlock_irqrestore(&pa_dbit_lock, flags); | 464 | spin_unlock_irqrestore(&pa_tlb_lock, flags); |
447 | return 1; | 465 | return 1; |
448 | } | 466 | } |
449 | 467 | ||
@@ -453,11 +471,12 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, | |||
453 | pte_t old_pte; | 471 | pte_t old_pte; |
454 | unsigned long flags; | 472 | unsigned long flags; |
455 | 473 | ||
456 | spin_lock_irqsave(&pa_dbit_lock, flags); | 474 | spin_lock_irqsave(&pa_tlb_lock, flags); |
457 | old_pte = *ptep; | 475 | old_pte = *ptep; |
458 | pte_clear(mm,addr,ptep); | 476 | set_pte(ptep, __pte(0)); |
459 | purge_tlb_entries(mm, addr); | 477 | if (pte_inserted(old_pte)) |
460 | spin_unlock_irqrestore(&pa_dbit_lock, flags); | 478 | purge_tlb_entries(mm, addr); |
479 | spin_unlock_irqrestore(&pa_tlb_lock, flags); | ||
461 | 480 | ||
462 | return old_pte; | 481 | return old_pte; |
463 | } | 482 | } |
@@ -465,10 +484,10 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, | |||
465 | static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 484 | static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
466 | { | 485 | { |
467 | unsigned long flags; | 486 | unsigned long flags; |
468 | spin_lock_irqsave(&pa_dbit_lock, flags); | 487 | spin_lock_irqsave(&pa_tlb_lock, flags); |
469 | set_pte(ptep, pte_wrprotect(*ptep)); | 488 | set_pte(ptep, pte_wrprotect(*ptep)); |
470 | purge_tlb_entries(mm, addr); | 489 | purge_tlb_entries(mm, addr); |
471 | spin_unlock_irqrestore(&pa_dbit_lock, flags); | 490 | spin_unlock_irqrestore(&pa_tlb_lock, flags); |
472 | } | 491 | } |
473 | 492 | ||
474 | #define pte_same(A,B) (pte_val(A) == pte_val(B)) | 493 | #define pte_same(A,B) (pte_val(A) == pte_val(B)) |
diff --git a/arch/parisc/include/asm/tlbflush.h b/arch/parisc/include/asm/tlbflush.h index 9d086a599fa0..e84b96478193 100644 --- a/arch/parisc/include/asm/tlbflush.h +++ b/arch/parisc/include/asm/tlbflush.h | |||
@@ -13,6 +13,9 @@ | |||
13 | * active at any one time on the Merced bus. This tlb purge | 13 | * active at any one time on the Merced bus. This tlb purge |
14 | * synchronisation is fairly lightweight and harmless so we activate | 14 | * synchronisation is fairly lightweight and harmless so we activate |
15 | * it on all systems not just the N class. | 15 | * it on all systems not just the N class. |
16 | |||
17 | * It is also used to ensure PTE updates are atomic and consistent | ||
18 | * with the TLB. | ||
16 | */ | 19 | */ |
17 | extern spinlock_t pa_tlb_lock; | 20 | extern spinlock_t pa_tlb_lock; |
18 | 21 | ||
@@ -24,20 +27,24 @@ extern void flush_tlb_all_local(void *); | |||
24 | 27 | ||
25 | #define smp_flush_tlb_all() flush_tlb_all() | 28 | #define smp_flush_tlb_all() flush_tlb_all() |
26 | 29 | ||
30 | int __flush_tlb_range(unsigned long sid, | ||
31 | unsigned long start, unsigned long end); | ||
32 | |||
33 | #define flush_tlb_range(vma, start, end) \ | ||
34 | __flush_tlb_range((vma)->vm_mm->context, start, end) | ||
35 | |||
36 | #define flush_tlb_kernel_range(start, end) \ | ||
37 | __flush_tlb_range(0, start, end) | ||
38 | |||
27 | /* | 39 | /* |
28 | * flush_tlb_mm() | 40 | * flush_tlb_mm() |
29 | * | 41 | * |
30 | * XXX This code is NOT valid for HP-UX compatibility processes, | 42 | * The code to switch to a new context is NOT valid for processes |
31 | * (although it will probably work 99% of the time). HP-UX | 43 | * which play with the space id's. Thus, we have to preserve the |
32 | * processes are free to play with the space id's and save them | 44 | * space and just flush the entire tlb. However, the compilers, |
33 | * over long periods of time, etc. so we have to preserve the | 45 | * dynamic linker, etc, do not manipulate space id's, so there |
34 | * space and just flush the entire tlb. We need to check the | 46 | * could be a significant performance benefit in switching contexts |
35 | * personality in order to do that, but the personality is not | 47 | * and not flushing the whole tlb. |
36 | * currently being set correctly. | ||
37 | * | ||
38 | * Of course, Linux processes could do the same thing, but | ||
39 | * we don't support that (and the compilers, dynamic linker, | ||
40 | * etc. do not do that). | ||
41 | */ | 48 | */ |
42 | 49 | ||
43 | static inline void flush_tlb_mm(struct mm_struct *mm) | 50 | static inline void flush_tlb_mm(struct mm_struct *mm) |
@@ -45,10 +52,18 @@ static inline void flush_tlb_mm(struct mm_struct *mm) | |||
45 | BUG_ON(mm == &init_mm); /* Should never happen */ | 52 | BUG_ON(mm == &init_mm); /* Should never happen */ |
46 | 53 | ||
47 | #if 1 || defined(CONFIG_SMP) | 54 | #if 1 || defined(CONFIG_SMP) |
55 | /* Except for very small threads, flushing the whole TLB is | ||
56 | * faster than using __flush_tlb_range. The pdtlb and pitlb | ||
57 | * instructions are very slow because of the TLB broadcast. | ||
58 | * It might be faster to do local range flushes on all CPUs | ||
59 | * on PA 2.0 systems. | ||
60 | */ | ||
48 | flush_tlb_all(); | 61 | flush_tlb_all(); |
49 | #else | 62 | #else |
50 | /* FIXME: currently broken, causing space id and protection ids | 63 | /* FIXME: currently broken, causing space id and protection ids |
51 | * to go out of sync, resulting in faults on userspace accesses. | 64 | * to go out of sync, resulting in faults on userspace accesses. |
65 | * This approach needs further investigation since running many | ||
66 | * small applications (e.g., GCC testsuite) is faster on HP-UX. | ||
52 | */ | 67 | */ |
53 | if (mm) { | 68 | if (mm) { |
54 | if (mm->context != 0) | 69 | if (mm->context != 0) |
@@ -65,22 +80,12 @@ static inline void flush_tlb_page(struct vm_area_struct *vma, | |||
65 | { | 80 | { |
66 | unsigned long flags, sid; | 81 | unsigned long flags, sid; |
67 | 82 | ||
68 | /* For one page, it's not worth testing the split_tlb variable */ | ||
69 | |||
70 | mb(); | ||
71 | sid = vma->vm_mm->context; | 83 | sid = vma->vm_mm->context; |
72 | purge_tlb_start(flags); | 84 | purge_tlb_start(flags); |
73 | mtsp(sid, 1); | 85 | mtsp(sid, 1); |
74 | pdtlb(addr); | 86 | pdtlb(addr); |
75 | pitlb(addr); | 87 | if (unlikely(split_tlb)) |
88 | pitlb(addr); | ||
76 | purge_tlb_end(flags); | 89 | purge_tlb_end(flags); |
77 | } | 90 | } |
78 | |||
79 | void __flush_tlb_range(unsigned long sid, | ||
80 | unsigned long start, unsigned long end); | ||
81 | |||
82 | #define flush_tlb_range(vma,start,end) __flush_tlb_range((vma)->vm_mm->context,start,end) | ||
83 | |||
84 | #define flush_tlb_kernel_range(start, end) __flush_tlb_range(0,start,end) | ||
85 | |||
86 | #endif | 91 | #endif |
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c index f6448c7c62b5..cda6dbbe9842 100644 --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c | |||
@@ -342,12 +342,15 @@ EXPORT_SYMBOL(flush_data_cache_local); | |||
342 | EXPORT_SYMBOL(flush_kernel_icache_range_asm); | 342 | EXPORT_SYMBOL(flush_kernel_icache_range_asm); |
343 | 343 | ||
344 | #define FLUSH_THRESHOLD 0x80000 /* 0.5MB */ | 344 | #define FLUSH_THRESHOLD 0x80000 /* 0.5MB */ |
345 | int parisc_cache_flush_threshold __read_mostly = FLUSH_THRESHOLD; | 345 | static unsigned long parisc_cache_flush_threshold __read_mostly = FLUSH_THRESHOLD; |
346 | |||
347 | #define FLUSH_TLB_THRESHOLD (2*1024*1024) /* 2MB initial TLB threshold */ | ||
348 | static unsigned long parisc_tlb_flush_threshold __read_mostly = FLUSH_TLB_THRESHOLD; | ||
346 | 349 | ||
347 | void __init parisc_setup_cache_timing(void) | 350 | void __init parisc_setup_cache_timing(void) |
348 | { | 351 | { |
349 | unsigned long rangetime, alltime; | 352 | unsigned long rangetime, alltime; |
350 | unsigned long size; | 353 | unsigned long size, start; |
351 | 354 | ||
352 | alltime = mfctl(16); | 355 | alltime = mfctl(16); |
353 | flush_data_cache(); | 356 | flush_data_cache(); |
@@ -364,14 +367,43 @@ void __init parisc_setup_cache_timing(void) | |||
364 | /* Racy, but if we see an intermediate value, it's ok too... */ | 367 | /* Racy, but if we see an intermediate value, it's ok too... */ |
365 | parisc_cache_flush_threshold = size * alltime / rangetime; | 368 | parisc_cache_flush_threshold = size * alltime / rangetime; |
366 | 369 | ||
367 | parisc_cache_flush_threshold = (parisc_cache_flush_threshold + L1_CACHE_BYTES - 1) &~ (L1_CACHE_BYTES - 1); | 370 | parisc_cache_flush_threshold = L1_CACHE_ALIGN(parisc_cache_flush_threshold); |
368 | if (!parisc_cache_flush_threshold) | 371 | if (!parisc_cache_flush_threshold) |
369 | parisc_cache_flush_threshold = FLUSH_THRESHOLD; | 372 | parisc_cache_flush_threshold = FLUSH_THRESHOLD; |
370 | 373 | ||
371 | if (parisc_cache_flush_threshold > cache_info.dc_size) | 374 | if (parisc_cache_flush_threshold > cache_info.dc_size) |
372 | parisc_cache_flush_threshold = cache_info.dc_size; | 375 | parisc_cache_flush_threshold = cache_info.dc_size; |
373 | 376 | ||
374 | printk(KERN_INFO "Setting cache flush threshold to %x (%d CPUs online)\n", parisc_cache_flush_threshold, num_online_cpus()); | 377 | printk(KERN_INFO "Setting cache flush threshold to %lu kB\n", |
378 | parisc_cache_flush_threshold/1024); | ||
379 | |||
380 | /* calculate TLB flush threshold */ | ||
381 | |||
382 | alltime = mfctl(16); | ||
383 | flush_tlb_all(); | ||
384 | alltime = mfctl(16) - alltime; | ||
385 | |||
386 | size = PAGE_SIZE; | ||
387 | start = (unsigned long) _text; | ||
388 | rangetime = mfctl(16); | ||
389 | while (start < (unsigned long) _end) { | ||
390 | flush_tlb_kernel_range(start, start + PAGE_SIZE); | ||
391 | start += PAGE_SIZE; | ||
392 | size += PAGE_SIZE; | ||
393 | } | ||
394 | rangetime = mfctl(16) - rangetime; | ||
395 | |||
396 | printk(KERN_DEBUG "Whole TLB flush %lu cycles, flushing %lu bytes %lu cycles\n", | ||
397 | alltime, size, rangetime); | ||
398 | |||
399 | parisc_tlb_flush_threshold = size * alltime / rangetime; | ||
400 | parisc_tlb_flush_threshold *= num_online_cpus(); | ||
401 | parisc_tlb_flush_threshold = PAGE_ALIGN(parisc_tlb_flush_threshold); | ||
402 | if (!parisc_tlb_flush_threshold) | ||
403 | parisc_tlb_flush_threshold = FLUSH_TLB_THRESHOLD; | ||
404 | |||
405 | printk(KERN_INFO "Setting TLB flush threshold to %lu kB\n", | ||
406 | parisc_tlb_flush_threshold/1024); | ||
375 | } | 407 | } |
376 | 408 | ||
377 | extern void purge_kernel_dcache_page_asm(unsigned long); | 409 | extern void purge_kernel_dcache_page_asm(unsigned long); |
@@ -403,48 +435,45 @@ void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, | |||
403 | } | 435 | } |
404 | EXPORT_SYMBOL(copy_user_page); | 436 | EXPORT_SYMBOL(copy_user_page); |
405 | 437 | ||
406 | void purge_tlb_entries(struct mm_struct *mm, unsigned long addr) | 438 | /* __flush_tlb_range() |
407 | { | 439 | * |
408 | unsigned long flags; | 440 | * returns 1 if all TLBs were flushed. |
409 | 441 | */ | |
410 | /* Note: purge_tlb_entries can be called at startup with | 442 | int __flush_tlb_range(unsigned long sid, unsigned long start, |
411 | no context. */ | 443 | unsigned long end) |
412 | |||
413 | purge_tlb_start(flags); | ||
414 | mtsp(mm->context, 1); | ||
415 | pdtlb(addr); | ||
416 | pitlb(addr); | ||
417 | purge_tlb_end(flags); | ||
418 | } | ||
419 | EXPORT_SYMBOL(purge_tlb_entries); | ||
420 | |||
421 | void __flush_tlb_range(unsigned long sid, unsigned long start, | ||
422 | unsigned long end) | ||
423 | { | 444 | { |
424 | unsigned long npages; | 445 | unsigned long flags, size; |
425 | 446 | ||
426 | npages = ((end - (start & PAGE_MASK)) + (PAGE_SIZE - 1)) >> PAGE_SHIFT; | 447 | size = (end - start); |
427 | if (npages >= 512) /* 2MB of space: arbitrary, should be tuned */ | 448 | if (size >= parisc_tlb_flush_threshold) { |
428 | flush_tlb_all(); | 449 | flush_tlb_all(); |
429 | else { | 450 | return 1; |
430 | unsigned long flags; | 451 | } |
431 | 452 | ||
453 | /* Purge TLB entries for small ranges using the pdtlb and | ||
454 | pitlb instructions. These instructions execute locally | ||
455 | but cause a purge request to be broadcast to other TLBs. */ | ||
456 | if (likely(!split_tlb)) { | ||
457 | while (start < end) { | ||
458 | purge_tlb_start(flags); | ||
459 | mtsp(sid, 1); | ||
460 | pdtlb(start); | ||
461 | purge_tlb_end(flags); | ||
462 | start += PAGE_SIZE; | ||
463 | } | ||
464 | return 0; | ||
465 | } | ||
466 | |||
467 | /* split TLB case */ | ||
468 | while (start < end) { | ||
432 | purge_tlb_start(flags); | 469 | purge_tlb_start(flags); |
433 | mtsp(sid, 1); | 470 | mtsp(sid, 1); |
434 | if (split_tlb) { | 471 | pdtlb(start); |
435 | while (npages--) { | 472 | pitlb(start); |
436 | pdtlb(start); | ||
437 | pitlb(start); | ||
438 | start += PAGE_SIZE; | ||
439 | } | ||
440 | } else { | ||
441 | while (npages--) { | ||
442 | pdtlb(start); | ||
443 | start += PAGE_SIZE; | ||
444 | } | ||
445 | } | ||
446 | purge_tlb_end(flags); | 473 | purge_tlb_end(flags); |
474 | start += PAGE_SIZE; | ||
447 | } | 475 | } |
476 | return 0; | ||
448 | } | 477 | } |
449 | 478 | ||
450 | static void cacheflush_h_tmp_function(void *dummy) | 479 | static void cacheflush_h_tmp_function(void *dummy) |
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S index 75819617f93b..c5ef4081b01d 100644 --- a/arch/parisc/kernel/entry.S +++ b/arch/parisc/kernel/entry.S | |||
@@ -45,7 +45,7 @@ | |||
45 | .level 2.0 | 45 | .level 2.0 |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | .import pa_dbit_lock,data | 48 | .import pa_tlb_lock,data |
49 | 49 | ||
50 | /* space_to_prot macro creates a prot id from a space id */ | 50 | /* space_to_prot macro creates a prot id from a space id */ |
51 | 51 | ||
@@ -420,8 +420,8 @@ | |||
420 | SHLREG %r9,PxD_VALUE_SHIFT,\pmd | 420 | SHLREG %r9,PxD_VALUE_SHIFT,\pmd |
421 | extru \va,31-PAGE_SHIFT,ASM_BITS_PER_PTE,\index | 421 | extru \va,31-PAGE_SHIFT,ASM_BITS_PER_PTE,\index |
422 | dep %r0,31,PAGE_SHIFT,\pmd /* clear offset */ | 422 | dep %r0,31,PAGE_SHIFT,\pmd /* clear offset */ |
423 | shladd \index,BITS_PER_PTE_ENTRY,\pmd,\pmd | 423 | shladd \index,BITS_PER_PTE_ENTRY,\pmd,\pmd /* pmd is now pte */ |
424 | LDREG %r0(\pmd),\pte /* pmd is now pte */ | 424 | LDREG %r0(\pmd),\pte |
425 | bb,>=,n \pte,_PAGE_PRESENT_BIT,\fault | 425 | bb,>=,n \pte,_PAGE_PRESENT_BIT,\fault |
426 | .endm | 426 | .endm |
427 | 427 | ||
@@ -453,57 +453,53 @@ | |||
453 | L2_ptep \pgd,\pte,\index,\va,\fault | 453 | L2_ptep \pgd,\pte,\index,\va,\fault |
454 | .endm | 454 | .endm |
455 | 455 | ||
456 | /* Acquire pa_dbit_lock lock. */ | 456 | /* Acquire pa_tlb_lock lock and recheck page is still present. */ |
457 | .macro dbit_lock spc,tmp,tmp1 | 457 | .macro tlb_lock spc,ptp,pte,tmp,tmp1,fault |
458 | #ifdef CONFIG_SMP | 458 | #ifdef CONFIG_SMP |
459 | cmpib,COND(=),n 0,\spc,2f | 459 | cmpib,COND(=),n 0,\spc,2f |
460 | load32 PA(pa_dbit_lock),\tmp | 460 | load32 PA(pa_tlb_lock),\tmp |
461 | 1: LDCW 0(\tmp),\tmp1 | 461 | 1: LDCW 0(\tmp),\tmp1 |
462 | cmpib,COND(=) 0,\tmp1,1b | 462 | cmpib,COND(=) 0,\tmp1,1b |
463 | nop | 463 | nop |
464 | LDREG 0(\ptp),\pte | ||
465 | bb,<,n \pte,_PAGE_PRESENT_BIT,2f | ||
466 | b \fault | ||
467 | stw \spc,0(\tmp) | ||
464 | 2: | 468 | 2: |
465 | #endif | 469 | #endif |
466 | .endm | 470 | .endm |
467 | 471 | ||
468 | /* Release pa_dbit_lock lock without reloading lock address. */ | 472 | /* Release pa_tlb_lock lock without reloading lock address. */ |
469 | .macro dbit_unlock0 spc,tmp | 473 | .macro tlb_unlock0 spc,tmp |
470 | #ifdef CONFIG_SMP | 474 | #ifdef CONFIG_SMP |
471 | or,COND(=) %r0,\spc,%r0 | 475 | or,COND(=) %r0,\spc,%r0 |
472 | stw \spc,0(\tmp) | 476 | stw \spc,0(\tmp) |
473 | #endif | 477 | #endif |
474 | .endm | 478 | .endm |
475 | 479 | ||
476 | /* Release pa_dbit_lock lock. */ | 480 | /* Release pa_tlb_lock lock. */ |
477 | .macro dbit_unlock1 spc,tmp | 481 | .macro tlb_unlock1 spc,tmp |
478 | #ifdef CONFIG_SMP | 482 | #ifdef CONFIG_SMP |
479 | load32 PA(pa_dbit_lock),\tmp | 483 | load32 PA(pa_tlb_lock),\tmp |
480 | dbit_unlock0 \spc,\tmp | 484 | tlb_unlock0 \spc,\tmp |
481 | #endif | 485 | #endif |
482 | .endm | 486 | .endm |
483 | 487 | ||
484 | /* Set the _PAGE_ACCESSED bit of the PTE. Be clever and | 488 | /* Set the _PAGE_ACCESSED bit of the PTE. Be clever and |
485 | * don't needlessly dirty the cache line if it was already set */ | 489 | * don't needlessly dirty the cache line if it was already set */ |
486 | .macro update_ptep spc,ptep,pte,tmp,tmp1 | 490 | .macro update_accessed ptp,pte,tmp,tmp1 |
487 | #ifdef CONFIG_SMP | ||
488 | or,COND(=) %r0,\spc,%r0 | ||
489 | LDREG 0(\ptep),\pte | ||
490 | #endif | ||
491 | ldi _PAGE_ACCESSED,\tmp1 | 491 | ldi _PAGE_ACCESSED,\tmp1 |
492 | or \tmp1,\pte,\tmp | 492 | or \tmp1,\pte,\tmp |
493 | and,COND(<>) \tmp1,\pte,%r0 | 493 | and,COND(<>) \tmp1,\pte,%r0 |
494 | STREG \tmp,0(\ptep) | 494 | STREG \tmp,0(\ptp) |
495 | .endm | 495 | .endm |
496 | 496 | ||
497 | /* Set the dirty bit (and accessed bit). No need to be | 497 | /* Set the dirty bit (and accessed bit). No need to be |
498 | * clever, this is only used from the dirty fault */ | 498 | * clever, this is only used from the dirty fault */ |
499 | .macro update_dirty spc,ptep,pte,tmp | 499 | .macro update_dirty ptp,pte,tmp |
500 | #ifdef CONFIG_SMP | ||
501 | or,COND(=) %r0,\spc,%r0 | ||
502 | LDREG 0(\ptep),\pte | ||
503 | #endif | ||
504 | ldi _PAGE_ACCESSED|_PAGE_DIRTY,\tmp | 500 | ldi _PAGE_ACCESSED|_PAGE_DIRTY,\tmp |
505 | or \tmp,\pte,\pte | 501 | or \tmp,\pte,\pte |
506 | STREG \pte,0(\ptep) | 502 | STREG \pte,0(\ptp) |
507 | .endm | 503 | .endm |
508 | 504 | ||
509 | /* bitshift difference between a PFN (based on kernel's PAGE_SIZE) | 505 | /* bitshift difference between a PFN (based on kernel's PAGE_SIZE) |
@@ -1148,14 +1144,14 @@ dtlb_miss_20w: | |||
1148 | 1144 | ||
1149 | L3_ptep ptp,pte,t0,va,dtlb_check_alias_20w | 1145 | L3_ptep ptp,pte,t0,va,dtlb_check_alias_20w |
1150 | 1146 | ||
1151 | dbit_lock spc,t0,t1 | 1147 | tlb_lock spc,ptp,pte,t0,t1,dtlb_check_alias_20w |
1152 | update_ptep spc,ptp,pte,t0,t1 | 1148 | update_accessed ptp,pte,t0,t1 |
1153 | 1149 | ||
1154 | make_insert_tlb spc,pte,prot | 1150 | make_insert_tlb spc,pte,prot |
1155 | 1151 | ||
1156 | idtlbt pte,prot | 1152 | idtlbt pte,prot |
1157 | dbit_unlock1 spc,t0 | ||
1158 | 1153 | ||
1154 | tlb_unlock1 spc,t0 | ||
1159 | rfir | 1155 | rfir |
1160 | nop | 1156 | nop |
1161 | 1157 | ||
@@ -1174,14 +1170,14 @@ nadtlb_miss_20w: | |||
1174 | 1170 | ||
1175 | L3_ptep ptp,pte,t0,va,nadtlb_check_alias_20w | 1171 | L3_ptep ptp,pte,t0,va,nadtlb_check_alias_20w |
1176 | 1172 | ||
1177 | dbit_lock spc,t0,t1 | 1173 | tlb_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_20w |
1178 | update_ptep spc,ptp,pte,t0,t1 | 1174 | update_accessed ptp,pte,t0,t1 |
1179 | 1175 | ||
1180 | make_insert_tlb spc,pte,prot | 1176 | make_insert_tlb spc,pte,prot |
1181 | 1177 | ||
1182 | idtlbt pte,prot | 1178 | idtlbt pte,prot |
1183 | dbit_unlock1 spc,t0 | ||
1184 | 1179 | ||
1180 | tlb_unlock1 spc,t0 | ||
1185 | rfir | 1181 | rfir |
1186 | nop | 1182 | nop |
1187 | 1183 | ||
@@ -1202,20 +1198,20 @@ dtlb_miss_11: | |||
1202 | 1198 | ||
1203 | L2_ptep ptp,pte,t0,va,dtlb_check_alias_11 | 1199 | L2_ptep ptp,pte,t0,va,dtlb_check_alias_11 |
1204 | 1200 | ||
1205 | dbit_lock spc,t0,t1 | 1201 | tlb_lock spc,ptp,pte,t0,t1,dtlb_check_alias_11 |
1206 | update_ptep spc,ptp,pte,t0,t1 | 1202 | update_accessed ptp,pte,t0,t1 |
1207 | 1203 | ||
1208 | make_insert_tlb_11 spc,pte,prot | 1204 | make_insert_tlb_11 spc,pte,prot |
1209 | 1205 | ||
1210 | mfsp %sr1,t0 /* Save sr1 so we can use it in tlb inserts */ | 1206 | mfsp %sr1,t1 /* Save sr1 so we can use it in tlb inserts */ |
1211 | mtsp spc,%sr1 | 1207 | mtsp spc,%sr1 |
1212 | 1208 | ||
1213 | idtlba pte,(%sr1,va) | 1209 | idtlba pte,(%sr1,va) |
1214 | idtlbp prot,(%sr1,va) | 1210 | idtlbp prot,(%sr1,va) |
1215 | 1211 | ||
1216 | mtsp t0, %sr1 /* Restore sr1 */ | 1212 | mtsp t1, %sr1 /* Restore sr1 */ |
1217 | dbit_unlock1 spc,t0 | ||
1218 | 1213 | ||
1214 | tlb_unlock1 spc,t0 | ||
1219 | rfir | 1215 | rfir |
1220 | nop | 1216 | nop |
1221 | 1217 | ||
@@ -1235,21 +1231,20 @@ nadtlb_miss_11: | |||
1235 | 1231 | ||
1236 | L2_ptep ptp,pte,t0,va,nadtlb_check_alias_11 | 1232 | L2_ptep ptp,pte,t0,va,nadtlb_check_alias_11 |
1237 | 1233 | ||
1238 | dbit_lock spc,t0,t1 | 1234 | tlb_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_11 |
1239 | update_ptep spc,ptp,pte,t0,t1 | 1235 | update_accessed ptp,pte,t0,t1 |
1240 | 1236 | ||
1241 | make_insert_tlb_11 spc,pte,prot | 1237 | make_insert_tlb_11 spc,pte,prot |
1242 | 1238 | ||
1243 | 1239 | mfsp %sr1,t1 /* Save sr1 so we can use it in tlb inserts */ | |
1244 | mfsp %sr1,t0 /* Save sr1 so we can use it in tlb inserts */ | ||
1245 | mtsp spc,%sr1 | 1240 | mtsp spc,%sr1 |
1246 | 1241 | ||
1247 | idtlba pte,(%sr1,va) | 1242 | idtlba pte,(%sr1,va) |
1248 | idtlbp prot,(%sr1,va) | 1243 | idtlbp prot,(%sr1,va) |
1249 | 1244 | ||
1250 | mtsp t0, %sr1 /* Restore sr1 */ | 1245 | mtsp t1, %sr1 /* Restore sr1 */ |
1251 | dbit_unlock1 spc,t0 | ||
1252 | 1246 | ||
1247 | tlb_unlock1 spc,t0 | ||
1253 | rfir | 1248 | rfir |
1254 | nop | 1249 | nop |
1255 | 1250 | ||
@@ -1269,16 +1264,16 @@ dtlb_miss_20: | |||
1269 | 1264 | ||
1270 | L2_ptep ptp,pte,t0,va,dtlb_check_alias_20 | 1265 | L2_ptep ptp,pte,t0,va,dtlb_check_alias_20 |
1271 | 1266 | ||
1272 | dbit_lock spc,t0,t1 | 1267 | tlb_lock spc,ptp,pte,t0,t1,dtlb_check_alias_20 |
1273 | update_ptep spc,ptp,pte,t0,t1 | 1268 | update_accessed ptp,pte,t0,t1 |
1274 | 1269 | ||
1275 | make_insert_tlb spc,pte,prot | 1270 | make_insert_tlb spc,pte,prot |
1276 | 1271 | ||
1277 | f_extend pte,t0 | 1272 | f_extend pte,t1 |
1278 | 1273 | ||
1279 | idtlbt pte,prot | 1274 | idtlbt pte,prot |
1280 | dbit_unlock1 spc,t0 | ||
1281 | 1275 | ||
1276 | tlb_unlock1 spc,t0 | ||
1282 | rfir | 1277 | rfir |
1283 | nop | 1278 | nop |
1284 | 1279 | ||
@@ -1297,16 +1292,16 @@ nadtlb_miss_20: | |||
1297 | 1292 | ||
1298 | L2_ptep ptp,pte,t0,va,nadtlb_check_alias_20 | 1293 | L2_ptep ptp,pte,t0,va,nadtlb_check_alias_20 |
1299 | 1294 | ||
1300 | dbit_lock spc,t0,t1 | 1295 | tlb_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_20 |
1301 | update_ptep spc,ptp,pte,t0,t1 | 1296 | update_accessed ptp,pte,t0,t1 |
1302 | 1297 | ||
1303 | make_insert_tlb spc,pte,prot | 1298 | make_insert_tlb spc,pte,prot |
1304 | 1299 | ||
1305 | f_extend pte,t0 | 1300 | f_extend pte,t1 |
1306 | 1301 | ||
1307 | idtlbt pte,prot | 1302 | idtlbt pte,prot |
1308 | dbit_unlock1 spc,t0 | ||
1309 | 1303 | ||
1304 | tlb_unlock1 spc,t0 | ||
1310 | rfir | 1305 | rfir |
1311 | nop | 1306 | nop |
1312 | 1307 | ||
@@ -1406,14 +1401,14 @@ itlb_miss_20w: | |||
1406 | 1401 | ||
1407 | L3_ptep ptp,pte,t0,va,itlb_fault | 1402 | L3_ptep ptp,pte,t0,va,itlb_fault |
1408 | 1403 | ||
1409 | dbit_lock spc,t0,t1 | 1404 | tlb_lock spc,ptp,pte,t0,t1,itlb_fault |
1410 | update_ptep spc,ptp,pte,t0,t1 | 1405 | update_accessed ptp,pte,t0,t1 |
1411 | 1406 | ||
1412 | make_insert_tlb spc,pte,prot | 1407 | make_insert_tlb spc,pte,prot |
1413 | 1408 | ||
1414 | iitlbt pte,prot | 1409 | iitlbt pte,prot |
1415 | dbit_unlock1 spc,t0 | ||
1416 | 1410 | ||
1411 | tlb_unlock1 spc,t0 | ||
1417 | rfir | 1412 | rfir |
1418 | nop | 1413 | nop |
1419 | 1414 | ||
@@ -1430,14 +1425,14 @@ naitlb_miss_20w: | |||
1430 | 1425 | ||
1431 | L3_ptep ptp,pte,t0,va,naitlb_check_alias_20w | 1426 | L3_ptep ptp,pte,t0,va,naitlb_check_alias_20w |
1432 | 1427 | ||
1433 | dbit_lock spc,t0,t1 | 1428 | tlb_lock spc,ptp,pte,t0,t1,naitlb_check_alias_20w |
1434 | update_ptep spc,ptp,pte,t0,t1 | 1429 | update_accessed ptp,pte,t0,t1 |
1435 | 1430 | ||
1436 | make_insert_tlb spc,pte,prot | 1431 | make_insert_tlb spc,pte,prot |
1437 | 1432 | ||
1438 | iitlbt pte,prot | 1433 | iitlbt pte,prot |
1439 | dbit_unlock1 spc,t0 | ||
1440 | 1434 | ||
1435 | tlb_unlock1 spc,t0 | ||
1441 | rfir | 1436 | rfir |
1442 | nop | 1437 | nop |
1443 | 1438 | ||
@@ -1458,20 +1453,20 @@ itlb_miss_11: | |||
1458 | 1453 | ||
1459 | L2_ptep ptp,pte,t0,va,itlb_fault | 1454 | L2_ptep ptp,pte,t0,va,itlb_fault |
1460 | 1455 | ||
1461 | dbit_lock spc,t0,t1 | 1456 | tlb_lock spc,ptp,pte,t0,t1,itlb_fault |
1462 | update_ptep spc,ptp,pte,t0,t1 | 1457 | update_accessed ptp,pte,t0,t1 |
1463 | 1458 | ||
1464 | make_insert_tlb_11 spc,pte,prot | 1459 | make_insert_tlb_11 spc,pte,prot |
1465 | 1460 | ||
1466 | mfsp %sr1,t0 /* Save sr1 so we can use it in tlb inserts */ | 1461 | mfsp %sr1,t1 /* Save sr1 so we can use it in tlb inserts */ |
1467 | mtsp spc,%sr1 | 1462 | mtsp spc,%sr1 |
1468 | 1463 | ||
1469 | iitlba pte,(%sr1,va) | 1464 | iitlba pte,(%sr1,va) |
1470 | iitlbp prot,(%sr1,va) | 1465 | iitlbp prot,(%sr1,va) |
1471 | 1466 | ||
1472 | mtsp t0, %sr1 /* Restore sr1 */ | 1467 | mtsp t1, %sr1 /* Restore sr1 */ |
1473 | dbit_unlock1 spc,t0 | ||
1474 | 1468 | ||
1469 | tlb_unlock1 spc,t0 | ||
1475 | rfir | 1470 | rfir |
1476 | nop | 1471 | nop |
1477 | 1472 | ||
@@ -1482,20 +1477,20 @@ naitlb_miss_11: | |||
1482 | 1477 | ||
1483 | L2_ptep ptp,pte,t0,va,naitlb_check_alias_11 | 1478 | L2_ptep ptp,pte,t0,va,naitlb_check_alias_11 |
1484 | 1479 | ||
1485 | dbit_lock spc,t0,t1 | 1480 | tlb_lock spc,ptp,pte,t0,t1,naitlb_check_alias_11 |
1486 | update_ptep spc,ptp,pte,t0,t1 | 1481 | update_accessed ptp,pte,t0,t1 |
1487 | 1482 | ||
1488 | make_insert_tlb_11 spc,pte,prot | 1483 | make_insert_tlb_11 spc,pte,prot |
1489 | 1484 | ||
1490 | mfsp %sr1,t0 /* Save sr1 so we can use it in tlb inserts */ | 1485 | mfsp %sr1,t1 /* Save sr1 so we can use it in tlb inserts */ |
1491 | mtsp spc,%sr1 | 1486 | mtsp spc,%sr1 |
1492 | 1487 | ||
1493 | iitlba pte,(%sr1,va) | 1488 | iitlba pte,(%sr1,va) |
1494 | iitlbp prot,(%sr1,va) | 1489 | iitlbp prot,(%sr1,va) |
1495 | 1490 | ||
1496 | mtsp t0, %sr1 /* Restore sr1 */ | 1491 | mtsp t1, %sr1 /* Restore sr1 */ |
1497 | dbit_unlock1 spc,t0 | ||
1498 | 1492 | ||
1493 | tlb_unlock1 spc,t0 | ||
1499 | rfir | 1494 | rfir |
1500 | nop | 1495 | nop |
1501 | 1496 | ||
@@ -1516,16 +1511,16 @@ itlb_miss_20: | |||
1516 | 1511 | ||
1517 | L2_ptep ptp,pte,t0,va,itlb_fault | 1512 | L2_ptep ptp,pte,t0,va,itlb_fault |
1518 | 1513 | ||
1519 | dbit_lock spc,t0,t1 | 1514 | tlb_lock spc,ptp,pte,t0,t1,itlb_fault |
1520 | update_ptep spc,ptp,pte,t0,t1 | 1515 | update_accessed ptp,pte,t0,t1 |
1521 | 1516 | ||
1522 | make_insert_tlb spc,pte,prot | 1517 | make_insert_tlb spc,pte,prot |
1523 | 1518 | ||
1524 | f_extend pte,t0 | 1519 | f_extend pte,t1 |
1525 | 1520 | ||
1526 | iitlbt pte,prot | 1521 | iitlbt pte,prot |
1527 | dbit_unlock1 spc,t0 | ||
1528 | 1522 | ||
1523 | tlb_unlock1 spc,t0 | ||
1529 | rfir | 1524 | rfir |
1530 | nop | 1525 | nop |
1531 | 1526 | ||
@@ -1536,16 +1531,16 @@ naitlb_miss_20: | |||
1536 | 1531 | ||
1537 | L2_ptep ptp,pte,t0,va,naitlb_check_alias_20 | 1532 | L2_ptep ptp,pte,t0,va,naitlb_check_alias_20 |
1538 | 1533 | ||
1539 | dbit_lock spc,t0,t1 | 1534 | tlb_lock spc,ptp,pte,t0,t1,naitlb_check_alias_20 |
1540 | update_ptep spc,ptp,pte,t0,t1 | 1535 | update_accessed ptp,pte,t0,t1 |
1541 | 1536 | ||
1542 | make_insert_tlb spc,pte,prot | 1537 | make_insert_tlb spc,pte,prot |
1543 | 1538 | ||
1544 | f_extend pte,t0 | 1539 | f_extend pte,t1 |
1545 | 1540 | ||
1546 | iitlbt pte,prot | 1541 | iitlbt pte,prot |
1547 | dbit_unlock1 spc,t0 | ||
1548 | 1542 | ||
1543 | tlb_unlock1 spc,t0 | ||
1549 | rfir | 1544 | rfir |
1550 | nop | 1545 | nop |
1551 | 1546 | ||
@@ -1568,14 +1563,14 @@ dbit_trap_20w: | |||
1568 | 1563 | ||
1569 | L3_ptep ptp,pte,t0,va,dbit_fault | 1564 | L3_ptep ptp,pte,t0,va,dbit_fault |
1570 | 1565 | ||
1571 | dbit_lock spc,t0,t1 | 1566 | tlb_lock spc,ptp,pte,t0,t1,dbit_fault |
1572 | update_dirty spc,ptp,pte,t1 | 1567 | update_dirty ptp,pte,t1 |
1573 | 1568 | ||
1574 | make_insert_tlb spc,pte,prot | 1569 | make_insert_tlb spc,pte,prot |
1575 | 1570 | ||
1576 | idtlbt pte,prot | 1571 | idtlbt pte,prot |
1577 | dbit_unlock0 spc,t0 | ||
1578 | 1572 | ||
1573 | tlb_unlock0 spc,t0 | ||
1579 | rfir | 1574 | rfir |
1580 | nop | 1575 | nop |
1581 | #else | 1576 | #else |
@@ -1588,8 +1583,8 @@ dbit_trap_11: | |||
1588 | 1583 | ||
1589 | L2_ptep ptp,pte,t0,va,dbit_fault | 1584 | L2_ptep ptp,pte,t0,va,dbit_fault |
1590 | 1585 | ||
1591 | dbit_lock spc,t0,t1 | 1586 | tlb_lock spc,ptp,pte,t0,t1,dbit_fault |
1592 | update_dirty spc,ptp,pte,t1 | 1587 | update_dirty ptp,pte,t1 |
1593 | 1588 | ||
1594 | make_insert_tlb_11 spc,pte,prot | 1589 | make_insert_tlb_11 spc,pte,prot |
1595 | 1590 | ||
@@ -1600,8 +1595,8 @@ dbit_trap_11: | |||
1600 | idtlbp prot,(%sr1,va) | 1595 | idtlbp prot,(%sr1,va) |
1601 | 1596 | ||
1602 | mtsp t1, %sr1 /* Restore sr1 */ | 1597 | mtsp t1, %sr1 /* Restore sr1 */ |
1603 | dbit_unlock0 spc,t0 | ||
1604 | 1598 | ||
1599 | tlb_unlock0 spc,t0 | ||
1605 | rfir | 1600 | rfir |
1606 | nop | 1601 | nop |
1607 | 1602 | ||
@@ -1612,16 +1607,16 @@ dbit_trap_20: | |||
1612 | 1607 | ||
1613 | L2_ptep ptp,pte,t0,va,dbit_fault | 1608 | L2_ptep ptp,pte,t0,va,dbit_fault |
1614 | 1609 | ||
1615 | dbit_lock spc,t0,t1 | 1610 | tlb_lock spc,ptp,pte,t0,t1,dbit_fault |
1616 | update_dirty spc,ptp,pte,t1 | 1611 | update_dirty ptp,pte,t1 |
1617 | 1612 | ||
1618 | make_insert_tlb spc,pte,prot | 1613 | make_insert_tlb spc,pte,prot |
1619 | 1614 | ||
1620 | f_extend pte,t1 | 1615 | f_extend pte,t1 |
1621 | 1616 | ||
1622 | idtlbt pte,prot | 1617 | idtlbt pte,prot |
1623 | dbit_unlock0 spc,t0 | ||
1624 | 1618 | ||
1619 | tlb_unlock0 spc,t0 | ||
1625 | rfir | 1620 | rfir |
1626 | nop | 1621 | nop |
1627 | #endif | 1622 | #endif |
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c index 6548fd1d2e62..b99b39f1da02 100644 --- a/arch/parisc/kernel/traps.c +++ b/arch/parisc/kernel/traps.c | |||
@@ -43,10 +43,6 @@ | |||
43 | 43 | ||
44 | #include "../math-emu/math-emu.h" /* for handle_fpe() */ | 44 | #include "../math-emu/math-emu.h" /* for handle_fpe() */ |
45 | 45 | ||
46 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
47 | DEFINE_SPINLOCK(pa_dbit_lock); | ||
48 | #endif | ||
49 | |||
50 | static void parisc_show_stack(struct task_struct *task, unsigned long *sp, | 46 | static void parisc_show_stack(struct task_struct *task, unsigned long *sp, |
51 | struct pt_regs *regs); | 47 | struct pt_regs *regs); |
52 | 48 | ||
diff --git a/arch/powerpc/kernel/idle_power7.S b/arch/powerpc/kernel/idle_power7.S index ccde8f084ce4..112ccf497562 100644 --- a/arch/powerpc/kernel/idle_power7.S +++ b/arch/powerpc/kernel/idle_power7.S | |||
@@ -52,6 +52,22 @@ | |||
52 | .text | 52 | .text |
53 | 53 | ||
54 | /* | 54 | /* |
55 | * Used by threads when the lock bit of core_idle_state is set. | ||
56 | * Threads will spin in HMT_LOW until the lock bit is cleared. | ||
57 | * r14 - pointer to core_idle_state | ||
58 | * r15 - used to load contents of core_idle_state | ||
59 | */ | ||
60 | |||
61 | core_idle_lock_held: | ||
62 | HMT_LOW | ||
63 | 3: lwz r15,0(r14) | ||
64 | andi. r15,r15,PNV_CORE_IDLE_LOCK_BIT | ||
65 | bne 3b | ||
66 | HMT_MEDIUM | ||
67 | lwarx r15,0,r14 | ||
68 | blr | ||
69 | |||
70 | /* | ||
55 | * Pass requested state in r3: | 71 | * Pass requested state in r3: |
56 | * r3 - PNV_THREAD_NAP/SLEEP/WINKLE | 72 | * r3 - PNV_THREAD_NAP/SLEEP/WINKLE |
57 | * | 73 | * |
@@ -150,6 +166,10 @@ power7_enter_nap_mode: | |||
150 | ld r14,PACA_CORE_IDLE_STATE_PTR(r13) | 166 | ld r14,PACA_CORE_IDLE_STATE_PTR(r13) |
151 | lwarx_loop1: | 167 | lwarx_loop1: |
152 | lwarx r15,0,r14 | 168 | lwarx r15,0,r14 |
169 | |||
170 | andi. r9,r15,PNV_CORE_IDLE_LOCK_BIT | ||
171 | bnel core_idle_lock_held | ||
172 | |||
153 | andc r15,r15,r7 /* Clear thread bit */ | 173 | andc r15,r15,r7 /* Clear thread bit */ |
154 | 174 | ||
155 | andi. r15,r15,PNV_CORE_IDLE_THREAD_BITS | 175 | andi. r15,r15,PNV_CORE_IDLE_THREAD_BITS |
@@ -294,7 +314,7 @@ lwarx_loop2: | |||
294 | * workaround undo code or resyncing timebase or restoring context | 314 | * workaround undo code or resyncing timebase or restoring context |
295 | * In either case loop until the lock bit is cleared. | 315 | * In either case loop until the lock bit is cleared. |
296 | */ | 316 | */ |
297 | bne core_idle_lock_held | 317 | bnel core_idle_lock_held |
298 | 318 | ||
299 | cmpwi cr2,r15,0 | 319 | cmpwi cr2,r15,0 |
300 | lbz r4,PACA_SUBCORE_SIBLING_MASK(r13) | 320 | lbz r4,PACA_SUBCORE_SIBLING_MASK(r13) |
@@ -319,15 +339,6 @@ lwarx_loop2: | |||
319 | isync | 339 | isync |
320 | b common_exit | 340 | b common_exit |
321 | 341 | ||
322 | core_idle_lock_held: | ||
323 | HMT_LOW | ||
324 | core_idle_lock_loop: | ||
325 | lwz r15,0(14) | ||
326 | andi. r9,r15,PNV_CORE_IDLE_LOCK_BIT | ||
327 | bne core_idle_lock_loop | ||
328 | HMT_MEDIUM | ||
329 | b lwarx_loop2 | ||
330 | |||
331 | first_thread_in_subcore: | 342 | first_thread_in_subcore: |
332 | /* First thread in subcore to wakeup */ | 343 | /* First thread in subcore to wakeup */ |
333 | ori r15,r15,PNV_CORE_IDLE_LOCK_BIT | 344 | ori r15,r15,PNV_CORE_IDLE_LOCK_BIT |
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index 6530f1b8874d..37de90f8a845 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c | |||
@@ -297,6 +297,8 @@ long machine_check_early(struct pt_regs *regs) | |||
297 | 297 | ||
298 | __this_cpu_inc(irq_stat.mce_exceptions); | 298 | __this_cpu_inc(irq_stat.mce_exceptions); |
299 | 299 | ||
300 | add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE); | ||
301 | |||
300 | if (cur_cpu_spec && cur_cpu_spec->machine_check_early) | 302 | if (cur_cpu_spec && cur_cpu_spec->machine_check_early) |
301 | handled = cur_cpu_spec->machine_check_early(regs); | 303 | handled = cur_cpu_spec->machine_check_early(regs); |
302 | return handled; | 304 | return handled; |
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index 6d535973b200..a67c6d781c52 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c | |||
@@ -529,6 +529,10 @@ void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig) | |||
529 | printk(KERN_ALERT "Unable to handle kernel paging request for " | 529 | printk(KERN_ALERT "Unable to handle kernel paging request for " |
530 | "instruction fetch\n"); | 530 | "instruction fetch\n"); |
531 | break; | 531 | break; |
532 | case 0x600: | ||
533 | printk(KERN_ALERT "Unable to handle kernel paging request for " | ||
534 | "unaligned access at address 0x%08lx\n", regs->dar); | ||
535 | break; | ||
532 | default: | 536 | default: |
533 | printk(KERN_ALERT "Unable to handle kernel paging request for " | 537 | printk(KERN_ALERT "Unable to handle kernel paging request for " |
534 | "unknown fault\n"); | 538 | "unknown fault\n"); |
diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index ec2eb20631d1..df956295c2a7 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c | |||
@@ -320,6 +320,8 @@ static struct attribute *device_str_attr_create_(char *name, char *str) | |||
320 | if (!attr) | 320 | if (!attr) |
321 | return NULL; | 321 | return NULL; |
322 | 322 | ||
323 | sysfs_attr_init(&attr->attr.attr); | ||
324 | |||
323 | attr->var = str; | 325 | attr->var = str; |
324 | attr->attr.attr.name = name; | 326 | attr->attr.attr.name = name; |
325 | attr->attr.attr.mode = 0444; | 327 | attr->attr.attr.mode = 0444; |
diff --git a/arch/powerpc/platforms/powernv/opal-elog.c b/arch/powerpc/platforms/powernv/opal-elog.c index 4949ef0d9400..37f959bf392e 100644 --- a/arch/powerpc/platforms/powernv/opal-elog.c +++ b/arch/powerpc/platforms/powernv/opal-elog.c | |||
@@ -237,7 +237,7 @@ static struct elog_obj *create_elog_obj(uint64_t id, size_t size, uint64_t type) | |||
237 | return elog; | 237 | return elog; |
238 | } | 238 | } |
239 | 239 | ||
240 | static void elog_work_fn(struct work_struct *work) | 240 | static irqreturn_t elog_event(int irq, void *data) |
241 | { | 241 | { |
242 | __be64 size; | 242 | __be64 size; |
243 | __be64 id; | 243 | __be64 id; |
@@ -251,7 +251,7 @@ static void elog_work_fn(struct work_struct *work) | |||
251 | rc = opal_get_elog_size(&id, &size, &type); | 251 | rc = opal_get_elog_size(&id, &size, &type); |
252 | if (rc != OPAL_SUCCESS) { | 252 | if (rc != OPAL_SUCCESS) { |
253 | pr_err("ELOG: OPAL log info read failed\n"); | 253 | pr_err("ELOG: OPAL log info read failed\n"); |
254 | return; | 254 | return IRQ_HANDLED; |
255 | } | 255 | } |
256 | 256 | ||
257 | elog_size = be64_to_cpu(size); | 257 | elog_size = be64_to_cpu(size); |
@@ -270,16 +270,10 @@ static void elog_work_fn(struct work_struct *work) | |||
270 | * entries. | 270 | * entries. |
271 | */ | 271 | */ |
272 | if (kset_find_obj(elog_kset, name)) | 272 | if (kset_find_obj(elog_kset, name)) |
273 | return; | 273 | return IRQ_HANDLED; |
274 | 274 | ||
275 | create_elog_obj(log_id, elog_size, elog_type); | 275 | create_elog_obj(log_id, elog_size, elog_type); |
276 | } | ||
277 | |||
278 | static DECLARE_WORK(elog_work, elog_work_fn); | ||
279 | 276 | ||
280 | static irqreturn_t elog_event(int irq, void *data) | ||
281 | { | ||
282 | schedule_work(&elog_work); | ||
283 | return IRQ_HANDLED; | 277 | return IRQ_HANDLED; |
284 | } | 278 | } |
285 | 279 | ||
@@ -304,8 +298,8 @@ int __init opal_elog_init(void) | |||
304 | return irq; | 298 | return irq; |
305 | } | 299 | } |
306 | 300 | ||
307 | rc = request_irq(irq, elog_event, | 301 | rc = request_threaded_irq(irq, NULL, elog_event, |
308 | IRQ_TYPE_LEVEL_HIGH, "opal-elog", NULL); | 302 | IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "opal-elog", NULL); |
309 | if (rc) { | 303 | if (rc) { |
310 | pr_err("%s: Can't request OPAL event irq (%d)\n", | 304 | pr_err("%s: Can't request OPAL event irq (%d)\n", |
311 | __func__, rc); | 305 | __func__, rc); |
diff --git a/arch/powerpc/platforms/powernv/opal-prd.c b/arch/powerpc/platforms/powernv/opal-prd.c index 46cb3feb0a13..4ece8e40dd54 100644 --- a/arch/powerpc/platforms/powernv/opal-prd.c +++ b/arch/powerpc/platforms/powernv/opal-prd.c | |||
@@ -112,6 +112,7 @@ static int opal_prd_open(struct inode *inode, struct file *file) | |||
112 | static int opal_prd_mmap(struct file *file, struct vm_area_struct *vma) | 112 | static int opal_prd_mmap(struct file *file, struct vm_area_struct *vma) |
113 | { | 113 | { |
114 | size_t addr, size; | 114 | size_t addr, size; |
115 | pgprot_t page_prot; | ||
115 | int rc; | 116 | int rc; |
116 | 117 | ||
117 | pr_devel("opal_prd_mmap(0x%016lx, 0x%016lx, 0x%lx, 0x%lx)\n", | 118 | pr_devel("opal_prd_mmap(0x%016lx, 0x%016lx, 0x%lx, 0x%lx)\n", |
@@ -125,13 +126,11 @@ static int opal_prd_mmap(struct file *file, struct vm_area_struct *vma) | |||
125 | if (!opal_prd_range_is_valid(addr, size)) | 126 | if (!opal_prd_range_is_valid(addr, size)) |
126 | return -EINVAL; | 127 | return -EINVAL; |
127 | 128 | ||
128 | vma->vm_page_prot = __pgprot(pgprot_val(phys_mem_access_prot(file, | 129 | page_prot = phys_mem_access_prot(file, vma->vm_pgoff, |
129 | vma->vm_pgoff, | 130 | size, vma->vm_page_prot); |
130 | size, vma->vm_page_prot)) | ||
131 | | _PAGE_SPECIAL); | ||
132 | 131 | ||
133 | rc = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, size, | 132 | rc = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, size, |
134 | vma->vm_page_prot); | 133 | page_prot); |
135 | 134 | ||
136 | return rc; | 135 | return rc; |
137 | } | 136 | } |
diff --git a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c index 0d88ba242754..af3c144b92c1 100644 --- a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c +++ b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include <linux/semaphore.h> | 19 | #include <linux/semaphore.h> |
20 | #include <asm/msi_bitmap.h> | 20 | #include <asm/msi_bitmap.h> |
21 | #include <asm/ppc-pci.h> | ||
21 | 22 | ||
22 | struct ppc4xx_hsta_msi { | 23 | struct ppc4xx_hsta_msi { |
23 | struct device *dev; | 24 | struct device *dev; |
diff --git a/arch/s390/include/asm/Kbuild b/arch/s390/include/asm/Kbuild index dc5385ebb071..5ad26dd94d77 100644 --- a/arch/s390/include/asm/Kbuild +++ b/arch/s390/include/asm/Kbuild | |||
@@ -3,5 +3,6 @@ | |||
3 | generic-y += clkdev.h | 3 | generic-y += clkdev.h |
4 | generic-y += irq_work.h | 4 | generic-y += irq_work.h |
5 | generic-y += mcs_spinlock.h | 5 | generic-y += mcs_spinlock.h |
6 | generic-y += mm-arch-hooks.h | ||
6 | generic-y += preempt.h | 7 | generic-y += preempt.h |
7 | generic-y += trace_clock.h | 8 | generic-y += trace_clock.h |
diff --git a/arch/s390/include/asm/ctl_reg.h b/arch/s390/include/asm/ctl_reg.h index cfad7fca01d6..d7697ab802f6 100644 --- a/arch/s390/include/asm/ctl_reg.h +++ b/arch/s390/include/asm/ctl_reg.h | |||
@@ -57,7 +57,10 @@ union ctlreg0 { | |||
57 | unsigned long lap : 1; /* Low-address-protection control */ | 57 | unsigned long lap : 1; /* Low-address-protection control */ |
58 | unsigned long : 4; | 58 | unsigned long : 4; |
59 | unsigned long edat : 1; /* Enhanced-DAT-enablement control */ | 59 | unsigned long edat : 1; /* Enhanced-DAT-enablement control */ |
60 | unsigned long : 23; | 60 | unsigned long : 4; |
61 | unsigned long afp : 1; /* AFP-register control */ | ||
62 | unsigned long vx : 1; /* Vector enablement control */ | ||
63 | unsigned long : 17; | ||
61 | }; | 64 | }; |
62 | }; | 65 | }; |
63 | 66 | ||
diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h index 0130d0379edd..d9be7c0c1291 100644 --- a/arch/s390/include/asm/hugetlb.h +++ b/arch/s390/include/asm/hugetlb.h | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #define is_hugepage_only_range(mm, addr, len) 0 | 15 | #define is_hugepage_only_range(mm, addr, len) 0 |
16 | #define hugetlb_free_pgd_range free_pgd_range | 16 | #define hugetlb_free_pgd_range free_pgd_range |
17 | #define hugepages_supported() (MACHINE_HAS_HPAGE) | ||
17 | 18 | ||
18 | void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | 19 | void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, |
19 | pte_t *ptep, pte_t pte); | 20 | pte_t *ptep, pte_t pte); |
diff --git a/arch/s390/include/asm/mm-arch-hooks.h b/arch/s390/include/asm/mm-arch-hooks.h deleted file mode 100644 index 07680b2f3c59..000000000000 --- a/arch/s390/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_S390_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_S390_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_S390_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h index dd345238d9a7..53eacbd4f09b 100644 --- a/arch/s390/include/asm/page.h +++ b/arch/s390/include/asm/page.h | |||
@@ -17,10 +17,7 @@ | |||
17 | #define PAGE_DEFAULT_ACC 0 | 17 | #define PAGE_DEFAULT_ACC 0 |
18 | #define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4) | 18 | #define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4) |
19 | 19 | ||
20 | #include <asm/setup.h> | 20 | #define HPAGE_SHIFT 20 |
21 | #ifndef __ASSEMBLY__ | ||
22 | |||
23 | extern int HPAGE_SHIFT; | ||
24 | #define HPAGE_SIZE (1UL << HPAGE_SHIFT) | 21 | #define HPAGE_SIZE (1UL << HPAGE_SHIFT) |
25 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) | 22 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) |
26 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | 23 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) |
@@ -30,6 +27,9 @@ extern int HPAGE_SHIFT; | |||
30 | #define ARCH_HAS_PREPARE_HUGEPAGE | 27 | #define ARCH_HAS_PREPARE_HUGEPAGE |
31 | #define ARCH_HAS_HUGEPAGE_CLEAR_FLUSH | 28 | #define ARCH_HAS_HUGEPAGE_CLEAR_FLUSH |
32 | 29 | ||
30 | #include <asm/setup.h> | ||
31 | #ifndef __ASSEMBLY__ | ||
32 | |||
33 | static inline void storage_key_init_range(unsigned long start, unsigned long end) | 33 | static inline void storage_key_init_range(unsigned long start, unsigned long end) |
34 | { | 34 | { |
35 | #if PAGE_DEFAULT_KEY | 35 | #if PAGE_DEFAULT_KEY |
diff --git a/arch/s390/include/asm/perf_event.h b/arch/s390/include/asm/perf_event.h index 4cb19fe76dd9..f897ec73dc8c 100644 --- a/arch/s390/include/asm/perf_event.h +++ b/arch/s390/include/asm/perf_event.h | |||
@@ -87,7 +87,15 @@ struct sf_raw_sample { | |||
87 | } __packed; | 87 | } __packed; |
88 | 88 | ||
89 | /* Perf hardware reserve and release functions */ | 89 | /* Perf hardware reserve and release functions */ |
90 | #ifdef CONFIG_PERF_EVENTS | ||
90 | int perf_reserve_sampling(void); | 91 | int perf_reserve_sampling(void); |
91 | void perf_release_sampling(void); | 92 | void perf_release_sampling(void); |
93 | #else /* CONFIG_PERF_EVENTS */ | ||
94 | static inline int perf_reserve_sampling(void) | ||
95 | { | ||
96 | return 0; | ||
97 | } | ||
98 | static inline void perf_release_sampling(void) {} | ||
99 | #endif /* CONFIG_PERF_EVENTS */ | ||
92 | 100 | ||
93 | #endif /* _ASM_S390_PERF_EVENT_H */ | 101 | #endif /* _ASM_S390_PERF_EVENT_H */ |
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c index c7d1b9d09011..a2da259d9327 100644 --- a/arch/s390/kernel/asm-offsets.c +++ b/arch/s390/kernel/asm-offsets.c | |||
@@ -23,15 +23,15 @@ | |||
23 | 23 | ||
24 | int main(void) | 24 | int main(void) |
25 | { | 25 | { |
26 | DEFINE(__THREAD_info, offsetof(struct task_struct, stack)); | 26 | DEFINE(__TASK_thread_info, offsetof(struct task_struct, stack)); |
27 | DEFINE(__THREAD_ksp, offsetof(struct task_struct, thread.ksp)); | 27 | DEFINE(__TASK_thread, offsetof(struct task_struct, thread)); |
28 | DEFINE(__THREAD_mm_segment, offsetof(struct task_struct, thread.mm_segment)); | ||
29 | BLANK(); | ||
30 | DEFINE(__TASK_pid, offsetof(struct task_struct, pid)); | 28 | DEFINE(__TASK_pid, offsetof(struct task_struct, pid)); |
31 | BLANK(); | 29 | BLANK(); |
32 | DEFINE(__THREAD_per_cause, offsetof(struct task_struct, thread.per_event.cause)); | 30 | DEFINE(__THREAD_ksp, offsetof(struct thread_struct, ksp)); |
33 | DEFINE(__THREAD_per_address, offsetof(struct task_struct, thread.per_event.address)); | 31 | DEFINE(__THREAD_per_cause, offsetof(struct thread_struct, per_event.cause)); |
34 | DEFINE(__THREAD_per_paid, offsetof(struct task_struct, thread.per_event.paid)); | 32 | DEFINE(__THREAD_per_address, offsetof(struct thread_struct, per_event.address)); |
33 | DEFINE(__THREAD_per_paid, offsetof(struct thread_struct, per_event.paid)); | ||
34 | DEFINE(__THREAD_trap_tdb, offsetof(struct thread_struct, trap_tdb)); | ||
35 | BLANK(); | 35 | BLANK(); |
36 | DEFINE(__TI_task, offsetof(struct thread_info, task)); | 36 | DEFINE(__TI_task, offsetof(struct thread_info, task)); |
37 | DEFINE(__TI_flags, offsetof(struct thread_info, flags)); | 37 | DEFINE(__TI_flags, offsetof(struct thread_info, flags)); |
@@ -176,7 +176,6 @@ int main(void) | |||
176 | DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data)); | 176 | DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data)); |
177 | DEFINE(__LC_GMAP, offsetof(struct _lowcore, gmap)); | 177 | DEFINE(__LC_GMAP, offsetof(struct _lowcore, gmap)); |
178 | DEFINE(__LC_PGM_TDB, offsetof(struct _lowcore, pgm_tdb)); | 178 | DEFINE(__LC_PGM_TDB, offsetof(struct _lowcore, pgm_tdb)); |
179 | DEFINE(__THREAD_trap_tdb, offsetof(struct task_struct, thread.trap_tdb)); | ||
180 | DEFINE(__GMAP_ASCE, offsetof(struct gmap, asce)); | 179 | DEFINE(__GMAP_ASCE, offsetof(struct gmap, asce)); |
181 | DEFINE(__SIE_PROG0C, offsetof(struct kvm_s390_sie_block, prog0c)); | 180 | DEFINE(__SIE_PROG0C, offsetof(struct kvm_s390_sie_block, prog0c)); |
182 | DEFINE(__SIE_PROG20, offsetof(struct kvm_s390_sie_block, prog20)); | 181 | DEFINE(__SIE_PROG20, offsetof(struct kvm_s390_sie_block, prog20)); |
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index 3238893c9d4f..84062e7a77da 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S | |||
@@ -178,17 +178,21 @@ _PIF_WORK = (_PIF_PER_TRAP) | |||
178 | */ | 178 | */ |
179 | ENTRY(__switch_to) | 179 | ENTRY(__switch_to) |
180 | stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task | 180 | stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task |
181 | stg %r15,__THREAD_ksp(%r2) # store kernel stack of prev | 181 | lgr %r1,%r2 |
182 | lg %r4,__THREAD_info(%r2) # get thread_info of prev | 182 | aghi %r1,__TASK_thread # thread_struct of prev task |
183 | lg %r5,__THREAD_info(%r3) # get thread_info of next | 183 | lg %r4,__TASK_thread_info(%r2) # get thread_info of prev |
184 | lg %r5,__TASK_thread_info(%r3) # get thread_info of next | ||
185 | stg %r15,__THREAD_ksp(%r1) # store kernel stack of prev | ||
186 | lgr %r1,%r3 | ||
187 | aghi %r1,__TASK_thread # thread_struct of next task | ||
184 | lgr %r15,%r5 | 188 | lgr %r15,%r5 |
185 | aghi %r15,STACK_INIT # end of kernel stack of next | 189 | aghi %r15,STACK_INIT # end of kernel stack of next |
186 | stg %r3,__LC_CURRENT # store task struct of next | 190 | stg %r3,__LC_CURRENT # store task struct of next |
187 | stg %r5,__LC_THREAD_INFO # store thread info of next | 191 | stg %r5,__LC_THREAD_INFO # store thread info of next |
188 | stg %r15,__LC_KERNEL_STACK # store end of kernel stack | 192 | stg %r15,__LC_KERNEL_STACK # store end of kernel stack |
193 | lg %r15,__THREAD_ksp(%r1) # load kernel stack of next | ||
189 | lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4 | 194 | lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4 |
190 | mvc __LC_CURRENT_PID+4(4,%r0),__TASK_pid(%r3) # store pid of next | 195 | mvc __LC_CURRENT_PID+4(4,%r0),__TASK_pid(%r3) # store pid of next |
191 | lg %r15,__THREAD_ksp(%r3) # load kernel stack of next | ||
192 | lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task | 196 | lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task |
193 | br %r14 | 197 | br %r14 |
194 | 198 | ||
@@ -417,6 +421,7 @@ ENTRY(pgm_check_handler) | |||
417 | LAST_BREAK %r14 | 421 | LAST_BREAK %r14 |
418 | lg %r15,__LC_KERNEL_STACK | 422 | lg %r15,__LC_KERNEL_STACK |
419 | lg %r14,__TI_task(%r12) | 423 | lg %r14,__TI_task(%r12) |
424 | aghi %r14,__TASK_thread # pointer to thread_struct | ||
420 | lghi %r13,__LC_PGM_TDB | 425 | lghi %r13,__LC_PGM_TDB |
421 | tm __LC_PGM_ILC+2,0x02 # check for transaction abort | 426 | tm __LC_PGM_ILC+2,0x02 # check for transaction abort |
422 | jz 2f | 427 | jz 2f |
diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c index 505c17c0ae1a..56b550893593 100644 --- a/arch/s390/kernel/nmi.c +++ b/arch/s390/kernel/nmi.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/nmi.h> | 21 | #include <asm/nmi.h> |
22 | #include <asm/crw.h> | 22 | #include <asm/crw.h> |
23 | #include <asm/switch_to.h> | 23 | #include <asm/switch_to.h> |
24 | #include <asm/ctl_reg.h> | ||
24 | 25 | ||
25 | struct mcck_struct { | 26 | struct mcck_struct { |
26 | int kill_task; | 27 | int kill_task; |
@@ -129,26 +130,30 @@ static int notrace s390_revalidate_registers(struct mci *mci) | |||
129 | } else | 130 | } else |
130 | asm volatile("lfpc 0(%0)" : : "a" (fpt_creg_save_area)); | 131 | asm volatile("lfpc 0(%0)" : : "a" (fpt_creg_save_area)); |
131 | 132 | ||
132 | asm volatile( | 133 | if (!MACHINE_HAS_VX) { |
133 | " ld 0,0(%0)\n" | 134 | /* Revalidate floating point registers */ |
134 | " ld 1,8(%0)\n" | 135 | asm volatile( |
135 | " ld 2,16(%0)\n" | 136 | " ld 0,0(%0)\n" |
136 | " ld 3,24(%0)\n" | 137 | " ld 1,8(%0)\n" |
137 | " ld 4,32(%0)\n" | 138 | " ld 2,16(%0)\n" |
138 | " ld 5,40(%0)\n" | 139 | " ld 3,24(%0)\n" |
139 | " ld 6,48(%0)\n" | 140 | " ld 4,32(%0)\n" |
140 | " ld 7,56(%0)\n" | 141 | " ld 5,40(%0)\n" |
141 | " ld 8,64(%0)\n" | 142 | " ld 6,48(%0)\n" |
142 | " ld 9,72(%0)\n" | 143 | " ld 7,56(%0)\n" |
143 | " ld 10,80(%0)\n" | 144 | " ld 8,64(%0)\n" |
144 | " ld 11,88(%0)\n" | 145 | " ld 9,72(%0)\n" |
145 | " ld 12,96(%0)\n" | 146 | " ld 10,80(%0)\n" |
146 | " ld 13,104(%0)\n" | 147 | " ld 11,88(%0)\n" |
147 | " ld 14,112(%0)\n" | 148 | " ld 12,96(%0)\n" |
148 | " ld 15,120(%0)\n" | 149 | " ld 13,104(%0)\n" |
149 | : : "a" (fpt_save_area)); | 150 | " ld 14,112(%0)\n" |
150 | /* Revalidate vector registers */ | 151 | " ld 15,120(%0)\n" |
151 | if (MACHINE_HAS_VX && current->thread.vxrs) { | 152 | : : "a" (fpt_save_area)); |
153 | } else { | ||
154 | /* Revalidate vector registers */ | ||
155 | union ctlreg0 cr0; | ||
156 | |||
152 | if (!mci->vr) { | 157 | if (!mci->vr) { |
153 | /* | 158 | /* |
154 | * Vector registers can't be restored and therefore | 159 | * Vector registers can't be restored and therefore |
@@ -156,8 +161,12 @@ static int notrace s390_revalidate_registers(struct mci *mci) | |||
156 | */ | 161 | */ |
157 | kill_task = 1; | 162 | kill_task = 1; |
158 | } | 163 | } |
164 | cr0.val = S390_lowcore.cregs_save_area[0]; | ||
165 | cr0.afp = cr0.vx = 1; | ||
166 | __ctl_load(cr0.val, 0, 0); | ||
159 | restore_vx_regs((__vector128 *) | 167 | restore_vx_regs((__vector128 *) |
160 | S390_lowcore.vector_save_area_addr); | 168 | &S390_lowcore.vector_save_area); |
169 | __ctl_load(S390_lowcore.cregs_save_area[0], 0, 0); | ||
161 | } | 170 | } |
162 | /* Revalidate access registers */ | 171 | /* Revalidate access registers */ |
163 | asm volatile( | 172 | asm volatile( |
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index dc5edc29b73a..8f587d871b9f 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c | |||
@@ -163,7 +163,7 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp, | |||
163 | asmlinkage void execve_tail(void) | 163 | asmlinkage void execve_tail(void) |
164 | { | 164 | { |
165 | current->thread.fp_regs.fpc = 0; | 165 | current->thread.fp_regs.fpc = 0; |
166 | asm volatile("sfpc %0,%0" : : "d" (0)); | 166 | asm volatile("sfpc %0" : : "d" (0)); |
167 | } | 167 | } |
168 | 168 | ||
169 | /* | 169 | /* |
diff --git a/arch/s390/kernel/sclp.S b/arch/s390/kernel/sclp.S index 43c3169ea49c..ada0c07fe1a8 100644 --- a/arch/s390/kernel/sclp.S +++ b/arch/s390/kernel/sclp.S | |||
@@ -270,6 +270,8 @@ ENTRY(_sclp_print_early) | |||
270 | jno .Lesa2 | 270 | jno .Lesa2 |
271 | ahi %r15,-80 | 271 | ahi %r15,-80 |
272 | stmh %r6,%r15,96(%r15) # store upper register halves | 272 | stmh %r6,%r15,96(%r15) # store upper register halves |
273 | basr %r13,0 | ||
274 | lmh %r0,%r15,.Lzeroes-.(%r13) # clear upper register halves | ||
273 | .Lesa2: | 275 | .Lesa2: |
274 | lr %r10,%r2 # save string pointer | 276 | lr %r10,%r2 # save string pointer |
275 | lhi %r2,0 | 277 | lhi %r2,0 |
@@ -291,6 +293,8 @@ ENTRY(_sclp_print_early) | |||
291 | .Lesa3: | 293 | .Lesa3: |
292 | lm %r6,%r15,120(%r15) # restore registers | 294 | lm %r6,%r15,120(%r15) # restore registers |
293 | br %r14 | 295 | br %r14 |
296 | .Lzeroes: | ||
297 | .fill 64,4,0 | ||
294 | 298 | ||
295 | .LwritedataS4: | 299 | .LwritedataS4: |
296 | .long 0x00760005 # SCLP command for write data | 300 | .long 0x00760005 # SCLP command for write data |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index f7f027caaaaa..ca070d260af2 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -885,8 +885,6 @@ void __init setup_arch(char **cmdline_p) | |||
885 | */ | 885 | */ |
886 | setup_hwcaps(); | 886 | setup_hwcaps(); |
887 | 887 | ||
888 | HPAGE_SHIFT = MACHINE_HAS_HPAGE ? 20 : 0; | ||
889 | |||
890 | /* | 888 | /* |
891 | * Create kernel page tables and switch to virtual addressing. | 889 | * Create kernel page tables and switch to virtual addressing. |
892 | */ | 890 | */ |
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index 4d96c9f53455..7bea81d8a363 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c | |||
@@ -259,7 +259,7 @@ void vector_exception(struct pt_regs *regs) | |||
259 | } | 259 | } |
260 | 260 | ||
261 | /* get vector interrupt code from fpc */ | 261 | /* get vector interrupt code from fpc */ |
262 | asm volatile("stfpc %0" : "=m" (current->thread.fp_regs.fpc)); | 262 | asm volatile("stfpc %0" : "=Q" (current->thread.fp_regs.fpc)); |
263 | vic = (current->thread.fp_regs.fpc & 0xf00) >> 8; | 263 | vic = (current->thread.fp_regs.fpc & 0xf00) >> 8; |
264 | switch (vic) { | 264 | switch (vic) { |
265 | case 1: /* invalid vector operation */ | 265 | case 1: /* invalid vector operation */ |
@@ -297,7 +297,7 @@ void data_exception(struct pt_regs *regs) | |||
297 | 297 | ||
298 | location = get_trap_ip(regs); | 298 | location = get_trap_ip(regs); |
299 | 299 | ||
300 | asm volatile("stfpc %0" : "=m" (current->thread.fp_regs.fpc)); | 300 | asm volatile("stfpc %0" : "=Q" (current->thread.fp_regs.fpc)); |
301 | /* Check for vector register enablement */ | 301 | /* Check for vector register enablement */ |
302 | if (MACHINE_HAS_VX && !current->thread.vxrs && | 302 | if (MACHINE_HAS_VX && !current->thread.vxrs && |
303 | (current->thread.fp_regs.fpc & FPC_DXC_MASK) == 0xfe00) { | 303 | (current->thread.fp_regs.fpc & FPC_DXC_MASK) == 0xfe00) { |
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c index 33082d0d101b..b33f66110ca9 100644 --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c | |||
@@ -31,8 +31,6 @@ | |||
31 | #define ALLOC_ORDER 2 | 31 | #define ALLOC_ORDER 2 |
32 | #define FRAG_MASK 0x03 | 32 | #define FRAG_MASK 0x03 |
33 | 33 | ||
34 | int HPAGE_SHIFT; | ||
35 | |||
36 | unsigned long *crst_table_alloc(struct mm_struct *mm) | 34 | unsigned long *crst_table_alloc(struct mm_struct *mm) |
37 | { | 35 | { |
38 | struct page *page = alloc_pages(GFP_KERNEL, ALLOC_ORDER); | 36 | struct page *page = alloc_pages(GFP_KERNEL, ALLOC_ORDER); |
diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c index bc927a09a172..9cfa2ffaa9d6 100644 --- a/arch/s390/oprofile/init.c +++ b/arch/s390/oprofile/init.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <asm/processor.h> | 18 | #include <asm/processor.h> |
19 | #include <asm/perf_event.h> | ||
19 | 20 | ||
20 | #include "../../../drivers/oprofile/oprof.h" | 21 | #include "../../../drivers/oprofile/oprof.h" |
21 | 22 | ||
diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild index 138fb3db45ba..92ffe397b893 100644 --- a/arch/score/include/asm/Kbuild +++ b/arch/score/include/asm/Kbuild | |||
@@ -7,6 +7,7 @@ generic-y += clkdev.h | |||
7 | generic-y += cputime.h | 7 | generic-y += cputime.h |
8 | generic-y += irq_work.h | 8 | generic-y += irq_work.h |
9 | generic-y += mcs_spinlock.h | 9 | generic-y += mcs_spinlock.h |
10 | generic-y += mm-arch-hooks.h | ||
10 | generic-y += preempt.h | 11 | generic-y += preempt.h |
11 | generic-y += sections.h | 12 | generic-y += sections.h |
12 | generic-y += trace_clock.h | 13 | generic-y += trace_clock.h |
diff --git a/arch/score/include/asm/mm-arch-hooks.h b/arch/score/include/asm/mm-arch-hooks.h deleted file mode 100644 index 5e38689f189a..000000000000 --- a/arch/score/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_SCORE_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_SCORE_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_SCORE_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild index 9ac4626e7284..aac452b26aa8 100644 --- a/arch/sh/include/asm/Kbuild +++ b/arch/sh/include/asm/Kbuild | |||
@@ -16,6 +16,7 @@ generic-y += kvm_para.h | |||
16 | generic-y += local.h | 16 | generic-y += local.h |
17 | generic-y += local64.h | 17 | generic-y += local64.h |
18 | generic-y += mcs_spinlock.h | 18 | generic-y += mcs_spinlock.h |
19 | generic-y += mm-arch-hooks.h | ||
19 | generic-y += mman.h | 20 | generic-y += mman.h |
20 | generic-y += msgbuf.h | 21 | generic-y += msgbuf.h |
21 | generic-y += param.h | 22 | generic-y += param.h |
diff --git a/arch/sh/include/asm/mm-arch-hooks.h b/arch/sh/include/asm/mm-arch-hooks.h deleted file mode 100644 index 18087298b728..000000000000 --- a/arch/sh/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_SH_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_SH_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_SH_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild index 2b2a69dcc467..e928618838bc 100644 --- a/arch/sparc/include/asm/Kbuild +++ b/arch/sparc/include/asm/Kbuild | |||
@@ -12,6 +12,7 @@ generic-y += linkage.h | |||
12 | generic-y += local.h | 12 | generic-y += local.h |
13 | generic-y += local64.h | 13 | generic-y += local64.h |
14 | generic-y += mcs_spinlock.h | 14 | generic-y += mcs_spinlock.h |
15 | generic-y += mm-arch-hooks.h | ||
15 | generic-y += module.h | 16 | generic-y += module.h |
16 | generic-y += mutex.h | 17 | generic-y += mutex.h |
17 | generic-y += preempt.h | 18 | generic-y += preempt.h |
diff --git a/arch/sparc/include/asm/mm-arch-hooks.h b/arch/sparc/include/asm/mm-arch-hooks.h deleted file mode 100644 index b89ba44c16f1..000000000000 --- a/arch/sparc/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_SPARC_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_SPARC_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_SPARC_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild index d53654488c2c..d8a843163471 100644 --- a/arch/tile/include/asm/Kbuild +++ b/arch/tile/include/asm/Kbuild | |||
@@ -19,6 +19,7 @@ generic-y += irq_regs.h | |||
19 | generic-y += local.h | 19 | generic-y += local.h |
20 | generic-y += local64.h | 20 | generic-y += local64.h |
21 | generic-y += mcs_spinlock.h | 21 | generic-y += mcs_spinlock.h |
22 | generic-y += mm-arch-hooks.h | ||
22 | generic-y += msgbuf.h | 23 | generic-y += msgbuf.h |
23 | generic-y += mutex.h | 24 | generic-y += mutex.h |
24 | generic-y += param.h | 25 | generic-y += param.h |
diff --git a/arch/tile/include/asm/mm-arch-hooks.h b/arch/tile/include/asm/mm-arch-hooks.h deleted file mode 100644 index d1709ea774f7..000000000000 --- a/arch/tile/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_TILE_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_TILE_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_TILE_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c index 99c9ff87e018..6b755d125783 100644 --- a/arch/tile/kernel/setup.c +++ b/arch/tile/kernel/setup.c | |||
@@ -1139,7 +1139,7 @@ static void __init load_hv_initrd(void) | |||
1139 | 1139 | ||
1140 | void __init free_initrd_mem(unsigned long begin, unsigned long end) | 1140 | void __init free_initrd_mem(unsigned long begin, unsigned long end) |
1141 | { | 1141 | { |
1142 | free_bootmem(__pa(begin), end - begin); | 1142 | free_bootmem_late(__pa(begin), end - begin); |
1143 | } | 1143 | } |
1144 | 1144 | ||
1145 | static int __init setup_initrd(char *str) | 1145 | static int __init setup_initrd(char *str) |
diff --git a/arch/tile/lib/memcpy_user_64.c b/arch/tile/lib/memcpy_user_64.c index 88c7016492c4..97bbb6060b25 100644 --- a/arch/tile/lib/memcpy_user_64.c +++ b/arch/tile/lib/memcpy_user_64.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #define _ST(p, inst, v) \ | 28 | #define _ST(p, inst, v) \ |
29 | ({ \ | 29 | ({ \ |
30 | asm("1: " #inst " %0, %1;" \ | 30 | asm("1: " #inst " %0, %1;" \ |
31 | ".pushsection .coldtext.memcpy,\"ax\";" \ | 31 | ".pushsection .coldtext,\"ax\";" \ |
32 | "2: { move r0, %2; jrp lr };" \ | 32 | "2: { move r0, %2; jrp lr };" \ |
33 | ".section __ex_table,\"a\";" \ | 33 | ".section __ex_table,\"a\";" \ |
34 | ".align 8;" \ | 34 | ".align 8;" \ |
@@ -41,7 +41,7 @@ | |||
41 | ({ \ | 41 | ({ \ |
42 | unsigned long __v; \ | 42 | unsigned long __v; \ |
43 | asm("1: " #inst " %0, %1;" \ | 43 | asm("1: " #inst " %0, %1;" \ |
44 | ".pushsection .coldtext.memcpy,\"ax\";" \ | 44 | ".pushsection .coldtext,\"ax\";" \ |
45 | "2: { move r0, %2; jrp lr };" \ | 45 | "2: { move r0, %2; jrp lr };" \ |
46 | ".section __ex_table,\"a\";" \ | 46 | ".section __ex_table,\"a\";" \ |
47 | ".align 8;" \ | 47 | ".align 8;" \ |
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild index 3d63ff6f583f..149ec55f9c46 100644 --- a/arch/um/include/asm/Kbuild +++ b/arch/um/include/asm/Kbuild | |||
@@ -16,6 +16,7 @@ generic-y += irq_regs.h | |||
16 | generic-y += irq_work.h | 16 | generic-y += irq_work.h |
17 | generic-y += kdebug.h | 17 | generic-y += kdebug.h |
18 | generic-y += mcs_spinlock.h | 18 | generic-y += mcs_spinlock.h |
19 | generic-y += mm-arch-hooks.h | ||
19 | generic-y += mutex.h | 20 | generic-y += mutex.h |
20 | generic-y += param.h | 21 | generic-y += param.h |
21 | generic-y += pci.h | 22 | generic-y += pci.h |
diff --git a/arch/um/include/asm/mm-arch-hooks.h b/arch/um/include/asm/mm-arch-hooks.h deleted file mode 100644 index a7c8b0dfdd4e..000000000000 --- a/arch/um/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_UM_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_UM_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_UM_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/unicore32/include/asm/Kbuild b/arch/unicore32/include/asm/Kbuild index d12b377b5a8b..1fc7a286dc6f 100644 --- a/arch/unicore32/include/asm/Kbuild +++ b/arch/unicore32/include/asm/Kbuild | |||
@@ -26,6 +26,7 @@ generic-y += kdebug.h | |||
26 | generic-y += kmap_types.h | 26 | generic-y += kmap_types.h |
27 | generic-y += local.h | 27 | generic-y += local.h |
28 | generic-y += mcs_spinlock.h | 28 | generic-y += mcs_spinlock.h |
29 | generic-y += mm-arch-hooks.h | ||
29 | generic-y += mman.h | 30 | generic-y += mman.h |
30 | generic-y += module.h | 31 | generic-y += module.h |
31 | generic-y += msgbuf.h | 32 | generic-y += msgbuf.h |
diff --git a/arch/unicore32/include/asm/mm-arch-hooks.h b/arch/unicore32/include/asm/mm-arch-hooks.h deleted file mode 100644 index 4d79a850c509..000000000000 --- a/arch/unicore32/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_UNICORE32_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_UNICORE32_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_UNICORE32_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 55bced17dc95..b3a1a5d77d92 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -41,6 +41,7 @@ config X86 | |||
41 | select ARCH_USE_CMPXCHG_LOCKREF if X86_64 | 41 | select ARCH_USE_CMPXCHG_LOCKREF if X86_64 |
42 | select ARCH_USE_QUEUED_RWLOCKS | 42 | select ARCH_USE_QUEUED_RWLOCKS |
43 | select ARCH_USE_QUEUED_SPINLOCKS | 43 | select ARCH_USE_QUEUED_SPINLOCKS |
44 | select ARCH_WANTS_DYNAMIC_TASK_STRUCT | ||
44 | select ARCH_WANT_FRAME_POINTERS | 45 | select ARCH_WANT_FRAME_POINTERS |
45 | select ARCH_WANT_IPC_PARSE_VERSION if X86_32 | 46 | select ARCH_WANT_IPC_PARSE_VERSION if X86_32 |
46 | select ARCH_WANT_OPTIONAL_GPIOLIB | 47 | select ARCH_WANT_OPTIONAL_GPIOLIB |
@@ -254,6 +255,11 @@ config ARCH_SUPPORTS_OPTIMIZED_INLINING | |||
254 | config ARCH_SUPPORTS_DEBUG_PAGEALLOC | 255 | config ARCH_SUPPORTS_DEBUG_PAGEALLOC |
255 | def_bool y | 256 | def_bool y |
256 | 257 | ||
258 | config KASAN_SHADOW_OFFSET | ||
259 | hex | ||
260 | depends on KASAN | ||
261 | default 0xdffffc0000000000 | ||
262 | |||
257 | config HAVE_INTEL_TXT | 263 | config HAVE_INTEL_TXT |
258 | def_bool y | 264 | def_bool y |
259 | depends on INTEL_IOMMU && ACPI | 265 | depends on INTEL_IOMMU && ACPI |
@@ -2015,7 +2021,7 @@ config CMDLINE_BOOL | |||
2015 | 2021 | ||
2016 | To compile command line arguments into the kernel, | 2022 | To compile command line arguments into the kernel, |
2017 | set this option to 'Y', then fill in the | 2023 | set this option to 'Y', then fill in the |
2018 | the boot arguments in CONFIG_CMDLINE. | 2024 | boot arguments in CONFIG_CMDLINE. |
2019 | 2025 | ||
2020 | Systems with fully functional boot loaders (i.e. non-embedded) | 2026 | Systems with fully functional boot loaders (i.e. non-embedded) |
2021 | should leave this option set to 'N'. | 2027 | should leave this option set to 'N'. |
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index a15893d17c55..d8c0d3266173 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
@@ -297,6 +297,18 @@ config OPTIMIZE_INLINING | |||
297 | 297 | ||
298 | If unsure, say N. | 298 | If unsure, say N. |
299 | 299 | ||
300 | config DEBUG_ENTRY | ||
301 | bool "Debug low-level entry code" | ||
302 | depends on DEBUG_KERNEL | ||
303 | ---help--- | ||
304 | This option enables sanity checks in x86's low-level entry code. | ||
305 | Some of these sanity checks may slow down kernel entries and | ||
306 | exits or otherwise impact performance. | ||
307 | |||
308 | This is currently used to help test NMI code. | ||
309 | |||
310 | If unsure, say N. | ||
311 | |||
300 | config DEBUG_NMI_SELFTEST | 312 | config DEBUG_NMI_SELFTEST |
301 | bool "NMI Selftest" | 313 | bool "NMI Selftest" |
302 | depends on DEBUG_KERNEL && X86_LOCAL_APIC | 314 | depends on DEBUG_KERNEL && X86_LOCAL_APIC |
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 3bb2c4302df1..8cb3e438f21e 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S | |||
@@ -1237,11 +1237,12 @@ ENTRY(nmi) | |||
1237 | * If the variable is not set and the stack is not the NMI | 1237 | * If the variable is not set and the stack is not the NMI |
1238 | * stack then: | 1238 | * stack then: |
1239 | * o Set the special variable on the stack | 1239 | * o Set the special variable on the stack |
1240 | * o Copy the interrupt frame into a "saved" location on the stack | 1240 | * o Copy the interrupt frame into an "outermost" location on the |
1241 | * o Copy the interrupt frame into a "copy" location on the stack | 1241 | * stack |
1242 | * o Copy the interrupt frame into an "iret" location on the stack | ||
1242 | * o Continue processing the NMI | 1243 | * o Continue processing the NMI |
1243 | * If the variable is set or the previous stack is the NMI stack: | 1244 | * If the variable is set or the previous stack is the NMI stack: |
1244 | * o Modify the "copy" location to jump to the repeate_nmi | 1245 | * o Modify the "iret" location to jump to the repeat_nmi |
1245 | * o return back to the first NMI | 1246 | * o return back to the first NMI |
1246 | * | 1247 | * |
1247 | * Now on exit of the first NMI, we first clear the stack variable | 1248 | * Now on exit of the first NMI, we first clear the stack variable |
@@ -1250,31 +1251,151 @@ ENTRY(nmi) | |||
1250 | * a nested NMI that updated the copy interrupt stack frame, a | 1251 | * a nested NMI that updated the copy interrupt stack frame, a |
1251 | * jump will be made to the repeat_nmi code that will handle the second | 1252 | * jump will be made to the repeat_nmi code that will handle the second |
1252 | * NMI. | 1253 | * NMI. |
1254 | * | ||
1255 | * However, espfix prevents us from directly returning to userspace | ||
1256 | * with a single IRET instruction. Similarly, IRET to user mode | ||
1257 | * can fault. We therefore handle NMIs from user space like | ||
1258 | * other IST entries. | ||
1253 | */ | 1259 | */ |
1254 | 1260 | ||
1255 | /* Use %rdx as our temp variable throughout */ | 1261 | /* Use %rdx as our temp variable throughout */ |
1256 | pushq %rdx | 1262 | pushq %rdx |
1257 | 1263 | ||
1264 | testb $3, CS-RIP+8(%rsp) | ||
1265 | jz .Lnmi_from_kernel | ||
1266 | |||
1267 | /* | ||
1268 | * NMI from user mode. We need to run on the thread stack, but we | ||
1269 | * can't go through the normal entry paths: NMIs are masked, and | ||
1270 | * we don't want to enable interrupts, because then we'll end | ||
1271 | * up in an awkward situation in which IRQs are on but NMIs | ||
1272 | * are off. | ||
1273 | */ | ||
1274 | |||
1275 | SWAPGS | ||
1276 | cld | ||
1277 | movq %rsp, %rdx | ||
1278 | movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp | ||
1279 | pushq 5*8(%rdx) /* pt_regs->ss */ | ||
1280 | pushq 4*8(%rdx) /* pt_regs->rsp */ | ||
1281 | pushq 3*8(%rdx) /* pt_regs->flags */ | ||
1282 | pushq 2*8(%rdx) /* pt_regs->cs */ | ||
1283 | pushq 1*8(%rdx) /* pt_regs->rip */ | ||
1284 | pushq $-1 /* pt_regs->orig_ax */ | ||
1285 | pushq %rdi /* pt_regs->di */ | ||
1286 | pushq %rsi /* pt_regs->si */ | ||
1287 | pushq (%rdx) /* pt_regs->dx */ | ||
1288 | pushq %rcx /* pt_regs->cx */ | ||
1289 | pushq %rax /* pt_regs->ax */ | ||
1290 | pushq %r8 /* pt_regs->r8 */ | ||
1291 | pushq %r9 /* pt_regs->r9 */ | ||
1292 | pushq %r10 /* pt_regs->r10 */ | ||
1293 | pushq %r11 /* pt_regs->r11 */ | ||
1294 | pushq %rbx /* pt_regs->rbx */ | ||
1295 | pushq %rbp /* pt_regs->rbp */ | ||
1296 | pushq %r12 /* pt_regs->r12 */ | ||
1297 | pushq %r13 /* pt_regs->r13 */ | ||
1298 | pushq %r14 /* pt_regs->r14 */ | ||
1299 | pushq %r15 /* pt_regs->r15 */ | ||
1300 | |||
1301 | /* | ||
1302 | * At this point we no longer need to worry about stack damage | ||
1303 | * due to nesting -- we're on the normal thread stack and we're | ||
1304 | * done with the NMI stack. | ||
1305 | */ | ||
1306 | |||
1307 | movq %rsp, %rdi | ||
1308 | movq $-1, %rsi | ||
1309 | call do_nmi | ||
1310 | |||
1311 | /* | ||
1312 | * Return back to user mode. We must *not* do the normal exit | ||
1313 | * work, because we don't want to enable interrupts. Fortunately, | ||
1314 | * do_nmi doesn't modify pt_regs. | ||
1315 | */ | ||
1316 | SWAPGS | ||
1317 | jmp restore_c_regs_and_iret | ||
1318 | |||
1319 | .Lnmi_from_kernel: | ||
1320 | /* | ||
1321 | * Here's what our stack frame will look like: | ||
1322 | * +---------------------------------------------------------+ | ||
1323 | * | original SS | | ||
1324 | * | original Return RSP | | ||
1325 | * | original RFLAGS | | ||
1326 | * | original CS | | ||
1327 | * | original RIP | | ||
1328 | * +---------------------------------------------------------+ | ||
1329 | * | temp storage for rdx | | ||
1330 | * +---------------------------------------------------------+ | ||
1331 | * | "NMI executing" variable | | ||
1332 | * +---------------------------------------------------------+ | ||
1333 | * | iret SS } Copied from "outermost" frame | | ||
1334 | * | iret Return RSP } on each loop iteration; overwritten | | ||
1335 | * | iret RFLAGS } by a nested NMI to force another | | ||
1336 | * | iret CS } iteration if needed. | | ||
1337 | * | iret RIP } | | ||
1338 | * +---------------------------------------------------------+ | ||
1339 | * | outermost SS } initialized in first_nmi; | | ||
1340 | * | outermost Return RSP } will not be changed before | | ||
1341 | * | outermost RFLAGS } NMI processing is done. | | ||
1342 | * | outermost CS } Copied to "iret" frame on each | | ||
1343 | * | outermost RIP } iteration. | | ||
1344 | * +---------------------------------------------------------+ | ||
1345 | * | pt_regs | | ||
1346 | * +---------------------------------------------------------+ | ||
1347 | * | ||
1348 | * The "original" frame is used by hardware. Before re-enabling | ||
1349 | * NMIs, we need to be done with it, and we need to leave enough | ||
1350 | * space for the asm code here. | ||
1351 | * | ||
1352 | * We return by executing IRET while RSP points to the "iret" frame. | ||
1353 | * That will either return for real or it will loop back into NMI | ||
1354 | * processing. | ||
1355 | * | ||
1356 | * The "outermost" frame is copied to the "iret" frame on each | ||
1357 | * iteration of the loop, so each iteration starts with the "iret" | ||
1358 | * frame pointing to the final return target. | ||
1359 | */ | ||
1360 | |||
1258 | /* | 1361 | /* |
1259 | * If %cs was not the kernel segment, then the NMI triggered in user | 1362 | * Determine whether we're a nested NMI. |
1260 | * space, which means it is definitely not nested. | 1363 | * |
1364 | * If we interrupted kernel code between repeat_nmi and | ||
1365 | * end_repeat_nmi, then we are a nested NMI. We must not | ||
1366 | * modify the "iret" frame because it's being written by | ||
1367 | * the outer NMI. That's okay; the outer NMI handler is | ||
1368 | * about to about to call do_nmi anyway, so we can just | ||
1369 | * resume the outer NMI. | ||
1261 | */ | 1370 | */ |
1262 | cmpl $__KERNEL_CS, 16(%rsp) | 1371 | |
1263 | jne first_nmi | 1372 | movq $repeat_nmi, %rdx |
1373 | cmpq 8(%rsp), %rdx | ||
1374 | ja 1f | ||
1375 | movq $end_repeat_nmi, %rdx | ||
1376 | cmpq 8(%rsp), %rdx | ||
1377 | ja nested_nmi_out | ||
1378 | 1: | ||
1264 | 1379 | ||
1265 | /* | 1380 | /* |
1266 | * Check the special variable on the stack to see if NMIs are | 1381 | * Now check "NMI executing". If it's set, then we're nested. |
1267 | * executing. | 1382 | * This will not detect if we interrupted an outer NMI just |
1383 | * before IRET. | ||
1268 | */ | 1384 | */ |
1269 | cmpl $1, -8(%rsp) | 1385 | cmpl $1, -8(%rsp) |
1270 | je nested_nmi | 1386 | je nested_nmi |
1271 | 1387 | ||
1272 | /* | 1388 | /* |
1273 | * Now test if the previous stack was an NMI stack. | 1389 | * Now test if the previous stack was an NMI stack. This covers |
1274 | * We need the double check. We check the NMI stack to satisfy the | 1390 | * the case where we interrupt an outer NMI after it clears |
1275 | * race when the first NMI clears the variable before returning. | 1391 | * "NMI executing" but before IRET. We need to be careful, though: |
1276 | * We check the variable because the first NMI could be in a | 1392 | * there is one case in which RSP could point to the NMI stack |
1277 | * breakpoint routine using a breakpoint stack. | 1393 | * despite there being no NMI active: naughty userspace controls |
1394 | * RSP at the very beginning of the SYSCALL targets. We can | ||
1395 | * pull a fast one on naughty userspace, though: we program | ||
1396 | * SYSCALL to mask DF, so userspace cannot cause DF to be set | ||
1397 | * if it controls the kernel's RSP. We set DF before we clear | ||
1398 | * "NMI executing". | ||
1278 | */ | 1399 | */ |
1279 | lea 6*8(%rsp), %rdx | 1400 | lea 6*8(%rsp), %rdx |
1280 | /* Compare the NMI stack (rdx) with the stack we came from (4*8(%rsp)) */ | 1401 | /* Compare the NMI stack (rdx) with the stack we came from (4*8(%rsp)) */ |
@@ -1286,25 +1407,20 @@ ENTRY(nmi) | |||
1286 | cmpq %rdx, 4*8(%rsp) | 1407 | cmpq %rdx, 4*8(%rsp) |
1287 | /* If it is below the NMI stack, it is a normal NMI */ | 1408 | /* If it is below the NMI stack, it is a normal NMI */ |
1288 | jb first_nmi | 1409 | jb first_nmi |
1289 | /* Ah, it is within the NMI stack, treat it as nested */ | 1410 | |
1411 | /* Ah, it is within the NMI stack. */ | ||
1412 | |||
1413 | testb $(X86_EFLAGS_DF >> 8), (3*8 + 1)(%rsp) | ||
1414 | jz first_nmi /* RSP was user controlled. */ | ||
1415 | |||
1416 | /* This is a nested NMI. */ | ||
1290 | 1417 | ||
1291 | nested_nmi: | 1418 | nested_nmi: |
1292 | /* | 1419 | /* |
1293 | * Do nothing if we interrupted the fixup in repeat_nmi. | 1420 | * Modify the "iret" frame to point to repeat_nmi, forcing another |
1294 | * It's about to repeat the NMI handler, so we are fine | 1421 | * iteration of NMI handling. |
1295 | * with ignoring this one. | ||
1296 | */ | 1422 | */ |
1297 | movq $repeat_nmi, %rdx | 1423 | subq $8, %rsp |
1298 | cmpq 8(%rsp), %rdx | ||
1299 | ja 1f | ||
1300 | movq $end_repeat_nmi, %rdx | ||
1301 | cmpq 8(%rsp), %rdx | ||
1302 | ja nested_nmi_out | ||
1303 | |||
1304 | 1: | ||
1305 | /* Set up the interrupted NMIs stack to jump to repeat_nmi */ | ||
1306 | leaq -1*8(%rsp), %rdx | ||
1307 | movq %rdx, %rsp | ||
1308 | leaq -10*8(%rsp), %rdx | 1424 | leaq -10*8(%rsp), %rdx |
1309 | pushq $__KERNEL_DS | 1425 | pushq $__KERNEL_DS |
1310 | pushq %rdx | 1426 | pushq %rdx |
@@ -1318,61 +1434,42 @@ nested_nmi: | |||
1318 | nested_nmi_out: | 1434 | nested_nmi_out: |
1319 | popq %rdx | 1435 | popq %rdx |
1320 | 1436 | ||
1321 | /* No need to check faults here */ | 1437 | /* We are returning to kernel mode, so this cannot result in a fault. */ |
1322 | INTERRUPT_RETURN | 1438 | INTERRUPT_RETURN |
1323 | 1439 | ||
1324 | first_nmi: | 1440 | first_nmi: |
1325 | /* | 1441 | /* Restore rdx. */ |
1326 | * Because nested NMIs will use the pushed location that we | ||
1327 | * stored in rdx, we must keep that space available. | ||
1328 | * Here's what our stack frame will look like: | ||
1329 | * +-------------------------+ | ||
1330 | * | original SS | | ||
1331 | * | original Return RSP | | ||
1332 | * | original RFLAGS | | ||
1333 | * | original CS | | ||
1334 | * | original RIP | | ||
1335 | * +-------------------------+ | ||
1336 | * | temp storage for rdx | | ||
1337 | * +-------------------------+ | ||
1338 | * | NMI executing variable | | ||
1339 | * +-------------------------+ | ||
1340 | * | copied SS | | ||
1341 | * | copied Return RSP | | ||
1342 | * | copied RFLAGS | | ||
1343 | * | copied CS | | ||
1344 | * | copied RIP | | ||
1345 | * +-------------------------+ | ||
1346 | * | Saved SS | | ||
1347 | * | Saved Return RSP | | ||
1348 | * | Saved RFLAGS | | ||
1349 | * | Saved CS | | ||
1350 | * | Saved RIP | | ||
1351 | * +-------------------------+ | ||
1352 | * | pt_regs | | ||
1353 | * +-------------------------+ | ||
1354 | * | ||
1355 | * The saved stack frame is used to fix up the copied stack frame | ||
1356 | * that a nested NMI may change to make the interrupted NMI iret jump | ||
1357 | * to the repeat_nmi. The original stack frame and the temp storage | ||
1358 | * is also used by nested NMIs and can not be trusted on exit. | ||
1359 | */ | ||
1360 | /* Do not pop rdx, nested NMIs will corrupt that part of the stack */ | ||
1361 | movq (%rsp), %rdx | 1442 | movq (%rsp), %rdx |
1362 | 1443 | ||
1363 | /* Set the NMI executing variable on the stack. */ | 1444 | /* Make room for "NMI executing". */ |
1364 | pushq $1 | 1445 | pushq $0 |
1365 | 1446 | ||
1366 | /* Leave room for the "copied" frame */ | 1447 | /* Leave room for the "iret" frame */ |
1367 | subq $(5*8), %rsp | 1448 | subq $(5*8), %rsp |
1368 | 1449 | ||
1369 | /* Copy the stack frame to the Saved frame */ | 1450 | /* Copy the "original" frame to the "outermost" frame */ |
1370 | .rept 5 | 1451 | .rept 5 |
1371 | pushq 11*8(%rsp) | 1452 | pushq 11*8(%rsp) |
1372 | .endr | 1453 | .endr |
1373 | 1454 | ||
1374 | /* Everything up to here is safe from nested NMIs */ | 1455 | /* Everything up to here is safe from nested NMIs */ |
1375 | 1456 | ||
1457 | #ifdef CONFIG_DEBUG_ENTRY | ||
1458 | /* | ||
1459 | * For ease of testing, unmask NMIs right away. Disabled by | ||
1460 | * default because IRET is very expensive. | ||
1461 | */ | ||
1462 | pushq $0 /* SS */ | ||
1463 | pushq %rsp /* RSP (minus 8 because of the previous push) */ | ||
1464 | addq $8, (%rsp) /* Fix up RSP */ | ||
1465 | pushfq /* RFLAGS */ | ||
1466 | pushq $__KERNEL_CS /* CS */ | ||
1467 | pushq $1f /* RIP */ | ||
1468 | INTERRUPT_RETURN /* continues at repeat_nmi below */ | ||
1469 | 1: | ||
1470 | #endif | ||
1471 | |||
1472 | repeat_nmi: | ||
1376 | /* | 1473 | /* |
1377 | * If there was a nested NMI, the first NMI's iret will return | 1474 | * If there was a nested NMI, the first NMI's iret will return |
1378 | * here. But NMIs are still enabled and we can take another | 1475 | * here. But NMIs are still enabled and we can take another |
@@ -1381,16 +1478,20 @@ first_nmi: | |||
1381 | * it will just return, as we are about to repeat an NMI anyway. | 1478 | * it will just return, as we are about to repeat an NMI anyway. |
1382 | * This makes it safe to copy to the stack frame that a nested | 1479 | * This makes it safe to copy to the stack frame that a nested |
1383 | * NMI will update. | 1480 | * NMI will update. |
1481 | * | ||
1482 | * RSP is pointing to "outermost RIP". gsbase is unknown, but, if | ||
1483 | * we're repeating an NMI, gsbase has the same value that it had on | ||
1484 | * the first iteration. paranoid_entry will load the kernel | ||
1485 | * gsbase if needed before we call do_nmi. "NMI executing" | ||
1486 | * is zero. | ||
1384 | */ | 1487 | */ |
1385 | repeat_nmi: | 1488 | movq $1, 10*8(%rsp) /* Set "NMI executing". */ |
1489 | |||
1386 | /* | 1490 | /* |
1387 | * Update the stack variable to say we are still in NMI (the update | 1491 | * Copy the "outermost" frame to the "iret" frame. NMIs that nest |
1388 | * is benign for the non-repeat case, where 1 was pushed just above | 1492 | * here must not modify the "iret" frame while we're writing to |
1389 | * to this very stack slot). | 1493 | * it or it will end up containing garbage. |
1390 | */ | 1494 | */ |
1391 | movq $1, 10*8(%rsp) | ||
1392 | |||
1393 | /* Make another copy, this one may be modified by nested NMIs */ | ||
1394 | addq $(10*8), %rsp | 1495 | addq $(10*8), %rsp |
1395 | .rept 5 | 1496 | .rept 5 |
1396 | pushq -6*8(%rsp) | 1497 | pushq -6*8(%rsp) |
@@ -1399,9 +1500,9 @@ repeat_nmi: | |||
1399 | end_repeat_nmi: | 1500 | end_repeat_nmi: |
1400 | 1501 | ||
1401 | /* | 1502 | /* |
1402 | * Everything below this point can be preempted by a nested | 1503 | * Everything below this point can be preempted by a nested NMI. |
1403 | * NMI if the first NMI took an exception and reset our iret stack | 1504 | * If this happens, then the inner NMI will change the "iret" |
1404 | * so that we repeat another NMI. | 1505 | * frame to point back to repeat_nmi. |
1405 | */ | 1506 | */ |
1406 | pushq $-1 /* ORIG_RAX: no syscall to restart */ | 1507 | pushq $-1 /* ORIG_RAX: no syscall to restart */ |
1407 | ALLOC_PT_GPREGS_ON_STACK | 1508 | ALLOC_PT_GPREGS_ON_STACK |
@@ -1415,28 +1516,11 @@ end_repeat_nmi: | |||
1415 | */ | 1516 | */ |
1416 | call paranoid_entry | 1517 | call paranoid_entry |
1417 | 1518 | ||
1418 | /* | ||
1419 | * Save off the CR2 register. If we take a page fault in the NMI then | ||
1420 | * it could corrupt the CR2 value. If the NMI preempts a page fault | ||
1421 | * handler before it was able to read the CR2 register, and then the | ||
1422 | * NMI itself takes a page fault, the page fault that was preempted | ||
1423 | * will read the information from the NMI page fault and not the | ||
1424 | * origin fault. Save it off and restore it if it changes. | ||
1425 | * Use the r12 callee-saved register. | ||
1426 | */ | ||
1427 | movq %cr2, %r12 | ||
1428 | |||
1429 | /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */ | 1519 | /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */ |
1430 | movq %rsp, %rdi | 1520 | movq %rsp, %rdi |
1431 | movq $-1, %rsi | 1521 | movq $-1, %rsi |
1432 | call do_nmi | 1522 | call do_nmi |
1433 | 1523 | ||
1434 | /* Did the NMI take a page fault? Restore cr2 if it did */ | ||
1435 | movq %cr2, %rcx | ||
1436 | cmpq %rcx, %r12 | ||
1437 | je 1f | ||
1438 | movq %r12, %cr2 | ||
1439 | 1: | ||
1440 | testl %ebx, %ebx /* swapgs needed? */ | 1524 | testl %ebx, %ebx /* swapgs needed? */ |
1441 | jnz nmi_restore | 1525 | jnz nmi_restore |
1442 | nmi_swapgs: | 1526 | nmi_swapgs: |
@@ -1444,11 +1528,26 @@ nmi_swapgs: | |||
1444 | nmi_restore: | 1528 | nmi_restore: |
1445 | RESTORE_EXTRA_REGS | 1529 | RESTORE_EXTRA_REGS |
1446 | RESTORE_C_REGS | 1530 | RESTORE_C_REGS |
1447 | /* Pop the extra iret frame at once */ | 1531 | |
1532 | /* Point RSP at the "iret" frame. */ | ||
1448 | REMOVE_PT_GPREGS_FROM_STACK 6*8 | 1533 | REMOVE_PT_GPREGS_FROM_STACK 6*8 |
1449 | 1534 | ||
1450 | /* Clear the NMI executing stack variable */ | 1535 | /* |
1451 | movq $0, 5*8(%rsp) | 1536 | * Clear "NMI executing". Set DF first so that we can easily |
1537 | * distinguish the remaining code between here and IRET from | ||
1538 | * the SYSCALL entry and exit paths. On a native kernel, we | ||
1539 | * could just inspect RIP, but, on paravirt kernels, | ||
1540 | * INTERRUPT_RETURN can translate into a jump into a | ||
1541 | * hypercall page. | ||
1542 | */ | ||
1543 | std | ||
1544 | movq $0, 5*8(%rsp) /* clear "NMI executing" */ | ||
1545 | |||
1546 | /* | ||
1547 | * INTERRUPT_RETURN reads the "iret" frame and exits the NMI | ||
1548 | * stack in a single instruction. We are returning to kernel | ||
1549 | * mode, so this cannot result in a fault. | ||
1550 | */ | ||
1452 | INTERRUPT_RETURN | 1551 | INTERRUPT_RETURN |
1453 | END(nmi) | 1552 | END(nmi) |
1454 | 1553 | ||
diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S index bb187a6a877c..5a1844765a7a 100644 --- a/arch/x86/entry/entry_64_compat.S +++ b/arch/x86/entry/entry_64_compat.S | |||
@@ -205,7 +205,6 @@ sysexit_from_sys_call: | |||
205 | movl RDX(%rsp), %edx /* arg3 */ | 205 | movl RDX(%rsp), %edx /* arg3 */ |
206 | movl RSI(%rsp), %ecx /* arg4 */ | 206 | movl RSI(%rsp), %ecx /* arg4 */ |
207 | movl RDI(%rsp), %r8d /* arg5 */ | 207 | movl RDI(%rsp), %r8d /* arg5 */ |
208 | movl %ebp, %r9d /* arg6 */ | ||
209 | .endm | 208 | .endm |
210 | 209 | ||
211 | .macro auditsys_exit exit | 210 | .macro auditsys_exit exit |
@@ -236,6 +235,7 @@ sysexit_from_sys_call: | |||
236 | 235 | ||
237 | sysenter_auditsys: | 236 | sysenter_auditsys: |
238 | auditsys_entry_common | 237 | auditsys_entry_common |
238 | movl %ebp, %r9d /* reload 6th syscall arg */ | ||
239 | jmp sysenter_dispatch | 239 | jmp sysenter_dispatch |
240 | 240 | ||
241 | sysexit_audit: | 241 | sysexit_audit: |
@@ -336,7 +336,7 @@ ENTRY(entry_SYSCALL_compat) | |||
336 | * 32-bit zero extended: | 336 | * 32-bit zero extended: |
337 | */ | 337 | */ |
338 | ASM_STAC | 338 | ASM_STAC |
339 | 1: movl (%r8), %ebp | 339 | 1: movl (%r8), %r9d |
340 | _ASM_EXTABLE(1b, ia32_badarg) | 340 | _ASM_EXTABLE(1b, ia32_badarg) |
341 | ASM_CLAC | 341 | ASM_CLAC |
342 | orl $TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) | 342 | orl $TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) |
@@ -346,7 +346,7 @@ ENTRY(entry_SYSCALL_compat) | |||
346 | cstar_do_call: | 346 | cstar_do_call: |
347 | /* 32-bit syscall -> 64-bit C ABI argument conversion */ | 347 | /* 32-bit syscall -> 64-bit C ABI argument conversion */ |
348 | movl %edi, %r8d /* arg5 */ | 348 | movl %edi, %r8d /* arg5 */ |
349 | movl %ebp, %r9d /* arg6 */ | 349 | /* r9 already loaded */ /* arg6 */ |
350 | xchg %ecx, %esi /* rsi:arg2, rcx:arg4 */ | 350 | xchg %ecx, %esi /* rsi:arg2, rcx:arg4 */ |
351 | movl %ebx, %edi /* arg1 */ | 351 | movl %ebx, %edi /* arg1 */ |
352 | movl %edx, %edx /* arg3 (zero extension) */ | 352 | movl %edx, %edx /* arg3 (zero extension) */ |
@@ -358,7 +358,6 @@ cstar_dispatch: | |||
358 | call *ia32_sys_call_table(, %rax, 8) | 358 | call *ia32_sys_call_table(, %rax, 8) |
359 | movq %rax, RAX(%rsp) | 359 | movq %rax, RAX(%rsp) |
360 | 1: | 360 | 1: |
361 | movl RCX(%rsp), %ebp | ||
362 | DISABLE_INTERRUPTS(CLBR_NONE) | 361 | DISABLE_INTERRUPTS(CLBR_NONE) |
363 | TRACE_IRQS_OFF | 362 | TRACE_IRQS_OFF |
364 | testl $_TIF_ALLWORK_MASK, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) | 363 | testl $_TIF_ALLWORK_MASK, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
@@ -392,7 +391,9 @@ sysretl_from_sys_call: | |||
392 | 391 | ||
393 | #ifdef CONFIG_AUDITSYSCALL | 392 | #ifdef CONFIG_AUDITSYSCALL |
394 | cstar_auditsys: | 393 | cstar_auditsys: |
394 | movl %r9d, R9(%rsp) /* register to be clobbered by call */ | ||
395 | auditsys_entry_common | 395 | auditsys_entry_common |
396 | movl R9(%rsp), %r9d /* reload 6th syscall arg */ | ||
396 | jmp cstar_dispatch | 397 | jmp cstar_dispatch |
397 | 398 | ||
398 | sysretl_audit: | 399 | sysretl_audit: |
@@ -404,14 +405,16 @@ cstar_tracesys: | |||
404 | testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT), ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) | 405 | testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT), ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
405 | jz cstar_auditsys | 406 | jz cstar_auditsys |
406 | #endif | 407 | #endif |
408 | xchgl %r9d, %ebp | ||
407 | SAVE_EXTRA_REGS | 409 | SAVE_EXTRA_REGS |
408 | xorl %eax, %eax /* Do not leak kernel information */ | 410 | xorl %eax, %eax /* Do not leak kernel information */ |
409 | movq %rax, R11(%rsp) | 411 | movq %rax, R11(%rsp) |
410 | movq %rax, R10(%rsp) | 412 | movq %rax, R10(%rsp) |
411 | movq %rax, R9(%rsp) | 413 | movq %r9, R9(%rsp) |
412 | movq %rax, R8(%rsp) | 414 | movq %rax, R8(%rsp) |
413 | movq %rsp, %rdi /* &pt_regs -> arg1 */ | 415 | movq %rsp, %rdi /* &pt_regs -> arg1 */ |
414 | call syscall_trace_enter | 416 | call syscall_trace_enter |
417 | movl R9(%rsp), %r9d | ||
415 | 418 | ||
416 | /* Reload arg registers from stack. (see sysenter_tracesys) */ | 419 | /* Reload arg registers from stack. (see sysenter_tracesys) */ |
417 | movl RCX(%rsp), %ecx | 420 | movl RCX(%rsp), %ecx |
@@ -421,6 +424,7 @@ cstar_tracesys: | |||
421 | movl %eax, %eax /* zero extension */ | 424 | movl %eax, %eax /* zero extension */ |
422 | 425 | ||
423 | RESTORE_EXTRA_REGS | 426 | RESTORE_EXTRA_REGS |
427 | xchgl %ebp, %r9d | ||
424 | jmp cstar_do_call | 428 | jmp cstar_do_call |
425 | END(entry_SYSCALL_compat) | 429 | END(entry_SYSCALL_compat) |
426 | 430 | ||
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild index 4dd1f2d770af..aeac434c9feb 100644 --- a/arch/x86/include/asm/Kbuild +++ b/arch/x86/include/asm/Kbuild | |||
@@ -9,3 +9,4 @@ generic-y += cputime.h | |||
9 | generic-y += dma-contiguous.h | 9 | generic-y += dma-contiguous.h |
10 | generic-y += early_ioremap.h | 10 | generic-y += early_ioremap.h |
11 | generic-y += mcs_spinlock.h | 11 | generic-y += mcs_spinlock.h |
12 | generic-y += mm-arch-hooks.h | ||
diff --git a/arch/x86/include/asm/espfix.h b/arch/x86/include/asm/espfix.h index 99efebb2f69d..ca3ce9ab9385 100644 --- a/arch/x86/include/asm/espfix.h +++ b/arch/x86/include/asm/espfix.h | |||
@@ -9,7 +9,7 @@ DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_stack); | |||
9 | DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_waddr); | 9 | DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_waddr); |
10 | 10 | ||
11 | extern void init_espfix_bsp(void); | 11 | extern void init_espfix_bsp(void); |
12 | extern void init_espfix_ap(void); | 12 | extern void init_espfix_ap(int cpu); |
13 | 13 | ||
14 | #endif /* CONFIG_X86_64 */ | 14 | #endif /* CONFIG_X86_64 */ |
15 | 15 | ||
diff --git a/arch/x86/include/asm/fpu/types.h b/arch/x86/include/asm/fpu/types.h index 0637826292de..c49c5173158e 100644 --- a/arch/x86/include/asm/fpu/types.h +++ b/arch/x86/include/asm/fpu/types.h | |||
@@ -189,6 +189,7 @@ union fpregs_state { | |||
189 | struct fxregs_state fxsave; | 189 | struct fxregs_state fxsave; |
190 | struct swregs_state soft; | 190 | struct swregs_state soft; |
191 | struct xregs_state xsave; | 191 | struct xregs_state xsave; |
192 | u8 __padding[PAGE_SIZE]; | ||
192 | }; | 193 | }; |
193 | 194 | ||
194 | /* | 195 | /* |
@@ -198,40 +199,6 @@ union fpregs_state { | |||
198 | */ | 199 | */ |
199 | struct fpu { | 200 | struct fpu { |
200 | /* | 201 | /* |
201 | * @state: | ||
202 | * | ||
203 | * In-memory copy of all FPU registers that we save/restore | ||
204 | * over context switches. If the task is using the FPU then | ||
205 | * the registers in the FPU are more recent than this state | ||
206 | * copy. If the task context-switches away then they get | ||
207 | * saved here and represent the FPU state. | ||
208 | * | ||
209 | * After context switches there may be a (short) time period | ||
210 | * during which the in-FPU hardware registers are unchanged | ||
211 | * and still perfectly match this state, if the tasks | ||
212 | * scheduled afterwards are not using the FPU. | ||
213 | * | ||
214 | * This is the 'lazy restore' window of optimization, which | ||
215 | * we track though 'fpu_fpregs_owner_ctx' and 'fpu->last_cpu'. | ||
216 | * | ||
217 | * We detect whether a subsequent task uses the FPU via setting | ||
218 | * CR0::TS to 1, which causes any FPU use to raise a #NM fault. | ||
219 | * | ||
220 | * During this window, if the task gets scheduled again, we | ||
221 | * might be able to skip having to do a restore from this | ||
222 | * memory buffer to the hardware registers - at the cost of | ||
223 | * incurring the overhead of #NM fault traps. | ||
224 | * | ||
225 | * Note that on modern CPUs that support the XSAVEOPT (or other | ||
226 | * optimized XSAVE instructions), we don't use #NM traps anymore, | ||
227 | * as the hardware can track whether FPU registers need saving | ||
228 | * or not. On such CPUs we activate the non-lazy ('eagerfpu') | ||
229 | * logic, which unconditionally saves/restores all FPU state | ||
230 | * across context switches. (if FPU state exists.) | ||
231 | */ | ||
232 | union fpregs_state state; | ||
233 | |||
234 | /* | ||
235 | * @last_cpu: | 202 | * @last_cpu: |
236 | * | 203 | * |
237 | * Records the last CPU on which this context was loaded into | 204 | * Records the last CPU on which this context was loaded into |
@@ -288,6 +255,43 @@ struct fpu { | |||
288 | * deal with bursty apps that only use the FPU for a short time: | 255 | * deal with bursty apps that only use the FPU for a short time: |
289 | */ | 256 | */ |
290 | unsigned char counter; | 257 | unsigned char counter; |
258 | /* | ||
259 | * @state: | ||
260 | * | ||
261 | * In-memory copy of all FPU registers that we save/restore | ||
262 | * over context switches. If the task is using the FPU then | ||
263 | * the registers in the FPU are more recent than this state | ||
264 | * copy. If the task context-switches away then they get | ||
265 | * saved here and represent the FPU state. | ||
266 | * | ||
267 | * After context switches there may be a (short) time period | ||
268 | * during which the in-FPU hardware registers are unchanged | ||
269 | * and still perfectly match this state, if the tasks | ||
270 | * scheduled afterwards are not using the FPU. | ||
271 | * | ||
272 | * This is the 'lazy restore' window of optimization, which | ||
273 | * we track though 'fpu_fpregs_owner_ctx' and 'fpu->last_cpu'. | ||
274 | * | ||
275 | * We detect whether a subsequent task uses the FPU via setting | ||
276 | * CR0::TS to 1, which causes any FPU use to raise a #NM fault. | ||
277 | * | ||
278 | * During this window, if the task gets scheduled again, we | ||
279 | * might be able to skip having to do a restore from this | ||
280 | * memory buffer to the hardware registers - at the cost of | ||
281 | * incurring the overhead of #NM fault traps. | ||
282 | * | ||
283 | * Note that on modern CPUs that support the XSAVEOPT (or other | ||
284 | * optimized XSAVE instructions), we don't use #NM traps anymore, | ||
285 | * as the hardware can track whether FPU registers need saving | ||
286 | * or not. On such CPUs we activate the non-lazy ('eagerfpu') | ||
287 | * logic, which unconditionally saves/restores all FPU state | ||
288 | * across context switches. (if FPU state exists.) | ||
289 | */ | ||
290 | union fpregs_state state; | ||
291 | /* | ||
292 | * WARNING: 'state' is dynamically-sized. Do not put | ||
293 | * anything after it here. | ||
294 | */ | ||
291 | }; | 295 | }; |
292 | 296 | ||
293 | #endif /* _ASM_X86_FPU_H */ | 297 | #endif /* _ASM_X86_FPU_H */ |
diff --git a/arch/x86/include/asm/intel_pmc_ipc.h b/arch/x86/include/asm/intel_pmc_ipc.h index 200ec2e7821d..cd0310e186f4 100644 --- a/arch/x86/include/asm/intel_pmc_ipc.h +++ b/arch/x86/include/asm/intel_pmc_ipc.h | |||
@@ -25,36 +25,9 @@ | |||
25 | 25 | ||
26 | #if IS_ENABLED(CONFIG_INTEL_PMC_IPC) | 26 | #if IS_ENABLED(CONFIG_INTEL_PMC_IPC) |
27 | 27 | ||
28 | /* | ||
29 | * intel_pmc_ipc_simple_command | ||
30 | * @cmd: command | ||
31 | * @sub: sub type | ||
32 | */ | ||
33 | int intel_pmc_ipc_simple_command(int cmd, int sub); | 28 | int intel_pmc_ipc_simple_command(int cmd, int sub); |
34 | |||
35 | /* | ||
36 | * intel_pmc_ipc_raw_cmd | ||
37 | * @cmd: command | ||
38 | * @sub: sub type | ||
39 | * @in: input data | ||
40 | * @inlen: input length in bytes | ||
41 | * @out: output data | ||
42 | * @outlen: output length in dwords | ||
43 | * @sptr: data writing to SPTR register | ||
44 | * @dptr: data writing to DPTR register | ||
45 | */ | ||
46 | int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen, | 29 | int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen, |
47 | u32 *out, u32 outlen, u32 dptr, u32 sptr); | 30 | u32 *out, u32 outlen, u32 dptr, u32 sptr); |
48 | |||
49 | /* | ||
50 | * intel_pmc_ipc_command | ||
51 | * @cmd: command | ||
52 | * @sub: sub type | ||
53 | * @in: input data | ||
54 | * @inlen: input length in bytes | ||
55 | * @out: output data | ||
56 | * @outlen: output length in dwords | ||
57 | */ | ||
58 | int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen, | 31 | int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen, |
59 | u32 *out, u32 outlen); | 32 | u32 *out, u32 outlen); |
60 | 33 | ||
diff --git a/arch/x86/include/asm/kasan.h b/arch/x86/include/asm/kasan.h index 8b22422fbad8..74a2a8dc9908 100644 --- a/arch/x86/include/asm/kasan.h +++ b/arch/x86/include/asm/kasan.h | |||
@@ -14,15 +14,11 @@ | |||
14 | 14 | ||
15 | #ifndef __ASSEMBLY__ | 15 | #ifndef __ASSEMBLY__ |
16 | 16 | ||
17 | extern pte_t kasan_zero_pte[]; | ||
18 | extern pte_t kasan_zero_pmd[]; | ||
19 | extern pte_t kasan_zero_pud[]; | ||
20 | |||
21 | #ifdef CONFIG_KASAN | 17 | #ifdef CONFIG_KASAN |
22 | void __init kasan_map_early_shadow(pgd_t *pgd); | 18 | void __init kasan_early_init(void); |
23 | void __init kasan_init(void); | 19 | void __init kasan_init(void); |
24 | #else | 20 | #else |
25 | static inline void kasan_map_early_shadow(pgd_t *pgd) { } | 21 | static inline void kasan_early_init(void) { } |
26 | static inline void kasan_init(void) { } | 22 | static inline void kasan_init(void) { } |
27 | #endif | 23 | #endif |
28 | 24 | ||
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 2a7f5d782c33..49ec9038ec14 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -604,6 +604,8 @@ struct kvm_arch { | |||
604 | bool iommu_noncoherent; | 604 | bool iommu_noncoherent; |
605 | #define __KVM_HAVE_ARCH_NONCOHERENT_DMA | 605 | #define __KVM_HAVE_ARCH_NONCOHERENT_DMA |
606 | atomic_t noncoherent_dma_count; | 606 | atomic_t noncoherent_dma_count; |
607 | #define __KVM_HAVE_ARCH_ASSIGNED_DEVICE | ||
608 | atomic_t assigned_device_count; | ||
607 | struct kvm_pic *vpic; | 609 | struct kvm_pic *vpic; |
608 | struct kvm_ioapic *vioapic; | 610 | struct kvm_ioapic *vioapic; |
609 | struct kvm_pit *vpit; | 611 | struct kvm_pit *vpit; |
diff --git a/arch/x86/include/asm/mm-arch-hooks.h b/arch/x86/include/asm/mm-arch-hooks.h deleted file mode 100644 index 4e881a342236..000000000000 --- a/arch/x86/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_X86_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_X86_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_X86_MM_ARCH_HOOKS_H */ | ||
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h index 5e8daee7c5c9..804a3a6030ca 100644 --- a/arch/x86/include/asm/mmu_context.h +++ b/arch/x86/include/asm/mmu_context.h | |||
@@ -23,7 +23,7 @@ extern struct static_key rdpmc_always_available; | |||
23 | 23 | ||
24 | static inline void load_mm_cr4(struct mm_struct *mm) | 24 | static inline void load_mm_cr4(struct mm_struct *mm) |
25 | { | 25 | { |
26 | if (static_key_true(&rdpmc_always_available) || | 26 | if (static_key_false(&rdpmc_always_available) || |
27 | atomic_read(&mm->context.perf_rdpmc_allowed)) | 27 | atomic_read(&mm->context.perf_rdpmc_allowed)) |
28 | cr4_set_bits(X86_CR4_PCE); | 28 | cr4_set_bits(X86_CR4_PCE); |
29 | else | 29 | else |
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 43e6519df0d5..944f1785ed0d 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -390,9 +390,6 @@ struct thread_struct { | |||
390 | #endif | 390 | #endif |
391 | unsigned long gs; | 391 | unsigned long gs; |
392 | 392 | ||
393 | /* Floating point and extended processor state */ | ||
394 | struct fpu fpu; | ||
395 | |||
396 | /* Save middle states of ptrace breakpoints */ | 393 | /* Save middle states of ptrace breakpoints */ |
397 | struct perf_event *ptrace_bps[HBP_NUM]; | 394 | struct perf_event *ptrace_bps[HBP_NUM]; |
398 | /* Debug status used for traps, single steps, etc... */ | 395 | /* Debug status used for traps, single steps, etc... */ |
@@ -418,6 +415,13 @@ struct thread_struct { | |||
418 | unsigned long iopl; | 415 | unsigned long iopl; |
419 | /* Max allowed port in the bitmap, in bytes: */ | 416 | /* Max allowed port in the bitmap, in bytes: */ |
420 | unsigned io_bitmap_max; | 417 | unsigned io_bitmap_max; |
418 | |||
419 | /* Floating point and extended processor state */ | ||
420 | struct fpu fpu; | ||
421 | /* | ||
422 | * WARNING: 'fpu' is dynamically-sized. It *MUST* be at | ||
423 | * the end. | ||
424 | */ | ||
421 | }; | 425 | }; |
422 | 426 | ||
423 | /* | 427 | /* |
diff --git a/arch/x86/include/uapi/asm/hyperv.h b/arch/x86/include/uapi/asm/hyperv.h index 8fba544e9cc4..f36d56bd7632 100644 --- a/arch/x86/include/uapi/asm/hyperv.h +++ b/arch/x86/include/uapi/asm/hyperv.h | |||
@@ -108,6 +108,8 @@ | |||
108 | #define HV_X64_HYPERCALL_PARAMS_XMM_AVAILABLE (1 << 4) | 108 | #define HV_X64_HYPERCALL_PARAMS_XMM_AVAILABLE (1 << 4) |
109 | /* Support for a virtual guest idle state is available */ | 109 | /* Support for a virtual guest idle state is available */ |
110 | #define HV_X64_GUEST_IDLE_STATE_AVAILABLE (1 << 5) | 110 | #define HV_X64_GUEST_IDLE_STATE_AVAILABLE (1 << 5) |
111 | /* Guest crash data handler available */ | ||
112 | #define HV_X64_GUEST_CRASH_MSR_AVAILABLE (1 << 10) | ||
111 | 113 | ||
112 | /* | 114 | /* |
113 | * Implementation recommendations. Indicates which behaviors the hypervisor | 115 | * Implementation recommendations. Indicates which behaviors the hypervisor |
diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h index a4ae82eb82aa..cd54147cb365 100644 --- a/arch/x86/include/uapi/asm/kvm.h +++ b/arch/x86/include/uapi/asm/kvm.h | |||
@@ -354,7 +354,7 @@ struct kvm_xcrs { | |||
354 | struct kvm_sync_regs { | 354 | struct kvm_sync_regs { |
355 | }; | 355 | }; |
356 | 356 | ||
357 | #define KVM_QUIRK_LINT0_REENABLED (1 << 0) | 357 | #define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0) |
358 | #define KVM_QUIRK_CD_NW_CLEARED (1 << 1) | 358 | #define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1) |
359 | 359 | ||
360 | #endif /* _ASM_X86_KVM_H */ | 360 | #endif /* _ASM_X86_KVM_H */ |
diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c index 28eba2d38b15..f813261d9740 100644 --- a/arch/x86/kernel/apic/vector.c +++ b/arch/x86/kernel/apic/vector.c | |||
@@ -409,12 +409,6 @@ static void __setup_vector_irq(int cpu) | |||
409 | int irq, vector; | 409 | int irq, vector; |
410 | struct apic_chip_data *data; | 410 | struct apic_chip_data *data; |
411 | 411 | ||
412 | /* | ||
413 | * vector_lock will make sure that we don't run into irq vector | ||
414 | * assignments that might be happening on another cpu in parallel, | ||
415 | * while we setup our initial vector to irq mappings. | ||
416 | */ | ||
417 | raw_spin_lock(&vector_lock); | ||
418 | /* Mark the inuse vectors */ | 412 | /* Mark the inuse vectors */ |
419 | for_each_active_irq(irq) { | 413 | for_each_active_irq(irq) { |
420 | data = apic_chip_data(irq_get_irq_data(irq)); | 414 | data = apic_chip_data(irq_get_irq_data(irq)); |
@@ -436,16 +430,16 @@ static void __setup_vector_irq(int cpu) | |||
436 | if (!cpumask_test_cpu(cpu, data->domain)) | 430 | if (!cpumask_test_cpu(cpu, data->domain)) |
437 | per_cpu(vector_irq, cpu)[vector] = VECTOR_UNDEFINED; | 431 | per_cpu(vector_irq, cpu)[vector] = VECTOR_UNDEFINED; |
438 | } | 432 | } |
439 | raw_spin_unlock(&vector_lock); | ||
440 | } | 433 | } |
441 | 434 | ||
442 | /* | 435 | /* |
443 | * Setup the vector to irq mappings. | 436 | * Setup the vector to irq mappings. Must be called with vector_lock held. |
444 | */ | 437 | */ |
445 | void setup_vector_irq(int cpu) | 438 | void setup_vector_irq(int cpu) |
446 | { | 439 | { |
447 | int irq; | 440 | int irq; |
448 | 441 | ||
442 | lockdep_assert_held(&vector_lock); | ||
449 | /* | 443 | /* |
450 | * On most of the platforms, legacy PIC delivers the interrupts on the | 444 | * On most of the platforms, legacy PIC delivers the interrupts on the |
451 | * boot cpu. But there are certain platforms where PIC interrupts are | 445 | * boot cpu. But there are certain platforms where PIC interrupts are |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_cqm.c b/arch/x86/kernel/cpu/perf_event_intel_cqm.c index 188076161c1b..63eb68b73589 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_cqm.c +++ b/arch/x86/kernel/cpu/perf_event_intel_cqm.c | |||
@@ -952,6 +952,14 @@ static u64 intel_cqm_event_count(struct perf_event *event) | |||
952 | return 0; | 952 | return 0; |
953 | 953 | ||
954 | /* | 954 | /* |
955 | * Getting up-to-date values requires an SMP IPI which is not | ||
956 | * possible if we're being called in interrupt context. Return | ||
957 | * the cached values instead. | ||
958 | */ | ||
959 | if (unlikely(in_interrupt())) | ||
960 | goto out; | ||
961 | |||
962 | /* | ||
955 | * Notice that we don't perform the reading of an RMID | 963 | * Notice that we don't perform the reading of an RMID |
956 | * atomically, because we can't hold a spin lock across the | 964 | * atomically, because we can't hold a spin lock across the |
957 | * IPIs. | 965 | * IPIs. |
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c index 89427d8d4fc5..eec40f595ab9 100644 --- a/arch/x86/kernel/early_printk.c +++ b/arch/x86/kernel/early_printk.c | |||
@@ -175,7 +175,9 @@ static __init void early_serial_init(char *s) | |||
175 | } | 175 | } |
176 | 176 | ||
177 | if (*s) { | 177 | if (*s) { |
178 | if (kstrtoul(s, 0, &baud) < 0 || baud == 0) | 178 | baud = simple_strtoull(s, &e, 0); |
179 | |||
180 | if (baud == 0 || s == e) | ||
179 | baud = DEFAULT_BAUD; | 181 | baud = DEFAULT_BAUD; |
180 | } | 182 | } |
181 | 183 | ||
diff --git a/arch/x86/kernel/espfix_64.c b/arch/x86/kernel/espfix_64.c index f5d0730e7b08..ce95676abd60 100644 --- a/arch/x86/kernel/espfix_64.c +++ b/arch/x86/kernel/espfix_64.c | |||
@@ -131,25 +131,24 @@ void __init init_espfix_bsp(void) | |||
131 | init_espfix_random(); | 131 | init_espfix_random(); |
132 | 132 | ||
133 | /* The rest is the same as for any other processor */ | 133 | /* The rest is the same as for any other processor */ |
134 | init_espfix_ap(); | 134 | init_espfix_ap(0); |
135 | } | 135 | } |
136 | 136 | ||
137 | void init_espfix_ap(void) | 137 | void init_espfix_ap(int cpu) |
138 | { | 138 | { |
139 | unsigned int cpu, page; | 139 | unsigned int page; |
140 | unsigned long addr; | 140 | unsigned long addr; |
141 | pud_t pud, *pud_p; | 141 | pud_t pud, *pud_p; |
142 | pmd_t pmd, *pmd_p; | 142 | pmd_t pmd, *pmd_p; |
143 | pte_t pte, *pte_p; | 143 | pte_t pte, *pte_p; |
144 | int n; | 144 | int n, node; |
145 | void *stack_page; | 145 | void *stack_page; |
146 | pteval_t ptemask; | 146 | pteval_t ptemask; |
147 | 147 | ||
148 | /* We only have to do this once... */ | 148 | /* We only have to do this once... */ |
149 | if (likely(this_cpu_read(espfix_stack))) | 149 | if (likely(per_cpu(espfix_stack, cpu))) |
150 | return; /* Already initialized */ | 150 | return; /* Already initialized */ |
151 | 151 | ||
152 | cpu = smp_processor_id(); | ||
153 | addr = espfix_base_addr(cpu); | 152 | addr = espfix_base_addr(cpu); |
154 | page = cpu/ESPFIX_STACKS_PER_PAGE; | 153 | page = cpu/ESPFIX_STACKS_PER_PAGE; |
155 | 154 | ||
@@ -165,12 +164,15 @@ void init_espfix_ap(void) | |||
165 | if (stack_page) | 164 | if (stack_page) |
166 | goto unlock_done; | 165 | goto unlock_done; |
167 | 166 | ||
167 | node = cpu_to_node(cpu); | ||
168 | ptemask = __supported_pte_mask; | 168 | ptemask = __supported_pte_mask; |
169 | 169 | ||
170 | pud_p = &espfix_pud_page[pud_index(addr)]; | 170 | pud_p = &espfix_pud_page[pud_index(addr)]; |
171 | pud = *pud_p; | 171 | pud = *pud_p; |
172 | if (!pud_present(pud)) { | 172 | if (!pud_present(pud)) { |
173 | pmd_p = (pmd_t *)__get_free_page(PGALLOC_GFP); | 173 | struct page *page = alloc_pages_node(node, PGALLOC_GFP, 0); |
174 | |||
175 | pmd_p = (pmd_t *)page_address(page); | ||
174 | pud = __pud(__pa(pmd_p) | (PGTABLE_PROT & ptemask)); | 176 | pud = __pud(__pa(pmd_p) | (PGTABLE_PROT & ptemask)); |
175 | paravirt_alloc_pmd(&init_mm, __pa(pmd_p) >> PAGE_SHIFT); | 177 | paravirt_alloc_pmd(&init_mm, __pa(pmd_p) >> PAGE_SHIFT); |
176 | for (n = 0; n < ESPFIX_PUD_CLONES; n++) | 178 | for (n = 0; n < ESPFIX_PUD_CLONES; n++) |
@@ -180,7 +182,9 @@ void init_espfix_ap(void) | |||
180 | pmd_p = pmd_offset(&pud, addr); | 182 | pmd_p = pmd_offset(&pud, addr); |
181 | pmd = *pmd_p; | 183 | pmd = *pmd_p; |
182 | if (!pmd_present(pmd)) { | 184 | if (!pmd_present(pmd)) { |
183 | pte_p = (pte_t *)__get_free_page(PGALLOC_GFP); | 185 | struct page *page = alloc_pages_node(node, PGALLOC_GFP, 0); |
186 | |||
187 | pte_p = (pte_t *)page_address(page); | ||
184 | pmd = __pmd(__pa(pte_p) | (PGTABLE_PROT & ptemask)); | 188 | pmd = __pmd(__pa(pte_p) | (PGTABLE_PROT & ptemask)); |
185 | paravirt_alloc_pte(&init_mm, __pa(pte_p) >> PAGE_SHIFT); | 189 | paravirt_alloc_pte(&init_mm, __pa(pte_p) >> PAGE_SHIFT); |
186 | for (n = 0; n < ESPFIX_PMD_CLONES; n++) | 190 | for (n = 0; n < ESPFIX_PMD_CLONES; n++) |
@@ -188,7 +192,7 @@ void init_espfix_ap(void) | |||
188 | } | 192 | } |
189 | 193 | ||
190 | pte_p = pte_offset_kernel(&pmd, addr); | 194 | pte_p = pte_offset_kernel(&pmd, addr); |
191 | stack_page = (void *)__get_free_page(GFP_KERNEL); | 195 | stack_page = page_address(alloc_pages_node(node, GFP_KERNEL, 0)); |
192 | pte = __pte(__pa(stack_page) | (__PAGE_KERNEL_RO & ptemask)); | 196 | pte = __pte(__pa(stack_page) | (__PAGE_KERNEL_RO & ptemask)); |
193 | for (n = 0; n < ESPFIX_PTE_CLONES; n++) | 197 | for (n = 0; n < ESPFIX_PTE_CLONES; n++) |
194 | set_pte(&pte_p[n*PTE_STRIDE], pte); | 198 | set_pte(&pte_p[n*PTE_STRIDE], pte); |
@@ -199,7 +203,7 @@ void init_espfix_ap(void) | |||
199 | unlock_done: | 203 | unlock_done: |
200 | mutex_unlock(&espfix_init_mutex); | 204 | mutex_unlock(&espfix_init_mutex); |
201 | done: | 205 | done: |
202 | this_cpu_write(espfix_stack, addr); | 206 | per_cpu(espfix_stack, cpu) = addr; |
203 | this_cpu_write(espfix_waddr, (unsigned long)stack_page | 207 | per_cpu(espfix_waddr, cpu) = (unsigned long)stack_page |
204 | + (addr & ~PAGE_MASK)); | 208 | + (addr & ~PAGE_MASK); |
205 | } | 209 | } |
diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c index 32826791e675..1e173f6285c7 100644 --- a/arch/x86/kernel/fpu/init.c +++ b/arch/x86/kernel/fpu/init.c | |||
@@ -4,6 +4,8 @@ | |||
4 | #include <asm/fpu/internal.h> | 4 | #include <asm/fpu/internal.h> |
5 | #include <asm/tlbflush.h> | 5 | #include <asm/tlbflush.h> |
6 | 6 | ||
7 | #include <linux/sched.h> | ||
8 | |||
7 | /* | 9 | /* |
8 | * Initialize the TS bit in CR0 according to the style of context-switches | 10 | * Initialize the TS bit in CR0 according to the style of context-switches |
9 | * we are using: | 11 | * we are using: |
@@ -136,6 +138,43 @@ static void __init fpu__init_system_generic(void) | |||
136 | unsigned int xstate_size; | 138 | unsigned int xstate_size; |
137 | EXPORT_SYMBOL_GPL(xstate_size); | 139 | EXPORT_SYMBOL_GPL(xstate_size); |
138 | 140 | ||
141 | /* Enforce that 'MEMBER' is the last field of 'TYPE': */ | ||
142 | #define CHECK_MEMBER_AT_END_OF(TYPE, MEMBER) \ | ||
143 | BUILD_BUG_ON(sizeof(TYPE) != offsetofend(TYPE, MEMBER)) | ||
144 | |||
145 | /* | ||
146 | * We append the 'struct fpu' to the task_struct: | ||
147 | */ | ||
148 | static void __init fpu__init_task_struct_size(void) | ||
149 | { | ||
150 | int task_size = sizeof(struct task_struct); | ||
151 | |||
152 | /* | ||
153 | * Subtract off the static size of the register state. | ||
154 | * It potentially has a bunch of padding. | ||
155 | */ | ||
156 | task_size -= sizeof(((struct task_struct *)0)->thread.fpu.state); | ||
157 | |||
158 | /* | ||
159 | * Add back the dynamically-calculated register state | ||
160 | * size. | ||
161 | */ | ||
162 | task_size += xstate_size; | ||
163 | |||
164 | /* | ||
165 | * We dynamically size 'struct fpu', so we require that | ||
166 | * it be at the end of 'thread_struct' and that | ||
167 | * 'thread_struct' be at the end of 'task_struct'. If | ||
168 | * you hit a compile error here, check the structure to | ||
169 | * see if something got added to the end. | ||
170 | */ | ||
171 | CHECK_MEMBER_AT_END_OF(struct fpu, state); | ||
172 | CHECK_MEMBER_AT_END_OF(struct thread_struct, fpu); | ||
173 | CHECK_MEMBER_AT_END_OF(struct task_struct, thread); | ||
174 | |||
175 | arch_task_struct_size = task_size; | ||
176 | } | ||
177 | |||
139 | /* | 178 | /* |
140 | * Set up the xstate_size based on the legacy FPU context size. | 179 | * Set up the xstate_size based on the legacy FPU context size. |
141 | * | 180 | * |
@@ -287,6 +326,7 @@ void __init fpu__init_system(struct cpuinfo_x86 *c) | |||
287 | fpu__init_system_generic(); | 326 | fpu__init_system_generic(); |
288 | fpu__init_system_xstate_size_legacy(); | 327 | fpu__init_system_xstate_size_legacy(); |
289 | fpu__init_system_xstate(); | 328 | fpu__init_system_xstate(); |
329 | fpu__init_task_struct_size(); | ||
290 | 330 | ||
291 | fpu__init_system_ctx_switch(); | 331 | fpu__init_system_ctx_switch(); |
292 | } | 332 | } |
@@ -311,9 +351,15 @@ static int __init x86_noxsave_setup(char *s) | |||
311 | 351 | ||
312 | setup_clear_cpu_cap(X86_FEATURE_XSAVE); | 352 | setup_clear_cpu_cap(X86_FEATURE_XSAVE); |
313 | setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT); | 353 | setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT); |
354 | setup_clear_cpu_cap(X86_FEATURE_XSAVEC); | ||
314 | setup_clear_cpu_cap(X86_FEATURE_XSAVES); | 355 | setup_clear_cpu_cap(X86_FEATURE_XSAVES); |
315 | setup_clear_cpu_cap(X86_FEATURE_AVX); | 356 | setup_clear_cpu_cap(X86_FEATURE_AVX); |
316 | setup_clear_cpu_cap(X86_FEATURE_AVX2); | 357 | setup_clear_cpu_cap(X86_FEATURE_AVX2); |
358 | setup_clear_cpu_cap(X86_FEATURE_AVX512F); | ||
359 | setup_clear_cpu_cap(X86_FEATURE_AVX512PF); | ||
360 | setup_clear_cpu_cap(X86_FEATURE_AVX512ER); | ||
361 | setup_clear_cpu_cap(X86_FEATURE_AVX512CD); | ||
362 | setup_clear_cpu_cap(X86_FEATURE_MPX); | ||
317 | 363 | ||
318 | return 1; | 364 | return 1; |
319 | } | 365 | } |
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 5a4668136e98..f129a9af6357 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c | |||
@@ -161,11 +161,12 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data) | |||
161 | /* Kill off the identity-map trampoline */ | 161 | /* Kill off the identity-map trampoline */ |
162 | reset_early_page_tables(); | 162 | reset_early_page_tables(); |
163 | 163 | ||
164 | kasan_map_early_shadow(early_level4_pgt); | ||
165 | |||
166 | /* clear bss before set_intr_gate with early_idt_handler */ | ||
167 | clear_bss(); | 164 | clear_bss(); |
168 | 165 | ||
166 | clear_page(init_level4_pgt); | ||
167 | |||
168 | kasan_early_init(); | ||
169 | |||
169 | for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) | 170 | for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) |
170 | set_intr_gate(i, early_idt_handler_array[i]); | 171 | set_intr_gate(i, early_idt_handler_array[i]); |
171 | load_idt((const struct desc_ptr *)&idt_descr); | 172 | load_idt((const struct desc_ptr *)&idt_descr); |
@@ -177,12 +178,9 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data) | |||
177 | */ | 178 | */ |
178 | load_ucode_bsp(); | 179 | load_ucode_bsp(); |
179 | 180 | ||
180 | clear_page(init_level4_pgt); | ||
181 | /* set init_level4_pgt kernel high mapping*/ | 181 | /* set init_level4_pgt kernel high mapping*/ |
182 | init_level4_pgt[511] = early_level4_pgt[511]; | 182 | init_level4_pgt[511] = early_level4_pgt[511]; |
183 | 183 | ||
184 | kasan_map_early_shadow(init_level4_pgt); | ||
185 | |||
186 | x86_64_start_reservations(real_mode_data); | 184 | x86_64_start_reservations(real_mode_data); |
187 | } | 185 | } |
188 | 186 | ||
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S index e5c27f729a38..1d40ca8a73f2 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S | |||
@@ -516,38 +516,9 @@ ENTRY(phys_base) | |||
516 | /* This must match the first entry in level2_kernel_pgt */ | 516 | /* This must match the first entry in level2_kernel_pgt */ |
517 | .quad 0x0000000000000000 | 517 | .quad 0x0000000000000000 |
518 | 518 | ||
519 | #ifdef CONFIG_KASAN | ||
520 | #define FILL(VAL, COUNT) \ | ||
521 | .rept (COUNT) ; \ | ||
522 | .quad (VAL) ; \ | ||
523 | .endr | ||
524 | |||
525 | NEXT_PAGE(kasan_zero_pte) | ||
526 | FILL(kasan_zero_page - __START_KERNEL_map + _KERNPG_TABLE, 512) | ||
527 | NEXT_PAGE(kasan_zero_pmd) | ||
528 | FILL(kasan_zero_pte - __START_KERNEL_map + _KERNPG_TABLE, 512) | ||
529 | NEXT_PAGE(kasan_zero_pud) | ||
530 | FILL(kasan_zero_pmd - __START_KERNEL_map + _KERNPG_TABLE, 512) | ||
531 | |||
532 | #undef FILL | ||
533 | #endif | ||
534 | |||
535 | |||
536 | #include "../../x86/xen/xen-head.S" | 519 | #include "../../x86/xen/xen-head.S" |
537 | 520 | ||
538 | __PAGE_ALIGNED_BSS | 521 | __PAGE_ALIGNED_BSS |
539 | NEXT_PAGE(empty_zero_page) | 522 | NEXT_PAGE(empty_zero_page) |
540 | .skip PAGE_SIZE | 523 | .skip PAGE_SIZE |
541 | 524 | ||
542 | #ifdef CONFIG_KASAN | ||
543 | /* | ||
544 | * This page used as early shadow. We don't use empty_zero_page | ||
545 | * at early stages, stack instrumentation could write some garbage | ||
546 | * to this page. | ||
547 | * Latter we reuse it as zero shadow for large ranges of memory | ||
548 | * that allowed to access, but not instrumented by kasan | ||
549 | * (vmalloc/vmemmap ...). | ||
550 | */ | ||
551 | NEXT_PAGE(kasan_zero_page) | ||
552 | .skip PAGE_SIZE | ||
553 | #endif | ||
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index 88b366487b0e..c7dfe1be784e 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c | |||
@@ -347,14 +347,22 @@ int check_irq_vectors_for_cpu_disable(void) | |||
347 | if (!desc) | 347 | if (!desc) |
348 | continue; | 348 | continue; |
349 | 349 | ||
350 | /* | ||
351 | * Protect against concurrent action removal, | ||
352 | * affinity changes etc. | ||
353 | */ | ||
354 | raw_spin_lock(&desc->lock); | ||
350 | data = irq_desc_get_irq_data(desc); | 355 | data = irq_desc_get_irq_data(desc); |
351 | cpumask_copy(&affinity_new, data->affinity); | 356 | cpumask_copy(&affinity_new, data->affinity); |
352 | cpumask_clear_cpu(this_cpu, &affinity_new); | 357 | cpumask_clear_cpu(this_cpu, &affinity_new); |
353 | 358 | ||
354 | /* Do not count inactive or per-cpu irqs. */ | 359 | /* Do not count inactive or per-cpu irqs. */ |
355 | if (!irq_has_action(irq) || irqd_is_per_cpu(data)) | 360 | if (!irq_has_action(irq) || irqd_is_per_cpu(data)) { |
361 | raw_spin_unlock(&desc->lock); | ||
356 | continue; | 362 | continue; |
363 | } | ||
357 | 364 | ||
365 | raw_spin_unlock(&desc->lock); | ||
358 | /* | 366 | /* |
359 | * A single irq may be mapped to multiple | 367 | * A single irq may be mapped to multiple |
360 | * cpu's vector_irq[] (for example IOAPIC cluster | 368 | * cpu's vector_irq[] (for example IOAPIC cluster |
@@ -385,6 +393,9 @@ int check_irq_vectors_for_cpu_disable(void) | |||
385 | * vector. If the vector is marked in the used vectors | 393 | * vector. If the vector is marked in the used vectors |
386 | * bitmap or an irq is assigned to it, we don't count | 394 | * bitmap or an irq is assigned to it, we don't count |
387 | * it as available. | 395 | * it as available. |
396 | * | ||
397 | * As this is an inaccurate snapshot anyway, we can do | ||
398 | * this w/o holding vector_lock. | ||
388 | */ | 399 | */ |
389 | for (vector = FIRST_EXTERNAL_VECTOR; | 400 | for (vector = FIRST_EXTERNAL_VECTOR; |
390 | vector < first_system_vector; vector++) { | 401 | vector < first_system_vector; vector++) { |
@@ -486,6 +497,11 @@ void fixup_irqs(void) | |||
486 | */ | 497 | */ |
487 | mdelay(1); | 498 | mdelay(1); |
488 | 499 | ||
500 | /* | ||
501 | * We can walk the vector array of this cpu without holding | ||
502 | * vector_lock because the cpu is already marked !online, so | ||
503 | * nothing else will touch it. | ||
504 | */ | ||
489 | for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) { | 505 | for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) { |
490 | unsigned int irr; | 506 | unsigned int irr; |
491 | 507 | ||
@@ -497,9 +513,9 @@ void fixup_irqs(void) | |||
497 | irq = __this_cpu_read(vector_irq[vector]); | 513 | irq = __this_cpu_read(vector_irq[vector]); |
498 | 514 | ||
499 | desc = irq_to_desc(irq); | 515 | desc = irq_to_desc(irq); |
516 | raw_spin_lock(&desc->lock); | ||
500 | data = irq_desc_get_irq_data(desc); | 517 | data = irq_desc_get_irq_data(desc); |
501 | chip = irq_data_get_irq_chip(data); | 518 | chip = irq_data_get_irq_chip(data); |
502 | raw_spin_lock(&desc->lock); | ||
503 | if (chip->irq_retrigger) { | 519 | if (chip->irq_retrigger) { |
504 | chip->irq_retrigger(data); | 520 | chip->irq_retrigger(data); |
505 | __this_cpu_write(vector_irq[vector], VECTOR_RETRIGGERED); | 521 | __this_cpu_write(vector_irq[vector], VECTOR_RETRIGGERED); |
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c index c3e985d1751c..d05bd2e2ee91 100644 --- a/arch/x86/kernel/nmi.c +++ b/arch/x86/kernel/nmi.c | |||
@@ -408,15 +408,15 @@ static void default_do_nmi(struct pt_regs *regs) | |||
408 | NOKPROBE_SYMBOL(default_do_nmi); | 408 | NOKPROBE_SYMBOL(default_do_nmi); |
409 | 409 | ||
410 | /* | 410 | /* |
411 | * NMIs can hit breakpoints which will cause it to lose its | 411 | * NMIs can page fault or hit breakpoints which will cause it to lose |
412 | * NMI context with the CPU when the breakpoint does an iret. | 412 | * its NMI context with the CPU when the breakpoint or page fault does an IRET. |
413 | */ | 413 | * |
414 | #ifdef CONFIG_X86_32 | 414 | * As a result, NMIs can nest if NMIs get unmasked due an IRET during |
415 | /* | 415 | * NMI processing. On x86_64, the asm glue protects us from nested NMIs |
416 | * For i386, NMIs use the same stack as the kernel, and we can | 416 | * if the outer NMI came from kernel mode, but we can still nest if the |
417 | * add a workaround to the iret problem in C (preventing nested | 417 | * outer NMI came from user mode. |
418 | * NMIs if an NMI takes a trap). Simply have 3 states the NMI | 418 | * |
419 | * can be in: | 419 | * To handle these nested NMIs, we have three states: |
420 | * | 420 | * |
421 | * 1) not running | 421 | * 1) not running |
422 | * 2) executing | 422 | * 2) executing |
@@ -430,15 +430,14 @@ NOKPROBE_SYMBOL(default_do_nmi); | |||
430 | * (Note, the latch is binary, thus multiple NMIs triggering, | 430 | * (Note, the latch is binary, thus multiple NMIs triggering, |
431 | * when one is running, are ignored. Only one NMI is restarted.) | 431 | * when one is running, are ignored. Only one NMI is restarted.) |
432 | * | 432 | * |
433 | * If an NMI hits a breakpoint that executes an iret, another | 433 | * If an NMI executes an iret, another NMI can preempt it. We do not |
434 | * NMI can preempt it. We do not want to allow this new NMI | 434 | * want to allow this new NMI to run, but we want to execute it when the |
435 | * to run, but we want to execute it when the first one finishes. | 435 | * first one finishes. We set the state to "latched", and the exit of |
436 | * We set the state to "latched", and the exit of the first NMI will | 436 | * the first NMI will perform a dec_return, if the result is zero |
437 | * perform a dec_return, if the result is zero (NOT_RUNNING), then | 437 | * (NOT_RUNNING), then it will simply exit the NMI handler. If not, the |
438 | * it will simply exit the NMI handler. If not, the dec_return | 438 | * dec_return would have set the state to NMI_EXECUTING (what we want it |
439 | * would have set the state to NMI_EXECUTING (what we want it to | 439 | * to be when we are running). In this case, we simply jump back to |
440 | * be when we are running). In this case, we simply jump back | 440 | * rerun the NMI handler again, and restart the 'latched' NMI. |
441 | * to rerun the NMI handler again, and restart the 'latched' NMI. | ||
442 | * | 441 | * |
443 | * No trap (breakpoint or page fault) should be hit before nmi_restart, | 442 | * No trap (breakpoint or page fault) should be hit before nmi_restart, |
444 | * thus there is no race between the first check of state for NOT_RUNNING | 443 | * thus there is no race between the first check of state for NOT_RUNNING |
@@ -461,49 +460,36 @@ enum nmi_states { | |||
461 | static DEFINE_PER_CPU(enum nmi_states, nmi_state); | 460 | static DEFINE_PER_CPU(enum nmi_states, nmi_state); |
462 | static DEFINE_PER_CPU(unsigned long, nmi_cr2); | 461 | static DEFINE_PER_CPU(unsigned long, nmi_cr2); |
463 | 462 | ||
464 | #define nmi_nesting_preprocess(regs) \ | 463 | #ifdef CONFIG_X86_64 |
465 | do { \ | ||
466 | if (this_cpu_read(nmi_state) != NMI_NOT_RUNNING) { \ | ||
467 | this_cpu_write(nmi_state, NMI_LATCHED); \ | ||
468 | return; \ | ||
469 | } \ | ||
470 | this_cpu_write(nmi_state, NMI_EXECUTING); \ | ||
471 | this_cpu_write(nmi_cr2, read_cr2()); \ | ||
472 | } while (0); \ | ||
473 | nmi_restart: | ||
474 | |||
475 | #define nmi_nesting_postprocess() \ | ||
476 | do { \ | ||
477 | if (unlikely(this_cpu_read(nmi_cr2) != read_cr2())) \ | ||
478 | write_cr2(this_cpu_read(nmi_cr2)); \ | ||
479 | if (this_cpu_dec_return(nmi_state)) \ | ||
480 | goto nmi_restart; \ | ||
481 | } while (0) | ||
482 | #else /* x86_64 */ | ||
483 | /* | 464 | /* |
484 | * In x86_64 things are a bit more difficult. This has the same problem | 465 | * In x86_64, we need to handle breakpoint -> NMI -> breakpoint. Without |
485 | * where an NMI hitting a breakpoint that calls iret will remove the | 466 | * some care, the inner breakpoint will clobber the outer breakpoint's |
486 | * NMI context, allowing a nested NMI to enter. What makes this more | 467 | * stack. |
487 | * difficult is that both NMIs and breakpoints have their own stack. | ||
488 | * When a new NMI or breakpoint is executed, the stack is set to a fixed | ||
489 | * point. If an NMI is nested, it will have its stack set at that same | ||
490 | * fixed address that the first NMI had, and will start corrupting the | ||
491 | * stack. This is handled in entry_64.S, but the same problem exists with | ||
492 | * the breakpoint stack. | ||
493 | * | 468 | * |
494 | * If a breakpoint is being processed, and the debug stack is being used, | 469 | * If a breakpoint is being processed, and the debug stack is being |
495 | * if an NMI comes in and also hits a breakpoint, the stack pointer | 470 | * used, if an NMI comes in and also hits a breakpoint, the stack |
496 | * will be set to the same fixed address as the breakpoint that was | 471 | * pointer will be set to the same fixed address as the breakpoint that |
497 | * interrupted, causing that stack to be corrupted. To handle this case, | 472 | * was interrupted, causing that stack to be corrupted. To handle this |
498 | * check if the stack that was interrupted is the debug stack, and if | 473 | * case, check if the stack that was interrupted is the debug stack, and |
499 | * so, change the IDT so that new breakpoints will use the current stack | 474 | * if so, change the IDT so that new breakpoints will use the current |
500 | * and not switch to the fixed address. On return of the NMI, switch back | 475 | * stack and not switch to the fixed address. On return of the NMI, |
501 | * to the original IDT. | 476 | * switch back to the original IDT. |
502 | */ | 477 | */ |
503 | static DEFINE_PER_CPU(int, update_debug_stack); | 478 | static DEFINE_PER_CPU(int, update_debug_stack); |
479 | #endif | ||
504 | 480 | ||
505 | static inline void nmi_nesting_preprocess(struct pt_regs *regs) | 481 | dotraplinkage notrace void |
482 | do_nmi(struct pt_regs *regs, long error_code) | ||
506 | { | 483 | { |
484 | if (this_cpu_read(nmi_state) != NMI_NOT_RUNNING) { | ||
485 | this_cpu_write(nmi_state, NMI_LATCHED); | ||
486 | return; | ||
487 | } | ||
488 | this_cpu_write(nmi_state, NMI_EXECUTING); | ||
489 | this_cpu_write(nmi_cr2, read_cr2()); | ||
490 | nmi_restart: | ||
491 | |||
492 | #ifdef CONFIG_X86_64 | ||
507 | /* | 493 | /* |
508 | * If we interrupted a breakpoint, it is possible that | 494 | * If we interrupted a breakpoint, it is possible that |
509 | * the nmi handler will have breakpoints too. We need to | 495 | * the nmi handler will have breakpoints too. We need to |
@@ -514,22 +500,8 @@ static inline void nmi_nesting_preprocess(struct pt_regs *regs) | |||
514 | debug_stack_set_zero(); | 500 | debug_stack_set_zero(); |
515 | this_cpu_write(update_debug_stack, 1); | 501 | this_cpu_write(update_debug_stack, 1); |
516 | } | 502 | } |
517 | } | ||
518 | |||
519 | static inline void nmi_nesting_postprocess(void) | ||
520 | { | ||
521 | if (unlikely(this_cpu_read(update_debug_stack))) { | ||
522 | debug_stack_reset(); | ||
523 | this_cpu_write(update_debug_stack, 0); | ||
524 | } | ||
525 | } | ||
526 | #endif | 503 | #endif |
527 | 504 | ||
528 | dotraplinkage notrace void | ||
529 | do_nmi(struct pt_regs *regs, long error_code) | ||
530 | { | ||
531 | nmi_nesting_preprocess(regs); | ||
532 | |||
533 | nmi_enter(); | 505 | nmi_enter(); |
534 | 506 | ||
535 | inc_irq_stat(__nmi_count); | 507 | inc_irq_stat(__nmi_count); |
@@ -539,8 +511,17 @@ do_nmi(struct pt_regs *regs, long error_code) | |||
539 | 511 | ||
540 | nmi_exit(); | 512 | nmi_exit(); |
541 | 513 | ||
542 | /* On i386, may loop back to preprocess */ | 514 | #ifdef CONFIG_X86_64 |
543 | nmi_nesting_postprocess(); | 515 | if (unlikely(this_cpu_read(update_debug_stack))) { |
516 | debug_stack_reset(); | ||
517 | this_cpu_write(update_debug_stack, 0); | ||
518 | } | ||
519 | #endif | ||
520 | |||
521 | if (unlikely(this_cpu_read(nmi_cr2) != read_cr2())) | ||
522 | write_cr2(this_cpu_read(nmi_cr2)); | ||
523 | if (this_cpu_dec_return(nmi_state)) | ||
524 | goto nmi_restart; | ||
544 | } | 525 | } |
545 | NOKPROBE_SYMBOL(do_nmi); | 526 | NOKPROBE_SYMBOL(do_nmi); |
546 | 527 | ||
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 9cad694ed7c4..397688beed4b 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -81,7 +81,7 @@ EXPORT_SYMBOL_GPL(idle_notifier_unregister); | |||
81 | */ | 81 | */ |
82 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | 82 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) |
83 | { | 83 | { |
84 | *dst = *src; | 84 | memcpy(dst, src, arch_task_struct_size); |
85 | 85 | ||
86 | return fpu__copy(&dst->thread.fpu, &src->thread.fpu); | 86 | return fpu__copy(&dst->thread.fpu, &src->thread.fpu); |
87 | } | 87 | } |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 8add66b22f33..b1f3ed9c7a9e 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -171,11 +171,6 @@ static void smp_callin(void) | |||
171 | apic_ap_setup(); | 171 | apic_ap_setup(); |
172 | 172 | ||
173 | /* | 173 | /* |
174 | * Need to setup vector mappings before we enable interrupts. | ||
175 | */ | ||
176 | setup_vector_irq(smp_processor_id()); | ||
177 | |||
178 | /* | ||
179 | * Save our processor parameters. Note: this information | 174 | * Save our processor parameters. Note: this information |
180 | * is needed for clock calibration. | 175 | * is needed for clock calibration. |
181 | */ | 176 | */ |
@@ -239,18 +234,13 @@ static void notrace start_secondary(void *unused) | |||
239 | check_tsc_sync_target(); | 234 | check_tsc_sync_target(); |
240 | 235 | ||
241 | /* | 236 | /* |
242 | * Enable the espfix hack for this CPU | 237 | * Lock vector_lock and initialize the vectors on this cpu |
243 | */ | 238 | * before setting the cpu online. We must set it online with |
244 | #ifdef CONFIG_X86_ESPFIX64 | 239 | * vector_lock held to prevent a concurrent setup/teardown |
245 | init_espfix_ap(); | 240 | * from seeing a half valid vector space. |
246 | #endif | ||
247 | |||
248 | /* | ||
249 | * We need to hold vector_lock so there the set of online cpus | ||
250 | * does not change while we are assigning vectors to cpus. Holding | ||
251 | * this lock ensures we don't half assign or remove an irq from a cpu. | ||
252 | */ | 241 | */ |
253 | lock_vector_lock(); | 242 | lock_vector_lock(); |
243 | setup_vector_irq(smp_processor_id()); | ||
254 | set_cpu_online(smp_processor_id(), true); | 244 | set_cpu_online(smp_processor_id(), true); |
255 | unlock_vector_lock(); | 245 | unlock_vector_lock(); |
256 | cpu_set_state_online(smp_processor_id()); | 246 | cpu_set_state_online(smp_processor_id()); |
@@ -854,6 +844,13 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle) | |||
854 | initial_code = (unsigned long)start_secondary; | 844 | initial_code = (unsigned long)start_secondary; |
855 | stack_start = idle->thread.sp; | 845 | stack_start = idle->thread.sp; |
856 | 846 | ||
847 | /* | ||
848 | * Enable the espfix hack for this CPU | ||
849 | */ | ||
850 | #ifdef CONFIG_X86_ESPFIX64 | ||
851 | init_espfix_ap(cpu); | ||
852 | #endif | ||
853 | |||
857 | /* So we see what's up */ | 854 | /* So we see what's up */ |
858 | announce_cpu(cpu, apicid); | 855 | announce_cpu(cpu, apicid); |
859 | 856 | ||
@@ -995,8 +992,17 @@ int native_cpu_up(unsigned int cpu, struct task_struct *tidle) | |||
995 | 992 | ||
996 | common_cpu_up(cpu, tidle); | 993 | common_cpu_up(cpu, tidle); |
997 | 994 | ||
995 | /* | ||
996 | * We have to walk the irq descriptors to setup the vector | ||
997 | * space for the cpu which comes online. Prevent irq | ||
998 | * alloc/free across the bringup. | ||
999 | */ | ||
1000 | irq_lock_sparse(); | ||
1001 | |||
998 | err = do_boot_cpu(apicid, cpu, tidle); | 1002 | err = do_boot_cpu(apicid, cpu, tidle); |
1003 | |||
999 | if (err) { | 1004 | if (err) { |
1005 | irq_unlock_sparse(); | ||
1000 | pr_err("do_boot_cpu failed(%d) to wakeup CPU#%u\n", err, cpu); | 1006 | pr_err("do_boot_cpu failed(%d) to wakeup CPU#%u\n", err, cpu); |
1001 | return -EIO; | 1007 | return -EIO; |
1002 | } | 1008 | } |
@@ -1014,6 +1020,8 @@ int native_cpu_up(unsigned int cpu, struct task_struct *tidle) | |||
1014 | touch_nmi_watchdog(); | 1020 | touch_nmi_watchdog(); |
1015 | } | 1021 | } |
1016 | 1022 | ||
1023 | irq_unlock_sparse(); | ||
1024 | |||
1017 | return 0; | 1025 | return 0; |
1018 | } | 1026 | } |
1019 | 1027 | ||
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 505449700e0c..7437b41f6a47 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -598,10 +598,19 @@ static unsigned long quick_pit_calibrate(void) | |||
598 | if (!pit_expect_msb(0xff-i, &delta, &d2)) | 598 | if (!pit_expect_msb(0xff-i, &delta, &d2)) |
599 | break; | 599 | break; |
600 | 600 | ||
601 | delta -= tsc; | ||
602 | |||
603 | /* | ||
604 | * Extrapolate the error and fail fast if the error will | ||
605 | * never be below 500 ppm. | ||
606 | */ | ||
607 | if (i == 1 && | ||
608 | d1 + d2 >= (delta * MAX_QUICK_PIT_ITERATIONS) >> 11) | ||
609 | return 0; | ||
610 | |||
601 | /* | 611 | /* |
602 | * Iterate until the error is less than 500 ppm | 612 | * Iterate until the error is less than 500 ppm |
603 | */ | 613 | */ |
604 | delta -= tsc; | ||
605 | if (d1+d2 >= delta >> 11) | 614 | if (d1+d2 >= delta >> 11) |
606 | continue; | 615 | continue; |
607 | 616 | ||
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 64dd46793099..2fbea2544f24 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c | |||
@@ -98,6 +98,8 @@ int kvm_update_cpuid(struct kvm_vcpu *vcpu) | |||
98 | best->ebx = xstate_required_size(vcpu->arch.xcr0, true); | 98 | best->ebx = xstate_required_size(vcpu->arch.xcr0, true); |
99 | 99 | ||
100 | vcpu->arch.eager_fpu = use_eager_fpu() || guest_cpuid_has_mpx(vcpu); | 100 | vcpu->arch.eager_fpu = use_eager_fpu() || guest_cpuid_has_mpx(vcpu); |
101 | if (vcpu->arch.eager_fpu) | ||
102 | kvm_x86_ops->fpu_activate(vcpu); | ||
101 | 103 | ||
102 | /* | 104 | /* |
103 | * The existing code assumes virtual address is 48-bit in the canonical | 105 | * The existing code assumes virtual address is 48-bit in the canonical |
diff --git a/arch/x86/kvm/iommu.c b/arch/x86/kvm/iommu.c index 7dbced309ddb..5c520ebf6343 100644 --- a/arch/x86/kvm/iommu.c +++ b/arch/x86/kvm/iommu.c | |||
@@ -200,6 +200,7 @@ int kvm_assign_device(struct kvm *kvm, struct pci_dev *pdev) | |||
200 | goto out_unmap; | 200 | goto out_unmap; |
201 | } | 201 | } |
202 | 202 | ||
203 | kvm_arch_start_assignment(kvm); | ||
203 | pci_set_dev_assigned(pdev); | 204 | pci_set_dev_assigned(pdev); |
204 | 205 | ||
205 | dev_info(&pdev->dev, "kvm assign device\n"); | 206 | dev_info(&pdev->dev, "kvm assign device\n"); |
@@ -224,6 +225,7 @@ int kvm_deassign_device(struct kvm *kvm, struct pci_dev *pdev) | |||
224 | iommu_detach_device(domain, &pdev->dev); | 225 | iommu_detach_device(domain, &pdev->dev); |
225 | 226 | ||
226 | pci_clear_dev_assigned(pdev); | 227 | pci_clear_dev_assigned(pdev); |
228 | kvm_arch_end_assignment(kvm); | ||
227 | 229 | ||
228 | dev_info(&pdev->dev, "kvm deassign device\n"); | 230 | dev_info(&pdev->dev, "kvm deassign device\n"); |
229 | 231 | ||
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 954e98a8c2e3..2a5ca97c263b 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -1595,7 +1595,7 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu, bool init_event) | |||
1595 | for (i = 0; i < APIC_LVT_NUM; i++) | 1595 | for (i = 0; i < APIC_LVT_NUM; i++) |
1596 | apic_set_reg(apic, APIC_LVTT + 0x10 * i, APIC_LVT_MASKED); | 1596 | apic_set_reg(apic, APIC_LVTT + 0x10 * i, APIC_LVT_MASKED); |
1597 | apic_update_lvtt(apic); | 1597 | apic_update_lvtt(apic); |
1598 | if (!(vcpu->kvm->arch.disabled_quirks & KVM_QUIRK_LINT0_REENABLED)) | 1598 | if (kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_LINT0_REENABLED)) |
1599 | apic_set_reg(apic, APIC_LVT0, | 1599 | apic_set_reg(apic, APIC_LVT0, |
1600 | SET_APIC_DELIVERY_MODE(0, APIC_MODE_EXTINT)); | 1600 | SET_APIC_DELIVERY_MODE(0, APIC_MODE_EXTINT)); |
1601 | apic_manage_nmi_watchdog(apic, kvm_apic_get_reg(apic, APIC_LVT0)); | 1601 | apic_manage_nmi_watchdog(apic, kvm_apic_get_reg(apic, APIC_LVT0)); |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index f807496b62c2..44171462bd2a 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2479,6 +2479,14 @@ static int mmu_need_write_protect(struct kvm_vcpu *vcpu, gfn_t gfn, | |||
2479 | return 0; | 2479 | return 0; |
2480 | } | 2480 | } |
2481 | 2481 | ||
2482 | static bool kvm_is_mmio_pfn(pfn_t pfn) | ||
2483 | { | ||
2484 | if (pfn_valid(pfn)) | ||
2485 | return !is_zero_pfn(pfn) && PageReserved(pfn_to_page(pfn)); | ||
2486 | |||
2487 | return true; | ||
2488 | } | ||
2489 | |||
2482 | static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep, | 2490 | static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep, |
2483 | unsigned pte_access, int level, | 2491 | unsigned pte_access, int level, |
2484 | gfn_t gfn, pfn_t pfn, bool speculative, | 2492 | gfn_t gfn, pfn_t pfn, bool speculative, |
@@ -2506,7 +2514,7 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep, | |||
2506 | spte |= PT_PAGE_SIZE_MASK; | 2514 | spte |= PT_PAGE_SIZE_MASK; |
2507 | if (tdp_enabled) | 2515 | if (tdp_enabled) |
2508 | spte |= kvm_x86_ops->get_mt_mask(vcpu, gfn, | 2516 | spte |= kvm_x86_ops->get_mt_mask(vcpu, gfn, |
2509 | kvm_is_reserved_pfn(pfn)); | 2517 | kvm_is_mmio_pfn(pfn)); |
2510 | 2518 | ||
2511 | if (host_writable) | 2519 | if (host_writable) |
2512 | spte |= SPTE_HOST_WRITEABLE; | 2520 | spte |= SPTE_HOST_WRITEABLE; |
diff --git a/arch/x86/kvm/mtrr.c b/arch/x86/kvm/mtrr.c index de1d2d8062e2..dc0a84a6f309 100644 --- a/arch/x86/kvm/mtrr.c +++ b/arch/x86/kvm/mtrr.c | |||
@@ -120,6 +120,16 @@ static u8 mtrr_default_type(struct kvm_mtrr *mtrr_state) | |||
120 | return mtrr_state->deftype & IA32_MTRR_DEF_TYPE_TYPE_MASK; | 120 | return mtrr_state->deftype & IA32_MTRR_DEF_TYPE_TYPE_MASK; |
121 | } | 121 | } |
122 | 122 | ||
123 | static u8 mtrr_disabled_type(void) | ||
124 | { | ||
125 | /* | ||
126 | * Intel SDM 11.11.2.2: all MTRRs are disabled when | ||
127 | * IA32_MTRR_DEF_TYPE.E bit is cleared, and the UC | ||
128 | * memory type is applied to all of physical memory. | ||
129 | */ | ||
130 | return MTRR_TYPE_UNCACHABLE; | ||
131 | } | ||
132 | |||
123 | /* | 133 | /* |
124 | * Three terms are used in the following code: | 134 | * Three terms are used in the following code: |
125 | * - segment, it indicates the address segments covered by fixed MTRRs. | 135 | * - segment, it indicates the address segments covered by fixed MTRRs. |
@@ -434,6 +444,8 @@ struct mtrr_iter { | |||
434 | 444 | ||
435 | /* output fields. */ | 445 | /* output fields. */ |
436 | int mem_type; | 446 | int mem_type; |
447 | /* mtrr is completely disabled? */ | ||
448 | bool mtrr_disabled; | ||
437 | /* [start, end) is not fully covered in MTRRs? */ | 449 | /* [start, end) is not fully covered in MTRRs? */ |
438 | bool partial_map; | 450 | bool partial_map; |
439 | 451 | ||
@@ -549,7 +561,7 @@ static void mtrr_lookup_var_next(struct mtrr_iter *iter) | |||
549 | static void mtrr_lookup_start(struct mtrr_iter *iter) | 561 | static void mtrr_lookup_start(struct mtrr_iter *iter) |
550 | { | 562 | { |
551 | if (!mtrr_is_enabled(iter->mtrr_state)) { | 563 | if (!mtrr_is_enabled(iter->mtrr_state)) { |
552 | iter->partial_map = true; | 564 | iter->mtrr_disabled = true; |
553 | return; | 565 | return; |
554 | } | 566 | } |
555 | 567 | ||
@@ -563,6 +575,7 @@ static void mtrr_lookup_init(struct mtrr_iter *iter, | |||
563 | iter->mtrr_state = mtrr_state; | 575 | iter->mtrr_state = mtrr_state; |
564 | iter->start = start; | 576 | iter->start = start; |
565 | iter->end = end; | 577 | iter->end = end; |
578 | iter->mtrr_disabled = false; | ||
566 | iter->partial_map = false; | 579 | iter->partial_map = false; |
567 | iter->fixed = false; | 580 | iter->fixed = false; |
568 | iter->range = NULL; | 581 | iter->range = NULL; |
@@ -656,15 +669,19 @@ u8 kvm_mtrr_get_guest_memory_type(struct kvm_vcpu *vcpu, gfn_t gfn) | |||
656 | return MTRR_TYPE_WRBACK; | 669 | return MTRR_TYPE_WRBACK; |
657 | } | 670 | } |
658 | 671 | ||
659 | /* It is not covered by MTRRs. */ | 672 | if (iter.mtrr_disabled) |
660 | if (iter.partial_map) { | 673 | return mtrr_disabled_type(); |
661 | /* | 674 | |
662 | * We just check one page, partially covered by MTRRs is | 675 | /* |
663 | * impossible. | 676 | * We just check one page, partially covered by MTRRs is |
664 | */ | 677 | * impossible. |
665 | WARN_ON(type != -1); | 678 | */ |
666 | type = mtrr_default_type(mtrr_state); | 679 | WARN_ON(iter.partial_map); |
667 | } | 680 | |
681 | /* not contained in any MTRRs. */ | ||
682 | if (type == -1) | ||
683 | return mtrr_default_type(mtrr_state); | ||
684 | |||
668 | return type; | 685 | return type; |
669 | } | 686 | } |
670 | EXPORT_SYMBOL_GPL(kvm_mtrr_get_guest_memory_type); | 687 | EXPORT_SYMBOL_GPL(kvm_mtrr_get_guest_memory_type); |
@@ -689,6 +706,9 @@ bool kvm_mtrr_check_gfn_range_consistency(struct kvm_vcpu *vcpu, gfn_t gfn, | |||
689 | return false; | 706 | return false; |
690 | } | 707 | } |
691 | 708 | ||
709 | if (iter.mtrr_disabled) | ||
710 | return true; | ||
711 | |||
692 | if (!iter.partial_map) | 712 | if (!iter.partial_map) |
693 | return true; | 713 | return true; |
694 | 714 | ||
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 602b974a60a6..8e0c0844c6b9 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -865,6 +865,64 @@ static void svm_disable_lbrv(struct vcpu_svm *svm) | |||
865 | set_msr_interception(msrpm, MSR_IA32_LASTINTTOIP, 0, 0); | 865 | set_msr_interception(msrpm, MSR_IA32_LASTINTTOIP, 0, 0); |
866 | } | 866 | } |
867 | 867 | ||
868 | #define MTRR_TYPE_UC_MINUS 7 | ||
869 | #define MTRR2PROTVAL_INVALID 0xff | ||
870 | |||
871 | static u8 mtrr2protval[8]; | ||
872 | |||
873 | static u8 fallback_mtrr_type(int mtrr) | ||
874 | { | ||
875 | /* | ||
876 | * WT and WP aren't always available in the host PAT. Treat | ||
877 | * them as UC and UC- respectively. Everything else should be | ||
878 | * there. | ||
879 | */ | ||
880 | switch (mtrr) | ||
881 | { | ||
882 | case MTRR_TYPE_WRTHROUGH: | ||
883 | return MTRR_TYPE_UNCACHABLE; | ||
884 | case MTRR_TYPE_WRPROT: | ||
885 | return MTRR_TYPE_UC_MINUS; | ||
886 | default: | ||
887 | BUG(); | ||
888 | } | ||
889 | } | ||
890 | |||
891 | static void build_mtrr2protval(void) | ||
892 | { | ||
893 | int i; | ||
894 | u64 pat; | ||
895 | |||
896 | for (i = 0; i < 8; i++) | ||
897 | mtrr2protval[i] = MTRR2PROTVAL_INVALID; | ||
898 | |||
899 | /* Ignore the invalid MTRR types. */ | ||
900 | mtrr2protval[2] = 0; | ||
901 | mtrr2protval[3] = 0; | ||
902 | |||
903 | /* | ||
904 | * Use host PAT value to figure out the mapping from guest MTRR | ||
905 | * values to nested page table PAT/PCD/PWT values. We do not | ||
906 | * want to change the host PAT value every time we enter the | ||
907 | * guest. | ||
908 | */ | ||
909 | rdmsrl(MSR_IA32_CR_PAT, pat); | ||
910 | for (i = 0; i < 8; i++) { | ||
911 | u8 mtrr = pat >> (8 * i); | ||
912 | |||
913 | if (mtrr2protval[mtrr] == MTRR2PROTVAL_INVALID) | ||
914 | mtrr2protval[mtrr] = __cm_idx2pte(i); | ||
915 | } | ||
916 | |||
917 | for (i = 0; i < 8; i++) { | ||
918 | if (mtrr2protval[i] == MTRR2PROTVAL_INVALID) { | ||
919 | u8 fallback = fallback_mtrr_type(i); | ||
920 | mtrr2protval[i] = mtrr2protval[fallback]; | ||
921 | BUG_ON(mtrr2protval[i] == MTRR2PROTVAL_INVALID); | ||
922 | } | ||
923 | } | ||
924 | } | ||
925 | |||
868 | static __init int svm_hardware_setup(void) | 926 | static __init int svm_hardware_setup(void) |
869 | { | 927 | { |
870 | int cpu; | 928 | int cpu; |
@@ -931,6 +989,7 @@ static __init int svm_hardware_setup(void) | |||
931 | } else | 989 | } else |
932 | kvm_disable_tdp(); | 990 | kvm_disable_tdp(); |
933 | 991 | ||
992 | build_mtrr2protval(); | ||
934 | return 0; | 993 | return 0; |
935 | 994 | ||
936 | err: | 995 | err: |
@@ -1085,6 +1144,39 @@ static u64 svm_compute_tsc_offset(struct kvm_vcpu *vcpu, u64 target_tsc) | |||
1085 | return target_tsc - tsc; | 1144 | return target_tsc - tsc; |
1086 | } | 1145 | } |
1087 | 1146 | ||
1147 | static void svm_set_guest_pat(struct vcpu_svm *svm, u64 *g_pat) | ||
1148 | { | ||
1149 | struct kvm_vcpu *vcpu = &svm->vcpu; | ||
1150 | |||
1151 | /* Unlike Intel, AMD takes the guest's CR0.CD into account. | ||
1152 | * | ||
1153 | * AMD does not have IPAT. To emulate it for the case of guests | ||
1154 | * with no assigned devices, just set everything to WB. If guests | ||
1155 | * have assigned devices, however, we cannot force WB for RAM | ||
1156 | * pages only, so use the guest PAT directly. | ||
1157 | */ | ||
1158 | if (!kvm_arch_has_assigned_device(vcpu->kvm)) | ||
1159 | *g_pat = 0x0606060606060606; | ||
1160 | else | ||
1161 | *g_pat = vcpu->arch.pat; | ||
1162 | } | ||
1163 | |||
1164 | static u64 svm_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) | ||
1165 | { | ||
1166 | u8 mtrr; | ||
1167 | |||
1168 | /* | ||
1169 | * 1. MMIO: trust guest MTRR, so same as item 3. | ||
1170 | * 2. No passthrough: always map as WB, and force guest PAT to WB as well | ||
1171 | * 3. Passthrough: can't guarantee the result, try to trust guest. | ||
1172 | */ | ||
1173 | if (!is_mmio && !kvm_arch_has_assigned_device(vcpu->kvm)) | ||
1174 | return 0; | ||
1175 | |||
1176 | mtrr = kvm_mtrr_get_guest_memory_type(vcpu, gfn); | ||
1177 | return mtrr2protval[mtrr]; | ||
1178 | } | ||
1179 | |||
1088 | static void init_vmcb(struct vcpu_svm *svm, bool init_event) | 1180 | static void init_vmcb(struct vcpu_svm *svm, bool init_event) |
1089 | { | 1181 | { |
1090 | struct vmcb_control_area *control = &svm->vmcb->control; | 1182 | struct vmcb_control_area *control = &svm->vmcb->control; |
@@ -1180,6 +1272,7 @@ static void init_vmcb(struct vcpu_svm *svm, bool init_event) | |||
1180 | clr_cr_intercept(svm, INTERCEPT_CR3_READ); | 1272 | clr_cr_intercept(svm, INTERCEPT_CR3_READ); |
1181 | clr_cr_intercept(svm, INTERCEPT_CR3_WRITE); | 1273 | clr_cr_intercept(svm, INTERCEPT_CR3_WRITE); |
1182 | save->g_pat = svm->vcpu.arch.pat; | 1274 | save->g_pat = svm->vcpu.arch.pat; |
1275 | svm_set_guest_pat(svm, &save->g_pat); | ||
1183 | save->cr3 = 0; | 1276 | save->cr3 = 0; |
1184 | save->cr4 = 0; | 1277 | save->cr4 = 0; |
1185 | } | 1278 | } |
@@ -1579,7 +1672,7 @@ static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) | |||
1579 | * does not do it - this results in some delay at | 1672 | * does not do it - this results in some delay at |
1580 | * reboot | 1673 | * reboot |
1581 | */ | 1674 | */ |
1582 | if (!(vcpu->kvm->arch.disabled_quirks & KVM_QUIRK_CD_NW_CLEARED)) | 1675 | if (kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_CD_NW_CLEARED)) |
1583 | cr0 &= ~(X86_CR0_CD | X86_CR0_NW); | 1676 | cr0 &= ~(X86_CR0_CD | X86_CR0_NW); |
1584 | svm->vmcb->save.cr0 = cr0; | 1677 | svm->vmcb->save.cr0 = cr0; |
1585 | mark_dirty(svm->vmcb, VMCB_CR); | 1678 | mark_dirty(svm->vmcb, VMCB_CR); |
@@ -3254,6 +3347,16 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) | |||
3254 | case MSR_VM_IGNNE: | 3347 | case MSR_VM_IGNNE: |
3255 | vcpu_unimpl(vcpu, "unimplemented wrmsr: 0x%x data 0x%llx\n", ecx, data); | 3348 | vcpu_unimpl(vcpu, "unimplemented wrmsr: 0x%x data 0x%llx\n", ecx, data); |
3256 | break; | 3349 | break; |
3350 | case MSR_IA32_CR_PAT: | ||
3351 | if (npt_enabled) { | ||
3352 | if (!kvm_mtrr_valid(vcpu, MSR_IA32_CR_PAT, data)) | ||
3353 | return 1; | ||
3354 | vcpu->arch.pat = data; | ||
3355 | svm_set_guest_pat(svm, &svm->vmcb->save.g_pat); | ||
3356 | mark_dirty(svm->vmcb, VMCB_NPT); | ||
3357 | break; | ||
3358 | } | ||
3359 | /* fall through */ | ||
3257 | default: | 3360 | default: |
3258 | return kvm_set_msr_common(vcpu, msr); | 3361 | return kvm_set_msr_common(vcpu, msr); |
3259 | } | 3362 | } |
@@ -4088,11 +4191,6 @@ static bool svm_has_high_real_mode_segbase(void) | |||
4088 | return true; | 4191 | return true; |
4089 | } | 4192 | } |
4090 | 4193 | ||
4091 | static u64 svm_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) | ||
4092 | { | ||
4093 | return 0; | ||
4094 | } | ||
4095 | |||
4096 | static void svm_cpuid_update(struct kvm_vcpu *vcpu) | 4194 | static void svm_cpuid_update(struct kvm_vcpu *vcpu) |
4097 | { | 4195 | { |
4098 | } | 4196 | } |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index e856dd566f4c..83b7b5cd75d5 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -8632,22 +8632,17 @@ static u64 vmx_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) | |||
8632 | u64 ipat = 0; | 8632 | u64 ipat = 0; |
8633 | 8633 | ||
8634 | /* For VT-d and EPT combination | 8634 | /* For VT-d and EPT combination |
8635 | * 1. MMIO: always map as UC | 8635 | * 1. MMIO: guest may want to apply WC, trust it. |
8636 | * 2. EPT with VT-d: | 8636 | * 2. EPT with VT-d: |
8637 | * a. VT-d without snooping control feature: can't guarantee the | 8637 | * a. VT-d without snooping control feature: can't guarantee the |
8638 | * result, try to trust guest. | 8638 | * result, try to trust guest. So the same as item 1. |
8639 | * b. VT-d with snooping control feature: snooping control feature of | 8639 | * b. VT-d with snooping control feature: snooping control feature of |
8640 | * VT-d engine can guarantee the cache correctness. Just set it | 8640 | * VT-d engine can guarantee the cache correctness. Just set it |
8641 | * to WB to keep consistent with host. So the same as item 3. | 8641 | * to WB to keep consistent with host. So the same as item 3. |
8642 | * 3. EPT without VT-d: always map as WB and set IPAT=1 to keep | 8642 | * 3. EPT without VT-d: always map as WB and set IPAT=1 to keep |
8643 | * consistent with host MTRR | 8643 | * consistent with host MTRR |
8644 | */ | 8644 | */ |
8645 | if (is_mmio) { | 8645 | if (!is_mmio && !kvm_arch_has_noncoherent_dma(vcpu->kvm)) { |
8646 | cache = MTRR_TYPE_UNCACHABLE; | ||
8647 | goto exit; | ||
8648 | } | ||
8649 | |||
8650 | if (!kvm_arch_has_noncoherent_dma(vcpu->kvm)) { | ||
8651 | ipat = VMX_EPT_IPAT_BIT; | 8646 | ipat = VMX_EPT_IPAT_BIT; |
8652 | cache = MTRR_TYPE_WRBACK; | 8647 | cache = MTRR_TYPE_WRBACK; |
8653 | goto exit; | 8648 | goto exit; |
@@ -8655,7 +8650,10 @@ static u64 vmx_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) | |||
8655 | 8650 | ||
8656 | if (kvm_read_cr0(vcpu) & X86_CR0_CD) { | 8651 | if (kvm_read_cr0(vcpu) & X86_CR0_CD) { |
8657 | ipat = VMX_EPT_IPAT_BIT; | 8652 | ipat = VMX_EPT_IPAT_BIT; |
8658 | cache = MTRR_TYPE_UNCACHABLE; | 8653 | if (kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_CD_NW_CLEARED)) |
8654 | cache = MTRR_TYPE_WRBACK; | ||
8655 | else | ||
8656 | cache = MTRR_TYPE_UNCACHABLE; | ||
8659 | goto exit; | 8657 | goto exit; |
8660 | } | 8658 | } |
8661 | 8659 | ||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bbaf44e8f0d3..5ef2560075bf 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -3157,8 +3157,7 @@ static void load_xsave(struct kvm_vcpu *vcpu, u8 *src) | |||
3157 | cpuid_count(XSTATE_CPUID, index, | 3157 | cpuid_count(XSTATE_CPUID, index, |
3158 | &size, &offset, &ecx, &edx); | 3158 | &size, &offset, &ecx, &edx); |
3159 | memcpy(dest, src + offset, size); | 3159 | memcpy(dest, src + offset, size); |
3160 | } else | 3160 | } |
3161 | WARN_ON_ONCE(1); | ||
3162 | 3161 | ||
3163 | valid -= feature; | 3162 | valid -= feature; |
3164 | } | 3163 | } |
@@ -7315,11 +7314,6 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, | |||
7315 | 7314 | ||
7316 | vcpu = kvm_x86_ops->vcpu_create(kvm, id); | 7315 | vcpu = kvm_x86_ops->vcpu_create(kvm, id); |
7317 | 7316 | ||
7318 | /* | ||
7319 | * Activate fpu unconditionally in case the guest needs eager FPU. It will be | ||
7320 | * deactivated soon if it doesn't. | ||
7321 | */ | ||
7322 | kvm_x86_ops->fpu_activate(vcpu); | ||
7323 | return vcpu; | 7317 | return vcpu; |
7324 | } | 7318 | } |
7325 | 7319 | ||
@@ -8218,6 +8212,24 @@ bool kvm_arch_can_inject_async_page_present(struct kvm_vcpu *vcpu) | |||
8218 | kvm_x86_ops->interrupt_allowed(vcpu); | 8212 | kvm_x86_ops->interrupt_allowed(vcpu); |
8219 | } | 8213 | } |
8220 | 8214 | ||
8215 | void kvm_arch_start_assignment(struct kvm *kvm) | ||
8216 | { | ||
8217 | atomic_inc(&kvm->arch.assigned_device_count); | ||
8218 | } | ||
8219 | EXPORT_SYMBOL_GPL(kvm_arch_start_assignment); | ||
8220 | |||
8221 | void kvm_arch_end_assignment(struct kvm *kvm) | ||
8222 | { | ||
8223 | atomic_dec(&kvm->arch.assigned_device_count); | ||
8224 | } | ||
8225 | EXPORT_SYMBOL_GPL(kvm_arch_end_assignment); | ||
8226 | |||
8227 | bool kvm_arch_has_assigned_device(struct kvm *kvm) | ||
8228 | { | ||
8229 | return atomic_read(&kvm->arch.assigned_device_count); | ||
8230 | } | ||
8231 | EXPORT_SYMBOL_GPL(kvm_arch_has_assigned_device); | ||
8232 | |||
8221 | void kvm_arch_register_noncoherent_dma(struct kvm *kvm) | 8233 | void kvm_arch_register_noncoherent_dma(struct kvm *kvm) |
8222 | { | 8234 | { |
8223 | atomic_inc(&kvm->arch.noncoherent_dma_count); | 8235 | atomic_inc(&kvm->arch.noncoherent_dma_count); |
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index edc8cdcd786b..0ca2f3e4803c 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h | |||
@@ -147,6 +147,11 @@ static inline void kvm_register_writel(struct kvm_vcpu *vcpu, | |||
147 | return kvm_register_write(vcpu, reg, val); | 147 | return kvm_register_write(vcpu, reg, val); |
148 | } | 148 | } |
149 | 149 | ||
150 | static inline bool kvm_check_has_quirk(struct kvm *kvm, u64 quirk) | ||
151 | { | ||
152 | return !(kvm->arch.disabled_quirks & quirk); | ||
153 | } | ||
154 | |||
150 | void kvm_before_handle_nmi(struct kvm_vcpu *vcpu); | 155 | void kvm_before_handle_nmi(struct kvm_vcpu *vcpu); |
151 | void kvm_after_handle_nmi(struct kvm_vcpu *vcpu); | 156 | void kvm_after_handle_nmi(struct kvm_vcpu *vcpu); |
152 | void kvm_set_pending_timer(struct kvm_vcpu *vcpu); | 157 | void kvm_set_pending_timer(struct kvm_vcpu *vcpu); |
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index cc5ccc415cc0..b9c78f3bcd67 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -63,8 +63,6 @@ static int __ioremap_check_ram(unsigned long start_pfn, unsigned long nr_pages, | |||
63 | !PageReserved(pfn_to_page(start_pfn + i))) | 63 | !PageReserved(pfn_to_page(start_pfn + i))) |
64 | return 1; | 64 | return 1; |
65 | 65 | ||
66 | WARN_ONCE(1, "ioremap on RAM pfn 0x%lx\n", start_pfn); | ||
67 | |||
68 | return 0; | 66 | return 0; |
69 | } | 67 | } |
70 | 68 | ||
@@ -94,7 +92,6 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, | |||
94 | pgprot_t prot; | 92 | pgprot_t prot; |
95 | int retval; | 93 | int retval; |
96 | void __iomem *ret_addr; | 94 | void __iomem *ret_addr; |
97 | int ram_region; | ||
98 | 95 | ||
99 | /* Don't allow wraparound or zero size */ | 96 | /* Don't allow wraparound or zero size */ |
100 | last_addr = phys_addr + size - 1; | 97 | last_addr = phys_addr + size - 1; |
@@ -117,23 +114,15 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, | |||
117 | /* | 114 | /* |
118 | * Don't allow anybody to remap normal RAM that we're using.. | 115 | * Don't allow anybody to remap normal RAM that we're using.. |
119 | */ | 116 | */ |
120 | /* First check if whole region can be identified as RAM or not */ | 117 | pfn = phys_addr >> PAGE_SHIFT; |
121 | ram_region = region_is_ram(phys_addr, size); | 118 | last_pfn = last_addr >> PAGE_SHIFT; |
122 | if (ram_region > 0) { | 119 | if (walk_system_ram_range(pfn, last_pfn - pfn + 1, NULL, |
123 | WARN_ONCE(1, "ioremap on RAM at 0x%lx - 0x%lx\n", | 120 | __ioremap_check_ram) == 1) { |
124 | (unsigned long int)phys_addr, | 121 | WARN_ONCE(1, "ioremap on RAM at %pa - %pa\n", |
125 | (unsigned long int)last_addr); | 122 | &phys_addr, &last_addr); |
126 | return NULL; | 123 | return NULL; |
127 | } | 124 | } |
128 | 125 | ||
129 | /* If could not be identified(-1), check page by page */ | ||
130 | if (ram_region < 0) { | ||
131 | pfn = phys_addr >> PAGE_SHIFT; | ||
132 | last_pfn = last_addr >> PAGE_SHIFT; | ||
133 | if (walk_system_ram_range(pfn, last_pfn - pfn + 1, NULL, | ||
134 | __ioremap_check_ram) == 1) | ||
135 | return NULL; | ||
136 | } | ||
137 | /* | 126 | /* |
138 | * Mappings have to be page-aligned | 127 | * Mappings have to be page-aligned |
139 | */ | 128 | */ |
diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c index 4860906c6b9f..e1840f3db5b5 100644 --- a/arch/x86/mm/kasan_init_64.c +++ b/arch/x86/mm/kasan_init_64.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #define pr_fmt(fmt) "kasan: " fmt | ||
1 | #include <linux/bootmem.h> | 2 | #include <linux/bootmem.h> |
2 | #include <linux/kasan.h> | 3 | #include <linux/kasan.h> |
3 | #include <linux/kdebug.h> | 4 | #include <linux/kdebug.h> |
@@ -11,7 +12,19 @@ | |||
11 | extern pgd_t early_level4_pgt[PTRS_PER_PGD]; | 12 | extern pgd_t early_level4_pgt[PTRS_PER_PGD]; |
12 | extern struct range pfn_mapped[E820_X_MAX]; | 13 | extern struct range pfn_mapped[E820_X_MAX]; |
13 | 14 | ||
14 | extern unsigned char kasan_zero_page[PAGE_SIZE]; | 15 | static pud_t kasan_zero_pud[PTRS_PER_PUD] __page_aligned_bss; |
16 | static pmd_t kasan_zero_pmd[PTRS_PER_PMD] __page_aligned_bss; | ||
17 | static pte_t kasan_zero_pte[PTRS_PER_PTE] __page_aligned_bss; | ||
18 | |||
19 | /* | ||
20 | * This page used as early shadow. We don't use empty_zero_page | ||
21 | * at early stages, stack instrumentation could write some garbage | ||
22 | * to this page. | ||
23 | * Latter we reuse it as zero shadow for large ranges of memory | ||
24 | * that allowed to access, but not instrumented by kasan | ||
25 | * (vmalloc/vmemmap ...). | ||
26 | */ | ||
27 | static unsigned char kasan_zero_page[PAGE_SIZE] __page_aligned_bss; | ||
15 | 28 | ||
16 | static int __init map_range(struct range *range) | 29 | static int __init map_range(struct range *range) |
17 | { | 30 | { |
@@ -36,7 +49,7 @@ static void __init clear_pgds(unsigned long start, | |||
36 | pgd_clear(pgd_offset_k(start)); | 49 | pgd_clear(pgd_offset_k(start)); |
37 | } | 50 | } |
38 | 51 | ||
39 | void __init kasan_map_early_shadow(pgd_t *pgd) | 52 | static void __init kasan_map_early_shadow(pgd_t *pgd) |
40 | { | 53 | { |
41 | int i; | 54 | int i; |
42 | unsigned long start = KASAN_SHADOW_START; | 55 | unsigned long start = KASAN_SHADOW_START; |
@@ -73,7 +86,7 @@ static int __init zero_pmd_populate(pud_t *pud, unsigned long addr, | |||
73 | while (IS_ALIGNED(addr, PMD_SIZE) && addr + PMD_SIZE <= end) { | 86 | while (IS_ALIGNED(addr, PMD_SIZE) && addr + PMD_SIZE <= end) { |
74 | WARN_ON(!pmd_none(*pmd)); | 87 | WARN_ON(!pmd_none(*pmd)); |
75 | set_pmd(pmd, __pmd(__pa_nodebug(kasan_zero_pte) | 88 | set_pmd(pmd, __pmd(__pa_nodebug(kasan_zero_pte) |
76 | | __PAGE_KERNEL_RO)); | 89 | | _KERNPG_TABLE)); |
77 | addr += PMD_SIZE; | 90 | addr += PMD_SIZE; |
78 | pmd = pmd_offset(pud, addr); | 91 | pmd = pmd_offset(pud, addr); |
79 | } | 92 | } |
@@ -99,7 +112,7 @@ static int __init zero_pud_populate(pgd_t *pgd, unsigned long addr, | |||
99 | while (IS_ALIGNED(addr, PUD_SIZE) && addr + PUD_SIZE <= end) { | 112 | while (IS_ALIGNED(addr, PUD_SIZE) && addr + PUD_SIZE <= end) { |
100 | WARN_ON(!pud_none(*pud)); | 113 | WARN_ON(!pud_none(*pud)); |
101 | set_pud(pud, __pud(__pa_nodebug(kasan_zero_pmd) | 114 | set_pud(pud, __pud(__pa_nodebug(kasan_zero_pmd) |
102 | | __PAGE_KERNEL_RO)); | 115 | | _KERNPG_TABLE)); |
103 | addr += PUD_SIZE; | 116 | addr += PUD_SIZE; |
104 | pud = pud_offset(pgd, addr); | 117 | pud = pud_offset(pgd, addr); |
105 | } | 118 | } |
@@ -124,7 +137,7 @@ static int __init zero_pgd_populate(unsigned long addr, unsigned long end) | |||
124 | while (IS_ALIGNED(addr, PGDIR_SIZE) && addr + PGDIR_SIZE <= end) { | 137 | while (IS_ALIGNED(addr, PGDIR_SIZE) && addr + PGDIR_SIZE <= end) { |
125 | WARN_ON(!pgd_none(*pgd)); | 138 | WARN_ON(!pgd_none(*pgd)); |
126 | set_pgd(pgd, __pgd(__pa_nodebug(kasan_zero_pud) | 139 | set_pgd(pgd, __pgd(__pa_nodebug(kasan_zero_pud) |
127 | | __PAGE_KERNEL_RO)); | 140 | | _KERNPG_TABLE)); |
128 | addr += PGDIR_SIZE; | 141 | addr += PGDIR_SIZE; |
129 | pgd = pgd_offset_k(addr); | 142 | pgd = pgd_offset_k(addr); |
130 | } | 143 | } |
@@ -166,6 +179,26 @@ static struct notifier_block kasan_die_notifier = { | |||
166 | }; | 179 | }; |
167 | #endif | 180 | #endif |
168 | 181 | ||
182 | void __init kasan_early_init(void) | ||
183 | { | ||
184 | int i; | ||
185 | pteval_t pte_val = __pa_nodebug(kasan_zero_page) | __PAGE_KERNEL; | ||
186 | pmdval_t pmd_val = __pa_nodebug(kasan_zero_pte) | _KERNPG_TABLE; | ||
187 | pudval_t pud_val = __pa_nodebug(kasan_zero_pmd) | _KERNPG_TABLE; | ||
188 | |||
189 | for (i = 0; i < PTRS_PER_PTE; i++) | ||
190 | kasan_zero_pte[i] = __pte(pte_val); | ||
191 | |||
192 | for (i = 0; i < PTRS_PER_PMD; i++) | ||
193 | kasan_zero_pmd[i] = __pmd(pmd_val); | ||
194 | |||
195 | for (i = 0; i < PTRS_PER_PUD; i++) | ||
196 | kasan_zero_pud[i] = __pud(pud_val); | ||
197 | |||
198 | kasan_map_early_shadow(early_level4_pgt); | ||
199 | kasan_map_early_shadow(init_level4_pgt); | ||
200 | } | ||
201 | |||
169 | void __init kasan_init(void) | 202 | void __init kasan_init(void) |
170 | { | 203 | { |
171 | int i; | 204 | int i; |
@@ -176,6 +209,7 @@ void __init kasan_init(void) | |||
176 | 209 | ||
177 | memcpy(early_level4_pgt, init_level4_pgt, sizeof(early_level4_pgt)); | 210 | memcpy(early_level4_pgt, init_level4_pgt, sizeof(early_level4_pgt)); |
178 | load_cr3(early_level4_pgt); | 211 | load_cr3(early_level4_pgt); |
212 | __flush_tlb_all(); | ||
179 | 213 | ||
180 | clear_pgds(KASAN_SHADOW_START, KASAN_SHADOW_END); | 214 | clear_pgds(KASAN_SHADOW_START, KASAN_SHADOW_END); |
181 | 215 | ||
@@ -202,5 +236,8 @@ void __init kasan_init(void) | |||
202 | memset(kasan_zero_page, 0, PAGE_SIZE); | 236 | memset(kasan_zero_page, 0, PAGE_SIZE); |
203 | 237 | ||
204 | load_cr3(init_level4_pgt); | 238 | load_cr3(init_level4_pgt); |
239 | __flush_tlb_all(); | ||
205 | init_task.kasan_depth = 0; | 240 | init_task.kasan_depth = 0; |
241 | |||
242 | pr_info("Kernel address sanitizer initialized\n"); | ||
206 | } | 243 | } |
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c index 9d518d693b4b..844b06d67df4 100644 --- a/arch/x86/mm/mmap.c +++ b/arch/x86/mm/mmap.c | |||
@@ -126,3 +126,10 @@ void arch_pick_mmap_layout(struct mm_struct *mm) | |||
126 | mm->get_unmapped_area = arch_get_unmapped_area_topdown; | 126 | mm->get_unmapped_area = arch_get_unmapped_area_topdown; |
127 | } | 127 | } |
128 | } | 128 | } |
129 | |||
130 | const char *arch_vma_name(struct vm_area_struct *vma) | ||
131 | { | ||
132 | if (vma->vm_flags & VM_MPX) | ||
133 | return "[mpx]"; | ||
134 | return NULL; | ||
135 | } | ||
diff --git a/arch/x86/mm/mpx.c b/arch/x86/mm/mpx.c index 7a657f58bbea..db1b0bc5017c 100644 --- a/arch/x86/mm/mpx.c +++ b/arch/x86/mm/mpx.c | |||
@@ -20,20 +20,6 @@ | |||
20 | #define CREATE_TRACE_POINTS | 20 | #define CREATE_TRACE_POINTS |
21 | #include <asm/trace/mpx.h> | 21 | #include <asm/trace/mpx.h> |
22 | 22 | ||
23 | static const char *mpx_mapping_name(struct vm_area_struct *vma) | ||
24 | { | ||
25 | return "[mpx]"; | ||
26 | } | ||
27 | |||
28 | static struct vm_operations_struct mpx_vma_ops = { | ||
29 | .name = mpx_mapping_name, | ||
30 | }; | ||
31 | |||
32 | static int is_mpx_vma(struct vm_area_struct *vma) | ||
33 | { | ||
34 | return (vma->vm_ops == &mpx_vma_ops); | ||
35 | } | ||
36 | |||
37 | static inline unsigned long mpx_bd_size_bytes(struct mm_struct *mm) | 23 | static inline unsigned long mpx_bd_size_bytes(struct mm_struct *mm) |
38 | { | 24 | { |
39 | if (is_64bit_mm(mm)) | 25 | if (is_64bit_mm(mm)) |
@@ -53,9 +39,6 @@ static inline unsigned long mpx_bt_size_bytes(struct mm_struct *mm) | |||
53 | /* | 39 | /* |
54 | * This is really a simplified "vm_mmap". it only handles MPX | 40 | * This is really a simplified "vm_mmap". it only handles MPX |
55 | * bounds tables (the bounds directory is user-allocated). | 41 | * bounds tables (the bounds directory is user-allocated). |
56 | * | ||
57 | * Later on, we use the vma->vm_ops to uniquely identify these | ||
58 | * VMAs. | ||
59 | */ | 42 | */ |
60 | static unsigned long mpx_mmap(unsigned long len) | 43 | static unsigned long mpx_mmap(unsigned long len) |
61 | { | 44 | { |
@@ -101,7 +84,6 @@ static unsigned long mpx_mmap(unsigned long len) | |||
101 | ret = -ENOMEM; | 84 | ret = -ENOMEM; |
102 | goto out; | 85 | goto out; |
103 | } | 86 | } |
104 | vma->vm_ops = &mpx_vma_ops; | ||
105 | 87 | ||
106 | if (vm_flags & VM_LOCKED) { | 88 | if (vm_flags & VM_LOCKED) { |
107 | up_write(&mm->mmap_sem); | 89 | up_write(&mm->mmap_sem); |
@@ -812,7 +794,7 @@ static noinline int zap_bt_entries_mapping(struct mm_struct *mm, | |||
812 | * so stop immediately and return an error. This | 794 | * so stop immediately and return an error. This |
813 | * probably results in a SIGSEGV. | 795 | * probably results in a SIGSEGV. |
814 | */ | 796 | */ |
815 | if (!is_mpx_vma(vma)) | 797 | if (!(vma->vm_flags & VM_MPX)) |
816 | return -EINVAL; | 798 | return -EINVAL; |
817 | 799 | ||
818 | len = min(vma->vm_end, end) - addr; | 800 | len = min(vma->vm_end, end) - addr; |
@@ -945,9 +927,9 @@ static int try_unmap_single_bt(struct mm_struct *mm, | |||
945 | * lots of tables even though we have no actual table | 927 | * lots of tables even though we have no actual table |
946 | * entries in use. | 928 | * entries in use. |
947 | */ | 929 | */ |
948 | while (next && is_mpx_vma(next)) | 930 | while (next && (next->vm_flags & VM_MPX)) |
949 | next = next->vm_next; | 931 | next = next->vm_next; |
950 | while (prev && is_mpx_vma(prev)) | 932 | while (prev && (prev->vm_flags & VM_MPX)) |
951 | prev = prev->vm_prev; | 933 | prev = prev->vm_prev; |
952 | /* | 934 | /* |
953 | * We know 'start' and 'end' lie within an area controlled | 935 | * We know 'start' and 'end' lie within an area controlled |
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index 3250f2371aea..90b924acd982 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c | |||
@@ -117,7 +117,7 @@ static void flush_tlb_func(void *info) | |||
117 | } else { | 117 | } else { |
118 | unsigned long addr; | 118 | unsigned long addr; |
119 | unsigned long nr_pages = | 119 | unsigned long nr_pages = |
120 | f->flush_end - f->flush_start / PAGE_SIZE; | 120 | (f->flush_end - f->flush_start) / PAGE_SIZE; |
121 | addr = f->flush_start; | 121 | addr = f->flush_start; |
122 | while (addr < f->flush_end) { | 122 | while (addr < f->flush_end) { |
123 | __flush_tlb_single(addr); | 123 | __flush_tlb_single(addr); |
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild index 14d15bf1a95b..5b478accd5fc 100644 --- a/arch/xtensa/include/asm/Kbuild +++ b/arch/xtensa/include/asm/Kbuild | |||
@@ -19,6 +19,7 @@ generic-y += linkage.h | |||
19 | generic-y += local.h | 19 | generic-y += local.h |
20 | generic-y += local64.h | 20 | generic-y += local64.h |
21 | generic-y += mcs_spinlock.h | 21 | generic-y += mcs_spinlock.h |
22 | generic-y += mm-arch-hooks.h | ||
22 | generic-y += percpu.h | 23 | generic-y += percpu.h |
23 | generic-y += preempt.h | 24 | generic-y += preempt.h |
24 | generic-y += resource.h | 25 | generic-y += resource.h |
diff --git a/arch/xtensa/include/asm/mm-arch-hooks.h b/arch/xtensa/include/asm/mm-arch-hooks.h deleted file mode 100644 index d2e5cfd3dd02..000000000000 --- a/arch/xtensa/include/asm/mm-arch-hooks.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | * | ||
4 | * Copyright (C) 2015, IBM Corporation | ||
5 | * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_XTENSA_MM_ARCH_HOOKS_H | ||
13 | #define _ASM_XTENSA_MM_ARCH_HOOKS_H | ||
14 | |||
15 | #endif /* _ASM_XTENSA_MM_ARCH_HOOKS_H */ | ||
diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 0436c21db7f2..719b7152aed1 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c | |||
@@ -51,7 +51,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, | |||
51 | unsigned long idx = BIO_POOL_NONE; | 51 | unsigned long idx = BIO_POOL_NONE; |
52 | unsigned inline_vecs; | 52 | unsigned inline_vecs; |
53 | 53 | ||
54 | if (!bs) { | 54 | if (!bs || !bs->bio_integrity_pool) { |
55 | bip = kmalloc(sizeof(struct bio_integrity_payload) + | 55 | bip = kmalloc(sizeof(struct bio_integrity_payload) + |
56 | sizeof(struct bio_vec) * nr_vecs, gfp_mask); | 56 | sizeof(struct bio_vec) * nr_vecs, gfp_mask); |
57 | inline_vecs = nr_vecs; | 57 | inline_vecs = nr_vecs; |
@@ -104,7 +104,7 @@ void bio_integrity_free(struct bio *bio) | |||
104 | kfree(page_address(bip->bip_vec->bv_page) + | 104 | kfree(page_address(bip->bip_vec->bv_page) + |
105 | bip->bip_vec->bv_offset); | 105 | bip->bip_vec->bv_offset); |
106 | 106 | ||
107 | if (bs) { | 107 | if (bs && bs->bio_integrity_pool) { |
108 | if (bip->bip_slab != BIO_POOL_NONE) | 108 | if (bip->bip_slab != BIO_POOL_NONE) |
109 | bvec_free(bs->bvec_integrity_pool, bip->bip_vec, | 109 | bvec_free(bs->bvec_integrity_pool, bip->bip_vec, |
110 | bip->bip_slab); | 110 | bip->bip_slab); |
diff --git a/block/bio.c b/block/bio.c index 2a00d349cd68..d6e5ba3399f0 100644 --- a/block/bio.c +++ b/block/bio.c | |||
@@ -1831,8 +1831,9 @@ EXPORT_SYMBOL(bio_endio); | |||
1831 | * Allocates and returns a new bio which represents @sectors from the start of | 1831 | * Allocates and returns a new bio which represents @sectors from the start of |
1832 | * @bio, and updates @bio to represent the remaining sectors. | 1832 | * @bio, and updates @bio to represent the remaining sectors. |
1833 | * | 1833 | * |
1834 | * The newly allocated bio will point to @bio's bi_io_vec; it is the caller's | 1834 | * Unless this is a discard request the newly allocated bio will point |
1835 | * responsibility to ensure that @bio is not freed before the split. | 1835 | * to @bio's bi_io_vec; it is the caller's responsibility to ensure that |
1836 | * @bio is not freed before the split. | ||
1836 | */ | 1837 | */ |
1837 | struct bio *bio_split(struct bio *bio, int sectors, | 1838 | struct bio *bio_split(struct bio *bio, int sectors, |
1838 | gfp_t gfp, struct bio_set *bs) | 1839 | gfp_t gfp, struct bio_set *bs) |
@@ -1842,7 +1843,15 @@ struct bio *bio_split(struct bio *bio, int sectors, | |||
1842 | BUG_ON(sectors <= 0); | 1843 | BUG_ON(sectors <= 0); |
1843 | BUG_ON(sectors >= bio_sectors(bio)); | 1844 | BUG_ON(sectors >= bio_sectors(bio)); |
1844 | 1845 | ||
1845 | split = bio_clone_fast(bio, gfp, bs); | 1846 | /* |
1847 | * Discards need a mutable bio_vec to accommodate the payload | ||
1848 | * required by the DSM TRIM and UNMAP commands. | ||
1849 | */ | ||
1850 | if (bio->bi_rw & REQ_DISCARD) | ||
1851 | split = bio_clone_bioset(bio, gfp, bs); | ||
1852 | else | ||
1853 | split = bio_clone_fast(bio, gfp, bs); | ||
1854 | |||
1846 | if (!split) | 1855 | if (!split) |
1847 | return NULL; | 1856 | return NULL; |
1848 | 1857 | ||
@@ -2009,6 +2018,7 @@ int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css) | |||
2009 | bio->bi_css = blkcg_css; | 2018 | bio->bi_css = blkcg_css; |
2010 | return 0; | 2019 | return 0; |
2011 | } | 2020 | } |
2021 | EXPORT_SYMBOL_GPL(bio_associate_blkcg); | ||
2012 | 2022 | ||
2013 | /** | 2023 | /** |
2014 | * bio_associate_current - associate a bio with %current | 2024 | * bio_associate_current - associate a bio with %current |
@@ -2039,6 +2049,7 @@ int bio_associate_current(struct bio *bio) | |||
2039 | bio->bi_css = task_get_css(current, blkio_cgrp_id); | 2049 | bio->bi_css = task_get_css(current, blkio_cgrp_id); |
2040 | return 0; | 2050 | return 0; |
2041 | } | 2051 | } |
2052 | EXPORT_SYMBOL_GPL(bio_associate_current); | ||
2042 | 2053 | ||
2043 | /** | 2054 | /** |
2044 | * bio_disassociate_task - undo bio_associate_current() | 2055 | * bio_disassociate_task - undo bio_associate_current() |
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 9f97da52d006..d6283b3f5db5 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -29,6 +29,14 @@ | |||
29 | 29 | ||
30 | #define MAX_KEY_LEN 100 | 30 | #define MAX_KEY_LEN 100 |
31 | 31 | ||
32 | /* | ||
33 | * blkcg_pol_mutex protects blkcg_policy[] and policy [de]activation. | ||
34 | * blkcg_pol_register_mutex nests outside of it and synchronizes entire | ||
35 | * policy [un]register operations including cgroup file additions / | ||
36 | * removals. Putting cgroup file registration outside blkcg_pol_mutex | ||
37 | * allows grabbing it from cgroup callbacks. | ||
38 | */ | ||
39 | static DEFINE_MUTEX(blkcg_pol_register_mutex); | ||
32 | static DEFINE_MUTEX(blkcg_pol_mutex); | 40 | static DEFINE_MUTEX(blkcg_pol_mutex); |
33 | 41 | ||
34 | struct blkcg blkcg_root; | 42 | struct blkcg blkcg_root; |
@@ -38,6 +46,8 @@ struct cgroup_subsys_state * const blkcg_root_css = &blkcg_root.css; | |||
38 | 46 | ||
39 | static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS]; | 47 | static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS]; |
40 | 48 | ||
49 | static LIST_HEAD(all_blkcgs); /* protected by blkcg_pol_mutex */ | ||
50 | |||
41 | static bool blkcg_policy_enabled(struct request_queue *q, | 51 | static bool blkcg_policy_enabled(struct request_queue *q, |
42 | const struct blkcg_policy *pol) | 52 | const struct blkcg_policy *pol) |
43 | { | 53 | { |
@@ -453,20 +463,7 @@ static int blkcg_reset_stats(struct cgroup_subsys_state *css, | |||
453 | struct blkcg_gq *blkg; | 463 | struct blkcg_gq *blkg; |
454 | int i; | 464 | int i; |
455 | 465 | ||
456 | /* | 466 | mutex_lock(&blkcg_pol_mutex); |
457 | * XXX: We invoke cgroup_add/rm_cftypes() under blkcg_pol_mutex | ||
458 | * which ends up putting cgroup's internal cgroup_tree_mutex under | ||
459 | * it; however, cgroup_tree_mutex is nested above cgroup file | ||
460 | * active protection and grabbing blkcg_pol_mutex from a cgroup | ||
461 | * file operation creates a possible circular dependency. cgroup | ||
462 | * internal locking is planned to go through further simplification | ||
463 | * and this issue should go away soon. For now, let's trylock | ||
464 | * blkcg_pol_mutex and restart the write on failure. | ||
465 | * | ||
466 | * http://lkml.kernel.org/g/5363C04B.4010400@oracle.com | ||
467 | */ | ||
468 | if (!mutex_trylock(&blkcg_pol_mutex)) | ||
469 | return restart_syscall(); | ||
470 | spin_lock_irq(&blkcg->lock); | 467 | spin_lock_irq(&blkcg->lock); |
471 | 468 | ||
472 | /* | 469 | /* |
@@ -721,8 +718,12 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, | |||
721 | return -EINVAL; | 718 | return -EINVAL; |
722 | 719 | ||
723 | disk = get_gendisk(MKDEV(major, minor), &part); | 720 | disk = get_gendisk(MKDEV(major, minor), &part); |
724 | if (!disk || part) | 721 | if (!disk) |
722 | return -EINVAL; | ||
723 | if (part) { | ||
724 | put_disk(disk); | ||
725 | return -EINVAL; | 725 | return -EINVAL; |
726 | } | ||
726 | 727 | ||
727 | rcu_read_lock(); | 728 | rcu_read_lock(); |
728 | spin_lock_irq(disk->queue->queue_lock); | 729 | spin_lock_irq(disk->queue->queue_lock); |
@@ -822,8 +823,17 @@ static void blkcg_css_free(struct cgroup_subsys_state *css) | |||
822 | { | 823 | { |
823 | struct blkcg *blkcg = css_to_blkcg(css); | 824 | struct blkcg *blkcg = css_to_blkcg(css); |
824 | 825 | ||
825 | if (blkcg != &blkcg_root) | 826 | mutex_lock(&blkcg_pol_mutex); |
827 | list_del(&blkcg->all_blkcgs_node); | ||
828 | mutex_unlock(&blkcg_pol_mutex); | ||
829 | |||
830 | if (blkcg != &blkcg_root) { | ||
831 | int i; | ||
832 | |||
833 | for (i = 0; i < BLKCG_MAX_POLS; i++) | ||
834 | kfree(blkcg->pd[i]); | ||
826 | kfree(blkcg); | 835 | kfree(blkcg); |
836 | } | ||
827 | } | 837 | } |
828 | 838 | ||
829 | static struct cgroup_subsys_state * | 839 | static struct cgroup_subsys_state * |
@@ -833,6 +843,8 @@ blkcg_css_alloc(struct cgroup_subsys_state *parent_css) | |||
833 | struct cgroup_subsys_state *ret; | 843 | struct cgroup_subsys_state *ret; |
834 | int i; | 844 | int i; |
835 | 845 | ||
846 | mutex_lock(&blkcg_pol_mutex); | ||
847 | |||
836 | if (!parent_css) { | 848 | if (!parent_css) { |
837 | blkcg = &blkcg_root; | 849 | blkcg = &blkcg_root; |
838 | goto done; | 850 | goto done; |
@@ -875,14 +887,17 @@ done: | |||
875 | #ifdef CONFIG_CGROUP_WRITEBACK | 887 | #ifdef CONFIG_CGROUP_WRITEBACK |
876 | INIT_LIST_HEAD(&blkcg->cgwb_list); | 888 | INIT_LIST_HEAD(&blkcg->cgwb_list); |
877 | #endif | 889 | #endif |
890 | list_add_tail(&blkcg->all_blkcgs_node, &all_blkcgs); | ||
891 | |||
892 | mutex_unlock(&blkcg_pol_mutex); | ||
878 | return &blkcg->css; | 893 | return &blkcg->css; |
879 | 894 | ||
880 | free_pd_blkcg: | 895 | free_pd_blkcg: |
881 | for (i--; i >= 0; i--) | 896 | for (i--; i >= 0; i--) |
882 | kfree(blkcg->pd[i]); | 897 | kfree(blkcg->pd[i]); |
883 | |||
884 | free_blkcg: | 898 | free_blkcg: |
885 | kfree(blkcg); | 899 | kfree(blkcg); |
900 | mutex_unlock(&blkcg_pol_mutex); | ||
886 | return ret; | 901 | return ret; |
887 | } | 902 | } |
888 | 903 | ||
@@ -1037,10 +1052,8 @@ int blkcg_activate_policy(struct request_queue *q, | |||
1037 | const struct blkcg_policy *pol) | 1052 | const struct blkcg_policy *pol) |
1038 | { | 1053 | { |
1039 | LIST_HEAD(pds); | 1054 | LIST_HEAD(pds); |
1040 | LIST_HEAD(cpds); | ||
1041 | struct blkcg_gq *blkg; | 1055 | struct blkcg_gq *blkg; |
1042 | struct blkg_policy_data *pd, *nd; | 1056 | struct blkg_policy_data *pd, *nd; |
1043 | struct blkcg_policy_data *cpd, *cnd; | ||
1044 | int cnt = 0, ret; | 1057 | int cnt = 0, ret; |
1045 | 1058 | ||
1046 | if (blkcg_policy_enabled(q, pol)) | 1059 | if (blkcg_policy_enabled(q, pol)) |
@@ -1053,10 +1066,7 @@ int blkcg_activate_policy(struct request_queue *q, | |||
1053 | cnt++; | 1066 | cnt++; |
1054 | spin_unlock_irq(q->queue_lock); | 1067 | spin_unlock_irq(q->queue_lock); |
1055 | 1068 | ||
1056 | /* | 1069 | /* allocate per-blkg policy data for all existing blkgs */ |
1057 | * Allocate per-blkg and per-blkcg policy data | ||
1058 | * for all existing blkgs. | ||
1059 | */ | ||
1060 | while (cnt--) { | 1070 | while (cnt--) { |
1061 | pd = kzalloc_node(pol->pd_size, GFP_KERNEL, q->node); | 1071 | pd = kzalloc_node(pol->pd_size, GFP_KERNEL, q->node); |
1062 | if (!pd) { | 1072 | if (!pd) { |
@@ -1064,15 +1074,6 @@ int blkcg_activate_policy(struct request_queue *q, | |||
1064 | goto out_free; | 1074 | goto out_free; |
1065 | } | 1075 | } |
1066 | list_add_tail(&pd->alloc_node, &pds); | 1076 | list_add_tail(&pd->alloc_node, &pds); |
1067 | |||
1068 | if (!pol->cpd_size) | ||
1069 | continue; | ||
1070 | cpd = kzalloc_node(pol->cpd_size, GFP_KERNEL, q->node); | ||
1071 | if (!cpd) { | ||
1072 | ret = -ENOMEM; | ||
1073 | goto out_free; | ||
1074 | } | ||
1075 | list_add_tail(&cpd->alloc_node, &cpds); | ||
1076 | } | 1077 | } |
1077 | 1078 | ||
1078 | /* | 1079 | /* |
@@ -1082,32 +1083,17 @@ int blkcg_activate_policy(struct request_queue *q, | |||
1082 | spin_lock_irq(q->queue_lock); | 1083 | spin_lock_irq(q->queue_lock); |
1083 | 1084 | ||
1084 | list_for_each_entry(blkg, &q->blkg_list, q_node) { | 1085 | list_for_each_entry(blkg, &q->blkg_list, q_node) { |
1085 | if (WARN_ON(list_empty(&pds)) || | 1086 | if (WARN_ON(list_empty(&pds))) { |
1086 | WARN_ON(pol->cpd_size && list_empty(&cpds))) { | ||
1087 | /* umm... this shouldn't happen, just abort */ | 1087 | /* umm... this shouldn't happen, just abort */ |
1088 | ret = -ENOMEM; | 1088 | ret = -ENOMEM; |
1089 | goto out_unlock; | 1089 | goto out_unlock; |
1090 | } | 1090 | } |
1091 | cpd = list_first_entry(&cpds, struct blkcg_policy_data, | ||
1092 | alloc_node); | ||
1093 | list_del_init(&cpd->alloc_node); | ||
1094 | pd = list_first_entry(&pds, struct blkg_policy_data, alloc_node); | 1091 | pd = list_first_entry(&pds, struct blkg_policy_data, alloc_node); |
1095 | list_del_init(&pd->alloc_node); | 1092 | list_del_init(&pd->alloc_node); |
1096 | 1093 | ||
1097 | /* grab blkcg lock too while installing @pd on @blkg */ | 1094 | /* grab blkcg lock too while installing @pd on @blkg */ |
1098 | spin_lock(&blkg->blkcg->lock); | 1095 | spin_lock(&blkg->blkcg->lock); |
1099 | 1096 | ||
1100 | if (!pol->cpd_size) | ||
1101 | goto no_cpd; | ||
1102 | if (!blkg->blkcg->pd[pol->plid]) { | ||
1103 | /* Per-policy per-blkcg data */ | ||
1104 | blkg->blkcg->pd[pol->plid] = cpd; | ||
1105 | cpd->plid = pol->plid; | ||
1106 | pol->cpd_init_fn(blkg->blkcg); | ||
1107 | } else { /* must free it as it has already been extracted */ | ||
1108 | kfree(cpd); | ||
1109 | } | ||
1110 | no_cpd: | ||
1111 | blkg->pd[pol->plid] = pd; | 1097 | blkg->pd[pol->plid] = pd; |
1112 | pd->blkg = blkg; | 1098 | pd->blkg = blkg; |
1113 | pd->plid = pol->plid; | 1099 | pd->plid = pol->plid; |
@@ -1124,8 +1110,6 @@ out_free: | |||
1124 | blk_queue_bypass_end(q); | 1110 | blk_queue_bypass_end(q); |
1125 | list_for_each_entry_safe(pd, nd, &pds, alloc_node) | 1111 | list_for_each_entry_safe(pd, nd, &pds, alloc_node) |
1126 | kfree(pd); | 1112 | kfree(pd); |
1127 | list_for_each_entry_safe(cpd, cnd, &cpds, alloc_node) | ||
1128 | kfree(cpd); | ||
1129 | return ret; | 1113 | return ret; |
1130 | } | 1114 | } |
1131 | EXPORT_SYMBOL_GPL(blkcg_activate_policy); | 1115 | EXPORT_SYMBOL_GPL(blkcg_activate_policy); |
@@ -1162,8 +1146,6 @@ void blkcg_deactivate_policy(struct request_queue *q, | |||
1162 | 1146 | ||
1163 | kfree(blkg->pd[pol->plid]); | 1147 | kfree(blkg->pd[pol->plid]); |
1164 | blkg->pd[pol->plid] = NULL; | 1148 | blkg->pd[pol->plid] = NULL; |
1165 | kfree(blkg->blkcg->pd[pol->plid]); | ||
1166 | blkg->blkcg->pd[pol->plid] = NULL; | ||
1167 | 1149 | ||
1168 | spin_unlock(&blkg->blkcg->lock); | 1150 | spin_unlock(&blkg->blkcg->lock); |
1169 | } | 1151 | } |
@@ -1182,11 +1164,13 @@ EXPORT_SYMBOL_GPL(blkcg_deactivate_policy); | |||
1182 | */ | 1164 | */ |
1183 | int blkcg_policy_register(struct blkcg_policy *pol) | 1165 | int blkcg_policy_register(struct blkcg_policy *pol) |
1184 | { | 1166 | { |
1167 | struct blkcg *blkcg; | ||
1185 | int i, ret; | 1168 | int i, ret; |
1186 | 1169 | ||
1187 | if (WARN_ON(pol->pd_size < sizeof(struct blkg_policy_data))) | 1170 | if (WARN_ON(pol->pd_size < sizeof(struct blkg_policy_data))) |
1188 | return -EINVAL; | 1171 | return -EINVAL; |
1189 | 1172 | ||
1173 | mutex_lock(&blkcg_pol_register_mutex); | ||
1190 | mutex_lock(&blkcg_pol_mutex); | 1174 | mutex_lock(&blkcg_pol_mutex); |
1191 | 1175 | ||
1192 | /* find an empty slot */ | 1176 | /* find an empty slot */ |
@@ -1195,19 +1179,49 @@ int blkcg_policy_register(struct blkcg_policy *pol) | |||
1195 | if (!blkcg_policy[i]) | 1179 | if (!blkcg_policy[i]) |
1196 | break; | 1180 | break; |
1197 | if (i >= BLKCG_MAX_POLS) | 1181 | if (i >= BLKCG_MAX_POLS) |
1198 | goto out_unlock; | 1182 | goto err_unlock; |
1199 | 1183 | ||
1200 | /* register and update blkgs */ | 1184 | /* register @pol */ |
1201 | pol->plid = i; | 1185 | pol->plid = i; |
1202 | blkcg_policy[i] = pol; | 1186 | blkcg_policy[pol->plid] = pol; |
1187 | |||
1188 | /* allocate and install cpd's */ | ||
1189 | if (pol->cpd_size) { | ||
1190 | list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) { | ||
1191 | struct blkcg_policy_data *cpd; | ||
1192 | |||
1193 | cpd = kzalloc(pol->cpd_size, GFP_KERNEL); | ||
1194 | if (!cpd) { | ||
1195 | mutex_unlock(&blkcg_pol_mutex); | ||
1196 | goto err_free_cpds; | ||
1197 | } | ||
1198 | |||
1199 | blkcg->pd[pol->plid] = cpd; | ||
1200 | cpd->plid = pol->plid; | ||
1201 | pol->cpd_init_fn(blkcg); | ||
1202 | } | ||
1203 | } | ||
1204 | |||
1205 | mutex_unlock(&blkcg_pol_mutex); | ||
1203 | 1206 | ||
1204 | /* everything is in place, add intf files for the new policy */ | 1207 | /* everything is in place, add intf files for the new policy */ |
1205 | if (pol->cftypes) | 1208 | if (pol->cftypes) |
1206 | WARN_ON(cgroup_add_legacy_cftypes(&blkio_cgrp_subsys, | 1209 | WARN_ON(cgroup_add_legacy_cftypes(&blkio_cgrp_subsys, |
1207 | pol->cftypes)); | 1210 | pol->cftypes)); |
1208 | ret = 0; | 1211 | mutex_unlock(&blkcg_pol_register_mutex); |
1209 | out_unlock: | 1212 | return 0; |
1213 | |||
1214 | err_free_cpds: | ||
1215 | if (pol->cpd_size) { | ||
1216 | list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) { | ||
1217 | kfree(blkcg->pd[pol->plid]); | ||
1218 | blkcg->pd[pol->plid] = NULL; | ||
1219 | } | ||
1220 | } | ||
1221 | blkcg_policy[pol->plid] = NULL; | ||
1222 | err_unlock: | ||
1210 | mutex_unlock(&blkcg_pol_mutex); | 1223 | mutex_unlock(&blkcg_pol_mutex); |
1224 | mutex_unlock(&blkcg_pol_register_mutex); | ||
1211 | return ret; | 1225 | return ret; |
1212 | } | 1226 | } |
1213 | EXPORT_SYMBOL_GPL(blkcg_policy_register); | 1227 | EXPORT_SYMBOL_GPL(blkcg_policy_register); |
@@ -1220,7 +1234,9 @@ EXPORT_SYMBOL_GPL(blkcg_policy_register); | |||
1220 | */ | 1234 | */ |
1221 | void blkcg_policy_unregister(struct blkcg_policy *pol) | 1235 | void blkcg_policy_unregister(struct blkcg_policy *pol) |
1222 | { | 1236 | { |
1223 | mutex_lock(&blkcg_pol_mutex); | 1237 | struct blkcg *blkcg; |
1238 | |||
1239 | mutex_lock(&blkcg_pol_register_mutex); | ||
1224 | 1240 | ||
1225 | if (WARN_ON(blkcg_policy[pol->plid] != pol)) | 1241 | if (WARN_ON(blkcg_policy[pol->plid] != pol)) |
1226 | goto out_unlock; | 1242 | goto out_unlock; |
@@ -1229,9 +1245,19 @@ void blkcg_policy_unregister(struct blkcg_policy *pol) | |||
1229 | if (pol->cftypes) | 1245 | if (pol->cftypes) |
1230 | cgroup_rm_cftypes(pol->cftypes); | 1246 | cgroup_rm_cftypes(pol->cftypes); |
1231 | 1247 | ||
1232 | /* unregister and update blkgs */ | 1248 | /* remove cpds and unregister */ |
1249 | mutex_lock(&blkcg_pol_mutex); | ||
1250 | |||
1251 | if (pol->cpd_size) { | ||
1252 | list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) { | ||
1253 | kfree(blkcg->pd[pol->plid]); | ||
1254 | blkcg->pd[pol->plid] = NULL; | ||
1255 | } | ||
1256 | } | ||
1233 | blkcg_policy[pol->plid] = NULL; | 1257 | blkcg_policy[pol->plid] = NULL; |
1234 | out_unlock: | 1258 | |
1235 | mutex_unlock(&blkcg_pol_mutex); | 1259 | mutex_unlock(&blkcg_pol_mutex); |
1260 | out_unlock: | ||
1261 | mutex_unlock(&blkcg_pol_register_mutex); | ||
1236 | } | 1262 | } |
1237 | EXPORT_SYMBOL_GPL(blkcg_policy_unregister); | 1263 | EXPORT_SYMBOL_GPL(blkcg_policy_unregister); |
diff --git a/block/blk-core.c b/block/blk-core.c index 82819e68f58b..627ed0c593fb 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -3370,7 +3370,7 @@ EXPORT_SYMBOL(blk_post_runtime_resume); | |||
3370 | int __init blk_dev_init(void) | 3370 | int __init blk_dev_init(void) |
3371 | { | 3371 | { |
3372 | BUILD_BUG_ON(__REQ_NR_BITS > 8 * | 3372 | BUILD_BUG_ON(__REQ_NR_BITS > 8 * |
3373 | sizeof(((struct request *)0)->cmd_flags)); | 3373 | FIELD_SIZEOF(struct request, cmd_flags)); |
3374 | 3374 | ||
3375 | /* used for unplugging and affects IO latency/throughput - HIGHPRI */ | 3375 | /* used for unplugging and affects IO latency/throughput - HIGHPRI */ |
3376 | kblockd_workqueue = alloc_workqueue("kblockd", | 3376 | kblockd_workqueue = alloc_workqueue("kblockd", |
diff --git a/block/blk-mq.c b/block/blk-mq.c index f53779692c77..7d842db59699 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -1998,7 +1998,7 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, | |||
1998 | goto err_hctxs; | 1998 | goto err_hctxs; |
1999 | 1999 | ||
2000 | setup_timer(&q->timeout, blk_mq_rq_timer, (unsigned long) q); | 2000 | setup_timer(&q->timeout, blk_mq_rq_timer, (unsigned long) q); |
2001 | blk_queue_rq_timeout(q, set->timeout ? set->timeout : 30000); | 2001 | blk_queue_rq_timeout(q, set->timeout ? set->timeout : 30 * HZ); |
2002 | 2002 | ||
2003 | q->nr_queues = nr_cpu_ids; | 2003 | q->nr_queues = nr_cpu_ids; |
2004 | q->nr_hw_queues = set->nr_hw_queues; | 2004 | q->nr_hw_queues = set->nr_hw_queues; |
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 569ee090343f..46b58abb08c5 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -352,13 +352,16 @@ static int acpi_lpss_create_device(struct acpi_device *adev, | |||
352 | pdata->mmio_size = resource_size(rentry->res); | 352 | pdata->mmio_size = resource_size(rentry->res); |
353 | pdata->mmio_base = ioremap(rentry->res->start, | 353 | pdata->mmio_base = ioremap(rentry->res->start, |
354 | pdata->mmio_size); | 354 | pdata->mmio_size); |
355 | if (!pdata->mmio_base) | ||
356 | goto err_out; | ||
357 | break; | 355 | break; |
358 | } | 356 | } |
359 | 357 | ||
360 | acpi_dev_free_resource_list(&resource_list); | 358 | acpi_dev_free_resource_list(&resource_list); |
361 | 359 | ||
360 | if (!pdata->mmio_base) { | ||
361 | ret = -ENOMEM; | ||
362 | goto err_out; | ||
363 | } | ||
364 | |||
362 | pdata->dev_desc = dev_desc; | 365 | pdata->dev_desc = dev_desc; |
363 | 366 | ||
364 | if (dev_desc->setup) | 367 | if (dev_desc->setup) |
diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c index 2161fa178c8d..628a42c41ab1 100644 --- a/drivers/acpi/nfit.c +++ b/drivers/acpi/nfit.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/list.h> | 18 | #include <linux/list.h> |
19 | #include <linux/acpi.h> | 19 | #include <linux/acpi.h> |
20 | #include <linux/sort.h> | 20 | #include <linux/sort.h> |
21 | #include <linux/pmem.h> | ||
21 | #include <linux/io.h> | 22 | #include <linux/io.h> |
22 | #include "nfit.h" | 23 | #include "nfit.h" |
23 | 24 | ||
@@ -305,6 +306,23 @@ static bool add_idt(struct acpi_nfit_desc *acpi_desc, | |||
305 | return true; | 306 | return true; |
306 | } | 307 | } |
307 | 308 | ||
309 | static bool add_flush(struct acpi_nfit_desc *acpi_desc, | ||
310 | struct acpi_nfit_flush_address *flush) | ||
311 | { | ||
312 | struct device *dev = acpi_desc->dev; | ||
313 | struct nfit_flush *nfit_flush = devm_kzalloc(dev, sizeof(*nfit_flush), | ||
314 | GFP_KERNEL); | ||
315 | |||
316 | if (!nfit_flush) | ||
317 | return false; | ||
318 | INIT_LIST_HEAD(&nfit_flush->list); | ||
319 | nfit_flush->flush = flush; | ||
320 | list_add_tail(&nfit_flush->list, &acpi_desc->flushes); | ||
321 | dev_dbg(dev, "%s: nfit_flush handle: %d hint_count: %d\n", __func__, | ||
322 | flush->device_handle, flush->hint_count); | ||
323 | return true; | ||
324 | } | ||
325 | |||
308 | static void *add_table(struct acpi_nfit_desc *acpi_desc, void *table, | 326 | static void *add_table(struct acpi_nfit_desc *acpi_desc, void *table, |
309 | const void *end) | 327 | const void *end) |
310 | { | 328 | { |
@@ -338,7 +356,8 @@ static void *add_table(struct acpi_nfit_desc *acpi_desc, void *table, | |||
338 | return err; | 356 | return err; |
339 | break; | 357 | break; |
340 | case ACPI_NFIT_TYPE_FLUSH_ADDRESS: | 358 | case ACPI_NFIT_TYPE_FLUSH_ADDRESS: |
341 | dev_dbg(dev, "%s: flush\n", __func__); | 359 | if (!add_flush(acpi_desc, table)) |
360 | return err; | ||
342 | break; | 361 | break; |
343 | case ACPI_NFIT_TYPE_SMBIOS: | 362 | case ACPI_NFIT_TYPE_SMBIOS: |
344 | dev_dbg(dev, "%s: smbios\n", __func__); | 363 | dev_dbg(dev, "%s: smbios\n", __func__); |
@@ -389,6 +408,7 @@ static int nfit_mem_add(struct acpi_nfit_desc *acpi_desc, | |||
389 | { | 408 | { |
390 | u16 dcr = __to_nfit_memdev(nfit_mem)->region_index; | 409 | u16 dcr = __to_nfit_memdev(nfit_mem)->region_index; |
391 | struct nfit_memdev *nfit_memdev; | 410 | struct nfit_memdev *nfit_memdev; |
411 | struct nfit_flush *nfit_flush; | ||
392 | struct nfit_dcr *nfit_dcr; | 412 | struct nfit_dcr *nfit_dcr; |
393 | struct nfit_bdw *nfit_bdw; | 413 | struct nfit_bdw *nfit_bdw; |
394 | struct nfit_idt *nfit_idt; | 414 | struct nfit_idt *nfit_idt; |
@@ -442,6 +462,14 @@ static int nfit_mem_add(struct acpi_nfit_desc *acpi_desc, | |||
442 | nfit_mem->idt_bdw = nfit_idt->idt; | 462 | nfit_mem->idt_bdw = nfit_idt->idt; |
443 | break; | 463 | break; |
444 | } | 464 | } |
465 | |||
466 | list_for_each_entry(nfit_flush, &acpi_desc->flushes, list) { | ||
467 | if (nfit_flush->flush->device_handle != | ||
468 | nfit_memdev->memdev->device_handle) | ||
469 | continue; | ||
470 | nfit_mem->nfit_flush = nfit_flush; | ||
471 | break; | ||
472 | } | ||
445 | break; | 473 | break; |
446 | } | 474 | } |
447 | 475 | ||
@@ -978,6 +1006,24 @@ static u64 to_interleave_offset(u64 offset, struct nfit_blk_mmio *mmio) | |||
978 | return mmio->base_offset + line_offset + table_offset + sub_line_offset; | 1006 | return mmio->base_offset + line_offset + table_offset + sub_line_offset; |
979 | } | 1007 | } |
980 | 1008 | ||
1009 | static void wmb_blk(struct nfit_blk *nfit_blk) | ||
1010 | { | ||
1011 | |||
1012 | if (nfit_blk->nvdimm_flush) { | ||
1013 | /* | ||
1014 | * The first wmb() is needed to 'sfence' all previous writes | ||
1015 | * such that they are architecturally visible for the platform | ||
1016 | * buffer flush. Note that we've already arranged for pmem | ||
1017 | * writes to avoid the cache via arch_memcpy_to_pmem(). The | ||
1018 | * final wmb() ensures ordering for the NVDIMM flush write. | ||
1019 | */ | ||
1020 | wmb(); | ||
1021 | writeq(1, nfit_blk->nvdimm_flush); | ||
1022 | wmb(); | ||
1023 | } else | ||
1024 | wmb_pmem(); | ||
1025 | } | ||
1026 | |||
981 | static u64 read_blk_stat(struct nfit_blk *nfit_blk, unsigned int bw) | 1027 | static u64 read_blk_stat(struct nfit_blk *nfit_blk, unsigned int bw) |
982 | { | 1028 | { |
983 | struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR]; | 1029 | struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR]; |
@@ -1012,7 +1058,10 @@ static void write_blk_ctl(struct nfit_blk *nfit_blk, unsigned int bw, | |||
1012 | offset = to_interleave_offset(offset, mmio); | 1058 | offset = to_interleave_offset(offset, mmio); |
1013 | 1059 | ||
1014 | writeq(cmd, mmio->base + offset); | 1060 | writeq(cmd, mmio->base + offset); |
1015 | /* FIXME: conditionally perform read-back if mandated by firmware */ | 1061 | wmb_blk(nfit_blk); |
1062 | |||
1063 | if (nfit_blk->dimm_flags & ND_BLK_DCR_LATCH) | ||
1064 | readq(mmio->base + offset); | ||
1016 | } | 1065 | } |
1017 | 1066 | ||
1018 | static int acpi_nfit_blk_single_io(struct nfit_blk *nfit_blk, | 1067 | static int acpi_nfit_blk_single_io(struct nfit_blk *nfit_blk, |
@@ -1026,7 +1075,6 @@ static int acpi_nfit_blk_single_io(struct nfit_blk *nfit_blk, | |||
1026 | 1075 | ||
1027 | base_offset = nfit_blk->bdw_offset + dpa % L1_CACHE_BYTES | 1076 | base_offset = nfit_blk->bdw_offset + dpa % L1_CACHE_BYTES |
1028 | + lane * mmio->size; | 1077 | + lane * mmio->size; |
1029 | /* TODO: non-temporal access, flush hints, cache management etc... */ | ||
1030 | write_blk_ctl(nfit_blk, lane, dpa, len, rw); | 1078 | write_blk_ctl(nfit_blk, lane, dpa, len, rw); |
1031 | while (len) { | 1079 | while (len) { |
1032 | unsigned int c; | 1080 | unsigned int c; |
@@ -1045,13 +1093,19 @@ static int acpi_nfit_blk_single_io(struct nfit_blk *nfit_blk, | |||
1045 | } | 1093 | } |
1046 | 1094 | ||
1047 | if (rw) | 1095 | if (rw) |
1048 | memcpy(mmio->aperture + offset, iobuf + copied, c); | 1096 | memcpy_to_pmem(mmio->aperture + offset, |
1097 | iobuf + copied, c); | ||
1049 | else | 1098 | else |
1050 | memcpy(iobuf + copied, mmio->aperture + offset, c); | 1099 | memcpy_from_pmem(iobuf + copied, |
1100 | mmio->aperture + offset, c); | ||
1051 | 1101 | ||
1052 | copied += c; | 1102 | copied += c; |
1053 | len -= c; | 1103 | len -= c; |
1054 | } | 1104 | } |
1105 | |||
1106 | if (rw) | ||
1107 | wmb_blk(nfit_blk); | ||
1108 | |||
1055 | rc = read_blk_stat(nfit_blk, lane) ? -EIO : 0; | 1109 | rc = read_blk_stat(nfit_blk, lane) ? -EIO : 0; |
1056 | return rc; | 1110 | return rc; |
1057 | } | 1111 | } |
@@ -1124,7 +1178,7 @@ static void nfit_spa_unmap(struct acpi_nfit_desc *acpi_desc, | |||
1124 | } | 1178 | } |
1125 | 1179 | ||
1126 | static void __iomem *__nfit_spa_map(struct acpi_nfit_desc *acpi_desc, | 1180 | static void __iomem *__nfit_spa_map(struct acpi_nfit_desc *acpi_desc, |
1127 | struct acpi_nfit_system_address *spa) | 1181 | struct acpi_nfit_system_address *spa, enum spa_map_type type) |
1128 | { | 1182 | { |
1129 | resource_size_t start = spa->address; | 1183 | resource_size_t start = spa->address; |
1130 | resource_size_t n = spa->length; | 1184 | resource_size_t n = spa->length; |
@@ -1152,8 +1206,15 @@ static void __iomem *__nfit_spa_map(struct acpi_nfit_desc *acpi_desc, | |||
1152 | if (!res) | 1206 | if (!res) |
1153 | goto err_mem; | 1207 | goto err_mem; |
1154 | 1208 | ||
1155 | /* TODO: cacheability based on the spa type */ | 1209 | if (type == SPA_MAP_APERTURE) { |
1156 | spa_map->iomem = ioremap_nocache(start, n); | 1210 | /* |
1211 | * TODO: memremap_pmem() support, but that requires cache | ||
1212 | * flushing when the aperture is moved. | ||
1213 | */ | ||
1214 | spa_map->iomem = ioremap_wc(start, n); | ||
1215 | } else | ||
1216 | spa_map->iomem = ioremap_nocache(start, n); | ||
1217 | |||
1157 | if (!spa_map->iomem) | 1218 | if (!spa_map->iomem) |
1158 | goto err_map; | 1219 | goto err_map; |
1159 | 1220 | ||
@@ -1171,6 +1232,7 @@ static void __iomem *__nfit_spa_map(struct acpi_nfit_desc *acpi_desc, | |||
1171 | * nfit_spa_map - interleave-aware managed-mappings of acpi_nfit_system_address ranges | 1232 | * nfit_spa_map - interleave-aware managed-mappings of acpi_nfit_system_address ranges |
1172 | * @nvdimm_bus: NFIT-bus that provided the spa table entry | 1233 | * @nvdimm_bus: NFIT-bus that provided the spa table entry |
1173 | * @nfit_spa: spa table to map | 1234 | * @nfit_spa: spa table to map |
1235 | * @type: aperture or control region | ||
1174 | * | 1236 | * |
1175 | * In the case where block-data-window apertures and | 1237 | * In the case where block-data-window apertures and |
1176 | * dimm-control-regions are interleaved they will end up sharing a | 1238 | * dimm-control-regions are interleaved they will end up sharing a |
@@ -1180,12 +1242,12 @@ static void __iomem *__nfit_spa_map(struct acpi_nfit_desc *acpi_desc, | |||
1180 | * unbound. | 1242 | * unbound. |
1181 | */ | 1243 | */ |
1182 | static void __iomem *nfit_spa_map(struct acpi_nfit_desc *acpi_desc, | 1244 | static void __iomem *nfit_spa_map(struct acpi_nfit_desc *acpi_desc, |
1183 | struct acpi_nfit_system_address *spa) | 1245 | struct acpi_nfit_system_address *spa, enum spa_map_type type) |
1184 | { | 1246 | { |
1185 | void __iomem *iomem; | 1247 | void __iomem *iomem; |
1186 | 1248 | ||
1187 | mutex_lock(&acpi_desc->spa_map_mutex); | 1249 | mutex_lock(&acpi_desc->spa_map_mutex); |
1188 | iomem = __nfit_spa_map(acpi_desc, spa); | 1250 | iomem = __nfit_spa_map(acpi_desc, spa, type); |
1189 | mutex_unlock(&acpi_desc->spa_map_mutex); | 1251 | mutex_unlock(&acpi_desc->spa_map_mutex); |
1190 | 1252 | ||
1191 | return iomem; | 1253 | return iomem; |
@@ -1206,12 +1268,35 @@ static int nfit_blk_init_interleave(struct nfit_blk_mmio *mmio, | |||
1206 | return 0; | 1268 | return 0; |
1207 | } | 1269 | } |
1208 | 1270 | ||
1271 | static int acpi_nfit_blk_get_flags(struct nvdimm_bus_descriptor *nd_desc, | ||
1272 | struct nvdimm *nvdimm, struct nfit_blk *nfit_blk) | ||
1273 | { | ||
1274 | struct nd_cmd_dimm_flags flags; | ||
1275 | int rc; | ||
1276 | |||
1277 | memset(&flags, 0, sizeof(flags)); | ||
1278 | rc = nd_desc->ndctl(nd_desc, nvdimm, ND_CMD_DIMM_FLAGS, &flags, | ||
1279 | sizeof(flags)); | ||
1280 | |||
1281 | if (rc >= 0 && flags.status == 0) | ||
1282 | nfit_blk->dimm_flags = flags.flags; | ||
1283 | else if (rc == -ENOTTY) { | ||
1284 | /* fall back to a conservative default */ | ||
1285 | nfit_blk->dimm_flags = ND_BLK_DCR_LATCH; | ||
1286 | rc = 0; | ||
1287 | } else | ||
1288 | rc = -ENXIO; | ||
1289 | |||
1290 | return rc; | ||
1291 | } | ||
1292 | |||
1209 | static int acpi_nfit_blk_region_enable(struct nvdimm_bus *nvdimm_bus, | 1293 | static int acpi_nfit_blk_region_enable(struct nvdimm_bus *nvdimm_bus, |
1210 | struct device *dev) | 1294 | struct device *dev) |
1211 | { | 1295 | { |
1212 | struct nvdimm_bus_descriptor *nd_desc = to_nd_desc(nvdimm_bus); | 1296 | struct nvdimm_bus_descriptor *nd_desc = to_nd_desc(nvdimm_bus); |
1213 | struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); | 1297 | struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); |
1214 | struct nd_blk_region *ndbr = to_nd_blk_region(dev); | 1298 | struct nd_blk_region *ndbr = to_nd_blk_region(dev); |
1299 | struct nfit_flush *nfit_flush; | ||
1215 | struct nfit_blk_mmio *mmio; | 1300 | struct nfit_blk_mmio *mmio; |
1216 | struct nfit_blk *nfit_blk; | 1301 | struct nfit_blk *nfit_blk; |
1217 | struct nfit_mem *nfit_mem; | 1302 | struct nfit_mem *nfit_mem; |
@@ -1223,8 +1308,8 @@ static int acpi_nfit_blk_region_enable(struct nvdimm_bus *nvdimm_bus, | |||
1223 | if (!nfit_mem || !nfit_mem->dcr || !nfit_mem->bdw) { | 1308 | if (!nfit_mem || !nfit_mem->dcr || !nfit_mem->bdw) { |
1224 | dev_dbg(dev, "%s: missing%s%s%s\n", __func__, | 1309 | dev_dbg(dev, "%s: missing%s%s%s\n", __func__, |
1225 | nfit_mem ? "" : " nfit_mem", | 1310 | nfit_mem ? "" : " nfit_mem", |
1226 | nfit_mem->dcr ? "" : " dcr", | 1311 | (nfit_mem && nfit_mem->dcr) ? "" : " dcr", |
1227 | nfit_mem->bdw ? "" : " bdw"); | 1312 | (nfit_mem && nfit_mem->bdw) ? "" : " bdw"); |
1228 | return -ENXIO; | 1313 | return -ENXIO; |
1229 | } | 1314 | } |
1230 | 1315 | ||
@@ -1237,7 +1322,8 @@ static int acpi_nfit_blk_region_enable(struct nvdimm_bus *nvdimm_bus, | |||
1237 | /* map block aperture memory */ | 1322 | /* map block aperture memory */ |
1238 | nfit_blk->bdw_offset = nfit_mem->bdw->offset; | 1323 | nfit_blk->bdw_offset = nfit_mem->bdw->offset; |
1239 | mmio = &nfit_blk->mmio[BDW]; | 1324 | mmio = &nfit_blk->mmio[BDW]; |
1240 | mmio->base = nfit_spa_map(acpi_desc, nfit_mem->spa_bdw); | 1325 | mmio->base = nfit_spa_map(acpi_desc, nfit_mem->spa_bdw, |
1326 | SPA_MAP_APERTURE); | ||
1241 | if (!mmio->base) { | 1327 | if (!mmio->base) { |
1242 | dev_dbg(dev, "%s: %s failed to map bdw\n", __func__, | 1328 | dev_dbg(dev, "%s: %s failed to map bdw\n", __func__, |
1243 | nvdimm_name(nvdimm)); | 1329 | nvdimm_name(nvdimm)); |
@@ -1259,7 +1345,8 @@ static int acpi_nfit_blk_region_enable(struct nvdimm_bus *nvdimm_bus, | |||
1259 | nfit_blk->cmd_offset = nfit_mem->dcr->command_offset; | 1345 | nfit_blk->cmd_offset = nfit_mem->dcr->command_offset; |
1260 | nfit_blk->stat_offset = nfit_mem->dcr->status_offset; | 1346 | nfit_blk->stat_offset = nfit_mem->dcr->status_offset; |
1261 | mmio = &nfit_blk->mmio[DCR]; | 1347 | mmio = &nfit_blk->mmio[DCR]; |
1262 | mmio->base = nfit_spa_map(acpi_desc, nfit_mem->spa_dcr); | 1348 | mmio->base = nfit_spa_map(acpi_desc, nfit_mem->spa_dcr, |
1349 | SPA_MAP_CONTROL); | ||
1263 | if (!mmio->base) { | 1350 | if (!mmio->base) { |
1264 | dev_dbg(dev, "%s: %s failed to map dcr\n", __func__, | 1351 | dev_dbg(dev, "%s: %s failed to map dcr\n", __func__, |
1265 | nvdimm_name(nvdimm)); | 1352 | nvdimm_name(nvdimm)); |
@@ -1277,6 +1364,24 @@ static int acpi_nfit_blk_region_enable(struct nvdimm_bus *nvdimm_bus, | |||
1277 | return rc; | 1364 | return rc; |
1278 | } | 1365 | } |
1279 | 1366 | ||
1367 | rc = acpi_nfit_blk_get_flags(nd_desc, nvdimm, nfit_blk); | ||
1368 | if (rc < 0) { | ||
1369 | dev_dbg(dev, "%s: %s failed get DIMM flags\n", | ||
1370 | __func__, nvdimm_name(nvdimm)); | ||
1371 | return rc; | ||
1372 | } | ||
1373 | |||
1374 | nfit_flush = nfit_mem->nfit_flush; | ||
1375 | if (nfit_flush && nfit_flush->flush->hint_count != 0) { | ||
1376 | nfit_blk->nvdimm_flush = devm_ioremap_nocache(dev, | ||
1377 | nfit_flush->flush->hint_address[0], 8); | ||
1378 | if (!nfit_blk->nvdimm_flush) | ||
1379 | return -ENOMEM; | ||
1380 | } | ||
1381 | |||
1382 | if (!arch_has_pmem_api() && !nfit_blk->nvdimm_flush) | ||
1383 | dev_warn(dev, "unable to guarantee persistence of writes\n"); | ||
1384 | |||
1280 | if (mmio->line_size == 0) | 1385 | if (mmio->line_size == 0) |
1281 | return 0; | 1386 | return 0; |
1282 | 1387 | ||
@@ -1459,6 +1564,7 @@ int acpi_nfit_init(struct acpi_nfit_desc *acpi_desc, acpi_size sz) | |||
1459 | INIT_LIST_HEAD(&acpi_desc->dcrs); | 1564 | INIT_LIST_HEAD(&acpi_desc->dcrs); |
1460 | INIT_LIST_HEAD(&acpi_desc->bdws); | 1565 | INIT_LIST_HEAD(&acpi_desc->bdws); |
1461 | INIT_LIST_HEAD(&acpi_desc->idts); | 1566 | INIT_LIST_HEAD(&acpi_desc->idts); |
1567 | INIT_LIST_HEAD(&acpi_desc->flushes); | ||
1462 | INIT_LIST_HEAD(&acpi_desc->memdevs); | 1568 | INIT_LIST_HEAD(&acpi_desc->memdevs); |
1463 | INIT_LIST_HEAD(&acpi_desc->dimms); | 1569 | INIT_LIST_HEAD(&acpi_desc->dimms); |
1464 | mutex_init(&acpi_desc->spa_map_mutex); | 1570 | mutex_init(&acpi_desc->spa_map_mutex); |
diff --git a/drivers/acpi/nfit.h b/drivers/acpi/nfit.h index 81f2e8c5a79c..79b6d83875c1 100644 --- a/drivers/acpi/nfit.h +++ b/drivers/acpi/nfit.h | |||
@@ -40,6 +40,10 @@ enum nfit_uuids { | |||
40 | NFIT_UUID_MAX, | 40 | NFIT_UUID_MAX, |
41 | }; | 41 | }; |
42 | 42 | ||
43 | enum { | ||
44 | ND_BLK_DCR_LATCH = 2, | ||
45 | }; | ||
46 | |||
43 | struct nfit_spa { | 47 | struct nfit_spa { |
44 | struct acpi_nfit_system_address *spa; | 48 | struct acpi_nfit_system_address *spa; |
45 | struct list_head list; | 49 | struct list_head list; |
@@ -60,6 +64,11 @@ struct nfit_idt { | |||
60 | struct list_head list; | 64 | struct list_head list; |
61 | }; | 65 | }; |
62 | 66 | ||
67 | struct nfit_flush { | ||
68 | struct acpi_nfit_flush_address *flush; | ||
69 | struct list_head list; | ||
70 | }; | ||
71 | |||
63 | struct nfit_memdev { | 72 | struct nfit_memdev { |
64 | struct acpi_nfit_memory_map *memdev; | 73 | struct acpi_nfit_memory_map *memdev; |
65 | struct list_head list; | 74 | struct list_head list; |
@@ -77,6 +86,7 @@ struct nfit_mem { | |||
77 | struct acpi_nfit_system_address *spa_bdw; | 86 | struct acpi_nfit_system_address *spa_bdw; |
78 | struct acpi_nfit_interleave *idt_dcr; | 87 | struct acpi_nfit_interleave *idt_dcr; |
79 | struct acpi_nfit_interleave *idt_bdw; | 88 | struct acpi_nfit_interleave *idt_bdw; |
89 | struct nfit_flush *nfit_flush; | ||
80 | struct list_head list; | 90 | struct list_head list; |
81 | struct acpi_device *adev; | 91 | struct acpi_device *adev; |
82 | unsigned long dsm_mask; | 92 | unsigned long dsm_mask; |
@@ -88,6 +98,7 @@ struct acpi_nfit_desc { | |||
88 | struct mutex spa_map_mutex; | 98 | struct mutex spa_map_mutex; |
89 | struct list_head spa_maps; | 99 | struct list_head spa_maps; |
90 | struct list_head memdevs; | 100 | struct list_head memdevs; |
101 | struct list_head flushes; | ||
91 | struct list_head dimms; | 102 | struct list_head dimms; |
92 | struct list_head spas; | 103 | struct list_head spas; |
93 | struct list_head dcrs; | 104 | struct list_head dcrs; |
@@ -109,7 +120,7 @@ struct nfit_blk { | |||
109 | struct nfit_blk_mmio { | 120 | struct nfit_blk_mmio { |
110 | union { | 121 | union { |
111 | void __iomem *base; | 122 | void __iomem *base; |
112 | void *aperture; | 123 | void __pmem *aperture; |
113 | }; | 124 | }; |
114 | u64 size; | 125 | u64 size; |
115 | u64 base_offset; | 126 | u64 base_offset; |
@@ -123,6 +134,13 @@ struct nfit_blk { | |||
123 | u64 bdw_offset; /* post interleave offset */ | 134 | u64 bdw_offset; /* post interleave offset */ |
124 | u64 stat_offset; | 135 | u64 stat_offset; |
125 | u64 cmd_offset; | 136 | u64 cmd_offset; |
137 | void __iomem *nvdimm_flush; | ||
138 | u32 dimm_flags; | ||
139 | }; | ||
140 | |||
141 | enum spa_map_type { | ||
142 | SPA_MAP_CONTROL, | ||
143 | SPA_MAP_APERTURE, | ||
126 | }; | 144 | }; |
127 | 145 | ||
128 | struct nfit_spa_mapping { | 146 | struct nfit_spa_mapping { |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index c262e4acd68d..3b8963f21b36 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -175,10 +175,14 @@ static void __init acpi_request_region (struct acpi_generic_address *gas, | |||
175 | if (!addr || !length) | 175 | if (!addr || !length) |
176 | return; | 176 | return; |
177 | 177 | ||
178 | acpi_reserve_region(addr, length, gas->space_id, 0, desc); | 178 | /* Resources are never freed */ |
179 | if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) | ||
180 | request_region(addr, length, desc); | ||
181 | else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) | ||
182 | request_mem_region(addr, length, desc); | ||
179 | } | 183 | } |
180 | 184 | ||
181 | static void __init acpi_reserve_resources(void) | 185 | static int __init acpi_reserve_resources(void) |
182 | { | 186 | { |
183 | acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length, | 187 | acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length, |
184 | "ACPI PM1a_EVT_BLK"); | 188 | "ACPI PM1a_EVT_BLK"); |
@@ -207,7 +211,10 @@ static void __init acpi_reserve_resources(void) | |||
207 | if (!(acpi_gbl_FADT.gpe1_block_length & 0x1)) | 211 | if (!(acpi_gbl_FADT.gpe1_block_length & 0x1)) |
208 | acpi_request_region(&acpi_gbl_FADT.xgpe1_block, | 212 | acpi_request_region(&acpi_gbl_FADT.xgpe1_block, |
209 | acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK"); | 213 | acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK"); |
214 | |||
215 | return 0; | ||
210 | } | 216 | } |
217 | fs_initcall_sync(acpi_reserve_resources); | ||
211 | 218 | ||
212 | void acpi_os_printf(const char *fmt, ...) | 219 | void acpi_os_printf(const char *fmt, ...) |
213 | { | 220 | { |
@@ -1862,7 +1869,6 @@ acpi_status __init acpi_os_initialize(void) | |||
1862 | 1869 | ||
1863 | acpi_status __init acpi_os_initialize1(void) | 1870 | acpi_status __init acpi_os_initialize1(void) |
1864 | { | 1871 | { |
1865 | acpi_reserve_resources(); | ||
1866 | kacpid_wq = alloc_workqueue("kacpid", 0, 1); | 1872 | kacpid_wq = alloc_workqueue("kacpid", 0, 1); |
1867 | kacpi_notify_wq = alloc_workqueue("kacpi_notify", 0, 1); | 1873 | kacpi_notify_wq = alloc_workqueue("kacpi_notify", 0, 1); |
1868 | kacpi_hotplug_wq = alloc_ordered_workqueue("kacpi_hotplug", 0); | 1874 | kacpi_hotplug_wq = alloc_ordered_workqueue("kacpi_hotplug", 0); |
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index 10561ce16ed1..f1c966e05078 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
27 | #include <linux/export.h> | 27 | #include <linux/export.h> |
28 | #include <linux/ioport.h> | 28 | #include <linux/ioport.h> |
29 | #include <linux/list.h> | ||
30 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
31 | 30 | ||
32 | #ifdef CONFIG_X86 | 31 | #ifdef CONFIG_X86 |
@@ -194,6 +193,7 @@ static bool acpi_decode_space(struct resource_win *win, | |||
194 | u8 iodec = attr->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16; | 193 | u8 iodec = attr->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16; |
195 | bool wp = addr->info.mem.write_protect; | 194 | bool wp = addr->info.mem.write_protect; |
196 | u64 len = attr->address_length; | 195 | u64 len = attr->address_length; |
196 | u64 start, end, offset = 0; | ||
197 | struct resource *res = &win->res; | 197 | struct resource *res = &win->res; |
198 | 198 | ||
199 | /* | 199 | /* |
@@ -205,9 +205,6 @@ static bool acpi_decode_space(struct resource_win *win, | |||
205 | pr_debug("ACPI: Invalid address space min_addr_fix %d, max_addr_fix %d, len %llx\n", | 205 | pr_debug("ACPI: Invalid address space min_addr_fix %d, max_addr_fix %d, len %llx\n", |
206 | addr->min_address_fixed, addr->max_address_fixed, len); | 206 | addr->min_address_fixed, addr->max_address_fixed, len); |
207 | 207 | ||
208 | res->start = attr->minimum; | ||
209 | res->end = attr->maximum; | ||
210 | |||
211 | /* | 208 | /* |
212 | * For bridges that translate addresses across the bridge, | 209 | * For bridges that translate addresses across the bridge, |
213 | * translation_offset is the offset that must be added to the | 210 | * translation_offset is the offset that must be added to the |
@@ -215,12 +212,22 @@ static bool acpi_decode_space(struct resource_win *win, | |||
215 | * primary side. Non-bridge devices must list 0 for all Address | 212 | * primary side. Non-bridge devices must list 0 for all Address |
216 | * Translation offset bits. | 213 | * Translation offset bits. |
217 | */ | 214 | */ |
218 | if (addr->producer_consumer == ACPI_PRODUCER) { | 215 | if (addr->producer_consumer == ACPI_PRODUCER) |
219 | res->start += attr->translation_offset; | 216 | offset = attr->translation_offset; |
220 | res->end += attr->translation_offset; | 217 | else if (attr->translation_offset) |
221 | } else if (attr->translation_offset) { | ||
222 | pr_debug("ACPI: translation_offset(%lld) is invalid for non-bridge device.\n", | 218 | pr_debug("ACPI: translation_offset(%lld) is invalid for non-bridge device.\n", |
223 | attr->translation_offset); | 219 | attr->translation_offset); |
220 | start = attr->minimum + offset; | ||
221 | end = attr->maximum + offset; | ||
222 | |||
223 | win->offset = offset; | ||
224 | res->start = start; | ||
225 | res->end = end; | ||
226 | if (sizeof(resource_size_t) < sizeof(u64) && | ||
227 | (offset != win->offset || start != res->start || end != res->end)) { | ||
228 | pr_warn("acpi resource window ([%#llx-%#llx] ignored, not CPU addressable)\n", | ||
229 | attr->minimum, attr->maximum); | ||
230 | return false; | ||
224 | } | 231 | } |
225 | 232 | ||
226 | switch (addr->resource_type) { | 233 | switch (addr->resource_type) { |
@@ -237,8 +244,6 @@ static bool acpi_decode_space(struct resource_win *win, | |||
237 | return false; | 244 | return false; |
238 | } | 245 | } |
239 | 246 | ||
240 | win->offset = attr->translation_offset; | ||
241 | |||
242 | if (addr->producer_consumer == ACPI_PRODUCER) | 247 | if (addr->producer_consumer == ACPI_PRODUCER) |
243 | res->flags |= IORESOURCE_WINDOW; | 248 | res->flags |= IORESOURCE_WINDOW; |
244 | 249 | ||
@@ -622,164 +627,3 @@ int acpi_dev_filter_resource_type(struct acpi_resource *ares, | |||
622 | return (type & types) ? 0 : 1; | 627 | return (type & types) ? 0 : 1; |
623 | } | 628 | } |
624 | EXPORT_SYMBOL_GPL(acpi_dev_filter_resource_type); | 629 | EXPORT_SYMBOL_GPL(acpi_dev_filter_resource_type); |
625 | |||
626 | struct reserved_region { | ||
627 | struct list_head node; | ||
628 | u64 start; | ||
629 | u64 end; | ||
630 | }; | ||
631 | |||
632 | static LIST_HEAD(reserved_io_regions); | ||
633 | static LIST_HEAD(reserved_mem_regions); | ||
634 | |||
635 | static int request_range(u64 start, u64 end, u8 space_id, unsigned long flags, | ||
636 | char *desc) | ||
637 | { | ||
638 | unsigned int length = end - start + 1; | ||
639 | struct resource *res; | ||
640 | |||
641 | res = space_id == ACPI_ADR_SPACE_SYSTEM_IO ? | ||
642 | request_region(start, length, desc) : | ||
643 | request_mem_region(start, length, desc); | ||
644 | if (!res) | ||
645 | return -EIO; | ||
646 | |||
647 | res->flags &= ~flags; | ||
648 | return 0; | ||
649 | } | ||
650 | |||
651 | static int add_region_before(u64 start, u64 end, u8 space_id, | ||
652 | unsigned long flags, char *desc, | ||
653 | struct list_head *head) | ||
654 | { | ||
655 | struct reserved_region *reg; | ||
656 | int error; | ||
657 | |||
658 | reg = kmalloc(sizeof(*reg), GFP_KERNEL); | ||
659 | if (!reg) | ||
660 | return -ENOMEM; | ||
661 | |||
662 | error = request_range(start, end, space_id, flags, desc); | ||
663 | if (error) { | ||
664 | kfree(reg); | ||
665 | return error; | ||
666 | } | ||
667 | |||
668 | reg->start = start; | ||
669 | reg->end = end; | ||
670 | list_add_tail(®->node, head); | ||
671 | return 0; | ||
672 | } | ||
673 | |||
674 | /** | ||
675 | * acpi_reserve_region - Reserve an I/O or memory region as a system resource. | ||
676 | * @start: Starting address of the region. | ||
677 | * @length: Length of the region. | ||
678 | * @space_id: Identifier of address space to reserve the region from. | ||
679 | * @flags: Resource flags to clear for the region after requesting it. | ||
680 | * @desc: Region description (for messages). | ||
681 | * | ||
682 | * Reserve an I/O or memory region as a system resource to prevent others from | ||
683 | * using it. If the new region overlaps with one of the regions (in the given | ||
684 | * address space) already reserved by this routine, only the non-overlapping | ||
685 | * parts of it will be reserved. | ||
686 | * | ||
687 | * Returned is either 0 (success) or a negative error code indicating a resource | ||
688 | * reservation problem. It is the code of the first encountered error, but the | ||
689 | * routine doesn't abort until it has attempted to request all of the parts of | ||
690 | * the new region that don't overlap with other regions reserved previously. | ||
691 | * | ||
692 | * The resources requested by this routine are never released. | ||
693 | */ | ||
694 | int acpi_reserve_region(u64 start, unsigned int length, u8 space_id, | ||
695 | unsigned long flags, char *desc) | ||
696 | { | ||
697 | struct list_head *regions; | ||
698 | struct reserved_region *reg; | ||
699 | u64 end = start + length - 1; | ||
700 | int ret = 0, error = 0; | ||
701 | |||
702 | if (space_id == ACPI_ADR_SPACE_SYSTEM_IO) | ||
703 | regions = &reserved_io_regions; | ||
704 | else if (space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) | ||
705 | regions = &reserved_mem_regions; | ||
706 | else | ||
707 | return -EINVAL; | ||
708 | |||
709 | if (list_empty(regions)) | ||
710 | return add_region_before(start, end, space_id, flags, desc, regions); | ||
711 | |||
712 | list_for_each_entry(reg, regions, node) | ||
713 | if (reg->start == end + 1) { | ||
714 | /* The new region can be prepended to this one. */ | ||
715 | ret = request_range(start, end, space_id, flags, desc); | ||
716 | if (!ret) | ||
717 | reg->start = start; | ||
718 | |||
719 | return ret; | ||
720 | } else if (reg->start > end) { | ||
721 | /* No overlap. Add the new region here and get out. */ | ||
722 | return add_region_before(start, end, space_id, flags, | ||
723 | desc, ®->node); | ||
724 | } else if (reg->end == start - 1) { | ||
725 | goto combine; | ||
726 | } else if (reg->end >= start) { | ||
727 | goto overlap; | ||
728 | } | ||
729 | |||
730 | /* The new region goes after the last existing one. */ | ||
731 | return add_region_before(start, end, space_id, flags, desc, regions); | ||
732 | |||
733 | overlap: | ||
734 | /* | ||
735 | * The new region overlaps an existing one. | ||
736 | * | ||
737 | * The head part of the new region immediately preceding the existing | ||
738 | * overlapping one can be combined with it right away. | ||
739 | */ | ||
740 | if (reg->start > start) { | ||
741 | error = request_range(start, reg->start - 1, space_id, flags, desc); | ||
742 | if (error) | ||
743 | ret = error; | ||
744 | else | ||
745 | reg->start = start; | ||
746 | } | ||
747 | |||
748 | combine: | ||
749 | /* | ||
750 | * The new region is adjacent to an existing one. If it extends beyond | ||
751 | * that region all the way to the next one, it is possible to combine | ||
752 | * all three of them. | ||
753 | */ | ||
754 | while (reg->end < end) { | ||
755 | struct reserved_region *next = NULL; | ||
756 | u64 a = reg->end + 1, b = end; | ||
757 | |||
758 | if (!list_is_last(®->node, regions)) { | ||
759 | next = list_next_entry(reg, node); | ||
760 | if (next->start <= end) | ||
761 | b = next->start - 1; | ||
762 | } | ||
763 | error = request_range(a, b, space_id, flags, desc); | ||
764 | if (!error) { | ||
765 | if (next && next->start == b + 1) { | ||
766 | reg->end = next->end; | ||
767 | list_del(&next->node); | ||
768 | kfree(next); | ||
769 | } else { | ||
770 | reg->end = end; | ||
771 | break; | ||
772 | } | ||
773 | } else if (next) { | ||
774 | if (!ret) | ||
775 | ret = error; | ||
776 | |||
777 | reg = next; | ||
778 | } else { | ||
779 | break; | ||
780 | } | ||
781 | } | ||
782 | |||
783 | return ret ? ret : error; | ||
784 | } | ||
785 | EXPORT_SYMBOL_GPL(acpi_reserve_region); | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 2649a068671d..ec256352f423 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -1019,6 +1019,29 @@ static bool acpi_of_match_device(struct acpi_device *adev, | |||
1019 | return false; | 1019 | return false; |
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | static bool __acpi_match_device_cls(const struct acpi_device_id *id, | ||
1023 | struct acpi_hardware_id *hwid) | ||
1024 | { | ||
1025 | int i, msk, byte_shift; | ||
1026 | char buf[3]; | ||
1027 | |||
1028 | if (!id->cls) | ||
1029 | return false; | ||
1030 | |||
1031 | /* Apply class-code bitmask, before checking each class-code byte */ | ||
1032 | for (i = 1; i <= 3; i++) { | ||
1033 | byte_shift = 8 * (3 - i); | ||
1034 | msk = (id->cls_msk >> byte_shift) & 0xFF; | ||
1035 | if (!msk) | ||
1036 | continue; | ||
1037 | |||
1038 | sprintf(buf, "%02x", (id->cls >> byte_shift) & msk); | ||
1039 | if (strncmp(buf, &hwid->id[(i - 1) * 2], 2)) | ||
1040 | return false; | ||
1041 | } | ||
1042 | return true; | ||
1043 | } | ||
1044 | |||
1022 | static const struct acpi_device_id *__acpi_match_device( | 1045 | static const struct acpi_device_id *__acpi_match_device( |
1023 | struct acpi_device *device, | 1046 | struct acpi_device *device, |
1024 | const struct acpi_device_id *ids, | 1047 | const struct acpi_device_id *ids, |
@@ -1036,9 +1059,12 @@ static const struct acpi_device_id *__acpi_match_device( | |||
1036 | 1059 | ||
1037 | list_for_each_entry(hwid, &device->pnp.ids, list) { | 1060 | list_for_each_entry(hwid, &device->pnp.ids, list) { |
1038 | /* First, check the ACPI/PNP IDs provided by the caller. */ | 1061 | /* First, check the ACPI/PNP IDs provided by the caller. */ |
1039 | for (id = ids; id->id[0]; id++) | 1062 | for (id = ids; id->id[0] || id->cls; id++) { |
1040 | if (!strcmp((char *) id->id, hwid->id)) | 1063 | if (id->id[0] && !strcmp((char *) id->id, hwid->id)) |
1041 | return id; | 1064 | return id; |
1065 | else if (id->cls && __acpi_match_device_cls(id, hwid)) | ||
1066 | return id; | ||
1067 | } | ||
1042 | 1068 | ||
1043 | /* | 1069 | /* |
1044 | * Next, check ACPI_DT_NAMESPACE_HID and try to match the | 1070 | * Next, check ACPI_DT_NAMESPACE_HID and try to match the |
@@ -2101,6 +2127,8 @@ static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp, | |||
2101 | if (info->valid & ACPI_VALID_UID) | 2127 | if (info->valid & ACPI_VALID_UID) |
2102 | pnp->unique_id = kstrdup(info->unique_id.string, | 2128 | pnp->unique_id = kstrdup(info->unique_id.string, |
2103 | GFP_KERNEL); | 2129 | GFP_KERNEL); |
2130 | if (info->valid & ACPI_VALID_CLS) | ||
2131 | acpi_add_id(pnp, info->class_code.string); | ||
2104 | 2132 | ||
2105 | kfree(info); | 2133 | kfree(info); |
2106 | 2134 | ||
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 6d17a3b65ef7..15e40ee62a94 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -48,7 +48,7 @@ config ATA_VERBOSE_ERROR | |||
48 | 48 | ||
49 | config ATA_ACPI | 49 | config ATA_ACPI |
50 | bool "ATA ACPI Support" | 50 | bool "ATA ACPI Support" |
51 | depends on ACPI && PCI | 51 | depends on ACPI |
52 | default y | 52 | default y |
53 | help | 53 | help |
54 | This option adds support for ATA-related ACPI objects. | 54 | This option adds support for ATA-related ACPI objects. |
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 614c78f510f0..1befb114c384 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c | |||
@@ -20,6 +20,8 @@ | |||
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/libata.h> | 21 | #include <linux/libata.h> |
22 | #include <linux/ahci_platform.h> | 22 | #include <linux/ahci_platform.h> |
23 | #include <linux/acpi.h> | ||
24 | #include <linux/pci_ids.h> | ||
23 | #include "ahci.h" | 25 | #include "ahci.h" |
24 | 26 | ||
25 | #define DRV_NAME "ahci" | 27 | #define DRV_NAME "ahci" |
@@ -79,12 +81,19 @@ static const struct of_device_id ahci_of_match[] = { | |||
79 | }; | 81 | }; |
80 | MODULE_DEVICE_TABLE(of, ahci_of_match); | 82 | MODULE_DEVICE_TABLE(of, ahci_of_match); |
81 | 83 | ||
84 | static const struct acpi_device_id ahci_acpi_match[] = { | ||
85 | { ACPI_DEVICE_CLASS(PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff) }, | ||
86 | {}, | ||
87 | }; | ||
88 | MODULE_DEVICE_TABLE(acpi, ahci_acpi_match); | ||
89 | |||
82 | static struct platform_driver ahci_driver = { | 90 | static struct platform_driver ahci_driver = { |
83 | .probe = ahci_probe, | 91 | .probe = ahci_probe, |
84 | .remove = ata_platform_remove_one, | 92 | .remove = ata_platform_remove_one, |
85 | .driver = { | 93 | .driver = { |
86 | .name = DRV_NAME, | 94 | .name = DRV_NAME, |
87 | .of_match_table = ahci_of_match, | 95 | .of_match_table = ahci_of_match, |
96 | .acpi_match_table = ahci_acpi_match, | ||
88 | .pm = &ahci_pm_ops, | 97 | .pm = &ahci_pm_ops, |
89 | }, | 98 | }, |
90 | }; | 99 | }; |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index e83fc3d0da9c..db5d9f79a247 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -2478,6 +2478,10 @@ int ata_dev_configure(struct ata_device *dev) | |||
2478 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, | 2478 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, |
2479 | dev->max_sectors); | 2479 | dev->max_sectors); |
2480 | 2480 | ||
2481 | if (dev->horkage & ATA_HORKAGE_MAX_SEC_1024) | ||
2482 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_1024, | ||
2483 | dev->max_sectors); | ||
2484 | |||
2481 | if (dev->horkage & ATA_HORKAGE_MAX_SEC_LBA48) | 2485 | if (dev->horkage & ATA_HORKAGE_MAX_SEC_LBA48) |
2482 | dev->max_sectors = ATA_MAX_SECTORS_LBA48; | 2486 | dev->max_sectors = ATA_MAX_SECTORS_LBA48; |
2483 | 2487 | ||
@@ -4146,6 +4150,12 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4146 | { "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, | 4150 | { "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, |
4147 | { "Slimtype DVD A DS8A9SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, | 4151 | { "Slimtype DVD A DS8A9SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, |
4148 | 4152 | ||
4153 | /* | ||
4154 | * Causes silent data corruption with higher max sects. | ||
4155 | * http://lkml.kernel.org/g/x49wpy40ysk.fsf@segfault.boston.devel.redhat.com | ||
4156 | */ | ||
4157 | { "ST380013AS", "3.20", ATA_HORKAGE_MAX_SEC_1024 }, | ||
4158 | |||
4149 | /* Devices we expect to fail diagnostics */ | 4159 | /* Devices we expect to fail diagnostics */ |
4150 | 4160 | ||
4151 | /* Devices where NCQ should be avoided */ | 4161 | /* Devices where NCQ should be avoided */ |
@@ -4174,9 +4184,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4174 | { "ST3320[68]13AS", "SD1[5-9]", ATA_HORKAGE_NONCQ | | 4184 | { "ST3320[68]13AS", "SD1[5-9]", ATA_HORKAGE_NONCQ | |
4175 | ATA_HORKAGE_FIRMWARE_WARN }, | 4185 | ATA_HORKAGE_FIRMWARE_WARN }, |
4176 | 4186 | ||
4177 | /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */ | 4187 | /* drives which fail FPDMA_AA activation (some may freeze afterwards) */ |
4178 | { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA }, | 4188 | { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA }, |
4179 | { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA }, | 4189 | { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA }, |
4190 | { "VB0250EAVER", "HPG7", ATA_HORKAGE_BROKEN_FPDMA_AA }, | ||
4180 | 4191 | ||
4181 | /* Blacklist entries taken from Silicon Image 3124/3132 | 4192 | /* Blacklist entries taken from Silicon Image 3124/3132 |
4182 | Windows driver .inf file - also several Linux problem reports */ | 4193 | Windows driver .inf file - also several Linux problem reports */ |
@@ -4229,7 +4240,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4229 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, | 4240 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
4230 | { "Crucial_CT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | | 4241 | { "Crucial_CT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
4231 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, | 4242 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
4232 | { "Micron_M5[15]0*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | | 4243 | { "Micron_M5[15]0_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
4233 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, | 4244 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
4234 | { "Crucial_CT*M550*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | | 4245 | { "Crucial_CT*M550*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
4235 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, | 4246 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
@@ -4238,6 +4249,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4238 | { "Samsung SSD 8*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | | 4249 | { "Samsung SSD 8*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
4239 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, | 4250 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
4240 | 4251 | ||
4252 | /* devices that don't properly handle TRIM commands */ | ||
4253 | { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, }, | ||
4254 | |||
4241 | /* | 4255 | /* |
4242 | * As defined, the DRAT (Deterministic Read After Trim) and RZAT | 4256 | * As defined, the DRAT (Deterministic Read After Trim) and RZAT |
4243 | * (Return Zero After Trim) flags in the ATA Command Set are | 4257 | * (Return Zero After Trim) flags in the ATA Command Set are |
@@ -4501,7 +4515,8 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev) | |||
4501 | else /* In the ancient relic department - skip all of this */ | 4515 | else /* In the ancient relic department - skip all of this */ |
4502 | return 0; | 4516 | return 0; |
4503 | 4517 | ||
4504 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); | 4518 | /* On some disks, this command causes spin-up, so we need longer timeout */ |
4519 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 15000); | ||
4505 | 4520 | ||
4506 | DPRINTK("EXIT, err_mask=%x\n", err_mask); | 4521 | DPRINTK("EXIT, err_mask=%x\n", err_mask); |
4507 | return err_mask; | 4522 | return err_mask; |
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c index 7ccc084bf1df..85aa76116a30 100644 --- a/drivers/ata/libata-pmp.c +++ b/drivers/ata/libata-pmp.c | |||
@@ -460,6 +460,13 @@ static void sata_pmp_quirks(struct ata_port *ap) | |||
460 | ATA_LFLAG_NO_SRST | | 460 | ATA_LFLAG_NO_SRST | |
461 | ATA_LFLAG_ASSUME_ATA; | 461 | ATA_LFLAG_ASSUME_ATA; |
462 | } | 462 | } |
463 | } else if (vendor == 0x11ab && devid == 0x4140) { | ||
464 | /* Marvell 4140 quirks */ | ||
465 | ata_for_each_link(link, ap, EDGE) { | ||
466 | /* port 4 is for SEMB device and it doesn't like SRST */ | ||
467 | if (link->pmp == 4) | ||
468 | link->flags |= ATA_LFLAG_DISABLED; | ||
469 | } | ||
463 | } | 470 | } |
464 | } | 471 | } |
465 | 472 | ||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 3131adcc1f87..641a61a59e89 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -2568,7 +2568,8 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf) | |||
2568 | rbuf[14] = (lowest_aligned >> 8) & 0x3f; | 2568 | rbuf[14] = (lowest_aligned >> 8) & 0x3f; |
2569 | rbuf[15] = lowest_aligned; | 2569 | rbuf[15] = lowest_aligned; |
2570 | 2570 | ||
2571 | if (ata_id_has_trim(args->id)) { | 2571 | if (ata_id_has_trim(args->id) && |
2572 | !(dev->horkage & ATA_HORKAGE_NOTRIM)) { | ||
2572 | rbuf[14] |= 0x80; /* LBPME */ | 2573 | rbuf[14] |= 0x80; /* LBPME */ |
2573 | 2574 | ||
2574 | if (ata_id_has_zero_after_trim(args->id) && | 2575 | if (ata_id_has_zero_after_trim(args->id) && |
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c index d6c37bcd416d..e2d94972962d 100644 --- a/drivers/ata/libata-transport.c +++ b/drivers/ata/libata-transport.c | |||
@@ -569,6 +569,8 @@ show_ata_dev_trim(struct device *dev, | |||
569 | 569 | ||
570 | if (!ata_id_has_trim(ata_dev->id)) | 570 | if (!ata_id_has_trim(ata_dev->id)) |
571 | mode = "unsupported"; | 571 | mode = "unsupported"; |
572 | else if (ata_dev->horkage & ATA_HORKAGE_NOTRIM) | ||
573 | mode = "forced_unsupported"; | ||
572 | else if (ata_dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM) | 574 | else if (ata_dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM) |
573 | mode = "forced_unqueued"; | 575 | mode = "forced_unqueued"; |
574 | else if (ata_fpdma_dsm_supported(ata_dev)) | 576 | else if (ata_fpdma_dsm_supported(ata_dev)) |
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c index a9b0c820f2eb..5d9ee99c2148 100644 --- a/drivers/ata/pata_arasan_cf.c +++ b/drivers/ata/pata_arasan_cf.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Arasan Compact Flash host controller source file | 4 | * Arasan Compact Flash host controller source file |
5 | * | 5 | * |
6 | * Copyright (C) 2011 ST Microelectronics | 6 | * Copyright (C) 2011 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
@@ -968,7 +968,7 @@ static struct platform_driver arasan_cf_driver = { | |||
968 | 968 | ||
969 | module_platform_driver(arasan_cf_driver); | 969 | module_platform_driver(arasan_cf_driver); |
970 | 970 | ||
971 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); | 971 | MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>"); |
972 | MODULE_DESCRIPTION("Arasan ATA Compact Flash driver"); | 972 | MODULE_DESCRIPTION("Arasan ATA Compact Flash driver"); |
973 | MODULE_LICENSE("GPL"); | 973 | MODULE_LICENSE("GPL"); |
974 | MODULE_ALIAS("platform:" DRIVER_NAME); | 974 | MODULE_ALIAS("platform:" DRIVER_NAME); |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 9c4288362a8e..894bda114224 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -563,10 +563,8 @@ static void fw_dev_release(struct device *dev) | |||
563 | kfree(fw_priv); | 563 | kfree(fw_priv); |
564 | } | 564 | } |
565 | 565 | ||
566 | static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env) | 566 | static int do_firmware_uevent(struct firmware_priv *fw_priv, struct kobj_uevent_env *env) |
567 | { | 567 | { |
568 | struct firmware_priv *fw_priv = to_firmware_priv(dev); | ||
569 | |||
570 | if (add_uevent_var(env, "FIRMWARE=%s", fw_priv->buf->fw_id)) | 568 | if (add_uevent_var(env, "FIRMWARE=%s", fw_priv->buf->fw_id)) |
571 | return -ENOMEM; | 569 | return -ENOMEM; |
572 | if (add_uevent_var(env, "TIMEOUT=%i", loading_timeout)) | 570 | if (add_uevent_var(env, "TIMEOUT=%i", loading_timeout)) |
@@ -577,6 +575,18 @@ static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
577 | return 0; | 575 | return 0; |
578 | } | 576 | } |
579 | 577 | ||
578 | static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
579 | { | ||
580 | struct firmware_priv *fw_priv = to_firmware_priv(dev); | ||
581 | int err = 0; | ||
582 | |||
583 | mutex_lock(&fw_lock); | ||
584 | if (fw_priv->buf) | ||
585 | err = do_firmware_uevent(fw_priv, env); | ||
586 | mutex_unlock(&fw_lock); | ||
587 | return err; | ||
588 | } | ||
589 | |||
580 | static struct class firmware_class = { | 590 | static struct class firmware_class = { |
581 | .name = "firmware", | 591 | .name = "firmware", |
582 | .class_attrs = firmware_class_attrs, | 592 | .class_attrs = firmware_class_attrs, |
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index cdd547bd67df..0ee43c1056e0 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
@@ -6,6 +6,7 @@ | |||
6 | * This file is released under the GPLv2. | 6 | * This file is released under the GPLv2. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/delay.h> | ||
9 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
10 | #include <linux/io.h> | 11 | #include <linux/io.h> |
11 | #include <linux/platform_device.h> | 12 | #include <linux/platform_device.h> |
@@ -19,6 +20,8 @@ | |||
19 | #include <linux/suspend.h> | 20 | #include <linux/suspend.h> |
20 | #include <linux/export.h> | 21 | #include <linux/export.h> |
21 | 22 | ||
23 | #define GENPD_RETRY_MAX_MS 250 /* Approximate */ | ||
24 | |||
22 | #define GENPD_DEV_CALLBACK(genpd, type, callback, dev) \ | 25 | #define GENPD_DEV_CALLBACK(genpd, type, callback, dev) \ |
23 | ({ \ | 26 | ({ \ |
24 | type (*__routine)(struct device *__d); \ | 27 | type (*__routine)(struct device *__d); \ |
@@ -2131,6 +2134,7 @@ EXPORT_SYMBOL_GPL(of_genpd_get_from_provider); | |||
2131 | static void genpd_dev_pm_detach(struct device *dev, bool power_off) | 2134 | static void genpd_dev_pm_detach(struct device *dev, bool power_off) |
2132 | { | 2135 | { |
2133 | struct generic_pm_domain *pd; | 2136 | struct generic_pm_domain *pd; |
2137 | unsigned int i; | ||
2134 | int ret = 0; | 2138 | int ret = 0; |
2135 | 2139 | ||
2136 | pd = pm_genpd_lookup_dev(dev); | 2140 | pd = pm_genpd_lookup_dev(dev); |
@@ -2139,10 +2143,12 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off) | |||
2139 | 2143 | ||
2140 | dev_dbg(dev, "removing from PM domain %s\n", pd->name); | 2144 | dev_dbg(dev, "removing from PM domain %s\n", pd->name); |
2141 | 2145 | ||
2142 | while (1) { | 2146 | for (i = 1; i < GENPD_RETRY_MAX_MS; i <<= 1) { |
2143 | ret = pm_genpd_remove_device(pd, dev); | 2147 | ret = pm_genpd_remove_device(pd, dev); |
2144 | if (ret != -EAGAIN) | 2148 | if (ret != -EAGAIN) |
2145 | break; | 2149 | break; |
2150 | |||
2151 | mdelay(i); | ||
2146 | cond_resched(); | 2152 | cond_resched(); |
2147 | } | 2153 | } |
2148 | 2154 | ||
@@ -2183,6 +2189,7 @@ int genpd_dev_pm_attach(struct device *dev) | |||
2183 | { | 2189 | { |
2184 | struct of_phandle_args pd_args; | 2190 | struct of_phandle_args pd_args; |
2185 | struct generic_pm_domain *pd; | 2191 | struct generic_pm_domain *pd; |
2192 | unsigned int i; | ||
2186 | int ret; | 2193 | int ret; |
2187 | 2194 | ||
2188 | if (!dev->of_node) | 2195 | if (!dev->of_node) |
@@ -2218,10 +2225,12 @@ int genpd_dev_pm_attach(struct device *dev) | |||
2218 | 2225 | ||
2219 | dev_dbg(dev, "adding to PM domain %s\n", pd->name); | 2226 | dev_dbg(dev, "adding to PM domain %s\n", pd->name); |
2220 | 2227 | ||
2221 | while (1) { | 2228 | for (i = 1; i < GENPD_RETRY_MAX_MS; i <<= 1) { |
2222 | ret = pm_genpd_add_device(pd, dev); | 2229 | ret = pm_genpd_add_device(pd, dev); |
2223 | if (ret != -EAGAIN) | 2230 | if (ret != -EAGAIN) |
2224 | break; | 2231 | break; |
2232 | |||
2233 | mdelay(i); | ||
2225 | cond_resched(); | 2234 | cond_resched(); |
2226 | } | 2235 | } |
2227 | 2236 | ||
diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c index 7470004ca810..eb6e67451dec 100644 --- a/drivers/base/power/wakeirq.c +++ b/drivers/base/power/wakeirq.c | |||
@@ -45,14 +45,12 @@ static int dev_pm_attach_wake_irq(struct device *dev, int irq, | |||
45 | return -EEXIST; | 45 | return -EEXIST; |
46 | } | 46 | } |
47 | 47 | ||
48 | dev->power.wakeirq = wirq; | ||
49 | spin_unlock_irqrestore(&dev->power.lock, flags); | ||
50 | |||
51 | err = device_wakeup_attach_irq(dev, wirq); | 48 | err = device_wakeup_attach_irq(dev, wirq); |
52 | if (err) | 49 | if (!err) |
53 | return err; | 50 | dev->power.wakeirq = wirq; |
54 | 51 | ||
55 | return 0; | 52 | spin_unlock_irqrestore(&dev->power.lock, flags); |
53 | return err; | ||
56 | } | 54 | } |
57 | 55 | ||
58 | /** | 56 | /** |
@@ -105,10 +103,10 @@ void dev_pm_clear_wake_irq(struct device *dev) | |||
105 | return; | 103 | return; |
106 | 104 | ||
107 | spin_lock_irqsave(&dev->power.lock, flags); | 105 | spin_lock_irqsave(&dev->power.lock, flags); |
106 | device_wakeup_detach_irq(dev); | ||
108 | dev->power.wakeirq = NULL; | 107 | dev->power.wakeirq = NULL; |
109 | spin_unlock_irqrestore(&dev->power.lock, flags); | 108 | spin_unlock_irqrestore(&dev->power.lock, flags); |
110 | 109 | ||
111 | device_wakeup_detach_irq(dev); | ||
112 | if (wirq->dedicated_irq) | 110 | if (wirq->dedicated_irq) |
113 | free_irq(wirq->irq, wirq); | 111 | free_irq(wirq->irq, wirq); |
114 | kfree(wirq); | 112 | kfree(wirq); |
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index 40f71603378c..51f15bc15774 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c | |||
@@ -281,32 +281,25 @@ EXPORT_SYMBOL_GPL(device_wakeup_enable); | |||
281 | * Attach a device wakeirq to the wakeup source so the device | 281 | * Attach a device wakeirq to the wakeup source so the device |
282 | * wake IRQ can be configured automatically for suspend and | 282 | * wake IRQ can be configured automatically for suspend and |
283 | * resume. | 283 | * resume. |
284 | * | ||
285 | * Call under the device's power.lock lock. | ||
284 | */ | 286 | */ |
285 | int device_wakeup_attach_irq(struct device *dev, | 287 | int device_wakeup_attach_irq(struct device *dev, |
286 | struct wake_irq *wakeirq) | 288 | struct wake_irq *wakeirq) |
287 | { | 289 | { |
288 | struct wakeup_source *ws; | 290 | struct wakeup_source *ws; |
289 | int ret = 0; | ||
290 | 291 | ||
291 | spin_lock_irq(&dev->power.lock); | ||
292 | ws = dev->power.wakeup; | 292 | ws = dev->power.wakeup; |
293 | if (!ws) { | 293 | if (!ws) { |
294 | dev_err(dev, "forgot to call call device_init_wakeup?\n"); | 294 | dev_err(dev, "forgot to call call device_init_wakeup?\n"); |
295 | ret = -EINVAL; | 295 | return -EINVAL; |
296 | goto unlock; | ||
297 | } | 296 | } |
298 | 297 | ||
299 | if (ws->wakeirq) { | 298 | if (ws->wakeirq) |
300 | ret = -EEXIST; | 299 | return -EEXIST; |
301 | goto unlock; | ||
302 | } | ||
303 | 300 | ||
304 | ws->wakeirq = wakeirq; | 301 | ws->wakeirq = wakeirq; |
305 | 302 | return 0; | |
306 | unlock: | ||
307 | spin_unlock_irq(&dev->power.lock); | ||
308 | |||
309 | return ret; | ||
310 | } | 303 | } |
311 | 304 | ||
312 | /** | 305 | /** |
@@ -314,20 +307,16 @@ unlock: | |||
314 | * @dev: Device to handle | 307 | * @dev: Device to handle |
315 | * | 308 | * |
316 | * Removes a device wakeirq from the wakeup source. | 309 | * Removes a device wakeirq from the wakeup source. |
310 | * | ||
311 | * Call under the device's power.lock lock. | ||
317 | */ | 312 | */ |
318 | void device_wakeup_detach_irq(struct device *dev) | 313 | void device_wakeup_detach_irq(struct device *dev) |
319 | { | 314 | { |
320 | struct wakeup_source *ws; | 315 | struct wakeup_source *ws; |
321 | 316 | ||
322 | spin_lock_irq(&dev->power.lock); | ||
323 | ws = dev->power.wakeup; | 317 | ws = dev->power.wakeup; |
324 | if (!ws) | 318 | if (ws) |
325 | goto unlock; | 319 | ws->wakeirq = NULL; |
326 | |||
327 | ws->wakeirq = NULL; | ||
328 | |||
329 | unlock: | ||
330 | spin_unlock_irq(&dev->power.lock); | ||
331 | } | 320 | } |
332 | 321 | ||
333 | /** | 322 | /** |
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index 69de41a87b74..3177b245d2bd 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c | |||
@@ -240,19 +240,19 @@ static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer) | |||
240 | while ((entry = llist_del_all(&cq->list)) != NULL) { | 240 | while ((entry = llist_del_all(&cq->list)) != NULL) { |
241 | entry = llist_reverse_order(entry); | 241 | entry = llist_reverse_order(entry); |
242 | do { | 242 | do { |
243 | struct request_queue *q = NULL; | ||
244 | |||
243 | cmd = container_of(entry, struct nullb_cmd, ll_list); | 245 | cmd = container_of(entry, struct nullb_cmd, ll_list); |
244 | entry = entry->next; | 246 | entry = entry->next; |
247 | if (cmd->rq) | ||
248 | q = cmd->rq->q; | ||
245 | end_cmd(cmd); | 249 | end_cmd(cmd); |
246 | 250 | ||
247 | if (cmd->rq) { | 251 | if (q && !q->mq_ops && blk_queue_stopped(q)) { |
248 | struct request_queue *q = cmd->rq->q; | 252 | spin_lock(q->queue_lock); |
249 | 253 | if (blk_queue_stopped(q)) | |
250 | if (!q->mq_ops && blk_queue_stopped(q)) { | 254 | blk_start_queue(q); |
251 | spin_lock(q->queue_lock); | 255 | spin_unlock(q->queue_lock); |
252 | if (blk_queue_stopped(q)) | ||
253 | blk_start_queue(q); | ||
254 | spin_unlock(q->queue_lock); | ||
255 | } | ||
256 | } | 256 | } |
257 | } while (entry); | 257 | } while (entry); |
258 | } | 258 | } |
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index d1d6141920d3..7920c2741b47 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -2108,8 +2108,17 @@ static void nvme_alloc_ns(struct nvme_dev *dev, unsigned nsid) | |||
2108 | goto out_free_disk; | 2108 | goto out_free_disk; |
2109 | 2109 | ||
2110 | add_disk(ns->disk); | 2110 | add_disk(ns->disk); |
2111 | if (ns->ms) | 2111 | if (ns->ms) { |
2112 | revalidate_disk(ns->disk); | 2112 | struct block_device *bd = bdget_disk(ns->disk, 0); |
2113 | if (!bd) | ||
2114 | return; | ||
2115 | if (blkdev_get(bd, FMODE_READ, NULL)) { | ||
2116 | bdput(bd); | ||
2117 | return; | ||
2118 | } | ||
2119 | blkdev_reread_part(bd); | ||
2120 | blkdev_put(bd, FMODE_READ); | ||
2121 | } | ||
2113 | return; | 2122 | return; |
2114 | out_free_disk: | 2123 | out_free_disk: |
2115 | kfree(disk); | 2124 | kfree(disk); |
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index 1e1a4323a71f..9ceb8ac68fdc 100644 --- a/drivers/bluetooth/btbcm.c +++ b/drivers/bluetooth/btbcm.c | |||
@@ -472,12 +472,11 @@ int btbcm_setup_apple(struct hci_dev *hdev) | |||
472 | 472 | ||
473 | /* Read Verbose Config Version Info */ | 473 | /* Read Verbose Config Version Info */ |
474 | skb = btbcm_read_verbose_config(hdev); | 474 | skb = btbcm_read_verbose_config(hdev); |
475 | if (IS_ERR(skb)) | 475 | if (!IS_ERR(skb)) { |
476 | return PTR_ERR(skb); | 476 | BT_INFO("%s: BCM: chip id %u build %4.4u", hdev->name, skb->data[1], |
477 | 477 | get_unaligned_le16(skb->data + 5)); | |
478 | BT_INFO("%s: BCM: chip id %u build %4.4u", hdev->name, skb->data[1], | 478 | kfree_skb(skb); |
479 | get_unaligned_le16(skb->data + 5)); | 479 | } |
480 | kfree_skb(skb); | ||
481 | 480 | ||
482 | set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); | 481 | set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); |
483 | 482 | ||
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index 283f00a7f036..1082d4bb016a 100644 --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c | |||
@@ -129,8 +129,9 @@ struct tpm_chip *tpmm_chip_alloc(struct device *dev, | |||
129 | 129 | ||
130 | device_initialize(&chip->dev); | 130 | device_initialize(&chip->dev); |
131 | 131 | ||
132 | chip->cdev.owner = chip->pdev->driver->owner; | ||
133 | cdev_init(&chip->cdev, &tpm_fops); | 132 | cdev_init(&chip->cdev, &tpm_fops); |
133 | chip->cdev.owner = chip->pdev->driver->owner; | ||
134 | chip->cdev.kobj.parent = &chip->dev.kobj; | ||
134 | 135 | ||
135 | return chip; | 136 | return chip; |
136 | } | 137 | } |
diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c index 44f9d20c19ac..1267322595da 100644 --- a/drivers/char/tpm/tpm_crb.c +++ b/drivers/char/tpm/tpm_crb.c | |||
@@ -233,6 +233,14 @@ static int crb_acpi_add(struct acpi_device *device) | |||
233 | return -ENODEV; | 233 | return -ENODEV; |
234 | } | 234 | } |
235 | 235 | ||
236 | /* At least some versions of AMI BIOS have a bug that TPM2 table has | ||
237 | * zero address for the control area and therefore we must fail. | ||
238 | */ | ||
239 | if (!buf->control_area_pa) { | ||
240 | dev_err(dev, "TPM2 ACPI table has a zero address for the control area\n"); | ||
241 | return -EINVAL; | ||
242 | } | ||
243 | |||
236 | if (buf->hdr.length < sizeof(struct acpi_tpm2)) { | 244 | if (buf->hdr.length < sizeof(struct acpi_tpm2)) { |
237 | dev_err(dev, "TPM2 ACPI table has wrong size"); | 245 | dev_err(dev, "TPM2 ACPI table has wrong size"); |
238 | return -EINVAL; | 246 | return -EINVAL; |
diff --git a/drivers/clk/at91/clk-h32mx.c b/drivers/clk/at91/clk-h32mx.c index 152dcb3f7b5f..61566bcefa53 100644 --- a/drivers/clk/at91/clk-h32mx.c +++ b/drivers/clk/at91/clk-h32mx.c | |||
@@ -116,8 +116,10 @@ void __init of_sama5d4_clk_h32mx_setup(struct device_node *np, | |||
116 | h32mxclk->pmc = pmc; | 116 | h32mxclk->pmc = pmc; |
117 | 117 | ||
118 | clk = clk_register(NULL, &h32mxclk->hw); | 118 | clk = clk_register(NULL, &h32mxclk->hw); |
119 | if (!clk) | 119 | if (!clk) { |
120 | kfree(h32mxclk); | ||
120 | return; | 121 | return; |
122 | } | ||
121 | 123 | ||
122 | of_clk_add_provider(np, of_clk_src_simple_get, clk); | 124 | of_clk_add_provider(np, of_clk_src_simple_get, clk); |
123 | } | 125 | } |
diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c index c2400456a044..27dfa965cfed 100644 --- a/drivers/clk/at91/clk-main.c +++ b/drivers/clk/at91/clk-main.c | |||
@@ -171,8 +171,10 @@ at91_clk_register_main_osc(struct at91_pmc *pmc, | |||
171 | irq_set_status_flags(osc->irq, IRQ_NOAUTOEN); | 171 | irq_set_status_flags(osc->irq, IRQ_NOAUTOEN); |
172 | ret = request_irq(osc->irq, clk_main_osc_irq_handler, | 172 | ret = request_irq(osc->irq, clk_main_osc_irq_handler, |
173 | IRQF_TRIGGER_HIGH, name, osc); | 173 | IRQF_TRIGGER_HIGH, name, osc); |
174 | if (ret) | 174 | if (ret) { |
175 | kfree(osc); | ||
175 | return ERR_PTR(ret); | 176 | return ERR_PTR(ret); |
177 | } | ||
176 | 178 | ||
177 | if (bypass) | 179 | if (bypass) |
178 | pmc_write(pmc, AT91_CKGR_MOR, | 180 | pmc_write(pmc, AT91_CKGR_MOR, |
diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c index f98eafe9b12d..5b3ded5205a2 100644 --- a/drivers/clk/at91/clk-master.c +++ b/drivers/clk/at91/clk-master.c | |||
@@ -165,12 +165,16 @@ at91_clk_register_master(struct at91_pmc *pmc, unsigned int irq, | |||
165 | irq_set_status_flags(master->irq, IRQ_NOAUTOEN); | 165 | irq_set_status_flags(master->irq, IRQ_NOAUTOEN); |
166 | ret = request_irq(master->irq, clk_master_irq_handler, | 166 | ret = request_irq(master->irq, clk_master_irq_handler, |
167 | IRQF_TRIGGER_HIGH, "clk-master", master); | 167 | IRQF_TRIGGER_HIGH, "clk-master", master); |
168 | if (ret) | 168 | if (ret) { |
169 | kfree(master); | ||
169 | return ERR_PTR(ret); | 170 | return ERR_PTR(ret); |
171 | } | ||
170 | 172 | ||
171 | clk = clk_register(NULL, &master->hw); | 173 | clk = clk_register(NULL, &master->hw); |
172 | if (IS_ERR(clk)) | 174 | if (IS_ERR(clk)) { |
175 | free_irq(master->irq, master); | ||
173 | kfree(master); | 176 | kfree(master); |
177 | } | ||
174 | 178 | ||
175 | return clk; | 179 | return clk; |
176 | } | 180 | } |
diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c index cbbe40377ad6..18b60f4895a6 100644 --- a/drivers/clk/at91/clk-pll.c +++ b/drivers/clk/at91/clk-pll.c | |||
@@ -346,12 +346,16 @@ at91_clk_register_pll(struct at91_pmc *pmc, unsigned int irq, const char *name, | |||
346 | irq_set_status_flags(pll->irq, IRQ_NOAUTOEN); | 346 | irq_set_status_flags(pll->irq, IRQ_NOAUTOEN); |
347 | ret = request_irq(pll->irq, clk_pll_irq_handler, IRQF_TRIGGER_HIGH, | 347 | ret = request_irq(pll->irq, clk_pll_irq_handler, IRQF_TRIGGER_HIGH, |
348 | id ? "clk-pllb" : "clk-plla", pll); | 348 | id ? "clk-pllb" : "clk-plla", pll); |
349 | if (ret) | 349 | if (ret) { |
350 | kfree(pll); | ||
350 | return ERR_PTR(ret); | 351 | return ERR_PTR(ret); |
352 | } | ||
351 | 353 | ||
352 | clk = clk_register(NULL, &pll->hw); | 354 | clk = clk_register(NULL, &pll->hw); |
353 | if (IS_ERR(clk)) | 355 | if (IS_ERR(clk)) { |
356 | free_irq(pll->irq, pll); | ||
354 | kfree(pll); | 357 | kfree(pll); |
358 | } | ||
355 | 359 | ||
356 | return clk; | 360 | return clk; |
357 | } | 361 | } |
diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c index a76d03fd577b..58008b3e8bc1 100644 --- a/drivers/clk/at91/clk-system.c +++ b/drivers/clk/at91/clk-system.c | |||
@@ -130,13 +130,17 @@ at91_clk_register_system(struct at91_pmc *pmc, const char *name, | |||
130 | irq_set_status_flags(sys->irq, IRQ_NOAUTOEN); | 130 | irq_set_status_flags(sys->irq, IRQ_NOAUTOEN); |
131 | ret = request_irq(sys->irq, clk_system_irq_handler, | 131 | ret = request_irq(sys->irq, clk_system_irq_handler, |
132 | IRQF_TRIGGER_HIGH, name, sys); | 132 | IRQF_TRIGGER_HIGH, name, sys); |
133 | if (ret) | 133 | if (ret) { |
134 | kfree(sys); | ||
134 | return ERR_PTR(ret); | 135 | return ERR_PTR(ret); |
136 | } | ||
135 | } | 137 | } |
136 | 138 | ||
137 | clk = clk_register(NULL, &sys->hw); | 139 | clk = clk_register(NULL, &sys->hw); |
138 | if (IS_ERR(clk)) | 140 | if (IS_ERR(clk)) { |
141 | free_irq(sys->irq, sys); | ||
139 | kfree(sys); | 142 | kfree(sys); |
143 | } | ||
140 | 144 | ||
141 | return clk; | 145 | return clk; |
142 | } | 146 | } |
diff --git a/drivers/clk/at91/clk-utmi.c b/drivers/clk/at91/clk-utmi.c index ae3263bc1476..30dd697b1668 100644 --- a/drivers/clk/at91/clk-utmi.c +++ b/drivers/clk/at91/clk-utmi.c | |||
@@ -118,12 +118,16 @@ at91_clk_register_utmi(struct at91_pmc *pmc, unsigned int irq, | |||
118 | irq_set_status_flags(utmi->irq, IRQ_NOAUTOEN); | 118 | irq_set_status_flags(utmi->irq, IRQ_NOAUTOEN); |
119 | ret = request_irq(utmi->irq, clk_utmi_irq_handler, | 119 | ret = request_irq(utmi->irq, clk_utmi_irq_handler, |
120 | IRQF_TRIGGER_HIGH, "clk-utmi", utmi); | 120 | IRQF_TRIGGER_HIGH, "clk-utmi", utmi); |
121 | if (ret) | 121 | if (ret) { |
122 | kfree(utmi); | ||
122 | return ERR_PTR(ret); | 123 | return ERR_PTR(ret); |
124 | } | ||
123 | 125 | ||
124 | clk = clk_register(NULL, &utmi->hw); | 126 | clk = clk_register(NULL, &utmi->hw); |
125 | if (IS_ERR(clk)) | 127 | if (IS_ERR(clk)) { |
128 | free_irq(utmi->irq, utmi); | ||
126 | kfree(utmi); | 129 | kfree(utmi); |
130 | } | ||
127 | 131 | ||
128 | return clk; | 132 | return clk; |
129 | } | 133 | } |
diff --git a/drivers/clk/bcm/clk-iproc-asiu.c b/drivers/clk/bcm/clk-iproc-asiu.c index e19c09cd9645..f630e1bbdcfe 100644 --- a/drivers/clk/bcm/clk-iproc-asiu.c +++ b/drivers/clk/bcm/clk-iproc-asiu.c | |||
@@ -222,10 +222,6 @@ void __init iproc_asiu_setup(struct device_node *node, | |||
222 | struct iproc_asiu_clk *asiu_clk; | 222 | struct iproc_asiu_clk *asiu_clk; |
223 | const char *clk_name; | 223 | const char *clk_name; |
224 | 224 | ||
225 | clk_name = kzalloc(IPROC_CLK_NAME_LEN, GFP_KERNEL); | ||
226 | if (WARN_ON(!clk_name)) | ||
227 | goto err_clk_register; | ||
228 | |||
229 | ret = of_property_read_string_index(node, "clock-output-names", | 225 | ret = of_property_read_string_index(node, "clock-output-names", |
230 | i, &clk_name); | 226 | i, &clk_name); |
231 | if (WARN_ON(ret)) | 227 | if (WARN_ON(ret)) |
@@ -259,7 +255,7 @@ void __init iproc_asiu_setup(struct device_node *node, | |||
259 | 255 | ||
260 | err_clk_register: | 256 | err_clk_register: |
261 | for (i = 0; i < num_clks; i++) | 257 | for (i = 0; i < num_clks; i++) |
262 | kfree(asiu->clks[i].name); | 258 | clk_unregister(asiu->clk_data.clks[i]); |
263 | iounmap(asiu->gate_base); | 259 | iounmap(asiu->gate_base); |
264 | 260 | ||
265 | err_iomap_gate: | 261 | err_iomap_gate: |
diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c index 46fb84bc2674..2dda4e8295a9 100644 --- a/drivers/clk/bcm/clk-iproc-pll.c +++ b/drivers/clk/bcm/clk-iproc-pll.c | |||
@@ -366,7 +366,7 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw, | |||
366 | val = readl(pll->pll_base + ctrl->ndiv_int.offset); | 366 | val = readl(pll->pll_base + ctrl->ndiv_int.offset); |
367 | ndiv_int = (val >> ctrl->ndiv_int.shift) & | 367 | ndiv_int = (val >> ctrl->ndiv_int.shift) & |
368 | bit_mask(ctrl->ndiv_int.width); | 368 | bit_mask(ctrl->ndiv_int.width); |
369 | ndiv = ndiv_int << ctrl->ndiv_int.shift; | 369 | ndiv = (u64)ndiv_int << ctrl->ndiv_int.shift; |
370 | 370 | ||
371 | if (ctrl->flags & IPROC_CLK_PLL_HAS_NDIV_FRAC) { | 371 | if (ctrl->flags & IPROC_CLK_PLL_HAS_NDIV_FRAC) { |
372 | val = readl(pll->pll_base + ctrl->ndiv_frac.offset); | 372 | val = readl(pll->pll_base + ctrl->ndiv_frac.offset); |
@@ -374,7 +374,8 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw, | |||
374 | bit_mask(ctrl->ndiv_frac.width); | 374 | bit_mask(ctrl->ndiv_frac.width); |
375 | 375 | ||
376 | if (ndiv_frac != 0) | 376 | if (ndiv_frac != 0) |
377 | ndiv = (ndiv_int << ctrl->ndiv_int.shift) | ndiv_frac; | 377 | ndiv = ((u64)ndiv_int << ctrl->ndiv_int.shift) | |
378 | ndiv_frac; | ||
378 | } | 379 | } |
379 | 380 | ||
380 | val = readl(pll->pll_base + ctrl->pdiv.offset); | 381 | val = readl(pll->pll_base + ctrl->pdiv.offset); |
@@ -655,10 +656,6 @@ void __init iproc_pll_clk_setup(struct device_node *node, | |||
655 | memset(&init, 0, sizeof(init)); | 656 | memset(&init, 0, sizeof(init)); |
656 | parent_name = node->name; | 657 | parent_name = node->name; |
657 | 658 | ||
658 | clk_name = kzalloc(IPROC_CLK_NAME_LEN, GFP_KERNEL); | ||
659 | if (WARN_ON(!clk_name)) | ||
660 | goto err_clk_register; | ||
661 | |||
662 | ret = of_property_read_string_index(node, "clock-output-names", | 659 | ret = of_property_read_string_index(node, "clock-output-names", |
663 | i, &clk_name); | 660 | i, &clk_name); |
664 | if (WARN_ON(ret)) | 661 | if (WARN_ON(ret)) |
@@ -690,10 +687,8 @@ void __init iproc_pll_clk_setup(struct device_node *node, | |||
690 | return; | 687 | return; |
691 | 688 | ||
692 | err_clk_register: | 689 | err_clk_register: |
693 | for (i = 0; i < num_clks; i++) { | 690 | for (i = 0; i < num_clks; i++) |
694 | kfree(pll->clks[i].name); | ||
695 | clk_unregister(pll->clk_data.clks[i]); | 691 | clk_unregister(pll->clk_data.clks[i]); |
696 | } | ||
697 | 692 | ||
698 | err_pll_register: | 693 | err_pll_register: |
699 | if (pll->asiu_base) | 694 | if (pll->asiu_base) |
diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c index b9b12a742970..3f6f7ad39490 100644 --- a/drivers/clk/clk-stm32f4.c +++ b/drivers/clk/clk-stm32f4.c | |||
@@ -268,7 +268,7 @@ static int stm32f4_rcc_lookup_clk_idx(u8 primary, u8 secondary) | |||
268 | memcpy(table, stm32f42xx_gate_map, sizeof(table)); | 268 | memcpy(table, stm32f42xx_gate_map, sizeof(table)); |
269 | 269 | ||
270 | /* only bits set in table can be used as indices */ | 270 | /* only bits set in table can be used as indices */ |
271 | if (WARN_ON(secondary > 8 * sizeof(table) || | 271 | if (WARN_ON(secondary >= BITS_PER_BYTE * sizeof(table) || |
272 | 0 == (table[BIT_ULL_WORD(secondary)] & | 272 | 0 == (table[BIT_ULL_WORD(secondary)] & |
273 | BIT_ULL_MASK(secondary)))) | 273 | BIT_ULL_MASK(secondary)))) |
274 | return -EINVAL; | 274 | return -EINVAL; |
diff --git a/drivers/clk/mediatek/clk-mt8173.c b/drivers/clk/mediatek/clk-mt8173.c index 4b9e04cdf7e8..8b6523d15fb8 100644 --- a/drivers/clk/mediatek/clk-mt8173.c +++ b/drivers/clk/mediatek/clk-mt8173.c | |||
@@ -700,6 +700,22 @@ static const struct mtk_composite peri_clks[] __initconst = { | |||
700 | MUX(CLK_PERI_UART3_SEL, "uart3_ck_sel", uart_ck_sel_parents, 0x40c, 3, 1), | 700 | MUX(CLK_PERI_UART3_SEL, "uart3_ck_sel", uart_ck_sel_parents, 0x40c, 3, 1), |
701 | }; | 701 | }; |
702 | 702 | ||
703 | static struct clk_onecell_data *mt8173_top_clk_data __initdata; | ||
704 | static struct clk_onecell_data *mt8173_pll_clk_data __initdata; | ||
705 | |||
706 | static void __init mtk_clk_enable_critical(void) | ||
707 | { | ||
708 | if (!mt8173_top_clk_data || !mt8173_pll_clk_data) | ||
709 | return; | ||
710 | |||
711 | clk_prepare_enable(mt8173_pll_clk_data->clks[CLK_APMIXED_ARMCA15PLL]); | ||
712 | clk_prepare_enable(mt8173_pll_clk_data->clks[CLK_APMIXED_ARMCA7PLL]); | ||
713 | clk_prepare_enable(mt8173_top_clk_data->clks[CLK_TOP_MEM_SEL]); | ||
714 | clk_prepare_enable(mt8173_top_clk_data->clks[CLK_TOP_DDRPHYCFG_SEL]); | ||
715 | clk_prepare_enable(mt8173_top_clk_data->clks[CLK_TOP_CCI400_SEL]); | ||
716 | clk_prepare_enable(mt8173_top_clk_data->clks[CLK_TOP_RTC_SEL]); | ||
717 | } | ||
718 | |||
703 | static void __init mtk_topckgen_init(struct device_node *node) | 719 | static void __init mtk_topckgen_init(struct device_node *node) |
704 | { | 720 | { |
705 | struct clk_onecell_data *clk_data; | 721 | struct clk_onecell_data *clk_data; |
@@ -712,19 +728,19 @@ static void __init mtk_topckgen_init(struct device_node *node) | |||
712 | return; | 728 | return; |
713 | } | 729 | } |
714 | 730 | ||
715 | clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK); | 731 | mt8173_top_clk_data = clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK); |
716 | 732 | ||
717 | mtk_clk_register_factors(root_clk_alias, ARRAY_SIZE(root_clk_alias), clk_data); | 733 | mtk_clk_register_factors(root_clk_alias, ARRAY_SIZE(root_clk_alias), clk_data); |
718 | mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data); | 734 | mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data); |
719 | mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base, | 735 | mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base, |
720 | &mt8173_clk_lock, clk_data); | 736 | &mt8173_clk_lock, clk_data); |
721 | 737 | ||
722 | clk_prepare_enable(clk_data->clks[CLK_TOP_CCI400_SEL]); | ||
723 | |||
724 | r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); | 738 | r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); |
725 | if (r) | 739 | if (r) |
726 | pr_err("%s(): could not register clock provider: %d\n", | 740 | pr_err("%s(): could not register clock provider: %d\n", |
727 | __func__, r); | 741 | __func__, r); |
742 | |||
743 | mtk_clk_enable_critical(); | ||
728 | } | 744 | } |
729 | CLK_OF_DECLARE(mtk_topckgen, "mediatek,mt8173-topckgen", mtk_topckgen_init); | 745 | CLK_OF_DECLARE(mtk_topckgen, "mediatek,mt8173-topckgen", mtk_topckgen_init); |
730 | 746 | ||
@@ -818,13 +834,13 @@ static void __init mtk_apmixedsys_init(struct device_node *node) | |||
818 | { | 834 | { |
819 | struct clk_onecell_data *clk_data; | 835 | struct clk_onecell_data *clk_data; |
820 | 836 | ||
821 | clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK); | 837 | mt8173_pll_clk_data = clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK); |
822 | if (!clk_data) | 838 | if (!clk_data) |
823 | return; | 839 | return; |
824 | 840 | ||
825 | mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data); | 841 | mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data); |
826 | 842 | ||
827 | clk_prepare_enable(clk_data->clks[CLK_APMIXED_ARMCA15PLL]); | 843 | mtk_clk_enable_critical(); |
828 | } | 844 | } |
829 | CLK_OF_DECLARE(mtk_apmixedsys, "mediatek,mt8173-apmixedsys", | 845 | CLK_OF_DECLARE(mtk_apmixedsys, "mediatek,mt8173-apmixedsys", |
830 | mtk_apmixedsys_init); | 846 | mtk_apmixedsys_init); |
diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index b95d17fbb8d7..92936f0912d2 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c | |||
@@ -530,19 +530,16 @@ static int clk_pixel_set_rate(struct clk_hw *hw, unsigned long rate, | |||
530 | struct clk_rcg2 *rcg = to_clk_rcg2(hw); | 530 | struct clk_rcg2 *rcg = to_clk_rcg2(hw); |
531 | struct freq_tbl f = *rcg->freq_tbl; | 531 | struct freq_tbl f = *rcg->freq_tbl; |
532 | const struct frac_entry *frac = frac_table_pixel; | 532 | const struct frac_entry *frac = frac_table_pixel; |
533 | unsigned long request, src_rate; | 533 | unsigned long request; |
534 | int delta = 100000; | 534 | int delta = 100000; |
535 | u32 mask = BIT(rcg->hid_width) - 1; | 535 | u32 mask = BIT(rcg->hid_width) - 1; |
536 | u32 hid_div; | 536 | u32 hid_div; |
537 | int index = qcom_find_src_index(hw, rcg->parent_map, f.src); | ||
538 | struct clk *parent = clk_get_parent_by_index(hw->clk, index); | ||
539 | 537 | ||
540 | for (; frac->num; frac++) { | 538 | for (; frac->num; frac++) { |
541 | request = (rate * frac->den) / frac->num; | 539 | request = (rate * frac->den) / frac->num; |
542 | 540 | ||
543 | src_rate = __clk_round_rate(parent, request); | 541 | if ((parent_rate < (request - delta)) || |
544 | if ((src_rate < (request - delta)) || | 542 | (parent_rate > (request + delta))) |
545 | (src_rate > (request + delta))) | ||
546 | continue; | 543 | continue; |
547 | 544 | ||
548 | regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, | 545 | regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, |
diff --git a/drivers/clk/spear/clk-aux-synth.c b/drivers/clk/spear/clk-aux-synth.c index bdfb4421c643..f271c350ef94 100644 --- a/drivers/clk/spear/clk-aux-synth.c +++ b/drivers/clk/spear/clk-aux-synth.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2012 ST Microelectronics | 2 | * Copyright (C) 2012 ST Microelectronics |
3 | * Viresh Kumar <viresh.linux@gmail.com> | 3 | * Viresh Kumar <vireshk@kernel.org> |
4 | * | 4 | * |
5 | * This file is licensed under the terms of the GNU General Public | 5 | * This file is licensed under the terms of the GNU General Public |
6 | * License version 2. This program is licensed "as is" without any | 6 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/spear/clk-frac-synth.c b/drivers/clk/spear/clk-frac-synth.c index dffd4ce6c8b5..58d678b5b40a 100644 --- a/drivers/clk/spear/clk-frac-synth.c +++ b/drivers/clk/spear/clk-frac-synth.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2012 ST Microelectronics | 2 | * Copyright (C) 2012 ST Microelectronics |
3 | * Viresh Kumar <viresh.linux@gmail.com> | 3 | * Viresh Kumar <vireshk@kernel.org> |
4 | * | 4 | * |
5 | * This file is licensed under the terms of the GNU General Public | 5 | * This file is licensed under the terms of the GNU General Public |
6 | * License version 2. This program is licensed "as is" without any | 6 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/spear/clk-gpt-synth.c b/drivers/clk/spear/clk-gpt-synth.c index 1afc18c4effc..1a722e99e76e 100644 --- a/drivers/clk/spear/clk-gpt-synth.c +++ b/drivers/clk/spear/clk-gpt-synth.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2012 ST Microelectronics | 2 | * Copyright (C) 2012 ST Microelectronics |
3 | * Viresh Kumar <viresh.linux@gmail.com> | 3 | * Viresh Kumar <vireshk@kernel.org> |
4 | * | 4 | * |
5 | * This file is licensed under the terms of the GNU General Public | 5 | * This file is licensed under the terms of the GNU General Public |
6 | * License version 2. This program is licensed "as is" without any | 6 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/spear/clk-vco-pll.c b/drivers/clk/spear/clk-vco-pll.c index 1b9b65bca51e..5ebddc528145 100644 --- a/drivers/clk/spear/clk-vco-pll.c +++ b/drivers/clk/spear/clk-vco-pll.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2012 ST Microelectronics | 2 | * Copyright (C) 2012 ST Microelectronics |
3 | * Viresh Kumar <viresh.linux@gmail.com> | 3 | * Viresh Kumar <vireshk@kernel.org> |
4 | * | 4 | * |
5 | * This file is licensed under the terms of the GNU General Public | 5 | * This file is licensed under the terms of the GNU General Public |
6 | * License version 2. This program is licensed "as is" without any | 6 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/spear/clk.c b/drivers/clk/spear/clk.c index 628b6d5ed3d9..157fe099ea6a 100644 --- a/drivers/clk/spear/clk.c +++ b/drivers/clk/spear/clk.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2012 ST Microelectronics | 2 | * Copyright (C) 2012 ST Microelectronics |
3 | * Viresh Kumar <viresh.linux@gmail.com> | 3 | * Viresh Kumar <vireshk@kernel.org> |
4 | * | 4 | * |
5 | * This file is licensed under the terms of the GNU General Public | 5 | * This file is licensed under the terms of the GNU General Public |
6 | * License version 2. This program is licensed "as is" without any | 6 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/spear/clk.h b/drivers/clk/spear/clk.h index 931737677dfa..9834944f08b1 100644 --- a/drivers/clk/spear/clk.h +++ b/drivers/clk/spear/clk.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * Clock framework definitions for SPEAr platform | 2 | * Clock framework definitions for SPEAr platform |
3 | * | 3 | * |
4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
5 | * Viresh Kumar <viresh.linux@gmail.com> | 5 | * Viresh Kumar <vireshk@kernel.org> |
6 | * | 6 | * |
7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/spear/spear1310_clock.c b/drivers/clk/spear/spear1310_clock.c index 4daa5977793a..222ce108b41a 100644 --- a/drivers/clk/spear/spear1310_clock.c +++ b/drivers/clk/spear/spear1310_clock.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * SPEAr1310 machine clock framework source file | 4 | * SPEAr1310 machine clock framework source file |
5 | * | 5 | * |
6 | * Copyright (C) 2012 ST Microelectronics | 6 | * Copyright (C) 2012 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/spear/spear1340_clock.c b/drivers/clk/spear/spear1340_clock.c index 5a5c6648308d..973c9d3fbcf8 100644 --- a/drivers/clk/spear/spear1340_clock.c +++ b/drivers/clk/spear/spear1340_clock.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * SPEAr1340 machine clock framework source file | 4 | * SPEAr1340 machine clock framework source file |
5 | * | 5 | * |
6 | * Copyright (C) 2012 ST Microelectronics | 6 | * Copyright (C) 2012 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/spear/spear3xx_clock.c b/drivers/clk/spear/spear3xx_clock.c index bb5f387774e2..404a55edd613 100644 --- a/drivers/clk/spear/spear3xx_clock.c +++ b/drivers/clk/spear/spear3xx_clock.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * SPEAr3xx machines clock framework source file | 2 | * SPEAr3xx machines clock framework source file |
3 | * | 3 | * |
4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
5 | * Viresh Kumar <viresh.linux@gmail.com> | 5 | * Viresh Kumar <vireshk@kernel.org> |
6 | * | 6 | * |
7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/spear/spear6xx_clock.c b/drivers/clk/spear/spear6xx_clock.c index 4f649c9cb094..231061fa73a4 100644 --- a/drivers/clk/spear/spear6xx_clock.c +++ b/drivers/clk/spear/spear6xx_clock.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * SPEAr6xx machines clock framework source file | 2 | * SPEAr6xx machines clock framework source file |
3 | * | 3 | * |
4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
5 | * Viresh Kumar <viresh.linux@gmail.com> | 5 | * Viresh Kumar <vireshk@kernel.org> |
6 | * | 6 | * |
7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c index 657ca14ba709..8dd8cce27361 100644 --- a/drivers/clk/st/clk-flexgen.c +++ b/drivers/clk/st/clk-flexgen.c | |||
@@ -190,7 +190,7 @@ static struct clk *clk_register_flexgen(const char *name, | |||
190 | 190 | ||
191 | init.name = name; | 191 | init.name = name; |
192 | init.ops = &flexgen_ops; | 192 | init.ops = &flexgen_ops; |
193 | init.flags = CLK_IS_BASIC | flexgen_flags; | 193 | init.flags = CLK_IS_BASIC | CLK_GET_RATE_NOCACHE | flexgen_flags; |
194 | init.parent_names = parent_names; | 194 | init.parent_names = parent_names; |
195 | init.num_parents = num_parents; | 195 | init.num_parents = num_parents; |
196 | 196 | ||
@@ -303,6 +303,8 @@ static void __init st_of_flexgen_setup(struct device_node *np) | |||
303 | if (!rlock) | 303 | if (!rlock) |
304 | goto err; | 304 | goto err; |
305 | 305 | ||
306 | spin_lock_init(rlock); | ||
307 | |||
306 | for (i = 0; i < clk_data->clk_num; i++) { | 308 | for (i = 0; i < clk_data->clk_num; i++) { |
307 | struct clk *clk; | 309 | struct clk *clk; |
308 | const char *clk_name; | 310 | const char *clk_name; |
diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c index e94197f04b0b..d9eb2e1d8471 100644 --- a/drivers/clk/st/clkgen-fsyn.c +++ b/drivers/clk/st/clkgen-fsyn.c | |||
@@ -340,7 +340,7 @@ static const struct clkgen_quadfs_data st_fs660c32_C_407 = { | |||
340 | CLKGEN_FIELD(0x30c, 0xf, 20), | 340 | CLKGEN_FIELD(0x30c, 0xf, 20), |
341 | CLKGEN_FIELD(0x310, 0xf, 20) }, | 341 | CLKGEN_FIELD(0x310, 0xf, 20) }, |
342 | .lockstatus_present = true, | 342 | .lockstatus_present = true, |
343 | .lock_status = CLKGEN_FIELD(0x2A0, 0x1, 24), | 343 | .lock_status = CLKGEN_FIELD(0x2f0, 0x1, 24), |
344 | .powerup_polarity = 1, | 344 | .powerup_polarity = 1, |
345 | .standby_polarity = 1, | 345 | .standby_polarity = 1, |
346 | .pll_ops = &st_quadfs_pll_c32_ops, | 346 | .pll_ops = &st_quadfs_pll_c32_ops, |
@@ -489,7 +489,7 @@ static int quadfs_pll_is_enabled(struct clk_hw *hw) | |||
489 | struct st_clk_quadfs_pll *pll = to_quadfs_pll(hw); | 489 | struct st_clk_quadfs_pll *pll = to_quadfs_pll(hw); |
490 | u32 npda = CLKGEN_READ(pll, npda); | 490 | u32 npda = CLKGEN_READ(pll, npda); |
491 | 491 | ||
492 | return !!npda; | 492 | return pll->data->powerup_polarity ? !npda : !!npda; |
493 | } | 493 | } |
494 | 494 | ||
495 | static int clk_fs660c32_vco_get_rate(unsigned long input, struct stm_fs *fs, | 495 | static int clk_fs660c32_vco_get_rate(unsigned long input, struct stm_fs *fs, |
@@ -635,7 +635,7 @@ static struct clk * __init st_clk_register_quadfs_pll( | |||
635 | 635 | ||
636 | init.name = name; | 636 | init.name = name; |
637 | init.ops = quadfs->pll_ops; | 637 | init.ops = quadfs->pll_ops; |
638 | init.flags = CLK_IS_BASIC; | 638 | init.flags = CLK_IS_BASIC | CLK_GET_RATE_NOCACHE; |
639 | init.parent_names = &parent_name; | 639 | init.parent_names = &parent_name; |
640 | init.num_parents = 1; | 640 | init.num_parents = 1; |
641 | 641 | ||
@@ -774,7 +774,7 @@ static void quadfs_fsynth_disable(struct clk_hw *hw) | |||
774 | if (fs->lock) | 774 | if (fs->lock) |
775 | spin_lock_irqsave(fs->lock, flags); | 775 | spin_lock_irqsave(fs->lock, flags); |
776 | 776 | ||
777 | CLKGEN_WRITE(fs, nsb[fs->chan], !fs->data->standby_polarity); | 777 | CLKGEN_WRITE(fs, nsb[fs->chan], fs->data->standby_polarity); |
778 | 778 | ||
779 | if (fs->lock) | 779 | if (fs->lock) |
780 | spin_unlock_irqrestore(fs->lock, flags); | 780 | spin_unlock_irqrestore(fs->lock, flags); |
@@ -1082,10 +1082,6 @@ static const struct of_device_id quadfs_of_match[] = { | |||
1082 | .compatible = "st,stih407-quadfs660-D", | 1082 | .compatible = "st,stih407-quadfs660-D", |
1083 | .data = &st_fs660c32_D_407 | 1083 | .data = &st_fs660c32_D_407 |
1084 | }, | 1084 | }, |
1085 | { | ||
1086 | .compatible = "st,stih407-quadfs660-D", | ||
1087 | .data = (void *)&st_fs660c32_D_407 | ||
1088 | }, | ||
1089 | {} | 1085 | {} |
1090 | }; | 1086 | }; |
1091 | 1087 | ||
diff --git a/drivers/clk/st/clkgen-mux.c b/drivers/clk/st/clkgen-mux.c index 4fbe6e099587..717c4a91a17b 100644 --- a/drivers/clk/st/clkgen-mux.c +++ b/drivers/clk/st/clkgen-mux.c | |||
@@ -237,7 +237,7 @@ static struct clk *clk_register_genamux(const char *name, | |||
237 | 237 | ||
238 | init.name = name; | 238 | init.name = name; |
239 | init.ops = &clkgena_divmux_ops; | 239 | init.ops = &clkgena_divmux_ops; |
240 | init.flags = CLK_IS_BASIC; | 240 | init.flags = CLK_IS_BASIC | CLK_GET_RATE_NOCACHE; |
241 | init.parent_names = parent_names; | 241 | init.parent_names = parent_names; |
242 | init.num_parents = num_parents; | 242 | init.num_parents = num_parents; |
243 | 243 | ||
@@ -513,7 +513,8 @@ static void __init st_of_clkgena_prediv_setup(struct device_node *np) | |||
513 | 0, &clk_name)) | 513 | 0, &clk_name)) |
514 | return; | 514 | return; |
515 | 515 | ||
516 | clk = clk_register_divider_table(NULL, clk_name, parent_name, 0, | 516 | clk = clk_register_divider_table(NULL, clk_name, parent_name, |
517 | CLK_GET_RATE_NOCACHE, | ||
517 | reg + data->offset, data->shift, 1, | 518 | reg + data->offset, data->shift, 1, |
518 | 0, data->table, NULL); | 519 | 0, data->table, NULL); |
519 | if (IS_ERR(clk)) | 520 | if (IS_ERR(clk)) |
@@ -582,7 +583,7 @@ static struct clkgen_mux_data stih416_a9_mux_data = { | |||
582 | }; | 583 | }; |
583 | static struct clkgen_mux_data stih407_a9_mux_data = { | 584 | static struct clkgen_mux_data stih407_a9_mux_data = { |
584 | .offset = 0x1a4, | 585 | .offset = 0x1a4, |
585 | .shift = 1, | 586 | .shift = 0, |
586 | .width = 2, | 587 | .width = 2, |
587 | }; | 588 | }; |
588 | 589 | ||
@@ -786,7 +787,8 @@ static void __init st_of_clkgen_vcc_setup(struct device_node *np) | |||
786 | &mux->hw, &clk_mux_ops, | 787 | &mux->hw, &clk_mux_ops, |
787 | &div->hw, &clk_divider_ops, | 788 | &div->hw, &clk_divider_ops, |
788 | &gate->hw, &clk_gate_ops, | 789 | &gate->hw, &clk_gate_ops, |
789 | data->clk_flags); | 790 | data->clk_flags | |
791 | CLK_GET_RATE_NOCACHE); | ||
790 | if (IS_ERR(clk)) { | 792 | if (IS_ERR(clk)) { |
791 | kfree(gate); | 793 | kfree(gate); |
792 | kfree(div); | 794 | kfree(div); |
diff --git a/drivers/clk/st/clkgen-pll.c b/drivers/clk/st/clkgen-pll.c index 106532207213..72d1c27eaffa 100644 --- a/drivers/clk/st/clkgen-pll.c +++ b/drivers/clk/st/clkgen-pll.c | |||
@@ -406,7 +406,7 @@ static struct clk * __init clkgen_pll_register(const char *parent_name, | |||
406 | init.name = clk_name; | 406 | init.name = clk_name; |
407 | init.ops = pll_data->ops; | 407 | init.ops = pll_data->ops; |
408 | 408 | ||
409 | init.flags = CLK_IS_BASIC; | 409 | init.flags = CLK_IS_BASIC | CLK_GET_RATE_NOCACHE; |
410 | init.parent_names = &parent_name; | 410 | init.parent_names = &parent_name; |
411 | init.num_parents = 1; | 411 | init.num_parents = 1; |
412 | 412 | ||
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c index 9a82f17d2d73..abf7b37faf73 100644 --- a/drivers/clk/sunxi/clk-sunxi.c +++ b/drivers/clk/sunxi/clk-sunxi.c | |||
@@ -1391,6 +1391,7 @@ static void __init sun6i_init_clocks(struct device_node *node) | |||
1391 | CLK_OF_DECLARE(sun6i_a31_clk_init, "allwinner,sun6i-a31", sun6i_init_clocks); | 1391 | CLK_OF_DECLARE(sun6i_a31_clk_init, "allwinner,sun6i-a31", sun6i_init_clocks); |
1392 | CLK_OF_DECLARE(sun6i_a31s_clk_init, "allwinner,sun6i-a31s", sun6i_init_clocks); | 1392 | CLK_OF_DECLARE(sun6i_a31s_clk_init, "allwinner,sun6i-a31s", sun6i_init_clocks); |
1393 | CLK_OF_DECLARE(sun8i_a23_clk_init, "allwinner,sun8i-a23", sun6i_init_clocks); | 1393 | CLK_OF_DECLARE(sun8i_a23_clk_init, "allwinner,sun8i-a23", sun6i_init_clocks); |
1394 | CLK_OF_DECLARE(sun8i_a33_clk_init, "allwinner,sun8i-a33", sun6i_init_clocks); | ||
1394 | 1395 | ||
1395 | static void __init sun9i_init_clocks(struct device_node *node) | 1396 | static void __init sun9i_init_clocks(struct device_node *node) |
1396 | { | 1397 | { |
diff --git a/drivers/clocksource/timer-imx-gpt.c b/drivers/clocksource/timer-imx-gpt.c index 879c78423546..2d59038dec43 100644 --- a/drivers/clocksource/timer-imx-gpt.c +++ b/drivers/clocksource/timer-imx-gpt.c | |||
@@ -529,6 +529,7 @@ static void __init imx6dl_timer_init_dt(struct device_node *np) | |||
529 | 529 | ||
530 | CLOCKSOURCE_OF_DECLARE(imx1_timer, "fsl,imx1-gpt", imx1_timer_init_dt); | 530 | CLOCKSOURCE_OF_DECLARE(imx1_timer, "fsl,imx1-gpt", imx1_timer_init_dt); |
531 | CLOCKSOURCE_OF_DECLARE(imx21_timer, "fsl,imx21-gpt", imx21_timer_init_dt); | 531 | CLOCKSOURCE_OF_DECLARE(imx21_timer, "fsl,imx21-gpt", imx21_timer_init_dt); |
532 | CLOCKSOURCE_OF_DECLARE(imx27_timer, "fsl,imx27-gpt", imx21_timer_init_dt); | ||
532 | CLOCKSOURCE_OF_DECLARE(imx31_timer, "fsl,imx31-gpt", imx31_timer_init_dt); | 533 | CLOCKSOURCE_OF_DECLARE(imx31_timer, "fsl,imx31-gpt", imx31_timer_init_dt); |
533 | CLOCKSOURCE_OF_DECLARE(imx25_timer, "fsl,imx25-gpt", imx31_timer_init_dt); | 534 | CLOCKSOURCE_OF_DECLARE(imx25_timer, "fsl,imx25-gpt", imx31_timer_init_dt); |
534 | CLOCKSOURCE_OF_DECLARE(imx50_timer, "fsl,imx50-gpt", imx31_timer_init_dt); | 535 | CLOCKSOURCE_OF_DECLARE(imx50_timer, "fsl,imx50-gpt", imx31_timer_init_dt); |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index b612411655f9..26063afb3eba 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -169,6 +169,15 @@ struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy) | |||
169 | } | 169 | } |
170 | EXPORT_SYMBOL_GPL(get_governor_parent_kobj); | 170 | EXPORT_SYMBOL_GPL(get_governor_parent_kobj); |
171 | 171 | ||
172 | struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu) | ||
173 | { | ||
174 | struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); | ||
175 | |||
176 | return policy && !policy_is_inactive(policy) ? | ||
177 | policy->freq_table : NULL; | ||
178 | } | ||
179 | EXPORT_SYMBOL_GPL(cpufreq_frequency_get_table); | ||
180 | |||
172 | static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall) | 181 | static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall) |
173 | { | 182 | { |
174 | u64 idle_time; | 183 | u64 idle_time; |
@@ -1132,6 +1141,7 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu) | |||
1132 | 1141 | ||
1133 | down_write(&policy->rwsem); | 1142 | down_write(&policy->rwsem); |
1134 | policy->cpu = cpu; | 1143 | policy->cpu = cpu; |
1144 | policy->governor = NULL; | ||
1135 | up_write(&policy->rwsem); | 1145 | up_write(&policy->rwsem); |
1136 | } | 1146 | } |
1137 | 1147 | ||
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index df14766a8e06..dfbbf981ed56 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c | |||
@@ -297,15 +297,6 @@ int cpufreq_table_validate_and_show(struct cpufreq_policy *policy, | |||
297 | } | 297 | } |
298 | EXPORT_SYMBOL_GPL(cpufreq_table_validate_and_show); | 298 | EXPORT_SYMBOL_GPL(cpufreq_table_validate_and_show); |
299 | 299 | ||
300 | struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu); | ||
301 | |||
302 | struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu) | ||
303 | { | ||
304 | struct cpufreq_policy *policy = cpufreq_cpu_get_raw(cpu); | ||
305 | return policy ? policy->freq_table : NULL; | ||
306 | } | ||
307 | EXPORT_SYMBOL_GPL(cpufreq_frequency_get_table); | ||
308 | |||
309 | MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>"); | 300 | MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>"); |
310 | MODULE_DESCRIPTION("CPUfreq frequency table helpers"); | 301 | MODULE_DESCRIPTION("CPUfreq frequency table helpers"); |
311 | MODULE_LICENSE("GPL"); | 302 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c index fc897babab55..e362860c2b50 100644 --- a/drivers/cpufreq/loongson2_cpufreq.c +++ b/drivers/cpufreq/loongson2_cpufreq.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * The 2E revision of loongson processor not support this feature. | 4 | * The 2E revision of loongson processor not support this feature. |
5 | * | 5 | * |
6 | * Copyright (C) 2006 - 2008 Lemote Inc. & Insititute of Computing Technology | 6 | * Copyright (C) 2006 - 2008 Lemote Inc. & Institute of Computing Technology |
7 | * Author: Yanhua, yanh@lemote.com | 7 | * Author: Yanhua, yanh@lemote.com |
8 | * | 8 | * |
9 | * This file is subject to the terms and conditions of the GNU General Public | 9 | * This file is subject to the terms and conditions of the GNU General Public |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index e8e2775c3821..48b7228563ad 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
@@ -112,7 +112,12 @@ int cpuidle_find_deepest_state(struct cpuidle_driver *drv, | |||
112 | static void enter_freeze_proper(struct cpuidle_driver *drv, | 112 | static void enter_freeze_proper(struct cpuidle_driver *drv, |
113 | struct cpuidle_device *dev, int index) | 113 | struct cpuidle_device *dev, int index) |
114 | { | 114 | { |
115 | tick_freeze(); | 115 | /* |
116 | * trace_suspend_resume() called by tick_freeze() for the last CPU | ||
117 | * executing it contains RCU usage regarded as invalid in the idle | ||
118 | * context, so tell RCU about that. | ||
119 | */ | ||
120 | RCU_NONIDLE(tick_freeze()); | ||
116 | /* | 121 | /* |
117 | * The state used here cannot be a "coupled" one, because the "coupled" | 122 | * The state used here cannot be a "coupled" one, because the "coupled" |
118 | * cpuidle mechanism enables interrupts and doing that with timekeeping | 123 | * cpuidle mechanism enables interrupts and doing that with timekeeping |
@@ -122,7 +127,7 @@ static void enter_freeze_proper(struct cpuidle_driver *drv, | |||
122 | WARN_ON(!irqs_disabled()); | 127 | WARN_ON(!irqs_disabled()); |
123 | /* | 128 | /* |
124 | * timekeeping_resume() that will be called by tick_unfreeze() for the | 129 | * timekeeping_resume() that will be called by tick_unfreeze() for the |
125 | * last CPU executing it calls functions containing RCU read-side | 130 | * first CPU executing it calls functions containing RCU read-side |
126 | * critical sections, so tell RCU about that. | 131 | * critical sections, so tell RCU about that. |
127 | */ | 132 | */ |
128 | RCU_NONIDLE(tick_unfreeze()); | 133 | RCU_NONIDLE(tick_unfreeze()); |
diff --git a/drivers/crypto/nx/nx-aes-ccm.c b/drivers/crypto/nx/nx-aes-ccm.c index 67f80813a06f..e4311ce0cd78 100644 --- a/drivers/crypto/nx/nx-aes-ccm.c +++ b/drivers/crypto/nx/nx-aes-ccm.c | |||
@@ -494,8 +494,9 @@ out: | |||
494 | static int ccm4309_aes_nx_encrypt(struct aead_request *req) | 494 | static int ccm4309_aes_nx_encrypt(struct aead_request *req) |
495 | { | 495 | { |
496 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); | 496 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); |
497 | struct nx_gcm_rctx *rctx = aead_request_ctx(req); | ||
497 | struct blkcipher_desc desc; | 498 | struct blkcipher_desc desc; |
498 | u8 *iv = nx_ctx->priv.ccm.iv; | 499 | u8 *iv = rctx->iv; |
499 | 500 | ||
500 | iv[0] = 3; | 501 | iv[0] = 3; |
501 | memcpy(iv + 1, nx_ctx->priv.ccm.nonce, 3); | 502 | memcpy(iv + 1, nx_ctx->priv.ccm.nonce, 3); |
@@ -525,8 +526,9 @@ static int ccm_aes_nx_encrypt(struct aead_request *req) | |||
525 | static int ccm4309_aes_nx_decrypt(struct aead_request *req) | 526 | static int ccm4309_aes_nx_decrypt(struct aead_request *req) |
526 | { | 527 | { |
527 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); | 528 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); |
529 | struct nx_gcm_rctx *rctx = aead_request_ctx(req); | ||
528 | struct blkcipher_desc desc; | 530 | struct blkcipher_desc desc; |
529 | u8 *iv = nx_ctx->priv.ccm.iv; | 531 | u8 *iv = rctx->iv; |
530 | 532 | ||
531 | iv[0] = 3; | 533 | iv[0] = 3; |
532 | memcpy(iv + 1, nx_ctx->priv.ccm.nonce, 3); | 534 | memcpy(iv + 1, nx_ctx->priv.ccm.nonce, 3); |
diff --git a/drivers/crypto/nx/nx-aes-ctr.c b/drivers/crypto/nx/nx-aes-ctr.c index 2617cd4d54dd..dd7e9f3f5b6b 100644 --- a/drivers/crypto/nx/nx-aes-ctr.c +++ b/drivers/crypto/nx/nx-aes-ctr.c | |||
@@ -72,7 +72,7 @@ static int ctr3686_aes_nx_set_key(struct crypto_tfm *tfm, | |||
72 | if (key_len < CTR_RFC3686_NONCE_SIZE) | 72 | if (key_len < CTR_RFC3686_NONCE_SIZE) |
73 | return -EINVAL; | 73 | return -EINVAL; |
74 | 74 | ||
75 | memcpy(nx_ctx->priv.ctr.iv, | 75 | memcpy(nx_ctx->priv.ctr.nonce, |
76 | in_key + key_len - CTR_RFC3686_NONCE_SIZE, | 76 | in_key + key_len - CTR_RFC3686_NONCE_SIZE, |
77 | CTR_RFC3686_NONCE_SIZE); | 77 | CTR_RFC3686_NONCE_SIZE); |
78 | 78 | ||
@@ -131,14 +131,15 @@ static int ctr3686_aes_nx_crypt(struct blkcipher_desc *desc, | |||
131 | unsigned int nbytes) | 131 | unsigned int nbytes) |
132 | { | 132 | { |
133 | struct nx_crypto_ctx *nx_ctx = crypto_blkcipher_ctx(desc->tfm); | 133 | struct nx_crypto_ctx *nx_ctx = crypto_blkcipher_ctx(desc->tfm); |
134 | u8 *iv = nx_ctx->priv.ctr.iv; | 134 | u8 iv[16]; |
135 | 135 | ||
136 | memcpy(iv, nx_ctx->priv.ctr.nonce, CTR_RFC3686_IV_SIZE); | ||
136 | memcpy(iv + CTR_RFC3686_NONCE_SIZE, | 137 | memcpy(iv + CTR_RFC3686_NONCE_SIZE, |
137 | desc->info, CTR_RFC3686_IV_SIZE); | 138 | desc->info, CTR_RFC3686_IV_SIZE); |
138 | iv[12] = iv[13] = iv[14] = 0; | 139 | iv[12] = iv[13] = iv[14] = 0; |
139 | iv[15] = 1; | 140 | iv[15] = 1; |
140 | 141 | ||
141 | desc->info = nx_ctx->priv.ctr.iv; | 142 | desc->info = iv; |
142 | 143 | ||
143 | return ctr_aes_nx_crypt(desc, dst, src, nbytes); | 144 | return ctr_aes_nx_crypt(desc, dst, src, nbytes); |
144 | } | 145 | } |
diff --git a/drivers/crypto/nx/nx-aes-gcm.c b/drivers/crypto/nx/nx-aes-gcm.c index 08ac6d48688c..92c993f08213 100644 --- a/drivers/crypto/nx/nx-aes-gcm.c +++ b/drivers/crypto/nx/nx-aes-gcm.c | |||
@@ -317,6 +317,7 @@ out: | |||
317 | static int gcm_aes_nx_crypt(struct aead_request *req, int enc) | 317 | static int gcm_aes_nx_crypt(struct aead_request *req, int enc) |
318 | { | 318 | { |
319 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); | 319 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); |
320 | struct nx_gcm_rctx *rctx = aead_request_ctx(req); | ||
320 | struct nx_csbcpb *csbcpb = nx_ctx->csbcpb; | 321 | struct nx_csbcpb *csbcpb = nx_ctx->csbcpb; |
321 | struct blkcipher_desc desc; | 322 | struct blkcipher_desc desc; |
322 | unsigned int nbytes = req->cryptlen; | 323 | unsigned int nbytes = req->cryptlen; |
@@ -326,7 +327,7 @@ static int gcm_aes_nx_crypt(struct aead_request *req, int enc) | |||
326 | 327 | ||
327 | spin_lock_irqsave(&nx_ctx->lock, irq_flags); | 328 | spin_lock_irqsave(&nx_ctx->lock, irq_flags); |
328 | 329 | ||
329 | desc.info = nx_ctx->priv.gcm.iv; | 330 | desc.info = rctx->iv; |
330 | /* initialize the counter */ | 331 | /* initialize the counter */ |
331 | *(u32 *)(desc.info + NX_GCM_CTR_OFFSET) = 1; | 332 | *(u32 *)(desc.info + NX_GCM_CTR_OFFSET) = 1; |
332 | 333 | ||
@@ -424,8 +425,8 @@ out: | |||
424 | 425 | ||
425 | static int gcm_aes_nx_encrypt(struct aead_request *req) | 426 | static int gcm_aes_nx_encrypt(struct aead_request *req) |
426 | { | 427 | { |
427 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); | 428 | struct nx_gcm_rctx *rctx = aead_request_ctx(req); |
428 | char *iv = nx_ctx->priv.gcm.iv; | 429 | char *iv = rctx->iv; |
429 | 430 | ||
430 | memcpy(iv, req->iv, 12); | 431 | memcpy(iv, req->iv, 12); |
431 | 432 | ||
@@ -434,8 +435,8 @@ static int gcm_aes_nx_encrypt(struct aead_request *req) | |||
434 | 435 | ||
435 | static int gcm_aes_nx_decrypt(struct aead_request *req) | 436 | static int gcm_aes_nx_decrypt(struct aead_request *req) |
436 | { | 437 | { |
437 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); | 438 | struct nx_gcm_rctx *rctx = aead_request_ctx(req); |
438 | char *iv = nx_ctx->priv.gcm.iv; | 439 | char *iv = rctx->iv; |
439 | 440 | ||
440 | memcpy(iv, req->iv, 12); | 441 | memcpy(iv, req->iv, 12); |
441 | 442 | ||
@@ -445,7 +446,8 @@ static int gcm_aes_nx_decrypt(struct aead_request *req) | |||
445 | static int gcm4106_aes_nx_encrypt(struct aead_request *req) | 446 | static int gcm4106_aes_nx_encrypt(struct aead_request *req) |
446 | { | 447 | { |
447 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); | 448 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); |
448 | char *iv = nx_ctx->priv.gcm.iv; | 449 | struct nx_gcm_rctx *rctx = aead_request_ctx(req); |
450 | char *iv = rctx->iv; | ||
449 | char *nonce = nx_ctx->priv.gcm.nonce; | 451 | char *nonce = nx_ctx->priv.gcm.nonce; |
450 | 452 | ||
451 | memcpy(iv, nonce, NX_GCM4106_NONCE_LEN); | 453 | memcpy(iv, nonce, NX_GCM4106_NONCE_LEN); |
@@ -457,7 +459,8 @@ static int gcm4106_aes_nx_encrypt(struct aead_request *req) | |||
457 | static int gcm4106_aes_nx_decrypt(struct aead_request *req) | 459 | static int gcm4106_aes_nx_decrypt(struct aead_request *req) |
458 | { | 460 | { |
459 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); | 461 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); |
460 | char *iv = nx_ctx->priv.gcm.iv; | 462 | struct nx_gcm_rctx *rctx = aead_request_ctx(req); |
463 | char *iv = rctx->iv; | ||
461 | char *nonce = nx_ctx->priv.gcm.nonce; | 464 | char *nonce = nx_ctx->priv.gcm.nonce; |
462 | 465 | ||
463 | memcpy(iv, nonce, NX_GCM4106_NONCE_LEN); | 466 | memcpy(iv, nonce, NX_GCM4106_NONCE_LEN); |
diff --git a/drivers/crypto/nx/nx-aes-xcbc.c b/drivers/crypto/nx/nx-aes-xcbc.c index 8c2faffab4a3..c2f7d4befb55 100644 --- a/drivers/crypto/nx/nx-aes-xcbc.c +++ b/drivers/crypto/nx/nx-aes-xcbc.c | |||
@@ -42,6 +42,7 @@ static int nx_xcbc_set_key(struct crypto_shash *desc, | |||
42 | unsigned int key_len) | 42 | unsigned int key_len) |
43 | { | 43 | { |
44 | struct nx_crypto_ctx *nx_ctx = crypto_shash_ctx(desc); | 44 | struct nx_crypto_ctx *nx_ctx = crypto_shash_ctx(desc); |
45 | struct nx_csbcpb *csbcpb = nx_ctx->csbcpb; | ||
45 | 46 | ||
46 | switch (key_len) { | 47 | switch (key_len) { |
47 | case AES_KEYSIZE_128: | 48 | case AES_KEYSIZE_128: |
@@ -51,7 +52,7 @@ static int nx_xcbc_set_key(struct crypto_shash *desc, | |||
51 | return -EINVAL; | 52 | return -EINVAL; |
52 | } | 53 | } |
53 | 54 | ||
54 | memcpy(nx_ctx->priv.xcbc.key, in_key, key_len); | 55 | memcpy(csbcpb->cpb.aes_xcbc.key, in_key, key_len); |
55 | 56 | ||
56 | return 0; | 57 | return 0; |
57 | } | 58 | } |
@@ -148,32 +149,29 @@ out: | |||
148 | return rc; | 149 | return rc; |
149 | } | 150 | } |
150 | 151 | ||
151 | static int nx_xcbc_init(struct shash_desc *desc) | 152 | static int nx_crypto_ctx_aes_xcbc_init2(struct crypto_tfm *tfm) |
152 | { | 153 | { |
153 | struct xcbc_state *sctx = shash_desc_ctx(desc); | 154 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(tfm); |
154 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); | ||
155 | struct nx_csbcpb *csbcpb = nx_ctx->csbcpb; | 155 | struct nx_csbcpb *csbcpb = nx_ctx->csbcpb; |
156 | struct nx_sg *out_sg; | 156 | int err; |
157 | int len; | ||
158 | 157 | ||
159 | nx_ctx_init(nx_ctx, HCOP_FC_AES); | 158 | err = nx_crypto_ctx_aes_xcbc_init(tfm); |
159 | if (err) | ||
160 | return err; | ||
160 | 161 | ||
161 | memset(sctx, 0, sizeof *sctx); | 162 | nx_ctx_init(nx_ctx, HCOP_FC_AES); |
162 | 163 | ||
163 | NX_CPB_SET_KEY_SIZE(csbcpb, NX_KS_AES_128); | 164 | NX_CPB_SET_KEY_SIZE(csbcpb, NX_KS_AES_128); |
164 | csbcpb->cpb.hdr.mode = NX_MODE_AES_XCBC_MAC; | 165 | csbcpb->cpb.hdr.mode = NX_MODE_AES_XCBC_MAC; |
165 | 166 | ||
166 | memcpy(csbcpb->cpb.aes_xcbc.key, nx_ctx->priv.xcbc.key, AES_BLOCK_SIZE); | 167 | return 0; |
167 | memset(nx_ctx->priv.xcbc.key, 0, sizeof *nx_ctx->priv.xcbc.key); | 168 | } |
168 | |||
169 | len = AES_BLOCK_SIZE; | ||
170 | out_sg = nx_build_sg_list(nx_ctx->out_sg, (u8 *)sctx->state, | ||
171 | &len, nx_ctx->ap->sglen); | ||
172 | 169 | ||
173 | if (len != AES_BLOCK_SIZE) | 170 | static int nx_xcbc_init(struct shash_desc *desc) |
174 | return -EINVAL; | 171 | { |
172 | struct xcbc_state *sctx = shash_desc_ctx(desc); | ||
175 | 173 | ||
176 | nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg); | 174 | memset(sctx, 0, sizeof *sctx); |
177 | 175 | ||
178 | return 0; | 176 | return 0; |
179 | } | 177 | } |
@@ -186,6 +184,7 @@ static int nx_xcbc_update(struct shash_desc *desc, | |||
186 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); | 184 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); |
187 | struct nx_csbcpb *csbcpb = nx_ctx->csbcpb; | 185 | struct nx_csbcpb *csbcpb = nx_ctx->csbcpb; |
188 | struct nx_sg *in_sg; | 186 | struct nx_sg *in_sg; |
187 | struct nx_sg *out_sg; | ||
189 | u32 to_process = 0, leftover, total; | 188 | u32 to_process = 0, leftover, total; |
190 | unsigned int max_sg_len; | 189 | unsigned int max_sg_len; |
191 | unsigned long irq_flags; | 190 | unsigned long irq_flags; |
@@ -213,6 +212,17 @@ static int nx_xcbc_update(struct shash_desc *desc, | |||
213 | max_sg_len = min_t(u64, max_sg_len, | 212 | max_sg_len = min_t(u64, max_sg_len, |
214 | nx_ctx->ap->databytelen/NX_PAGE_SIZE); | 213 | nx_ctx->ap->databytelen/NX_PAGE_SIZE); |
215 | 214 | ||
215 | data_len = AES_BLOCK_SIZE; | ||
216 | out_sg = nx_build_sg_list(nx_ctx->out_sg, (u8 *)sctx->state, | ||
217 | &len, nx_ctx->ap->sglen); | ||
218 | |||
219 | if (data_len != AES_BLOCK_SIZE) { | ||
220 | rc = -EINVAL; | ||
221 | goto out; | ||
222 | } | ||
223 | |||
224 | nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg); | ||
225 | |||
216 | do { | 226 | do { |
217 | to_process = total - to_process; | 227 | to_process = total - to_process; |
218 | to_process = to_process & ~(AES_BLOCK_SIZE - 1); | 228 | to_process = to_process & ~(AES_BLOCK_SIZE - 1); |
@@ -235,8 +245,10 @@ static int nx_xcbc_update(struct shash_desc *desc, | |||
235 | (u8 *) sctx->buffer, | 245 | (u8 *) sctx->buffer, |
236 | &data_len, | 246 | &data_len, |
237 | max_sg_len); | 247 | max_sg_len); |
238 | if (data_len != sctx->count) | 248 | if (data_len != sctx->count) { |
239 | return -EINVAL; | 249 | rc = -EINVAL; |
250 | goto out; | ||
251 | } | ||
240 | } | 252 | } |
241 | 253 | ||
242 | data_len = to_process - sctx->count; | 254 | data_len = to_process - sctx->count; |
@@ -245,8 +257,10 @@ static int nx_xcbc_update(struct shash_desc *desc, | |||
245 | &data_len, | 257 | &data_len, |
246 | max_sg_len); | 258 | max_sg_len); |
247 | 259 | ||
248 | if (data_len != to_process - sctx->count) | 260 | if (data_len != to_process - sctx->count) { |
249 | return -EINVAL; | 261 | rc = -EINVAL; |
262 | goto out; | ||
263 | } | ||
250 | 264 | ||
251 | nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * | 265 | nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * |
252 | sizeof(struct nx_sg); | 266 | sizeof(struct nx_sg); |
@@ -325,15 +339,19 @@ static int nx_xcbc_final(struct shash_desc *desc, u8 *out) | |||
325 | in_sg = nx_build_sg_list(nx_ctx->in_sg, (u8 *)sctx->buffer, | 339 | in_sg = nx_build_sg_list(nx_ctx->in_sg, (u8 *)sctx->buffer, |
326 | &len, nx_ctx->ap->sglen); | 340 | &len, nx_ctx->ap->sglen); |
327 | 341 | ||
328 | if (len != sctx->count) | 342 | if (len != sctx->count) { |
329 | return -EINVAL; | 343 | rc = -EINVAL; |
344 | goto out; | ||
345 | } | ||
330 | 346 | ||
331 | len = AES_BLOCK_SIZE; | 347 | len = AES_BLOCK_SIZE; |
332 | out_sg = nx_build_sg_list(nx_ctx->out_sg, out, &len, | 348 | out_sg = nx_build_sg_list(nx_ctx->out_sg, out, &len, |
333 | nx_ctx->ap->sglen); | 349 | nx_ctx->ap->sglen); |
334 | 350 | ||
335 | if (len != AES_BLOCK_SIZE) | 351 | if (len != AES_BLOCK_SIZE) { |
336 | return -EINVAL; | 352 | rc = -EINVAL; |
353 | goto out; | ||
354 | } | ||
337 | 355 | ||
338 | nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * sizeof(struct nx_sg); | 356 | nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * sizeof(struct nx_sg); |
339 | nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg); | 357 | nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg); |
@@ -372,7 +390,7 @@ struct shash_alg nx_shash_aes_xcbc_alg = { | |||
372 | .cra_blocksize = AES_BLOCK_SIZE, | 390 | .cra_blocksize = AES_BLOCK_SIZE, |
373 | .cra_module = THIS_MODULE, | 391 | .cra_module = THIS_MODULE, |
374 | .cra_ctxsize = sizeof(struct nx_crypto_ctx), | 392 | .cra_ctxsize = sizeof(struct nx_crypto_ctx), |
375 | .cra_init = nx_crypto_ctx_aes_xcbc_init, | 393 | .cra_init = nx_crypto_ctx_aes_xcbc_init2, |
376 | .cra_exit = nx_crypto_ctx_exit, | 394 | .cra_exit = nx_crypto_ctx_exit, |
377 | } | 395 | } |
378 | }; | 396 | }; |
diff --git a/drivers/crypto/nx/nx-sha256.c b/drivers/crypto/nx/nx-sha256.c index 4e91bdb83c59..08f8d5cd6334 100644 --- a/drivers/crypto/nx/nx-sha256.c +++ b/drivers/crypto/nx/nx-sha256.c | |||
@@ -29,34 +29,28 @@ | |||
29 | #include "nx.h" | 29 | #include "nx.h" |
30 | 30 | ||
31 | 31 | ||
32 | static int nx_sha256_init(struct shash_desc *desc) | 32 | static int nx_crypto_ctx_sha256_init(struct crypto_tfm *tfm) |
33 | { | 33 | { |
34 | struct sha256_state *sctx = shash_desc_ctx(desc); | 34 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(tfm); |
35 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); | 35 | int err; |
36 | struct nx_sg *out_sg; | ||
37 | int len; | ||
38 | u32 max_sg_len; | ||
39 | 36 | ||
40 | nx_ctx_init(nx_ctx, HCOP_FC_SHA); | 37 | err = nx_crypto_ctx_sha_init(tfm); |
38 | if (err) | ||
39 | return err; | ||
41 | 40 | ||
42 | memset(sctx, 0, sizeof *sctx); | 41 | nx_ctx_init(nx_ctx, HCOP_FC_SHA); |
43 | 42 | ||
44 | nx_ctx->ap = &nx_ctx->props[NX_PROPS_SHA256]; | 43 | nx_ctx->ap = &nx_ctx->props[NX_PROPS_SHA256]; |
45 | 44 | ||
46 | NX_CPB_SET_DIGEST_SIZE(nx_ctx->csbcpb, NX_DS_SHA256); | 45 | NX_CPB_SET_DIGEST_SIZE(nx_ctx->csbcpb, NX_DS_SHA256); |
47 | 46 | ||
48 | max_sg_len = min_t(u64, nx_ctx->ap->sglen, | 47 | return 0; |
49 | nx_driver.of.max_sg_len/sizeof(struct nx_sg)); | 48 | } |
50 | max_sg_len = min_t(u64, max_sg_len, | ||
51 | nx_ctx->ap->databytelen/NX_PAGE_SIZE); | ||
52 | 49 | ||
53 | len = SHA256_DIGEST_SIZE; | 50 | static int nx_sha256_init(struct shash_desc *desc) { |
54 | out_sg = nx_build_sg_list(nx_ctx->out_sg, (u8 *)sctx->state, | 51 | struct sha256_state *sctx = shash_desc_ctx(desc); |
55 | &len, max_sg_len); | ||
56 | nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg); | ||
57 | 52 | ||
58 | if (len != SHA256_DIGEST_SIZE) | 53 | memset(sctx, 0, sizeof *sctx); |
59 | return -EINVAL; | ||
60 | 54 | ||
61 | sctx->state[0] = __cpu_to_be32(SHA256_H0); | 55 | sctx->state[0] = __cpu_to_be32(SHA256_H0); |
62 | sctx->state[1] = __cpu_to_be32(SHA256_H1); | 56 | sctx->state[1] = __cpu_to_be32(SHA256_H1); |
@@ -78,6 +72,7 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data, | |||
78 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); | 72 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); |
79 | struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb; | 73 | struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb; |
80 | struct nx_sg *in_sg; | 74 | struct nx_sg *in_sg; |
75 | struct nx_sg *out_sg; | ||
81 | u64 to_process = 0, leftover, total; | 76 | u64 to_process = 0, leftover, total; |
82 | unsigned long irq_flags; | 77 | unsigned long irq_flags; |
83 | int rc = 0; | 78 | int rc = 0; |
@@ -108,6 +103,16 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data, | |||
108 | max_sg_len = min_t(u64, max_sg_len, | 103 | max_sg_len = min_t(u64, max_sg_len, |
109 | nx_ctx->ap->databytelen/NX_PAGE_SIZE); | 104 | nx_ctx->ap->databytelen/NX_PAGE_SIZE); |
110 | 105 | ||
106 | data_len = SHA256_DIGEST_SIZE; | ||
107 | out_sg = nx_build_sg_list(nx_ctx->out_sg, (u8 *)sctx->state, | ||
108 | &data_len, max_sg_len); | ||
109 | nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg); | ||
110 | |||
111 | if (data_len != SHA256_DIGEST_SIZE) { | ||
112 | rc = -EINVAL; | ||
113 | goto out; | ||
114 | } | ||
115 | |||
111 | do { | 116 | do { |
112 | /* | 117 | /* |
113 | * to_process: the SHA256_BLOCK_SIZE data chunk to process in | 118 | * to_process: the SHA256_BLOCK_SIZE data chunk to process in |
@@ -282,7 +287,7 @@ struct shash_alg nx_shash_sha256_alg = { | |||
282 | .cra_blocksize = SHA256_BLOCK_SIZE, | 287 | .cra_blocksize = SHA256_BLOCK_SIZE, |
283 | .cra_module = THIS_MODULE, | 288 | .cra_module = THIS_MODULE, |
284 | .cra_ctxsize = sizeof(struct nx_crypto_ctx), | 289 | .cra_ctxsize = sizeof(struct nx_crypto_ctx), |
285 | .cra_init = nx_crypto_ctx_sha_init, | 290 | .cra_init = nx_crypto_ctx_sha256_init, |
286 | .cra_exit = nx_crypto_ctx_exit, | 291 | .cra_exit = nx_crypto_ctx_exit, |
287 | } | 292 | } |
288 | }; | 293 | }; |
diff --git a/drivers/crypto/nx/nx-sha512.c b/drivers/crypto/nx/nx-sha512.c index e6a58d2ee628..aff0fe58eac0 100644 --- a/drivers/crypto/nx/nx-sha512.c +++ b/drivers/crypto/nx/nx-sha512.c | |||
@@ -28,34 +28,29 @@ | |||
28 | #include "nx.h" | 28 | #include "nx.h" |
29 | 29 | ||
30 | 30 | ||
31 | static int nx_sha512_init(struct shash_desc *desc) | 31 | static int nx_crypto_ctx_sha512_init(struct crypto_tfm *tfm) |
32 | { | 32 | { |
33 | struct sha512_state *sctx = shash_desc_ctx(desc); | 33 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(tfm); |
34 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); | 34 | int err; |
35 | struct nx_sg *out_sg; | ||
36 | int len; | ||
37 | u32 max_sg_len; | ||
38 | 35 | ||
39 | nx_ctx_init(nx_ctx, HCOP_FC_SHA); | 36 | err = nx_crypto_ctx_sha_init(tfm); |
37 | if (err) | ||
38 | return err; | ||
40 | 39 | ||
41 | memset(sctx, 0, sizeof *sctx); | 40 | nx_ctx_init(nx_ctx, HCOP_FC_SHA); |
42 | 41 | ||
43 | nx_ctx->ap = &nx_ctx->props[NX_PROPS_SHA512]; | 42 | nx_ctx->ap = &nx_ctx->props[NX_PROPS_SHA512]; |
44 | 43 | ||
45 | NX_CPB_SET_DIGEST_SIZE(nx_ctx->csbcpb, NX_DS_SHA512); | 44 | NX_CPB_SET_DIGEST_SIZE(nx_ctx->csbcpb, NX_DS_SHA512); |
46 | 45 | ||
47 | max_sg_len = min_t(u64, nx_ctx->ap->sglen, | 46 | return 0; |
48 | nx_driver.of.max_sg_len/sizeof(struct nx_sg)); | 47 | } |
49 | max_sg_len = min_t(u64, max_sg_len, | ||
50 | nx_ctx->ap->databytelen/NX_PAGE_SIZE); | ||
51 | 48 | ||
52 | len = SHA512_DIGEST_SIZE; | 49 | static int nx_sha512_init(struct shash_desc *desc) |
53 | out_sg = nx_build_sg_list(nx_ctx->out_sg, (u8 *)sctx->state, | 50 | { |
54 | &len, max_sg_len); | 51 | struct sha512_state *sctx = shash_desc_ctx(desc); |
55 | nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg); | ||
56 | 52 | ||
57 | if (len != SHA512_DIGEST_SIZE) | 53 | memset(sctx, 0, sizeof *sctx); |
58 | return -EINVAL; | ||
59 | 54 | ||
60 | sctx->state[0] = __cpu_to_be64(SHA512_H0); | 55 | sctx->state[0] = __cpu_to_be64(SHA512_H0); |
61 | sctx->state[1] = __cpu_to_be64(SHA512_H1); | 56 | sctx->state[1] = __cpu_to_be64(SHA512_H1); |
@@ -77,6 +72,7 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data, | |||
77 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); | 72 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); |
78 | struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb; | 73 | struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb; |
79 | struct nx_sg *in_sg; | 74 | struct nx_sg *in_sg; |
75 | struct nx_sg *out_sg; | ||
80 | u64 to_process, leftover = 0, total; | 76 | u64 to_process, leftover = 0, total; |
81 | unsigned long irq_flags; | 77 | unsigned long irq_flags; |
82 | int rc = 0; | 78 | int rc = 0; |
@@ -107,6 +103,16 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data, | |||
107 | max_sg_len = min_t(u64, max_sg_len, | 103 | max_sg_len = min_t(u64, max_sg_len, |
108 | nx_ctx->ap->databytelen/NX_PAGE_SIZE); | 104 | nx_ctx->ap->databytelen/NX_PAGE_SIZE); |
109 | 105 | ||
106 | data_len = SHA512_DIGEST_SIZE; | ||
107 | out_sg = nx_build_sg_list(nx_ctx->out_sg, (u8 *)sctx->state, | ||
108 | &data_len, max_sg_len); | ||
109 | nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg); | ||
110 | |||
111 | if (data_len != SHA512_DIGEST_SIZE) { | ||
112 | rc = -EINVAL; | ||
113 | goto out; | ||
114 | } | ||
115 | |||
110 | do { | 116 | do { |
111 | /* | 117 | /* |
112 | * to_process: the SHA512_BLOCK_SIZE data chunk to process in | 118 | * to_process: the SHA512_BLOCK_SIZE data chunk to process in |
@@ -288,7 +294,7 @@ struct shash_alg nx_shash_sha512_alg = { | |||
288 | .cra_blocksize = SHA512_BLOCK_SIZE, | 294 | .cra_blocksize = SHA512_BLOCK_SIZE, |
289 | .cra_module = THIS_MODULE, | 295 | .cra_module = THIS_MODULE, |
290 | .cra_ctxsize = sizeof(struct nx_crypto_ctx), | 296 | .cra_ctxsize = sizeof(struct nx_crypto_ctx), |
291 | .cra_init = nx_crypto_ctx_sha_init, | 297 | .cra_init = nx_crypto_ctx_sha512_init, |
292 | .cra_exit = nx_crypto_ctx_exit, | 298 | .cra_exit = nx_crypto_ctx_exit, |
293 | } | 299 | } |
294 | }; | 300 | }; |
diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c index f6198f29a4a8..436971343ff7 100644 --- a/drivers/crypto/nx/nx.c +++ b/drivers/crypto/nx/nx.c | |||
@@ -713,12 +713,15 @@ static int nx_crypto_ctx_init(struct nx_crypto_ctx *nx_ctx, u32 fc, u32 mode) | |||
713 | /* entry points from the crypto tfm initializers */ | 713 | /* entry points from the crypto tfm initializers */ |
714 | int nx_crypto_ctx_aes_ccm_init(struct crypto_tfm *tfm) | 714 | int nx_crypto_ctx_aes_ccm_init(struct crypto_tfm *tfm) |
715 | { | 715 | { |
716 | crypto_aead_set_reqsize(__crypto_aead_cast(tfm), | ||
717 | sizeof(struct nx_ccm_rctx)); | ||
716 | return nx_crypto_ctx_init(crypto_tfm_ctx(tfm), NX_FC_AES, | 718 | return nx_crypto_ctx_init(crypto_tfm_ctx(tfm), NX_FC_AES, |
717 | NX_MODE_AES_CCM); | 719 | NX_MODE_AES_CCM); |
718 | } | 720 | } |
719 | 721 | ||
720 | int nx_crypto_ctx_aes_gcm_init(struct crypto_aead *tfm) | 722 | int nx_crypto_ctx_aes_gcm_init(struct crypto_aead *tfm) |
721 | { | 723 | { |
724 | crypto_aead_set_reqsize(tfm, sizeof(struct nx_gcm_rctx)); | ||
722 | return nx_crypto_ctx_init(crypto_aead_ctx(tfm), NX_FC_AES, | 725 | return nx_crypto_ctx_init(crypto_aead_ctx(tfm), NX_FC_AES, |
723 | NX_MODE_AES_GCM); | 726 | NX_MODE_AES_GCM); |
724 | } | 727 | } |
diff --git a/drivers/crypto/nx/nx.h b/drivers/crypto/nx/nx.h index de3ea8738146..cdff03a42ae7 100644 --- a/drivers/crypto/nx/nx.h +++ b/drivers/crypto/nx/nx.h | |||
@@ -2,6 +2,8 @@ | |||
2 | #ifndef __NX_H__ | 2 | #ifndef __NX_H__ |
3 | #define __NX_H__ | 3 | #define __NX_H__ |
4 | 4 | ||
5 | #include <crypto/ctr.h> | ||
6 | |||
5 | #define NX_NAME "nx-crypto" | 7 | #define NX_NAME "nx-crypto" |
6 | #define NX_STRING "IBM Power7+ Nest Accelerator Crypto Driver" | 8 | #define NX_STRING "IBM Power7+ Nest Accelerator Crypto Driver" |
7 | #define NX_VERSION "1.0" | 9 | #define NX_VERSION "1.0" |
@@ -91,8 +93,11 @@ struct nx_crypto_driver { | |||
91 | 93 | ||
92 | #define NX_GCM4106_NONCE_LEN (4) | 94 | #define NX_GCM4106_NONCE_LEN (4) |
93 | #define NX_GCM_CTR_OFFSET (12) | 95 | #define NX_GCM_CTR_OFFSET (12) |
94 | struct nx_gcm_priv { | 96 | struct nx_gcm_rctx { |
95 | u8 iv[16]; | 97 | u8 iv[16]; |
98 | }; | ||
99 | |||
100 | struct nx_gcm_priv { | ||
96 | u8 iauth_tag[16]; | 101 | u8 iauth_tag[16]; |
97 | u8 nonce[NX_GCM4106_NONCE_LEN]; | 102 | u8 nonce[NX_GCM4106_NONCE_LEN]; |
98 | }; | 103 | }; |
@@ -100,8 +105,11 @@ struct nx_gcm_priv { | |||
100 | #define NX_CCM_AES_KEY_LEN (16) | 105 | #define NX_CCM_AES_KEY_LEN (16) |
101 | #define NX_CCM4309_AES_KEY_LEN (19) | 106 | #define NX_CCM4309_AES_KEY_LEN (19) |
102 | #define NX_CCM4309_NONCE_LEN (3) | 107 | #define NX_CCM4309_NONCE_LEN (3) |
103 | struct nx_ccm_priv { | 108 | struct nx_ccm_rctx { |
104 | u8 iv[16]; | 109 | u8 iv[16]; |
110 | }; | ||
111 | |||
112 | struct nx_ccm_priv { | ||
105 | u8 b0[16]; | 113 | u8 b0[16]; |
106 | u8 iauth_tag[16]; | 114 | u8 iauth_tag[16]; |
107 | u8 oauth_tag[16]; | 115 | u8 oauth_tag[16]; |
@@ -113,7 +121,7 @@ struct nx_xcbc_priv { | |||
113 | }; | 121 | }; |
114 | 122 | ||
115 | struct nx_ctr_priv { | 123 | struct nx_ctr_priv { |
116 | u8 iv[16]; | 124 | u8 nonce[CTR_RFC3686_NONCE_SIZE]; |
117 | }; | 125 | }; |
118 | 126 | ||
119 | struct nx_crypto_ctx { | 127 | struct nx_crypto_ctx { |
diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c index 46307098f8ba..0a70e46d5416 100644 --- a/drivers/crypto/omap-des.c +++ b/drivers/crypto/omap-des.c | |||
@@ -536,9 +536,6 @@ static int omap_des_crypt_dma_stop(struct omap_des_dev *dd) | |||
536 | dmaengine_terminate_all(dd->dma_lch_in); | 536 | dmaengine_terminate_all(dd->dma_lch_in); |
537 | dmaengine_terminate_all(dd->dma_lch_out); | 537 | dmaengine_terminate_all(dd->dma_lch_out); |
538 | 538 | ||
539 | dma_unmap_sg(dd->dev, dd->in_sg, dd->in_sg_len, DMA_TO_DEVICE); | ||
540 | dma_unmap_sg(dd->dev, dd->out_sg, dd->out_sg_len, DMA_FROM_DEVICE); | ||
541 | |||
542 | return err; | 539 | return err; |
543 | } | 540 | } |
544 | 541 | ||
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c index 1022c2e1a2b0..cf1c87fa1edd 100644 --- a/drivers/dma/dw/core.c +++ b/drivers/dma/dw/core.c | |||
@@ -1746,4 +1746,4 @@ EXPORT_SYMBOL_GPL(dw_dma_enable); | |||
1746 | MODULE_LICENSE("GPL v2"); | 1746 | MODULE_LICENSE("GPL v2"); |
1747 | MODULE_DESCRIPTION("Synopsys DesignWare DMA Controller core driver"); | 1747 | MODULE_DESCRIPTION("Synopsys DesignWare DMA Controller core driver"); |
1748 | MODULE_AUTHOR("Haavard Skinnemoen (Atmel)"); | 1748 | MODULE_AUTHOR("Haavard Skinnemoen (Atmel)"); |
1749 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); | 1749 | MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>"); |
diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c index 4fd9961d552e..d42537425438 100644 --- a/drivers/firmware/efi/cper.c +++ b/drivers/firmware/efi/cper.c | |||
@@ -305,10 +305,17 @@ const char *cper_mem_err_unpack(struct trace_seq *p, | |||
305 | return ret; | 305 | return ret; |
306 | } | 306 | } |
307 | 307 | ||
308 | static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem) | 308 | static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem, |
309 | int len) | ||
309 | { | 310 | { |
310 | struct cper_mem_err_compact cmem; | 311 | struct cper_mem_err_compact cmem; |
311 | 312 | ||
313 | /* Don't trust UEFI 2.1/2.2 structure with bad validation bits */ | ||
314 | if (len == sizeof(struct cper_sec_mem_err_old) && | ||
315 | (mem->validation_bits & ~(CPER_MEM_VALID_RANK_NUMBER - 1))) { | ||
316 | pr_err(FW_WARN "valid bits set for fields beyond structure\n"); | ||
317 | return; | ||
318 | } | ||
312 | if (mem->validation_bits & CPER_MEM_VALID_ERROR_STATUS) | 319 | if (mem->validation_bits & CPER_MEM_VALID_ERROR_STATUS) |
313 | printk("%s""error_status: 0x%016llx\n", pfx, mem->error_status); | 320 | printk("%s""error_status: 0x%016llx\n", pfx, mem->error_status); |
314 | if (mem->validation_bits & CPER_MEM_VALID_PA) | 321 | if (mem->validation_bits & CPER_MEM_VALID_PA) |
@@ -405,8 +412,10 @@ static void cper_estatus_print_section( | |||
405 | } else if (!uuid_le_cmp(*sec_type, CPER_SEC_PLATFORM_MEM)) { | 412 | } else if (!uuid_le_cmp(*sec_type, CPER_SEC_PLATFORM_MEM)) { |
406 | struct cper_sec_mem_err *mem_err = (void *)(gdata + 1); | 413 | struct cper_sec_mem_err *mem_err = (void *)(gdata + 1); |
407 | printk("%s""section_type: memory error\n", newpfx); | 414 | printk("%s""section_type: memory error\n", newpfx); |
408 | if (gdata->error_data_length >= sizeof(*mem_err)) | 415 | if (gdata->error_data_length >= |
409 | cper_print_mem(newpfx, mem_err); | 416 | sizeof(struct cper_sec_mem_err_old)) |
417 | cper_print_mem(newpfx, mem_err, | ||
418 | gdata->error_data_length); | ||
410 | else | 419 | else |
411 | goto err_section_too_small; | 420 | goto err_section_too_small; |
412 | } else if (!uuid_le_cmp(*sec_type, CPER_SEC_PCIE)) { | 421 | } else if (!uuid_le_cmp(*sec_type, CPER_SEC_PCIE)) { |
diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c index 7a3cb1fa0a76..4630a8133ea6 100644 --- a/drivers/gpio/gpio-brcmstb.c +++ b/drivers/gpio/gpio-brcmstb.c | |||
@@ -87,6 +87,15 @@ static int brcmstb_gpio_remove(struct platform_device *pdev) | |||
87 | struct brcmstb_gpio_bank *bank; | 87 | struct brcmstb_gpio_bank *bank; |
88 | int ret = 0; | 88 | int ret = 0; |
89 | 89 | ||
90 | if (!priv) { | ||
91 | dev_err(&pdev->dev, "called %s without drvdata!\n", __func__); | ||
92 | return -EFAULT; | ||
93 | } | ||
94 | |||
95 | /* | ||
96 | * You can lose return values below, but we report all errors, and it's | ||
97 | * more important to actually perform all of the steps. | ||
98 | */ | ||
90 | list_for_each(pos, &priv->bank_list) { | 99 | list_for_each(pos, &priv->bank_list) { |
91 | bank = list_entry(pos, struct brcmstb_gpio_bank, node); | 100 | bank = list_entry(pos, struct brcmstb_gpio_bank, node); |
92 | ret = bgpio_remove(&bank->bgc); | 101 | ret = bgpio_remove(&bank->bgc); |
@@ -143,6 +152,8 @@ static int brcmstb_gpio_probe(struct platform_device *pdev) | |||
143 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); | 152 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); |
144 | if (!priv) | 153 | if (!priv) |
145 | return -ENOMEM; | 154 | return -ENOMEM; |
155 | platform_set_drvdata(pdev, priv); | ||
156 | INIT_LIST_HEAD(&priv->bank_list); | ||
146 | 157 | ||
147 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 158 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
148 | reg_base = devm_ioremap_resource(dev, res); | 159 | reg_base = devm_ioremap_resource(dev, res); |
@@ -153,7 +164,6 @@ static int brcmstb_gpio_probe(struct platform_device *pdev) | |||
153 | priv->reg_base = reg_base; | 164 | priv->reg_base = reg_base; |
154 | priv->pdev = pdev; | 165 | priv->pdev = pdev; |
155 | 166 | ||
156 | INIT_LIST_HEAD(&priv->bank_list); | ||
157 | if (brcmstb_gpio_sanity_check_banks(dev, np, res)) | 167 | if (brcmstb_gpio_sanity_check_banks(dev, np, res)) |
158 | return -EINVAL; | 168 | return -EINVAL; |
159 | 169 | ||
@@ -221,8 +231,6 @@ static int brcmstb_gpio_probe(struct platform_device *pdev) | |||
221 | dev_info(dev, "Registered %d banks (GPIO(s): %d-%d)\n", | 231 | dev_info(dev, "Registered %d banks (GPIO(s): %d-%d)\n", |
222 | priv->num_banks, priv->gpio_base, gpio_base - 1); | 232 | priv->num_banks, priv->gpio_base, gpio_base - 1); |
223 | 233 | ||
224 | platform_set_drvdata(pdev, priv); | ||
225 | |||
226 | return 0; | 234 | return 0; |
227 | 235 | ||
228 | fail: | 236 | fail: |
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c index c5e05c82d67c..c246ac3dda7c 100644 --- a/drivers/gpio/gpio-davinci.c +++ b/drivers/gpio/gpio-davinci.c | |||
@@ -578,15 +578,13 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) | |||
578 | writel_relaxed(~0, &g->clr_falling); | 578 | writel_relaxed(~0, &g->clr_falling); |
579 | writel_relaxed(~0, &g->clr_rising); | 579 | writel_relaxed(~0, &g->clr_rising); |
580 | 580 | ||
581 | /* set up all irqs in this bank */ | ||
582 | irq_set_chained_handler(bank_irq, gpio_irq_handler); | ||
583 | |||
584 | /* | 581 | /* |
585 | * Each chip handles 32 gpios, and each irq bank consists of 16 | 582 | * Each chip handles 32 gpios, and each irq bank consists of 16 |
586 | * gpio irqs. Pass the irq bank's corresponding controller to | 583 | * gpio irqs. Pass the irq bank's corresponding controller to |
587 | * the chained irq handler. | 584 | * the chained irq handler. |
588 | */ | 585 | */ |
589 | irq_set_handler_data(bank_irq, &chips[gpio / 32]); | 586 | irq_set_chained_handler_and_data(bank_irq, gpio_irq_handler, |
587 | &chips[gpio / 32]); | ||
590 | 588 | ||
591 | binten |= BIT(bank); | 589 | binten |= BIT(bank); |
592 | } | 590 | } |
diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c index aed4ca9338bc..7d3c90e9da71 100644 --- a/drivers/gpio/gpio-max732x.c +++ b/drivers/gpio/gpio-max732x.c | |||
@@ -603,6 +603,7 @@ static int max732x_setup_gpio(struct max732x_chip *chip, | |||
603 | gc->base = gpio_start; | 603 | gc->base = gpio_start; |
604 | gc->ngpio = port; | 604 | gc->ngpio = port; |
605 | gc->label = chip->client->name; | 605 | gc->label = chip->client->name; |
606 | gc->dev = &chip->client->dev; | ||
606 | gc->owner = THIS_MODULE; | 607 | gc->owner = THIS_MODULE; |
607 | 608 | ||
608 | return port; | 609 | return port; |
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index b0c57d505be7..61a731ff9a07 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -500,8 +500,10 @@ static int omap_gpio_irq_type(struct irq_data *d, unsigned type) | |||
500 | 500 | ||
501 | spin_lock_irqsave(&bank->lock, flags); | 501 | spin_lock_irqsave(&bank->lock, flags); |
502 | retval = omap_set_gpio_triggering(bank, offset, type); | 502 | retval = omap_set_gpio_triggering(bank, offset, type); |
503 | if (retval) | 503 | if (retval) { |
504 | spin_unlock_irqrestore(&bank->lock, flags); | ||
504 | goto error; | 505 | goto error; |
506 | } | ||
505 | omap_gpio_init_irq(bank, offset); | 507 | omap_gpio_init_irq(bank, offset); |
506 | if (!omap_gpio_is_input(bank, offset)) { | 508 | if (!omap_gpio_is_input(bank, offset)) { |
507 | spin_unlock_irqrestore(&bank->lock, flags); | 509 | spin_unlock_irqrestore(&bank->lock, flags); |
@@ -1185,6 +1187,7 @@ static int omap_gpio_probe(struct platform_device *pdev) | |||
1185 | bank->irq = res->start; | 1187 | bank->irq = res->start; |
1186 | bank->dev = dev; | 1188 | bank->dev = dev; |
1187 | bank->chip.dev = dev; | 1189 | bank->chip.dev = dev; |
1190 | bank->chip.owner = THIS_MODULE; | ||
1188 | bank->dbck_flag = pdata->dbck_flag; | 1191 | bank->dbck_flag = pdata->dbck_flag; |
1189 | bank->stride = pdata->bank_stride; | 1192 | bank->stride = pdata->bank_stride; |
1190 | bank->width = pdata->bank_width; | 1193 | bank->width = pdata->bank_width; |
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index d233eb3b8132..50caeb1ee350 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c | |||
@@ -570,6 +570,10 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, | |||
570 | "could not connect irqchip to gpiochip\n"); | 570 | "could not connect irqchip to gpiochip\n"); |
571 | return ret; | 571 | return ret; |
572 | } | 572 | } |
573 | |||
574 | gpiochip_set_chained_irqchip(&chip->gpio_chip, | ||
575 | &pca953x_irq_chip, | ||
576 | client->irq, NULL); | ||
573 | } | 577 | } |
574 | 578 | ||
575 | return 0; | 579 | return 0; |
diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c index 77fe5d3cb105..d5284dfe01fe 100644 --- a/drivers/gpio/gpio-xilinx.c +++ b/drivers/gpio/gpio-xilinx.c | |||
@@ -220,9 +220,9 @@ static void xgpio_save_regs(struct of_mm_gpio_chip *mm_gc) | |||
220 | if (!chip->gpio_width[1]) | 220 | if (!chip->gpio_width[1]) |
221 | return; | 221 | return; |
222 | 222 | ||
223 | xgpio_writereg(mm_gc->regs + XGPIO_DATA_OFFSET + XGPIO_TRI_OFFSET, | 223 | xgpio_writereg(mm_gc->regs + XGPIO_DATA_OFFSET + XGPIO_CHANNEL_OFFSET, |
224 | chip->gpio_state[1]); | 224 | chip->gpio_state[1]); |
225 | xgpio_writereg(mm_gc->regs + XGPIO_TRI_OFFSET + XGPIO_TRI_OFFSET, | 225 | xgpio_writereg(mm_gc->regs + XGPIO_TRI_OFFSET + XGPIO_CHANNEL_OFFSET, |
226 | chip->gpio_dir[1]); | 226 | chip->gpio_dir[1]); |
227 | } | 227 | } |
228 | 228 | ||
diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c index 2e87c4b8da26..a78882389836 100644 --- a/drivers/gpio/gpio-zynq.c +++ b/drivers/gpio/gpio-zynq.c | |||
@@ -757,6 +757,7 @@ static int zynq_gpio_remove(struct platform_device *pdev) | |||
757 | gpiochip_remove(&gpio->chip); | 757 | gpiochip_remove(&gpio->chip); |
758 | clk_disable_unprepare(gpio->clk); | 758 | clk_disable_unprepare(gpio->clk); |
759 | device_set_wakeup_capable(&pdev->dev, 0); | 759 | device_set_wakeup_capable(&pdev->dev, 0); |
760 | pm_runtime_disable(&pdev->dev); | ||
760 | return 0; | 761 | return 0; |
761 | } | 762 | } |
762 | 763 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 01657830b470..e9fde72cf038 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -1614,6 +1614,9 @@ struct amdgpu_uvd { | |||
1614 | #define AMDGPU_MAX_VCE_HANDLES 16 | 1614 | #define AMDGPU_MAX_VCE_HANDLES 16 |
1615 | #define AMDGPU_VCE_FIRMWARE_OFFSET 256 | 1615 | #define AMDGPU_VCE_FIRMWARE_OFFSET 256 |
1616 | 1616 | ||
1617 | #define AMDGPU_VCE_HARVEST_VCE0 (1 << 0) | ||
1618 | #define AMDGPU_VCE_HARVEST_VCE1 (1 << 1) | ||
1619 | |||
1617 | struct amdgpu_vce { | 1620 | struct amdgpu_vce { |
1618 | struct amdgpu_bo *vcpu_bo; | 1621 | struct amdgpu_bo *vcpu_bo; |
1619 | uint64_t gpu_addr; | 1622 | uint64_t gpu_addr; |
@@ -1626,6 +1629,7 @@ struct amdgpu_vce { | |||
1626 | const struct firmware *fw; /* VCE firmware */ | 1629 | const struct firmware *fw; /* VCE firmware */ |
1627 | struct amdgpu_ring ring[AMDGPU_MAX_VCE_RINGS]; | 1630 | struct amdgpu_ring ring[AMDGPU_MAX_VCE_RINGS]; |
1628 | struct amdgpu_irq_src irq; | 1631 | struct amdgpu_irq_src irq; |
1632 | unsigned harvest_config; | ||
1629 | }; | 1633 | }; |
1630 | 1634 | ||
1631 | /* | 1635 | /* |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index d63135bf29c0..1f040d85ac47 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |||
@@ -669,6 +669,7 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev, | |||
669 | static int amdgpu_cs_dependencies(struct amdgpu_device *adev, | 669 | static int amdgpu_cs_dependencies(struct amdgpu_device *adev, |
670 | struct amdgpu_cs_parser *p) | 670 | struct amdgpu_cs_parser *p) |
671 | { | 671 | { |
672 | struct amdgpu_fpriv *fpriv = p->filp->driver_priv; | ||
672 | struct amdgpu_ib *ib; | 673 | struct amdgpu_ib *ib; |
673 | int i, j, r; | 674 | int i, j, r; |
674 | 675 | ||
@@ -694,6 +695,7 @@ static int amdgpu_cs_dependencies(struct amdgpu_device *adev, | |||
694 | for (j = 0; j < num_deps; ++j) { | 695 | for (j = 0; j < num_deps; ++j) { |
695 | struct amdgpu_fence *fence; | 696 | struct amdgpu_fence *fence; |
696 | struct amdgpu_ring *ring; | 697 | struct amdgpu_ring *ring; |
698 | struct amdgpu_ctx *ctx; | ||
697 | 699 | ||
698 | r = amdgpu_cs_get_ring(adev, deps[j].ip_type, | 700 | r = amdgpu_cs_get_ring(adev, deps[j].ip_type, |
699 | deps[j].ip_instance, | 701 | deps[j].ip_instance, |
@@ -701,14 +703,21 @@ static int amdgpu_cs_dependencies(struct amdgpu_device *adev, | |||
701 | if (r) | 703 | if (r) |
702 | return r; | 704 | return r; |
703 | 705 | ||
706 | ctx = amdgpu_ctx_get(fpriv, deps[j].ctx_id); | ||
707 | if (ctx == NULL) | ||
708 | return -EINVAL; | ||
709 | |||
704 | r = amdgpu_fence_recreate(ring, p->filp, | 710 | r = amdgpu_fence_recreate(ring, p->filp, |
705 | deps[j].handle, | 711 | deps[j].handle, |
706 | &fence); | 712 | &fence); |
707 | if (r) | 713 | if (r) { |
714 | amdgpu_ctx_put(ctx); | ||
708 | return r; | 715 | return r; |
716 | } | ||
709 | 717 | ||
710 | amdgpu_sync_fence(&ib->sync, fence); | 718 | amdgpu_sync_fence(&ib->sync, fence); |
711 | amdgpu_fence_unref(&fence); | 719 | amdgpu_fence_unref(&fence); |
720 | amdgpu_ctx_put(ctx); | ||
712 | } | 721 | } |
713 | } | 722 | } |
714 | 723 | ||
@@ -808,12 +817,16 @@ int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data, | |||
808 | 817 | ||
809 | r = amdgpu_cs_get_ring(adev, wait->in.ip_type, wait->in.ip_instance, | 818 | r = amdgpu_cs_get_ring(adev, wait->in.ip_type, wait->in.ip_instance, |
810 | wait->in.ring, &ring); | 819 | wait->in.ring, &ring); |
811 | if (r) | 820 | if (r) { |
821 | amdgpu_ctx_put(ctx); | ||
812 | return r; | 822 | return r; |
823 | } | ||
813 | 824 | ||
814 | r = amdgpu_fence_recreate(ring, filp, wait->in.handle, &fence); | 825 | r = amdgpu_fence_recreate(ring, filp, wait->in.handle, &fence); |
815 | if (r) | 826 | if (r) { |
827 | amdgpu_ctx_put(ctx); | ||
816 | return r; | 828 | return r; |
829 | } | ||
817 | 830 | ||
818 | r = fence_wait_timeout(&fence->base, true, timeout); | 831 | r = fence_wait_timeout(&fence->base, true, timeout); |
819 | amdgpu_fence_unref(&fence); | 832 | amdgpu_fence_unref(&fence); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index ba46be361c9b..d79009b65867 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -1207,10 +1207,15 @@ static int amdgpu_early_init(struct amdgpu_device *adev) | |||
1207 | } else { | 1207 | } else { |
1208 | if (adev->ip_blocks[i].funcs->early_init) { | 1208 | if (adev->ip_blocks[i].funcs->early_init) { |
1209 | r = adev->ip_blocks[i].funcs->early_init((void *)adev); | 1209 | r = adev->ip_blocks[i].funcs->early_init((void *)adev); |
1210 | if (r) | 1210 | if (r == -ENOENT) |
1211 | adev->ip_block_enabled[i] = false; | ||
1212 | else if (r) | ||
1211 | return r; | 1213 | return r; |
1214 | else | ||
1215 | adev->ip_block_enabled[i] = true; | ||
1216 | } else { | ||
1217 | adev->ip_block_enabled[i] = true; | ||
1212 | } | 1218 | } |
1213 | adev->ip_block_enabled[i] = true; | ||
1214 | } | 1219 | } |
1215 | } | 1220 | } |
1216 | 1221 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index 975edb1000a2..ae43b58c9733 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | |||
@@ -352,7 +352,7 @@ unsigned long amdgpu_gem_timeout(uint64_t timeout_ns) | |||
352 | if (((int64_t)timeout_ns) < 0) | 352 | if (((int64_t)timeout_ns) < 0) |
353 | return MAX_SCHEDULE_TIMEOUT; | 353 | return MAX_SCHEDULE_TIMEOUT; |
354 | 354 | ||
355 | timeout = ktime_sub_ns(ktime_get(), timeout_ns); | 355 | timeout = ktime_sub(ns_to_ktime(timeout_ns), ktime_get()); |
356 | if (ktime_to_ns(timeout) < 0) | 356 | if (ktime_to_ns(timeout) < 0) |
357 | return 0; | 357 | return 0; |
358 | 358 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 5533434c7a8f..31ad444c6386 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | |||
@@ -459,6 +459,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file | |||
459 | memcpy(&dev_info.cu_bitmap[0], &cu_info.bitmap[0], sizeof(cu_info.bitmap)); | 459 | memcpy(&dev_info.cu_bitmap[0], &cu_info.bitmap[0], sizeof(cu_info.bitmap)); |
460 | dev_info.vram_type = adev->mc.vram_type; | 460 | dev_info.vram_type = adev->mc.vram_type; |
461 | dev_info.vram_bit_width = adev->mc.vram_width; | 461 | dev_info.vram_bit_width = adev->mc.vram_width; |
462 | dev_info.vce_harvest_config = adev->vce.harvest_config; | ||
462 | 463 | ||
463 | return copy_to_user(out, &dev_info, | 464 | return copy_to_user(out, &dev_info, |
464 | min((size_t)size, sizeof(dev_info))) ? -EFAULT : 0; | 465 | min((size_t)size, sizeof(dev_info))) ? -EFAULT : 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c index f75a31df30bd..ace870afc7d4 100644 --- a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c | |||
@@ -494,29 +494,67 @@ static void cz_dpm_fini(struct amdgpu_device *adev) | |||
494 | amdgpu_free_extended_power_table(adev); | 494 | amdgpu_free_extended_power_table(adev); |
495 | } | 495 | } |
496 | 496 | ||
497 | #define ixSMUSVI_NB_CURRENTVID 0xD8230044 | ||
498 | #define CURRENT_NB_VID_MASK 0xff000000 | ||
499 | #define CURRENT_NB_VID__SHIFT 24 | ||
500 | #define ixSMUSVI_GFX_CURRENTVID 0xD8230048 | ||
501 | #define CURRENT_GFX_VID_MASK 0xff000000 | ||
502 | #define CURRENT_GFX_VID__SHIFT 24 | ||
503 | |||
497 | static void | 504 | static void |
498 | cz_dpm_debugfs_print_current_performance_level(struct amdgpu_device *adev, | 505 | cz_dpm_debugfs_print_current_performance_level(struct amdgpu_device *adev, |
499 | struct seq_file *m) | 506 | struct seq_file *m) |
500 | { | 507 | { |
508 | struct cz_power_info *pi = cz_get_pi(adev); | ||
501 | struct amdgpu_clock_voltage_dependency_table *table = | 509 | struct amdgpu_clock_voltage_dependency_table *table = |
502 | &adev->pm.dpm.dyn_state.vddc_dependency_on_sclk; | 510 | &adev->pm.dpm.dyn_state.vddc_dependency_on_sclk; |
503 | u32 current_index = | 511 | struct amdgpu_uvd_clock_voltage_dependency_table *uvd_table = |
504 | (RREG32_SMC(ixTARGET_AND_CURRENT_PROFILE_INDEX) & | 512 | &adev->pm.dpm.dyn_state.uvd_clock_voltage_dependency_table; |
505 | TARGET_AND_CURRENT_PROFILE_INDEX__CURR_SCLK_INDEX_MASK) >> | 513 | struct amdgpu_vce_clock_voltage_dependency_table *vce_table = |
506 | TARGET_AND_CURRENT_PROFILE_INDEX__CURR_SCLK_INDEX__SHIFT; | 514 | &adev->pm.dpm.dyn_state.vce_clock_voltage_dependency_table; |
507 | u32 sclk, tmp; | 515 | u32 sclk_index = REG_GET_FIELD(RREG32_SMC(ixTARGET_AND_CURRENT_PROFILE_INDEX), |
508 | u16 vddc; | 516 | TARGET_AND_CURRENT_PROFILE_INDEX, CURR_SCLK_INDEX); |
509 | 517 | u32 uvd_index = REG_GET_FIELD(RREG32_SMC(ixTARGET_AND_CURRENT_PROFILE_INDEX_2), | |
510 | if (current_index >= NUM_SCLK_LEVELS) { | 518 | TARGET_AND_CURRENT_PROFILE_INDEX_2, CURR_UVD_INDEX); |
511 | seq_printf(m, "invalid dpm profile %d\n", current_index); | 519 | u32 vce_index = REG_GET_FIELD(RREG32_SMC(ixTARGET_AND_CURRENT_PROFILE_INDEX_2), |
520 | TARGET_AND_CURRENT_PROFILE_INDEX_2, CURR_VCE_INDEX); | ||
521 | u32 sclk, vclk, dclk, ecclk, tmp; | ||
522 | u16 vddnb, vddgfx; | ||
523 | |||
524 | if (sclk_index >= NUM_SCLK_LEVELS) { | ||
525 | seq_printf(m, "invalid sclk dpm profile %d\n", sclk_index); | ||
512 | } else { | 526 | } else { |
513 | sclk = table->entries[current_index].clk; | 527 | sclk = table->entries[sclk_index].clk; |
514 | tmp = (RREG32_SMC(ixSMU_VOLTAGE_STATUS) & | 528 | seq_printf(m, "%u sclk: %u\n", sclk_index, sclk); |
515 | SMU_VOLTAGE_STATUS__SMU_VOLTAGE_CURRENT_LEVEL_MASK) >> | 529 | } |
516 | SMU_VOLTAGE_STATUS__SMU_VOLTAGE_CURRENT_LEVEL__SHIFT; | 530 | |
517 | vddc = cz_convert_8bit_index_to_voltage(adev, (u16)tmp); | 531 | tmp = (RREG32_SMC(ixSMUSVI_NB_CURRENTVID) & |
518 | seq_printf(m, "power level %d sclk: %u vddc: %u\n", | 532 | CURRENT_NB_VID_MASK) >> CURRENT_NB_VID__SHIFT; |
519 | current_index, sclk, vddc); | 533 | vddnb = cz_convert_8bit_index_to_voltage(adev, (u16)tmp); |
534 | tmp = (RREG32_SMC(ixSMUSVI_GFX_CURRENTVID) & | ||
535 | CURRENT_GFX_VID_MASK) >> CURRENT_GFX_VID__SHIFT; | ||
536 | vddgfx = cz_convert_8bit_index_to_voltage(adev, (u16)tmp); | ||
537 | seq_printf(m, "vddnb: %u vddgfx: %u\n", vddnb, vddgfx); | ||
538 | |||
539 | seq_printf(m, "uvd %sabled\n", pi->uvd_power_gated ? "dis" : "en"); | ||
540 | if (!pi->uvd_power_gated) { | ||
541 | if (uvd_index >= CZ_MAX_HARDWARE_POWERLEVELS) { | ||
542 | seq_printf(m, "invalid uvd dpm level %d\n", uvd_index); | ||
543 | } else { | ||
544 | vclk = uvd_table->entries[uvd_index].vclk; | ||
545 | dclk = uvd_table->entries[uvd_index].dclk; | ||
546 | seq_printf(m, "%u uvd vclk: %u dclk: %u\n", uvd_index, vclk, dclk); | ||
547 | } | ||
548 | } | ||
549 | |||
550 | seq_printf(m, "vce %sabled\n", pi->vce_power_gated ? "dis" : "en"); | ||
551 | if (!pi->vce_power_gated) { | ||
552 | if (vce_index >= CZ_MAX_HARDWARE_POWERLEVELS) { | ||
553 | seq_printf(m, "invalid vce dpm level %d\n", vce_index); | ||
554 | } else { | ||
555 | ecclk = vce_table->entries[vce_index].ecclk; | ||
556 | seq_printf(m, "%u vce ecclk: %u\n", vce_index, ecclk); | ||
557 | } | ||
520 | } | 558 | } |
521 | } | 559 | } |
522 | 560 | ||
@@ -1679,25 +1717,31 @@ static int cz_dpm_unforce_dpm_levels(struct amdgpu_device *adev) | |||
1679 | if (ret) | 1717 | if (ret) |
1680 | return ret; | 1718 | return ret; |
1681 | 1719 | ||
1682 | DRM_INFO("DPM unforce state min=%d, max=%d.\n", | 1720 | DRM_DEBUG("DPM unforce state min=%d, max=%d.\n", |
1683 | pi->sclk_dpm.soft_min_clk, | 1721 | pi->sclk_dpm.soft_min_clk, |
1684 | pi->sclk_dpm.soft_max_clk); | 1722 | pi->sclk_dpm.soft_max_clk); |
1685 | 1723 | ||
1686 | return 0; | 1724 | return 0; |
1687 | } | 1725 | } |
1688 | 1726 | ||
1689 | static int cz_dpm_force_dpm_level(struct amdgpu_device *adev, | 1727 | static int cz_dpm_force_dpm_level(struct amdgpu_device *adev, |
1690 | enum amdgpu_dpm_forced_level level) | 1728 | enum amdgpu_dpm_forced_level level) |
1691 | { | 1729 | { |
1692 | int ret = 0; | 1730 | int ret = 0; |
1693 | 1731 | ||
1694 | switch (level) { | 1732 | switch (level) { |
1695 | case AMDGPU_DPM_FORCED_LEVEL_HIGH: | 1733 | case AMDGPU_DPM_FORCED_LEVEL_HIGH: |
1734 | ret = cz_dpm_unforce_dpm_levels(adev); | ||
1735 | if (ret) | ||
1736 | return ret; | ||
1696 | ret = cz_dpm_force_highest(adev); | 1737 | ret = cz_dpm_force_highest(adev); |
1697 | if (ret) | 1738 | if (ret) |
1698 | return ret; | 1739 | return ret; |
1699 | break; | 1740 | break; |
1700 | case AMDGPU_DPM_FORCED_LEVEL_LOW: | 1741 | case AMDGPU_DPM_FORCED_LEVEL_LOW: |
1742 | ret = cz_dpm_unforce_dpm_levels(adev); | ||
1743 | if (ret) | ||
1744 | return ret; | ||
1701 | ret = cz_dpm_force_lowest(adev); | 1745 | ret = cz_dpm_force_lowest(adev); |
1702 | if (ret) | 1746 | if (ret) |
1703 | return ret; | 1747 | return ret; |
@@ -1711,6 +1755,8 @@ static int cz_dpm_force_dpm_level(struct amdgpu_device *adev, | |||
1711 | break; | 1755 | break; |
1712 | } | 1756 | } |
1713 | 1757 | ||
1758 | adev->pm.dpm.forced_level = level; | ||
1759 | |||
1714 | return ret; | 1760 | return ret; |
1715 | } | 1761 | } |
1716 | 1762 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c index 5cde635978f9..e70a26f587a0 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | |||
@@ -2632,6 +2632,7 @@ static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2632 | struct drm_device *dev = crtc->dev; | 2632 | struct drm_device *dev = crtc->dev; |
2633 | struct amdgpu_device *adev = dev->dev_private; | 2633 | struct amdgpu_device *adev = dev->dev_private; |
2634 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 2634 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
2635 | unsigned type; | ||
2635 | 2636 | ||
2636 | switch (mode) { | 2637 | switch (mode) { |
2637 | case DRM_MODE_DPMS_ON: | 2638 | case DRM_MODE_DPMS_ON: |
@@ -2640,6 +2641,9 @@ static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2640 | dce_v10_0_vga_enable(crtc, true); | 2641 | dce_v10_0_vga_enable(crtc, true); |
2641 | amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); | 2642 | amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); |
2642 | dce_v10_0_vga_enable(crtc, false); | 2643 | dce_v10_0_vga_enable(crtc, false); |
2644 | /* Make sure VBLANK interrupt is still enabled */ | ||
2645 | type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id); | ||
2646 | amdgpu_irq_update(adev, &adev->crtc_irq, type); | ||
2643 | drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); | 2647 | drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); |
2644 | dce_v10_0_crtc_load_lut(crtc); | 2648 | dce_v10_0_crtc_load_lut(crtc); |
2645 | break; | 2649 | break; |
@@ -3403,19 +3407,25 @@ static int dce_v10_0_crtc_irq(struct amdgpu_device *adev, | |||
3403 | 3407 | ||
3404 | switch (entry->src_data) { | 3408 | switch (entry->src_data) { |
3405 | case 0: /* vblank */ | 3409 | case 0: /* vblank */ |
3406 | if (disp_int & interrupt_status_offsets[crtc].vblank) { | 3410 | if (disp_int & interrupt_status_offsets[crtc].vblank) |
3407 | dce_v10_0_crtc_vblank_int_ack(adev, crtc); | 3411 | dce_v10_0_crtc_vblank_int_ack(adev, crtc); |
3408 | if (amdgpu_irq_enabled(adev, source, irq_type)) { | 3412 | else |
3409 | drm_handle_vblank(adev->ddev, crtc); | 3413 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3410 | } | 3414 | |
3411 | DRM_DEBUG("IH: D%d vblank\n", crtc + 1); | 3415 | if (amdgpu_irq_enabled(adev, source, irq_type)) { |
3416 | drm_handle_vblank(adev->ddev, crtc); | ||
3412 | } | 3417 | } |
3418 | DRM_DEBUG("IH: D%d vblank\n", crtc + 1); | ||
3419 | |||
3413 | break; | 3420 | break; |
3414 | case 1: /* vline */ | 3421 | case 1: /* vline */ |
3415 | if (disp_int & interrupt_status_offsets[crtc].vline) { | 3422 | if (disp_int & interrupt_status_offsets[crtc].vline) |
3416 | dce_v10_0_crtc_vline_int_ack(adev, crtc); | 3423 | dce_v10_0_crtc_vline_int_ack(adev, crtc); |
3417 | DRM_DEBUG("IH: D%d vline\n", crtc + 1); | 3424 | else |
3418 | } | 3425 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3426 | |||
3427 | DRM_DEBUG("IH: D%d vline\n", crtc + 1); | ||
3428 | |||
3419 | break; | 3429 | break; |
3420 | default: | 3430 | default: |
3421 | DRM_DEBUG("Unhandled interrupt: %d %d\n", entry->src_id, entry->src_data); | 3431 | DRM_DEBUG("Unhandled interrupt: %d %d\n", entry->src_id, entry->src_data); |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c index 95efd98b202d..dcb402ee048a 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | |||
@@ -2631,6 +2631,7 @@ static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2631 | struct drm_device *dev = crtc->dev; | 2631 | struct drm_device *dev = crtc->dev; |
2632 | struct amdgpu_device *adev = dev->dev_private; | 2632 | struct amdgpu_device *adev = dev->dev_private; |
2633 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 2633 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
2634 | unsigned type; | ||
2634 | 2635 | ||
2635 | switch (mode) { | 2636 | switch (mode) { |
2636 | case DRM_MODE_DPMS_ON: | 2637 | case DRM_MODE_DPMS_ON: |
@@ -2639,6 +2640,9 @@ static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2639 | dce_v11_0_vga_enable(crtc, true); | 2640 | dce_v11_0_vga_enable(crtc, true); |
2640 | amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); | 2641 | amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); |
2641 | dce_v11_0_vga_enable(crtc, false); | 2642 | dce_v11_0_vga_enable(crtc, false); |
2643 | /* Make sure VBLANK interrupt is still enabled */ | ||
2644 | type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id); | ||
2645 | amdgpu_irq_update(adev, &adev->crtc_irq, type); | ||
2642 | drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); | 2646 | drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); |
2643 | dce_v11_0_crtc_load_lut(crtc); | 2647 | dce_v11_0_crtc_load_lut(crtc); |
2644 | break; | 2648 | break; |
@@ -3402,19 +3406,25 @@ static int dce_v11_0_crtc_irq(struct amdgpu_device *adev, | |||
3402 | 3406 | ||
3403 | switch (entry->src_data) { | 3407 | switch (entry->src_data) { |
3404 | case 0: /* vblank */ | 3408 | case 0: /* vblank */ |
3405 | if (disp_int & interrupt_status_offsets[crtc].vblank) { | 3409 | if (disp_int & interrupt_status_offsets[crtc].vblank) |
3406 | dce_v11_0_crtc_vblank_int_ack(adev, crtc); | 3410 | dce_v11_0_crtc_vblank_int_ack(adev, crtc); |
3407 | if (amdgpu_irq_enabled(adev, source, irq_type)) { | 3411 | else |
3408 | drm_handle_vblank(adev->ddev, crtc); | 3412 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3409 | } | 3413 | |
3410 | DRM_DEBUG("IH: D%d vblank\n", crtc + 1); | 3414 | if (amdgpu_irq_enabled(adev, source, irq_type)) { |
3415 | drm_handle_vblank(adev->ddev, crtc); | ||
3411 | } | 3416 | } |
3417 | DRM_DEBUG("IH: D%d vblank\n", crtc + 1); | ||
3418 | |||
3412 | break; | 3419 | break; |
3413 | case 1: /* vline */ | 3420 | case 1: /* vline */ |
3414 | if (disp_int & interrupt_status_offsets[crtc].vline) { | 3421 | if (disp_int & interrupt_status_offsets[crtc].vline) |
3415 | dce_v11_0_crtc_vline_int_ack(adev, crtc); | 3422 | dce_v11_0_crtc_vline_int_ack(adev, crtc); |
3416 | DRM_DEBUG("IH: D%d vline\n", crtc + 1); | 3423 | else |
3417 | } | 3424 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3425 | |||
3426 | DRM_DEBUG("IH: D%d vline\n", crtc + 1); | ||
3427 | |||
3418 | break; | 3428 | break; |
3419 | default: | 3429 | default: |
3420 | DRM_DEBUG("Unhandled interrupt: %d %d\n", entry->src_id, entry->src_data); | 3430 | DRM_DEBUG("Unhandled interrupt: %d %d\n", entry->src_id, entry->src_data); |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c index aaca8d663f2c..cc050a329c49 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | |||
@@ -2566,6 +2566,7 @@ static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2566 | struct drm_device *dev = crtc->dev; | 2566 | struct drm_device *dev = crtc->dev; |
2567 | struct amdgpu_device *adev = dev->dev_private; | 2567 | struct amdgpu_device *adev = dev->dev_private; |
2568 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 2568 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
2569 | unsigned type; | ||
2569 | 2570 | ||
2570 | switch (mode) { | 2571 | switch (mode) { |
2571 | case DRM_MODE_DPMS_ON: | 2572 | case DRM_MODE_DPMS_ON: |
@@ -2574,6 +2575,9 @@ static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2574 | dce_v8_0_vga_enable(crtc, true); | 2575 | dce_v8_0_vga_enable(crtc, true); |
2575 | amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); | 2576 | amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); |
2576 | dce_v8_0_vga_enable(crtc, false); | 2577 | dce_v8_0_vga_enable(crtc, false); |
2578 | /* Make sure VBLANK interrupt is still enabled */ | ||
2579 | type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id); | ||
2580 | amdgpu_irq_update(adev, &adev->crtc_irq, type); | ||
2577 | drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); | 2581 | drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); |
2578 | dce_v8_0_crtc_load_lut(crtc); | 2582 | dce_v8_0_crtc_load_lut(crtc); |
2579 | break; | 2583 | break; |
@@ -3237,19 +3241,25 @@ static int dce_v8_0_crtc_irq(struct amdgpu_device *adev, | |||
3237 | 3241 | ||
3238 | switch (entry->src_data) { | 3242 | switch (entry->src_data) { |
3239 | case 0: /* vblank */ | 3243 | case 0: /* vblank */ |
3240 | if (disp_int & interrupt_status_offsets[crtc].vblank) { | 3244 | if (disp_int & interrupt_status_offsets[crtc].vblank) |
3241 | WREG32(mmLB_VBLANK_STATUS + crtc_offsets[crtc], LB_VBLANK_STATUS__VBLANK_ACK_MASK); | 3245 | WREG32(mmLB_VBLANK_STATUS + crtc_offsets[crtc], LB_VBLANK_STATUS__VBLANK_ACK_MASK); |
3242 | if (amdgpu_irq_enabled(adev, source, irq_type)) { | 3246 | else |
3243 | drm_handle_vblank(adev->ddev, crtc); | 3247 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3244 | } | 3248 | |
3245 | DRM_DEBUG("IH: D%d vblank\n", crtc + 1); | 3249 | if (amdgpu_irq_enabled(adev, source, irq_type)) { |
3250 | drm_handle_vblank(adev->ddev, crtc); | ||
3246 | } | 3251 | } |
3252 | DRM_DEBUG("IH: D%d vblank\n", crtc + 1); | ||
3253 | |||
3247 | break; | 3254 | break; |
3248 | case 1: /* vline */ | 3255 | case 1: /* vline */ |
3249 | if (disp_int & interrupt_status_offsets[crtc].vline) { | 3256 | if (disp_int & interrupt_status_offsets[crtc].vline) |
3250 | WREG32(mmLB_VLINE_STATUS + crtc_offsets[crtc], LB_VLINE_STATUS__VLINE_ACK_MASK); | 3257 | WREG32(mmLB_VLINE_STATUS + crtc_offsets[crtc], LB_VLINE_STATUS__VLINE_ACK_MASK); |
3251 | DRM_DEBUG("IH: D%d vline\n", crtc + 1); | 3258 | else |
3252 | } | 3259 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3260 | |||
3261 | DRM_DEBUG("IH: D%d vline\n", crtc + 1); | ||
3262 | |||
3253 | break; | 3263 | break; |
3254 | default: | 3264 | default: |
3255 | DRM_DEBUG("Unhandled interrupt: %d %d\n", entry->src_id, entry->src_data); | 3265 | DRM_DEBUG("Unhandled interrupt: %d %d\n", entry->src_id, entry->src_data); |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 7b683fb2173c..1c7c992dea37 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
@@ -1813,10 +1813,7 @@ static u32 gfx_v8_0_get_rb_disabled(struct amdgpu_device *adev, | |||
1813 | u32 data, mask; | 1813 | u32 data, mask; |
1814 | 1814 | ||
1815 | data = RREG32(mmCC_RB_BACKEND_DISABLE); | 1815 | data = RREG32(mmCC_RB_BACKEND_DISABLE); |
1816 | if (data & 1) | 1816 | data &= CC_RB_BACKEND_DISABLE__BACKEND_DISABLE_MASK; |
1817 | data &= CC_RB_BACKEND_DISABLE__BACKEND_DISABLE_MASK; | ||
1818 | else | ||
1819 | data = 0; | ||
1820 | 1817 | ||
1821 | data |= RREG32(mmGC_USER_RB_BACKEND_DISABLE); | 1818 | data |= RREG32(mmGC_USER_RB_BACKEND_DISABLE); |
1822 | 1819 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c index d62c4002e39c..d1064ca3670e 100644 --- a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #include "oss/oss_2_0_d.h" | 35 | #include "oss/oss_2_0_d.h" |
36 | #include "oss/oss_2_0_sh_mask.h" | 36 | #include "oss/oss_2_0_sh_mask.h" |
37 | #include "gca/gfx_8_0_d.h" | 37 | #include "gca/gfx_8_0_d.h" |
38 | #include "smu/smu_7_1_2_d.h" | ||
39 | #include "smu/smu_7_1_2_sh_mask.h" | ||
38 | 40 | ||
39 | #define GRBM_GFX_INDEX__VCE_INSTANCE__SHIFT 0x04 | 41 | #define GRBM_GFX_INDEX__VCE_INSTANCE__SHIFT 0x04 |
40 | #define GRBM_GFX_INDEX__VCE_INSTANCE_MASK 0x10 | 42 | #define GRBM_GFX_INDEX__VCE_INSTANCE_MASK 0x10 |
@@ -112,6 +114,10 @@ static int vce_v3_0_start(struct amdgpu_device *adev) | |||
112 | 114 | ||
113 | mutex_lock(&adev->grbm_idx_mutex); | 115 | mutex_lock(&adev->grbm_idx_mutex); |
114 | for (idx = 0; idx < 2; ++idx) { | 116 | for (idx = 0; idx < 2; ++idx) { |
117 | |||
118 | if (adev->vce.harvest_config & (1 << idx)) | ||
119 | continue; | ||
120 | |||
115 | if(idx == 0) | 121 | if(idx == 0) |
116 | WREG32_P(mmGRBM_GFX_INDEX, 0, | 122 | WREG32_P(mmGRBM_GFX_INDEX, 0, |
117 | ~GRBM_GFX_INDEX__VCE_INSTANCE_MASK); | 123 | ~GRBM_GFX_INDEX__VCE_INSTANCE_MASK); |
@@ -190,10 +196,52 @@ static int vce_v3_0_start(struct amdgpu_device *adev) | |||
190 | return 0; | 196 | return 0; |
191 | } | 197 | } |
192 | 198 | ||
199 | #define ixVCE_HARVEST_FUSE_MACRO__ADDRESS 0xC0014074 | ||
200 | #define VCE_HARVEST_FUSE_MACRO__SHIFT 27 | ||
201 | #define VCE_HARVEST_FUSE_MACRO__MASK 0x18000000 | ||
202 | |||
203 | static unsigned vce_v3_0_get_harvest_config(struct amdgpu_device *adev) | ||
204 | { | ||
205 | u32 tmp; | ||
206 | unsigned ret; | ||
207 | |||
208 | if (adev->flags & AMDGPU_IS_APU) | ||
209 | tmp = (RREG32_SMC(ixVCE_HARVEST_FUSE_MACRO__ADDRESS) & | ||
210 | VCE_HARVEST_FUSE_MACRO__MASK) >> | ||
211 | VCE_HARVEST_FUSE_MACRO__SHIFT; | ||
212 | else | ||
213 | tmp = (RREG32_SMC(ixCC_HARVEST_FUSES) & | ||
214 | CC_HARVEST_FUSES__VCE_DISABLE_MASK) >> | ||
215 | CC_HARVEST_FUSES__VCE_DISABLE__SHIFT; | ||
216 | |||
217 | switch (tmp) { | ||
218 | case 1: | ||
219 | ret = AMDGPU_VCE_HARVEST_VCE0; | ||
220 | break; | ||
221 | case 2: | ||
222 | ret = AMDGPU_VCE_HARVEST_VCE1; | ||
223 | break; | ||
224 | case 3: | ||
225 | ret = AMDGPU_VCE_HARVEST_VCE0 | AMDGPU_VCE_HARVEST_VCE1; | ||
226 | break; | ||
227 | default: | ||
228 | ret = 0; | ||
229 | } | ||
230 | |||
231 | return ret; | ||
232 | } | ||
233 | |||
193 | static int vce_v3_0_early_init(void *handle) | 234 | static int vce_v3_0_early_init(void *handle) |
194 | { | 235 | { |
195 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 236 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
196 | 237 | ||
238 | adev->vce.harvest_config = vce_v3_0_get_harvest_config(adev); | ||
239 | |||
240 | if ((adev->vce.harvest_config & | ||
241 | (AMDGPU_VCE_HARVEST_VCE0 | AMDGPU_VCE_HARVEST_VCE1)) == | ||
242 | (AMDGPU_VCE_HARVEST_VCE0 | AMDGPU_VCE_HARVEST_VCE1)) | ||
243 | return -ENOENT; | ||
244 | |||
197 | vce_v3_0_set_ring_funcs(adev); | 245 | vce_v3_0_set_ring_funcs(adev); |
198 | vce_v3_0_set_irq_funcs(adev); | 246 | vce_v3_0_set_irq_funcs(adev); |
199 | 247 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c index fa5a4448531d..68552da40287 100644 --- a/drivers/gpu/drm/amd/amdgpu/vi.c +++ b/drivers/gpu/drm/amd/amdgpu/vi.c | |||
@@ -122,6 +122,32 @@ static void vi_smc_wreg(struct amdgpu_device *adev, u32 reg, u32 v) | |||
122 | spin_unlock_irqrestore(&adev->smc_idx_lock, flags); | 122 | spin_unlock_irqrestore(&adev->smc_idx_lock, flags); |
123 | } | 123 | } |
124 | 124 | ||
125 | /* smu_8_0_d.h */ | ||
126 | #define mmMP0PUB_IND_INDEX 0x180 | ||
127 | #define mmMP0PUB_IND_DATA 0x181 | ||
128 | |||
129 | static u32 cz_smc_rreg(struct amdgpu_device *adev, u32 reg) | ||
130 | { | ||
131 | unsigned long flags; | ||
132 | u32 r; | ||
133 | |||
134 | spin_lock_irqsave(&adev->smc_idx_lock, flags); | ||
135 | WREG32(mmMP0PUB_IND_INDEX, (reg)); | ||
136 | r = RREG32(mmMP0PUB_IND_DATA); | ||
137 | spin_unlock_irqrestore(&adev->smc_idx_lock, flags); | ||
138 | return r; | ||
139 | } | ||
140 | |||
141 | static void cz_smc_wreg(struct amdgpu_device *adev, u32 reg, u32 v) | ||
142 | { | ||
143 | unsigned long flags; | ||
144 | |||
145 | spin_lock_irqsave(&adev->smc_idx_lock, flags); | ||
146 | WREG32(mmMP0PUB_IND_INDEX, (reg)); | ||
147 | WREG32(mmMP0PUB_IND_DATA, (v)); | ||
148 | spin_unlock_irqrestore(&adev->smc_idx_lock, flags); | ||
149 | } | ||
150 | |||
125 | static u32 vi_uvd_ctx_rreg(struct amdgpu_device *adev, u32 reg) | 151 | static u32 vi_uvd_ctx_rreg(struct amdgpu_device *adev, u32 reg) |
126 | { | 152 | { |
127 | unsigned long flags; | 153 | unsigned long flags; |
@@ -1222,8 +1248,13 @@ static int vi_common_early_init(void *handle) | |||
1222 | bool smc_enabled = false; | 1248 | bool smc_enabled = false; |
1223 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 1249 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
1224 | 1250 | ||
1225 | adev->smc_rreg = &vi_smc_rreg; | 1251 | if (adev->flags & AMDGPU_IS_APU) { |
1226 | adev->smc_wreg = &vi_smc_wreg; | 1252 | adev->smc_rreg = &cz_smc_rreg; |
1253 | adev->smc_wreg = &cz_smc_wreg; | ||
1254 | } else { | ||
1255 | adev->smc_rreg = &vi_smc_rreg; | ||
1256 | adev->smc_wreg = &vi_smc_wreg; | ||
1257 | } | ||
1227 | adev->pcie_rreg = &vi_pcie_rreg; | 1258 | adev->pcie_rreg = &vi_pcie_rreg; |
1228 | adev->pcie_wreg = &vi_pcie_wreg; | 1259 | adev->pcie_wreg = &vi_pcie_wreg; |
1229 | adev->uvd_ctx_rreg = &vi_uvd_ctx_rreg; | 1260 | adev->uvd_ctx_rreg = &vi_uvd_ctx_rreg; |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c index 8a1f999daa24..9be007081b72 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c | |||
@@ -420,6 +420,12 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid) | |||
420 | pqm_uninit(&p->pqm); | 420 | pqm_uninit(&p->pqm); |
421 | 421 | ||
422 | pdd = kfd_get_process_device_data(dev, p); | 422 | pdd = kfd_get_process_device_data(dev, p); |
423 | |||
424 | if (!pdd) { | ||
425 | mutex_unlock(&p->mutex); | ||
426 | return; | ||
427 | } | ||
428 | |||
423 | if (pdd->reset_wavefronts) { | 429 | if (pdd->reset_wavefronts) { |
424 | dbgdev_wave_reset_wavefronts(pdd->dev, p); | 430 | dbgdev_wave_reset_wavefronts(pdd->dev, p); |
425 | pdd->reset_wavefronts = false; | 431 | pdd->reset_wavefronts = false; |
@@ -431,8 +437,7 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid) | |||
431 | * We don't call amd_iommu_unbind_pasid() here | 437 | * We don't call amd_iommu_unbind_pasid() here |
432 | * because the IOMMU called us. | 438 | * because the IOMMU called us. |
433 | */ | 439 | */ |
434 | if (pdd) | 440 | pdd->bound = false; |
435 | pdd->bound = false; | ||
436 | 441 | ||
437 | mutex_unlock(&p->mutex); | 442 | mutex_unlock(&p->mutex); |
438 | } | 443 | } |
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c index 42d2ffa08716..01ffe9bffe38 100644 --- a/drivers/gpu/drm/armada/armada_crtc.c +++ b/drivers/gpu/drm/armada/armada_crtc.c | |||
@@ -531,8 +531,6 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, | |||
531 | 531 | ||
532 | drm_crtc_vblank_off(crtc); | 532 | drm_crtc_vblank_off(crtc); |
533 | 533 | ||
534 | crtc->mode = *adj; | ||
535 | |||
536 | val = dcrtc->dumb_ctrl & ~CFG_DUMB_ENA; | 534 | val = dcrtc->dumb_ctrl & ~CFG_DUMB_ENA; |
537 | if (val != dcrtc->dumb_ctrl) { | 535 | if (val != dcrtc->dumb_ctrl) { |
538 | dcrtc->dumb_ctrl = val; | 536 | dcrtc->dumb_ctrl = val; |
diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c index 580e10acaa3a..60a688ef81c7 100644 --- a/drivers/gpu/drm/armada/armada_gem.c +++ b/drivers/gpu/drm/armada/armada_gem.c | |||
@@ -69,8 +69,9 @@ void armada_gem_free_object(struct drm_gem_object *obj) | |||
69 | 69 | ||
70 | if (dobj->obj.import_attach) { | 70 | if (dobj->obj.import_attach) { |
71 | /* We only ever display imported data */ | 71 | /* We only ever display imported data */ |
72 | dma_buf_unmap_attachment(dobj->obj.import_attach, dobj->sgt, | 72 | if (dobj->sgt) |
73 | DMA_TO_DEVICE); | 73 | dma_buf_unmap_attachment(dobj->obj.import_attach, |
74 | dobj->sgt, DMA_TO_DEVICE); | ||
74 | drm_prime_gem_destroy(&dobj->obj, NULL); | 75 | drm_prime_gem_destroy(&dobj->obj, NULL); |
75 | } | 76 | } |
76 | 77 | ||
diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c index c5b06fdb459c..e939faba7fcc 100644 --- a/drivers/gpu/drm/armada/armada_overlay.c +++ b/drivers/gpu/drm/armada/armada_overlay.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
8 | */ | 8 | */ |
9 | #include <drm/drmP.h> | 9 | #include <drm/drmP.h> |
10 | #include <drm/drm_plane_helper.h> | ||
10 | #include "armada_crtc.h" | 11 | #include "armada_crtc.h" |
11 | #include "armada_drm.h" | 12 | #include "armada_drm.h" |
12 | #include "armada_fb.h" | 13 | #include "armada_fb.h" |
@@ -85,16 +86,8 @@ static void armada_plane_vbl(struct armada_crtc *dcrtc, void *data) | |||
85 | 86 | ||
86 | if (fb) | 87 | if (fb) |
87 | armada_drm_queue_unref_work(dcrtc->crtc.dev, fb); | 88 | armada_drm_queue_unref_work(dcrtc->crtc.dev, fb); |
88 | } | ||
89 | 89 | ||
90 | static unsigned armada_limit(int start, unsigned size, unsigned max) | 90 | wake_up(&dplane->vbl.wait); |
91 | { | ||
92 | int end = start + size; | ||
93 | if (end < 0) | ||
94 | return 0; | ||
95 | if (start < 0) | ||
96 | start = 0; | ||
97 | return (unsigned)end > max ? max - start : end - start; | ||
98 | } | 91 | } |
99 | 92 | ||
100 | static int | 93 | static int |
@@ -105,26 +98,39 @@ armada_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, | |||
105 | { | 98 | { |
106 | struct armada_plane *dplane = drm_to_armada_plane(plane); | 99 | struct armada_plane *dplane = drm_to_armada_plane(plane); |
107 | struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc); | 100 | struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc); |
101 | struct drm_rect src = { | ||
102 | .x1 = src_x, | ||
103 | .y1 = src_y, | ||
104 | .x2 = src_x + src_w, | ||
105 | .y2 = src_y + src_h, | ||
106 | }; | ||
107 | struct drm_rect dest = { | ||
108 | .x1 = crtc_x, | ||
109 | .y1 = crtc_y, | ||
110 | .x2 = crtc_x + crtc_w, | ||
111 | .y2 = crtc_y + crtc_h, | ||
112 | }; | ||
113 | const struct drm_rect clip = { | ||
114 | .x2 = crtc->mode.hdisplay, | ||
115 | .y2 = crtc->mode.vdisplay, | ||
116 | }; | ||
108 | uint32_t val, ctrl0; | 117 | uint32_t val, ctrl0; |
109 | unsigned idx = 0; | 118 | unsigned idx = 0; |
119 | bool visible; | ||
110 | int ret; | 120 | int ret; |
111 | 121 | ||
112 | crtc_w = armada_limit(crtc_x, crtc_w, dcrtc->crtc.mode.hdisplay); | 122 | ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip, |
113 | crtc_h = armada_limit(crtc_y, crtc_h, dcrtc->crtc.mode.vdisplay); | 123 | 0, INT_MAX, true, false, &visible); |
124 | if (ret) | ||
125 | return ret; | ||
126 | |||
114 | ctrl0 = CFG_DMA_FMT(drm_fb_to_armada_fb(fb)->fmt) | | 127 | ctrl0 = CFG_DMA_FMT(drm_fb_to_armada_fb(fb)->fmt) | |
115 | CFG_DMA_MOD(drm_fb_to_armada_fb(fb)->mod) | | 128 | CFG_DMA_MOD(drm_fb_to_armada_fb(fb)->mod) | |
116 | CFG_CBSH_ENA | CFG_DMA_HSMOOTH | CFG_DMA_ENA; | 129 | CFG_CBSH_ENA | CFG_DMA_HSMOOTH | CFG_DMA_ENA; |
117 | 130 | ||
118 | /* Does the position/size result in nothing to display? */ | 131 | /* Does the position/size result in nothing to display? */ |
119 | if (crtc_w == 0 || crtc_h == 0) { | 132 | if (!visible) |
120 | ctrl0 &= ~CFG_DMA_ENA; | 133 | ctrl0 &= ~CFG_DMA_ENA; |
121 | } | ||
122 | |||
123 | /* | ||
124 | * FIXME: if the starting point is off screen, we need to | ||
125 | * adjust src_x, src_y, src_w, src_h appropriately, and | ||
126 | * according to the scale. | ||
127 | */ | ||
128 | 134 | ||
129 | if (!dcrtc->plane) { | 135 | if (!dcrtc->plane) { |
130 | dcrtc->plane = plane; | 136 | dcrtc->plane = plane; |
@@ -134,15 +140,19 @@ armada_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, | |||
134 | /* FIXME: overlay on an interlaced display */ | 140 | /* FIXME: overlay on an interlaced display */ |
135 | /* Just updating the position/size? */ | 141 | /* Just updating the position/size? */ |
136 | if (plane->fb == fb && dplane->ctrl0 == ctrl0) { | 142 | if (plane->fb == fb && dplane->ctrl0 == ctrl0) { |
137 | val = (src_h & 0xffff0000) | src_w >> 16; | 143 | val = (drm_rect_height(&src) & 0xffff0000) | |
144 | drm_rect_width(&src) >> 16; | ||
138 | dplane->src_hw = val; | 145 | dplane->src_hw = val; |
139 | writel_relaxed(val, dcrtc->base + LCD_SPU_DMA_HPXL_VLN); | 146 | writel_relaxed(val, dcrtc->base + LCD_SPU_DMA_HPXL_VLN); |
140 | val = crtc_h << 16 | crtc_w; | 147 | |
148 | val = drm_rect_height(&dest) << 16 | drm_rect_width(&dest); | ||
141 | dplane->dst_hw = val; | 149 | dplane->dst_hw = val; |
142 | writel_relaxed(val, dcrtc->base + LCD_SPU_DZM_HPXL_VLN); | 150 | writel_relaxed(val, dcrtc->base + LCD_SPU_DZM_HPXL_VLN); |
143 | val = crtc_y << 16 | crtc_x; | 151 | |
152 | val = dest.y1 << 16 | dest.x1; | ||
144 | dplane->dst_yx = val; | 153 | dplane->dst_yx = val; |
145 | writel_relaxed(val, dcrtc->base + LCD_SPU_DMA_OVSA_HPXL_VLN); | 154 | writel_relaxed(val, dcrtc->base + LCD_SPU_DMA_OVSA_HPXL_VLN); |
155 | |||
146 | return 0; | 156 | return 0; |
147 | } else if (~dplane->ctrl0 & ctrl0 & CFG_DMA_ENA) { | 157 | } else if (~dplane->ctrl0 & ctrl0 & CFG_DMA_ENA) { |
148 | /* Power up the Y/U/V FIFOs on ENA 0->1 transitions */ | 158 | /* Power up the Y/U/V FIFOs on ENA 0->1 transitions */ |
@@ -150,15 +160,14 @@ armada_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, | |||
150 | dcrtc->base + LCD_SPU_SRAM_PARA1); | 160 | dcrtc->base + LCD_SPU_SRAM_PARA1); |
151 | } | 161 | } |
152 | 162 | ||
153 | ret = wait_event_timeout(dplane->vbl.wait, | 163 | wait_event_timeout(dplane->vbl.wait, |
154 | list_empty(&dplane->vbl.update.node), | 164 | list_empty(&dplane->vbl.update.node), |
155 | HZ/25); | 165 | HZ/25); |
156 | if (ret < 0) | ||
157 | return ret; | ||
158 | 166 | ||
159 | if (plane->fb != fb) { | 167 | if (plane->fb != fb) { |
160 | struct armada_gem_object *obj = drm_fb_obj(fb); | 168 | struct armada_gem_object *obj = drm_fb_obj(fb); |
161 | uint32_t sy, su, sv; | 169 | uint32_t addr[3], pixel_format; |
170 | int i, num_planes, hsub; | ||
162 | 171 | ||
163 | /* | 172 | /* |
164 | * Take a reference on the new framebuffer - we want to | 173 | * Take a reference on the new framebuffer - we want to |
@@ -178,26 +187,39 @@ armada_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, | |||
178 | older_fb); | 187 | older_fb); |
179 | } | 188 | } |
180 | 189 | ||
181 | src_y >>= 16; | 190 | src_y = src.y1 >> 16; |
182 | src_x >>= 16; | 191 | src_x = src.x1 >> 16; |
183 | sy = obj->dev_addr + fb->offsets[0] + src_y * fb->pitches[0] + | ||
184 | src_x * fb->bits_per_pixel / 8; | ||
185 | su = obj->dev_addr + fb->offsets[1] + src_y * fb->pitches[1] + | ||
186 | src_x; | ||
187 | sv = obj->dev_addr + fb->offsets[2] + src_y * fb->pitches[2] + | ||
188 | src_x; | ||
189 | 192 | ||
190 | armada_reg_queue_set(dplane->vbl.regs, idx, sy, | 193 | pixel_format = fb->pixel_format; |
194 | hsub = drm_format_horz_chroma_subsampling(pixel_format); | ||
195 | num_planes = drm_format_num_planes(pixel_format); | ||
196 | |||
197 | /* | ||
198 | * Annoyingly, shifting a YUYV-format image by one pixel | ||
199 | * causes the U/V planes to toggle. Toggle the UV swap. | ||
200 | * (Unfortunately, this causes momentary colour flickering.) | ||
201 | */ | ||
202 | if (src_x & (hsub - 1) && num_planes == 1) | ||
203 | ctrl0 ^= CFG_DMA_MOD(CFG_SWAPUV); | ||
204 | |||
205 | for (i = 0; i < num_planes; i++) | ||
206 | addr[i] = obj->dev_addr + fb->offsets[i] + | ||
207 | src_y * fb->pitches[i] + | ||
208 | src_x * drm_format_plane_cpp(pixel_format, i); | ||
209 | for (; i < ARRAY_SIZE(addr); i++) | ||
210 | addr[i] = 0; | ||
211 | |||
212 | armada_reg_queue_set(dplane->vbl.regs, idx, addr[0], | ||
191 | LCD_SPU_DMA_START_ADDR_Y0); | 213 | LCD_SPU_DMA_START_ADDR_Y0); |
192 | armada_reg_queue_set(dplane->vbl.regs, idx, su, | 214 | armada_reg_queue_set(dplane->vbl.regs, idx, addr[1], |
193 | LCD_SPU_DMA_START_ADDR_U0); | 215 | LCD_SPU_DMA_START_ADDR_U0); |
194 | armada_reg_queue_set(dplane->vbl.regs, idx, sv, | 216 | armada_reg_queue_set(dplane->vbl.regs, idx, addr[2], |
195 | LCD_SPU_DMA_START_ADDR_V0); | 217 | LCD_SPU_DMA_START_ADDR_V0); |
196 | armada_reg_queue_set(dplane->vbl.regs, idx, sy, | 218 | armada_reg_queue_set(dplane->vbl.regs, idx, addr[0], |
197 | LCD_SPU_DMA_START_ADDR_Y1); | 219 | LCD_SPU_DMA_START_ADDR_Y1); |
198 | armada_reg_queue_set(dplane->vbl.regs, idx, su, | 220 | armada_reg_queue_set(dplane->vbl.regs, idx, addr[1], |
199 | LCD_SPU_DMA_START_ADDR_U1); | 221 | LCD_SPU_DMA_START_ADDR_U1); |
200 | armada_reg_queue_set(dplane->vbl.regs, idx, sv, | 222 | armada_reg_queue_set(dplane->vbl.regs, idx, addr[2], |
201 | LCD_SPU_DMA_START_ADDR_V1); | 223 | LCD_SPU_DMA_START_ADDR_V1); |
202 | 224 | ||
203 | val = fb->pitches[0] << 16 | fb->pitches[0]; | 225 | val = fb->pitches[0] << 16 | fb->pitches[0]; |
@@ -208,24 +230,27 @@ armada_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, | |||
208 | LCD_SPU_DMA_PITCH_UV); | 230 | LCD_SPU_DMA_PITCH_UV); |
209 | } | 231 | } |
210 | 232 | ||
211 | val = (src_h & 0xffff0000) | src_w >> 16; | 233 | val = (drm_rect_height(&src) & 0xffff0000) | drm_rect_width(&src) >> 16; |
212 | if (dplane->src_hw != val) { | 234 | if (dplane->src_hw != val) { |
213 | dplane->src_hw = val; | 235 | dplane->src_hw = val; |
214 | armada_reg_queue_set(dplane->vbl.regs, idx, val, | 236 | armada_reg_queue_set(dplane->vbl.regs, idx, val, |
215 | LCD_SPU_DMA_HPXL_VLN); | 237 | LCD_SPU_DMA_HPXL_VLN); |
216 | } | 238 | } |
217 | val = crtc_h << 16 | crtc_w; | 239 | |
240 | val = drm_rect_height(&dest) << 16 | drm_rect_width(&dest); | ||
218 | if (dplane->dst_hw != val) { | 241 | if (dplane->dst_hw != val) { |
219 | dplane->dst_hw = val; | 242 | dplane->dst_hw = val; |
220 | armada_reg_queue_set(dplane->vbl.regs, idx, val, | 243 | armada_reg_queue_set(dplane->vbl.regs, idx, val, |
221 | LCD_SPU_DZM_HPXL_VLN); | 244 | LCD_SPU_DZM_HPXL_VLN); |
222 | } | 245 | } |
223 | val = crtc_y << 16 | crtc_x; | 246 | |
247 | val = dest.y1 << 16 | dest.x1; | ||
224 | if (dplane->dst_yx != val) { | 248 | if (dplane->dst_yx != val) { |
225 | dplane->dst_yx = val; | 249 | dplane->dst_yx = val; |
226 | armada_reg_queue_set(dplane->vbl.regs, idx, val, | 250 | armada_reg_queue_set(dplane->vbl.regs, idx, val, |
227 | LCD_SPU_DMA_OVSA_HPXL_VLN); | 251 | LCD_SPU_DMA_OVSA_HPXL_VLN); |
228 | } | 252 | } |
253 | |||
229 | if (dplane->ctrl0 != ctrl0) { | 254 | if (dplane->ctrl0 != ctrl0) { |
230 | dplane->ctrl0 = ctrl0; | 255 | dplane->ctrl0 = ctrl0; |
231 | armada_reg_queue_mod(dplane->vbl.regs, idx, ctrl0, | 256 | armada_reg_queue_mod(dplane->vbl.regs, idx, ctrl0, |
@@ -279,7 +304,11 @@ static int armada_plane_disable(struct drm_plane *plane) | |||
279 | 304 | ||
280 | static void armada_plane_destroy(struct drm_plane *plane) | 305 | static void armada_plane_destroy(struct drm_plane *plane) |
281 | { | 306 | { |
282 | kfree(plane); | 307 | struct armada_plane *dplane = drm_to_armada_plane(plane); |
308 | |||
309 | drm_plane_cleanup(plane); | ||
310 | |||
311 | kfree(dplane); | ||
283 | } | 312 | } |
284 | 313 | ||
285 | static int armada_plane_set_property(struct drm_plane *plane, | 314 | static int armada_plane_set_property(struct drm_plane *plane, |
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c index f69b92535505..5ae5c6923128 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | |||
@@ -355,6 +355,7 @@ int atmel_hlcdc_crtc_create(struct drm_device *dev) | |||
355 | planes->overlays[i]->base.possible_crtcs = 1 << crtc->id; | 355 | planes->overlays[i]->base.possible_crtcs = 1 << crtc->id; |
356 | 356 | ||
357 | drm_crtc_helper_add(&crtc->base, &lcdc_crtc_helper_funcs); | 357 | drm_crtc_helper_add(&crtc->base, &lcdc_crtc_helper_funcs); |
358 | drm_crtc_vblank_reset(&crtc->base); | ||
358 | 359 | ||
359 | dc->crtc = &crtc->base; | 360 | dc->crtc = &crtc->base; |
360 | 361 | ||
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c index 60b0c13d7ff5..6fad1f9648f3 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | |||
@@ -313,20 +313,20 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev) | |||
313 | 313 | ||
314 | pm_runtime_enable(dev->dev); | 314 | pm_runtime_enable(dev->dev); |
315 | 315 | ||
316 | ret = atmel_hlcdc_dc_modeset_init(dev); | 316 | ret = drm_vblank_init(dev, 1); |
317 | if (ret < 0) { | 317 | if (ret < 0) { |
318 | dev_err(dev->dev, "failed to initialize mode setting\n"); | 318 | dev_err(dev->dev, "failed to initialize vblank\n"); |
319 | goto err_periph_clk_disable; | 319 | goto err_periph_clk_disable; |
320 | } | 320 | } |
321 | 321 | ||
322 | drm_mode_config_reset(dev); | 322 | ret = atmel_hlcdc_dc_modeset_init(dev); |
323 | |||
324 | ret = drm_vblank_init(dev, 1); | ||
325 | if (ret < 0) { | 323 | if (ret < 0) { |
326 | dev_err(dev->dev, "failed to initialize vblank\n"); | 324 | dev_err(dev->dev, "failed to initialize mode setting\n"); |
327 | goto err_periph_clk_disable; | 325 | goto err_periph_clk_disable; |
328 | } | 326 | } |
329 | 327 | ||
328 | drm_mode_config_reset(dev); | ||
329 | |||
330 | pm_runtime_get_sync(dev->dev); | 330 | pm_runtime_get_sync(dev->dev); |
331 | ret = drm_irq_install(dev, dc->hlcdc->irq); | 331 | ret = drm_irq_install(dev, dc->hlcdc->irq); |
332 | pm_runtime_put_sync(dev->dev); | 332 | pm_runtime_put_sync(dev->dev); |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index b9ba06176eb1..fed748311b92 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -2706,8 +2706,11 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, | |||
2706 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 2706 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
2707 | return -EINVAL; | 2707 | return -EINVAL; |
2708 | 2708 | ||
2709 | /* For some reason crtc x/y offsets are signed internally. */ | 2709 | /* |
2710 | if (crtc_req->x > INT_MAX || crtc_req->y > INT_MAX) | 2710 | * Universal plane src offsets are only 16.16, prevent havoc for |
2711 | * drivers using universal plane code internally. | ||
2712 | */ | ||
2713 | if (crtc_req->x & 0xffff0000 || crtc_req->y & 0xffff0000) | ||
2711 | return -ERANGE; | 2714 | return -ERANGE; |
2712 | 2715 | ||
2713 | drm_modeset_lock_all(dev); | 2716 | drm_modeset_lock_all(dev); |
@@ -5395,12 +5398,9 @@ void drm_mode_config_reset(struct drm_device *dev) | |||
5395 | if (encoder->funcs->reset) | 5398 | if (encoder->funcs->reset) |
5396 | encoder->funcs->reset(encoder); | 5399 | encoder->funcs->reset(encoder); |
5397 | 5400 | ||
5398 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 5401 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) |
5399 | connector->status = connector_status_unknown; | ||
5400 | |||
5401 | if (connector->funcs->reset) | 5402 | if (connector->funcs->reset) |
5402 | connector->funcs->reset(connector); | 5403 | connector->funcs->reset(connector); |
5403 | } | ||
5404 | } | 5404 | } |
5405 | EXPORT_SYMBOL(drm_mode_config_reset); | 5405 | EXPORT_SYMBOL(drm_mode_config_reset); |
5406 | 5406 | ||
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c index aa8bbb460c57..9cfcd0aef0df 100644 --- a/drivers/gpu/drm/drm_ioc32.c +++ b/drivers/gpu/drm/drm_ioc32.c | |||
@@ -70,6 +70,8 @@ | |||
70 | 70 | ||
71 | #define DRM_IOCTL_WAIT_VBLANK32 DRM_IOWR(0x3a, drm_wait_vblank32_t) | 71 | #define DRM_IOCTL_WAIT_VBLANK32 DRM_IOWR(0x3a, drm_wait_vblank32_t) |
72 | 72 | ||
73 | #define DRM_IOCTL_MODE_ADDFB232 DRM_IOWR(0xb8, drm_mode_fb_cmd232_t) | ||
74 | |||
73 | typedef struct drm_version_32 { | 75 | typedef struct drm_version_32 { |
74 | int version_major; /**< Major version */ | 76 | int version_major; /**< Major version */ |
75 | int version_minor; /**< Minor version */ | 77 | int version_minor; /**< Minor version */ |
@@ -1016,6 +1018,63 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd, | |||
1016 | return 0; | 1018 | return 0; |
1017 | } | 1019 | } |
1018 | 1020 | ||
1021 | typedef struct drm_mode_fb_cmd232 { | ||
1022 | u32 fb_id; | ||
1023 | u32 width; | ||
1024 | u32 height; | ||
1025 | u32 pixel_format; | ||
1026 | u32 flags; | ||
1027 | u32 handles[4]; | ||
1028 | u32 pitches[4]; | ||
1029 | u32 offsets[4]; | ||
1030 | u64 modifier[4]; | ||
1031 | } __attribute__((packed)) drm_mode_fb_cmd232_t; | ||
1032 | |||
1033 | static int compat_drm_mode_addfb2(struct file *file, unsigned int cmd, | ||
1034 | unsigned long arg) | ||
1035 | { | ||
1036 | struct drm_mode_fb_cmd232 __user *argp = (void __user *)arg; | ||
1037 | struct drm_mode_fb_cmd232 req32; | ||
1038 | struct drm_mode_fb_cmd2 __user *req64; | ||
1039 | int i; | ||
1040 | int err; | ||
1041 | |||
1042 | if (copy_from_user(&req32, argp, sizeof(req32))) | ||
1043 | return -EFAULT; | ||
1044 | |||
1045 | req64 = compat_alloc_user_space(sizeof(*req64)); | ||
1046 | |||
1047 | if (!access_ok(VERIFY_WRITE, req64, sizeof(*req64)) | ||
1048 | || __put_user(req32.width, &req64->width) | ||
1049 | || __put_user(req32.height, &req64->height) | ||
1050 | || __put_user(req32.pixel_format, &req64->pixel_format) | ||
1051 | || __put_user(req32.flags, &req64->flags)) | ||
1052 | return -EFAULT; | ||
1053 | |||
1054 | for (i = 0; i < 4; i++) { | ||
1055 | if (__put_user(req32.handles[i], &req64->handles[i])) | ||
1056 | return -EFAULT; | ||
1057 | if (__put_user(req32.pitches[i], &req64->pitches[i])) | ||
1058 | return -EFAULT; | ||
1059 | if (__put_user(req32.offsets[i], &req64->offsets[i])) | ||
1060 | return -EFAULT; | ||
1061 | if (__put_user(req32.modifier[i], &req64->modifier[i])) | ||
1062 | return -EFAULT; | ||
1063 | } | ||
1064 | |||
1065 | err = drm_ioctl(file, DRM_IOCTL_MODE_ADDFB2, (unsigned long)req64); | ||
1066 | if (err) | ||
1067 | return err; | ||
1068 | |||
1069 | if (__get_user(req32.fb_id, &req64->fb_id)) | ||
1070 | return -EFAULT; | ||
1071 | |||
1072 | if (copy_to_user(argp, &req32, sizeof(req32))) | ||
1073 | return -EFAULT; | ||
1074 | |||
1075 | return 0; | ||
1076 | } | ||
1077 | |||
1019 | static drm_ioctl_compat_t *drm_compat_ioctls[] = { | 1078 | static drm_ioctl_compat_t *drm_compat_ioctls[] = { |
1020 | [DRM_IOCTL_NR(DRM_IOCTL_VERSION32)] = compat_drm_version, | 1079 | [DRM_IOCTL_NR(DRM_IOCTL_VERSION32)] = compat_drm_version, |
1021 | [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE32)] = compat_drm_getunique, | 1080 | [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE32)] = compat_drm_getunique, |
@@ -1048,6 +1107,7 @@ static drm_ioctl_compat_t *drm_compat_ioctls[] = { | |||
1048 | [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw, | 1107 | [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw, |
1049 | #endif | 1108 | #endif |
1050 | [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank, | 1109 | [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank, |
1110 | [DRM_IOCTL_NR(DRM_IOCTL_MODE_ADDFB232)] = compat_drm_mode_addfb2, | ||
1051 | }; | 1111 | }; |
1052 | 1112 | ||
1053 | /** | 1113 | /** |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 542fac628b28..5f27290201e0 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -826,6 +826,7 @@ struct intel_context { | |||
826 | struct kref ref; | 826 | struct kref ref; |
827 | int user_handle; | 827 | int user_handle; |
828 | uint8_t remap_slice; | 828 | uint8_t remap_slice; |
829 | struct drm_i915_private *i915; | ||
829 | struct drm_i915_file_private *file_priv; | 830 | struct drm_i915_file_private *file_priv; |
830 | struct i915_ctx_hang_stats hang_stats; | 831 | struct i915_ctx_hang_stats hang_stats; |
831 | struct i915_hw_ppgtt *ppgtt; | 832 | struct i915_hw_ppgtt *ppgtt; |
@@ -2036,8 +2037,6 @@ struct drm_i915_gem_object { | |||
2036 | unsigned int cache_level:3; | 2037 | unsigned int cache_level:3; |
2037 | unsigned int cache_dirty:1; | 2038 | unsigned int cache_dirty:1; |
2038 | 2039 | ||
2039 | unsigned int has_dma_mapping:1; | ||
2040 | |||
2041 | unsigned int frontbuffer_bits:INTEL_FRONTBUFFER_BITS; | 2040 | unsigned int frontbuffer_bits:INTEL_FRONTBUFFER_BITS; |
2042 | 2041 | ||
2043 | unsigned int pin_display; | 2042 | unsigned int pin_display; |
@@ -3116,7 +3115,8 @@ void i915_debugfs_cleanup(struct drm_minor *minor); | |||
3116 | int i915_debugfs_connector_add(struct drm_connector *connector); | 3115 | int i915_debugfs_connector_add(struct drm_connector *connector); |
3117 | void intel_display_crc_init(struct drm_device *dev); | 3116 | void intel_display_crc_init(struct drm_device *dev); |
3118 | #else | 3117 | #else |
3119 | static inline int i915_debugfs_connector_add(struct drm_connector *connector) {} | 3118 | static inline int i915_debugfs_connector_add(struct drm_connector *connector) |
3119 | { return 0; } | ||
3120 | static inline void intel_display_crc_init(struct drm_device *dev) {} | 3120 | static inline void intel_display_crc_init(struct drm_device *dev) {} |
3121 | #endif | 3121 | #endif |
3122 | 3122 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 248fd1ac7b3a..52b446b27b4d 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -213,7 +213,6 @@ i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj) | |||
213 | sg_dma_len(sg) = obj->base.size; | 213 | sg_dma_len(sg) = obj->base.size; |
214 | 214 | ||
215 | obj->pages = st; | 215 | obj->pages = st; |
216 | obj->has_dma_mapping = true; | ||
217 | return 0; | 216 | return 0; |
218 | } | 217 | } |
219 | 218 | ||
@@ -265,8 +264,6 @@ i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj) | |||
265 | 264 | ||
266 | sg_free_table(obj->pages); | 265 | sg_free_table(obj->pages); |
267 | kfree(obj->pages); | 266 | kfree(obj->pages); |
268 | |||
269 | obj->has_dma_mapping = false; | ||
270 | } | 267 | } |
271 | 268 | ||
272 | static void | 269 | static void |
@@ -2139,6 +2136,8 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj) | |||
2139 | obj->base.read_domains = obj->base.write_domain = I915_GEM_DOMAIN_CPU; | 2136 | obj->base.read_domains = obj->base.write_domain = I915_GEM_DOMAIN_CPU; |
2140 | } | 2137 | } |
2141 | 2138 | ||
2139 | i915_gem_gtt_finish_object(obj); | ||
2140 | |||
2142 | if (i915_gem_object_needs_bit17_swizzle(obj)) | 2141 | if (i915_gem_object_needs_bit17_swizzle(obj)) |
2143 | i915_gem_object_save_bit_17_swizzle(obj); | 2142 | i915_gem_object_save_bit_17_swizzle(obj); |
2144 | 2143 | ||
@@ -2199,6 +2198,7 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) | |||
2199 | struct sg_page_iter sg_iter; | 2198 | struct sg_page_iter sg_iter; |
2200 | struct page *page; | 2199 | struct page *page; |
2201 | unsigned long last_pfn = 0; /* suppress gcc warning */ | 2200 | unsigned long last_pfn = 0; /* suppress gcc warning */ |
2201 | int ret; | ||
2202 | gfp_t gfp; | 2202 | gfp_t gfp; |
2203 | 2203 | ||
2204 | /* Assert that the object is not currently in any GPU domain. As it | 2204 | /* Assert that the object is not currently in any GPU domain. As it |
@@ -2246,8 +2246,10 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) | |||
2246 | */ | 2246 | */ |
2247 | i915_gem_shrink_all(dev_priv); | 2247 | i915_gem_shrink_all(dev_priv); |
2248 | page = shmem_read_mapping_page(mapping, i); | 2248 | page = shmem_read_mapping_page(mapping, i); |
2249 | if (IS_ERR(page)) | 2249 | if (IS_ERR(page)) { |
2250 | ret = PTR_ERR(page); | ||
2250 | goto err_pages; | 2251 | goto err_pages; |
2252 | } | ||
2251 | } | 2253 | } |
2252 | #ifdef CONFIG_SWIOTLB | 2254 | #ifdef CONFIG_SWIOTLB |
2253 | if (swiotlb_nr_tbl()) { | 2255 | if (swiotlb_nr_tbl()) { |
@@ -2276,6 +2278,10 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) | |||
2276 | sg_mark_end(sg); | 2278 | sg_mark_end(sg); |
2277 | obj->pages = st; | 2279 | obj->pages = st; |
2278 | 2280 | ||
2281 | ret = i915_gem_gtt_prepare_object(obj); | ||
2282 | if (ret) | ||
2283 | goto err_pages; | ||
2284 | |||
2279 | if (i915_gem_object_needs_bit17_swizzle(obj)) | 2285 | if (i915_gem_object_needs_bit17_swizzle(obj)) |
2280 | i915_gem_object_do_bit_17_swizzle(obj); | 2286 | i915_gem_object_do_bit_17_swizzle(obj); |
2281 | 2287 | ||
@@ -2300,10 +2306,10 @@ err_pages: | |||
2300 | * space and so want to translate the error from shmemfs back to our | 2306 | * space and so want to translate the error from shmemfs back to our |
2301 | * usual understanding of ENOMEM. | 2307 | * usual understanding of ENOMEM. |
2302 | */ | 2308 | */ |
2303 | if (PTR_ERR(page) == -ENOSPC) | 2309 | if (ret == -ENOSPC) |
2304 | return -ENOMEM; | 2310 | ret = -ENOMEM; |
2305 | else | 2311 | |
2306 | return PTR_ERR(page); | 2312 | return ret; |
2307 | } | 2313 | } |
2308 | 2314 | ||
2309 | /* Ensure that the associated pages are gathered from the backing storage | 2315 | /* Ensure that the associated pages are gathered from the backing storage |
@@ -2542,6 +2548,7 @@ int __i915_add_request(struct intel_engine_cs *ring, | |||
2542 | } | 2548 | } |
2543 | 2549 | ||
2544 | request->emitted_jiffies = jiffies; | 2550 | request->emitted_jiffies = jiffies; |
2551 | ring->last_submitted_seqno = request->seqno; | ||
2545 | list_add_tail(&request->list, &ring->request_list); | 2552 | list_add_tail(&request->list, &ring->request_list); |
2546 | request->file_priv = NULL; | 2553 | request->file_priv = NULL; |
2547 | 2554 | ||
@@ -3247,10 +3254,8 @@ int i915_vma_unbind(struct i915_vma *vma) | |||
3247 | 3254 | ||
3248 | /* Since the unbound list is global, only move to that list if | 3255 | /* Since the unbound list is global, only move to that list if |
3249 | * no more VMAs exist. */ | 3256 | * no more VMAs exist. */ |
3250 | if (list_empty(&obj->vma_list)) { | 3257 | if (list_empty(&obj->vma_list)) |
3251 | i915_gem_gtt_finish_object(obj); | ||
3252 | list_move_tail(&obj->global_list, &dev_priv->mm.unbound_list); | 3258 | list_move_tail(&obj->global_list, &dev_priv->mm.unbound_list); |
3253 | } | ||
3254 | 3259 | ||
3255 | /* And finally now the object is completely decoupled from this vma, | 3260 | /* And finally now the object is completely decoupled from this vma, |
3256 | * we can drop its hold on the backing storage and allow it to be | 3261 | * we can drop its hold on the backing storage and allow it to be |
@@ -3768,22 +3773,16 @@ search_free: | |||
3768 | goto err_remove_node; | 3773 | goto err_remove_node; |
3769 | } | 3774 | } |
3770 | 3775 | ||
3771 | ret = i915_gem_gtt_prepare_object(obj); | ||
3772 | if (ret) | ||
3773 | goto err_remove_node; | ||
3774 | |||
3775 | trace_i915_vma_bind(vma, flags); | 3776 | trace_i915_vma_bind(vma, flags); |
3776 | ret = i915_vma_bind(vma, obj->cache_level, flags); | 3777 | ret = i915_vma_bind(vma, obj->cache_level, flags); |
3777 | if (ret) | 3778 | if (ret) |
3778 | goto err_finish_gtt; | 3779 | goto err_remove_node; |
3779 | 3780 | ||
3780 | list_move_tail(&obj->global_list, &dev_priv->mm.bound_list); | 3781 | list_move_tail(&obj->global_list, &dev_priv->mm.bound_list); |
3781 | list_add_tail(&vma->mm_list, &vm->inactive_list); | 3782 | list_add_tail(&vma->mm_list, &vm->inactive_list); |
3782 | 3783 | ||
3783 | return vma; | 3784 | return vma; |
3784 | 3785 | ||
3785 | err_finish_gtt: | ||
3786 | i915_gem_gtt_finish_object(obj); | ||
3787 | err_remove_node: | 3786 | err_remove_node: |
3788 | drm_mm_remove_node(&vma->node); | 3787 | drm_mm_remove_node(&vma->node); |
3789 | err_free_vma: | 3788 | err_free_vma: |
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index 8867818b1401..48afa777e94a 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c | |||
@@ -135,8 +135,7 @@ static int get_context_size(struct drm_device *dev) | |||
135 | 135 | ||
136 | void i915_gem_context_free(struct kref *ctx_ref) | 136 | void i915_gem_context_free(struct kref *ctx_ref) |
137 | { | 137 | { |
138 | struct intel_context *ctx = container_of(ctx_ref, | 138 | struct intel_context *ctx = container_of(ctx_ref, typeof(*ctx), ref); |
139 | typeof(*ctx), ref); | ||
140 | 139 | ||
141 | trace_i915_context_free(ctx); | 140 | trace_i915_context_free(ctx); |
142 | 141 | ||
@@ -157,9 +156,7 @@ i915_gem_alloc_context_obj(struct drm_device *dev, size_t size) | |||
157 | struct drm_i915_gem_object *obj; | 156 | struct drm_i915_gem_object *obj; |
158 | int ret; | 157 | int ret; |
159 | 158 | ||
160 | obj = i915_gem_object_create_stolen(dev, size); | 159 | obj = i915_gem_alloc_object(dev, size); |
161 | if (obj == NULL) | ||
162 | obj = i915_gem_alloc_object(dev, size); | ||
163 | if (obj == NULL) | 160 | if (obj == NULL) |
164 | return ERR_PTR(-ENOMEM); | 161 | return ERR_PTR(-ENOMEM); |
165 | 162 | ||
@@ -197,6 +194,7 @@ __create_hw_context(struct drm_device *dev, | |||
197 | 194 | ||
198 | kref_init(&ctx->ref); | 195 | kref_init(&ctx->ref); |
199 | list_add_tail(&ctx->link, &dev_priv->context_list); | 196 | list_add_tail(&ctx->link, &dev_priv->context_list); |
197 | ctx->i915 = dev_priv; | ||
200 | 198 | ||
201 | if (dev_priv->hw_context_size) { | 199 | if (dev_priv->hw_context_size) { |
202 | struct drm_i915_gem_object *obj = | 200 | struct drm_i915_gem_object *obj = |
diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c index 7998da27c500..e9c2bfd85b52 100644 --- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c +++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c | |||
@@ -256,7 +256,6 @@ static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj) | |||
256 | return PTR_ERR(sg); | 256 | return PTR_ERR(sg); |
257 | 257 | ||
258 | obj->pages = sg; | 258 | obj->pages = sg; |
259 | obj->has_dma_mapping = true; | ||
260 | return 0; | 259 | return 0; |
261 | } | 260 | } |
262 | 261 | ||
@@ -264,7 +263,6 @@ static void i915_gem_object_put_pages_dmabuf(struct drm_i915_gem_object *obj) | |||
264 | { | 263 | { |
265 | dma_buf_unmap_attachment(obj->base.import_attach, | 264 | dma_buf_unmap_attachment(obj->base.import_attach, |
266 | obj->pages, DMA_BIDIRECTIONAL); | 265 | obj->pages, DMA_BIDIRECTIONAL); |
267 | obj->has_dma_mapping = false; | ||
268 | } | 266 | } |
269 | 267 | ||
270 | static const struct drm_i915_gem_object_ops i915_gem_object_dmabuf_ops = { | 268 | static const struct drm_i915_gem_object_ops i915_gem_object_dmabuf_ops = { |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 9daa2883ac18..56b52a4767d4 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -1723,9 +1723,6 @@ void i915_gem_suspend_gtt_mappings(struct drm_device *dev) | |||
1723 | 1723 | ||
1724 | int i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj) | 1724 | int i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj) |
1725 | { | 1725 | { |
1726 | if (obj->has_dma_mapping) | ||
1727 | return 0; | ||
1728 | |||
1729 | if (!dma_map_sg(&obj->base.dev->pdev->dev, | 1726 | if (!dma_map_sg(&obj->base.dev->pdev->dev, |
1730 | obj->pages->sgl, obj->pages->nents, | 1727 | obj->pages->sgl, obj->pages->nents, |
1731 | PCI_DMA_BIDIRECTIONAL)) | 1728 | PCI_DMA_BIDIRECTIONAL)) |
@@ -1972,10 +1969,8 @@ void i915_gem_gtt_finish_object(struct drm_i915_gem_object *obj) | |||
1972 | 1969 | ||
1973 | interruptible = do_idling(dev_priv); | 1970 | interruptible = do_idling(dev_priv); |
1974 | 1971 | ||
1975 | if (!obj->has_dma_mapping) | 1972 | dma_unmap_sg(&dev->pdev->dev, obj->pages->sgl, obj->pages->nents, |
1976 | dma_unmap_sg(&dev->pdev->dev, | 1973 | PCI_DMA_BIDIRECTIONAL); |
1977 | obj->pages->sgl, obj->pages->nents, | ||
1978 | PCI_DMA_BIDIRECTIONAL); | ||
1979 | 1974 | ||
1980 | undo_idling(dev_priv, interruptible); | 1975 | undo_idling(dev_priv, interruptible); |
1981 | } | 1976 | } |
@@ -2546,6 +2541,8 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev) | |||
2546 | struct drm_i915_private *dev_priv = dev->dev_private; | 2541 | struct drm_i915_private *dev_priv = dev->dev_private; |
2547 | struct drm_i915_gem_object *obj; | 2542 | struct drm_i915_gem_object *obj; |
2548 | struct i915_address_space *vm; | 2543 | struct i915_address_space *vm; |
2544 | struct i915_vma *vma; | ||
2545 | bool flush; | ||
2549 | 2546 | ||
2550 | i915_check_and_clear_faults(dev); | 2547 | i915_check_and_clear_faults(dev); |
2551 | 2548 | ||
@@ -2555,16 +2552,23 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev) | |||
2555 | dev_priv->gtt.base.total, | 2552 | dev_priv->gtt.base.total, |
2556 | true); | 2553 | true); |
2557 | 2554 | ||
2555 | /* Cache flush objects bound into GGTT and rebind them. */ | ||
2556 | vm = &dev_priv->gtt.base; | ||
2558 | list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { | 2557 | list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { |
2559 | struct i915_vma *vma = i915_gem_obj_to_vma(obj, | 2558 | flush = false; |
2560 | &dev_priv->gtt.base); | 2559 | list_for_each_entry(vma, &obj->vma_list, vma_link) { |
2561 | if (!vma) | 2560 | if (vma->vm != vm) |
2562 | continue; | 2561 | continue; |
2563 | 2562 | ||
2564 | i915_gem_clflush_object(obj, obj->pin_display); | 2563 | WARN_ON(i915_vma_bind(vma, obj->cache_level, |
2565 | WARN_ON(i915_vma_bind(vma, obj->cache_level, PIN_UPDATE)); | 2564 | PIN_UPDATE)); |
2566 | } | 2565 | |
2566 | flush = true; | ||
2567 | } | ||
2567 | 2568 | ||
2569 | if (flush) | ||
2570 | i915_gem_clflush_object(obj, obj->pin_display); | ||
2571 | } | ||
2568 | 2572 | ||
2569 | if (INTEL_INFO(dev)->gen >= 8) { | 2573 | if (INTEL_INFO(dev)->gen >= 8) { |
2570 | if (IS_CHERRYVIEW(dev) || IS_BROXTON(dev)) | 2574 | if (IS_CHERRYVIEW(dev) || IS_BROXTON(dev)) |
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 348ed5abcdbf..8b5b784c62fe 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c | |||
@@ -416,7 +416,6 @@ _i915_gem_object_create_stolen(struct drm_device *dev, | |||
416 | if (obj->pages == NULL) | 416 | if (obj->pages == NULL) |
417 | goto cleanup; | 417 | goto cleanup; |
418 | 418 | ||
419 | obj->has_dma_mapping = true; | ||
420 | i915_gem_object_pin_pages(obj); | 419 | i915_gem_object_pin_pages(obj); |
421 | obj->stolen = stolen; | 420 | obj->stolen = stolen; |
422 | 421 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c index 1f4e5a32a16e..8fd431bcdfd3 100644 --- a/drivers/gpu/drm/i915/i915_gem_userptr.c +++ b/drivers/gpu/drm/i915/i915_gem_userptr.c | |||
@@ -545,6 +545,26 @@ err: | |||
545 | return ret; | 545 | return ret; |
546 | } | 546 | } |
547 | 547 | ||
548 | static int | ||
549 | __i915_gem_userptr_set_pages(struct drm_i915_gem_object *obj, | ||
550 | struct page **pvec, int num_pages) | ||
551 | { | ||
552 | int ret; | ||
553 | |||
554 | ret = st_set_pages(&obj->pages, pvec, num_pages); | ||
555 | if (ret) | ||
556 | return ret; | ||
557 | |||
558 | ret = i915_gem_gtt_prepare_object(obj); | ||
559 | if (ret) { | ||
560 | sg_free_table(obj->pages); | ||
561 | kfree(obj->pages); | ||
562 | obj->pages = NULL; | ||
563 | } | ||
564 | |||
565 | return ret; | ||
566 | } | ||
567 | |||
548 | static void | 568 | static void |
549 | __i915_gem_userptr_get_pages_worker(struct work_struct *_work) | 569 | __i915_gem_userptr_get_pages_worker(struct work_struct *_work) |
550 | { | 570 | { |
@@ -584,9 +604,12 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work) | |||
584 | if (obj->userptr.work != &work->work) { | 604 | if (obj->userptr.work != &work->work) { |
585 | ret = 0; | 605 | ret = 0; |
586 | } else if (pinned == num_pages) { | 606 | } else if (pinned == num_pages) { |
587 | ret = st_set_pages(&obj->pages, pvec, num_pages); | 607 | ret = __i915_gem_userptr_set_pages(obj, pvec, num_pages); |
588 | if (ret == 0) { | 608 | if (ret == 0) { |
589 | list_add_tail(&obj->global_list, &to_i915(dev)->mm.unbound_list); | 609 | list_add_tail(&obj->global_list, &to_i915(dev)->mm.unbound_list); |
610 | obj->get_page.sg = obj->pages->sgl; | ||
611 | obj->get_page.last = 0; | ||
612 | |||
590 | pinned = 0; | 613 | pinned = 0; |
591 | } | 614 | } |
592 | } | 615 | } |
@@ -693,7 +716,7 @@ i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj) | |||
693 | } | 716 | } |
694 | } | 717 | } |
695 | } else { | 718 | } else { |
696 | ret = st_set_pages(&obj->pages, pvec, num_pages); | 719 | ret = __i915_gem_userptr_set_pages(obj, pvec, num_pages); |
697 | if (ret == 0) { | 720 | if (ret == 0) { |
698 | obj->userptr.work = NULL; | 721 | obj->userptr.work = NULL; |
699 | pinned = 0; | 722 | pinned = 0; |
@@ -715,6 +738,8 @@ i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj) | |||
715 | if (obj->madv != I915_MADV_WILLNEED) | 738 | if (obj->madv != I915_MADV_WILLNEED) |
716 | obj->dirty = 0; | 739 | obj->dirty = 0; |
717 | 740 | ||
741 | i915_gem_gtt_finish_object(obj); | ||
742 | |||
718 | for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, 0) { | 743 | for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, 0) { |
719 | struct page *page = sg_page_iter_page(&sg_iter); | 744 | struct page *page = sg_page_iter_page(&sg_iter); |
720 | 745 | ||
diff --git a/drivers/gpu/drm/i915/i915_ioc32.c b/drivers/gpu/drm/i915/i915_ioc32.c index 176de6322e4d..23aa04cded6b 100644 --- a/drivers/gpu/drm/i915/i915_ioc32.c +++ b/drivers/gpu/drm/i915/i915_ioc32.c | |||
@@ -204,7 +204,7 @@ long i915_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
204 | drm_ioctl_compat_t *fn = NULL; | 204 | drm_ioctl_compat_t *fn = NULL; |
205 | int ret; | 205 | int ret; |
206 | 206 | ||
207 | if (nr < DRM_COMMAND_BASE) | 207 | if (nr < DRM_COMMAND_BASE || nr >= DRM_COMMAND_END) |
208 | return drm_compat_ioctl(filp, cmd, arg); | 208 | return drm_compat_ioctl(filp, cmd, arg); |
209 | 209 | ||
210 | if (nr < DRM_COMMAND_BASE + ARRAY_SIZE(i915_compat_ioctls)) | 210 | if (nr < DRM_COMMAND_BASE + ARRAY_SIZE(i915_compat_ioctls)) |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index e6bb72dca3ff..984e2fe6688c 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -2706,18 +2706,11 @@ static void gen8_disable_vblank(struct drm_device *dev, int pipe) | |||
2706 | spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); | 2706 | spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); |
2707 | } | 2707 | } |
2708 | 2708 | ||
2709 | static struct drm_i915_gem_request * | ||
2710 | ring_last_request(struct intel_engine_cs *ring) | ||
2711 | { | ||
2712 | return list_entry(ring->request_list.prev, | ||
2713 | struct drm_i915_gem_request, list); | ||
2714 | } | ||
2715 | |||
2716 | static bool | 2709 | static bool |
2717 | ring_idle(struct intel_engine_cs *ring) | 2710 | ring_idle(struct intel_engine_cs *ring, u32 seqno) |
2718 | { | 2711 | { |
2719 | return (list_empty(&ring->request_list) || | 2712 | return (list_empty(&ring->request_list) || |
2720 | i915_gem_request_completed(ring_last_request(ring), false)); | 2713 | i915_seqno_passed(seqno, ring->last_submitted_seqno)); |
2721 | } | 2714 | } |
2722 | 2715 | ||
2723 | static bool | 2716 | static bool |
@@ -2939,7 +2932,7 @@ static void i915_hangcheck_elapsed(struct work_struct *work) | |||
2939 | acthd = intel_ring_get_active_head(ring); | 2932 | acthd = intel_ring_get_active_head(ring); |
2940 | 2933 | ||
2941 | if (ring->hangcheck.seqno == seqno) { | 2934 | if (ring->hangcheck.seqno == seqno) { |
2942 | if (ring_idle(ring)) { | 2935 | if (ring_idle(ring, seqno)) { |
2943 | ring->hangcheck.action = HANGCHECK_IDLE; | 2936 | ring->hangcheck.action = HANGCHECK_IDLE; |
2944 | 2937 | ||
2945 | if (waitqueue_active(&ring->irq_queue)) { | 2938 | if (waitqueue_active(&ring->irq_queue)) { |
diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h index 497cba5deb1e..849a2590e010 100644 --- a/drivers/gpu/drm/i915/i915_trace.h +++ b/drivers/gpu/drm/i915/i915_trace.h | |||
@@ -727,7 +727,7 @@ DECLARE_EVENT_CLASS(i915_context, | |||
727 | TP_fast_assign( | 727 | TP_fast_assign( |
728 | __entry->ctx = ctx; | 728 | __entry->ctx = ctx; |
729 | __entry->vm = ctx->ppgtt ? &ctx->ppgtt->base : NULL; | 729 | __entry->vm = ctx->ppgtt ? &ctx->ppgtt->base : NULL; |
730 | __entry->dev = ctx->file_priv->dev_priv->dev->primary->index; | 730 | __entry->dev = ctx->i915->dev->primary->index; |
731 | ), | 731 | ), |
732 | 732 | ||
733 | TP_printk("dev=%u, ctx=%p, ctx_vm=%p", | 733 | TP_printk("dev=%u, ctx=%p, ctx_vm=%p", |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 1b61f9810387..30e0f54ba19d 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -4854,6 +4854,9 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc) | |||
4854 | struct intel_plane *intel_plane; | 4854 | struct intel_plane *intel_plane; |
4855 | int pipe = intel_crtc->pipe; | 4855 | int pipe = intel_crtc->pipe; |
4856 | 4856 | ||
4857 | if (!intel_crtc->active) | ||
4858 | return; | ||
4859 | |||
4857 | intel_crtc_wait_for_pending_flips(crtc); | 4860 | intel_crtc_wait_for_pending_flips(crtc); |
4858 | 4861 | ||
4859 | intel_pre_disable_primary(crtc); | 4862 | intel_pre_disable_primary(crtc); |
@@ -6312,9 +6315,6 @@ static void intel_crtc_disable(struct drm_crtc *crtc) | |||
6312 | struct drm_connector *connector; | 6315 | struct drm_connector *connector; |
6313 | struct drm_i915_private *dev_priv = dev->dev_private; | 6316 | struct drm_i915_private *dev_priv = dev->dev_private; |
6314 | 6317 | ||
6315 | /* crtc should still be enabled when we disable it. */ | ||
6316 | WARN_ON(!crtc->state->enable); | ||
6317 | |||
6318 | intel_crtc_disable_planes(crtc); | 6318 | intel_crtc_disable_planes(crtc); |
6319 | dev_priv->display.crtc_disable(crtc); | 6319 | dev_priv->display.crtc_disable(crtc); |
6320 | dev_priv->display.off(crtc); | 6320 | dev_priv->display.off(crtc); |
@@ -7887,7 +7887,7 @@ static void chv_crtc_clock_get(struct intel_crtc *crtc, | |||
7887 | int pipe = pipe_config->cpu_transcoder; | 7887 | int pipe = pipe_config->cpu_transcoder; |
7888 | enum dpio_channel port = vlv_pipe_to_channel(pipe); | 7888 | enum dpio_channel port = vlv_pipe_to_channel(pipe); |
7889 | intel_clock_t clock; | 7889 | intel_clock_t clock; |
7890 | u32 cmn_dw13, pll_dw0, pll_dw1, pll_dw2; | 7890 | u32 cmn_dw13, pll_dw0, pll_dw1, pll_dw2, pll_dw3; |
7891 | int refclk = 100000; | 7891 | int refclk = 100000; |
7892 | 7892 | ||
7893 | mutex_lock(&dev_priv->sb_lock); | 7893 | mutex_lock(&dev_priv->sb_lock); |
@@ -7895,10 +7895,13 @@ static void chv_crtc_clock_get(struct intel_crtc *crtc, | |||
7895 | pll_dw0 = vlv_dpio_read(dev_priv, pipe, CHV_PLL_DW0(port)); | 7895 | pll_dw0 = vlv_dpio_read(dev_priv, pipe, CHV_PLL_DW0(port)); |
7896 | pll_dw1 = vlv_dpio_read(dev_priv, pipe, CHV_PLL_DW1(port)); | 7896 | pll_dw1 = vlv_dpio_read(dev_priv, pipe, CHV_PLL_DW1(port)); |
7897 | pll_dw2 = vlv_dpio_read(dev_priv, pipe, CHV_PLL_DW2(port)); | 7897 | pll_dw2 = vlv_dpio_read(dev_priv, pipe, CHV_PLL_DW2(port)); |
7898 | pll_dw3 = vlv_dpio_read(dev_priv, pipe, CHV_PLL_DW3(port)); | ||
7898 | mutex_unlock(&dev_priv->sb_lock); | 7899 | mutex_unlock(&dev_priv->sb_lock); |
7899 | 7900 | ||
7900 | clock.m1 = (pll_dw1 & 0x7) == DPIO_CHV_M1_DIV_BY_2 ? 2 : 0; | 7901 | clock.m1 = (pll_dw1 & 0x7) == DPIO_CHV_M1_DIV_BY_2 ? 2 : 0; |
7901 | clock.m2 = ((pll_dw0 & 0xff) << 22) | (pll_dw2 & 0x3fffff); | 7902 | clock.m2 = (pll_dw0 & 0xff) << 22; |
7903 | if (pll_dw3 & DPIO_CHV_FRAC_DIV_EN) | ||
7904 | clock.m2 |= pll_dw2 & 0x3fffff; | ||
7902 | clock.n = (pll_dw1 >> DPIO_CHV_N_DIV_SHIFT) & 0xf; | 7905 | clock.n = (pll_dw1 >> DPIO_CHV_N_DIV_SHIFT) & 0xf; |
7903 | clock.p1 = (cmn_dw13 >> DPIO_CHV_P1_DIV_SHIFT) & 0x7; | 7906 | clock.p1 = (cmn_dw13 >> DPIO_CHV_P1_DIV_SHIFT) & 0x7; |
7904 | clock.p2 = (cmn_dw13 >> DPIO_CHV_P2_DIV_SHIFT) & 0x1f; | 7907 | clock.p2 = (cmn_dw13 >> DPIO_CHV_P2_DIV_SHIFT) & 0x1f; |
@@ -12585,7 +12588,8 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc, | |||
12585 | continue; | 12588 | continue; |
12586 | 12589 | ||
12587 | if (!crtc_state->enable) { | 12590 | if (!crtc_state->enable) { |
12588 | intel_crtc_disable(crtc); | 12591 | if (crtc->state->enable) |
12592 | intel_crtc_disable(crtc); | ||
12589 | } else if (crtc->state->enable) { | 12593 | } else if (crtc->state->enable) { |
12590 | intel_crtc_disable_planes(crtc); | 12594 | intel_crtc_disable_planes(crtc); |
12591 | dev_priv->display.crtc_disable(crtc); | 12595 | dev_priv->display.crtc_disable(crtc); |
@@ -13270,7 +13274,7 @@ intel_check_primary_plane(struct drm_plane *plane, | |||
13270 | if (ret) | 13274 | if (ret) |
13271 | return ret; | 13275 | return ret; |
13272 | 13276 | ||
13273 | if (intel_crtc->active) { | 13277 | if (crtc_state ? crtc_state->base.active : intel_crtc->active) { |
13274 | struct intel_plane_state *old_state = | 13278 | struct intel_plane_state *old_state = |
13275 | to_intel_plane_state(plane->state); | 13279 | to_intel_plane_state(plane->state); |
13276 | 13280 | ||
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index e539314ae87e..4be66f60504d 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h | |||
@@ -275,6 +275,13 @@ struct intel_engine_cs { | |||
275 | * Do we have some not yet emitted requests outstanding? | 275 | * Do we have some not yet emitted requests outstanding? |
276 | */ | 276 | */ |
277 | struct drm_i915_gem_request *outstanding_lazy_request; | 277 | struct drm_i915_gem_request *outstanding_lazy_request; |
278 | /** | ||
279 | * Seqno of request most recently submitted to request_list. | ||
280 | * Used exclusively by hang checker to avoid grabbing lock while | ||
281 | * inspecting request list. | ||
282 | */ | ||
283 | u32 last_submitted_seqno; | ||
284 | |||
278 | bool gpu_caches_dirty; | 285 | bool gpu_caches_dirty; |
279 | 286 | ||
280 | wait_queue_head_t irq_queue; | 287 | wait_queue_head_t irq_queue; |
diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index a6d8a3ee7750..260389acfb77 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c | |||
@@ -1274,10 +1274,12 @@ int i915_reg_read_ioctl(struct drm_device *dev, | |||
1274 | struct drm_i915_private *dev_priv = dev->dev_private; | 1274 | struct drm_i915_private *dev_priv = dev->dev_private; |
1275 | struct drm_i915_reg_read *reg = data; | 1275 | struct drm_i915_reg_read *reg = data; |
1276 | struct register_whitelist const *entry = whitelist; | 1276 | struct register_whitelist const *entry = whitelist; |
1277 | unsigned size; | ||
1278 | u64 offset; | ||
1277 | int i, ret = 0; | 1279 | int i, ret = 0; |
1278 | 1280 | ||
1279 | for (i = 0; i < ARRAY_SIZE(whitelist); i++, entry++) { | 1281 | for (i = 0; i < ARRAY_SIZE(whitelist); i++, entry++) { |
1280 | if (entry->offset == reg->offset && | 1282 | if (entry->offset == (reg->offset & -entry->size) && |
1281 | (1 << INTEL_INFO(dev)->gen & entry->gen_bitmask)) | 1283 | (1 << INTEL_INFO(dev)->gen & entry->gen_bitmask)) |
1282 | break; | 1284 | break; |
1283 | } | 1285 | } |
@@ -1285,23 +1287,33 @@ int i915_reg_read_ioctl(struct drm_device *dev, | |||
1285 | if (i == ARRAY_SIZE(whitelist)) | 1287 | if (i == ARRAY_SIZE(whitelist)) |
1286 | return -EINVAL; | 1288 | return -EINVAL; |
1287 | 1289 | ||
1290 | /* We use the low bits to encode extra flags as the register should | ||
1291 | * be naturally aligned (and those that are not so aligned merely | ||
1292 | * limit the available flags for that register). | ||
1293 | */ | ||
1294 | offset = entry->offset; | ||
1295 | size = entry->size; | ||
1296 | size |= reg->offset ^ offset; | ||
1297 | |||
1288 | intel_runtime_pm_get(dev_priv); | 1298 | intel_runtime_pm_get(dev_priv); |
1289 | 1299 | ||
1290 | switch (entry->size) { | 1300 | switch (size) { |
1301 | case 8 | 1: | ||
1302 | reg->val = I915_READ64_2x32(offset, offset+4); | ||
1303 | break; | ||
1291 | case 8: | 1304 | case 8: |
1292 | reg->val = I915_READ64(reg->offset); | 1305 | reg->val = I915_READ64(offset); |
1293 | break; | 1306 | break; |
1294 | case 4: | 1307 | case 4: |
1295 | reg->val = I915_READ(reg->offset); | 1308 | reg->val = I915_READ(offset); |
1296 | break; | 1309 | break; |
1297 | case 2: | 1310 | case 2: |
1298 | reg->val = I915_READ16(reg->offset); | 1311 | reg->val = I915_READ16(offset); |
1299 | break; | 1312 | break; |
1300 | case 1: | 1313 | case 1: |
1301 | reg->val = I915_READ8(reg->offset); | 1314 | reg->val = I915_READ8(offset); |
1302 | break; | 1315 | break; |
1303 | default: | 1316 | default: |
1304 | MISSING_CASE(entry->size); | ||
1305 | ret = -EINVAL; | 1317 | ret = -EINVAL; |
1306 | goto out; | 1318 | goto out; |
1307 | } | 1319 | } |
diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c index 214eceefc981..e671ad369416 100644 --- a/drivers/gpu/drm/imx/imx-tve.c +++ b/drivers/gpu/drm/imx/imx-tve.c | |||
@@ -301,7 +301,7 @@ static void imx_tve_encoder_prepare(struct drm_encoder *encoder) | |||
301 | 301 | ||
302 | switch (tve->mode) { | 302 | switch (tve->mode) { |
303 | case TVE_MODE_VGA: | 303 | case TVE_MODE_VGA: |
304 | imx_drm_set_bus_format_pins(encoder, MEDIA_BUS_FMT_YUV8_1X24, | 304 | imx_drm_set_bus_format_pins(encoder, MEDIA_BUS_FMT_GBR888_1X24, |
305 | tve->hsync_pin, tve->vsync_pin); | 305 | tve->hsync_pin, tve->vsync_pin); |
306 | break; | 306 | break; |
307 | case TVE_MODE_TVOUT: | 307 | case TVE_MODE_TVOUT: |
diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c index 74a9ce40ddc4..b4deb9cf9d71 100644 --- a/drivers/gpu/drm/imx/parallel-display.c +++ b/drivers/gpu/drm/imx/parallel-display.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <drm/drm_panel.h> | 21 | #include <drm/drm_panel.h> |
22 | #include <linux/videodev2.h> | 22 | #include <linux/videodev2.h> |
23 | #include <video/of_display_timing.h> | 23 | #include <video/of_display_timing.h> |
24 | #include <linux/of_graph.h> | ||
24 | 25 | ||
25 | #include "imx-drm.h" | 26 | #include "imx-drm.h" |
26 | 27 | ||
@@ -208,7 +209,7 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) | |||
208 | { | 209 | { |
209 | struct drm_device *drm = data; | 210 | struct drm_device *drm = data; |
210 | struct device_node *np = dev->of_node; | 211 | struct device_node *np = dev->of_node; |
211 | struct device_node *panel_node; | 212 | struct device_node *port; |
212 | const u8 *edidp; | 213 | const u8 *edidp; |
213 | struct imx_parallel_display *imxpd; | 214 | struct imx_parallel_display *imxpd; |
214 | int ret; | 215 | int ret; |
@@ -234,11 +235,19 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) | |||
234 | imxpd->bus_format = MEDIA_BUS_FMT_RGB666_1X24_CPADHI; | 235 | imxpd->bus_format = MEDIA_BUS_FMT_RGB666_1X24_CPADHI; |
235 | } | 236 | } |
236 | 237 | ||
237 | panel_node = of_parse_phandle(np, "fsl,panel", 0); | 238 | /* port@1 is the output port */ |
238 | if (panel_node) { | 239 | port = of_graph_get_port_by_id(np, 1); |
239 | imxpd->panel = of_drm_find_panel(panel_node); | 240 | if (port) { |
240 | if (!imxpd->panel) | 241 | struct device_node *endpoint, *remote; |
241 | return -EPROBE_DEFER; | 242 | |
243 | endpoint = of_get_child_by_name(port, "endpoint"); | ||
244 | if (endpoint) { | ||
245 | remote = of_graph_get_remote_port_parent(endpoint); | ||
246 | if (remote) | ||
247 | imxpd->panel = of_drm_find_panel(remote); | ||
248 | if (!imxpd->panel) | ||
249 | return -EPROBE_DEFER; | ||
250 | } | ||
242 | } | 251 | } |
243 | 252 | ||
244 | imxpd->dev = dev; | 253 | imxpd->dev = dev; |
diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c index f2daad8c3d96..7841970de48d 100644 --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | |||
@@ -285,7 +285,7 @@ static int dmm_txn_commit(struct dmm_txn *txn, bool wait) | |||
285 | 285 | ||
286 | if (wait) { | 286 | if (wait) { |
287 | if (!wait_for_completion_timeout(&engine->compl, | 287 | if (!wait_for_completion_timeout(&engine->compl, |
288 | msecs_to_jiffies(1))) { | 288 | msecs_to_jiffies(100))) { |
289 | dev_err(dmm->dev, "timed out waiting for done\n"); | 289 | dev_err(dmm->dev, "timed out waiting for done\n"); |
290 | ret = -ETIMEDOUT; | 290 | ret = -ETIMEDOUT; |
291 | } | 291 | } |
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index ae2df41f216f..12081e61d45a 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h | |||
@@ -177,7 +177,7 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, | |||
177 | struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_object **bos); | 177 | struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_object **bos); |
178 | struct drm_gem_object *omap_framebuffer_bo(struct drm_framebuffer *fb, int p); | 178 | struct drm_gem_object *omap_framebuffer_bo(struct drm_framebuffer *fb, int p); |
179 | int omap_framebuffer_pin(struct drm_framebuffer *fb); | 179 | int omap_framebuffer_pin(struct drm_framebuffer *fb); |
180 | int omap_framebuffer_unpin(struct drm_framebuffer *fb); | 180 | void omap_framebuffer_unpin(struct drm_framebuffer *fb); |
181 | void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, | 181 | void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, |
182 | struct omap_drm_window *win, struct omap_overlay_info *info); | 182 | struct omap_drm_window *win, struct omap_overlay_info *info); |
183 | struct drm_connector *omap_framebuffer_get_next_connector( | 183 | struct drm_connector *omap_framebuffer_get_next_connector( |
@@ -211,7 +211,7 @@ void omap_gem_dma_sync(struct drm_gem_object *obj, | |||
211 | enum dma_data_direction dir); | 211 | enum dma_data_direction dir); |
212 | int omap_gem_get_paddr(struct drm_gem_object *obj, | 212 | int omap_gem_get_paddr(struct drm_gem_object *obj, |
213 | dma_addr_t *paddr, bool remap); | 213 | dma_addr_t *paddr, bool remap); |
214 | int omap_gem_put_paddr(struct drm_gem_object *obj); | 214 | void omap_gem_put_paddr(struct drm_gem_object *obj); |
215 | int omap_gem_get_pages(struct drm_gem_object *obj, struct page ***pages, | 215 | int omap_gem_get_pages(struct drm_gem_object *obj, struct page ***pages, |
216 | bool remap); | 216 | bool remap); |
217 | int omap_gem_put_pages(struct drm_gem_object *obj); | 217 | int omap_gem_put_pages(struct drm_gem_object *obj); |
@@ -236,7 +236,7 @@ static inline int align_pitch(int pitch, int width, int bpp) | |||
236 | /* PVR needs alignment to 8 pixels.. right now that is the most | 236 | /* PVR needs alignment to 8 pixels.. right now that is the most |
237 | * restrictive stride requirement.. | 237 | * restrictive stride requirement.. |
238 | */ | 238 | */ |
239 | return ALIGN(pitch, 8 * bytespp); | 239 | return roundup(pitch, 8 * bytespp); |
240 | } | 240 | } |
241 | 241 | ||
242 | /* map crtc to vblank mask */ | 242 | /* map crtc to vblank mask */ |
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c index 0b967e76df1a..51b1219af87f 100644 --- a/drivers/gpu/drm/omapdrm/omap_fb.c +++ b/drivers/gpu/drm/omapdrm/omap_fb.c | |||
@@ -287,10 +287,10 @@ fail: | |||
287 | } | 287 | } |
288 | 288 | ||
289 | /* unpin, no longer being scanned out: */ | 289 | /* unpin, no longer being scanned out: */ |
290 | int omap_framebuffer_unpin(struct drm_framebuffer *fb) | 290 | void omap_framebuffer_unpin(struct drm_framebuffer *fb) |
291 | { | 291 | { |
292 | struct omap_framebuffer *omap_fb = to_omap_framebuffer(fb); | 292 | struct omap_framebuffer *omap_fb = to_omap_framebuffer(fb); |
293 | int ret, i, n = drm_format_num_planes(fb->pixel_format); | 293 | int i, n = drm_format_num_planes(fb->pixel_format); |
294 | 294 | ||
295 | mutex_lock(&omap_fb->lock); | 295 | mutex_lock(&omap_fb->lock); |
296 | 296 | ||
@@ -298,24 +298,16 @@ int omap_framebuffer_unpin(struct drm_framebuffer *fb) | |||
298 | 298 | ||
299 | if (omap_fb->pin_count > 0) { | 299 | if (omap_fb->pin_count > 0) { |
300 | mutex_unlock(&omap_fb->lock); | 300 | mutex_unlock(&omap_fb->lock); |
301 | return 0; | 301 | return; |
302 | } | 302 | } |
303 | 303 | ||
304 | for (i = 0; i < n; i++) { | 304 | for (i = 0; i < n; i++) { |
305 | struct plane *plane = &omap_fb->planes[i]; | 305 | struct plane *plane = &omap_fb->planes[i]; |
306 | ret = omap_gem_put_paddr(plane->bo); | 306 | omap_gem_put_paddr(plane->bo); |
307 | if (ret) | ||
308 | goto fail; | ||
309 | plane->paddr = 0; | 307 | plane->paddr = 0; |
310 | } | 308 | } |
311 | 309 | ||
312 | mutex_unlock(&omap_fb->lock); | 310 | mutex_unlock(&omap_fb->lock); |
313 | |||
314 | return 0; | ||
315 | |||
316 | fail: | ||
317 | mutex_unlock(&omap_fb->lock); | ||
318 | return ret; | ||
319 | } | 311 | } |
320 | 312 | ||
321 | struct drm_gem_object *omap_framebuffer_bo(struct drm_framebuffer *fb, int p) | 313 | struct drm_gem_object *omap_framebuffer_bo(struct drm_framebuffer *fb, int p) |
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index 23b5a84389e3..720d16bce7e8 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c | |||
@@ -135,7 +135,7 @@ static int omap_fbdev_create(struct drm_fb_helper *helper, | |||
135 | fbdev->ywrap_enabled = priv->has_dmm && ywrap_enabled; | 135 | fbdev->ywrap_enabled = priv->has_dmm && ywrap_enabled; |
136 | if (fbdev->ywrap_enabled) { | 136 | if (fbdev->ywrap_enabled) { |
137 | /* need to align pitch to page size if using DMM scrolling */ | 137 | /* need to align pitch to page size if using DMM scrolling */ |
138 | mode_cmd.pitches[0] = ALIGN(mode_cmd.pitches[0], PAGE_SIZE); | 138 | mode_cmd.pitches[0] = PAGE_ALIGN(mode_cmd.pitches[0]); |
139 | } | 139 | } |
140 | 140 | ||
141 | /* allocate backing bo */ | 141 | /* allocate backing bo */ |
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index 2ab77801cf5f..7ed08fdc4c42 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c | |||
@@ -808,10 +808,10 @@ fail: | |||
808 | /* Release physical address, when DMA is no longer being performed.. this | 808 | /* Release physical address, when DMA is no longer being performed.. this |
809 | * could potentially unpin and unmap buffers from TILER | 809 | * could potentially unpin and unmap buffers from TILER |
810 | */ | 810 | */ |
811 | int omap_gem_put_paddr(struct drm_gem_object *obj) | 811 | void omap_gem_put_paddr(struct drm_gem_object *obj) |
812 | { | 812 | { |
813 | struct omap_gem_object *omap_obj = to_omap_bo(obj); | 813 | struct omap_gem_object *omap_obj = to_omap_bo(obj); |
814 | int ret = 0; | 814 | int ret; |
815 | 815 | ||
816 | mutex_lock(&obj->dev->struct_mutex); | 816 | mutex_lock(&obj->dev->struct_mutex); |
817 | if (omap_obj->paddr_cnt > 0) { | 817 | if (omap_obj->paddr_cnt > 0) { |
@@ -821,7 +821,6 @@ int omap_gem_put_paddr(struct drm_gem_object *obj) | |||
821 | if (ret) { | 821 | if (ret) { |
822 | dev_err(obj->dev->dev, | 822 | dev_err(obj->dev->dev, |
823 | "could not unpin pages: %d\n", ret); | 823 | "could not unpin pages: %d\n", ret); |
824 | goto fail; | ||
825 | } | 824 | } |
826 | ret = tiler_release(omap_obj->block); | 825 | ret = tiler_release(omap_obj->block); |
827 | if (ret) { | 826 | if (ret) { |
@@ -832,9 +831,8 @@ int omap_gem_put_paddr(struct drm_gem_object *obj) | |||
832 | omap_obj->block = NULL; | 831 | omap_obj->block = NULL; |
833 | } | 832 | } |
834 | } | 833 | } |
835 | fail: | 834 | |
836 | mutex_unlock(&obj->dev->struct_mutex); | 835 | mutex_unlock(&obj->dev->struct_mutex); |
837 | return ret; | ||
838 | } | 836 | } |
839 | 837 | ||
840 | /* Get rotated scanout address (only valid if already pinned), at the | 838 | /* Get rotated scanout address (only valid if already pinned), at the |
@@ -1378,11 +1376,7 @@ struct drm_gem_object *omap_gem_new(struct drm_device *dev, | |||
1378 | 1376 | ||
1379 | omap_obj = kzalloc(sizeof(*omap_obj), GFP_KERNEL); | 1377 | omap_obj = kzalloc(sizeof(*omap_obj), GFP_KERNEL); |
1380 | if (!omap_obj) | 1378 | if (!omap_obj) |
1381 | goto fail; | 1379 | return NULL; |
1382 | |||
1383 | spin_lock(&priv->list_lock); | ||
1384 | list_add(&omap_obj->mm_list, &priv->obj_list); | ||
1385 | spin_unlock(&priv->list_lock); | ||
1386 | 1380 | ||
1387 | obj = &omap_obj->base; | 1381 | obj = &omap_obj->base; |
1388 | 1382 | ||
@@ -1392,11 +1386,19 @@ struct drm_gem_object *omap_gem_new(struct drm_device *dev, | |||
1392 | */ | 1386 | */ |
1393 | omap_obj->vaddr = dma_alloc_writecombine(dev->dev, size, | 1387 | omap_obj->vaddr = dma_alloc_writecombine(dev->dev, size, |
1394 | &omap_obj->paddr, GFP_KERNEL); | 1388 | &omap_obj->paddr, GFP_KERNEL); |
1395 | if (omap_obj->vaddr) | 1389 | if (!omap_obj->vaddr) { |
1396 | flags |= OMAP_BO_DMA; | 1390 | kfree(omap_obj); |
1391 | |||
1392 | return NULL; | ||
1393 | } | ||
1397 | 1394 | ||
1395 | flags |= OMAP_BO_DMA; | ||
1398 | } | 1396 | } |
1399 | 1397 | ||
1398 | spin_lock(&priv->list_lock); | ||
1399 | list_add(&omap_obj->mm_list, &priv->obj_list); | ||
1400 | spin_unlock(&priv->list_lock); | ||
1401 | |||
1400 | omap_obj->flags = flags; | 1402 | omap_obj->flags = flags; |
1401 | 1403 | ||
1402 | if (flags & OMAP_BO_TILED) { | 1404 | if (flags & OMAP_BO_TILED) { |
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index cfa8276c4deb..098904696a5c 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * this program. If not, see <http://www.gnu.org/licenses/>. | 17 | * this program. If not, see <http://www.gnu.org/licenses/>. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <drm/drm_atomic.h> | ||
20 | #include <drm/drm_atomic_helper.h> | 21 | #include <drm/drm_atomic_helper.h> |
21 | #include <drm/drm_plane_helper.h> | 22 | #include <drm/drm_plane_helper.h> |
22 | 23 | ||
@@ -153,9 +154,34 @@ static void omap_plane_atomic_disable(struct drm_plane *plane, | |||
153 | dispc_ovl_enable(omap_plane->id, false); | 154 | dispc_ovl_enable(omap_plane->id, false); |
154 | } | 155 | } |
155 | 156 | ||
157 | static int omap_plane_atomic_check(struct drm_plane *plane, | ||
158 | struct drm_plane_state *state) | ||
159 | { | ||
160 | struct drm_crtc_state *crtc_state; | ||
161 | |||
162 | if (!state->crtc) | ||
163 | return 0; | ||
164 | |||
165 | crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc); | ||
166 | if (IS_ERR(crtc_state)) | ||
167 | return PTR_ERR(crtc_state); | ||
168 | |||
169 | if (state->crtc_x < 0 || state->crtc_y < 0) | ||
170 | return -EINVAL; | ||
171 | |||
172 | if (state->crtc_x + state->crtc_w > crtc_state->adjusted_mode.hdisplay) | ||
173 | return -EINVAL; | ||
174 | |||
175 | if (state->crtc_y + state->crtc_h > crtc_state->adjusted_mode.vdisplay) | ||
176 | return -EINVAL; | ||
177 | |||
178 | return 0; | ||
179 | } | ||
180 | |||
156 | static const struct drm_plane_helper_funcs omap_plane_helper_funcs = { | 181 | static const struct drm_plane_helper_funcs omap_plane_helper_funcs = { |
157 | .prepare_fb = omap_plane_prepare_fb, | 182 | .prepare_fb = omap_plane_prepare_fb, |
158 | .cleanup_fb = omap_plane_cleanup_fb, | 183 | .cleanup_fb = omap_plane_cleanup_fb, |
184 | .atomic_check = omap_plane_atomic_check, | ||
159 | .atomic_update = omap_plane_atomic_update, | 185 | .atomic_update = omap_plane_atomic_update, |
160 | .atomic_disable = omap_plane_atomic_disable, | 186 | .atomic_disable = omap_plane_atomic_disable, |
161 | }; | 187 | }; |
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c index 8730562323a8..4a09947be244 100644 --- a/drivers/gpu/drm/radeon/ci_dpm.c +++ b/drivers/gpu/drm/radeon/ci_dpm.c | |||
@@ -5818,7 +5818,7 @@ int ci_dpm_init(struct radeon_device *rdev) | |||
5818 | tmp |= DPM_ENABLED; | 5818 | tmp |= DPM_ENABLED; |
5819 | break; | 5819 | break; |
5820 | default: | 5820 | default: |
5821 | DRM_ERROR("Invalid PCC GPIO: %u!\n", gpio.shift); | 5821 | DRM_DEBUG("Invalid PCC GPIO: %u!\n", gpio.shift); |
5822 | break; | 5822 | break; |
5823 | } | 5823 | } |
5824 | WREG32_SMC(CNB_PWRMGT_CNTL, tmp); | 5824 | WREG32_SMC(CNB_PWRMGT_CNTL, tmp); |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 4ecf5caa8c6d..248953d2fdb7 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -7964,23 +7964,27 @@ restart_ih: | |||
7964 | case 1: /* D1 vblank/vline */ | 7964 | case 1: /* D1 vblank/vline */ |
7965 | switch (src_data) { | 7965 | switch (src_data) { |
7966 | case 0: /* D1 vblank */ | 7966 | case 0: /* D1 vblank */ |
7967 | if (rdev->irq.stat_regs.cik.disp_int & LB_D1_VBLANK_INTERRUPT) { | 7967 | if (!(rdev->irq.stat_regs.cik.disp_int & LB_D1_VBLANK_INTERRUPT)) |
7968 | if (rdev->irq.crtc_vblank_int[0]) { | 7968 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
7969 | drm_handle_vblank(rdev->ddev, 0); | 7969 | |
7970 | rdev->pm.vblank_sync = true; | 7970 | if (rdev->irq.crtc_vblank_int[0]) { |
7971 | wake_up(&rdev->irq.vblank_queue); | 7971 | drm_handle_vblank(rdev->ddev, 0); |
7972 | } | 7972 | rdev->pm.vblank_sync = true; |
7973 | if (atomic_read(&rdev->irq.pflip[0])) | 7973 | wake_up(&rdev->irq.vblank_queue); |
7974 | radeon_crtc_handle_vblank(rdev, 0); | ||
7975 | rdev->irq.stat_regs.cik.disp_int &= ~LB_D1_VBLANK_INTERRUPT; | ||
7976 | DRM_DEBUG("IH: D1 vblank\n"); | ||
7977 | } | 7974 | } |
7975 | if (atomic_read(&rdev->irq.pflip[0])) | ||
7976 | radeon_crtc_handle_vblank(rdev, 0); | ||
7977 | rdev->irq.stat_regs.cik.disp_int &= ~LB_D1_VBLANK_INTERRUPT; | ||
7978 | DRM_DEBUG("IH: D1 vblank\n"); | ||
7979 | |||
7978 | break; | 7980 | break; |
7979 | case 1: /* D1 vline */ | 7981 | case 1: /* D1 vline */ |
7980 | if (rdev->irq.stat_regs.cik.disp_int & LB_D1_VLINE_INTERRUPT) { | 7982 | if (!(rdev->irq.stat_regs.cik.disp_int & LB_D1_VLINE_INTERRUPT)) |
7981 | rdev->irq.stat_regs.cik.disp_int &= ~LB_D1_VLINE_INTERRUPT; | 7983 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
7982 | DRM_DEBUG("IH: D1 vline\n"); | 7984 | |
7983 | } | 7985 | rdev->irq.stat_regs.cik.disp_int &= ~LB_D1_VLINE_INTERRUPT; |
7986 | DRM_DEBUG("IH: D1 vline\n"); | ||
7987 | |||
7984 | break; | 7988 | break; |
7985 | default: | 7989 | default: |
7986 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 7990 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -7990,23 +7994,27 @@ restart_ih: | |||
7990 | case 2: /* D2 vblank/vline */ | 7994 | case 2: /* D2 vblank/vline */ |
7991 | switch (src_data) { | 7995 | switch (src_data) { |
7992 | case 0: /* D2 vblank */ | 7996 | case 0: /* D2 vblank */ |
7993 | if (rdev->irq.stat_regs.cik.disp_int_cont & LB_D2_VBLANK_INTERRUPT) { | 7997 | if (!(rdev->irq.stat_regs.cik.disp_int_cont & LB_D2_VBLANK_INTERRUPT)) |
7994 | if (rdev->irq.crtc_vblank_int[1]) { | 7998 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
7995 | drm_handle_vblank(rdev->ddev, 1); | 7999 | |
7996 | rdev->pm.vblank_sync = true; | 8000 | if (rdev->irq.crtc_vblank_int[1]) { |
7997 | wake_up(&rdev->irq.vblank_queue); | 8001 | drm_handle_vblank(rdev->ddev, 1); |
7998 | } | 8002 | rdev->pm.vblank_sync = true; |
7999 | if (atomic_read(&rdev->irq.pflip[1])) | 8003 | wake_up(&rdev->irq.vblank_queue); |
8000 | radeon_crtc_handle_vblank(rdev, 1); | ||
8001 | rdev->irq.stat_regs.cik.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT; | ||
8002 | DRM_DEBUG("IH: D2 vblank\n"); | ||
8003 | } | 8004 | } |
8005 | if (atomic_read(&rdev->irq.pflip[1])) | ||
8006 | radeon_crtc_handle_vblank(rdev, 1); | ||
8007 | rdev->irq.stat_regs.cik.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT; | ||
8008 | DRM_DEBUG("IH: D2 vblank\n"); | ||
8009 | |||
8004 | break; | 8010 | break; |
8005 | case 1: /* D2 vline */ | 8011 | case 1: /* D2 vline */ |
8006 | if (rdev->irq.stat_regs.cik.disp_int_cont & LB_D2_VLINE_INTERRUPT) { | 8012 | if (!(rdev->irq.stat_regs.cik.disp_int_cont & LB_D2_VLINE_INTERRUPT)) |
8007 | rdev->irq.stat_regs.cik.disp_int_cont &= ~LB_D2_VLINE_INTERRUPT; | 8013 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8008 | DRM_DEBUG("IH: D2 vline\n"); | 8014 | |
8009 | } | 8015 | rdev->irq.stat_regs.cik.disp_int_cont &= ~LB_D2_VLINE_INTERRUPT; |
8016 | DRM_DEBUG("IH: D2 vline\n"); | ||
8017 | |||
8010 | break; | 8018 | break; |
8011 | default: | 8019 | default: |
8012 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 8020 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -8016,23 +8024,27 @@ restart_ih: | |||
8016 | case 3: /* D3 vblank/vline */ | 8024 | case 3: /* D3 vblank/vline */ |
8017 | switch (src_data) { | 8025 | switch (src_data) { |
8018 | case 0: /* D3 vblank */ | 8026 | case 0: /* D3 vblank */ |
8019 | if (rdev->irq.stat_regs.cik.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT) { | 8027 | if (!(rdev->irq.stat_regs.cik.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT)) |
8020 | if (rdev->irq.crtc_vblank_int[2]) { | 8028 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8021 | drm_handle_vblank(rdev->ddev, 2); | 8029 | |
8022 | rdev->pm.vblank_sync = true; | 8030 | if (rdev->irq.crtc_vblank_int[2]) { |
8023 | wake_up(&rdev->irq.vblank_queue); | 8031 | drm_handle_vblank(rdev->ddev, 2); |
8024 | } | 8032 | rdev->pm.vblank_sync = true; |
8025 | if (atomic_read(&rdev->irq.pflip[2])) | 8033 | wake_up(&rdev->irq.vblank_queue); |
8026 | radeon_crtc_handle_vblank(rdev, 2); | ||
8027 | rdev->irq.stat_regs.cik.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT; | ||
8028 | DRM_DEBUG("IH: D3 vblank\n"); | ||
8029 | } | 8034 | } |
8035 | if (atomic_read(&rdev->irq.pflip[2])) | ||
8036 | radeon_crtc_handle_vblank(rdev, 2); | ||
8037 | rdev->irq.stat_regs.cik.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT; | ||
8038 | DRM_DEBUG("IH: D3 vblank\n"); | ||
8039 | |||
8030 | break; | 8040 | break; |
8031 | case 1: /* D3 vline */ | 8041 | case 1: /* D3 vline */ |
8032 | if (rdev->irq.stat_regs.cik.disp_int_cont2 & LB_D3_VLINE_INTERRUPT) { | 8042 | if (!(rdev->irq.stat_regs.cik.disp_int_cont2 & LB_D3_VLINE_INTERRUPT)) |
8033 | rdev->irq.stat_regs.cik.disp_int_cont2 &= ~LB_D3_VLINE_INTERRUPT; | 8043 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8034 | DRM_DEBUG("IH: D3 vline\n"); | 8044 | |
8035 | } | 8045 | rdev->irq.stat_regs.cik.disp_int_cont2 &= ~LB_D3_VLINE_INTERRUPT; |
8046 | DRM_DEBUG("IH: D3 vline\n"); | ||
8047 | |||
8036 | break; | 8048 | break; |
8037 | default: | 8049 | default: |
8038 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 8050 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -8042,23 +8054,27 @@ restart_ih: | |||
8042 | case 4: /* D4 vblank/vline */ | 8054 | case 4: /* D4 vblank/vline */ |
8043 | switch (src_data) { | 8055 | switch (src_data) { |
8044 | case 0: /* D4 vblank */ | 8056 | case 0: /* D4 vblank */ |
8045 | if (rdev->irq.stat_regs.cik.disp_int_cont3 & LB_D4_VBLANK_INTERRUPT) { | 8057 | if (!(rdev->irq.stat_regs.cik.disp_int_cont3 & LB_D4_VBLANK_INTERRUPT)) |
8046 | if (rdev->irq.crtc_vblank_int[3]) { | 8058 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8047 | drm_handle_vblank(rdev->ddev, 3); | 8059 | |
8048 | rdev->pm.vblank_sync = true; | 8060 | if (rdev->irq.crtc_vblank_int[3]) { |
8049 | wake_up(&rdev->irq.vblank_queue); | 8061 | drm_handle_vblank(rdev->ddev, 3); |
8050 | } | 8062 | rdev->pm.vblank_sync = true; |
8051 | if (atomic_read(&rdev->irq.pflip[3])) | 8063 | wake_up(&rdev->irq.vblank_queue); |
8052 | radeon_crtc_handle_vblank(rdev, 3); | ||
8053 | rdev->irq.stat_regs.cik.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT; | ||
8054 | DRM_DEBUG("IH: D4 vblank\n"); | ||
8055 | } | 8064 | } |
8065 | if (atomic_read(&rdev->irq.pflip[3])) | ||
8066 | radeon_crtc_handle_vblank(rdev, 3); | ||
8067 | rdev->irq.stat_regs.cik.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT; | ||
8068 | DRM_DEBUG("IH: D4 vblank\n"); | ||
8069 | |||
8056 | break; | 8070 | break; |
8057 | case 1: /* D4 vline */ | 8071 | case 1: /* D4 vline */ |
8058 | if (rdev->irq.stat_regs.cik.disp_int_cont3 & LB_D4_VLINE_INTERRUPT) { | 8072 | if (!(rdev->irq.stat_regs.cik.disp_int_cont3 & LB_D4_VLINE_INTERRUPT)) |
8059 | rdev->irq.stat_regs.cik.disp_int_cont3 &= ~LB_D4_VLINE_INTERRUPT; | 8073 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8060 | DRM_DEBUG("IH: D4 vline\n"); | 8074 | |
8061 | } | 8075 | rdev->irq.stat_regs.cik.disp_int_cont3 &= ~LB_D4_VLINE_INTERRUPT; |
8076 | DRM_DEBUG("IH: D4 vline\n"); | ||
8077 | |||
8062 | break; | 8078 | break; |
8063 | default: | 8079 | default: |
8064 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 8080 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -8068,23 +8084,27 @@ restart_ih: | |||
8068 | case 5: /* D5 vblank/vline */ | 8084 | case 5: /* D5 vblank/vline */ |
8069 | switch (src_data) { | 8085 | switch (src_data) { |
8070 | case 0: /* D5 vblank */ | 8086 | case 0: /* D5 vblank */ |
8071 | if (rdev->irq.stat_regs.cik.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT) { | 8087 | if (!(rdev->irq.stat_regs.cik.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT)) |
8072 | if (rdev->irq.crtc_vblank_int[4]) { | 8088 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8073 | drm_handle_vblank(rdev->ddev, 4); | 8089 | |
8074 | rdev->pm.vblank_sync = true; | 8090 | if (rdev->irq.crtc_vblank_int[4]) { |
8075 | wake_up(&rdev->irq.vblank_queue); | 8091 | drm_handle_vblank(rdev->ddev, 4); |
8076 | } | 8092 | rdev->pm.vblank_sync = true; |
8077 | if (atomic_read(&rdev->irq.pflip[4])) | 8093 | wake_up(&rdev->irq.vblank_queue); |
8078 | radeon_crtc_handle_vblank(rdev, 4); | ||
8079 | rdev->irq.stat_regs.cik.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT; | ||
8080 | DRM_DEBUG("IH: D5 vblank\n"); | ||
8081 | } | 8094 | } |
8095 | if (atomic_read(&rdev->irq.pflip[4])) | ||
8096 | radeon_crtc_handle_vblank(rdev, 4); | ||
8097 | rdev->irq.stat_regs.cik.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT; | ||
8098 | DRM_DEBUG("IH: D5 vblank\n"); | ||
8099 | |||
8082 | break; | 8100 | break; |
8083 | case 1: /* D5 vline */ | 8101 | case 1: /* D5 vline */ |
8084 | if (rdev->irq.stat_regs.cik.disp_int_cont4 & LB_D5_VLINE_INTERRUPT) { | 8102 | if (!(rdev->irq.stat_regs.cik.disp_int_cont4 & LB_D5_VLINE_INTERRUPT)) |
8085 | rdev->irq.stat_regs.cik.disp_int_cont4 &= ~LB_D5_VLINE_INTERRUPT; | 8103 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8086 | DRM_DEBUG("IH: D5 vline\n"); | 8104 | |
8087 | } | 8105 | rdev->irq.stat_regs.cik.disp_int_cont4 &= ~LB_D5_VLINE_INTERRUPT; |
8106 | DRM_DEBUG("IH: D5 vline\n"); | ||
8107 | |||
8088 | break; | 8108 | break; |
8089 | default: | 8109 | default: |
8090 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 8110 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -8094,23 +8114,27 @@ restart_ih: | |||
8094 | case 6: /* D6 vblank/vline */ | 8114 | case 6: /* D6 vblank/vline */ |
8095 | switch (src_data) { | 8115 | switch (src_data) { |
8096 | case 0: /* D6 vblank */ | 8116 | case 0: /* D6 vblank */ |
8097 | if (rdev->irq.stat_regs.cik.disp_int_cont5 & LB_D6_VBLANK_INTERRUPT) { | 8117 | if (!(rdev->irq.stat_regs.cik.disp_int_cont5 & LB_D6_VBLANK_INTERRUPT)) |
8098 | if (rdev->irq.crtc_vblank_int[5]) { | 8118 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8099 | drm_handle_vblank(rdev->ddev, 5); | 8119 | |
8100 | rdev->pm.vblank_sync = true; | 8120 | if (rdev->irq.crtc_vblank_int[5]) { |
8101 | wake_up(&rdev->irq.vblank_queue); | 8121 | drm_handle_vblank(rdev->ddev, 5); |
8102 | } | 8122 | rdev->pm.vblank_sync = true; |
8103 | if (atomic_read(&rdev->irq.pflip[5])) | 8123 | wake_up(&rdev->irq.vblank_queue); |
8104 | radeon_crtc_handle_vblank(rdev, 5); | ||
8105 | rdev->irq.stat_regs.cik.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT; | ||
8106 | DRM_DEBUG("IH: D6 vblank\n"); | ||
8107 | } | 8124 | } |
8125 | if (atomic_read(&rdev->irq.pflip[5])) | ||
8126 | radeon_crtc_handle_vblank(rdev, 5); | ||
8127 | rdev->irq.stat_regs.cik.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT; | ||
8128 | DRM_DEBUG("IH: D6 vblank\n"); | ||
8129 | |||
8108 | break; | 8130 | break; |
8109 | case 1: /* D6 vline */ | 8131 | case 1: /* D6 vline */ |
8110 | if (rdev->irq.stat_regs.cik.disp_int_cont5 & LB_D6_VLINE_INTERRUPT) { | 8132 | if (!(rdev->irq.stat_regs.cik.disp_int_cont5 & LB_D6_VLINE_INTERRUPT)) |
8111 | rdev->irq.stat_regs.cik.disp_int_cont5 &= ~LB_D6_VLINE_INTERRUPT; | 8133 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8112 | DRM_DEBUG("IH: D6 vline\n"); | 8134 | |
8113 | } | 8135 | rdev->irq.stat_regs.cik.disp_int_cont5 &= ~LB_D6_VLINE_INTERRUPT; |
8136 | DRM_DEBUG("IH: D6 vline\n"); | ||
8137 | |||
8114 | break; | 8138 | break; |
8115 | default: | 8139 | default: |
8116 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 8140 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -8130,88 +8154,112 @@ restart_ih: | |||
8130 | case 42: /* HPD hotplug */ | 8154 | case 42: /* HPD hotplug */ |
8131 | switch (src_data) { | 8155 | switch (src_data) { |
8132 | case 0: | 8156 | case 0: |
8133 | if (rdev->irq.stat_regs.cik.disp_int & DC_HPD1_INTERRUPT) { | 8157 | if (!(rdev->irq.stat_regs.cik.disp_int & DC_HPD1_INTERRUPT)) |
8134 | rdev->irq.stat_regs.cik.disp_int &= ~DC_HPD1_INTERRUPT; | 8158 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8135 | queue_hotplug = true; | 8159 | |
8136 | DRM_DEBUG("IH: HPD1\n"); | 8160 | rdev->irq.stat_regs.cik.disp_int &= ~DC_HPD1_INTERRUPT; |
8137 | } | 8161 | queue_hotplug = true; |
8162 | DRM_DEBUG("IH: HPD1\n"); | ||
8163 | |||
8138 | break; | 8164 | break; |
8139 | case 1: | 8165 | case 1: |
8140 | if (rdev->irq.stat_regs.cik.disp_int_cont & DC_HPD2_INTERRUPT) { | 8166 | if (!(rdev->irq.stat_regs.cik.disp_int_cont & DC_HPD2_INTERRUPT)) |
8141 | rdev->irq.stat_regs.cik.disp_int_cont &= ~DC_HPD2_INTERRUPT; | 8167 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8142 | queue_hotplug = true; | 8168 | |
8143 | DRM_DEBUG("IH: HPD2\n"); | 8169 | rdev->irq.stat_regs.cik.disp_int_cont &= ~DC_HPD2_INTERRUPT; |
8144 | } | 8170 | queue_hotplug = true; |
8171 | DRM_DEBUG("IH: HPD2\n"); | ||
8172 | |||
8145 | break; | 8173 | break; |
8146 | case 2: | 8174 | case 2: |
8147 | if (rdev->irq.stat_regs.cik.disp_int_cont2 & DC_HPD3_INTERRUPT) { | 8175 | if (!(rdev->irq.stat_regs.cik.disp_int_cont2 & DC_HPD3_INTERRUPT)) |
8148 | rdev->irq.stat_regs.cik.disp_int_cont2 &= ~DC_HPD3_INTERRUPT; | 8176 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8149 | queue_hotplug = true; | 8177 | |
8150 | DRM_DEBUG("IH: HPD3\n"); | 8178 | rdev->irq.stat_regs.cik.disp_int_cont2 &= ~DC_HPD3_INTERRUPT; |
8151 | } | 8179 | queue_hotplug = true; |
8180 | DRM_DEBUG("IH: HPD3\n"); | ||
8181 | |||
8152 | break; | 8182 | break; |
8153 | case 3: | 8183 | case 3: |
8154 | if (rdev->irq.stat_regs.cik.disp_int_cont3 & DC_HPD4_INTERRUPT) { | 8184 | if (!(rdev->irq.stat_regs.cik.disp_int_cont3 & DC_HPD4_INTERRUPT)) |
8155 | rdev->irq.stat_regs.cik.disp_int_cont3 &= ~DC_HPD4_INTERRUPT; | 8185 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8156 | queue_hotplug = true; | 8186 | |
8157 | DRM_DEBUG("IH: HPD4\n"); | 8187 | rdev->irq.stat_regs.cik.disp_int_cont3 &= ~DC_HPD4_INTERRUPT; |
8158 | } | 8188 | queue_hotplug = true; |
8189 | DRM_DEBUG("IH: HPD4\n"); | ||
8190 | |||
8159 | break; | 8191 | break; |
8160 | case 4: | 8192 | case 4: |
8161 | if (rdev->irq.stat_regs.cik.disp_int_cont4 & DC_HPD5_INTERRUPT) { | 8193 | if (!(rdev->irq.stat_regs.cik.disp_int_cont4 & DC_HPD5_INTERRUPT)) |
8162 | rdev->irq.stat_regs.cik.disp_int_cont4 &= ~DC_HPD5_INTERRUPT; | 8194 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8163 | queue_hotplug = true; | 8195 | |
8164 | DRM_DEBUG("IH: HPD5\n"); | 8196 | rdev->irq.stat_regs.cik.disp_int_cont4 &= ~DC_HPD5_INTERRUPT; |
8165 | } | 8197 | queue_hotplug = true; |
8198 | DRM_DEBUG("IH: HPD5\n"); | ||
8199 | |||
8166 | break; | 8200 | break; |
8167 | case 5: | 8201 | case 5: |
8168 | if (rdev->irq.stat_regs.cik.disp_int_cont5 & DC_HPD6_INTERRUPT) { | 8202 | if (!(rdev->irq.stat_regs.cik.disp_int_cont5 & DC_HPD6_INTERRUPT)) |
8169 | rdev->irq.stat_regs.cik.disp_int_cont5 &= ~DC_HPD6_INTERRUPT; | 8203 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8170 | queue_hotplug = true; | 8204 | |
8171 | DRM_DEBUG("IH: HPD6\n"); | 8205 | rdev->irq.stat_regs.cik.disp_int_cont5 &= ~DC_HPD6_INTERRUPT; |
8172 | } | 8206 | queue_hotplug = true; |
8207 | DRM_DEBUG("IH: HPD6\n"); | ||
8208 | |||
8173 | break; | 8209 | break; |
8174 | case 6: | 8210 | case 6: |
8175 | if (rdev->irq.stat_regs.cik.disp_int & DC_HPD1_RX_INTERRUPT) { | 8211 | if (!(rdev->irq.stat_regs.cik.disp_int & DC_HPD1_RX_INTERRUPT)) |
8176 | rdev->irq.stat_regs.cik.disp_int &= ~DC_HPD1_RX_INTERRUPT; | 8212 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8177 | queue_dp = true; | 8213 | |
8178 | DRM_DEBUG("IH: HPD_RX 1\n"); | 8214 | rdev->irq.stat_regs.cik.disp_int &= ~DC_HPD1_RX_INTERRUPT; |
8179 | } | 8215 | queue_dp = true; |
8216 | DRM_DEBUG("IH: HPD_RX 1\n"); | ||
8217 | |||
8180 | break; | 8218 | break; |
8181 | case 7: | 8219 | case 7: |
8182 | if (rdev->irq.stat_regs.cik.disp_int_cont & DC_HPD2_RX_INTERRUPT) { | 8220 | if (!(rdev->irq.stat_regs.cik.disp_int_cont & DC_HPD2_RX_INTERRUPT)) |
8183 | rdev->irq.stat_regs.cik.disp_int_cont &= ~DC_HPD2_RX_INTERRUPT; | 8221 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8184 | queue_dp = true; | 8222 | |
8185 | DRM_DEBUG("IH: HPD_RX 2\n"); | 8223 | rdev->irq.stat_regs.cik.disp_int_cont &= ~DC_HPD2_RX_INTERRUPT; |
8186 | } | 8224 | queue_dp = true; |
8225 | DRM_DEBUG("IH: HPD_RX 2\n"); | ||
8226 | |||
8187 | break; | 8227 | break; |
8188 | case 8: | 8228 | case 8: |
8189 | if (rdev->irq.stat_regs.cik.disp_int_cont2 & DC_HPD3_RX_INTERRUPT) { | 8229 | if (!(rdev->irq.stat_regs.cik.disp_int_cont2 & DC_HPD3_RX_INTERRUPT)) |
8190 | rdev->irq.stat_regs.cik.disp_int_cont2 &= ~DC_HPD3_RX_INTERRUPT; | 8230 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8191 | queue_dp = true; | 8231 | |
8192 | DRM_DEBUG("IH: HPD_RX 3\n"); | 8232 | rdev->irq.stat_regs.cik.disp_int_cont2 &= ~DC_HPD3_RX_INTERRUPT; |
8193 | } | 8233 | queue_dp = true; |
8234 | DRM_DEBUG("IH: HPD_RX 3\n"); | ||
8235 | |||
8194 | break; | 8236 | break; |
8195 | case 9: | 8237 | case 9: |
8196 | if (rdev->irq.stat_regs.cik.disp_int_cont3 & DC_HPD4_RX_INTERRUPT) { | 8238 | if (!(rdev->irq.stat_regs.cik.disp_int_cont3 & DC_HPD4_RX_INTERRUPT)) |
8197 | rdev->irq.stat_regs.cik.disp_int_cont3 &= ~DC_HPD4_RX_INTERRUPT; | 8239 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8198 | queue_dp = true; | 8240 | |
8199 | DRM_DEBUG("IH: HPD_RX 4\n"); | 8241 | rdev->irq.stat_regs.cik.disp_int_cont3 &= ~DC_HPD4_RX_INTERRUPT; |
8200 | } | 8242 | queue_dp = true; |
8243 | DRM_DEBUG("IH: HPD_RX 4\n"); | ||
8244 | |||
8201 | break; | 8245 | break; |
8202 | case 10: | 8246 | case 10: |
8203 | if (rdev->irq.stat_regs.cik.disp_int_cont4 & DC_HPD5_RX_INTERRUPT) { | 8247 | if (!(rdev->irq.stat_regs.cik.disp_int_cont4 & DC_HPD5_RX_INTERRUPT)) |
8204 | rdev->irq.stat_regs.cik.disp_int_cont4 &= ~DC_HPD5_RX_INTERRUPT; | 8248 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8205 | queue_dp = true; | 8249 | |
8206 | DRM_DEBUG("IH: HPD_RX 5\n"); | 8250 | rdev->irq.stat_regs.cik.disp_int_cont4 &= ~DC_HPD5_RX_INTERRUPT; |
8207 | } | 8251 | queue_dp = true; |
8252 | DRM_DEBUG("IH: HPD_RX 5\n"); | ||
8253 | |||
8208 | break; | 8254 | break; |
8209 | case 11: | 8255 | case 11: |
8210 | if (rdev->irq.stat_regs.cik.disp_int_cont5 & DC_HPD6_RX_INTERRUPT) { | 8256 | if (!(rdev->irq.stat_regs.cik.disp_int_cont5 & DC_HPD6_RX_INTERRUPT)) |
8211 | rdev->irq.stat_regs.cik.disp_int_cont5 &= ~DC_HPD6_RX_INTERRUPT; | 8257 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
8212 | queue_dp = true; | 8258 | |
8213 | DRM_DEBUG("IH: HPD_RX 6\n"); | 8259 | rdev->irq.stat_regs.cik.disp_int_cont5 &= ~DC_HPD6_RX_INTERRUPT; |
8214 | } | 8260 | queue_dp = true; |
8261 | DRM_DEBUG("IH: HPD_RX 6\n"); | ||
8262 | |||
8215 | break; | 8263 | break; |
8216 | default: | 8264 | default: |
8217 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 8265 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 3a6d483a2c36..0acde1949c18 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -4924,7 +4924,7 @@ restart_ih: | |||
4924 | return IRQ_NONE; | 4924 | return IRQ_NONE; |
4925 | 4925 | ||
4926 | rptr = rdev->ih.rptr; | 4926 | rptr = rdev->ih.rptr; |
4927 | DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr); | 4927 | DRM_DEBUG("evergreen_irq_process start: rptr %d, wptr %d\n", rptr, wptr); |
4928 | 4928 | ||
4929 | /* Order reading of wptr vs. reading of IH ring data */ | 4929 | /* Order reading of wptr vs. reading of IH ring data */ |
4930 | rmb(); | 4930 | rmb(); |
@@ -4942,23 +4942,27 @@ restart_ih: | |||
4942 | case 1: /* D1 vblank/vline */ | 4942 | case 1: /* D1 vblank/vline */ |
4943 | switch (src_data) { | 4943 | switch (src_data) { |
4944 | case 0: /* D1 vblank */ | 4944 | case 0: /* D1 vblank */ |
4945 | if (rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VBLANK_INTERRUPT) { | 4945 | if (!(rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VBLANK_INTERRUPT)) |
4946 | if (rdev->irq.crtc_vblank_int[0]) { | 4946 | DRM_DEBUG("IH: D1 vblank - IH event w/o asserted irq bit?\n"); |
4947 | drm_handle_vblank(rdev->ddev, 0); | 4947 | |
4948 | rdev->pm.vblank_sync = true; | 4948 | if (rdev->irq.crtc_vblank_int[0]) { |
4949 | wake_up(&rdev->irq.vblank_queue); | 4949 | drm_handle_vblank(rdev->ddev, 0); |
4950 | } | 4950 | rdev->pm.vblank_sync = true; |
4951 | if (atomic_read(&rdev->irq.pflip[0])) | 4951 | wake_up(&rdev->irq.vblank_queue); |
4952 | radeon_crtc_handle_vblank(rdev, 0); | ||
4953 | rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VBLANK_INTERRUPT; | ||
4954 | DRM_DEBUG("IH: D1 vblank\n"); | ||
4955 | } | 4952 | } |
4953 | if (atomic_read(&rdev->irq.pflip[0])) | ||
4954 | radeon_crtc_handle_vblank(rdev, 0); | ||
4955 | rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VBLANK_INTERRUPT; | ||
4956 | DRM_DEBUG("IH: D1 vblank\n"); | ||
4957 | |||
4956 | break; | 4958 | break; |
4957 | case 1: /* D1 vline */ | 4959 | case 1: /* D1 vline */ |
4958 | if (rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VLINE_INTERRUPT) { | 4960 | if (!(rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VLINE_INTERRUPT)) |
4959 | rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VLINE_INTERRUPT; | 4961 | DRM_DEBUG("IH: D1 vline - IH event w/o asserted irq bit?\n"); |
4960 | DRM_DEBUG("IH: D1 vline\n"); | 4962 | |
4961 | } | 4963 | rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VLINE_INTERRUPT; |
4964 | DRM_DEBUG("IH: D1 vline\n"); | ||
4965 | |||
4962 | break; | 4966 | break; |
4963 | default: | 4967 | default: |
4964 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 4968 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -4968,23 +4972,27 @@ restart_ih: | |||
4968 | case 2: /* D2 vblank/vline */ | 4972 | case 2: /* D2 vblank/vline */ |
4969 | switch (src_data) { | 4973 | switch (src_data) { |
4970 | case 0: /* D2 vblank */ | 4974 | case 0: /* D2 vblank */ |
4971 | if (rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VBLANK_INTERRUPT) { | 4975 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VBLANK_INTERRUPT)) |
4972 | if (rdev->irq.crtc_vblank_int[1]) { | 4976 | DRM_DEBUG("IH: D2 vblank - IH event w/o asserted irq bit?\n"); |
4973 | drm_handle_vblank(rdev->ddev, 1); | 4977 | |
4974 | rdev->pm.vblank_sync = true; | 4978 | if (rdev->irq.crtc_vblank_int[1]) { |
4975 | wake_up(&rdev->irq.vblank_queue); | 4979 | drm_handle_vblank(rdev->ddev, 1); |
4976 | } | 4980 | rdev->pm.vblank_sync = true; |
4977 | if (atomic_read(&rdev->irq.pflip[1])) | 4981 | wake_up(&rdev->irq.vblank_queue); |
4978 | radeon_crtc_handle_vblank(rdev, 1); | ||
4979 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT; | ||
4980 | DRM_DEBUG("IH: D2 vblank\n"); | ||
4981 | } | 4982 | } |
4983 | if (atomic_read(&rdev->irq.pflip[1])) | ||
4984 | radeon_crtc_handle_vblank(rdev, 1); | ||
4985 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT; | ||
4986 | DRM_DEBUG("IH: D2 vblank\n"); | ||
4987 | |||
4982 | break; | 4988 | break; |
4983 | case 1: /* D2 vline */ | 4989 | case 1: /* D2 vline */ |
4984 | if (rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VLINE_INTERRUPT) { | 4990 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VLINE_INTERRUPT)) |
4985 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VLINE_INTERRUPT; | 4991 | DRM_DEBUG("IH: D2 vline - IH event w/o asserted irq bit?\n"); |
4986 | DRM_DEBUG("IH: D2 vline\n"); | 4992 | |
4987 | } | 4993 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VLINE_INTERRUPT; |
4994 | DRM_DEBUG("IH: D2 vline\n"); | ||
4995 | |||
4988 | break; | 4996 | break; |
4989 | default: | 4997 | default: |
4990 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 4998 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -4994,23 +5002,27 @@ restart_ih: | |||
4994 | case 3: /* D3 vblank/vline */ | 5002 | case 3: /* D3 vblank/vline */ |
4995 | switch (src_data) { | 5003 | switch (src_data) { |
4996 | case 0: /* D3 vblank */ | 5004 | case 0: /* D3 vblank */ |
4997 | if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT) { | 5005 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT)) |
4998 | if (rdev->irq.crtc_vblank_int[2]) { | 5006 | DRM_DEBUG("IH: D3 vblank - IH event w/o asserted irq bit?\n"); |
4999 | drm_handle_vblank(rdev->ddev, 2); | 5007 | |
5000 | rdev->pm.vblank_sync = true; | 5008 | if (rdev->irq.crtc_vblank_int[2]) { |
5001 | wake_up(&rdev->irq.vblank_queue); | 5009 | drm_handle_vblank(rdev->ddev, 2); |
5002 | } | 5010 | rdev->pm.vblank_sync = true; |
5003 | if (atomic_read(&rdev->irq.pflip[2])) | 5011 | wake_up(&rdev->irq.vblank_queue); |
5004 | radeon_crtc_handle_vblank(rdev, 2); | ||
5005 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT; | ||
5006 | DRM_DEBUG("IH: D3 vblank\n"); | ||
5007 | } | 5012 | } |
5013 | if (atomic_read(&rdev->irq.pflip[2])) | ||
5014 | radeon_crtc_handle_vblank(rdev, 2); | ||
5015 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT; | ||
5016 | DRM_DEBUG("IH: D3 vblank\n"); | ||
5017 | |||
5008 | break; | 5018 | break; |
5009 | case 1: /* D3 vline */ | 5019 | case 1: /* D3 vline */ |
5010 | if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VLINE_INTERRUPT) { | 5020 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VLINE_INTERRUPT)) |
5011 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VLINE_INTERRUPT; | 5021 | DRM_DEBUG("IH: D3 vline - IH event w/o asserted irq bit?\n"); |
5012 | DRM_DEBUG("IH: D3 vline\n"); | 5022 | |
5013 | } | 5023 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VLINE_INTERRUPT; |
5024 | DRM_DEBUG("IH: D3 vline\n"); | ||
5025 | |||
5014 | break; | 5026 | break; |
5015 | default: | 5027 | default: |
5016 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 5028 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -5020,23 +5032,27 @@ restart_ih: | |||
5020 | case 4: /* D4 vblank/vline */ | 5032 | case 4: /* D4 vblank/vline */ |
5021 | switch (src_data) { | 5033 | switch (src_data) { |
5022 | case 0: /* D4 vblank */ | 5034 | case 0: /* D4 vblank */ |
5023 | if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VBLANK_INTERRUPT) { | 5035 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VBLANK_INTERRUPT)) |
5024 | if (rdev->irq.crtc_vblank_int[3]) { | 5036 | DRM_DEBUG("IH: D4 vblank - IH event w/o asserted irq bit?\n"); |
5025 | drm_handle_vblank(rdev->ddev, 3); | 5037 | |
5026 | rdev->pm.vblank_sync = true; | 5038 | if (rdev->irq.crtc_vblank_int[3]) { |
5027 | wake_up(&rdev->irq.vblank_queue); | 5039 | drm_handle_vblank(rdev->ddev, 3); |
5028 | } | 5040 | rdev->pm.vblank_sync = true; |
5029 | if (atomic_read(&rdev->irq.pflip[3])) | 5041 | wake_up(&rdev->irq.vblank_queue); |
5030 | radeon_crtc_handle_vblank(rdev, 3); | ||
5031 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT; | ||
5032 | DRM_DEBUG("IH: D4 vblank\n"); | ||
5033 | } | 5042 | } |
5043 | if (atomic_read(&rdev->irq.pflip[3])) | ||
5044 | radeon_crtc_handle_vblank(rdev, 3); | ||
5045 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT; | ||
5046 | DRM_DEBUG("IH: D4 vblank\n"); | ||
5047 | |||
5034 | break; | 5048 | break; |
5035 | case 1: /* D4 vline */ | 5049 | case 1: /* D4 vline */ |
5036 | if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VLINE_INTERRUPT) { | 5050 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VLINE_INTERRUPT)) |
5037 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VLINE_INTERRUPT; | 5051 | DRM_DEBUG("IH: D4 vline - IH event w/o asserted irq bit?\n"); |
5038 | DRM_DEBUG("IH: D4 vline\n"); | 5052 | |
5039 | } | 5053 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VLINE_INTERRUPT; |
5054 | DRM_DEBUG("IH: D4 vline\n"); | ||
5055 | |||
5040 | break; | 5056 | break; |
5041 | default: | 5057 | default: |
5042 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 5058 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -5046,23 +5062,27 @@ restart_ih: | |||
5046 | case 5: /* D5 vblank/vline */ | 5062 | case 5: /* D5 vblank/vline */ |
5047 | switch (src_data) { | 5063 | switch (src_data) { |
5048 | case 0: /* D5 vblank */ | 5064 | case 0: /* D5 vblank */ |
5049 | if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT) { | 5065 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT)) |
5050 | if (rdev->irq.crtc_vblank_int[4]) { | 5066 | DRM_DEBUG("IH: D5 vblank - IH event w/o asserted irq bit?\n"); |
5051 | drm_handle_vblank(rdev->ddev, 4); | 5067 | |
5052 | rdev->pm.vblank_sync = true; | 5068 | if (rdev->irq.crtc_vblank_int[4]) { |
5053 | wake_up(&rdev->irq.vblank_queue); | 5069 | drm_handle_vblank(rdev->ddev, 4); |
5054 | } | 5070 | rdev->pm.vblank_sync = true; |
5055 | if (atomic_read(&rdev->irq.pflip[4])) | 5071 | wake_up(&rdev->irq.vblank_queue); |
5056 | radeon_crtc_handle_vblank(rdev, 4); | ||
5057 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT; | ||
5058 | DRM_DEBUG("IH: D5 vblank\n"); | ||
5059 | } | 5072 | } |
5073 | if (atomic_read(&rdev->irq.pflip[4])) | ||
5074 | radeon_crtc_handle_vblank(rdev, 4); | ||
5075 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT; | ||
5076 | DRM_DEBUG("IH: D5 vblank\n"); | ||
5077 | |||
5060 | break; | 5078 | break; |
5061 | case 1: /* D5 vline */ | 5079 | case 1: /* D5 vline */ |
5062 | if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VLINE_INTERRUPT) { | 5080 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VLINE_INTERRUPT)) |
5063 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VLINE_INTERRUPT; | 5081 | DRM_DEBUG("IH: D5 vline - IH event w/o asserted irq bit?\n"); |
5064 | DRM_DEBUG("IH: D5 vline\n"); | 5082 | |
5065 | } | 5083 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VLINE_INTERRUPT; |
5084 | DRM_DEBUG("IH: D5 vline\n"); | ||
5085 | |||
5066 | break; | 5086 | break; |
5067 | default: | 5087 | default: |
5068 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 5088 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -5072,23 +5092,27 @@ restart_ih: | |||
5072 | case 6: /* D6 vblank/vline */ | 5092 | case 6: /* D6 vblank/vline */ |
5073 | switch (src_data) { | 5093 | switch (src_data) { |
5074 | case 0: /* D6 vblank */ | 5094 | case 0: /* D6 vblank */ |
5075 | if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VBLANK_INTERRUPT) { | 5095 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VBLANK_INTERRUPT)) |
5076 | if (rdev->irq.crtc_vblank_int[5]) { | 5096 | DRM_DEBUG("IH: D6 vblank - IH event w/o asserted irq bit?\n"); |
5077 | drm_handle_vblank(rdev->ddev, 5); | 5097 | |
5078 | rdev->pm.vblank_sync = true; | 5098 | if (rdev->irq.crtc_vblank_int[5]) { |
5079 | wake_up(&rdev->irq.vblank_queue); | 5099 | drm_handle_vblank(rdev->ddev, 5); |
5080 | } | 5100 | rdev->pm.vblank_sync = true; |
5081 | if (atomic_read(&rdev->irq.pflip[5])) | 5101 | wake_up(&rdev->irq.vblank_queue); |
5082 | radeon_crtc_handle_vblank(rdev, 5); | ||
5083 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT; | ||
5084 | DRM_DEBUG("IH: D6 vblank\n"); | ||
5085 | } | 5102 | } |
5103 | if (atomic_read(&rdev->irq.pflip[5])) | ||
5104 | radeon_crtc_handle_vblank(rdev, 5); | ||
5105 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT; | ||
5106 | DRM_DEBUG("IH: D6 vblank\n"); | ||
5107 | |||
5086 | break; | 5108 | break; |
5087 | case 1: /* D6 vline */ | 5109 | case 1: /* D6 vline */ |
5088 | if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VLINE_INTERRUPT) { | 5110 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VLINE_INTERRUPT)) |
5089 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VLINE_INTERRUPT; | 5111 | DRM_DEBUG("IH: D6 vline - IH event w/o asserted irq bit?\n"); |
5090 | DRM_DEBUG("IH: D6 vline\n"); | 5112 | |
5091 | } | 5113 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VLINE_INTERRUPT; |
5114 | DRM_DEBUG("IH: D6 vline\n"); | ||
5115 | |||
5092 | break; | 5116 | break; |
5093 | default: | 5117 | default: |
5094 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 5118 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -5108,88 +5132,100 @@ restart_ih: | |||
5108 | case 42: /* HPD hotplug */ | 5132 | case 42: /* HPD hotplug */ |
5109 | switch (src_data) { | 5133 | switch (src_data) { |
5110 | case 0: | 5134 | case 0: |
5111 | if (rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_INTERRUPT) { | 5135 | if (!(rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_INTERRUPT)) |
5112 | rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_INTERRUPT; | 5136 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5113 | queue_hotplug = true; | 5137 | |
5114 | DRM_DEBUG("IH: HPD1\n"); | 5138 | rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_INTERRUPT; |
5115 | } | 5139 | queue_hotplug = true; |
5140 | DRM_DEBUG("IH: HPD1\n"); | ||
5116 | break; | 5141 | break; |
5117 | case 1: | 5142 | case 1: |
5118 | if (rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_INTERRUPT) { | 5143 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_INTERRUPT)) |
5119 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_INTERRUPT; | 5144 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5120 | queue_hotplug = true; | 5145 | |
5121 | DRM_DEBUG("IH: HPD2\n"); | 5146 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_INTERRUPT; |
5122 | } | 5147 | queue_hotplug = true; |
5148 | DRM_DEBUG("IH: HPD2\n"); | ||
5123 | break; | 5149 | break; |
5124 | case 2: | 5150 | case 2: |
5125 | if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_INTERRUPT) { | 5151 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_INTERRUPT)) |
5126 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_INTERRUPT; | 5152 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5127 | queue_hotplug = true; | 5153 | |
5128 | DRM_DEBUG("IH: HPD3\n"); | 5154 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_INTERRUPT; |
5129 | } | 5155 | queue_hotplug = true; |
5156 | DRM_DEBUG("IH: HPD3\n"); | ||
5130 | break; | 5157 | break; |
5131 | case 3: | 5158 | case 3: |
5132 | if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_INTERRUPT) { | 5159 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_INTERRUPT)) |
5133 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_INTERRUPT; | 5160 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5134 | queue_hotplug = true; | 5161 | |
5135 | DRM_DEBUG("IH: HPD4\n"); | 5162 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_INTERRUPT; |
5136 | } | 5163 | queue_hotplug = true; |
5164 | DRM_DEBUG("IH: HPD4\n"); | ||
5137 | break; | 5165 | break; |
5138 | case 4: | 5166 | case 4: |
5139 | if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_INTERRUPT) { | 5167 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_INTERRUPT)) |
5140 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_INTERRUPT; | 5168 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5141 | queue_hotplug = true; | 5169 | |
5142 | DRM_DEBUG("IH: HPD5\n"); | 5170 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_INTERRUPT; |
5143 | } | 5171 | queue_hotplug = true; |
5172 | DRM_DEBUG("IH: HPD5\n"); | ||
5144 | break; | 5173 | break; |
5145 | case 5: | 5174 | case 5: |
5146 | if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_INTERRUPT) { | 5175 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_INTERRUPT)) |
5147 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_INTERRUPT; | 5176 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5148 | queue_hotplug = true; | 5177 | |
5149 | DRM_DEBUG("IH: HPD6\n"); | 5178 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_INTERRUPT; |
5150 | } | 5179 | queue_hotplug = true; |
5180 | DRM_DEBUG("IH: HPD6\n"); | ||
5151 | break; | 5181 | break; |
5152 | case 6: | 5182 | case 6: |
5153 | if (rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_RX_INTERRUPT) { | 5183 | if (!(rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_RX_INTERRUPT)) |
5154 | rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_RX_INTERRUPT; | 5184 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5155 | queue_dp = true; | 5185 | |
5156 | DRM_DEBUG("IH: HPD_RX 1\n"); | 5186 | rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_RX_INTERRUPT; |
5157 | } | 5187 | queue_dp = true; |
5188 | DRM_DEBUG("IH: HPD_RX 1\n"); | ||
5158 | break; | 5189 | break; |
5159 | case 7: | 5190 | case 7: |
5160 | if (rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_RX_INTERRUPT) { | 5191 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_RX_INTERRUPT)) |
5161 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_RX_INTERRUPT; | 5192 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5162 | queue_dp = true; | 5193 | |
5163 | DRM_DEBUG("IH: HPD_RX 2\n"); | 5194 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_RX_INTERRUPT; |
5164 | } | 5195 | queue_dp = true; |
5196 | DRM_DEBUG("IH: HPD_RX 2\n"); | ||
5165 | break; | 5197 | break; |
5166 | case 8: | 5198 | case 8: |
5167 | if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_RX_INTERRUPT) { | 5199 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_RX_INTERRUPT)) |
5168 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_RX_INTERRUPT; | 5200 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5169 | queue_dp = true; | 5201 | |
5170 | DRM_DEBUG("IH: HPD_RX 3\n"); | 5202 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_RX_INTERRUPT; |
5171 | } | 5203 | queue_dp = true; |
5204 | DRM_DEBUG("IH: HPD_RX 3\n"); | ||
5172 | break; | 5205 | break; |
5173 | case 9: | 5206 | case 9: |
5174 | if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_RX_INTERRUPT) { | 5207 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_RX_INTERRUPT)) |
5175 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_RX_INTERRUPT; | 5208 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5176 | queue_dp = true; | 5209 | |
5177 | DRM_DEBUG("IH: HPD_RX 4\n"); | 5210 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_RX_INTERRUPT; |
5178 | } | 5211 | queue_dp = true; |
5212 | DRM_DEBUG("IH: HPD_RX 4\n"); | ||
5179 | break; | 5213 | break; |
5180 | case 10: | 5214 | case 10: |
5181 | if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_RX_INTERRUPT) { | 5215 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_RX_INTERRUPT)) |
5182 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_RX_INTERRUPT; | 5216 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5183 | queue_dp = true; | 5217 | |
5184 | DRM_DEBUG("IH: HPD_RX 5\n"); | 5218 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_RX_INTERRUPT; |
5185 | } | 5219 | queue_dp = true; |
5220 | DRM_DEBUG("IH: HPD_RX 5\n"); | ||
5186 | break; | 5221 | break; |
5187 | case 11: | 5222 | case 11: |
5188 | if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_RX_INTERRUPT) { | 5223 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_RX_INTERRUPT)) |
5189 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_RX_INTERRUPT; | 5224 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5190 | queue_dp = true; | 5225 | |
5191 | DRM_DEBUG("IH: HPD_RX 6\n"); | 5226 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_RX_INTERRUPT; |
5192 | } | 5227 | queue_dp = true; |
5228 | DRM_DEBUG("IH: HPD_RX 6\n"); | ||
5193 | break; | 5229 | break; |
5194 | default: | 5230 | default: |
5195 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 5231 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -5199,46 +5235,52 @@ restart_ih: | |||
5199 | case 44: /* hdmi */ | 5235 | case 44: /* hdmi */ |
5200 | switch (src_data) { | 5236 | switch (src_data) { |
5201 | case 0: | 5237 | case 0: |
5202 | if (rdev->irq.stat_regs.evergreen.afmt_status1 & AFMT_AZ_FORMAT_WTRIG) { | 5238 | if (!(rdev->irq.stat_regs.evergreen.afmt_status1 & AFMT_AZ_FORMAT_WTRIG)) |
5203 | rdev->irq.stat_regs.evergreen.afmt_status1 &= ~AFMT_AZ_FORMAT_WTRIG; | 5239 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5204 | queue_hdmi = true; | 5240 | |
5205 | DRM_DEBUG("IH: HDMI0\n"); | 5241 | rdev->irq.stat_regs.evergreen.afmt_status1 &= ~AFMT_AZ_FORMAT_WTRIG; |
5206 | } | 5242 | queue_hdmi = true; |
5243 | DRM_DEBUG("IH: HDMI0\n"); | ||
5207 | break; | 5244 | break; |
5208 | case 1: | 5245 | case 1: |
5209 | if (rdev->irq.stat_regs.evergreen.afmt_status2 & AFMT_AZ_FORMAT_WTRIG) { | 5246 | if (!(rdev->irq.stat_regs.evergreen.afmt_status2 & AFMT_AZ_FORMAT_WTRIG)) |
5210 | rdev->irq.stat_regs.evergreen.afmt_status2 &= ~AFMT_AZ_FORMAT_WTRIG; | 5247 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5211 | queue_hdmi = true; | 5248 | |
5212 | DRM_DEBUG("IH: HDMI1\n"); | 5249 | rdev->irq.stat_regs.evergreen.afmt_status2 &= ~AFMT_AZ_FORMAT_WTRIG; |
5213 | } | 5250 | queue_hdmi = true; |
5251 | DRM_DEBUG("IH: HDMI1\n"); | ||
5214 | break; | 5252 | break; |
5215 | case 2: | 5253 | case 2: |
5216 | if (rdev->irq.stat_regs.evergreen.afmt_status3 & AFMT_AZ_FORMAT_WTRIG) { | 5254 | if (!(rdev->irq.stat_regs.evergreen.afmt_status3 & AFMT_AZ_FORMAT_WTRIG)) |
5217 | rdev->irq.stat_regs.evergreen.afmt_status3 &= ~AFMT_AZ_FORMAT_WTRIG; | 5255 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5218 | queue_hdmi = true; | 5256 | |
5219 | DRM_DEBUG("IH: HDMI2\n"); | 5257 | rdev->irq.stat_regs.evergreen.afmt_status3 &= ~AFMT_AZ_FORMAT_WTRIG; |
5220 | } | 5258 | queue_hdmi = true; |
5259 | DRM_DEBUG("IH: HDMI2\n"); | ||
5221 | break; | 5260 | break; |
5222 | case 3: | 5261 | case 3: |
5223 | if (rdev->irq.stat_regs.evergreen.afmt_status4 & AFMT_AZ_FORMAT_WTRIG) { | 5262 | if (!(rdev->irq.stat_regs.evergreen.afmt_status4 & AFMT_AZ_FORMAT_WTRIG)) |
5224 | rdev->irq.stat_regs.evergreen.afmt_status4 &= ~AFMT_AZ_FORMAT_WTRIG; | 5263 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5225 | queue_hdmi = true; | 5264 | |
5226 | DRM_DEBUG("IH: HDMI3\n"); | 5265 | rdev->irq.stat_regs.evergreen.afmt_status4 &= ~AFMT_AZ_FORMAT_WTRIG; |
5227 | } | 5266 | queue_hdmi = true; |
5267 | DRM_DEBUG("IH: HDMI3\n"); | ||
5228 | break; | 5268 | break; |
5229 | case 4: | 5269 | case 4: |
5230 | if (rdev->irq.stat_regs.evergreen.afmt_status5 & AFMT_AZ_FORMAT_WTRIG) { | 5270 | if (!(rdev->irq.stat_regs.evergreen.afmt_status5 & AFMT_AZ_FORMAT_WTRIG)) |
5231 | rdev->irq.stat_regs.evergreen.afmt_status5 &= ~AFMT_AZ_FORMAT_WTRIG; | 5271 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5232 | queue_hdmi = true; | 5272 | |
5233 | DRM_DEBUG("IH: HDMI4\n"); | 5273 | rdev->irq.stat_regs.evergreen.afmt_status5 &= ~AFMT_AZ_FORMAT_WTRIG; |
5234 | } | 5274 | queue_hdmi = true; |
5275 | DRM_DEBUG("IH: HDMI4\n"); | ||
5235 | break; | 5276 | break; |
5236 | case 5: | 5277 | case 5: |
5237 | if (rdev->irq.stat_regs.evergreen.afmt_status6 & AFMT_AZ_FORMAT_WTRIG) { | 5278 | if (!(rdev->irq.stat_regs.evergreen.afmt_status6 & AFMT_AZ_FORMAT_WTRIG)) |
5238 | rdev->irq.stat_regs.evergreen.afmt_status6 &= ~AFMT_AZ_FORMAT_WTRIG; | 5279 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5239 | queue_hdmi = true; | 5280 | |
5240 | DRM_DEBUG("IH: HDMI5\n"); | 5281 | rdev->irq.stat_regs.evergreen.afmt_status6 &= ~AFMT_AZ_FORMAT_WTRIG; |
5241 | } | 5282 | queue_hdmi = true; |
5283 | DRM_DEBUG("IH: HDMI5\n"); | ||
5242 | break; | 5284 | break; |
5243 | default: | 5285 | default: |
5244 | DRM_ERROR("Unhandled interrupt: %d %d\n", src_id, src_data); | 5286 | DRM_ERROR("Unhandled interrupt: %d %d\n", src_id, src_data); |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 8e5aeeb058a5..158872eb78e4 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -2162,18 +2162,20 @@ static int cayman_startup(struct radeon_device *rdev) | |||
2162 | DRM_ERROR("radeon: failed initializing UVD (%d).\n", r); | 2162 | DRM_ERROR("radeon: failed initializing UVD (%d).\n", r); |
2163 | } | 2163 | } |
2164 | 2164 | ||
2165 | ring = &rdev->ring[TN_RING_TYPE_VCE1_INDEX]; | 2165 | if (rdev->family == CHIP_ARUBA) { |
2166 | if (ring->ring_size) | 2166 | ring = &rdev->ring[TN_RING_TYPE_VCE1_INDEX]; |
2167 | r = radeon_ring_init(rdev, ring, ring->ring_size, 0, 0x0); | 2167 | if (ring->ring_size) |
2168 | r = radeon_ring_init(rdev, ring, ring->ring_size, 0, 0x0); | ||
2168 | 2169 | ||
2169 | ring = &rdev->ring[TN_RING_TYPE_VCE2_INDEX]; | 2170 | ring = &rdev->ring[TN_RING_TYPE_VCE2_INDEX]; |
2170 | if (ring->ring_size) | 2171 | if (ring->ring_size) |
2171 | r = radeon_ring_init(rdev, ring, ring->ring_size, 0, 0x0); | 2172 | r = radeon_ring_init(rdev, ring, ring->ring_size, 0, 0x0); |
2172 | 2173 | ||
2173 | if (!r) | 2174 | if (!r) |
2174 | r = vce_v1_0_init(rdev); | 2175 | r = vce_v1_0_init(rdev); |
2175 | else if (r != -ENOENT) | 2176 | if (r) |
2176 | DRM_ERROR("radeon: failed initializing VCE (%d).\n", r); | 2177 | DRM_ERROR("radeon: failed initializing VCE (%d).\n", r); |
2178 | } | ||
2177 | 2179 | ||
2178 | r = radeon_ib_pool_init(rdev); | 2180 | r = radeon_ib_pool_init(rdev); |
2179 | if (r) { | 2181 | if (r) { |
@@ -2396,7 +2398,8 @@ void cayman_fini(struct radeon_device *rdev) | |||
2396 | radeon_irq_kms_fini(rdev); | 2398 | radeon_irq_kms_fini(rdev); |
2397 | uvd_v1_0_fini(rdev); | 2399 | uvd_v1_0_fini(rdev); |
2398 | radeon_uvd_fini(rdev); | 2400 | radeon_uvd_fini(rdev); |
2399 | radeon_vce_fini(rdev); | 2401 | if (rdev->family == CHIP_ARUBA) |
2402 | radeon_vce_fini(rdev); | ||
2400 | cayman_pcie_gart_fini(rdev); | 2403 | cayman_pcie_gart_fini(rdev); |
2401 | r600_vram_scratch_fini(rdev); | 2404 | r600_vram_scratch_fini(rdev); |
2402 | radeon_gem_fini(rdev); | 2405 | radeon_gem_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 35dafd77a639..4ea5b10ff5f4 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -4086,23 +4086,27 @@ restart_ih: | |||
4086 | case 1: /* D1 vblank/vline */ | 4086 | case 1: /* D1 vblank/vline */ |
4087 | switch (src_data) { | 4087 | switch (src_data) { |
4088 | case 0: /* D1 vblank */ | 4088 | case 0: /* D1 vblank */ |
4089 | if (rdev->irq.stat_regs.r600.disp_int & LB_D1_VBLANK_INTERRUPT) { | 4089 | if (!(rdev->irq.stat_regs.r600.disp_int & LB_D1_VBLANK_INTERRUPT)) |
4090 | if (rdev->irq.crtc_vblank_int[0]) { | 4090 | DRM_DEBUG("IH: D1 vblank - IH event w/o asserted irq bit?\n"); |
4091 | drm_handle_vblank(rdev->ddev, 0); | 4091 | |
4092 | rdev->pm.vblank_sync = true; | 4092 | if (rdev->irq.crtc_vblank_int[0]) { |
4093 | wake_up(&rdev->irq.vblank_queue); | 4093 | drm_handle_vblank(rdev->ddev, 0); |
4094 | } | 4094 | rdev->pm.vblank_sync = true; |
4095 | if (atomic_read(&rdev->irq.pflip[0])) | 4095 | wake_up(&rdev->irq.vblank_queue); |
4096 | radeon_crtc_handle_vblank(rdev, 0); | ||
4097 | rdev->irq.stat_regs.r600.disp_int &= ~LB_D1_VBLANK_INTERRUPT; | ||
4098 | DRM_DEBUG("IH: D1 vblank\n"); | ||
4099 | } | 4096 | } |
4097 | if (atomic_read(&rdev->irq.pflip[0])) | ||
4098 | radeon_crtc_handle_vblank(rdev, 0); | ||
4099 | rdev->irq.stat_regs.r600.disp_int &= ~LB_D1_VBLANK_INTERRUPT; | ||
4100 | DRM_DEBUG("IH: D1 vblank\n"); | ||
4101 | |||
4100 | break; | 4102 | break; |
4101 | case 1: /* D1 vline */ | 4103 | case 1: /* D1 vline */ |
4102 | if (rdev->irq.stat_regs.r600.disp_int & LB_D1_VLINE_INTERRUPT) { | 4104 | if (!(rdev->irq.stat_regs.r600.disp_int & LB_D1_VLINE_INTERRUPT)) |
4103 | rdev->irq.stat_regs.r600.disp_int &= ~LB_D1_VLINE_INTERRUPT; | 4105 | DRM_DEBUG("IH: D1 vline - IH event w/o asserted irq bit?\n"); |
4104 | DRM_DEBUG("IH: D1 vline\n"); | 4106 | |
4105 | } | 4107 | rdev->irq.stat_regs.r600.disp_int &= ~LB_D1_VLINE_INTERRUPT; |
4108 | DRM_DEBUG("IH: D1 vline\n"); | ||
4109 | |||
4106 | break; | 4110 | break; |
4107 | default: | 4111 | default: |
4108 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 4112 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -4112,23 +4116,27 @@ restart_ih: | |||
4112 | case 5: /* D2 vblank/vline */ | 4116 | case 5: /* D2 vblank/vline */ |
4113 | switch (src_data) { | 4117 | switch (src_data) { |
4114 | case 0: /* D2 vblank */ | 4118 | case 0: /* D2 vblank */ |
4115 | if (rdev->irq.stat_regs.r600.disp_int & LB_D2_VBLANK_INTERRUPT) { | 4119 | if (!(rdev->irq.stat_regs.r600.disp_int & LB_D2_VBLANK_INTERRUPT)) |
4116 | if (rdev->irq.crtc_vblank_int[1]) { | 4120 | DRM_DEBUG("IH: D2 vblank - IH event w/o asserted irq bit?\n"); |
4117 | drm_handle_vblank(rdev->ddev, 1); | 4121 | |
4118 | rdev->pm.vblank_sync = true; | 4122 | if (rdev->irq.crtc_vblank_int[1]) { |
4119 | wake_up(&rdev->irq.vblank_queue); | 4123 | drm_handle_vblank(rdev->ddev, 1); |
4120 | } | 4124 | rdev->pm.vblank_sync = true; |
4121 | if (atomic_read(&rdev->irq.pflip[1])) | 4125 | wake_up(&rdev->irq.vblank_queue); |
4122 | radeon_crtc_handle_vblank(rdev, 1); | ||
4123 | rdev->irq.stat_regs.r600.disp_int &= ~LB_D2_VBLANK_INTERRUPT; | ||
4124 | DRM_DEBUG("IH: D2 vblank\n"); | ||
4125 | } | 4126 | } |
4127 | if (atomic_read(&rdev->irq.pflip[1])) | ||
4128 | radeon_crtc_handle_vblank(rdev, 1); | ||
4129 | rdev->irq.stat_regs.r600.disp_int &= ~LB_D2_VBLANK_INTERRUPT; | ||
4130 | DRM_DEBUG("IH: D2 vblank\n"); | ||
4131 | |||
4126 | break; | 4132 | break; |
4127 | case 1: /* D1 vline */ | 4133 | case 1: /* D1 vline */ |
4128 | if (rdev->irq.stat_regs.r600.disp_int & LB_D2_VLINE_INTERRUPT) { | 4134 | if (!(rdev->irq.stat_regs.r600.disp_int & LB_D2_VLINE_INTERRUPT)) |
4129 | rdev->irq.stat_regs.r600.disp_int &= ~LB_D2_VLINE_INTERRUPT; | 4135 | DRM_DEBUG("IH: D2 vline - IH event w/o asserted irq bit?\n"); |
4130 | DRM_DEBUG("IH: D2 vline\n"); | 4136 | |
4131 | } | 4137 | rdev->irq.stat_regs.r600.disp_int &= ~LB_D2_VLINE_INTERRUPT; |
4138 | DRM_DEBUG("IH: D2 vline\n"); | ||
4139 | |||
4132 | break; | 4140 | break; |
4133 | default: | 4141 | default: |
4134 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 4142 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -4148,46 +4156,53 @@ restart_ih: | |||
4148 | case 19: /* HPD/DAC hotplug */ | 4156 | case 19: /* HPD/DAC hotplug */ |
4149 | switch (src_data) { | 4157 | switch (src_data) { |
4150 | case 0: | 4158 | case 0: |
4151 | if (rdev->irq.stat_regs.r600.disp_int & DC_HPD1_INTERRUPT) { | 4159 | if (!(rdev->irq.stat_regs.r600.disp_int & DC_HPD1_INTERRUPT)) |
4152 | rdev->irq.stat_regs.r600.disp_int &= ~DC_HPD1_INTERRUPT; | 4160 | DRM_DEBUG("IH: HPD1 - IH event w/o asserted irq bit?\n"); |
4153 | queue_hotplug = true; | 4161 | |
4154 | DRM_DEBUG("IH: HPD1\n"); | 4162 | rdev->irq.stat_regs.r600.disp_int &= ~DC_HPD1_INTERRUPT; |
4155 | } | 4163 | queue_hotplug = true; |
4164 | DRM_DEBUG("IH: HPD1\n"); | ||
4156 | break; | 4165 | break; |
4157 | case 1: | 4166 | case 1: |
4158 | if (rdev->irq.stat_regs.r600.disp_int & DC_HPD2_INTERRUPT) { | 4167 | if (!(rdev->irq.stat_regs.r600.disp_int & DC_HPD2_INTERRUPT)) |
4159 | rdev->irq.stat_regs.r600.disp_int &= ~DC_HPD2_INTERRUPT; | 4168 | DRM_DEBUG("IH: HPD2 - IH event w/o asserted irq bit?\n"); |
4160 | queue_hotplug = true; | 4169 | |
4161 | DRM_DEBUG("IH: HPD2\n"); | 4170 | rdev->irq.stat_regs.r600.disp_int &= ~DC_HPD2_INTERRUPT; |
4162 | } | 4171 | queue_hotplug = true; |
4172 | DRM_DEBUG("IH: HPD2\n"); | ||
4163 | break; | 4173 | break; |
4164 | case 4: | 4174 | case 4: |
4165 | if (rdev->irq.stat_regs.r600.disp_int_cont & DC_HPD3_INTERRUPT) { | 4175 | if (!(rdev->irq.stat_regs.r600.disp_int_cont & DC_HPD3_INTERRUPT)) |
4166 | rdev->irq.stat_regs.r600.disp_int_cont &= ~DC_HPD3_INTERRUPT; | 4176 | DRM_DEBUG("IH: HPD3 - IH event w/o asserted irq bit?\n"); |
4167 | queue_hotplug = true; | 4177 | |
4168 | DRM_DEBUG("IH: HPD3\n"); | 4178 | rdev->irq.stat_regs.r600.disp_int_cont &= ~DC_HPD3_INTERRUPT; |
4169 | } | 4179 | queue_hotplug = true; |
4180 | DRM_DEBUG("IH: HPD3\n"); | ||
4170 | break; | 4181 | break; |
4171 | case 5: | 4182 | case 5: |
4172 | if (rdev->irq.stat_regs.r600.disp_int_cont & DC_HPD4_INTERRUPT) { | 4183 | if (!(rdev->irq.stat_regs.r600.disp_int_cont & DC_HPD4_INTERRUPT)) |
4173 | rdev->irq.stat_regs.r600.disp_int_cont &= ~DC_HPD4_INTERRUPT; | 4184 | DRM_DEBUG("IH: HPD4 - IH event w/o asserted irq bit?\n"); |
4174 | queue_hotplug = true; | 4185 | |
4175 | DRM_DEBUG("IH: HPD4\n"); | 4186 | rdev->irq.stat_regs.r600.disp_int_cont &= ~DC_HPD4_INTERRUPT; |
4176 | } | 4187 | queue_hotplug = true; |
4188 | DRM_DEBUG("IH: HPD4\n"); | ||
4177 | break; | 4189 | break; |
4178 | case 10: | 4190 | case 10: |
4179 | if (rdev->irq.stat_regs.r600.disp_int_cont2 & DC_HPD5_INTERRUPT) { | 4191 | if (!(rdev->irq.stat_regs.r600.disp_int_cont2 & DC_HPD5_INTERRUPT)) |
4180 | rdev->irq.stat_regs.r600.disp_int_cont2 &= ~DC_HPD5_INTERRUPT; | 4192 | DRM_DEBUG("IH: HPD5 - IH event w/o asserted irq bit?\n"); |
4181 | queue_hotplug = true; | 4193 | |
4182 | DRM_DEBUG("IH: HPD5\n"); | 4194 | rdev->irq.stat_regs.r600.disp_int_cont2 &= ~DC_HPD5_INTERRUPT; |
4183 | } | 4195 | queue_hotplug = true; |
4196 | DRM_DEBUG("IH: HPD5\n"); | ||
4184 | break; | 4197 | break; |
4185 | case 12: | 4198 | case 12: |
4186 | if (rdev->irq.stat_regs.r600.disp_int_cont2 & DC_HPD6_INTERRUPT) { | 4199 | if (!(rdev->irq.stat_regs.r600.disp_int_cont2 & DC_HPD6_INTERRUPT)) |
4187 | rdev->irq.stat_regs.r600.disp_int_cont2 &= ~DC_HPD6_INTERRUPT; | 4200 | DRM_DEBUG("IH: HPD6 - IH event w/o asserted irq bit?\n"); |
4188 | queue_hotplug = true; | 4201 | |
4189 | DRM_DEBUG("IH: HPD6\n"); | 4202 | rdev->irq.stat_regs.r600.disp_int_cont2 &= ~DC_HPD6_INTERRUPT; |
4190 | } | 4203 | queue_hotplug = true; |
4204 | DRM_DEBUG("IH: HPD6\n"); | ||
4205 | |||
4191 | break; | 4206 | break; |
4192 | default: | 4207 | default: |
4193 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 4208 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -4197,18 +4212,22 @@ restart_ih: | |||
4197 | case 21: /* hdmi */ | 4212 | case 21: /* hdmi */ |
4198 | switch (src_data) { | 4213 | switch (src_data) { |
4199 | case 4: | 4214 | case 4: |
4200 | if (rdev->irq.stat_regs.r600.hdmi0_status & HDMI0_AZ_FORMAT_WTRIG) { | 4215 | if (!(rdev->irq.stat_regs.r600.hdmi0_status & HDMI0_AZ_FORMAT_WTRIG)) |
4201 | rdev->irq.stat_regs.r600.hdmi0_status &= ~HDMI0_AZ_FORMAT_WTRIG; | 4216 | DRM_DEBUG("IH: HDMI0 - IH event w/o asserted irq bit?\n"); |
4202 | queue_hdmi = true; | 4217 | |
4203 | DRM_DEBUG("IH: HDMI0\n"); | 4218 | rdev->irq.stat_regs.r600.hdmi0_status &= ~HDMI0_AZ_FORMAT_WTRIG; |
4204 | } | 4219 | queue_hdmi = true; |
4220 | DRM_DEBUG("IH: HDMI0\n"); | ||
4221 | |||
4205 | break; | 4222 | break; |
4206 | case 5: | 4223 | case 5: |
4207 | if (rdev->irq.stat_regs.r600.hdmi1_status & HDMI0_AZ_FORMAT_WTRIG) { | 4224 | if (!(rdev->irq.stat_regs.r600.hdmi1_status & HDMI0_AZ_FORMAT_WTRIG)) |
4208 | rdev->irq.stat_regs.r600.hdmi1_status &= ~HDMI0_AZ_FORMAT_WTRIG; | 4225 | DRM_DEBUG("IH: HDMI1 - IH event w/o asserted irq bit?\n"); |
4209 | queue_hdmi = true; | 4226 | |
4210 | DRM_DEBUG("IH: HDMI1\n"); | 4227 | rdev->irq.stat_regs.r600.hdmi1_status &= ~HDMI0_AZ_FORMAT_WTRIG; |
4211 | } | 4228 | queue_hdmi = true; |
4229 | DRM_DEBUG("IH: HDMI1\n"); | ||
4230 | |||
4212 | break; | 4231 | break; |
4213 | default: | 4232 | default: |
4214 | DRM_ERROR("Unhandled interrupt: %d %d\n", src_id, src_data); | 4233 | DRM_ERROR("Unhandled interrupt: %d %d\n", src_id, src_data); |
diff --git a/drivers/gpu/drm/radeon/r600_cp.c b/drivers/gpu/drm/radeon/r600_cp.c index 09e3f39925fa..98f9adaccc3d 100644 --- a/drivers/gpu/drm/radeon/r600_cp.c +++ b/drivers/gpu/drm/radeon/r600_cp.c | |||
@@ -2483,7 +2483,7 @@ int r600_cp_dispatch_texture(struct drm_device *dev, | |||
2483 | struct drm_buf *buf; | 2483 | struct drm_buf *buf; |
2484 | u32 *buffer; | 2484 | u32 *buffer; |
2485 | const u8 __user *data; | 2485 | const u8 __user *data; |
2486 | int size, pass_size; | 2486 | unsigned int size, pass_size; |
2487 | u64 src_offset, dst_offset; | 2487 | u64 src_offset, dst_offset; |
2488 | 2488 | ||
2489 | if (!radeon_check_offset(dev_priv, tex->offset)) { | 2489 | if (!radeon_check_offset(dev_priv, tex->offset)) { |
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c index 45e54060ee97..afaf346bd50e 100644 --- a/drivers/gpu/drm/radeon/radeon_cursor.c +++ b/drivers/gpu/drm/radeon/radeon_cursor.c | |||
@@ -91,15 +91,34 @@ static void radeon_show_cursor(struct drm_crtc *crtc) | |||
91 | struct radeon_device *rdev = crtc->dev->dev_private; | 91 | struct radeon_device *rdev = crtc->dev->dev_private; |
92 | 92 | ||
93 | if (ASIC_IS_DCE4(rdev)) { | 93 | if (ASIC_IS_DCE4(rdev)) { |
94 | WREG32(EVERGREEN_CUR_SURFACE_ADDRESS_HIGH + radeon_crtc->crtc_offset, | ||
95 | upper_32_bits(radeon_crtc->cursor_addr)); | ||
96 | WREG32(EVERGREEN_CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, | ||
97 | lower_32_bits(radeon_crtc->cursor_addr)); | ||
94 | WREG32(RADEON_MM_INDEX, EVERGREEN_CUR_CONTROL + radeon_crtc->crtc_offset); | 98 | WREG32(RADEON_MM_INDEX, EVERGREEN_CUR_CONTROL + radeon_crtc->crtc_offset); |
95 | WREG32(RADEON_MM_DATA, EVERGREEN_CURSOR_EN | | 99 | WREG32(RADEON_MM_DATA, EVERGREEN_CURSOR_EN | |
96 | EVERGREEN_CURSOR_MODE(EVERGREEN_CURSOR_24_8_PRE_MULT) | | 100 | EVERGREEN_CURSOR_MODE(EVERGREEN_CURSOR_24_8_PRE_MULT) | |
97 | EVERGREEN_CURSOR_URGENT_CONTROL(EVERGREEN_CURSOR_URGENT_1_2)); | 101 | EVERGREEN_CURSOR_URGENT_CONTROL(EVERGREEN_CURSOR_URGENT_1_2)); |
98 | } else if (ASIC_IS_AVIVO(rdev)) { | 102 | } else if (ASIC_IS_AVIVO(rdev)) { |
103 | if (rdev->family >= CHIP_RV770) { | ||
104 | if (radeon_crtc->crtc_id) | ||
105 | WREG32(R700_D2CUR_SURFACE_ADDRESS_HIGH, | ||
106 | upper_32_bits(radeon_crtc->cursor_addr)); | ||
107 | else | ||
108 | WREG32(R700_D1CUR_SURFACE_ADDRESS_HIGH, | ||
109 | upper_32_bits(radeon_crtc->cursor_addr)); | ||
110 | } | ||
111 | |||
112 | WREG32(AVIVO_D1CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, | ||
113 | lower_32_bits(radeon_crtc->cursor_addr)); | ||
99 | WREG32(RADEON_MM_INDEX, AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset); | 114 | WREG32(RADEON_MM_INDEX, AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset); |
100 | WREG32(RADEON_MM_DATA, AVIVO_D1CURSOR_EN | | 115 | WREG32(RADEON_MM_DATA, AVIVO_D1CURSOR_EN | |
101 | (AVIVO_D1CURSOR_MODE_24BPP << AVIVO_D1CURSOR_MODE_SHIFT)); | 116 | (AVIVO_D1CURSOR_MODE_24BPP << AVIVO_D1CURSOR_MODE_SHIFT)); |
102 | } else { | 117 | } else { |
118 | /* offset is from DISP(2)_BASE_ADDRESS */ | ||
119 | WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, | ||
120 | radeon_crtc->cursor_addr - radeon_crtc->legacy_display_base_addr); | ||
121 | |||
103 | switch (radeon_crtc->crtc_id) { | 122 | switch (radeon_crtc->crtc_id) { |
104 | case 0: | 123 | case 0: |
105 | WREG32(RADEON_MM_INDEX, RADEON_CRTC_GEN_CNTL); | 124 | WREG32(RADEON_MM_INDEX, RADEON_CRTC_GEN_CNTL); |
@@ -205,8 +224,9 @@ static int radeon_cursor_move_locked(struct drm_crtc *crtc, int x, int y) | |||
205 | | (x << 16) | 224 | | (x << 16) |
206 | | y)); | 225 | | y)); |
207 | /* offset is from DISP(2)_BASE_ADDRESS */ | 226 | /* offset is from DISP(2)_BASE_ADDRESS */ |
208 | WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, (radeon_crtc->legacy_cursor_offset + | 227 | WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, |
209 | (yorigin * 256))); | 228 | radeon_crtc->cursor_addr - radeon_crtc->legacy_display_base_addr + |
229 | yorigin * 256); | ||
210 | } | 230 | } |
211 | 231 | ||
212 | radeon_crtc->cursor_x = x; | 232 | radeon_crtc->cursor_x = x; |
@@ -227,53 +247,6 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc, | |||
227 | return ret; | 247 | return ret; |
228 | } | 248 | } |
229 | 249 | ||
230 | static int radeon_set_cursor(struct drm_crtc *crtc, struct drm_gem_object *obj) | ||
231 | { | ||
232 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
233 | struct radeon_device *rdev = crtc->dev->dev_private; | ||
234 | struct radeon_bo *robj = gem_to_radeon_bo(obj); | ||
235 | uint64_t gpu_addr; | ||
236 | int ret; | ||
237 | |||
238 | ret = radeon_bo_reserve(robj, false); | ||
239 | if (unlikely(ret != 0)) | ||
240 | goto fail; | ||
241 | /* Only 27 bit offset for legacy cursor */ | ||
242 | ret = radeon_bo_pin_restricted(robj, RADEON_GEM_DOMAIN_VRAM, | ||
243 | ASIC_IS_AVIVO(rdev) ? 0 : 1 << 27, | ||
244 | &gpu_addr); | ||
245 | radeon_bo_unreserve(robj); | ||
246 | if (ret) | ||
247 | goto fail; | ||
248 | |||
249 | if (ASIC_IS_DCE4(rdev)) { | ||
250 | WREG32(EVERGREEN_CUR_SURFACE_ADDRESS_HIGH + radeon_crtc->crtc_offset, | ||
251 | upper_32_bits(gpu_addr)); | ||
252 | WREG32(EVERGREEN_CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, | ||
253 | gpu_addr & 0xffffffff); | ||
254 | } else if (ASIC_IS_AVIVO(rdev)) { | ||
255 | if (rdev->family >= CHIP_RV770) { | ||
256 | if (radeon_crtc->crtc_id) | ||
257 | WREG32(R700_D2CUR_SURFACE_ADDRESS_HIGH, upper_32_bits(gpu_addr)); | ||
258 | else | ||
259 | WREG32(R700_D1CUR_SURFACE_ADDRESS_HIGH, upper_32_bits(gpu_addr)); | ||
260 | } | ||
261 | WREG32(AVIVO_D1CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, | ||
262 | gpu_addr & 0xffffffff); | ||
263 | } else { | ||
264 | radeon_crtc->legacy_cursor_offset = gpu_addr - radeon_crtc->legacy_display_base_addr; | ||
265 | /* offset is from DISP(2)_BASE_ADDRESS */ | ||
266 | WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, radeon_crtc->legacy_cursor_offset); | ||
267 | } | ||
268 | |||
269 | return 0; | ||
270 | |||
271 | fail: | ||
272 | drm_gem_object_unreference_unlocked(obj); | ||
273 | |||
274 | return ret; | ||
275 | } | ||
276 | |||
277 | int radeon_crtc_cursor_set2(struct drm_crtc *crtc, | 250 | int radeon_crtc_cursor_set2(struct drm_crtc *crtc, |
278 | struct drm_file *file_priv, | 251 | struct drm_file *file_priv, |
279 | uint32_t handle, | 252 | uint32_t handle, |
@@ -283,7 +256,9 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc, | |||
283 | int32_t hot_y) | 256 | int32_t hot_y) |
284 | { | 257 | { |
285 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 258 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
259 | struct radeon_device *rdev = crtc->dev->dev_private; | ||
286 | struct drm_gem_object *obj; | 260 | struct drm_gem_object *obj; |
261 | struct radeon_bo *robj; | ||
287 | int ret; | 262 | int ret; |
288 | 263 | ||
289 | if (!handle) { | 264 | if (!handle) { |
@@ -305,6 +280,23 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc, | |||
305 | return -ENOENT; | 280 | return -ENOENT; |
306 | } | 281 | } |
307 | 282 | ||
283 | robj = gem_to_radeon_bo(obj); | ||
284 | ret = radeon_bo_reserve(robj, false); | ||
285 | if (ret != 0) { | ||
286 | drm_gem_object_unreference_unlocked(obj); | ||
287 | return ret; | ||
288 | } | ||
289 | /* Only 27 bit offset for legacy cursor */ | ||
290 | ret = radeon_bo_pin_restricted(robj, RADEON_GEM_DOMAIN_VRAM, | ||
291 | ASIC_IS_AVIVO(rdev) ? 0 : 1 << 27, | ||
292 | &radeon_crtc->cursor_addr); | ||
293 | radeon_bo_unreserve(robj); | ||
294 | if (ret) { | ||
295 | DRM_ERROR("Failed to pin new cursor BO (%d)\n", ret); | ||
296 | drm_gem_object_unreference_unlocked(obj); | ||
297 | return ret; | ||
298 | } | ||
299 | |||
308 | radeon_crtc->cursor_width = width; | 300 | radeon_crtc->cursor_width = width; |
309 | radeon_crtc->cursor_height = height; | 301 | radeon_crtc->cursor_height = height; |
310 | 302 | ||
@@ -323,13 +315,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc, | |||
323 | radeon_crtc->cursor_hot_y = hot_y; | 315 | radeon_crtc->cursor_hot_y = hot_y; |
324 | } | 316 | } |
325 | 317 | ||
326 | ret = radeon_set_cursor(crtc, obj); | 318 | radeon_show_cursor(crtc); |
327 | |||
328 | if (ret) | ||
329 | DRM_ERROR("radeon_set_cursor returned %d, not changing cursor\n", | ||
330 | ret); | ||
331 | else | ||
332 | radeon_show_cursor(crtc); | ||
333 | 319 | ||
334 | radeon_lock_cursor(crtc, false); | 320 | radeon_lock_cursor(crtc, false); |
335 | 321 | ||
@@ -341,8 +327,7 @@ unpin: | |||
341 | radeon_bo_unpin(robj); | 327 | radeon_bo_unpin(robj); |
342 | radeon_bo_unreserve(robj); | 328 | radeon_bo_unreserve(robj); |
343 | } | 329 | } |
344 | if (radeon_crtc->cursor_bo != obj) | 330 | drm_gem_object_unreference_unlocked(radeon_crtc->cursor_bo); |
345 | drm_gem_object_unreference_unlocked(radeon_crtc->cursor_bo); | ||
346 | } | 331 | } |
347 | 332 | ||
348 | radeon_crtc->cursor_bo = obj; | 333 | radeon_crtc->cursor_bo = obj; |
@@ -360,7 +345,6 @@ unpin: | |||
360 | void radeon_cursor_reset(struct drm_crtc *crtc) | 345 | void radeon_cursor_reset(struct drm_crtc *crtc) |
361 | { | 346 | { |
362 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 347 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
363 | int ret; | ||
364 | 348 | ||
365 | if (radeon_crtc->cursor_bo) { | 349 | if (radeon_crtc->cursor_bo) { |
366 | radeon_lock_cursor(crtc, true); | 350 | radeon_lock_cursor(crtc, true); |
@@ -368,12 +352,7 @@ void radeon_cursor_reset(struct drm_crtc *crtc) | |||
368 | radeon_cursor_move_locked(crtc, radeon_crtc->cursor_x, | 352 | radeon_cursor_move_locked(crtc, radeon_crtc->cursor_x, |
369 | radeon_crtc->cursor_y); | 353 | radeon_crtc->cursor_y); |
370 | 354 | ||
371 | ret = radeon_set_cursor(crtc, radeon_crtc->cursor_bo); | 355 | radeon_show_cursor(crtc); |
372 | if (ret) | ||
373 | DRM_ERROR("radeon_set_cursor returned %d, not showing " | ||
374 | "cursor\n", ret); | ||
375 | else | ||
376 | radeon_show_cursor(crtc); | ||
377 | 356 | ||
378 | radeon_lock_cursor(crtc, false); | 357 | radeon_lock_cursor(crtc, false); |
379 | } | 358 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 2593b1168bd6..d8319dae8358 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -1080,6 +1080,22 @@ static bool radeon_check_pot_argument(int arg) | |||
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | /** | 1082 | /** |
1083 | * Determine a sensible default GART size according to ASIC family. | ||
1084 | * | ||
1085 | * @family ASIC family name | ||
1086 | */ | ||
1087 | static int radeon_gart_size_auto(enum radeon_family family) | ||
1088 | { | ||
1089 | /* default to a larger gart size on newer asics */ | ||
1090 | if (family >= CHIP_TAHITI) | ||
1091 | return 2048; | ||
1092 | else if (family >= CHIP_RV770) | ||
1093 | return 1024; | ||
1094 | else | ||
1095 | return 512; | ||
1096 | } | ||
1097 | |||
1098 | /** | ||
1083 | * radeon_check_arguments - validate module params | 1099 | * radeon_check_arguments - validate module params |
1084 | * | 1100 | * |
1085 | * @rdev: radeon_device pointer | 1101 | * @rdev: radeon_device pointer |
@@ -1097,27 +1113,17 @@ static void radeon_check_arguments(struct radeon_device *rdev) | |||
1097 | } | 1113 | } |
1098 | 1114 | ||
1099 | if (radeon_gart_size == -1) { | 1115 | if (radeon_gart_size == -1) { |
1100 | /* default to a larger gart size on newer asics */ | 1116 | radeon_gart_size = radeon_gart_size_auto(rdev->family); |
1101 | if (rdev->family >= CHIP_RV770) | ||
1102 | radeon_gart_size = 1024; | ||
1103 | else | ||
1104 | radeon_gart_size = 512; | ||
1105 | } | 1117 | } |
1106 | /* gtt size must be power of two and greater or equal to 32M */ | 1118 | /* gtt size must be power of two and greater or equal to 32M */ |
1107 | if (radeon_gart_size < 32) { | 1119 | if (radeon_gart_size < 32) { |
1108 | dev_warn(rdev->dev, "gart size (%d) too small\n", | 1120 | dev_warn(rdev->dev, "gart size (%d) too small\n", |
1109 | radeon_gart_size); | 1121 | radeon_gart_size); |
1110 | if (rdev->family >= CHIP_RV770) | 1122 | radeon_gart_size = radeon_gart_size_auto(rdev->family); |
1111 | radeon_gart_size = 1024; | ||
1112 | else | ||
1113 | radeon_gart_size = 512; | ||
1114 | } else if (!radeon_check_pot_argument(radeon_gart_size)) { | 1123 | } else if (!radeon_check_pot_argument(radeon_gart_size)) { |
1115 | dev_warn(rdev->dev, "gart size (%d) must be a power of 2\n", | 1124 | dev_warn(rdev->dev, "gart size (%d) must be a power of 2\n", |
1116 | radeon_gart_size); | 1125 | radeon_gart_size); |
1117 | if (rdev->family >= CHIP_RV770) | 1126 | radeon_gart_size = radeon_gart_size_auto(rdev->family); |
1118 | radeon_gart_size = 1024; | ||
1119 | else | ||
1120 | radeon_gart_size = 512; | ||
1121 | } | 1127 | } |
1122 | rdev->mc.gtt_size = (uint64_t)radeon_gart_size << 20; | 1128 | rdev->mc.gtt_size = (uint64_t)radeon_gart_size << 20; |
1123 | 1129 | ||
@@ -1572,11 +1578,21 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon) | |||
1572 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); | 1578 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); |
1573 | } | 1579 | } |
1574 | 1580 | ||
1575 | /* unpin the front buffers */ | 1581 | /* unpin the front buffers and cursors */ |
1576 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 1582 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
1583 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
1577 | struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->primary->fb); | 1584 | struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->primary->fb); |
1578 | struct radeon_bo *robj; | 1585 | struct radeon_bo *robj; |
1579 | 1586 | ||
1587 | if (radeon_crtc->cursor_bo) { | ||
1588 | struct radeon_bo *robj = gem_to_radeon_bo(radeon_crtc->cursor_bo); | ||
1589 | r = radeon_bo_reserve(robj, false); | ||
1590 | if (r == 0) { | ||
1591 | radeon_bo_unpin(robj); | ||
1592 | radeon_bo_unreserve(robj); | ||
1593 | } | ||
1594 | } | ||
1595 | |||
1580 | if (rfb == NULL || rfb->obj == NULL) { | 1596 | if (rfb == NULL || rfb->obj == NULL) { |
1581 | continue; | 1597 | continue; |
1582 | } | 1598 | } |
@@ -1639,6 +1655,7 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon) | |||
1639 | { | 1655 | { |
1640 | struct drm_connector *connector; | 1656 | struct drm_connector *connector; |
1641 | struct radeon_device *rdev = dev->dev_private; | 1657 | struct radeon_device *rdev = dev->dev_private; |
1658 | struct drm_crtc *crtc; | ||
1642 | int r; | 1659 | int r; |
1643 | 1660 | ||
1644 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) | 1661 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
@@ -1678,6 +1695,27 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon) | |||
1678 | 1695 | ||
1679 | radeon_restore_bios_scratch_regs(rdev); | 1696 | radeon_restore_bios_scratch_regs(rdev); |
1680 | 1697 | ||
1698 | /* pin cursors */ | ||
1699 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | ||
1700 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
1701 | |||
1702 | if (radeon_crtc->cursor_bo) { | ||
1703 | struct radeon_bo *robj = gem_to_radeon_bo(radeon_crtc->cursor_bo); | ||
1704 | r = radeon_bo_reserve(robj, false); | ||
1705 | if (r == 0) { | ||
1706 | /* Only 27 bit offset for legacy cursor */ | ||
1707 | r = radeon_bo_pin_restricted(robj, | ||
1708 | RADEON_GEM_DOMAIN_VRAM, | ||
1709 | ASIC_IS_AVIVO(rdev) ? | ||
1710 | 0 : 1 << 27, | ||
1711 | &radeon_crtc->cursor_addr); | ||
1712 | if (r != 0) | ||
1713 | DRM_ERROR("Failed to pin cursor BO (%d)\n", r); | ||
1714 | radeon_bo_unreserve(robj); | ||
1715 | } | ||
1716 | } | ||
1717 | } | ||
1718 | |||
1681 | /* init dig PHYs, disp eng pll */ | 1719 | /* init dig PHYs, disp eng pll */ |
1682 | if (rdev->is_atom_bios) { | 1720 | if (rdev->is_atom_bios) { |
1683 | radeon_atom_encoder_init(rdev); | 1721 | radeon_atom_encoder_init(rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c index 634793ea8418..aeb676708e60 100644 --- a/drivers/gpu/drm/radeon/radeon_fb.c +++ b/drivers/gpu/drm/radeon/radeon_fb.c | |||
@@ -257,6 +257,7 @@ static int radeonfb_create(struct drm_fb_helper *helper, | |||
257 | } | 257 | } |
258 | 258 | ||
259 | info->par = rfbdev; | 259 | info->par = rfbdev; |
260 | info->skip_vt_switch = true; | ||
260 | 261 | ||
261 | ret = radeon_framebuffer_init(rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj); | 262 | ret = radeon_framebuffer_init(rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj); |
262 | if (ret) { | 263 | if (ret) { |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 5450fa95a47e..c4777c8d0312 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -260,8 +260,10 @@ void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset, | |||
260 | } | 260 | } |
261 | } | 261 | } |
262 | } | 262 | } |
263 | mb(); | 263 | if (rdev->gart.ptr) { |
264 | radeon_gart_tlb_flush(rdev); | 264 | mb(); |
265 | radeon_gart_tlb_flush(rdev); | ||
266 | } | ||
265 | } | 267 | } |
266 | 268 | ||
267 | /** | 269 | /** |
@@ -306,8 +308,10 @@ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset, | |||
306 | page_base += RADEON_GPU_PAGE_SIZE; | 308 | page_base += RADEON_GPU_PAGE_SIZE; |
307 | } | 309 | } |
308 | } | 310 | } |
309 | mb(); | 311 | if (rdev->gart.ptr) { |
310 | radeon_gart_tlb_flush(rdev); | 312 | mb(); |
313 | radeon_gart_tlb_flush(rdev); | ||
314 | } | ||
311 | return 0; | 315 | return 0; |
312 | } | 316 | } |
313 | 317 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index ac3c1310b953..3dcc5733ff69 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -36,6 +36,7 @@ void radeon_gem_object_free(struct drm_gem_object *gobj) | |||
36 | if (robj) { | 36 | if (robj) { |
37 | if (robj->gem_base.import_attach) | 37 | if (robj->gem_base.import_attach) |
38 | drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg); | 38 | drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg); |
39 | radeon_mn_unregister(robj); | ||
39 | radeon_bo_unref(&robj); | 40 | radeon_bo_unref(&robj); |
40 | } | 41 | } |
41 | } | 42 | } |
@@ -428,7 +429,6 @@ int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
428 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, | 429 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, |
429 | struct drm_file *filp) | 430 | struct drm_file *filp) |
430 | { | 431 | { |
431 | struct radeon_device *rdev = dev->dev_private; | ||
432 | struct drm_radeon_gem_busy *args = data; | 432 | struct drm_radeon_gem_busy *args = data; |
433 | struct drm_gem_object *gobj; | 433 | struct drm_gem_object *gobj; |
434 | struct radeon_bo *robj; | 434 | struct radeon_bo *robj; |
@@ -440,10 +440,16 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, | |||
440 | return -ENOENT; | 440 | return -ENOENT; |
441 | } | 441 | } |
442 | robj = gem_to_radeon_bo(gobj); | 442 | robj = gem_to_radeon_bo(gobj); |
443 | r = radeon_bo_wait(robj, &cur_placement, true); | 443 | |
444 | r = reservation_object_test_signaled_rcu(robj->tbo.resv, true); | ||
445 | if (r == 0) | ||
446 | r = -EBUSY; | ||
447 | else | ||
448 | r = 0; | ||
449 | |||
450 | cur_placement = ACCESS_ONCE(robj->tbo.mem.mem_type); | ||
444 | args->domain = radeon_mem_type_to_domain(cur_placement); | 451 | args->domain = radeon_mem_type_to_domain(cur_placement); |
445 | drm_gem_object_unreference_unlocked(gobj); | 452 | drm_gem_object_unreference_unlocked(gobj); |
446 | r = radeon_gem_handle_lockup(rdev, r); | ||
447 | return r; | 453 | return r; |
448 | } | 454 | } |
449 | 455 | ||
@@ -471,6 +477,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, | |||
471 | r = ret; | 477 | r = ret; |
472 | 478 | ||
473 | /* Flush HDP cache via MMIO if necessary */ | 479 | /* Flush HDP cache via MMIO if necessary */ |
480 | cur_placement = ACCESS_ONCE(robj->tbo.mem.mem_type); | ||
474 | if (rdev->asic->mmio_hdp_flush && | 481 | if (rdev->asic->mmio_hdp_flush && |
475 | radeon_mem_type_to_domain(cur_placement) == RADEON_GEM_DOMAIN_VRAM) | 482 | radeon_mem_type_to_domain(cur_placement) == RADEON_GEM_DOMAIN_VRAM) |
476 | robj->rdev->asic->mmio_hdp_flush(rdev); | 483 | robj->rdev->asic->mmio_hdp_flush(rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 6de5459316b5..07909d817381 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -343,7 +343,6 @@ struct radeon_crtc { | |||
343 | int max_cursor_width; | 343 | int max_cursor_width; |
344 | int max_cursor_height; | 344 | int max_cursor_height; |
345 | uint32_t legacy_display_base_addr; | 345 | uint32_t legacy_display_base_addr; |
346 | uint32_t legacy_cursor_offset; | ||
347 | enum radeon_rmx_type rmx_type; | 346 | enum radeon_rmx_type rmx_type; |
348 | u8 h_border; | 347 | u8 h_border; |
349 | u8 v_border; | 348 | u8 v_border; |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 318165d4855c..676362769b8d 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -75,7 +75,6 @@ static void radeon_ttm_bo_destroy(struct ttm_buffer_object *tbo) | |||
75 | bo = container_of(tbo, struct radeon_bo, tbo); | 75 | bo = container_of(tbo, struct radeon_bo, tbo); |
76 | 76 | ||
77 | radeon_update_memory_usage(bo, bo->tbo.mem.mem_type, -1); | 77 | radeon_update_memory_usage(bo, bo->tbo.mem.mem_type, -1); |
78 | radeon_mn_unregister(bo); | ||
79 | 78 | ||
80 | mutex_lock(&bo->rdev->gem.mutex); | 79 | mutex_lock(&bo->rdev->gem.mutex); |
81 | list_del_init(&bo->list); | 80 | list_del_init(&bo->list); |
diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c index ec10533a49b8..48d97c040f49 100644 --- a/drivers/gpu/drm/radeon/radeon_vm.c +++ b/drivers/gpu/drm/radeon/radeon_vm.c | |||
@@ -493,38 +493,35 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, | |||
493 | } | 493 | } |
494 | 494 | ||
495 | if (bo_va->it.start || bo_va->it.last) { | 495 | if (bo_va->it.start || bo_va->it.last) { |
496 | spin_lock(&vm->status_lock); | 496 | /* add a clone of the bo_va to clear the old address */ |
497 | if (list_empty(&bo_va->vm_status)) { | 497 | struct radeon_bo_va *tmp; |
498 | /* add a clone of the bo_va to clear the old address */ | 498 | tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL); |
499 | struct radeon_bo_va *tmp; | 499 | if (!tmp) { |
500 | spin_unlock(&vm->status_lock); | 500 | mutex_unlock(&vm->mutex); |
501 | tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL); | 501 | r = -ENOMEM; |
502 | if (!tmp) { | 502 | goto error_unreserve; |
503 | mutex_unlock(&vm->mutex); | ||
504 | r = -ENOMEM; | ||
505 | goto error_unreserve; | ||
506 | } | ||
507 | tmp->it.start = bo_va->it.start; | ||
508 | tmp->it.last = bo_va->it.last; | ||
509 | tmp->vm = vm; | ||
510 | tmp->bo = radeon_bo_ref(bo_va->bo); | ||
511 | spin_lock(&vm->status_lock); | ||
512 | list_add(&tmp->vm_status, &vm->freed); | ||
513 | } | 503 | } |
514 | spin_unlock(&vm->status_lock); | 504 | tmp->it.start = bo_va->it.start; |
505 | tmp->it.last = bo_va->it.last; | ||
506 | tmp->vm = vm; | ||
507 | tmp->bo = radeon_bo_ref(bo_va->bo); | ||
515 | 508 | ||
516 | interval_tree_remove(&bo_va->it, &vm->va); | 509 | interval_tree_remove(&bo_va->it, &vm->va); |
510 | spin_lock(&vm->status_lock); | ||
517 | bo_va->it.start = 0; | 511 | bo_va->it.start = 0; |
518 | bo_va->it.last = 0; | 512 | bo_va->it.last = 0; |
513 | list_del_init(&bo_va->vm_status); | ||
514 | list_add(&tmp->vm_status, &vm->freed); | ||
515 | spin_unlock(&vm->status_lock); | ||
519 | } | 516 | } |
520 | 517 | ||
521 | if (soffset || eoffset) { | 518 | if (soffset || eoffset) { |
519 | spin_lock(&vm->status_lock); | ||
522 | bo_va->it.start = soffset; | 520 | bo_va->it.start = soffset; |
523 | bo_va->it.last = eoffset - 1; | 521 | bo_va->it.last = eoffset - 1; |
524 | interval_tree_insert(&bo_va->it, &vm->va); | ||
525 | spin_lock(&vm->status_lock); | ||
526 | list_add(&bo_va->vm_status, &vm->cleared); | 522 | list_add(&bo_va->vm_status, &vm->cleared); |
527 | spin_unlock(&vm->status_lock); | 523 | spin_unlock(&vm->status_lock); |
524 | interval_tree_insert(&bo_va->it, &vm->va); | ||
528 | } | 525 | } |
529 | 526 | ||
530 | bo_va->flags = flags; | 527 | bo_va->flags = flags; |
@@ -1158,7 +1155,8 @@ void radeon_vm_bo_invalidate(struct radeon_device *rdev, | |||
1158 | 1155 | ||
1159 | list_for_each_entry(bo_va, &bo->va, bo_list) { | 1156 | list_for_each_entry(bo_va, &bo->va, bo_list) { |
1160 | spin_lock(&bo_va->vm->status_lock); | 1157 | spin_lock(&bo_va->vm->status_lock); |
1161 | if (list_empty(&bo_va->vm_status)) | 1158 | if (list_empty(&bo_va->vm_status) && |
1159 | (bo_va->it.start || bo_va->it.last)) | ||
1162 | list_add(&bo_va->vm_status, &bo_va->vm->invalidated); | 1160 | list_add(&bo_va->vm_status, &bo_va->vm->invalidated); |
1163 | spin_unlock(&bo_va->vm->status_lock); | 1161 | spin_unlock(&bo_va->vm->status_lock); |
1164 | } | 1162 | } |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 26388b5dd6ed..07037e32dea3 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -6466,23 +6466,27 @@ restart_ih: | |||
6466 | case 1: /* D1 vblank/vline */ | 6466 | case 1: /* D1 vblank/vline */ |
6467 | switch (src_data) { | 6467 | switch (src_data) { |
6468 | case 0: /* D1 vblank */ | 6468 | case 0: /* D1 vblank */ |
6469 | if (rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VBLANK_INTERRUPT) { | 6469 | if (!(rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VBLANK_INTERRUPT)) |
6470 | if (rdev->irq.crtc_vblank_int[0]) { | 6470 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6471 | drm_handle_vblank(rdev->ddev, 0); | 6471 | |
6472 | rdev->pm.vblank_sync = true; | 6472 | if (rdev->irq.crtc_vblank_int[0]) { |
6473 | wake_up(&rdev->irq.vblank_queue); | 6473 | drm_handle_vblank(rdev->ddev, 0); |
6474 | } | 6474 | rdev->pm.vblank_sync = true; |
6475 | if (atomic_read(&rdev->irq.pflip[0])) | 6475 | wake_up(&rdev->irq.vblank_queue); |
6476 | radeon_crtc_handle_vblank(rdev, 0); | ||
6477 | rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VBLANK_INTERRUPT; | ||
6478 | DRM_DEBUG("IH: D1 vblank\n"); | ||
6479 | } | 6476 | } |
6477 | if (atomic_read(&rdev->irq.pflip[0])) | ||
6478 | radeon_crtc_handle_vblank(rdev, 0); | ||
6479 | rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VBLANK_INTERRUPT; | ||
6480 | DRM_DEBUG("IH: D1 vblank\n"); | ||
6481 | |||
6480 | break; | 6482 | break; |
6481 | case 1: /* D1 vline */ | 6483 | case 1: /* D1 vline */ |
6482 | if (rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VLINE_INTERRUPT) { | 6484 | if (!(rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VLINE_INTERRUPT)) |
6483 | rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VLINE_INTERRUPT; | 6485 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6484 | DRM_DEBUG("IH: D1 vline\n"); | 6486 | |
6485 | } | 6487 | rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VLINE_INTERRUPT; |
6488 | DRM_DEBUG("IH: D1 vline\n"); | ||
6489 | |||
6486 | break; | 6490 | break; |
6487 | default: | 6491 | default: |
6488 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 6492 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -6492,23 +6496,27 @@ restart_ih: | |||
6492 | case 2: /* D2 vblank/vline */ | 6496 | case 2: /* D2 vblank/vline */ |
6493 | switch (src_data) { | 6497 | switch (src_data) { |
6494 | case 0: /* D2 vblank */ | 6498 | case 0: /* D2 vblank */ |
6495 | if (rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VBLANK_INTERRUPT) { | 6499 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VBLANK_INTERRUPT)) |
6496 | if (rdev->irq.crtc_vblank_int[1]) { | 6500 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6497 | drm_handle_vblank(rdev->ddev, 1); | 6501 | |
6498 | rdev->pm.vblank_sync = true; | 6502 | if (rdev->irq.crtc_vblank_int[1]) { |
6499 | wake_up(&rdev->irq.vblank_queue); | 6503 | drm_handle_vblank(rdev->ddev, 1); |
6500 | } | 6504 | rdev->pm.vblank_sync = true; |
6501 | if (atomic_read(&rdev->irq.pflip[1])) | 6505 | wake_up(&rdev->irq.vblank_queue); |
6502 | radeon_crtc_handle_vblank(rdev, 1); | ||
6503 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT; | ||
6504 | DRM_DEBUG("IH: D2 vblank\n"); | ||
6505 | } | 6506 | } |
6507 | if (atomic_read(&rdev->irq.pflip[1])) | ||
6508 | radeon_crtc_handle_vblank(rdev, 1); | ||
6509 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT; | ||
6510 | DRM_DEBUG("IH: D2 vblank\n"); | ||
6511 | |||
6506 | break; | 6512 | break; |
6507 | case 1: /* D2 vline */ | 6513 | case 1: /* D2 vline */ |
6508 | if (rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VLINE_INTERRUPT) { | 6514 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VLINE_INTERRUPT)) |
6509 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VLINE_INTERRUPT; | 6515 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6510 | DRM_DEBUG("IH: D2 vline\n"); | 6516 | |
6511 | } | 6517 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VLINE_INTERRUPT; |
6518 | DRM_DEBUG("IH: D2 vline\n"); | ||
6519 | |||
6512 | break; | 6520 | break; |
6513 | default: | 6521 | default: |
6514 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 6522 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -6518,23 +6526,27 @@ restart_ih: | |||
6518 | case 3: /* D3 vblank/vline */ | 6526 | case 3: /* D3 vblank/vline */ |
6519 | switch (src_data) { | 6527 | switch (src_data) { |
6520 | case 0: /* D3 vblank */ | 6528 | case 0: /* D3 vblank */ |
6521 | if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT) { | 6529 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT)) |
6522 | if (rdev->irq.crtc_vblank_int[2]) { | 6530 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6523 | drm_handle_vblank(rdev->ddev, 2); | 6531 | |
6524 | rdev->pm.vblank_sync = true; | 6532 | if (rdev->irq.crtc_vblank_int[2]) { |
6525 | wake_up(&rdev->irq.vblank_queue); | 6533 | drm_handle_vblank(rdev->ddev, 2); |
6526 | } | 6534 | rdev->pm.vblank_sync = true; |
6527 | if (atomic_read(&rdev->irq.pflip[2])) | 6535 | wake_up(&rdev->irq.vblank_queue); |
6528 | radeon_crtc_handle_vblank(rdev, 2); | ||
6529 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT; | ||
6530 | DRM_DEBUG("IH: D3 vblank\n"); | ||
6531 | } | 6536 | } |
6537 | if (atomic_read(&rdev->irq.pflip[2])) | ||
6538 | radeon_crtc_handle_vblank(rdev, 2); | ||
6539 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT; | ||
6540 | DRM_DEBUG("IH: D3 vblank\n"); | ||
6541 | |||
6532 | break; | 6542 | break; |
6533 | case 1: /* D3 vline */ | 6543 | case 1: /* D3 vline */ |
6534 | if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VLINE_INTERRUPT) { | 6544 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VLINE_INTERRUPT)) |
6535 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VLINE_INTERRUPT; | 6545 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6536 | DRM_DEBUG("IH: D3 vline\n"); | 6546 | |
6537 | } | 6547 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VLINE_INTERRUPT; |
6548 | DRM_DEBUG("IH: D3 vline\n"); | ||
6549 | |||
6538 | break; | 6550 | break; |
6539 | default: | 6551 | default: |
6540 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 6552 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -6544,23 +6556,27 @@ restart_ih: | |||
6544 | case 4: /* D4 vblank/vline */ | 6556 | case 4: /* D4 vblank/vline */ |
6545 | switch (src_data) { | 6557 | switch (src_data) { |
6546 | case 0: /* D4 vblank */ | 6558 | case 0: /* D4 vblank */ |
6547 | if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VBLANK_INTERRUPT) { | 6559 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VBLANK_INTERRUPT)) |
6548 | if (rdev->irq.crtc_vblank_int[3]) { | 6560 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6549 | drm_handle_vblank(rdev->ddev, 3); | 6561 | |
6550 | rdev->pm.vblank_sync = true; | 6562 | if (rdev->irq.crtc_vblank_int[3]) { |
6551 | wake_up(&rdev->irq.vblank_queue); | 6563 | drm_handle_vblank(rdev->ddev, 3); |
6552 | } | 6564 | rdev->pm.vblank_sync = true; |
6553 | if (atomic_read(&rdev->irq.pflip[3])) | 6565 | wake_up(&rdev->irq.vblank_queue); |
6554 | radeon_crtc_handle_vblank(rdev, 3); | ||
6555 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT; | ||
6556 | DRM_DEBUG("IH: D4 vblank\n"); | ||
6557 | } | 6566 | } |
6567 | if (atomic_read(&rdev->irq.pflip[3])) | ||
6568 | radeon_crtc_handle_vblank(rdev, 3); | ||
6569 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT; | ||
6570 | DRM_DEBUG("IH: D4 vblank\n"); | ||
6571 | |||
6558 | break; | 6572 | break; |
6559 | case 1: /* D4 vline */ | 6573 | case 1: /* D4 vline */ |
6560 | if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VLINE_INTERRUPT) { | 6574 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VLINE_INTERRUPT)) |
6561 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VLINE_INTERRUPT; | 6575 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6562 | DRM_DEBUG("IH: D4 vline\n"); | 6576 | |
6563 | } | 6577 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VLINE_INTERRUPT; |
6578 | DRM_DEBUG("IH: D4 vline\n"); | ||
6579 | |||
6564 | break; | 6580 | break; |
6565 | default: | 6581 | default: |
6566 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 6582 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -6570,23 +6586,27 @@ restart_ih: | |||
6570 | case 5: /* D5 vblank/vline */ | 6586 | case 5: /* D5 vblank/vline */ |
6571 | switch (src_data) { | 6587 | switch (src_data) { |
6572 | case 0: /* D5 vblank */ | 6588 | case 0: /* D5 vblank */ |
6573 | if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT) { | 6589 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT)) |
6574 | if (rdev->irq.crtc_vblank_int[4]) { | 6590 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6575 | drm_handle_vblank(rdev->ddev, 4); | 6591 | |
6576 | rdev->pm.vblank_sync = true; | 6592 | if (rdev->irq.crtc_vblank_int[4]) { |
6577 | wake_up(&rdev->irq.vblank_queue); | 6593 | drm_handle_vblank(rdev->ddev, 4); |
6578 | } | 6594 | rdev->pm.vblank_sync = true; |
6579 | if (atomic_read(&rdev->irq.pflip[4])) | 6595 | wake_up(&rdev->irq.vblank_queue); |
6580 | radeon_crtc_handle_vblank(rdev, 4); | ||
6581 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT; | ||
6582 | DRM_DEBUG("IH: D5 vblank\n"); | ||
6583 | } | 6596 | } |
6597 | if (atomic_read(&rdev->irq.pflip[4])) | ||
6598 | radeon_crtc_handle_vblank(rdev, 4); | ||
6599 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT; | ||
6600 | DRM_DEBUG("IH: D5 vblank\n"); | ||
6601 | |||
6584 | break; | 6602 | break; |
6585 | case 1: /* D5 vline */ | 6603 | case 1: /* D5 vline */ |
6586 | if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VLINE_INTERRUPT) { | 6604 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VLINE_INTERRUPT)) |
6587 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VLINE_INTERRUPT; | 6605 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6588 | DRM_DEBUG("IH: D5 vline\n"); | 6606 | |
6589 | } | 6607 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VLINE_INTERRUPT; |
6608 | DRM_DEBUG("IH: D5 vline\n"); | ||
6609 | |||
6590 | break; | 6610 | break; |
6591 | default: | 6611 | default: |
6592 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 6612 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -6596,23 +6616,27 @@ restart_ih: | |||
6596 | case 6: /* D6 vblank/vline */ | 6616 | case 6: /* D6 vblank/vline */ |
6597 | switch (src_data) { | 6617 | switch (src_data) { |
6598 | case 0: /* D6 vblank */ | 6618 | case 0: /* D6 vblank */ |
6599 | if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VBLANK_INTERRUPT) { | 6619 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VBLANK_INTERRUPT)) |
6600 | if (rdev->irq.crtc_vblank_int[5]) { | 6620 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6601 | drm_handle_vblank(rdev->ddev, 5); | 6621 | |
6602 | rdev->pm.vblank_sync = true; | 6622 | if (rdev->irq.crtc_vblank_int[5]) { |
6603 | wake_up(&rdev->irq.vblank_queue); | 6623 | drm_handle_vblank(rdev->ddev, 5); |
6604 | } | 6624 | rdev->pm.vblank_sync = true; |
6605 | if (atomic_read(&rdev->irq.pflip[5])) | 6625 | wake_up(&rdev->irq.vblank_queue); |
6606 | radeon_crtc_handle_vblank(rdev, 5); | ||
6607 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT; | ||
6608 | DRM_DEBUG("IH: D6 vblank\n"); | ||
6609 | } | 6626 | } |
6627 | if (atomic_read(&rdev->irq.pflip[5])) | ||
6628 | radeon_crtc_handle_vblank(rdev, 5); | ||
6629 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT; | ||
6630 | DRM_DEBUG("IH: D6 vblank\n"); | ||
6631 | |||
6610 | break; | 6632 | break; |
6611 | case 1: /* D6 vline */ | 6633 | case 1: /* D6 vline */ |
6612 | if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VLINE_INTERRUPT) { | 6634 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VLINE_INTERRUPT)) |
6613 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VLINE_INTERRUPT; | 6635 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6614 | DRM_DEBUG("IH: D6 vline\n"); | 6636 | |
6615 | } | 6637 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VLINE_INTERRUPT; |
6638 | DRM_DEBUG("IH: D6 vline\n"); | ||
6639 | |||
6616 | break; | 6640 | break; |
6617 | default: | 6641 | default: |
6618 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 6642 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
@@ -6632,88 +6656,112 @@ restart_ih: | |||
6632 | case 42: /* HPD hotplug */ | 6656 | case 42: /* HPD hotplug */ |
6633 | switch (src_data) { | 6657 | switch (src_data) { |
6634 | case 0: | 6658 | case 0: |
6635 | if (rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_INTERRUPT) { | 6659 | if (!(rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_INTERRUPT)) |
6636 | rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_INTERRUPT; | 6660 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6637 | queue_hotplug = true; | 6661 | |
6638 | DRM_DEBUG("IH: HPD1\n"); | 6662 | rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_INTERRUPT; |
6639 | } | 6663 | queue_hotplug = true; |
6664 | DRM_DEBUG("IH: HPD1\n"); | ||
6665 | |||
6640 | break; | 6666 | break; |
6641 | case 1: | 6667 | case 1: |
6642 | if (rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_INTERRUPT) { | 6668 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_INTERRUPT)) |
6643 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_INTERRUPT; | 6669 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6644 | queue_hotplug = true; | 6670 | |
6645 | DRM_DEBUG("IH: HPD2\n"); | 6671 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_INTERRUPT; |
6646 | } | 6672 | queue_hotplug = true; |
6673 | DRM_DEBUG("IH: HPD2\n"); | ||
6674 | |||
6647 | break; | 6675 | break; |
6648 | case 2: | 6676 | case 2: |
6649 | if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_INTERRUPT) { | 6677 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_INTERRUPT)) |
6650 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_INTERRUPT; | 6678 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6651 | queue_hotplug = true; | 6679 | |
6652 | DRM_DEBUG("IH: HPD3\n"); | 6680 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_INTERRUPT; |
6653 | } | 6681 | queue_hotplug = true; |
6682 | DRM_DEBUG("IH: HPD3\n"); | ||
6683 | |||
6654 | break; | 6684 | break; |
6655 | case 3: | 6685 | case 3: |
6656 | if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_INTERRUPT) { | 6686 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_INTERRUPT)) |
6657 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_INTERRUPT; | 6687 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6658 | queue_hotplug = true; | 6688 | |
6659 | DRM_DEBUG("IH: HPD4\n"); | 6689 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_INTERRUPT; |
6660 | } | 6690 | queue_hotplug = true; |
6691 | DRM_DEBUG("IH: HPD4\n"); | ||
6692 | |||
6661 | break; | 6693 | break; |
6662 | case 4: | 6694 | case 4: |
6663 | if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_INTERRUPT) { | 6695 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_INTERRUPT)) |
6664 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_INTERRUPT; | 6696 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6665 | queue_hotplug = true; | 6697 | |
6666 | DRM_DEBUG("IH: HPD5\n"); | 6698 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_INTERRUPT; |
6667 | } | 6699 | queue_hotplug = true; |
6700 | DRM_DEBUG("IH: HPD5\n"); | ||
6701 | |||
6668 | break; | 6702 | break; |
6669 | case 5: | 6703 | case 5: |
6670 | if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_INTERRUPT) { | 6704 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_INTERRUPT)) |
6671 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_INTERRUPT; | 6705 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6672 | queue_hotplug = true; | 6706 | |
6673 | DRM_DEBUG("IH: HPD6\n"); | 6707 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_INTERRUPT; |
6674 | } | 6708 | queue_hotplug = true; |
6709 | DRM_DEBUG("IH: HPD6\n"); | ||
6710 | |||
6675 | break; | 6711 | break; |
6676 | case 6: | 6712 | case 6: |
6677 | if (rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_RX_INTERRUPT) { | 6713 | if (!(rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_RX_INTERRUPT)) |
6678 | rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_RX_INTERRUPT; | 6714 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6679 | queue_dp = true; | 6715 | |
6680 | DRM_DEBUG("IH: HPD_RX 1\n"); | 6716 | rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_RX_INTERRUPT; |
6681 | } | 6717 | queue_dp = true; |
6718 | DRM_DEBUG("IH: HPD_RX 1\n"); | ||
6719 | |||
6682 | break; | 6720 | break; |
6683 | case 7: | 6721 | case 7: |
6684 | if (rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_RX_INTERRUPT) { | 6722 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_RX_INTERRUPT)) |
6685 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_RX_INTERRUPT; | 6723 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6686 | queue_dp = true; | 6724 | |
6687 | DRM_DEBUG("IH: HPD_RX 2\n"); | 6725 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_RX_INTERRUPT; |
6688 | } | 6726 | queue_dp = true; |
6727 | DRM_DEBUG("IH: HPD_RX 2\n"); | ||
6728 | |||
6689 | break; | 6729 | break; |
6690 | case 8: | 6730 | case 8: |
6691 | if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_RX_INTERRUPT) { | 6731 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_RX_INTERRUPT)) |
6692 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_RX_INTERRUPT; | 6732 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6693 | queue_dp = true; | 6733 | |
6694 | DRM_DEBUG("IH: HPD_RX 3\n"); | 6734 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_RX_INTERRUPT; |
6695 | } | 6735 | queue_dp = true; |
6736 | DRM_DEBUG("IH: HPD_RX 3\n"); | ||
6737 | |||
6696 | break; | 6738 | break; |
6697 | case 9: | 6739 | case 9: |
6698 | if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_RX_INTERRUPT) { | 6740 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_RX_INTERRUPT)) |
6699 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_RX_INTERRUPT; | 6741 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6700 | queue_dp = true; | 6742 | |
6701 | DRM_DEBUG("IH: HPD_RX 4\n"); | 6743 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_RX_INTERRUPT; |
6702 | } | 6744 | queue_dp = true; |
6745 | DRM_DEBUG("IH: HPD_RX 4\n"); | ||
6746 | |||
6703 | break; | 6747 | break; |
6704 | case 10: | 6748 | case 10: |
6705 | if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_RX_INTERRUPT) { | 6749 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_RX_INTERRUPT)) |
6706 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_RX_INTERRUPT; | 6750 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6707 | queue_dp = true; | 6751 | |
6708 | DRM_DEBUG("IH: HPD_RX 5\n"); | 6752 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_RX_INTERRUPT; |
6709 | } | 6753 | queue_dp = true; |
6754 | DRM_DEBUG("IH: HPD_RX 5\n"); | ||
6755 | |||
6710 | break; | 6756 | break; |
6711 | case 11: | 6757 | case 11: |
6712 | if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_RX_INTERRUPT) { | 6758 | if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_RX_INTERRUPT)) |
6713 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_RX_INTERRUPT; | 6759 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
6714 | queue_dp = true; | 6760 | |
6715 | DRM_DEBUG("IH: HPD_RX 6\n"); | 6761 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_RX_INTERRUPT; |
6716 | } | 6762 | queue_dp = true; |
6763 | DRM_DEBUG("IH: HPD_RX 6\n"); | ||
6764 | |||
6717 | break; | 6765 | break; |
6718 | default: | 6766 | default: |
6719 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); | 6767 | DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 1dbdf3230dae..787cd8fd897f 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c | |||
@@ -2926,6 +2926,7 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = { | |||
2926 | /* PITCAIRN - https://bugs.freedesktop.org/show_bug.cgi?id=76490 */ | 2926 | /* PITCAIRN - https://bugs.freedesktop.org/show_bug.cgi?id=76490 */ |
2927 | { PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 }, | 2927 | { PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 }, |
2928 | { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 }, | 2928 | { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 }, |
2929 | { PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 }, | ||
2929 | { 0, 0, 0, 0 }, | 2930 | { 0, 0, 0, 0 }, |
2930 | }; | 2931 | }; |
2931 | 2932 | ||
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 01b558fe3695..9a0c2911272a 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c | |||
@@ -555,7 +555,6 @@ static struct platform_driver rockchip_drm_platform_driver = { | |||
555 | .probe = rockchip_drm_platform_probe, | 555 | .probe = rockchip_drm_platform_probe, |
556 | .remove = rockchip_drm_platform_remove, | 556 | .remove = rockchip_drm_platform_remove, |
557 | .driver = { | 557 | .driver = { |
558 | .owner = THIS_MODULE, | ||
559 | .name = "rockchip-drm", | 558 | .name = "rockchip-drm", |
560 | .of_match_table = rockchip_drm_dt_ids, | 559 | .of_match_table = rockchip_drm_dt_ids, |
561 | .pm = &rockchip_drm_pm_ops, | 560 | .pm = &rockchip_drm_pm_ops, |
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c index 77d52893d40f..002645bb5bbf 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c | |||
@@ -162,7 +162,8 @@ static void rockchip_drm_output_poll_changed(struct drm_device *dev) | |||
162 | struct rockchip_drm_private *private = dev->dev_private; | 162 | struct rockchip_drm_private *private = dev->dev_private; |
163 | struct drm_fb_helper *fb_helper = &private->fbdev_helper; | 163 | struct drm_fb_helper *fb_helper = &private->fbdev_helper; |
164 | 164 | ||
165 | drm_fb_helper_hotplug_event(fb_helper); | 165 | if (fb_helper) |
166 | drm_fb_helper_hotplug_event(fb_helper); | ||
166 | } | 167 | } |
167 | 168 | ||
168 | static const struct drm_mode_config_funcs rockchip_drm_mode_config_funcs = { | 169 | static const struct drm_mode_config_funcs rockchip_drm_mode_config_funcs = { |
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c index eb2282cc4a56..eba5f8a52fbd 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c | |||
@@ -54,55 +54,56 @@ static void rockchip_gem_free_buf(struct rockchip_gem_object *rk_obj) | |||
54 | &rk_obj->dma_attrs); | 54 | &rk_obj->dma_attrs); |
55 | } | 55 | } |
56 | 56 | ||
57 | int rockchip_gem_mmap_buf(struct drm_gem_object *obj, | 57 | static int rockchip_drm_gem_object_mmap(struct drm_gem_object *obj, |
58 | struct vm_area_struct *vma) | 58 | struct vm_area_struct *vma) |
59 | |||
59 | { | 60 | { |
61 | int ret; | ||
60 | struct rockchip_gem_object *rk_obj = to_rockchip_obj(obj); | 62 | struct rockchip_gem_object *rk_obj = to_rockchip_obj(obj); |
61 | struct drm_device *drm = obj->dev; | 63 | struct drm_device *drm = obj->dev; |
62 | unsigned long vm_size; | ||
63 | 64 | ||
64 | vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; | 65 | /* |
65 | vm_size = vma->vm_end - vma->vm_start; | 66 | * dma_alloc_attrs() allocated a struct page table for rk_obj, so clear |
66 | 67 | * VM_PFNMAP flag that was set by drm_gem_mmap_obj()/drm_gem_mmap(). | |
67 | if (vm_size > obj->size) | 68 | */ |
68 | return -EINVAL; | 69 | vma->vm_flags &= ~VM_PFNMAP; |
69 | 70 | ||
70 | return dma_mmap_attrs(drm->dev, vma, rk_obj->kvaddr, rk_obj->dma_addr, | 71 | ret = dma_mmap_attrs(drm->dev, vma, rk_obj->kvaddr, rk_obj->dma_addr, |
71 | obj->size, &rk_obj->dma_attrs); | 72 | obj->size, &rk_obj->dma_attrs); |
73 | if (ret) | ||
74 | drm_gem_vm_close(vma); | ||
75 | |||
76 | return ret; | ||
72 | } | 77 | } |
73 | 78 | ||
74 | /* drm driver mmap file operations */ | 79 | int rockchip_gem_mmap_buf(struct drm_gem_object *obj, |
75 | int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma) | 80 | struct vm_area_struct *vma) |
76 | { | 81 | { |
77 | struct drm_file *priv = filp->private_data; | 82 | struct drm_device *drm = obj->dev; |
78 | struct drm_device *dev = priv->minor->dev; | ||
79 | struct drm_gem_object *obj; | ||
80 | struct drm_vma_offset_node *node; | ||
81 | int ret; | 83 | int ret; |
82 | 84 | ||
83 | if (drm_device_is_unplugged(dev)) | 85 | mutex_lock(&drm->struct_mutex); |
84 | return -ENODEV; | 86 | ret = drm_gem_mmap_obj(obj, obj->size, vma); |
87 | mutex_unlock(&drm->struct_mutex); | ||
88 | if (ret) | ||
89 | return ret; | ||
85 | 90 | ||
86 | mutex_lock(&dev->struct_mutex); | 91 | return rockchip_drm_gem_object_mmap(obj, vma); |
92 | } | ||
87 | 93 | ||
88 | node = drm_vma_offset_exact_lookup(dev->vma_offset_manager, | 94 | /* drm driver mmap file operations */ |
89 | vma->vm_pgoff, | 95 | int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma) |
90 | vma_pages(vma)); | 96 | { |
91 | if (!node) { | 97 | struct drm_gem_object *obj; |
92 | mutex_unlock(&dev->struct_mutex); | 98 | int ret; |
93 | DRM_ERROR("failed to find vma node.\n"); | ||
94 | return -EINVAL; | ||
95 | } else if (!drm_vma_node_is_allowed(node, filp)) { | ||
96 | mutex_unlock(&dev->struct_mutex); | ||
97 | return -EACCES; | ||
98 | } | ||
99 | 99 | ||
100 | obj = container_of(node, struct drm_gem_object, vma_node); | 100 | ret = drm_gem_mmap(filp, vma); |
101 | ret = rockchip_gem_mmap_buf(obj, vma); | 101 | if (ret) |
102 | return ret; | ||
102 | 103 | ||
103 | mutex_unlock(&dev->struct_mutex); | 104 | obj = vma->vm_private_data; |
104 | 105 | ||
105 | return ret; | 106 | return rockchip_drm_gem_object_mmap(obj, vma); |
106 | } | 107 | } |
107 | 108 | ||
108 | struct rockchip_gem_object * | 109 | struct rockchip_gem_object * |
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index dc65161d7cad..34b78e736532 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c | |||
@@ -170,6 +170,7 @@ struct vop_win_phy { | |||
170 | 170 | ||
171 | struct vop_reg enable; | 171 | struct vop_reg enable; |
172 | struct vop_reg format; | 172 | struct vop_reg format; |
173 | struct vop_reg rb_swap; | ||
173 | struct vop_reg act_info; | 174 | struct vop_reg act_info; |
174 | struct vop_reg dsp_info; | 175 | struct vop_reg dsp_info; |
175 | struct vop_reg dsp_st; | 176 | struct vop_reg dsp_st; |
@@ -199,8 +200,12 @@ struct vop_data { | |||
199 | static const uint32_t formats_01[] = { | 200 | static const uint32_t formats_01[] = { |
200 | DRM_FORMAT_XRGB8888, | 201 | DRM_FORMAT_XRGB8888, |
201 | DRM_FORMAT_ARGB8888, | 202 | DRM_FORMAT_ARGB8888, |
203 | DRM_FORMAT_XBGR8888, | ||
204 | DRM_FORMAT_ABGR8888, | ||
202 | DRM_FORMAT_RGB888, | 205 | DRM_FORMAT_RGB888, |
206 | DRM_FORMAT_BGR888, | ||
203 | DRM_FORMAT_RGB565, | 207 | DRM_FORMAT_RGB565, |
208 | DRM_FORMAT_BGR565, | ||
204 | DRM_FORMAT_NV12, | 209 | DRM_FORMAT_NV12, |
205 | DRM_FORMAT_NV16, | 210 | DRM_FORMAT_NV16, |
206 | DRM_FORMAT_NV24, | 211 | DRM_FORMAT_NV24, |
@@ -209,8 +214,12 @@ static const uint32_t formats_01[] = { | |||
209 | static const uint32_t formats_234[] = { | 214 | static const uint32_t formats_234[] = { |
210 | DRM_FORMAT_XRGB8888, | 215 | DRM_FORMAT_XRGB8888, |
211 | DRM_FORMAT_ARGB8888, | 216 | DRM_FORMAT_ARGB8888, |
217 | DRM_FORMAT_XBGR8888, | ||
218 | DRM_FORMAT_ABGR8888, | ||
212 | DRM_FORMAT_RGB888, | 219 | DRM_FORMAT_RGB888, |
220 | DRM_FORMAT_BGR888, | ||
213 | DRM_FORMAT_RGB565, | 221 | DRM_FORMAT_RGB565, |
222 | DRM_FORMAT_BGR565, | ||
214 | }; | 223 | }; |
215 | 224 | ||
216 | static const struct vop_win_phy win01_data = { | 225 | static const struct vop_win_phy win01_data = { |
@@ -218,6 +227,7 @@ static const struct vop_win_phy win01_data = { | |||
218 | .nformats = ARRAY_SIZE(formats_01), | 227 | .nformats = ARRAY_SIZE(formats_01), |
219 | .enable = VOP_REG(WIN0_CTRL0, 0x1, 0), | 228 | .enable = VOP_REG(WIN0_CTRL0, 0x1, 0), |
220 | .format = VOP_REG(WIN0_CTRL0, 0x7, 1), | 229 | .format = VOP_REG(WIN0_CTRL0, 0x7, 1), |
230 | .rb_swap = VOP_REG(WIN0_CTRL0, 0x1, 12), | ||
221 | .act_info = VOP_REG(WIN0_ACT_INFO, 0x1fff1fff, 0), | 231 | .act_info = VOP_REG(WIN0_ACT_INFO, 0x1fff1fff, 0), |
222 | .dsp_info = VOP_REG(WIN0_DSP_INFO, 0x0fff0fff, 0), | 232 | .dsp_info = VOP_REG(WIN0_DSP_INFO, 0x0fff0fff, 0), |
223 | .dsp_st = VOP_REG(WIN0_DSP_ST, 0x1fff1fff, 0), | 233 | .dsp_st = VOP_REG(WIN0_DSP_ST, 0x1fff1fff, 0), |
@@ -234,6 +244,7 @@ static const struct vop_win_phy win23_data = { | |||
234 | .nformats = ARRAY_SIZE(formats_234), | 244 | .nformats = ARRAY_SIZE(formats_234), |
235 | .enable = VOP_REG(WIN2_CTRL0, 0x1, 0), | 245 | .enable = VOP_REG(WIN2_CTRL0, 0x1, 0), |
236 | .format = VOP_REG(WIN2_CTRL0, 0x7, 1), | 246 | .format = VOP_REG(WIN2_CTRL0, 0x7, 1), |
247 | .rb_swap = VOP_REG(WIN2_CTRL0, 0x1, 12), | ||
237 | .dsp_info = VOP_REG(WIN2_DSP_INFO0, 0x0fff0fff, 0), | 248 | .dsp_info = VOP_REG(WIN2_DSP_INFO0, 0x0fff0fff, 0), |
238 | .dsp_st = VOP_REG(WIN2_DSP_ST0, 0x1fff1fff, 0), | 249 | .dsp_st = VOP_REG(WIN2_DSP_ST0, 0x1fff1fff, 0), |
239 | .yrgb_mst = VOP_REG(WIN2_MST0, 0xffffffff, 0), | 250 | .yrgb_mst = VOP_REG(WIN2_MST0, 0xffffffff, 0), |
@@ -242,15 +253,6 @@ static const struct vop_win_phy win23_data = { | |||
242 | .dst_alpha_ctl = VOP_REG(WIN2_DST_ALPHA_CTRL, 0xff, 0), | 253 | .dst_alpha_ctl = VOP_REG(WIN2_DST_ALPHA_CTRL, 0xff, 0), |
243 | }; | 254 | }; |
244 | 255 | ||
245 | static const struct vop_win_phy cursor_data = { | ||
246 | .data_formats = formats_234, | ||
247 | .nformats = ARRAY_SIZE(formats_234), | ||
248 | .enable = VOP_REG(HWC_CTRL0, 0x1, 0), | ||
249 | .format = VOP_REG(HWC_CTRL0, 0x7, 1), | ||
250 | .dsp_st = VOP_REG(HWC_DSP_ST, 0x1fff1fff, 0), | ||
251 | .yrgb_mst = VOP_REG(HWC_MST, 0xffffffff, 0), | ||
252 | }; | ||
253 | |||
254 | static const struct vop_ctrl ctrl_data = { | 256 | static const struct vop_ctrl ctrl_data = { |
255 | .standby = VOP_REG(SYS_CTRL, 0x1, 22), | 257 | .standby = VOP_REG(SYS_CTRL, 0x1, 22), |
256 | .gate_en = VOP_REG(SYS_CTRL, 0x1, 23), | 258 | .gate_en = VOP_REG(SYS_CTRL, 0x1, 23), |
@@ -282,14 +284,14 @@ static const struct vop_reg_data vop_init_reg_table[] = { | |||
282 | /* | 284 | /* |
283 | * Note: rk3288 has a dedicated 'cursor' window, however, that window requires | 285 | * Note: rk3288 has a dedicated 'cursor' window, however, that window requires |
284 | * special support to get alpha blending working. For now, just use overlay | 286 | * special support to get alpha blending working. For now, just use overlay |
285 | * window 1 for the drm cursor. | 287 | * window 3 for the drm cursor. |
288 | * | ||
286 | */ | 289 | */ |
287 | static const struct vop_win_data rk3288_vop_win_data[] = { | 290 | static const struct vop_win_data rk3288_vop_win_data[] = { |
288 | { .base = 0x00, .phy = &win01_data, .type = DRM_PLANE_TYPE_PRIMARY }, | 291 | { .base = 0x00, .phy = &win01_data, .type = DRM_PLANE_TYPE_PRIMARY }, |
289 | { .base = 0x40, .phy = &win01_data, .type = DRM_PLANE_TYPE_CURSOR }, | 292 | { .base = 0x40, .phy = &win01_data, .type = DRM_PLANE_TYPE_OVERLAY }, |
290 | { .base = 0x00, .phy = &win23_data, .type = DRM_PLANE_TYPE_OVERLAY }, | 293 | { .base = 0x00, .phy = &win23_data, .type = DRM_PLANE_TYPE_OVERLAY }, |
291 | { .base = 0x50, .phy = &win23_data, .type = DRM_PLANE_TYPE_OVERLAY }, | 294 | { .base = 0x50, .phy = &win23_data, .type = DRM_PLANE_TYPE_CURSOR }, |
292 | { .base = 0x00, .phy = &cursor_data, .type = DRM_PLANE_TYPE_OVERLAY }, | ||
293 | }; | 295 | }; |
294 | 296 | ||
295 | static const struct vop_data rk3288_vop = { | 297 | static const struct vop_data rk3288_vop = { |
@@ -352,15 +354,32 @@ static inline void vop_mask_write_relaxed(struct vop *vop, uint32_t offset, | |||
352 | } | 354 | } |
353 | } | 355 | } |
354 | 356 | ||
357 | static bool has_rb_swapped(uint32_t format) | ||
358 | { | ||
359 | switch (format) { | ||
360 | case DRM_FORMAT_XBGR8888: | ||
361 | case DRM_FORMAT_ABGR8888: | ||
362 | case DRM_FORMAT_BGR888: | ||
363 | case DRM_FORMAT_BGR565: | ||
364 | return true; | ||
365 | default: | ||
366 | return false; | ||
367 | } | ||
368 | } | ||
369 | |||
355 | static enum vop_data_format vop_convert_format(uint32_t format) | 370 | static enum vop_data_format vop_convert_format(uint32_t format) |
356 | { | 371 | { |
357 | switch (format) { | 372 | switch (format) { |
358 | case DRM_FORMAT_XRGB8888: | 373 | case DRM_FORMAT_XRGB8888: |
359 | case DRM_FORMAT_ARGB8888: | 374 | case DRM_FORMAT_ARGB8888: |
375 | case DRM_FORMAT_XBGR8888: | ||
376 | case DRM_FORMAT_ABGR8888: | ||
360 | return VOP_FMT_ARGB8888; | 377 | return VOP_FMT_ARGB8888; |
361 | case DRM_FORMAT_RGB888: | 378 | case DRM_FORMAT_RGB888: |
379 | case DRM_FORMAT_BGR888: | ||
362 | return VOP_FMT_RGB888; | 380 | return VOP_FMT_RGB888; |
363 | case DRM_FORMAT_RGB565: | 381 | case DRM_FORMAT_RGB565: |
382 | case DRM_FORMAT_BGR565: | ||
364 | return VOP_FMT_RGB565; | 383 | return VOP_FMT_RGB565; |
365 | case DRM_FORMAT_NV12: | 384 | case DRM_FORMAT_NV12: |
366 | return VOP_FMT_YUV420SP; | 385 | return VOP_FMT_YUV420SP; |
@@ -378,6 +397,7 @@ static bool is_alpha_support(uint32_t format) | |||
378 | { | 397 | { |
379 | switch (format) { | 398 | switch (format) { |
380 | case DRM_FORMAT_ARGB8888: | 399 | case DRM_FORMAT_ARGB8888: |
400 | case DRM_FORMAT_ABGR8888: | ||
381 | return true; | 401 | return true; |
382 | default: | 402 | default: |
383 | return false; | 403 | return false; |
@@ -588,6 +608,7 @@ static int vop_update_plane_event(struct drm_plane *plane, | |||
588 | enum vop_data_format format; | 608 | enum vop_data_format format; |
589 | uint32_t val; | 609 | uint32_t val; |
590 | bool is_alpha; | 610 | bool is_alpha; |
611 | bool rb_swap; | ||
591 | bool visible; | 612 | bool visible; |
592 | int ret; | 613 | int ret; |
593 | struct drm_rect dest = { | 614 | struct drm_rect dest = { |
@@ -621,6 +642,7 @@ static int vop_update_plane_event(struct drm_plane *plane, | |||
621 | return 0; | 642 | return 0; |
622 | 643 | ||
623 | is_alpha = is_alpha_support(fb->pixel_format); | 644 | is_alpha = is_alpha_support(fb->pixel_format); |
645 | rb_swap = has_rb_swapped(fb->pixel_format); | ||
624 | format = vop_convert_format(fb->pixel_format); | 646 | format = vop_convert_format(fb->pixel_format); |
625 | if (format < 0) | 647 | if (format < 0) |
626 | return format; | 648 | return format; |
@@ -689,6 +711,7 @@ static int vop_update_plane_event(struct drm_plane *plane, | |||
689 | val = (dsp_sty - 1) << 16; | 711 | val = (dsp_sty - 1) << 16; |
690 | val |= (dsp_stx - 1) & 0xffff; | 712 | val |= (dsp_stx - 1) & 0xffff; |
691 | VOP_WIN_SET(vop, win, dsp_st, val); | 713 | VOP_WIN_SET(vop, win, dsp_st, val); |
714 | VOP_WIN_SET(vop, win, rb_swap, rb_swap); | ||
692 | 715 | ||
693 | if (is_alpha) { | 716 | if (is_alpha) { |
694 | VOP_WIN_SET(vop, win, dst_alpha_ctl, | 717 | VOP_WIN_SET(vop, win, dst_alpha_ctl, |
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 882cccdad272..ac6fe40b99f7 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c | |||
@@ -490,7 +490,8 @@ pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp) | |||
490 | else if (boot_cpu_data.x86 > 3) | 490 | else if (boot_cpu_data.x86 > 3) |
491 | tmp = pgprot_noncached(tmp); | 491 | tmp = pgprot_noncached(tmp); |
492 | #endif | 492 | #endif |
493 | #if defined(__ia64__) || defined(__arm__) || defined(__powerpc__) | 493 | #if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \ |
494 | defined(__powerpc__) | ||
494 | if (caching_flags & TTM_PL_FLAG_WC) | 495 | if (caching_flags & TTM_PL_FLAG_WC) |
495 | tmp = pgprot_writecombine(tmp); | 496 | tmp = pgprot_writecombine(tmp); |
496 | else | 497 | else |
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c index 3077f1554099..624d941aaad1 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | |||
@@ -963,14 +963,13 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev) | |||
963 | } else { | 963 | } else { |
964 | pool->npages_free += count; | 964 | pool->npages_free += count; |
965 | list_splice(&ttm_dma->pages_list, &pool->free_list); | 965 | list_splice(&ttm_dma->pages_list, &pool->free_list); |
966 | npages = count; | 966 | /* |
967 | if (pool->npages_free > _manager->options.max_size) { | 967 | * Wait to have at at least NUM_PAGES_TO_ALLOC number of pages |
968 | * to free in order to minimize calls to set_memory_wb(). | ||
969 | */ | ||
970 | if (pool->npages_free >= (_manager->options.max_size + | ||
971 | NUM_PAGES_TO_ALLOC)) | ||
968 | npages = pool->npages_free - _manager->options.max_size; | 972 | npages = pool->npages_free - _manager->options.max_size; |
969 | /* free at least NUM_PAGES_TO_ALLOC number of pages | ||
970 | * to reduce calls to set_memory_wb */ | ||
971 | if (npages < NUM_PAGES_TO_ALLOC) | ||
972 | npages = NUM_PAGES_TO_ALLOC; | ||
973 | } | ||
974 | } | 973 | } |
975 | spin_unlock_irqrestore(&pool->lock, irq_flags); | 974 | spin_unlock_irqrestore(&pool->lock, irq_flags); |
976 | 975 | ||
diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c index 6d2f39d36e44..00f2058944e5 100644 --- a/drivers/gpu/ipu-v3/ipu-common.c +++ b/drivers/gpu/ipu-v3/ipu-common.c | |||
@@ -1107,6 +1107,9 @@ static int ipu_irq_init(struct ipu_soc *ipu) | |||
1107 | return ret; | 1107 | return ret; |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | for (i = 0; i < IPU_NUM_IRQS; i += 32) | ||
1111 | ipu_cm_write(ipu, 0, IPU_INT_CTRL(i / 32)); | ||
1112 | |||
1110 | for (i = 0; i < IPU_NUM_IRQS; i += 32) { | 1113 | for (i = 0; i < IPU_NUM_IRQS; i += 32) { |
1111 | gc = irq_get_domain_generic_chip(ipu->domain, i); | 1114 | gc = irq_get_domain_generic_chip(ipu->domain, i); |
1112 | gc->reg_base = ipu->cm_reg; | 1115 | gc->reg_base = ipu->cm_reg; |
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index 3318de690e00..a2dbbbe0d8d7 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c | |||
@@ -356,6 +356,8 @@ static int cp2112_read(struct cp2112_device *dev, u8 *data, size_t size) | |||
356 | struct cp2112_force_read_report report; | 356 | struct cp2112_force_read_report report; |
357 | int ret; | 357 | int ret; |
358 | 358 | ||
359 | if (size > sizeof(dev->read_data)) | ||
360 | size = sizeof(dev->read_data); | ||
359 | report.report = CP2112_DATA_READ_FORCE_SEND; | 361 | report.report = CP2112_DATA_READ_FORCE_SEND; |
360 | report.length = cpu_to_be16(size); | 362 | report.length = cpu_to_be16(size); |
361 | 363 | ||
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 6a9b05b328a9..7c811252c1ce 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
@@ -778,9 +778,16 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
778 | /* | 778 | /* |
779 | * some egalax touchscreens have "application == HID_DG_TOUCHSCREEN" | 779 | * some egalax touchscreens have "application == HID_DG_TOUCHSCREEN" |
780 | * for the stylus. | 780 | * for the stylus. |
781 | * The check for mt_report_id ensures we don't process | ||
782 | * HID_DG_CONTACTCOUNT from the pen report as it is outside the physical | ||
783 | * collection, but within the report ID. | ||
781 | */ | 784 | */ |
782 | if (field->physical == HID_DG_STYLUS) | 785 | if (field->physical == HID_DG_STYLUS) |
783 | return 0; | 786 | return 0; |
787 | else if ((field->physical == 0) && | ||
788 | (field->report->id != td->mt_report_id) && | ||
789 | (td->mt_report_id != -1)) | ||
790 | return 0; | ||
784 | 791 | ||
785 | if (field->application == HID_DG_TOUCHSCREEN || | 792 | if (field->application == HID_DG_TOUCHSCREEN || |
786 | field->application == HID_DG_TOUCHPAD) | 793 | field->application == HID_DG_TOUCHPAD) |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 53e7de7cb9e2..20f9a653444c 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -87,6 +87,9 @@ static const struct hid_blacklist { | |||
87 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C05A, HID_QUIRK_ALWAYS_POLL }, | 87 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C05A, HID_QUIRK_ALWAYS_POLL }, |
88 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C06A, HID_QUIRK_ALWAYS_POLL }, | 88 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C06A, HID_QUIRK_ALWAYS_POLL }, |
89 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, | 89 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, |
90 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE_PRO_2, HID_QUIRK_NO_INIT_REPORTS }, | ||
91 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2, HID_QUIRK_NO_INIT_REPORTS }, | ||
92 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2, HID_QUIRK_NO_INIT_REPORTS }, | ||
90 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS }, | 93 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS }, |
91 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS }, | 94 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS }, |
92 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER, HID_QUIRK_NO_INIT_REPORTS }, | 95 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER, HID_QUIRK_NO_INIT_REPORTS }, |
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 4c0ffca97bef..44958d79d598 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -1271,11 +1271,13 @@ fail_leds: | |||
1271 | pad_input_dev = NULL; | 1271 | pad_input_dev = NULL; |
1272 | wacom_wac->pad_registered = false; | 1272 | wacom_wac->pad_registered = false; |
1273 | fail_register_pad_input: | 1273 | fail_register_pad_input: |
1274 | input_unregister_device(touch_input_dev); | 1274 | if (touch_input_dev) |
1275 | input_unregister_device(touch_input_dev); | ||
1275 | wacom_wac->touch_input = NULL; | 1276 | wacom_wac->touch_input = NULL; |
1276 | wacom_wac->touch_registered = false; | 1277 | wacom_wac->touch_registered = false; |
1277 | fail_register_touch_input: | 1278 | fail_register_touch_input: |
1278 | input_unregister_device(pen_input_dev); | 1279 | if (pen_input_dev) |
1280 | input_unregister_device(pen_input_dev); | ||
1279 | wacom_wac->pen_input = NULL; | 1281 | wacom_wac->pen_input = NULL; |
1280 | wacom_wac->pen_registered = false; | 1282 | wacom_wac->pen_registered = false; |
1281 | fail_register_pen_input: | 1283 | fail_register_pen_input: |
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 232da89f4e88..0d244239e55d 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
@@ -2213,6 +2213,9 @@ void wacom_setup_device_quirks(struct wacom *wacom) | |||
2213 | features->x_max = 4096; | 2213 | features->x_max = 4096; |
2214 | features->y_max = 4096; | 2214 | features->y_max = 4096; |
2215 | } | 2215 | } |
2216 | else if (features->pktlen == WACOM_PKGLEN_BBTOUCH) { | ||
2217 | features->device_type |= WACOM_DEVICETYPE_PAD; | ||
2218 | } | ||
2216 | } | 2219 | } |
2217 | 2220 | ||
2218 | /* | 2221 | /* |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 35ac23768ce9..577d58d1f1a1 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -633,6 +633,7 @@ config I2C_MPC | |||
633 | config I2C_MT65XX | 633 | config I2C_MT65XX |
634 | tristate "MediaTek I2C adapter" | 634 | tristate "MediaTek I2C adapter" |
635 | depends on ARCH_MEDIATEK || COMPILE_TEST | 635 | depends on ARCH_MEDIATEK || COMPILE_TEST |
636 | depends on HAS_DMA | ||
636 | help | 637 | help |
637 | This selects the MediaTek(R) Integrated Inter Circuit bus driver | 638 | This selects the MediaTek(R) Integrated Inter Circuit bus driver |
638 | for MT65xx and MT81xx. | 639 | for MT65xx and MT81xx. |
diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c index 19b2d689a5ef..f325663c27c5 100644 --- a/drivers/i2c/busses/i2c-jz4780.c +++ b/drivers/i2c/busses/i2c-jz4780.c | |||
@@ -764,12 +764,15 @@ static int jz4780_i2c_probe(struct platform_device *pdev) | |||
764 | if (IS_ERR(i2c->clk)) | 764 | if (IS_ERR(i2c->clk)) |
765 | return PTR_ERR(i2c->clk); | 765 | return PTR_ERR(i2c->clk); |
766 | 766 | ||
767 | clk_prepare_enable(i2c->clk); | 767 | ret = clk_prepare_enable(i2c->clk); |
768 | if (ret) | ||
769 | return ret; | ||
768 | 770 | ||
769 | if (of_property_read_u32(pdev->dev.of_node, "clock-frequency", | 771 | ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", |
770 | &clk_freq)) { | 772 | &clk_freq); |
773 | if (ret) { | ||
771 | dev_err(&pdev->dev, "clock-frequency not specified in DT"); | 774 | dev_err(&pdev->dev, "clock-frequency not specified in DT"); |
772 | return clk_freq; | 775 | goto err; |
773 | } | 776 | } |
774 | 777 | ||
775 | i2c->speed = clk_freq / 1000; | 778 | i2c->speed = clk_freq / 1000; |
@@ -790,10 +793,8 @@ static int jz4780_i2c_probe(struct platform_device *pdev) | |||
790 | i2c->irq = platform_get_irq(pdev, 0); | 793 | i2c->irq = platform_get_irq(pdev, 0); |
791 | ret = devm_request_irq(&pdev->dev, i2c->irq, jz4780_i2c_irq, 0, | 794 | ret = devm_request_irq(&pdev->dev, i2c->irq, jz4780_i2c_irq, 0, |
792 | dev_name(&pdev->dev), i2c); | 795 | dev_name(&pdev->dev), i2c); |
793 | if (ret) { | 796 | if (ret) |
794 | ret = -ENODEV; | ||
795 | goto err; | 797 | goto err; |
796 | } | ||
797 | 798 | ||
798 | ret = i2c_add_adapter(&i2c->adap); | 799 | ret = i2c_add_adapter(&i2c->adap); |
799 | if (ret < 0) { | 800 | if (ret < 0) { |
diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c b/drivers/i2c/busses/i2c-xgene-slimpro.c index dcca7076231e..1c9cb65ac4cf 100644 --- a/drivers/i2c/busses/i2c-xgene-slimpro.c +++ b/drivers/i2c/busses/i2c-xgene-slimpro.c | |||
@@ -419,6 +419,7 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev) | |||
419 | rc = i2c_add_adapter(adapter); | 419 | rc = i2c_add_adapter(adapter); |
420 | if (rc) { | 420 | if (rc) { |
421 | dev_err(&pdev->dev, "Adapter registeration failed\n"); | 421 | dev_err(&pdev->dev, "Adapter registeration failed\n"); |
422 | mbox_free_channel(ctx->mbox_chan); | ||
422 | return rc; | 423 | return rc; |
423 | } | 424 | } |
424 | 425 | ||
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 069a41f116dd..e6d4935161e4 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -1012,6 +1012,8 @@ EXPORT_SYMBOL_GPL(i2c_new_device); | |||
1012 | */ | 1012 | */ |
1013 | void i2c_unregister_device(struct i2c_client *client) | 1013 | void i2c_unregister_device(struct i2c_client *client) |
1014 | { | 1014 | { |
1015 | if (client->dev.of_node) | ||
1016 | of_node_clear_flag(client->dev.of_node, OF_POPULATED); | ||
1015 | device_unregister(&client->dev); | 1017 | device_unregister(&client->dev); |
1016 | } | 1018 | } |
1017 | EXPORT_SYMBOL_GPL(i2c_unregister_device); | 1019 | EXPORT_SYMBOL_GPL(i2c_unregister_device); |
@@ -1320,8 +1322,11 @@ static void of_i2c_register_devices(struct i2c_adapter *adap) | |||
1320 | 1322 | ||
1321 | dev_dbg(&adap->dev, "of_i2c: walking child nodes\n"); | 1323 | dev_dbg(&adap->dev, "of_i2c: walking child nodes\n"); |
1322 | 1324 | ||
1323 | for_each_available_child_of_node(adap->dev.of_node, node) | 1325 | for_each_available_child_of_node(adap->dev.of_node, node) { |
1326 | if (of_node_test_and_set_flag(node, OF_POPULATED)) | ||
1327 | continue; | ||
1324 | of_i2c_register_device(adap, node); | 1328 | of_i2c_register_device(adap, node); |
1329 | } | ||
1325 | } | 1330 | } |
1326 | 1331 | ||
1327 | static int of_dev_node_match(struct device *dev, void *data) | 1332 | static int of_dev_node_match(struct device *dev, void *data) |
@@ -1853,6 +1858,11 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action, | |||
1853 | if (adap == NULL) | 1858 | if (adap == NULL) |
1854 | return NOTIFY_OK; /* not for us */ | 1859 | return NOTIFY_OK; /* not for us */ |
1855 | 1860 | ||
1861 | if (of_node_test_and_set_flag(rd->dn, OF_POPULATED)) { | ||
1862 | put_device(&adap->dev); | ||
1863 | return NOTIFY_OK; | ||
1864 | } | ||
1865 | |||
1856 | client = of_i2c_register_device(adap, rd->dn); | 1866 | client = of_i2c_register_device(adap, rd->dn); |
1857 | put_device(&adap->dev); | 1867 | put_device(&adap->dev); |
1858 | 1868 | ||
@@ -1863,6 +1873,10 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action, | |||
1863 | } | 1873 | } |
1864 | break; | 1874 | break; |
1865 | case OF_RECONFIG_CHANGE_REMOVE: | 1875 | case OF_RECONFIG_CHANGE_REMOVE: |
1876 | /* already depopulated? */ | ||
1877 | if (!of_node_check_flag(rd->dn, OF_POPULATED)) | ||
1878 | return NOTIFY_OK; | ||
1879 | |||
1866 | /* find our device by node */ | 1880 | /* find our device by node */ |
1867 | client = of_find_i2c_device_by_node(rd->dn); | 1881 | client = of_find_i2c_device_by_node(rd->dn); |
1868 | if (client == NULL) | 1882 | if (client == NULL) |
diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c index 4e70f51c2370..cc5a35750b50 100644 --- a/drivers/iio/accel/bmc150-accel.c +++ b/drivers/iio/accel/bmc150-accel.c | |||
@@ -1464,7 +1464,7 @@ static void bmc150_accel_unregister_triggers(struct bmc150_accel_data *data, | |||
1464 | { | 1464 | { |
1465 | int i; | 1465 | int i; |
1466 | 1466 | ||
1467 | for (i = from; i >= 0; i++) { | 1467 | for (i = from; i >= 0; i--) { |
1468 | if (data->triggers[i].indio_trig) { | 1468 | if (data->triggers[i].indio_trig) { |
1469 | iio_trigger_unregister(data->triggers[i].indio_trig); | 1469 | iio_trigger_unregister(data->triggers[i].indio_trig); |
1470 | data->triggers[i].indio_trig = NULL; | 1470 | data->triggers[i].indio_trig = NULL; |
diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index e8e2077c7244..13ea1ea23328 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c | |||
@@ -557,21 +557,21 @@ static void mma8452_transient_interrupt(struct iio_dev *indio_dev) | |||
557 | if (src & MMA8452_TRANSIENT_SRC_XTRANSE) | 557 | if (src & MMA8452_TRANSIENT_SRC_XTRANSE) |
558 | iio_push_event(indio_dev, | 558 | iio_push_event(indio_dev, |
559 | IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_X, | 559 | IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_X, |
560 | IIO_EV_TYPE_THRESH, | 560 | IIO_EV_TYPE_MAG, |
561 | IIO_EV_DIR_RISING), | 561 | IIO_EV_DIR_RISING), |
562 | ts); | 562 | ts); |
563 | 563 | ||
564 | if (src & MMA8452_TRANSIENT_SRC_YTRANSE) | 564 | if (src & MMA8452_TRANSIENT_SRC_YTRANSE) |
565 | iio_push_event(indio_dev, | 565 | iio_push_event(indio_dev, |
566 | IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_Y, | 566 | IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_Y, |
567 | IIO_EV_TYPE_THRESH, | 567 | IIO_EV_TYPE_MAG, |
568 | IIO_EV_DIR_RISING), | 568 | IIO_EV_DIR_RISING), |
569 | ts); | 569 | ts); |
570 | 570 | ||
571 | if (src & MMA8452_TRANSIENT_SRC_ZTRANSE) | 571 | if (src & MMA8452_TRANSIENT_SRC_ZTRANSE) |
572 | iio_push_event(indio_dev, | 572 | iio_push_event(indio_dev, |
573 | IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_Z, | 573 | IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_Z, |
574 | IIO_EV_TYPE_THRESH, | 574 | IIO_EV_TYPE_MAG, |
575 | IIO_EV_DIR_RISING), | 575 | IIO_EV_DIR_RISING), |
576 | ts); | 576 | ts); |
577 | } | 577 | } |
@@ -644,7 +644,7 @@ static int mma8452_reg_access_dbg(struct iio_dev *indio_dev, | |||
644 | 644 | ||
645 | static const struct iio_event_spec mma8452_transient_event[] = { | 645 | static const struct iio_event_spec mma8452_transient_event[] = { |
646 | { | 646 | { |
647 | .type = IIO_EV_TYPE_THRESH, | 647 | .type = IIO_EV_TYPE_MAG, |
648 | .dir = IIO_EV_DIR_RISING, | 648 | .dir = IIO_EV_DIR_RISING, |
649 | .mask_separate = BIT(IIO_EV_INFO_ENABLE), | 649 | .mask_separate = BIT(IIO_EV_INFO_ENABLE), |
650 | .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) | | 650 | .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) | |
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 7c5565891cb8..eb0cd897714a 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig | |||
@@ -153,8 +153,7 @@ config DA9150_GPADC | |||
153 | 153 | ||
154 | config CC10001_ADC | 154 | config CC10001_ADC |
155 | tristate "Cosmic Circuits 10001 ADC driver" | 155 | tristate "Cosmic Circuits 10001 ADC driver" |
156 | depends on HAVE_CLK || REGULATOR | 156 | depends on HAS_IOMEM && HAVE_CLK && REGULATOR |
157 | depends on HAS_IOMEM | ||
158 | select IIO_BUFFER | 157 | select IIO_BUFFER |
159 | select IIO_TRIGGERED_BUFFER | 158 | select IIO_TRIGGERED_BUFFER |
160 | help | 159 | help |
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 8a0eb4a04fb5..7b40925dd4ff 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c | |||
@@ -182,7 +182,7 @@ struct at91_adc_caps { | |||
182 | u8 ts_pen_detect_sensitivity; | 182 | u8 ts_pen_detect_sensitivity; |
183 | 183 | ||
184 | /* startup time calculate function */ | 184 | /* startup time calculate function */ |
185 | u32 (*calc_startup_ticks)(u8 startup_time, u32 adc_clk_khz); | 185 | u32 (*calc_startup_ticks)(u32 startup_time, u32 adc_clk_khz); |
186 | 186 | ||
187 | u8 num_channels; | 187 | u8 num_channels; |
188 | struct at91_adc_reg_desc registers; | 188 | struct at91_adc_reg_desc registers; |
@@ -201,7 +201,7 @@ struct at91_adc_state { | |||
201 | u8 num_channels; | 201 | u8 num_channels; |
202 | void __iomem *reg_base; | 202 | void __iomem *reg_base; |
203 | struct at91_adc_reg_desc *registers; | 203 | struct at91_adc_reg_desc *registers; |
204 | u8 startup_time; | 204 | u32 startup_time; |
205 | u8 sample_hold_time; | 205 | u8 sample_hold_time; |
206 | bool sleep_mode; | 206 | bool sleep_mode; |
207 | struct iio_trigger **trig; | 207 | struct iio_trigger **trig; |
@@ -779,7 +779,7 @@ ret: | |||
779 | return ret; | 779 | return ret; |
780 | } | 780 | } |
781 | 781 | ||
782 | static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz) | 782 | static u32 calc_startup_ticks_9260(u32 startup_time, u32 adc_clk_khz) |
783 | { | 783 | { |
784 | /* | 784 | /* |
785 | * Number of ticks needed to cover the startup time of the ADC | 785 | * Number of ticks needed to cover the startup time of the ADC |
@@ -790,7 +790,7 @@ static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz) | |||
790 | return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8; | 790 | return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8; |
791 | } | 791 | } |
792 | 792 | ||
793 | static u32 calc_startup_ticks_9x5(u8 startup_time, u32 adc_clk_khz) | 793 | static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz) |
794 | { | 794 | { |
795 | /* | 795 | /* |
796 | * For sama5d3x and at91sam9x5, the formula changes to: | 796 | * For sama5d3x and at91sam9x5, the formula changes to: |
diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c index 8d9c9b9215dd..d819823f7257 100644 --- a/drivers/iio/adc/mcp320x.c +++ b/drivers/iio/adc/mcp320x.c | |||
@@ -299,6 +299,8 @@ static int mcp320x_probe(struct spi_device *spi) | |||
299 | indio_dev->channels = chip_info->channels; | 299 | indio_dev->channels = chip_info->channels; |
300 | indio_dev->num_channels = chip_info->num_channels; | 300 | indio_dev->num_channels = chip_info->num_channels; |
301 | 301 | ||
302 | adc->chip_info = chip_info; | ||
303 | |||
302 | adc->transfer[0].tx_buf = &adc->tx_buf; | 304 | adc->transfer[0].tx_buf = &adc->tx_buf; |
303 | adc->transfer[0].len = sizeof(adc->tx_buf); | 305 | adc->transfer[0].len = sizeof(adc->tx_buf); |
304 | adc->transfer[1].rx_buf = adc->rx_buf; | 306 | adc->transfer[1].rx_buf = adc->rx_buf; |
diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index 8d4e019ea4ca..9c311c1e1ac7 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c | |||
@@ -349,3 +349,7 @@ static struct platform_driver rockchip_saradc_driver = { | |||
349 | }; | 349 | }; |
350 | 350 | ||
351 | module_platform_driver(rockchip_saradc_driver); | 351 | module_platform_driver(rockchip_saradc_driver); |
352 | |||
353 | MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>"); | ||
354 | MODULE_DESCRIPTION("Rockchip SARADC driver"); | ||
355 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c index 06f4792240f0..ebe415f10640 100644 --- a/drivers/iio/adc/twl4030-madc.c +++ b/drivers/iio/adc/twl4030-madc.c | |||
@@ -833,7 +833,8 @@ static int twl4030_madc_probe(struct platform_device *pdev) | |||
833 | irq = platform_get_irq(pdev, 0); | 833 | irq = platform_get_irq(pdev, 0); |
834 | ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, | 834 | ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, |
835 | twl4030_madc_threaded_irq_handler, | 835 | twl4030_madc_threaded_irq_handler, |
836 | IRQF_TRIGGER_RISING, "twl4030_madc", madc); | 836 | IRQF_TRIGGER_RISING | IRQF_ONESHOT, |
837 | "twl4030_madc", madc); | ||
837 | if (ret) { | 838 | if (ret) { |
838 | dev_err(&pdev->dev, "could not request irq\n"); | 839 | dev_err(&pdev->dev, "could not request irq\n"); |
839 | goto err_i2c; | 840 | goto err_i2c; |
diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c index 480f335a0f9f..819632bf1fda 100644 --- a/drivers/iio/adc/vf610_adc.c +++ b/drivers/iio/adc/vf610_adc.c | |||
@@ -635,7 +635,7 @@ static int vf610_adc_reg_access(struct iio_dev *indio_dev, | |||
635 | struct vf610_adc *info = iio_priv(indio_dev); | 635 | struct vf610_adc *info = iio_priv(indio_dev); |
636 | 636 | ||
637 | if ((readval == NULL) || | 637 | if ((readval == NULL) || |
638 | (!(reg % 4) || (reg > VF610_REG_ADC_PCTL))) | 638 | ((reg % 4) || (reg > VF610_REG_ADC_PCTL))) |
639 | return -EINVAL; | 639 | return -EINVAL; |
640 | 640 | ||
641 | *readval = readl(info->regs + reg); | 641 | *readval = readl(info->regs + reg); |
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index 610fc98f88ef..595511022795 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c | |||
@@ -36,6 +36,8 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state) | |||
36 | s32 poll_value = 0; | 36 | s32 poll_value = 0; |
37 | 37 | ||
38 | if (state) { | 38 | if (state) { |
39 | if (!atomic_read(&st->user_requested_state)) | ||
40 | return 0; | ||
39 | if (sensor_hub_device_open(st->hsdev)) | 41 | if (sensor_hub_device_open(st->hsdev)) |
40 | return -EIO; | 42 | return -EIO; |
41 | 43 | ||
@@ -52,8 +54,12 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state) | |||
52 | 54 | ||
53 | poll_value = hid_sensor_read_poll_value(st); | 55 | poll_value = hid_sensor_read_poll_value(st); |
54 | } else { | 56 | } else { |
55 | if (!atomic_dec_and_test(&st->data_ready)) | 57 | int val; |
58 | |||
59 | val = atomic_dec_if_positive(&st->data_ready); | ||
60 | if (val < 0) | ||
56 | return 0; | 61 | return 0; |
62 | |||
57 | sensor_hub_device_close(st->hsdev); | 63 | sensor_hub_device_close(st->hsdev); |
58 | state_val = hid_sensor_get_usage_index(st->hsdev, | 64 | state_val = hid_sensor_get_usage_index(st->hsdev, |
59 | st->power_state.report_id, | 65 | st->power_state.report_id, |
@@ -92,9 +98,11 @@ EXPORT_SYMBOL(hid_sensor_power_state); | |||
92 | 98 | ||
93 | int hid_sensor_power_state(struct hid_sensor_common *st, bool state) | 99 | int hid_sensor_power_state(struct hid_sensor_common *st, bool state) |
94 | { | 100 | { |
101 | |||
95 | #ifdef CONFIG_PM | 102 | #ifdef CONFIG_PM |
96 | int ret; | 103 | int ret; |
97 | 104 | ||
105 | atomic_set(&st->user_requested_state, state); | ||
98 | if (state) | 106 | if (state) |
99 | ret = pm_runtime_get_sync(&st->pdev->dev); | 107 | ret = pm_runtime_get_sync(&st->pdev->dev); |
100 | else { | 108 | else { |
@@ -109,6 +117,7 @@ int hid_sensor_power_state(struct hid_sensor_common *st, bool state) | |||
109 | 117 | ||
110 | return 0; | 118 | return 0; |
111 | #else | 119 | #else |
120 | atomic_set(&st->user_requested_state, state); | ||
112 | return _hid_sensor_power_state(st, state); | 121 | return _hid_sensor_power_state(st, state); |
113 | #endif | 122 | #endif |
114 | } | 123 | } |
diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c index 61bb9d4239ea..e98428df0d44 100644 --- a/drivers/iio/dac/ad5624r_spi.c +++ b/drivers/iio/dac/ad5624r_spi.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "ad5624r.h" | 22 | #include "ad5624r.h" |
23 | 23 | ||
24 | static int ad5624r_spi_write(struct spi_device *spi, | 24 | static int ad5624r_spi_write(struct spi_device *spi, |
25 | u8 cmd, u8 addr, u16 val, u8 len) | 25 | u8 cmd, u8 addr, u16 val, u8 shift) |
26 | { | 26 | { |
27 | u32 data; | 27 | u32 data; |
28 | u8 msg[3]; | 28 | u8 msg[3]; |
@@ -35,7 +35,7 @@ static int ad5624r_spi_write(struct spi_device *spi, | |||
35 | * 14-, 12-bit input code followed by 0, 2, or 4 don't care bits, | 35 | * 14-, 12-bit input code followed by 0, 2, or 4 don't care bits, |
36 | * for the AD5664R, AD5644R, and AD5624R, respectively. | 36 | * for the AD5664R, AD5644R, and AD5624R, respectively. |
37 | */ | 37 | */ |
38 | data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << (16 - len)); | 38 | data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << shift); |
39 | msg[0] = data >> 16; | 39 | msg[0] = data >> 16; |
40 | msg[1] = data >> 8; | 40 | msg[1] = data >> 8; |
41 | msg[2] = data; | 41 | msg[2] = data; |
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index 17d4bb15be4d..65ce86837177 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | |||
@@ -431,6 +431,23 @@ static int inv_mpu6050_write_gyro_scale(struct inv_mpu6050_state *st, int val) | |||
431 | return -EINVAL; | 431 | return -EINVAL; |
432 | } | 432 | } |
433 | 433 | ||
434 | static int inv_write_raw_get_fmt(struct iio_dev *indio_dev, | ||
435 | struct iio_chan_spec const *chan, long mask) | ||
436 | { | ||
437 | switch (mask) { | ||
438 | case IIO_CHAN_INFO_SCALE: | ||
439 | switch (chan->type) { | ||
440 | case IIO_ANGL_VEL: | ||
441 | return IIO_VAL_INT_PLUS_NANO; | ||
442 | default: | ||
443 | return IIO_VAL_INT_PLUS_MICRO; | ||
444 | } | ||
445 | default: | ||
446 | return IIO_VAL_INT_PLUS_MICRO; | ||
447 | } | ||
448 | |||
449 | return -EINVAL; | ||
450 | } | ||
434 | static int inv_mpu6050_write_accel_scale(struct inv_mpu6050_state *st, int val) | 451 | static int inv_mpu6050_write_accel_scale(struct inv_mpu6050_state *st, int val) |
435 | { | 452 | { |
436 | int result, i; | 453 | int result, i; |
@@ -696,6 +713,7 @@ static const struct iio_info mpu_info = { | |||
696 | .driver_module = THIS_MODULE, | 713 | .driver_module = THIS_MODULE, |
697 | .read_raw = &inv_mpu6050_read_raw, | 714 | .read_raw = &inv_mpu6050_read_raw, |
698 | .write_raw = &inv_mpu6050_write_raw, | 715 | .write_raw = &inv_mpu6050_write_raw, |
716 | .write_raw_get_fmt = &inv_write_raw_get_fmt, | ||
699 | .attrs = &inv_attribute_group, | 717 | .attrs = &inv_attribute_group, |
700 | .validate_trigger = inv_mpu6050_validate_trigger, | 718 | .validate_trigger = inv_mpu6050_validate_trigger, |
701 | }; | 719 | }; |
diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig index e6198b7c9cbf..a5c59251ec0e 100644 --- a/drivers/iio/light/Kconfig +++ b/drivers/iio/light/Kconfig | |||
@@ -188,6 +188,7 @@ config SENSORS_LM3533 | |||
188 | config LTR501 | 188 | config LTR501 |
189 | tristate "LTR-501ALS-01 light sensor" | 189 | tristate "LTR-501ALS-01 light sensor" |
190 | depends on I2C | 190 | depends on I2C |
191 | select REGMAP_I2C | ||
191 | select IIO_BUFFER | 192 | select IIO_BUFFER |
192 | select IIO_TRIGGERED_BUFFER | 193 | select IIO_TRIGGERED_BUFFER |
193 | help | 194 | help |
@@ -201,6 +202,7 @@ config LTR501 | |||
201 | config STK3310 | 202 | config STK3310 |
202 | tristate "STK3310 ALS and proximity sensor" | 203 | tristate "STK3310 ALS and proximity sensor" |
203 | depends on I2C | 204 | depends on I2C |
205 | select REGMAP_I2C | ||
204 | help | 206 | help |
205 | Say yes here to get support for the Sensortek STK3310 ambient light | 207 | Say yes here to get support for the Sensortek STK3310 ambient light |
206 | and proximity sensor. The STK3311 model is also supported by this | 208 | and proximity sensor. The STK3311 model is also supported by this |
diff --git a/drivers/iio/light/cm3323.c b/drivers/iio/light/cm3323.c index 869033e48a1f..a1d4905cc9d2 100644 --- a/drivers/iio/light/cm3323.c +++ b/drivers/iio/light/cm3323.c | |||
@@ -123,7 +123,7 @@ static int cm3323_set_it_bits(struct cm3323_data *data, int val, int val2) | |||
123 | for (i = 0; i < ARRAY_SIZE(cm3323_int_time); i++) { | 123 | for (i = 0; i < ARRAY_SIZE(cm3323_int_time); i++) { |
124 | if (val == cm3323_int_time[i].val && | 124 | if (val == cm3323_int_time[i].val && |
125 | val2 == cm3323_int_time[i].val2) { | 125 | val2 == cm3323_int_time[i].val2) { |
126 | reg_conf = data->reg_conf; | 126 | reg_conf = data->reg_conf & ~CM3323_CONF_IT_MASK; |
127 | reg_conf |= i << CM3323_CONF_IT_SHIFT; | 127 | reg_conf |= i << CM3323_CONF_IT_SHIFT; |
128 | 128 | ||
129 | ret = i2c_smbus_write_word_data(data->client, | 129 | ret = i2c_smbus_write_word_data(data->client, |
diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c index 1ef7d3773ab9..b5a0e66b5f28 100644 --- a/drivers/iio/light/ltr501.c +++ b/drivers/iio/light/ltr501.c | |||
@@ -1302,7 +1302,7 @@ static int ltr501_init(struct ltr501_data *data) | |||
1302 | if (ret < 0) | 1302 | if (ret < 0) |
1303 | return ret; | 1303 | return ret; |
1304 | 1304 | ||
1305 | data->als_contr = ret | data->chip_info->als_mode_active; | 1305 | data->als_contr = status | data->chip_info->als_mode_active; |
1306 | 1306 | ||
1307 | ret = regmap_read(data->regmap, LTR501_PS_CONTR, &status); | 1307 | ret = regmap_read(data->regmap, LTR501_PS_CONTR, &status); |
1308 | if (ret < 0) | 1308 | if (ret < 0) |
diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c index fee4297d7c8f..11a027adc204 100644 --- a/drivers/iio/light/stk3310.c +++ b/drivers/iio/light/stk3310.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #define STK3311_CHIP_ID_VAL 0x1D | 43 | #define STK3311_CHIP_ID_VAL 0x1D |
44 | #define STK3310_PSINT_EN 0x01 | 44 | #define STK3310_PSINT_EN 0x01 |
45 | #define STK3310_PS_MAX_VAL 0xFFFF | 45 | #define STK3310_PS_MAX_VAL 0xFFFF |
46 | #define STK3310_THRESH_MAX 0xFFFF | ||
47 | 46 | ||
48 | #define STK3310_DRIVER_NAME "stk3310" | 47 | #define STK3310_DRIVER_NAME "stk3310" |
49 | #define STK3310_REGMAP_NAME "stk3310_regmap" | 48 | #define STK3310_REGMAP_NAME "stk3310_regmap" |
@@ -84,15 +83,13 @@ static const struct reg_field stk3310_reg_field_flag_psint = | |||
84 | REG_FIELD(STK3310_REG_FLAG, 4, 4); | 83 | REG_FIELD(STK3310_REG_FLAG, 4, 4); |
85 | static const struct reg_field stk3310_reg_field_flag_nf = | 84 | static const struct reg_field stk3310_reg_field_flag_nf = |
86 | REG_FIELD(STK3310_REG_FLAG, 0, 0); | 85 | REG_FIELD(STK3310_REG_FLAG, 0, 0); |
87 | /* | 86 | |
88 | * Maximum PS values with regard to scale. Used to export the 'inverse' | 87 | /* Estimate maximum proximity values with regard to measurement scale. */ |
89 | * PS value (high values for far objects, low values for near objects). | ||
90 | */ | ||
91 | static const int stk3310_ps_max[4] = { | 88 | static const int stk3310_ps_max[4] = { |
92 | STK3310_PS_MAX_VAL / 64, | 89 | STK3310_PS_MAX_VAL / 640, |
93 | STK3310_PS_MAX_VAL / 16, | 90 | STK3310_PS_MAX_VAL / 160, |
94 | STK3310_PS_MAX_VAL / 4, | 91 | STK3310_PS_MAX_VAL / 40, |
95 | STK3310_PS_MAX_VAL, | 92 | STK3310_PS_MAX_VAL / 10 |
96 | }; | 93 | }; |
97 | 94 | ||
98 | static const int stk3310_scale_table[][2] = { | 95 | static const int stk3310_scale_table[][2] = { |
@@ -128,14 +125,14 @@ static const struct iio_event_spec stk3310_events[] = { | |||
128 | /* Proximity event */ | 125 | /* Proximity event */ |
129 | { | 126 | { |
130 | .type = IIO_EV_TYPE_THRESH, | 127 | .type = IIO_EV_TYPE_THRESH, |
131 | .dir = IIO_EV_DIR_FALLING, | 128 | .dir = IIO_EV_DIR_RISING, |
132 | .mask_separate = BIT(IIO_EV_INFO_VALUE) | | 129 | .mask_separate = BIT(IIO_EV_INFO_VALUE) | |
133 | BIT(IIO_EV_INFO_ENABLE), | 130 | BIT(IIO_EV_INFO_ENABLE), |
134 | }, | 131 | }, |
135 | /* Out-of-proximity event */ | 132 | /* Out-of-proximity event */ |
136 | { | 133 | { |
137 | .type = IIO_EV_TYPE_THRESH, | 134 | .type = IIO_EV_TYPE_THRESH, |
138 | .dir = IIO_EV_DIR_RISING, | 135 | .dir = IIO_EV_DIR_FALLING, |
139 | .mask_separate = BIT(IIO_EV_INFO_VALUE) | | 136 | .mask_separate = BIT(IIO_EV_INFO_VALUE) | |
140 | BIT(IIO_EV_INFO_ENABLE), | 137 | BIT(IIO_EV_INFO_ENABLE), |
141 | }, | 138 | }, |
@@ -203,25 +200,18 @@ static int stk3310_read_event(struct iio_dev *indio_dev, | |||
203 | int *val, int *val2) | 200 | int *val, int *val2) |
204 | { | 201 | { |
205 | u8 reg; | 202 | u8 reg; |
206 | u16 buf; | 203 | __be16 buf; |
207 | int ret; | 204 | int ret; |
208 | unsigned int index; | ||
209 | struct stk3310_data *data = iio_priv(indio_dev); | 205 | struct stk3310_data *data = iio_priv(indio_dev); |
210 | 206 | ||
211 | if (info != IIO_EV_INFO_VALUE) | 207 | if (info != IIO_EV_INFO_VALUE) |
212 | return -EINVAL; | 208 | return -EINVAL; |
213 | 209 | ||
214 | /* | 210 | /* Only proximity interrupts are implemented at the moment. */ |
215 | * Only proximity interrupts are implemented at the moment. | ||
216 | * Since we're inverting proximity values, the sensor's 'high' | ||
217 | * threshold will become our 'low' threshold, associated with | ||
218 | * 'near' events. Similarly, the sensor's 'low' threshold will | ||
219 | * be our 'high' threshold, associated with 'far' events. | ||
220 | */ | ||
221 | if (dir == IIO_EV_DIR_RISING) | 211 | if (dir == IIO_EV_DIR_RISING) |
222 | reg = STK3310_REG_THDL_PS; | ||
223 | else if (dir == IIO_EV_DIR_FALLING) | ||
224 | reg = STK3310_REG_THDH_PS; | 212 | reg = STK3310_REG_THDH_PS; |
213 | else if (dir == IIO_EV_DIR_FALLING) | ||
214 | reg = STK3310_REG_THDL_PS; | ||
225 | else | 215 | else |
226 | return -EINVAL; | 216 | return -EINVAL; |
227 | 217 | ||
@@ -232,8 +222,7 @@ static int stk3310_read_event(struct iio_dev *indio_dev, | |||
232 | dev_err(&data->client->dev, "register read failed\n"); | 222 | dev_err(&data->client->dev, "register read failed\n"); |
233 | return ret; | 223 | return ret; |
234 | } | 224 | } |
235 | regmap_field_read(data->reg_ps_gain, &index); | 225 | *val = be16_to_cpu(buf); |
236 | *val = swab16(stk3310_ps_max[index] - buf); | ||
237 | 226 | ||
238 | return IIO_VAL_INT; | 227 | return IIO_VAL_INT; |
239 | } | 228 | } |
@@ -246,7 +235,7 @@ static int stk3310_write_event(struct iio_dev *indio_dev, | |||
246 | int val, int val2) | 235 | int val, int val2) |
247 | { | 236 | { |
248 | u8 reg; | 237 | u8 reg; |
249 | u16 buf; | 238 | __be16 buf; |
250 | int ret; | 239 | int ret; |
251 | unsigned int index; | 240 | unsigned int index; |
252 | struct stk3310_data *data = iio_priv(indio_dev); | 241 | struct stk3310_data *data = iio_priv(indio_dev); |
@@ -257,13 +246,13 @@ static int stk3310_write_event(struct iio_dev *indio_dev, | |||
257 | return -EINVAL; | 246 | return -EINVAL; |
258 | 247 | ||
259 | if (dir == IIO_EV_DIR_RISING) | 248 | if (dir == IIO_EV_DIR_RISING) |
260 | reg = STK3310_REG_THDL_PS; | ||
261 | else if (dir == IIO_EV_DIR_FALLING) | ||
262 | reg = STK3310_REG_THDH_PS; | 249 | reg = STK3310_REG_THDH_PS; |
250 | else if (dir == IIO_EV_DIR_FALLING) | ||
251 | reg = STK3310_REG_THDL_PS; | ||
263 | else | 252 | else |
264 | return -EINVAL; | 253 | return -EINVAL; |
265 | 254 | ||
266 | buf = swab16(stk3310_ps_max[index] - val); | 255 | buf = cpu_to_be16(val); |
267 | ret = regmap_bulk_write(data->regmap, reg, &buf, 2); | 256 | ret = regmap_bulk_write(data->regmap, reg, &buf, 2); |
268 | if (ret < 0) | 257 | if (ret < 0) |
269 | dev_err(&client->dev, "failed to set PS threshold!\n"); | 258 | dev_err(&client->dev, "failed to set PS threshold!\n"); |
@@ -312,7 +301,7 @@ static int stk3310_read_raw(struct iio_dev *indio_dev, | |||
312 | int *val, int *val2, long mask) | 301 | int *val, int *val2, long mask) |
313 | { | 302 | { |
314 | u8 reg; | 303 | u8 reg; |
315 | u16 buf; | 304 | __be16 buf; |
316 | int ret; | 305 | int ret; |
317 | unsigned int index; | 306 | unsigned int index; |
318 | struct stk3310_data *data = iio_priv(indio_dev); | 307 | struct stk3310_data *data = iio_priv(indio_dev); |
@@ -333,15 +322,7 @@ static int stk3310_read_raw(struct iio_dev *indio_dev, | |||
333 | mutex_unlock(&data->lock); | 322 | mutex_unlock(&data->lock); |
334 | return ret; | 323 | return ret; |
335 | } | 324 | } |
336 | *val = swab16(buf); | 325 | *val = be16_to_cpu(buf); |
337 | if (chan->type == IIO_PROXIMITY) { | ||
338 | /* | ||
339 | * Invert the proximity data so we return low values | ||
340 | * for close objects and high values for far ones. | ||
341 | */ | ||
342 | regmap_field_read(data->reg_ps_gain, &index); | ||
343 | *val = stk3310_ps_max[index] - *val; | ||
344 | } | ||
345 | mutex_unlock(&data->lock); | 326 | mutex_unlock(&data->lock); |
346 | return IIO_VAL_INT; | 327 | return IIO_VAL_INT; |
347 | case IIO_CHAN_INFO_INT_TIME: | 328 | case IIO_CHAN_INFO_INT_TIME: |
@@ -581,8 +562,8 @@ static irqreturn_t stk3310_irq_event_handler(int irq, void *private) | |||
581 | } | 562 | } |
582 | event = IIO_UNMOD_EVENT_CODE(IIO_PROXIMITY, 1, | 563 | event = IIO_UNMOD_EVENT_CODE(IIO_PROXIMITY, 1, |
583 | IIO_EV_TYPE_THRESH, | 564 | IIO_EV_TYPE_THRESH, |
584 | (dir ? IIO_EV_DIR_RISING : | 565 | (dir ? IIO_EV_DIR_FALLING : |
585 | IIO_EV_DIR_FALLING)); | 566 | IIO_EV_DIR_RISING)); |
586 | iio_push_event(indio_dev, event, data->timestamp); | 567 | iio_push_event(indio_dev, event, data->timestamp); |
587 | 568 | ||
588 | /* Reset the interrupt flag */ | 569 | /* Reset the interrupt flag */ |
@@ -627,13 +608,7 @@ static int stk3310_probe(struct i2c_client *client, | |||
627 | if (ret < 0) | 608 | if (ret < 0) |
628 | return ret; | 609 | return ret; |
629 | 610 | ||
630 | ret = iio_device_register(indio_dev); | 611 | if (client->irq < 0) |
631 | if (ret < 0) { | ||
632 | dev_err(&client->dev, "device_register failed\n"); | ||
633 | stk3310_set_state(data, STK3310_STATE_STANDBY); | ||
634 | } | ||
635 | |||
636 | if (client->irq <= 0) | ||
637 | client->irq = stk3310_gpio_probe(client); | 612 | client->irq = stk3310_gpio_probe(client); |
638 | 613 | ||
639 | if (client->irq >= 0) { | 614 | if (client->irq >= 0) { |
@@ -648,6 +623,12 @@ static int stk3310_probe(struct i2c_client *client, | |||
648 | client->irq); | 623 | client->irq); |
649 | } | 624 | } |
650 | 625 | ||
626 | ret = iio_device_register(indio_dev); | ||
627 | if (ret < 0) { | ||
628 | dev_err(&client->dev, "device_register failed\n"); | ||
629 | stk3310_set_state(data, STK3310_STATE_STANDBY); | ||
630 | } | ||
631 | |||
651 | return ret; | 632 | return ret; |
652 | } | 633 | } |
653 | 634 | ||
diff --git a/drivers/iio/light/tcs3414.c b/drivers/iio/light/tcs3414.c index 71c2bde275aa..f8b1df018abe 100644 --- a/drivers/iio/light/tcs3414.c +++ b/drivers/iio/light/tcs3414.c | |||
@@ -185,7 +185,7 @@ static int tcs3414_write_raw(struct iio_dev *indio_dev, | |||
185 | if (val != 0) | 185 | if (val != 0) |
186 | return -EINVAL; | 186 | return -EINVAL; |
187 | for (i = 0; i < ARRAY_SIZE(tcs3414_times); i++) { | 187 | for (i = 0; i < ARRAY_SIZE(tcs3414_times); i++) { |
188 | if (val == tcs3414_times[i] * 1000) { | 188 | if (val2 == tcs3414_times[i] * 1000) { |
189 | data->timing &= ~TCS3414_INTEG_MASK; | 189 | data->timing &= ~TCS3414_INTEG_MASK; |
190 | data->timing |= i; | 190 | data->timing |= i; |
191 | return i2c_smbus_write_byte_data( | 191 | return i2c_smbus_write_byte_data( |
diff --git a/drivers/iio/magnetometer/Kconfig b/drivers/iio/magnetometer/Kconfig index dcadfc4f0661..efb9350b0d76 100644 --- a/drivers/iio/magnetometer/Kconfig +++ b/drivers/iio/magnetometer/Kconfig | |||
@@ -90,6 +90,7 @@ config IIO_ST_MAGN_SPI_3AXIS | |||
90 | config BMC150_MAGN | 90 | config BMC150_MAGN |
91 | tristate "Bosch BMC150 Magnetometer Driver" | 91 | tristate "Bosch BMC150 Magnetometer Driver" |
92 | depends on I2C | 92 | depends on I2C |
93 | select REGMAP_I2C | ||
93 | select IIO_BUFFER | 94 | select IIO_BUFFER |
94 | select IIO_TRIGGERED_BUFFER | 95 | select IIO_TRIGGERED_BUFFER |
95 | help | 96 | help |
diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c index d4c178869991..1347a1f2e46f 100644 --- a/drivers/iio/magnetometer/bmc150_magn.c +++ b/drivers/iio/magnetometer/bmc150_magn.c | |||
@@ -706,11 +706,11 @@ static int bmc150_magn_init(struct bmc150_magn_data *data) | |||
706 | goto err_poweroff; | 706 | goto err_poweroff; |
707 | } | 707 | } |
708 | if (chip_id != BMC150_MAGN_CHIP_ID_VAL) { | 708 | if (chip_id != BMC150_MAGN_CHIP_ID_VAL) { |
709 | dev_err(&data->client->dev, "Invalid chip id 0x%x\n", ret); | 709 | dev_err(&data->client->dev, "Invalid chip id 0x%x\n", chip_id); |
710 | ret = -ENODEV; | 710 | ret = -ENODEV; |
711 | goto err_poweroff; | 711 | goto err_poweroff; |
712 | } | 712 | } |
713 | dev_dbg(&data->client->dev, "Chip id %x\n", ret); | 713 | dev_dbg(&data->client->dev, "Chip id %x\n", chip_id); |
714 | 714 | ||
715 | preset = bmc150_magn_presets_table[BMC150_MAGN_DEFAULT_PRESET]; | 715 | preset = bmc150_magn_presets_table[BMC150_MAGN_DEFAULT_PRESET]; |
716 | ret = bmc150_magn_set_odr(data, preset.odr); | 716 | ret = bmc150_magn_set_odr(data, preset.odr); |
diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c index 7a2ea71c659a..706ebfd6297f 100644 --- a/drivers/iio/magnetometer/mmc35240.c +++ b/drivers/iio/magnetometer/mmc35240.c | |||
@@ -84,10 +84,10 @@ | |||
84 | #define MMC35240_OTP_START_ADDR 0x1B | 84 | #define MMC35240_OTP_START_ADDR 0x1B |
85 | 85 | ||
86 | enum mmc35240_resolution { | 86 | enum mmc35240_resolution { |
87 | MMC35240_16_BITS_SLOW = 0, /* 100 Hz */ | 87 | MMC35240_16_BITS_SLOW = 0, /* 7.92 ms */ |
88 | MMC35240_16_BITS_FAST, /* 200 Hz */ | 88 | MMC35240_16_BITS_FAST, /* 4.08 ms */ |
89 | MMC35240_14_BITS, /* 333 Hz */ | 89 | MMC35240_14_BITS, /* 2.16 ms */ |
90 | MMC35240_12_BITS, /* 666 Hz */ | 90 | MMC35240_12_BITS, /* 1.20 ms */ |
91 | }; | 91 | }; |
92 | 92 | ||
93 | enum mmc35240_axis { | 93 | enum mmc35240_axis { |
@@ -100,22 +100,22 @@ static const struct { | |||
100 | int sens[3]; /* sensitivity per X, Y, Z axis */ | 100 | int sens[3]; /* sensitivity per X, Y, Z axis */ |
101 | int nfo; /* null field output */ | 101 | int nfo; /* null field output */ |
102 | } mmc35240_props_table[] = { | 102 | } mmc35240_props_table[] = { |
103 | /* 16 bits, 100Hz ODR */ | 103 | /* 16 bits, 125Hz ODR */ |
104 | { | 104 | { |
105 | {1024, 1024, 1024}, | 105 | {1024, 1024, 1024}, |
106 | 32768, | 106 | 32768, |
107 | }, | 107 | }, |
108 | /* 16 bits, 200Hz ODR */ | 108 | /* 16 bits, 250Hz ODR */ |
109 | { | 109 | { |
110 | {1024, 1024, 770}, | 110 | {1024, 1024, 770}, |
111 | 32768, | 111 | 32768, |
112 | }, | 112 | }, |
113 | /* 14 bits, 333Hz ODR */ | 113 | /* 14 bits, 450Hz ODR */ |
114 | { | 114 | { |
115 | {256, 256, 193}, | 115 | {256, 256, 193}, |
116 | 8192, | 116 | 8192, |
117 | }, | 117 | }, |
118 | /* 12 bits, 666Hz ODR */ | 118 | /* 12 bits, 800Hz ODR */ |
119 | { | 119 | { |
120 | {64, 64, 48}, | 120 | {64, 64, 48}, |
121 | 2048, | 121 | 2048, |
@@ -133,9 +133,15 @@ struct mmc35240_data { | |||
133 | int axis_scale[3]; | 133 | int axis_scale[3]; |
134 | }; | 134 | }; |
135 | 135 | ||
136 | static const int mmc35240_samp_freq[] = {100, 200, 333, 666}; | 136 | static const struct { |
137 | int val; | ||
138 | int val2; | ||
139 | } mmc35240_samp_freq[] = { {1, 500000}, | ||
140 | {13, 0}, | ||
141 | {25, 0}, | ||
142 | {50, 0} }; | ||
137 | 143 | ||
138 | static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("100 200 333 666"); | 144 | static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("1.5 13 25 50"); |
139 | 145 | ||
140 | #define MMC35240_CHANNEL(_axis) { \ | 146 | #define MMC35240_CHANNEL(_axis) { \ |
141 | .type = IIO_MAGN, \ | 147 | .type = IIO_MAGN, \ |
@@ -168,7 +174,8 @@ static int mmc35240_get_samp_freq_index(struct mmc35240_data *data, | |||
168 | int i; | 174 | int i; |
169 | 175 | ||
170 | for (i = 0; i < ARRAY_SIZE(mmc35240_samp_freq); i++) | 176 | for (i = 0; i < ARRAY_SIZE(mmc35240_samp_freq); i++) |
171 | if (mmc35240_samp_freq[i] == val) | 177 | if (mmc35240_samp_freq[i].val == val && |
178 | mmc35240_samp_freq[i].val2 == val2) | ||
172 | return i; | 179 | return i; |
173 | return -EINVAL; | 180 | return -EINVAL; |
174 | } | 181 | } |
@@ -195,8 +202,8 @@ static int mmc35240_hw_set(struct mmc35240_data *data, bool set) | |||
195 | coil_bit = MMC35240_CTRL0_RESET_BIT; | 202 | coil_bit = MMC35240_CTRL0_RESET_BIT; |
196 | 203 | ||
197 | return regmap_update_bits(data->regmap, MMC35240_REG_CTRL0, | 204 | return regmap_update_bits(data->regmap, MMC35240_REG_CTRL0, |
198 | MMC35240_CTRL0_REFILL_BIT, | 205 | coil_bit, coil_bit); |
199 | coil_bit); | 206 | |
200 | } | 207 | } |
201 | 208 | ||
202 | static int mmc35240_init(struct mmc35240_data *data) | 209 | static int mmc35240_init(struct mmc35240_data *data) |
@@ -215,14 +222,15 @@ static int mmc35240_init(struct mmc35240_data *data) | |||
215 | 222 | ||
216 | /* | 223 | /* |
217 | * make sure we restore sensor characteristics, by doing | 224 | * make sure we restore sensor characteristics, by doing |
218 | * a RESET/SET sequence | 225 | * a SET/RESET sequence, the axis polarity being naturally |
226 | * aligned after RESET | ||
219 | */ | 227 | */ |
220 | ret = mmc35240_hw_set(data, false); | 228 | ret = mmc35240_hw_set(data, true); |
221 | if (ret < 0) | 229 | if (ret < 0) |
222 | return ret; | 230 | return ret; |
223 | usleep_range(MMC53240_WAIT_SET_RESET, MMC53240_WAIT_SET_RESET + 1); | 231 | usleep_range(MMC53240_WAIT_SET_RESET, MMC53240_WAIT_SET_RESET + 1); |
224 | 232 | ||
225 | ret = mmc35240_hw_set(data, true); | 233 | ret = mmc35240_hw_set(data, false); |
226 | if (ret < 0) | 234 | if (ret < 0) |
227 | return ret; | 235 | return ret; |
228 | 236 | ||
@@ -378,9 +386,9 @@ static int mmc35240_read_raw(struct iio_dev *indio_dev, | |||
378 | if (i < 0 || i >= ARRAY_SIZE(mmc35240_samp_freq)) | 386 | if (i < 0 || i >= ARRAY_SIZE(mmc35240_samp_freq)) |
379 | return -EINVAL; | 387 | return -EINVAL; |
380 | 388 | ||
381 | *val = mmc35240_samp_freq[i]; | 389 | *val = mmc35240_samp_freq[i].val; |
382 | *val2 = 0; | 390 | *val2 = mmc35240_samp_freq[i].val2; |
383 | return IIO_VAL_INT; | 391 | return IIO_VAL_INT_PLUS_MICRO; |
384 | default: | 392 | default: |
385 | return -EINVAL; | 393 | return -EINVAL; |
386 | } | 394 | } |
@@ -496,6 +504,7 @@ static int mmc35240_probe(struct i2c_client *client, | |||
496 | } | 504 | } |
497 | 505 | ||
498 | data = iio_priv(indio_dev); | 506 | data = iio_priv(indio_dev); |
507 | i2c_set_clientdata(client, indio_dev); | ||
499 | data->client = client; | 508 | data->client = client; |
500 | data->regmap = regmap; | 509 | data->regmap = regmap; |
501 | data->res = MMC35240_16_BITS_SLOW; | 510 | data->res = MMC35240_16_BITS_SLOW; |
diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c index 2042e375f835..3d756bd8c703 100644 --- a/drivers/iio/proximity/sx9500.c +++ b/drivers/iio/proximity/sx9500.c | |||
@@ -80,6 +80,7 @@ | |||
80 | #define SX9500_COMPSTAT_MASK GENMASK(3, 0) | 80 | #define SX9500_COMPSTAT_MASK GENMASK(3, 0) |
81 | 81 | ||
82 | #define SX9500_NUM_CHANNELS 4 | 82 | #define SX9500_NUM_CHANNELS 4 |
83 | #define SX9500_CHAN_MASK GENMASK(SX9500_NUM_CHANNELS - 1, 0) | ||
83 | 84 | ||
84 | struct sx9500_data { | 85 | struct sx9500_data { |
85 | struct mutex mutex; | 86 | struct mutex mutex; |
@@ -281,7 +282,7 @@ static int sx9500_read_prox_data(struct sx9500_data *data, | |||
281 | if (ret < 0) | 282 | if (ret < 0) |
282 | return ret; | 283 | return ret; |
283 | 284 | ||
284 | *val = 32767 - (s16)be16_to_cpu(regval); | 285 | *val = be16_to_cpu(regval); |
285 | 286 | ||
286 | return IIO_VAL_INT; | 287 | return IIO_VAL_INT; |
287 | } | 288 | } |
@@ -329,27 +330,29 @@ static int sx9500_read_proximity(struct sx9500_data *data, | |||
329 | else | 330 | else |
330 | ret = sx9500_wait_for_sample(data); | 331 | ret = sx9500_wait_for_sample(data); |
331 | 332 | ||
332 | if (ret < 0) | ||
333 | return ret; | ||
334 | |||
335 | mutex_lock(&data->mutex); | 333 | mutex_lock(&data->mutex); |
336 | 334 | ||
337 | ret = sx9500_read_prox_data(data, chan, val); | ||
338 | if (ret < 0) | 335 | if (ret < 0) |
339 | goto out; | 336 | goto out_dec_data_rdy; |
340 | 337 | ||
341 | ret = sx9500_dec_chan_users(data, chan->channel); | 338 | ret = sx9500_read_prox_data(data, chan, val); |
342 | if (ret < 0) | 339 | if (ret < 0) |
343 | goto out; | 340 | goto out_dec_data_rdy; |
344 | 341 | ||
345 | ret = sx9500_dec_data_rdy_users(data); | 342 | ret = sx9500_dec_data_rdy_users(data); |
346 | if (ret < 0) | 343 | if (ret < 0) |
344 | goto out_dec_chan; | ||
345 | |||
346 | ret = sx9500_dec_chan_users(data, chan->channel); | ||
347 | if (ret < 0) | ||
347 | goto out; | 348 | goto out; |
348 | 349 | ||
349 | ret = IIO_VAL_INT; | 350 | ret = IIO_VAL_INT; |
350 | 351 | ||
351 | goto out; | 352 | goto out; |
352 | 353 | ||
354 | out_dec_data_rdy: | ||
355 | sx9500_dec_data_rdy_users(data); | ||
353 | out_dec_chan: | 356 | out_dec_chan: |
354 | sx9500_dec_chan_users(data, chan->channel); | 357 | sx9500_dec_chan_users(data, chan->channel); |
355 | out: | 358 | out: |
@@ -679,7 +682,7 @@ out: | |||
679 | static int sx9500_buffer_preenable(struct iio_dev *indio_dev) | 682 | static int sx9500_buffer_preenable(struct iio_dev *indio_dev) |
680 | { | 683 | { |
681 | struct sx9500_data *data = iio_priv(indio_dev); | 684 | struct sx9500_data *data = iio_priv(indio_dev); |
682 | int ret, i; | 685 | int ret = 0, i; |
683 | 686 | ||
684 | mutex_lock(&data->mutex); | 687 | mutex_lock(&data->mutex); |
685 | 688 | ||
@@ -703,7 +706,7 @@ static int sx9500_buffer_preenable(struct iio_dev *indio_dev) | |||
703 | static int sx9500_buffer_predisable(struct iio_dev *indio_dev) | 706 | static int sx9500_buffer_predisable(struct iio_dev *indio_dev) |
704 | { | 707 | { |
705 | struct sx9500_data *data = iio_priv(indio_dev); | 708 | struct sx9500_data *data = iio_priv(indio_dev); |
706 | int ret, i; | 709 | int ret = 0, i; |
707 | 710 | ||
708 | iio_triggered_buffer_predisable(indio_dev); | 711 | iio_triggered_buffer_predisable(indio_dev); |
709 | 712 | ||
@@ -800,8 +803,7 @@ static int sx9500_init_compensation(struct iio_dev *indio_dev) | |||
800 | unsigned int val; | 803 | unsigned int val; |
801 | 804 | ||
802 | ret = regmap_update_bits(data->regmap, SX9500_REG_PROX_CTRL0, | 805 | ret = regmap_update_bits(data->regmap, SX9500_REG_PROX_CTRL0, |
803 | GENMASK(SX9500_NUM_CHANNELS, 0), | 806 | SX9500_CHAN_MASK, SX9500_CHAN_MASK); |
804 | GENMASK(SX9500_NUM_CHANNELS, 0)); | ||
805 | if (ret < 0) | 807 | if (ret < 0) |
806 | return ret; | 808 | return ret; |
807 | 809 | ||
@@ -821,7 +823,7 @@ static int sx9500_init_compensation(struct iio_dev *indio_dev) | |||
821 | 823 | ||
822 | out: | 824 | out: |
823 | regmap_update_bits(data->regmap, SX9500_REG_PROX_CTRL0, | 825 | regmap_update_bits(data->regmap, SX9500_REG_PROX_CTRL0, |
824 | GENMASK(SX9500_NUM_CHANNELS, 0), 0); | 826 | SX9500_CHAN_MASK, 0); |
825 | return ret; | 827 | return ret; |
826 | } | 828 | } |
827 | 829 | ||
diff --git a/drivers/iio/temperature/mlx90614.c b/drivers/iio/temperature/mlx90614.c index cb2e8ad8bfdc..7a2b639eaa96 100644 --- a/drivers/iio/temperature/mlx90614.c +++ b/drivers/iio/temperature/mlx90614.c | |||
@@ -204,7 +204,7 @@ static int mlx90614_read_raw(struct iio_dev *indio_dev, | |||
204 | *val = ret; | 204 | *val = ret; |
205 | return IIO_VAL_INT; | 205 | return IIO_VAL_INT; |
206 | case IIO_CHAN_INFO_OFFSET: | 206 | case IIO_CHAN_INFO_OFFSET: |
207 | *val = 13657; | 207 | *val = -13657; |
208 | *val2 = 500000; | 208 | *val2 = 500000; |
209 | return IIO_VAL_INT_PLUS_MICRO; | 209 | return IIO_VAL_INT_PLUS_MICRO; |
210 | case IIO_CHAN_INFO_SCALE: | 210 | case IIO_CHAN_INFO_SCALE: |
diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c index fcc49f89b946..8f21f32f9739 100644 --- a/drivers/iio/temperature/tmp006.c +++ b/drivers/iio/temperature/tmp006.c | |||
@@ -132,6 +132,9 @@ static int tmp006_write_raw(struct iio_dev *indio_dev, | |||
132 | struct tmp006_data *data = iio_priv(indio_dev); | 132 | struct tmp006_data *data = iio_priv(indio_dev); |
133 | int i; | 133 | int i; |
134 | 134 | ||
135 | if (mask != IIO_CHAN_INFO_SAMP_FREQ) | ||
136 | return -EINVAL; | ||
137 | |||
135 | for (i = 0; i < ARRAY_SIZE(tmp006_freqs); i++) | 138 | for (i = 0; i < ARRAY_SIZE(tmp006_freqs); i++) |
136 | if ((val == tmp006_freqs[i][0]) && | 139 | if ((val == tmp006_freqs[i][0]) && |
137 | (val2 == tmp006_freqs[i][1])) { | 140 | (val2 == tmp006_freqs[i][1])) { |
diff --git a/drivers/infiniband/core/agent.c b/drivers/infiniband/core/agent.c index c7dcfe4ca5f1..0429040304fd 100644 --- a/drivers/infiniband/core/agent.c +++ b/drivers/infiniband/core/agent.c | |||
@@ -88,7 +88,7 @@ void agent_send_response(const struct ib_mad_hdr *mad_hdr, const struct ib_grh * | |||
88 | struct ib_ah *ah; | 88 | struct ib_ah *ah; |
89 | struct ib_mad_send_wr_private *mad_send_wr; | 89 | struct ib_mad_send_wr_private *mad_send_wr; |
90 | 90 | ||
91 | if (device->node_type == RDMA_NODE_IB_SWITCH) | 91 | if (rdma_cap_ib_switch(device)) |
92 | port_priv = ib_get_agent_port(device, 0); | 92 | port_priv = ib_get_agent_port(device, 0); |
93 | else | 93 | else |
94 | port_priv = ib_get_agent_port(device, port_num); | 94 | port_priv = ib_get_agent_port(device, port_num); |
@@ -122,7 +122,7 @@ void agent_send_response(const struct ib_mad_hdr *mad_hdr, const struct ib_grh * | |||
122 | memcpy(send_buf->mad, mad_hdr, resp_mad_len); | 122 | memcpy(send_buf->mad, mad_hdr, resp_mad_len); |
123 | send_buf->ah = ah; | 123 | send_buf->ah = ah; |
124 | 124 | ||
125 | if (device->node_type == RDMA_NODE_IB_SWITCH) { | 125 | if (rdma_cap_ib_switch(device)) { |
126 | mad_send_wr = container_of(send_buf, | 126 | mad_send_wr = container_of(send_buf, |
127 | struct ib_mad_send_wr_private, | 127 | struct ib_mad_send_wr_private, |
128 | send_buf); | 128 | send_buf); |
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index dbddddd6fb5d..3a972ebf3c0d 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -169,6 +169,7 @@ struct cm_device { | |||
169 | struct ib_device *ib_device; | 169 | struct ib_device *ib_device; |
170 | struct device *device; | 170 | struct device *device; |
171 | u8 ack_delay; | 171 | u8 ack_delay; |
172 | int going_down; | ||
172 | struct cm_port *port[0]; | 173 | struct cm_port *port[0]; |
173 | }; | 174 | }; |
174 | 175 | ||
@@ -805,6 +806,11 @@ static void cm_enter_timewait(struct cm_id_private *cm_id_priv) | |||
805 | { | 806 | { |
806 | int wait_time; | 807 | int wait_time; |
807 | unsigned long flags; | 808 | unsigned long flags; |
809 | struct cm_device *cm_dev; | ||
810 | |||
811 | cm_dev = ib_get_client_data(cm_id_priv->id.device, &cm_client); | ||
812 | if (!cm_dev) | ||
813 | return; | ||
808 | 814 | ||
809 | spin_lock_irqsave(&cm.lock, flags); | 815 | spin_lock_irqsave(&cm.lock, flags); |
810 | cm_cleanup_timewait(cm_id_priv->timewait_info); | 816 | cm_cleanup_timewait(cm_id_priv->timewait_info); |
@@ -818,8 +824,14 @@ static void cm_enter_timewait(struct cm_id_private *cm_id_priv) | |||
818 | */ | 824 | */ |
819 | cm_id_priv->id.state = IB_CM_TIMEWAIT; | 825 | cm_id_priv->id.state = IB_CM_TIMEWAIT; |
820 | wait_time = cm_convert_to_ms(cm_id_priv->av.timeout); | 826 | wait_time = cm_convert_to_ms(cm_id_priv->av.timeout); |
821 | queue_delayed_work(cm.wq, &cm_id_priv->timewait_info->work.work, | 827 | |
822 | msecs_to_jiffies(wait_time)); | 828 | /* Check if the device started its remove_one */ |
829 | spin_lock_irq(&cm.lock); | ||
830 | if (!cm_dev->going_down) | ||
831 | queue_delayed_work(cm.wq, &cm_id_priv->timewait_info->work.work, | ||
832 | msecs_to_jiffies(wait_time)); | ||
833 | spin_unlock_irq(&cm.lock); | ||
834 | |||
823 | cm_id_priv->timewait_info = NULL; | 835 | cm_id_priv->timewait_info = NULL; |
824 | } | 836 | } |
825 | 837 | ||
@@ -3305,6 +3317,11 @@ static int cm_establish(struct ib_cm_id *cm_id) | |||
3305 | struct cm_work *work; | 3317 | struct cm_work *work; |
3306 | unsigned long flags; | 3318 | unsigned long flags; |
3307 | int ret = 0; | 3319 | int ret = 0; |
3320 | struct cm_device *cm_dev; | ||
3321 | |||
3322 | cm_dev = ib_get_client_data(cm_id->device, &cm_client); | ||
3323 | if (!cm_dev) | ||
3324 | return -ENODEV; | ||
3308 | 3325 | ||
3309 | work = kmalloc(sizeof *work, GFP_ATOMIC); | 3326 | work = kmalloc(sizeof *work, GFP_ATOMIC); |
3310 | if (!work) | 3327 | if (!work) |
@@ -3343,7 +3360,17 @@ static int cm_establish(struct ib_cm_id *cm_id) | |||
3343 | work->remote_id = cm_id->remote_id; | 3360 | work->remote_id = cm_id->remote_id; |
3344 | work->mad_recv_wc = NULL; | 3361 | work->mad_recv_wc = NULL; |
3345 | work->cm_event.event = IB_CM_USER_ESTABLISHED; | 3362 | work->cm_event.event = IB_CM_USER_ESTABLISHED; |
3346 | queue_delayed_work(cm.wq, &work->work, 0); | 3363 | |
3364 | /* Check if the device started its remove_one */ | ||
3365 | spin_lock_irq(&cm.lock); | ||
3366 | if (!cm_dev->going_down) { | ||
3367 | queue_delayed_work(cm.wq, &work->work, 0); | ||
3368 | } else { | ||
3369 | kfree(work); | ||
3370 | ret = -ENODEV; | ||
3371 | } | ||
3372 | spin_unlock_irq(&cm.lock); | ||
3373 | |||
3347 | out: | 3374 | out: |
3348 | return ret; | 3375 | return ret; |
3349 | } | 3376 | } |
@@ -3394,6 +3421,7 @@ static void cm_recv_handler(struct ib_mad_agent *mad_agent, | |||
3394 | enum ib_cm_event_type event; | 3421 | enum ib_cm_event_type event; |
3395 | u16 attr_id; | 3422 | u16 attr_id; |
3396 | int paths = 0; | 3423 | int paths = 0; |
3424 | int going_down = 0; | ||
3397 | 3425 | ||
3398 | switch (mad_recv_wc->recv_buf.mad->mad_hdr.attr_id) { | 3426 | switch (mad_recv_wc->recv_buf.mad->mad_hdr.attr_id) { |
3399 | case CM_REQ_ATTR_ID: | 3427 | case CM_REQ_ATTR_ID: |
@@ -3452,7 +3480,19 @@ static void cm_recv_handler(struct ib_mad_agent *mad_agent, | |||
3452 | work->cm_event.event = event; | 3480 | work->cm_event.event = event; |
3453 | work->mad_recv_wc = mad_recv_wc; | 3481 | work->mad_recv_wc = mad_recv_wc; |
3454 | work->port = port; | 3482 | work->port = port; |
3455 | queue_delayed_work(cm.wq, &work->work, 0); | 3483 | |
3484 | /* Check if the device started its remove_one */ | ||
3485 | spin_lock_irq(&cm.lock); | ||
3486 | if (!port->cm_dev->going_down) | ||
3487 | queue_delayed_work(cm.wq, &work->work, 0); | ||
3488 | else | ||
3489 | going_down = 1; | ||
3490 | spin_unlock_irq(&cm.lock); | ||
3491 | |||
3492 | if (going_down) { | ||
3493 | kfree(work); | ||
3494 | ib_free_recv_mad(mad_recv_wc); | ||
3495 | } | ||
3456 | } | 3496 | } |
3457 | 3497 | ||
3458 | static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, | 3498 | static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, |
@@ -3771,7 +3811,7 @@ static void cm_add_one(struct ib_device *ib_device) | |||
3771 | 3811 | ||
3772 | cm_dev->ib_device = ib_device; | 3812 | cm_dev->ib_device = ib_device; |
3773 | cm_get_ack_delay(cm_dev); | 3813 | cm_get_ack_delay(cm_dev); |
3774 | 3814 | cm_dev->going_down = 0; | |
3775 | cm_dev->device = device_create(&cm_class, &ib_device->dev, | 3815 | cm_dev->device = device_create(&cm_class, &ib_device->dev, |
3776 | MKDEV(0, 0), NULL, | 3816 | MKDEV(0, 0), NULL, |
3777 | "%s", ib_device->name); | 3817 | "%s", ib_device->name); |
@@ -3864,14 +3904,23 @@ static void cm_remove_one(struct ib_device *ib_device) | |||
3864 | list_del(&cm_dev->list); | 3904 | list_del(&cm_dev->list); |
3865 | write_unlock_irqrestore(&cm.device_lock, flags); | 3905 | write_unlock_irqrestore(&cm.device_lock, flags); |
3866 | 3906 | ||
3907 | spin_lock_irq(&cm.lock); | ||
3908 | cm_dev->going_down = 1; | ||
3909 | spin_unlock_irq(&cm.lock); | ||
3910 | |||
3867 | for (i = 1; i <= ib_device->phys_port_cnt; i++) { | 3911 | for (i = 1; i <= ib_device->phys_port_cnt; i++) { |
3868 | if (!rdma_cap_ib_cm(ib_device, i)) | 3912 | if (!rdma_cap_ib_cm(ib_device, i)) |
3869 | continue; | 3913 | continue; |
3870 | 3914 | ||
3871 | port = cm_dev->port[i-1]; | 3915 | port = cm_dev->port[i-1]; |
3872 | ib_modify_port(ib_device, port->port_num, 0, &port_modify); | 3916 | ib_modify_port(ib_device, port->port_num, 0, &port_modify); |
3873 | ib_unregister_mad_agent(port->mad_agent); | 3917 | /* |
3918 | * We flush the queue here after the going_down set, this | ||
3919 | * verify that no new works will be queued in the recv handler, | ||
3920 | * after that we can call the unregister_mad_agent | ||
3921 | */ | ||
3874 | flush_workqueue(cm.wq); | 3922 | flush_workqueue(cm.wq); |
3923 | ib_unregister_mad_agent(port->mad_agent); | ||
3875 | cm_remove_port_fs(port); | 3924 | cm_remove_port_fs(port); |
3876 | } | 3925 | } |
3877 | device_unregister(cm_dev->device); | 3926 | device_unregister(cm_dev->device); |
diff --git a/drivers/infiniband/core/iwpm_msg.c b/drivers/infiniband/core/iwpm_msg.c index e6ffa2e66c1a..22a3abee2a54 100644 --- a/drivers/infiniband/core/iwpm_msg.c +++ b/drivers/infiniband/core/iwpm_msg.c | |||
@@ -67,7 +67,8 @@ int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client) | |||
67 | err_str = "Invalid port mapper client"; | 67 | err_str = "Invalid port mapper client"; |
68 | goto pid_query_error; | 68 | goto pid_query_error; |
69 | } | 69 | } |
70 | if (iwpm_registered_client(nl_client)) | 70 | if (iwpm_check_registration(nl_client, IWPM_REG_VALID) || |
71 | iwpm_user_pid == IWPM_PID_UNAVAILABLE) | ||
71 | return 0; | 72 | return 0; |
72 | skb = iwpm_create_nlmsg(RDMA_NL_IWPM_REG_PID, &nlh, nl_client); | 73 | skb = iwpm_create_nlmsg(RDMA_NL_IWPM_REG_PID, &nlh, nl_client); |
73 | if (!skb) { | 74 | if (!skb) { |
@@ -106,7 +107,6 @@ int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client) | |||
106 | ret = ibnl_multicast(skb, nlh, RDMA_NL_GROUP_IWPM, GFP_KERNEL); | 107 | ret = ibnl_multicast(skb, nlh, RDMA_NL_GROUP_IWPM, GFP_KERNEL); |
107 | if (ret) { | 108 | if (ret) { |
108 | skb = NULL; /* skb is freed in the netlink send-op handling */ | 109 | skb = NULL; /* skb is freed in the netlink send-op handling */ |
109 | iwpm_set_registered(nl_client, 1); | ||
110 | iwpm_user_pid = IWPM_PID_UNAVAILABLE; | 110 | iwpm_user_pid = IWPM_PID_UNAVAILABLE; |
111 | err_str = "Unable to send a nlmsg"; | 111 | err_str = "Unable to send a nlmsg"; |
112 | goto pid_query_error; | 112 | goto pid_query_error; |
@@ -144,12 +144,12 @@ int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client) | |||
144 | err_str = "Invalid port mapper client"; | 144 | err_str = "Invalid port mapper client"; |
145 | goto add_mapping_error; | 145 | goto add_mapping_error; |
146 | } | 146 | } |
147 | if (!iwpm_registered_client(nl_client)) { | 147 | if (!iwpm_valid_pid()) |
148 | return 0; | ||
149 | if (!iwpm_check_registration(nl_client, IWPM_REG_VALID)) { | ||
148 | err_str = "Unregistered port mapper client"; | 150 | err_str = "Unregistered port mapper client"; |
149 | goto add_mapping_error; | 151 | goto add_mapping_error; |
150 | } | 152 | } |
151 | if (!iwpm_valid_pid()) | ||
152 | return 0; | ||
153 | skb = iwpm_create_nlmsg(RDMA_NL_IWPM_ADD_MAPPING, &nlh, nl_client); | 153 | skb = iwpm_create_nlmsg(RDMA_NL_IWPM_ADD_MAPPING, &nlh, nl_client); |
154 | if (!skb) { | 154 | if (!skb) { |
155 | err_str = "Unable to create a nlmsg"; | 155 | err_str = "Unable to create a nlmsg"; |
@@ -214,12 +214,12 @@ int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client) | |||
214 | err_str = "Invalid port mapper client"; | 214 | err_str = "Invalid port mapper client"; |
215 | goto query_mapping_error; | 215 | goto query_mapping_error; |
216 | } | 216 | } |
217 | if (!iwpm_registered_client(nl_client)) { | 217 | if (!iwpm_valid_pid()) |
218 | return 0; | ||
219 | if (!iwpm_check_registration(nl_client, IWPM_REG_VALID)) { | ||
218 | err_str = "Unregistered port mapper client"; | 220 | err_str = "Unregistered port mapper client"; |
219 | goto query_mapping_error; | 221 | goto query_mapping_error; |
220 | } | 222 | } |
221 | if (!iwpm_valid_pid()) | ||
222 | return 0; | ||
223 | ret = -ENOMEM; | 223 | ret = -ENOMEM; |
224 | skb = iwpm_create_nlmsg(RDMA_NL_IWPM_QUERY_MAPPING, &nlh, nl_client); | 224 | skb = iwpm_create_nlmsg(RDMA_NL_IWPM_QUERY_MAPPING, &nlh, nl_client); |
225 | if (!skb) { | 225 | if (!skb) { |
@@ -288,12 +288,12 @@ int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client) | |||
288 | err_str = "Invalid port mapper client"; | 288 | err_str = "Invalid port mapper client"; |
289 | goto remove_mapping_error; | 289 | goto remove_mapping_error; |
290 | } | 290 | } |
291 | if (!iwpm_registered_client(nl_client)) { | 291 | if (!iwpm_valid_pid()) |
292 | return 0; | ||
293 | if (iwpm_check_registration(nl_client, IWPM_REG_UNDEF)) { | ||
292 | err_str = "Unregistered port mapper client"; | 294 | err_str = "Unregistered port mapper client"; |
293 | goto remove_mapping_error; | 295 | goto remove_mapping_error; |
294 | } | 296 | } |
295 | if (!iwpm_valid_pid()) | ||
296 | return 0; | ||
297 | skb = iwpm_create_nlmsg(RDMA_NL_IWPM_REMOVE_MAPPING, &nlh, nl_client); | 297 | skb = iwpm_create_nlmsg(RDMA_NL_IWPM_REMOVE_MAPPING, &nlh, nl_client); |
298 | if (!skb) { | 298 | if (!skb) { |
299 | ret = -ENOMEM; | 299 | ret = -ENOMEM; |
@@ -388,7 +388,7 @@ int iwpm_register_pid_cb(struct sk_buff *skb, struct netlink_callback *cb) | |||
388 | pr_debug("%s: iWarp Port Mapper (pid = %d) is available!\n", | 388 | pr_debug("%s: iWarp Port Mapper (pid = %d) is available!\n", |
389 | __func__, iwpm_user_pid); | 389 | __func__, iwpm_user_pid); |
390 | if (iwpm_valid_client(nl_client)) | 390 | if (iwpm_valid_client(nl_client)) |
391 | iwpm_set_registered(nl_client, 1); | 391 | iwpm_set_registration(nl_client, IWPM_REG_VALID); |
392 | register_pid_response_exit: | 392 | register_pid_response_exit: |
393 | nlmsg_request->request_done = 1; | 393 | nlmsg_request->request_done = 1; |
394 | /* always for found nlmsg_request */ | 394 | /* always for found nlmsg_request */ |
@@ -644,7 +644,6 @@ int iwpm_mapping_info_cb(struct sk_buff *skb, struct netlink_callback *cb) | |||
644 | { | 644 | { |
645 | struct nlattr *nltb[IWPM_NLA_MAPINFO_REQ_MAX]; | 645 | struct nlattr *nltb[IWPM_NLA_MAPINFO_REQ_MAX]; |
646 | const char *msg_type = "Mapping Info response"; | 646 | const char *msg_type = "Mapping Info response"; |
647 | int iwpm_pid; | ||
648 | u8 nl_client; | 647 | u8 nl_client; |
649 | char *iwpm_name; | 648 | char *iwpm_name; |
650 | u16 iwpm_version; | 649 | u16 iwpm_version; |
@@ -669,14 +668,14 @@ int iwpm_mapping_info_cb(struct sk_buff *skb, struct netlink_callback *cb) | |||
669 | __func__, nl_client); | 668 | __func__, nl_client); |
670 | return ret; | 669 | return ret; |
671 | } | 670 | } |
672 | iwpm_set_registered(nl_client, 0); | 671 | iwpm_set_registration(nl_client, IWPM_REG_INCOMPL); |
673 | atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq); | 672 | atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq); |
673 | iwpm_user_pid = cb->nlh->nlmsg_pid; | ||
674 | if (!iwpm_mapinfo_available()) | 674 | if (!iwpm_mapinfo_available()) |
675 | return 0; | 675 | return 0; |
676 | iwpm_pid = cb->nlh->nlmsg_pid; | ||
677 | pr_debug("%s: iWarp Port Mapper (pid = %d) is available!\n", | 676 | pr_debug("%s: iWarp Port Mapper (pid = %d) is available!\n", |
678 | __func__, iwpm_pid); | 677 | __func__, iwpm_user_pid); |
679 | ret = iwpm_send_mapinfo(nl_client, iwpm_pid); | 678 | ret = iwpm_send_mapinfo(nl_client, iwpm_user_pid); |
680 | return ret; | 679 | return ret; |
681 | } | 680 | } |
682 | EXPORT_SYMBOL(iwpm_mapping_info_cb); | 681 | EXPORT_SYMBOL(iwpm_mapping_info_cb); |
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c index a626795bf9c7..5fb089e91353 100644 --- a/drivers/infiniband/core/iwpm_util.c +++ b/drivers/infiniband/core/iwpm_util.c | |||
@@ -78,6 +78,7 @@ init_exit: | |||
78 | mutex_unlock(&iwpm_admin_lock); | 78 | mutex_unlock(&iwpm_admin_lock); |
79 | if (!ret) { | 79 | if (!ret) { |
80 | iwpm_set_valid(nl_client, 1); | 80 | iwpm_set_valid(nl_client, 1); |
81 | iwpm_set_registration(nl_client, IWPM_REG_UNDEF); | ||
81 | pr_debug("%s: Mapinfo and reminfo tables are created\n", | 82 | pr_debug("%s: Mapinfo and reminfo tables are created\n", |
82 | __func__); | 83 | __func__); |
83 | } | 84 | } |
@@ -106,6 +107,7 @@ int iwpm_exit(u8 nl_client) | |||
106 | } | 107 | } |
107 | mutex_unlock(&iwpm_admin_lock); | 108 | mutex_unlock(&iwpm_admin_lock); |
108 | iwpm_set_valid(nl_client, 0); | 109 | iwpm_set_valid(nl_client, 0); |
110 | iwpm_set_registration(nl_client, IWPM_REG_UNDEF); | ||
109 | return 0; | 111 | return 0; |
110 | } | 112 | } |
111 | EXPORT_SYMBOL(iwpm_exit); | 113 | EXPORT_SYMBOL(iwpm_exit); |
@@ -397,17 +399,23 @@ void iwpm_set_valid(u8 nl_client, int valid) | |||
397 | } | 399 | } |
398 | 400 | ||
399 | /* valid client */ | 401 | /* valid client */ |
400 | int iwpm_registered_client(u8 nl_client) | 402 | u32 iwpm_get_registration(u8 nl_client) |
401 | { | 403 | { |
402 | return iwpm_admin.reg_list[nl_client]; | 404 | return iwpm_admin.reg_list[nl_client]; |
403 | } | 405 | } |
404 | 406 | ||
405 | /* valid client */ | 407 | /* valid client */ |
406 | void iwpm_set_registered(u8 nl_client, int reg) | 408 | void iwpm_set_registration(u8 nl_client, u32 reg) |
407 | { | 409 | { |
408 | iwpm_admin.reg_list[nl_client] = reg; | 410 | iwpm_admin.reg_list[nl_client] = reg; |
409 | } | 411 | } |
410 | 412 | ||
413 | /* valid client */ | ||
414 | u32 iwpm_check_registration(u8 nl_client, u32 reg) | ||
415 | { | ||
416 | return (iwpm_get_registration(nl_client) & reg); | ||
417 | } | ||
418 | |||
411 | int iwpm_compare_sockaddr(struct sockaddr_storage *a_sockaddr, | 419 | int iwpm_compare_sockaddr(struct sockaddr_storage *a_sockaddr, |
412 | struct sockaddr_storage *b_sockaddr) | 420 | struct sockaddr_storage *b_sockaddr) |
413 | { | 421 | { |
diff --git a/drivers/infiniband/core/iwpm_util.h b/drivers/infiniband/core/iwpm_util.h index ee2d9ff095be..b7b9e194ce81 100644 --- a/drivers/infiniband/core/iwpm_util.h +++ b/drivers/infiniband/core/iwpm_util.h | |||
@@ -58,6 +58,10 @@ | |||
58 | #define IWPM_PID_UNDEFINED -1 | 58 | #define IWPM_PID_UNDEFINED -1 |
59 | #define IWPM_PID_UNAVAILABLE -2 | 59 | #define IWPM_PID_UNAVAILABLE -2 |
60 | 60 | ||
61 | #define IWPM_REG_UNDEF 0x01 | ||
62 | #define IWPM_REG_VALID 0x02 | ||
63 | #define IWPM_REG_INCOMPL 0x04 | ||
64 | |||
61 | struct iwpm_nlmsg_request { | 65 | struct iwpm_nlmsg_request { |
62 | struct list_head inprocess_list; | 66 | struct list_head inprocess_list; |
63 | __u32 nlmsg_seq; | 67 | __u32 nlmsg_seq; |
@@ -88,7 +92,7 @@ struct iwpm_admin_data { | |||
88 | atomic_t refcount; | 92 | atomic_t refcount; |
89 | atomic_t nlmsg_seq; | 93 | atomic_t nlmsg_seq; |
90 | int client_list[RDMA_NL_NUM_CLIENTS]; | 94 | int client_list[RDMA_NL_NUM_CLIENTS]; |
91 | int reg_list[RDMA_NL_NUM_CLIENTS]; | 95 | u32 reg_list[RDMA_NL_NUM_CLIENTS]; |
92 | }; | 96 | }; |
93 | 97 | ||
94 | /** | 98 | /** |
@@ -159,19 +163,31 @@ int iwpm_valid_client(u8 nl_client); | |||
159 | void iwpm_set_valid(u8 nl_client, int valid); | 163 | void iwpm_set_valid(u8 nl_client, int valid); |
160 | 164 | ||
161 | /** | 165 | /** |
162 | * iwpm_registered_client - Check if the port mapper client is registered | 166 | * iwpm_check_registration - Check if the client registration |
167 | * matches the given one | ||
163 | * @nl_client: The index of the netlink client | 168 | * @nl_client: The index of the netlink client |
169 | * @reg: The given registration type to compare with | ||
164 | * | 170 | * |
165 | * Call iwpm_register_pid() to register a client | 171 | * Call iwpm_register_pid() to register a client |
172 | * Returns true if the client registration matches reg, | ||
173 | * otherwise returns false | ||
174 | */ | ||
175 | u32 iwpm_check_registration(u8 nl_client, u32 reg); | ||
176 | |||
177 | /** | ||
178 | * iwpm_set_registration - Set the client registration | ||
179 | * @nl_client: The index of the netlink client | ||
180 | * @reg: Registration type to set | ||
166 | */ | 181 | */ |
167 | int iwpm_registered_client(u8 nl_client); | 182 | void iwpm_set_registration(u8 nl_client, u32 reg); |
168 | 183 | ||
169 | /** | 184 | /** |
170 | * iwpm_set_registered - Set the port mapper client to registered or not | 185 | * iwpm_get_registration |
171 | * @nl_client: The index of the netlink client | 186 | * @nl_client: The index of the netlink client |
172 | * @reg: 1 if registered or 0 if not | 187 | * |
188 | * Returns the client registration type | ||
173 | */ | 189 | */ |
174 | void iwpm_set_registered(u8 nl_client, int reg); | 190 | u32 iwpm_get_registration(u8 nl_client); |
175 | 191 | ||
176 | /** | 192 | /** |
177 | * iwpm_send_mapinfo - Send local and mapped IPv4/IPv6 address info of | 193 | * iwpm_send_mapinfo - Send local and mapped IPv4/IPv6 address info of |
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index a4b1466c1bf6..786fc51bf04b 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -769,7 +769,7 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, | |||
769 | bool opa = rdma_cap_opa_mad(mad_agent_priv->qp_info->port_priv->device, | 769 | bool opa = rdma_cap_opa_mad(mad_agent_priv->qp_info->port_priv->device, |
770 | mad_agent_priv->qp_info->port_priv->port_num); | 770 | mad_agent_priv->qp_info->port_priv->port_num); |
771 | 771 | ||
772 | if (device->node_type == RDMA_NODE_IB_SWITCH && | 772 | if (rdma_cap_ib_switch(device) && |
773 | smp->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) | 773 | smp->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) |
774 | port_num = send_wr->wr.ud.port_num; | 774 | port_num = send_wr->wr.ud.port_num; |
775 | else | 775 | else |
@@ -787,14 +787,15 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, | |||
787 | if ((opa_get_smp_direction(opa_smp) | 787 | if ((opa_get_smp_direction(opa_smp) |
788 | ? opa_smp->route.dr.dr_dlid : opa_smp->route.dr.dr_slid) == | 788 | ? opa_smp->route.dr.dr_dlid : opa_smp->route.dr.dr_slid) == |
789 | OPA_LID_PERMISSIVE && | 789 | OPA_LID_PERMISSIVE && |
790 | opa_smi_handle_dr_smp_send(opa_smp, device->node_type, | 790 | opa_smi_handle_dr_smp_send(opa_smp, |
791 | rdma_cap_ib_switch(device), | ||
791 | port_num) == IB_SMI_DISCARD) { | 792 | port_num) == IB_SMI_DISCARD) { |
792 | ret = -EINVAL; | 793 | ret = -EINVAL; |
793 | dev_err(&device->dev, "OPA Invalid directed route\n"); | 794 | dev_err(&device->dev, "OPA Invalid directed route\n"); |
794 | goto out; | 795 | goto out; |
795 | } | 796 | } |
796 | opa_drslid = be32_to_cpu(opa_smp->route.dr.dr_slid); | 797 | opa_drslid = be32_to_cpu(opa_smp->route.dr.dr_slid); |
797 | if (opa_drslid != OPA_LID_PERMISSIVE && | 798 | if (opa_drslid != be32_to_cpu(OPA_LID_PERMISSIVE) && |
798 | opa_drslid & 0xffff0000) { | 799 | opa_drslid & 0xffff0000) { |
799 | ret = -EINVAL; | 800 | ret = -EINVAL; |
800 | dev_err(&device->dev, "OPA Invalid dr_slid 0x%x\n", | 801 | dev_err(&device->dev, "OPA Invalid dr_slid 0x%x\n", |
@@ -810,7 +811,7 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, | |||
810 | } else { | 811 | } else { |
811 | if ((ib_get_smp_direction(smp) ? smp->dr_dlid : smp->dr_slid) == | 812 | if ((ib_get_smp_direction(smp) ? smp->dr_dlid : smp->dr_slid) == |
812 | IB_LID_PERMISSIVE && | 813 | IB_LID_PERMISSIVE && |
813 | smi_handle_dr_smp_send(smp, device->node_type, port_num) == | 814 | smi_handle_dr_smp_send(smp, rdma_cap_ib_switch(device), port_num) == |
814 | IB_SMI_DISCARD) { | 815 | IB_SMI_DISCARD) { |
815 | ret = -EINVAL; | 816 | ret = -EINVAL; |
816 | dev_err(&device->dev, "Invalid directed route\n"); | 817 | dev_err(&device->dev, "Invalid directed route\n"); |
@@ -2030,7 +2031,7 @@ static enum smi_action handle_ib_smi(const struct ib_mad_port_private *port_priv | |||
2030 | struct ib_smp *smp = (struct ib_smp *)recv->mad; | 2031 | struct ib_smp *smp = (struct ib_smp *)recv->mad; |
2031 | 2032 | ||
2032 | if (smi_handle_dr_smp_recv(smp, | 2033 | if (smi_handle_dr_smp_recv(smp, |
2033 | port_priv->device->node_type, | 2034 | rdma_cap_ib_switch(port_priv->device), |
2034 | port_num, | 2035 | port_num, |
2035 | port_priv->device->phys_port_cnt) == | 2036 | port_priv->device->phys_port_cnt) == |
2036 | IB_SMI_DISCARD) | 2037 | IB_SMI_DISCARD) |
@@ -2042,13 +2043,13 @@ static enum smi_action handle_ib_smi(const struct ib_mad_port_private *port_priv | |||
2042 | 2043 | ||
2043 | if (retsmi == IB_SMI_SEND) { /* don't forward */ | 2044 | if (retsmi == IB_SMI_SEND) { /* don't forward */ |
2044 | if (smi_handle_dr_smp_send(smp, | 2045 | if (smi_handle_dr_smp_send(smp, |
2045 | port_priv->device->node_type, | 2046 | rdma_cap_ib_switch(port_priv->device), |
2046 | port_num) == IB_SMI_DISCARD) | 2047 | port_num) == IB_SMI_DISCARD) |
2047 | return IB_SMI_DISCARD; | 2048 | return IB_SMI_DISCARD; |
2048 | 2049 | ||
2049 | if (smi_check_local_smp(smp, port_priv->device) == IB_SMI_DISCARD) | 2050 | if (smi_check_local_smp(smp, port_priv->device) == IB_SMI_DISCARD) |
2050 | return IB_SMI_DISCARD; | 2051 | return IB_SMI_DISCARD; |
2051 | } else if (port_priv->device->node_type == RDMA_NODE_IB_SWITCH) { | 2052 | } else if (rdma_cap_ib_switch(port_priv->device)) { |
2052 | /* forward case for switches */ | 2053 | /* forward case for switches */ |
2053 | memcpy(response, recv, mad_priv_size(response)); | 2054 | memcpy(response, recv, mad_priv_size(response)); |
2054 | response->header.recv_wc.wc = &response->header.wc; | 2055 | response->header.recv_wc.wc = &response->header.wc; |
@@ -2115,7 +2116,7 @@ handle_opa_smi(struct ib_mad_port_private *port_priv, | |||
2115 | struct opa_smp *smp = (struct opa_smp *)recv->mad; | 2116 | struct opa_smp *smp = (struct opa_smp *)recv->mad; |
2116 | 2117 | ||
2117 | if (opa_smi_handle_dr_smp_recv(smp, | 2118 | if (opa_smi_handle_dr_smp_recv(smp, |
2118 | port_priv->device->node_type, | 2119 | rdma_cap_ib_switch(port_priv->device), |
2119 | port_num, | 2120 | port_num, |
2120 | port_priv->device->phys_port_cnt) == | 2121 | port_priv->device->phys_port_cnt) == |
2121 | IB_SMI_DISCARD) | 2122 | IB_SMI_DISCARD) |
@@ -2127,7 +2128,7 @@ handle_opa_smi(struct ib_mad_port_private *port_priv, | |||
2127 | 2128 | ||
2128 | if (retsmi == IB_SMI_SEND) { /* don't forward */ | 2129 | if (retsmi == IB_SMI_SEND) { /* don't forward */ |
2129 | if (opa_smi_handle_dr_smp_send(smp, | 2130 | if (opa_smi_handle_dr_smp_send(smp, |
2130 | port_priv->device->node_type, | 2131 | rdma_cap_ib_switch(port_priv->device), |
2131 | port_num) == IB_SMI_DISCARD) | 2132 | port_num) == IB_SMI_DISCARD) |
2132 | return IB_SMI_DISCARD; | 2133 | return IB_SMI_DISCARD; |
2133 | 2134 | ||
@@ -2135,7 +2136,7 @@ handle_opa_smi(struct ib_mad_port_private *port_priv, | |||
2135 | IB_SMI_DISCARD) | 2136 | IB_SMI_DISCARD) |
2136 | return IB_SMI_DISCARD; | 2137 | return IB_SMI_DISCARD; |
2137 | 2138 | ||
2138 | } else if (port_priv->device->node_type == RDMA_NODE_IB_SWITCH) { | 2139 | } else if (rdma_cap_ib_switch(port_priv->device)) { |
2139 | /* forward case for switches */ | 2140 | /* forward case for switches */ |
2140 | memcpy(response, recv, mad_priv_size(response)); | 2141 | memcpy(response, recv, mad_priv_size(response)); |
2141 | response->header.recv_wc.wc = &response->header.wc; | 2142 | response->header.recv_wc.wc = &response->header.wc; |
@@ -2235,7 +2236,7 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv, | |||
2235 | goto out; | 2236 | goto out; |
2236 | } | 2237 | } |
2237 | 2238 | ||
2238 | if (port_priv->device->node_type == RDMA_NODE_IB_SWITCH) | 2239 | if (rdma_cap_ib_switch(port_priv->device)) |
2239 | port_num = wc->port_num; | 2240 | port_num = wc->port_num; |
2240 | else | 2241 | else |
2241 | port_num = port_priv->port_num; | 2242 | port_num = port_priv->port_num; |
@@ -3297,17 +3298,11 @@ static int ib_mad_port_close(struct ib_device *device, int port_num) | |||
3297 | 3298 | ||
3298 | static void ib_mad_init_device(struct ib_device *device) | 3299 | static void ib_mad_init_device(struct ib_device *device) |
3299 | { | 3300 | { |
3300 | int start, end, i; | 3301 | int start, i; |
3301 | 3302 | ||
3302 | if (device->node_type == RDMA_NODE_IB_SWITCH) { | 3303 | start = rdma_start_port(device); |
3303 | start = 0; | ||
3304 | end = 0; | ||
3305 | } else { | ||
3306 | start = 1; | ||
3307 | end = device->phys_port_cnt; | ||
3308 | } | ||
3309 | 3304 | ||
3310 | for (i = start; i <= end; i++) { | 3305 | for (i = start; i <= rdma_end_port(device); i++) { |
3311 | if (!rdma_cap_ib_mad(device, i)) | 3306 | if (!rdma_cap_ib_mad(device, i)) |
3312 | continue; | 3307 | continue; |
3313 | 3308 | ||
@@ -3342,17 +3337,9 @@ error: | |||
3342 | 3337 | ||
3343 | static void ib_mad_remove_device(struct ib_device *device) | 3338 | static void ib_mad_remove_device(struct ib_device *device) |
3344 | { | 3339 | { |
3345 | int start, end, i; | 3340 | int i; |
3346 | |||
3347 | if (device->node_type == RDMA_NODE_IB_SWITCH) { | ||
3348 | start = 0; | ||
3349 | end = 0; | ||
3350 | } else { | ||
3351 | start = 1; | ||
3352 | end = device->phys_port_cnt; | ||
3353 | } | ||
3354 | 3341 | ||
3355 | for (i = start; i <= end; i++) { | 3342 | for (i = rdma_start_port(device); i <= rdma_end_port(device); i++) { |
3356 | if (!rdma_cap_ib_mad(device, i)) | 3343 | if (!rdma_cap_ib_mad(device, i)) |
3357 | continue; | 3344 | continue; |
3358 | 3345 | ||
diff --git a/drivers/infiniband/core/multicast.c b/drivers/infiniband/core/multicast.c index 1244f02a5c6d..2cb865c7ce7a 100644 --- a/drivers/infiniband/core/multicast.c +++ b/drivers/infiniband/core/multicast.c | |||
@@ -812,12 +812,8 @@ static void mcast_add_one(struct ib_device *device) | |||
812 | if (!dev) | 812 | if (!dev) |
813 | return; | 813 | return; |
814 | 814 | ||
815 | if (device->node_type == RDMA_NODE_IB_SWITCH) | 815 | dev->start_port = rdma_start_port(device); |
816 | dev->start_port = dev->end_port = 0; | 816 | dev->end_port = rdma_end_port(device); |
817 | else { | ||
818 | dev->start_port = 1; | ||
819 | dev->end_port = device->phys_port_cnt; | ||
820 | } | ||
821 | 817 | ||
822 | for (i = 0; i <= dev->end_port - dev->start_port; i++) { | 818 | for (i = 0; i <= dev->end_port - dev->start_port; i++) { |
823 | if (!rdma_cap_ib_mcast(device, dev->start_port + i)) | 819 | if (!rdma_cap_ib_mcast(device, dev->start_port + i)) |
diff --git a/drivers/infiniband/core/opa_smi.h b/drivers/infiniband/core/opa_smi.h index 62d91bfa4cb7..3bfab3505a29 100644 --- a/drivers/infiniband/core/opa_smi.h +++ b/drivers/infiniband/core/opa_smi.h | |||
@@ -39,12 +39,12 @@ | |||
39 | 39 | ||
40 | #include "smi.h" | 40 | #include "smi.h" |
41 | 41 | ||
42 | enum smi_action opa_smi_handle_dr_smp_recv(struct opa_smp *smp, u8 node_type, | 42 | enum smi_action opa_smi_handle_dr_smp_recv(struct opa_smp *smp, bool is_switch, |
43 | int port_num, int phys_port_cnt); | 43 | int port_num, int phys_port_cnt); |
44 | int opa_smi_get_fwd_port(struct opa_smp *smp); | 44 | int opa_smi_get_fwd_port(struct opa_smp *smp); |
45 | extern enum smi_forward_action opa_smi_check_forward_dr_smp(struct opa_smp *smp); | 45 | extern enum smi_forward_action opa_smi_check_forward_dr_smp(struct opa_smp *smp); |
46 | extern enum smi_action opa_smi_handle_dr_smp_send(struct opa_smp *smp, | 46 | extern enum smi_action opa_smi_handle_dr_smp_send(struct opa_smp *smp, |
47 | u8 node_type, int port_num); | 47 | bool is_switch, int port_num); |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * Return IB_SMI_HANDLE if the SMP should be handled by the local SMA/SM | 50 | * Return IB_SMI_HANDLE if the SMP should be handled by the local SMA/SM |
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index 0fae85062a65..ca919f429666 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c | |||
@@ -1156,12 +1156,8 @@ static void ib_sa_add_one(struct ib_device *device) | |||
1156 | int s, e, i; | 1156 | int s, e, i; |
1157 | int count = 0; | 1157 | int count = 0; |
1158 | 1158 | ||
1159 | if (device->node_type == RDMA_NODE_IB_SWITCH) | 1159 | s = rdma_start_port(device); |
1160 | s = e = 0; | 1160 | e = rdma_end_port(device); |
1161 | else { | ||
1162 | s = 1; | ||
1163 | e = device->phys_port_cnt; | ||
1164 | } | ||
1165 | 1161 | ||
1166 | sa_dev = kzalloc(sizeof *sa_dev + | 1162 | sa_dev = kzalloc(sizeof *sa_dev + |
1167 | (e - s + 1) * sizeof (struct ib_sa_port), | 1163 | (e - s + 1) * sizeof (struct ib_sa_port), |
diff --git a/drivers/infiniband/core/smi.c b/drivers/infiniband/core/smi.c index 368a561d1a5d..f19b23817c2b 100644 --- a/drivers/infiniband/core/smi.c +++ b/drivers/infiniband/core/smi.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include "smi.h" | 41 | #include "smi.h" |
42 | #include "opa_smi.h" | 42 | #include "opa_smi.h" |
43 | 43 | ||
44 | static enum smi_action __smi_handle_dr_smp_send(u8 node_type, int port_num, | 44 | static enum smi_action __smi_handle_dr_smp_send(bool is_switch, int port_num, |
45 | u8 *hop_ptr, u8 hop_cnt, | 45 | u8 *hop_ptr, u8 hop_cnt, |
46 | const u8 *initial_path, | 46 | const u8 *initial_path, |
47 | const u8 *return_path, | 47 | const u8 *return_path, |
@@ -64,7 +64,7 @@ static enum smi_action __smi_handle_dr_smp_send(u8 node_type, int port_num, | |||
64 | 64 | ||
65 | /* C14-9:2 */ | 65 | /* C14-9:2 */ |
66 | if (*hop_ptr && *hop_ptr < hop_cnt) { | 66 | if (*hop_ptr && *hop_ptr < hop_cnt) { |
67 | if (node_type != RDMA_NODE_IB_SWITCH) | 67 | if (!is_switch) |
68 | return IB_SMI_DISCARD; | 68 | return IB_SMI_DISCARD; |
69 | 69 | ||
70 | /* return_path set when received */ | 70 | /* return_path set when received */ |
@@ -77,7 +77,7 @@ static enum smi_action __smi_handle_dr_smp_send(u8 node_type, int port_num, | |||
77 | if (*hop_ptr == hop_cnt) { | 77 | if (*hop_ptr == hop_cnt) { |
78 | /* return_path set when received */ | 78 | /* return_path set when received */ |
79 | (*hop_ptr)++; | 79 | (*hop_ptr)++; |
80 | return (node_type == RDMA_NODE_IB_SWITCH || | 80 | return (is_switch || |
81 | dr_dlid_is_permissive ? | 81 | dr_dlid_is_permissive ? |
82 | IB_SMI_HANDLE : IB_SMI_DISCARD); | 82 | IB_SMI_HANDLE : IB_SMI_DISCARD); |
83 | } | 83 | } |
@@ -96,7 +96,7 @@ static enum smi_action __smi_handle_dr_smp_send(u8 node_type, int port_num, | |||
96 | 96 | ||
97 | /* C14-13:2 */ | 97 | /* C14-13:2 */ |
98 | if (2 <= *hop_ptr && *hop_ptr <= hop_cnt) { | 98 | if (2 <= *hop_ptr && *hop_ptr <= hop_cnt) { |
99 | if (node_type != RDMA_NODE_IB_SWITCH) | 99 | if (!is_switch) |
100 | return IB_SMI_DISCARD; | 100 | return IB_SMI_DISCARD; |
101 | 101 | ||
102 | (*hop_ptr)--; | 102 | (*hop_ptr)--; |
@@ -108,7 +108,7 @@ static enum smi_action __smi_handle_dr_smp_send(u8 node_type, int port_num, | |||
108 | if (*hop_ptr == 1) { | 108 | if (*hop_ptr == 1) { |
109 | (*hop_ptr)--; | 109 | (*hop_ptr)--; |
110 | /* C14-13:3 -- SMPs destined for SM shouldn't be here */ | 110 | /* C14-13:3 -- SMPs destined for SM shouldn't be here */ |
111 | return (node_type == RDMA_NODE_IB_SWITCH || | 111 | return (is_switch || |
112 | dr_slid_is_permissive ? | 112 | dr_slid_is_permissive ? |
113 | IB_SMI_HANDLE : IB_SMI_DISCARD); | 113 | IB_SMI_HANDLE : IB_SMI_DISCARD); |
114 | } | 114 | } |
@@ -127,9 +127,9 @@ static enum smi_action __smi_handle_dr_smp_send(u8 node_type, int port_num, | |||
127 | * Return IB_SMI_DISCARD if the SMP should be discarded | 127 | * Return IB_SMI_DISCARD if the SMP should be discarded |
128 | */ | 128 | */ |
129 | enum smi_action smi_handle_dr_smp_send(struct ib_smp *smp, | 129 | enum smi_action smi_handle_dr_smp_send(struct ib_smp *smp, |
130 | u8 node_type, int port_num) | 130 | bool is_switch, int port_num) |
131 | { | 131 | { |
132 | return __smi_handle_dr_smp_send(node_type, port_num, | 132 | return __smi_handle_dr_smp_send(is_switch, port_num, |
133 | &smp->hop_ptr, smp->hop_cnt, | 133 | &smp->hop_ptr, smp->hop_cnt, |
134 | smp->initial_path, | 134 | smp->initial_path, |
135 | smp->return_path, | 135 | smp->return_path, |
@@ -139,9 +139,9 @@ enum smi_action smi_handle_dr_smp_send(struct ib_smp *smp, | |||
139 | } | 139 | } |
140 | 140 | ||
141 | enum smi_action opa_smi_handle_dr_smp_send(struct opa_smp *smp, | 141 | enum smi_action opa_smi_handle_dr_smp_send(struct opa_smp *smp, |
142 | u8 node_type, int port_num) | 142 | bool is_switch, int port_num) |
143 | { | 143 | { |
144 | return __smi_handle_dr_smp_send(node_type, port_num, | 144 | return __smi_handle_dr_smp_send(is_switch, port_num, |
145 | &smp->hop_ptr, smp->hop_cnt, | 145 | &smp->hop_ptr, smp->hop_cnt, |
146 | smp->route.dr.initial_path, | 146 | smp->route.dr.initial_path, |
147 | smp->route.dr.return_path, | 147 | smp->route.dr.return_path, |
@@ -152,7 +152,7 @@ enum smi_action opa_smi_handle_dr_smp_send(struct opa_smp *smp, | |||
152 | OPA_LID_PERMISSIVE); | 152 | OPA_LID_PERMISSIVE); |
153 | } | 153 | } |
154 | 154 | ||
155 | static enum smi_action __smi_handle_dr_smp_recv(u8 node_type, int port_num, | 155 | static enum smi_action __smi_handle_dr_smp_recv(bool is_switch, int port_num, |
156 | int phys_port_cnt, | 156 | int phys_port_cnt, |
157 | u8 *hop_ptr, u8 hop_cnt, | 157 | u8 *hop_ptr, u8 hop_cnt, |
158 | const u8 *initial_path, | 158 | const u8 *initial_path, |
@@ -173,7 +173,7 @@ static enum smi_action __smi_handle_dr_smp_recv(u8 node_type, int port_num, | |||
173 | 173 | ||
174 | /* C14-9:2 -- intermediate hop */ | 174 | /* C14-9:2 -- intermediate hop */ |
175 | if (*hop_ptr && *hop_ptr < hop_cnt) { | 175 | if (*hop_ptr && *hop_ptr < hop_cnt) { |
176 | if (node_type != RDMA_NODE_IB_SWITCH) | 176 | if (!is_switch) |
177 | return IB_SMI_DISCARD; | 177 | return IB_SMI_DISCARD; |
178 | 178 | ||
179 | return_path[*hop_ptr] = port_num; | 179 | return_path[*hop_ptr] = port_num; |
@@ -188,7 +188,7 @@ static enum smi_action __smi_handle_dr_smp_recv(u8 node_type, int port_num, | |||
188 | return_path[*hop_ptr] = port_num; | 188 | return_path[*hop_ptr] = port_num; |
189 | /* hop_ptr updated when sending */ | 189 | /* hop_ptr updated when sending */ |
190 | 190 | ||
191 | return (node_type == RDMA_NODE_IB_SWITCH || | 191 | return (is_switch || |
192 | dr_dlid_is_permissive ? | 192 | dr_dlid_is_permissive ? |
193 | IB_SMI_HANDLE : IB_SMI_DISCARD); | 193 | IB_SMI_HANDLE : IB_SMI_DISCARD); |
194 | } | 194 | } |
@@ -208,7 +208,7 @@ static enum smi_action __smi_handle_dr_smp_recv(u8 node_type, int port_num, | |||
208 | 208 | ||
209 | /* C14-13:2 */ | 209 | /* C14-13:2 */ |
210 | if (2 <= *hop_ptr && *hop_ptr <= hop_cnt) { | 210 | if (2 <= *hop_ptr && *hop_ptr <= hop_cnt) { |
211 | if (node_type != RDMA_NODE_IB_SWITCH) | 211 | if (!is_switch) |
212 | return IB_SMI_DISCARD; | 212 | return IB_SMI_DISCARD; |
213 | 213 | ||
214 | /* hop_ptr updated when sending */ | 214 | /* hop_ptr updated when sending */ |
@@ -224,8 +224,7 @@ static enum smi_action __smi_handle_dr_smp_recv(u8 node_type, int port_num, | |||
224 | return IB_SMI_HANDLE; | 224 | return IB_SMI_HANDLE; |
225 | } | 225 | } |
226 | /* hop_ptr updated when sending */ | 226 | /* hop_ptr updated when sending */ |
227 | return (node_type == RDMA_NODE_IB_SWITCH ? | 227 | return (is_switch ? IB_SMI_HANDLE : IB_SMI_DISCARD); |
228 | IB_SMI_HANDLE : IB_SMI_DISCARD); | ||
229 | } | 228 | } |
230 | 229 | ||
231 | /* C14-13:4 -- hop_ptr = 0 -> give to SM */ | 230 | /* C14-13:4 -- hop_ptr = 0 -> give to SM */ |
@@ -238,10 +237,10 @@ static enum smi_action __smi_handle_dr_smp_recv(u8 node_type, int port_num, | |||
238 | * Adjust information for a received SMP | 237 | * Adjust information for a received SMP |
239 | * Return IB_SMI_DISCARD if the SMP should be dropped | 238 | * Return IB_SMI_DISCARD if the SMP should be dropped |
240 | */ | 239 | */ |
241 | enum smi_action smi_handle_dr_smp_recv(struct ib_smp *smp, u8 node_type, | 240 | enum smi_action smi_handle_dr_smp_recv(struct ib_smp *smp, bool is_switch, |
242 | int port_num, int phys_port_cnt) | 241 | int port_num, int phys_port_cnt) |
243 | { | 242 | { |
244 | return __smi_handle_dr_smp_recv(node_type, port_num, phys_port_cnt, | 243 | return __smi_handle_dr_smp_recv(is_switch, port_num, phys_port_cnt, |
245 | &smp->hop_ptr, smp->hop_cnt, | 244 | &smp->hop_ptr, smp->hop_cnt, |
246 | smp->initial_path, | 245 | smp->initial_path, |
247 | smp->return_path, | 246 | smp->return_path, |
@@ -254,10 +253,10 @@ enum smi_action smi_handle_dr_smp_recv(struct ib_smp *smp, u8 node_type, | |||
254 | * Adjust information for a received SMP | 253 | * Adjust information for a received SMP |
255 | * Return IB_SMI_DISCARD if the SMP should be dropped | 254 | * Return IB_SMI_DISCARD if the SMP should be dropped |
256 | */ | 255 | */ |
257 | enum smi_action opa_smi_handle_dr_smp_recv(struct opa_smp *smp, u8 node_type, | 256 | enum smi_action opa_smi_handle_dr_smp_recv(struct opa_smp *smp, bool is_switch, |
258 | int port_num, int phys_port_cnt) | 257 | int port_num, int phys_port_cnt) |
259 | { | 258 | { |
260 | return __smi_handle_dr_smp_recv(node_type, port_num, phys_port_cnt, | 259 | return __smi_handle_dr_smp_recv(is_switch, port_num, phys_port_cnt, |
261 | &smp->hop_ptr, smp->hop_cnt, | 260 | &smp->hop_ptr, smp->hop_cnt, |
262 | smp->route.dr.initial_path, | 261 | smp->route.dr.initial_path, |
263 | smp->route.dr.return_path, | 262 | smp->route.dr.return_path, |
diff --git a/drivers/infiniband/core/smi.h b/drivers/infiniband/core/smi.h index aff96bac49b4..33c91c8a16e9 100644 --- a/drivers/infiniband/core/smi.h +++ b/drivers/infiniband/core/smi.h | |||
@@ -51,12 +51,12 @@ enum smi_forward_action { | |||
51 | IB_SMI_FORWARD /* SMP should be forwarded (for switches only) */ | 51 | IB_SMI_FORWARD /* SMP should be forwarded (for switches only) */ |
52 | }; | 52 | }; |
53 | 53 | ||
54 | enum smi_action smi_handle_dr_smp_recv(struct ib_smp *smp, u8 node_type, | 54 | enum smi_action smi_handle_dr_smp_recv(struct ib_smp *smp, bool is_switch, |
55 | int port_num, int phys_port_cnt); | 55 | int port_num, int phys_port_cnt); |
56 | int smi_get_fwd_port(struct ib_smp *smp); | 56 | int smi_get_fwd_port(struct ib_smp *smp); |
57 | extern enum smi_forward_action smi_check_forward_dr_smp(struct ib_smp *smp); | 57 | extern enum smi_forward_action smi_check_forward_dr_smp(struct ib_smp *smp); |
58 | extern enum smi_action smi_handle_dr_smp_send(struct ib_smp *smp, | 58 | extern enum smi_action smi_handle_dr_smp_send(struct ib_smp *smp, |
59 | u8 node_type, int port_num); | 59 | bool is_switch, int port_num); |
60 | 60 | ||
61 | /* | 61 | /* |
62 | * Return IB_SMI_HANDLE if the SMP should be handled by the local SMA/SM | 62 | * Return IB_SMI_HANDLE if the SMP should be handled by the local SMA/SM |
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index ed6b6c85c334..0b84a9cdfe5b 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
@@ -870,7 +870,7 @@ int ib_device_register_sysfs(struct ib_device *device, | |||
870 | goto err_put; | 870 | goto err_put; |
871 | } | 871 | } |
872 | 872 | ||
873 | if (device->node_type == RDMA_NODE_IB_SWITCH) { | 873 | if (rdma_cap_ib_switch(device)) { |
874 | ret = add_port(device, 0, port_callback); | 874 | ret = add_port(device, 0, port_callback); |
875 | if (ret) | 875 | if (ret) |
876 | goto err_put; | 876 | goto err_put; |
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c index 62c24b1452b8..009481073644 100644 --- a/drivers/infiniband/core/ucm.c +++ b/drivers/infiniband/core/ucm.c | |||
@@ -1193,6 +1193,7 @@ static int ib_ucm_close(struct inode *inode, struct file *filp) | |||
1193 | return 0; | 1193 | return 0; |
1194 | } | 1194 | } |
1195 | 1195 | ||
1196 | static DECLARE_BITMAP(overflow_map, IB_UCM_MAX_DEVICES); | ||
1196 | static void ib_ucm_release_dev(struct device *dev) | 1197 | static void ib_ucm_release_dev(struct device *dev) |
1197 | { | 1198 | { |
1198 | struct ib_ucm_device *ucm_dev; | 1199 | struct ib_ucm_device *ucm_dev; |
@@ -1202,7 +1203,7 @@ static void ib_ucm_release_dev(struct device *dev) | |||
1202 | if (ucm_dev->devnum < IB_UCM_MAX_DEVICES) | 1203 | if (ucm_dev->devnum < IB_UCM_MAX_DEVICES) |
1203 | clear_bit(ucm_dev->devnum, dev_map); | 1204 | clear_bit(ucm_dev->devnum, dev_map); |
1204 | else | 1205 | else |
1205 | clear_bit(ucm_dev->devnum - IB_UCM_MAX_DEVICES, dev_map); | 1206 | clear_bit(ucm_dev->devnum - IB_UCM_MAX_DEVICES, overflow_map); |
1206 | kfree(ucm_dev); | 1207 | kfree(ucm_dev); |
1207 | } | 1208 | } |
1208 | 1209 | ||
@@ -1226,7 +1227,6 @@ static ssize_t show_ibdev(struct device *dev, struct device_attribute *attr, | |||
1226 | static DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL); | 1227 | static DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL); |
1227 | 1228 | ||
1228 | static dev_t overflow_maj; | 1229 | static dev_t overflow_maj; |
1229 | static DECLARE_BITMAP(overflow_map, IB_UCM_MAX_DEVICES); | ||
1230 | static int find_overflow_devnum(void) | 1230 | static int find_overflow_devnum(void) |
1231 | { | 1231 | { |
1232 | int ret; | 1232 | int ret; |
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index ad45469f7582..29b21213ea75 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c | |||
@@ -1354,10 +1354,10 @@ static void ucma_lock_files(struct ucma_file *file1, struct ucma_file *file2) | |||
1354 | /* Acquire mutex's based on pointer comparison to prevent deadlock. */ | 1354 | /* Acquire mutex's based on pointer comparison to prevent deadlock. */ |
1355 | if (file1 < file2) { | 1355 | if (file1 < file2) { |
1356 | mutex_lock(&file1->mut); | 1356 | mutex_lock(&file1->mut); |
1357 | mutex_lock(&file2->mut); | 1357 | mutex_lock_nested(&file2->mut, SINGLE_DEPTH_NESTING); |
1358 | } else { | 1358 | } else { |
1359 | mutex_lock(&file2->mut); | 1359 | mutex_lock(&file2->mut); |
1360 | mutex_lock(&file1->mut); | 1360 | mutex_lock_nested(&file1->mut, SINGLE_DEPTH_NESTING); |
1361 | } | 1361 | } |
1362 | } | 1362 | } |
1363 | 1363 | ||
@@ -1616,6 +1616,7 @@ static void __exit ucma_cleanup(void) | |||
1616 | device_remove_file(ucma_misc.this_device, &dev_attr_abi_version); | 1616 | device_remove_file(ucma_misc.this_device, &dev_attr_abi_version); |
1617 | misc_deregister(&ucma_misc); | 1617 | misc_deregister(&ucma_misc); |
1618 | idr_destroy(&ctx_idr); | 1618 | idr_destroy(&ctx_idr); |
1619 | idr_destroy(&multicast_idr); | ||
1619 | } | 1620 | } |
1620 | 1621 | ||
1621 | module_init(ucma_init); | 1622 | module_init(ucma_init); |
diff --git a/drivers/infiniband/hw/ehca/ehca_sqp.c b/drivers/infiniband/hw/ehca/ehca_sqp.c index 12b5bc23832b..376b031c2c7f 100644 --- a/drivers/infiniband/hw/ehca/ehca_sqp.c +++ b/drivers/infiniband/hw/ehca/ehca_sqp.c | |||
@@ -226,8 +226,9 @@ int ehca_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, | |||
226 | const struct ib_mad *in_mad = (const struct ib_mad *)in; | 226 | const struct ib_mad *in_mad = (const struct ib_mad *)in; |
227 | struct ib_mad *out_mad = (struct ib_mad *)out; | 227 | struct ib_mad *out_mad = (struct ib_mad *)out; |
228 | 228 | ||
229 | BUG_ON(in_mad_size != sizeof(*in_mad) || | 229 | if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) || |
230 | *out_mad_size != sizeof(*out_mad)); | 230 | *out_mad_size != sizeof(*out_mad))) |
231 | return IB_MAD_RESULT_FAILURE; | ||
231 | 232 | ||
232 | if (!port_num || port_num > ibdev->phys_port_cnt || !in_wc) | 233 | if (!port_num || port_num > ibdev->phys_port_cnt || !in_wc) |
233 | return IB_MAD_RESULT_FAILURE; | 234 | return IB_MAD_RESULT_FAILURE; |
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index 2d7e503d13cb..871dbe56216a 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c | |||
@@ -31,6 +31,8 @@ | |||
31 | * SOFTWARE. | 31 | * SOFTWARE. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
35 | |||
34 | #include <linux/sched.h> | 36 | #include <linux/sched.h> |
35 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
36 | #include <linux/idr.h> | 38 | #include <linux/idr.h> |
@@ -399,8 +401,8 @@ static int ipath_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
399 | u32 bar0 = 0, bar1 = 0; | 401 | u32 bar0 = 0, bar1 = 0; |
400 | 402 | ||
401 | #ifdef CONFIG_X86_64 | 403 | #ifdef CONFIG_X86_64 |
402 | if (WARN(pat_enabled(), | 404 | if (pat_enabled()) { |
403 | "ipath needs PAT disabled, boot with nopat kernel parameter\n")) { | 405 | pr_warn("ipath needs PAT disabled, boot with nopat kernel parameter\n"); |
404 | ret = -ENODEV; | 406 | ret = -ENODEV; |
405 | goto bail; | 407 | goto bail; |
406 | } | 408 | } |
diff --git a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c index 948188e37f95..ad3a926ab3c5 100644 --- a/drivers/infiniband/hw/ipath/ipath_mad.c +++ b/drivers/infiniband/hw/ipath/ipath_mad.c | |||
@@ -1499,8 +1499,9 @@ int ipath_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, | |||
1499 | const struct ib_mad *in_mad = (const struct ib_mad *)in; | 1499 | const struct ib_mad *in_mad = (const struct ib_mad *)in; |
1500 | struct ib_mad *out_mad = (struct ib_mad *)out; | 1500 | struct ib_mad *out_mad = (struct ib_mad *)out; |
1501 | 1501 | ||
1502 | BUG_ON(in_mad_size != sizeof(*in_mad) || | 1502 | if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) || |
1503 | *out_mad_size != sizeof(*out_mad)); | 1503 | *out_mad_size != sizeof(*out_mad))) |
1504 | return IB_MAD_RESULT_FAILURE; | ||
1504 | 1505 | ||
1505 | switch (in_mad->mad_hdr.mgmt_class) { | 1506 | switch (in_mad->mad_hdr.mgmt_class) { |
1506 | case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE: | 1507 | case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE: |
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index 48253b839a6f..30ba49c4a98c 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c | |||
@@ -2044,9 +2044,9 @@ int ipath_register_ib_device(struct ipath_devdata *dd) | |||
2044 | 2044 | ||
2045 | spin_lock_init(&idev->qp_table.lock); | 2045 | spin_lock_init(&idev->qp_table.lock); |
2046 | spin_lock_init(&idev->lk_table.lock); | 2046 | spin_lock_init(&idev->lk_table.lock); |
2047 | idev->sm_lid = __constant_be16_to_cpu(IB_LID_PERMISSIVE); | 2047 | idev->sm_lid = be16_to_cpu(IB_LID_PERMISSIVE); |
2048 | /* Set the prefix to the default value (see ch. 4.1.1) */ | 2048 | /* Set the prefix to the default value (see ch. 4.1.1) */ |
2049 | idev->gid_prefix = __constant_cpu_to_be64(0xfe80000000000000ULL); | 2049 | idev->gid_prefix = cpu_to_be64(0xfe80000000000000ULL); |
2050 | 2050 | ||
2051 | ret = ipath_init_qp_table(idev, ib_ipath_qp_table_size); | 2051 | ret = ipath_init_qp_table(idev, ib_ipath_qp_table_size); |
2052 | if (ret) | 2052 | if (ret) |
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 85a50df2f203..68b3dfa922bf 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
@@ -860,21 +860,31 @@ int mlx4_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, | |||
860 | struct mlx4_ib_dev *dev = to_mdev(ibdev); | 860 | struct mlx4_ib_dev *dev = to_mdev(ibdev); |
861 | const struct ib_mad *in_mad = (const struct ib_mad *)in; | 861 | const struct ib_mad *in_mad = (const struct ib_mad *)in; |
862 | struct ib_mad *out_mad = (struct ib_mad *)out; | 862 | struct ib_mad *out_mad = (struct ib_mad *)out; |
863 | enum rdma_link_layer link = rdma_port_get_link_layer(ibdev, port_num); | ||
863 | 864 | ||
864 | BUG_ON(in_mad_size != sizeof(*in_mad) || | 865 | if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) || |
865 | *out_mad_size != sizeof(*out_mad)); | 866 | *out_mad_size != sizeof(*out_mad))) |
867 | return IB_MAD_RESULT_FAILURE; | ||
866 | 868 | ||
867 | switch (rdma_port_get_link_layer(ibdev, port_num)) { | 869 | /* iboe_process_mad() which uses the HCA flow-counters to implement IB PMA |
868 | case IB_LINK_LAYER_INFINIBAND: | 870 | * queries, should be called only by VFs and for that specific purpose |
869 | if (!mlx4_is_slave(dev->dev)) | 871 | */ |
870 | return ib_process_mad(ibdev, mad_flags, port_num, in_wc, | 872 | if (link == IB_LINK_LAYER_INFINIBAND) { |
871 | in_grh, in_mad, out_mad); | 873 | if (mlx4_is_slave(dev->dev) && |
872 | case IB_LINK_LAYER_ETHERNET: | 874 | in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT && |
873 | return iboe_process_mad(ibdev, mad_flags, port_num, in_wc, | 875 | in_mad->mad_hdr.attr_id == IB_PMA_PORT_COUNTERS) |
874 | in_grh, in_mad, out_mad); | 876 | return iboe_process_mad(ibdev, mad_flags, port_num, in_wc, |
875 | default: | 877 | in_grh, in_mad, out_mad); |
876 | return -EINVAL; | 878 | |
879 | return ib_process_mad(ibdev, mad_flags, port_num, in_wc, | ||
880 | in_grh, in_mad, out_mad); | ||
877 | } | 881 | } |
882 | |||
883 | if (link == IB_LINK_LAYER_ETHERNET) | ||
884 | return iboe_process_mad(ibdev, mad_flags, port_num, in_wc, | ||
885 | in_grh, in_mad, out_mad); | ||
886 | |||
887 | return -EINVAL; | ||
878 | } | 888 | } |
879 | 889 | ||
880 | static void send_handler(struct ib_mad_agent *agent, | 890 | static void send_handler(struct ib_mad_agent *agent, |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 067a691ecbed..8be6db816460 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -253,14 +253,15 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, | |||
253 | props->hca_core_clock = dev->dev->caps.hca_core_clock * 1000UL; | 253 | props->hca_core_clock = dev->dev->caps.hca_core_clock * 1000UL; |
254 | props->timestamp_mask = 0xFFFFFFFFFFFFULL; | 254 | props->timestamp_mask = 0xFFFFFFFFFFFFULL; |
255 | 255 | ||
256 | err = mlx4_get_internal_clock_params(dev->dev, &clock_params); | 256 | if (!mlx4_is_slave(dev->dev)) |
257 | if (err) | 257 | err = mlx4_get_internal_clock_params(dev->dev, &clock_params); |
258 | goto out; | ||
259 | 258 | ||
260 | if (uhw->outlen >= resp.response_length + sizeof(resp.hca_core_clock_offset)) { | 259 | if (uhw->outlen >= resp.response_length + sizeof(resp.hca_core_clock_offset)) { |
261 | resp.hca_core_clock_offset = clock_params.offset % PAGE_SIZE; | ||
262 | resp.response_length += sizeof(resp.hca_core_clock_offset); | 260 | resp.response_length += sizeof(resp.hca_core_clock_offset); |
263 | resp.comp_mask |= QUERY_DEVICE_RESP_MASK_TIMESTAMP; | 261 | if (!err && !mlx4_is_slave(dev->dev)) { |
262 | resp.comp_mask |= QUERY_DEVICE_RESP_MASK_TIMESTAMP; | ||
263 | resp.hca_core_clock_offset = clock_params.offset % PAGE_SIZE; | ||
264 | } | ||
264 | } | 265 | } |
265 | 266 | ||
266 | if (uhw->outlen) { | 267 | if (uhw->outlen) { |
@@ -2669,31 +2670,33 @@ static void do_slave_init(struct mlx4_ib_dev *ibdev, int slave, int do_init) | |||
2669 | dm = kcalloc(ports, sizeof(*dm), GFP_ATOMIC); | 2670 | dm = kcalloc(ports, sizeof(*dm), GFP_ATOMIC); |
2670 | if (!dm) { | 2671 | if (!dm) { |
2671 | pr_err("failed to allocate memory for tunneling qp update\n"); | 2672 | pr_err("failed to allocate memory for tunneling qp update\n"); |
2672 | goto out; | 2673 | return; |
2673 | } | 2674 | } |
2674 | 2675 | ||
2675 | for (i = 0; i < ports; i++) { | 2676 | for (i = 0; i < ports; i++) { |
2676 | dm[i] = kmalloc(sizeof (struct mlx4_ib_demux_work), GFP_ATOMIC); | 2677 | dm[i] = kmalloc(sizeof (struct mlx4_ib_demux_work), GFP_ATOMIC); |
2677 | if (!dm[i]) { | 2678 | if (!dm[i]) { |
2678 | pr_err("failed to allocate memory for tunneling qp update work struct\n"); | 2679 | pr_err("failed to allocate memory for tunneling qp update work struct\n"); |
2679 | for (i = 0; i < dev->caps.num_ports; i++) { | 2680 | while (--i >= 0) |
2680 | if (dm[i]) | 2681 | kfree(dm[i]); |
2681 | kfree(dm[i]); | ||
2682 | } | ||
2683 | goto out; | 2682 | goto out; |
2684 | } | 2683 | } |
2685 | } | ||
2686 | /* initialize or tear down tunnel QPs for the slave */ | ||
2687 | for (i = 0; i < ports; i++) { | ||
2688 | INIT_WORK(&dm[i]->work, mlx4_ib_tunnels_update_work); | 2684 | INIT_WORK(&dm[i]->work, mlx4_ib_tunnels_update_work); |
2689 | dm[i]->port = first_port + i + 1; | 2685 | dm[i]->port = first_port + i + 1; |
2690 | dm[i]->slave = slave; | 2686 | dm[i]->slave = slave; |
2691 | dm[i]->do_init = do_init; | 2687 | dm[i]->do_init = do_init; |
2692 | dm[i]->dev = ibdev; | 2688 | dm[i]->dev = ibdev; |
2693 | spin_lock_irqsave(&ibdev->sriov.going_down_lock, flags); | 2689 | } |
2694 | if (!ibdev->sriov.is_going_down) | 2690 | /* initialize or tear down tunnel QPs for the slave */ |
2691 | spin_lock_irqsave(&ibdev->sriov.going_down_lock, flags); | ||
2692 | if (!ibdev->sriov.is_going_down) { | ||
2693 | for (i = 0; i < ports; i++) | ||
2695 | queue_work(ibdev->sriov.demux[i].ud_wq, &dm[i]->work); | 2694 | queue_work(ibdev->sriov.demux[i].ud_wq, &dm[i]->work); |
2696 | spin_unlock_irqrestore(&ibdev->sriov.going_down_lock, flags); | 2695 | spin_unlock_irqrestore(&ibdev->sriov.going_down_lock, flags); |
2696 | } else { | ||
2697 | spin_unlock_irqrestore(&ibdev->sriov.going_down_lock, flags); | ||
2698 | for (i = 0; i < ports; i++) | ||
2699 | kfree(dm[i]); | ||
2697 | } | 2700 | } |
2698 | out: | 2701 | out: |
2699 | kfree(dm); | 2702 | kfree(dm); |
diff --git a/drivers/infiniband/hw/mlx5/mad.c b/drivers/infiniband/hw/mlx5/mad.c index 01fc97db45d6..b84d13a487cc 100644 --- a/drivers/infiniband/hw/mlx5/mad.c +++ b/drivers/infiniband/hw/mlx5/mad.c | |||
@@ -68,8 +68,9 @@ int mlx5_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, | |||
68 | const struct ib_mad *in_mad = (const struct ib_mad *)in; | 68 | const struct ib_mad *in_mad = (const struct ib_mad *)in; |
69 | struct ib_mad *out_mad = (struct ib_mad *)out; | 69 | struct ib_mad *out_mad = (struct ib_mad *)out; |
70 | 70 | ||
71 | BUG_ON(in_mad_size != sizeof(*in_mad) || | 71 | if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) || |
72 | *out_mad_size != sizeof(*out_mad)); | 72 | *out_mad_size != sizeof(*out_mad))) |
73 | return IB_MAD_RESULT_FAILURE; | ||
73 | 74 | ||
74 | slid = in_wc ? in_wc->slid : be16_to_cpu(IB_LID_PERMISSIVE); | 75 | slid = in_wc ? in_wc->slid : be16_to_cpu(IB_LID_PERMISSIVE); |
75 | 76 | ||
diff --git a/drivers/infiniband/hw/mthca/mthca_mad.c b/drivers/infiniband/hw/mthca/mthca_mad.c index 6b2418b74c99..7c3f2fb44ba5 100644 --- a/drivers/infiniband/hw/mthca/mthca_mad.c +++ b/drivers/infiniband/hw/mthca/mthca_mad.c | |||
@@ -209,8 +209,9 @@ int mthca_process_mad(struct ib_device *ibdev, | |||
209 | const struct ib_mad *in_mad = (const struct ib_mad *)in; | 209 | const struct ib_mad *in_mad = (const struct ib_mad *)in; |
210 | struct ib_mad *out_mad = (struct ib_mad *)out; | 210 | struct ib_mad *out_mad = (struct ib_mad *)out; |
211 | 211 | ||
212 | BUG_ON(in_mad_size != sizeof(*in_mad) || | 212 | if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) || |
213 | *out_mad_size != sizeof(*out_mad)); | 213 | *out_mad_size != sizeof(*out_mad))) |
214 | return IB_MAD_RESULT_FAILURE; | ||
214 | 215 | ||
215 | /* Forward locally generated traps to the SM */ | 216 | /* Forward locally generated traps to the SM */ |
216 | if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP && | 217 | if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP && |
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index 9047af429906..8a3ad170d790 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c | |||
@@ -1520,8 +1520,9 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi | |||
1520 | int rc = arpindex; | 1520 | int rc = arpindex; |
1521 | struct net_device *netdev; | 1521 | struct net_device *netdev; |
1522 | struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter; | 1522 | struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter; |
1523 | __be32 dst_ipaddr = htonl(dst_ip); | ||
1523 | 1524 | ||
1524 | rt = ip_route_output(&init_net, htonl(dst_ip), 0, 0, 0); | 1525 | rt = ip_route_output(&init_net, dst_ipaddr, nesvnic->local_ipaddr, 0, 0); |
1525 | if (IS_ERR(rt)) { | 1526 | if (IS_ERR(rt)) { |
1526 | printk(KERN_ERR "%s: ip_route_output_key failed for 0x%08X\n", | 1527 | printk(KERN_ERR "%s: ip_route_output_key failed for 0x%08X\n", |
1527 | __func__, dst_ip); | 1528 | __func__, dst_ip); |
@@ -1533,7 +1534,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi | |||
1533 | else | 1534 | else |
1534 | netdev = nesvnic->netdev; | 1535 | netdev = nesvnic->netdev; |
1535 | 1536 | ||
1536 | neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, netdev); | 1537 | neigh = dst_neigh_lookup(&rt->dst, &dst_ipaddr); |
1537 | 1538 | ||
1538 | rcu_read_lock(); | 1539 | rcu_read_lock(); |
1539 | if (neigh) { | 1540 | if (neigh) { |
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c index 02120d340d50..4713dd7ed764 100644 --- a/drivers/infiniband/hw/nes/nes_hw.c +++ b/drivers/infiniband/hw/nes/nes_hw.c | |||
@@ -3861,7 +3861,7 @@ void nes_manage_arp_cache(struct net_device *netdev, unsigned char *mac_addr, | |||
3861 | (((u32)mac_addr[2]) << 24) | (((u32)mac_addr[3]) << 16) | | 3861 | (((u32)mac_addr[2]) << 24) | (((u32)mac_addr[3]) << 16) | |
3862 | (((u32)mac_addr[4]) << 8) | (u32)mac_addr[5]); | 3862 | (((u32)mac_addr[4]) << 8) | (u32)mac_addr[5]); |
3863 | cqp_wqe->wqe_words[NES_CQP_ARP_WQE_MAC_HIGH_IDX] = cpu_to_le32( | 3863 | cqp_wqe->wqe_words[NES_CQP_ARP_WQE_MAC_HIGH_IDX] = cpu_to_le32( |
3864 | (((u32)mac_addr[0]) << 16) | (u32)mac_addr[1]); | 3864 | (((u32)mac_addr[0]) << 8) | (u32)mac_addr[1]); |
3865 | } else { | 3865 | } else { |
3866 | cqp_wqe->wqe_words[NES_CQP_ARP_WQE_MAC_ADDR_LOW_IDX] = 0; | 3866 | cqp_wqe->wqe_words[NES_CQP_ARP_WQE_MAC_ADDR_LOW_IDX] = 0; |
3867 | cqp_wqe->wqe_words[NES_CQP_ARP_WQE_MAC_HIGH_IDX] = 0; | 3867 | cqp_wqe->wqe_words[NES_CQP_ARP_WQE_MAC_HIGH_IDX] = 0; |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c index 4bafa15708d0..29b27675dd70 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c | |||
@@ -215,8 +215,9 @@ int ocrdma_process_mad(struct ib_device *ibdev, | |||
215 | const struct ib_mad *in_mad = (const struct ib_mad *)in; | 215 | const struct ib_mad *in_mad = (const struct ib_mad *)in; |
216 | struct ib_mad *out_mad = (struct ib_mad *)out; | 216 | struct ib_mad *out_mad = (struct ib_mad *)out; |
217 | 217 | ||
218 | BUG_ON(in_mad_size != sizeof(*in_mad) || | 218 | if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) || |
219 | *out_mad_size != sizeof(*out_mad)); | 219 | *out_mad_size != sizeof(*out_mad))) |
220 | return IB_MAD_RESULT_FAILURE; | ||
220 | 221 | ||
221 | switch (in_mad->mad_hdr.mgmt_class) { | 222 | switch (in_mad->mad_hdr.mgmt_class) { |
222 | case IB_MGMT_CLASS_PERF_MGMT: | 223 | case IB_MGMT_CLASS_PERF_MGMT: |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c index 8a1398b253a2..d98a707a5eb9 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c | |||
@@ -696,6 +696,7 @@ static void __exit ocrdma_exit_module(void) | |||
696 | ocrdma_unregister_inet6addr_notifier(); | 696 | ocrdma_unregister_inet6addr_notifier(); |
697 | ocrdma_unregister_inetaddr_notifier(); | 697 | ocrdma_unregister_inetaddr_notifier(); |
698 | ocrdma_rem_debugfs(); | 698 | ocrdma_rem_debugfs(); |
699 | idr_destroy(&ocrdma_dev_id); | ||
699 | } | 700 | } |
700 | 701 | ||
701 | module_init(ocrdma_init_module); | 702 | module_init(ocrdma_init_module); |
diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c index 05e3242d8442..9625e7c438e5 100644 --- a/drivers/infiniband/hw/qib/qib_mad.c +++ b/drivers/infiniband/hw/qib/qib_mad.c | |||
@@ -2412,8 +2412,9 @@ int qib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port, | |||
2412 | const struct ib_mad *in_mad = (const struct ib_mad *)in; | 2412 | const struct ib_mad *in_mad = (const struct ib_mad *)in; |
2413 | struct ib_mad *out_mad = (struct ib_mad *)out; | 2413 | struct ib_mad *out_mad = (struct ib_mad *)out; |
2414 | 2414 | ||
2415 | BUG_ON(in_mad_size != sizeof(*in_mad) || | 2415 | if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) || |
2416 | *out_mad_size != sizeof(*out_mad)); | 2416 | *out_mad_size != sizeof(*out_mad))) |
2417 | return IB_MAD_RESULT_FAILURE; | ||
2417 | 2418 | ||
2418 | switch (in_mad->mad_hdr.mgmt_class) { | 2419 | switch (in_mad->mad_hdr.mgmt_class) { |
2419 | case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE: | 2420 | case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE: |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index bd94b0a6e9e5..79859c4d43c9 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
@@ -239,7 +239,7 @@ struct ipoib_cm_tx { | |||
239 | struct net_device *dev; | 239 | struct net_device *dev; |
240 | struct ipoib_neigh *neigh; | 240 | struct ipoib_neigh *neigh; |
241 | struct ipoib_path *path; | 241 | struct ipoib_path *path; |
242 | struct ipoib_cm_tx_buf *tx_ring; | 242 | struct ipoib_tx_buf *tx_ring; |
243 | unsigned tx_head; | 243 | unsigned tx_head; |
244 | unsigned tx_tail; | 244 | unsigned tx_tail; |
245 | unsigned long flags; | 245 | unsigned long flags; |
@@ -504,6 +504,33 @@ int ipoib_mcast_stop_thread(struct net_device *dev); | |||
504 | void ipoib_mcast_dev_down(struct net_device *dev); | 504 | void ipoib_mcast_dev_down(struct net_device *dev); |
505 | void ipoib_mcast_dev_flush(struct net_device *dev); | 505 | void ipoib_mcast_dev_flush(struct net_device *dev); |
506 | 506 | ||
507 | int ipoib_dma_map_tx(struct ib_device *ca, struct ipoib_tx_buf *tx_req); | ||
508 | void ipoib_dma_unmap_tx(struct ipoib_dev_priv *priv, | ||
509 | struct ipoib_tx_buf *tx_req); | ||
510 | |||
511 | static inline void ipoib_build_sge(struct ipoib_dev_priv *priv, | ||
512 | struct ipoib_tx_buf *tx_req) | ||
513 | { | ||
514 | int i, off; | ||
515 | struct sk_buff *skb = tx_req->skb; | ||
516 | skb_frag_t *frags = skb_shinfo(skb)->frags; | ||
517 | int nr_frags = skb_shinfo(skb)->nr_frags; | ||
518 | u64 *mapping = tx_req->mapping; | ||
519 | |||
520 | if (skb_headlen(skb)) { | ||
521 | priv->tx_sge[0].addr = mapping[0]; | ||
522 | priv->tx_sge[0].length = skb_headlen(skb); | ||
523 | off = 1; | ||
524 | } else | ||
525 | off = 0; | ||
526 | |||
527 | for (i = 0; i < nr_frags; ++i) { | ||
528 | priv->tx_sge[i + off].addr = mapping[i + off]; | ||
529 | priv->tx_sge[i + off].length = skb_frag_size(&frags[i]); | ||
530 | } | ||
531 | priv->tx_wr.num_sge = nr_frags + off; | ||
532 | } | ||
533 | |||
507 | #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG | 534 | #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG |
508 | struct ipoib_mcast_iter *ipoib_mcast_iter_init(struct net_device *dev); | 535 | struct ipoib_mcast_iter *ipoib_mcast_iter_init(struct net_device *dev); |
509 | int ipoib_mcast_iter_next(struct ipoib_mcast_iter *iter); | 536 | int ipoib_mcast_iter_next(struct ipoib_mcast_iter *iter); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index cf32a778e7d0..ee39be6ccfb0 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
@@ -694,14 +694,12 @@ repost: | |||
694 | static inline int post_send(struct ipoib_dev_priv *priv, | 694 | static inline int post_send(struct ipoib_dev_priv *priv, |
695 | struct ipoib_cm_tx *tx, | 695 | struct ipoib_cm_tx *tx, |
696 | unsigned int wr_id, | 696 | unsigned int wr_id, |
697 | u64 addr, int len) | 697 | struct ipoib_tx_buf *tx_req) |
698 | { | 698 | { |
699 | struct ib_send_wr *bad_wr; | 699 | struct ib_send_wr *bad_wr; |
700 | 700 | ||
701 | priv->tx_sge[0].addr = addr; | 701 | ipoib_build_sge(priv, tx_req); |
702 | priv->tx_sge[0].length = len; | ||
703 | 702 | ||
704 | priv->tx_wr.num_sge = 1; | ||
705 | priv->tx_wr.wr_id = wr_id | IPOIB_OP_CM; | 703 | priv->tx_wr.wr_id = wr_id | IPOIB_OP_CM; |
706 | 704 | ||
707 | return ib_post_send(tx->qp, &priv->tx_wr, &bad_wr); | 705 | return ib_post_send(tx->qp, &priv->tx_wr, &bad_wr); |
@@ -710,8 +708,7 @@ static inline int post_send(struct ipoib_dev_priv *priv, | |||
710 | void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_tx *tx) | 708 | void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_tx *tx) |
711 | { | 709 | { |
712 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 710 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
713 | struct ipoib_cm_tx_buf *tx_req; | 711 | struct ipoib_tx_buf *tx_req; |
714 | u64 addr; | ||
715 | int rc; | 712 | int rc; |
716 | 713 | ||
717 | if (unlikely(skb->len > tx->mtu)) { | 714 | if (unlikely(skb->len > tx->mtu)) { |
@@ -735,24 +732,21 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_ | |||
735 | */ | 732 | */ |
736 | tx_req = &tx->tx_ring[tx->tx_head & (ipoib_sendq_size - 1)]; | 733 | tx_req = &tx->tx_ring[tx->tx_head & (ipoib_sendq_size - 1)]; |
737 | tx_req->skb = skb; | 734 | tx_req->skb = skb; |
738 | addr = ib_dma_map_single(priv->ca, skb->data, skb->len, DMA_TO_DEVICE); | 735 | |
739 | if (unlikely(ib_dma_mapping_error(priv->ca, addr))) { | 736 | if (unlikely(ipoib_dma_map_tx(priv->ca, tx_req))) { |
740 | ++dev->stats.tx_errors; | 737 | ++dev->stats.tx_errors; |
741 | dev_kfree_skb_any(skb); | 738 | dev_kfree_skb_any(skb); |
742 | return; | 739 | return; |
743 | } | 740 | } |
744 | 741 | ||
745 | tx_req->mapping = addr; | ||
746 | |||
747 | skb_orphan(skb); | 742 | skb_orphan(skb); |
748 | skb_dst_drop(skb); | 743 | skb_dst_drop(skb); |
749 | 744 | ||
750 | rc = post_send(priv, tx, tx->tx_head & (ipoib_sendq_size - 1), | 745 | rc = post_send(priv, tx, tx->tx_head & (ipoib_sendq_size - 1), tx_req); |
751 | addr, skb->len); | ||
752 | if (unlikely(rc)) { | 746 | if (unlikely(rc)) { |
753 | ipoib_warn(priv, "post_send failed, error %d\n", rc); | 747 | ipoib_warn(priv, "post_send failed, error %d\n", rc); |
754 | ++dev->stats.tx_errors; | 748 | ++dev->stats.tx_errors; |
755 | ib_dma_unmap_single(priv->ca, addr, skb->len, DMA_TO_DEVICE); | 749 | ipoib_dma_unmap_tx(priv, tx_req); |
756 | dev_kfree_skb_any(skb); | 750 | dev_kfree_skb_any(skb); |
757 | } else { | 751 | } else { |
758 | dev->trans_start = jiffies; | 752 | dev->trans_start = jiffies; |
@@ -777,7 +771,7 @@ void ipoib_cm_handle_tx_wc(struct net_device *dev, struct ib_wc *wc) | |||
777 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 771 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
778 | struct ipoib_cm_tx *tx = wc->qp->qp_context; | 772 | struct ipoib_cm_tx *tx = wc->qp->qp_context; |
779 | unsigned int wr_id = wc->wr_id & ~IPOIB_OP_CM; | 773 | unsigned int wr_id = wc->wr_id & ~IPOIB_OP_CM; |
780 | struct ipoib_cm_tx_buf *tx_req; | 774 | struct ipoib_tx_buf *tx_req; |
781 | unsigned long flags; | 775 | unsigned long flags; |
782 | 776 | ||
783 | ipoib_dbg_data(priv, "cm send completion: id %d, status: %d\n", | 777 | ipoib_dbg_data(priv, "cm send completion: id %d, status: %d\n", |
@@ -791,7 +785,7 @@ void ipoib_cm_handle_tx_wc(struct net_device *dev, struct ib_wc *wc) | |||
791 | 785 | ||
792 | tx_req = &tx->tx_ring[wr_id]; | 786 | tx_req = &tx->tx_ring[wr_id]; |
793 | 787 | ||
794 | ib_dma_unmap_single(priv->ca, tx_req->mapping, tx_req->skb->len, DMA_TO_DEVICE); | 788 | ipoib_dma_unmap_tx(priv, tx_req); |
795 | 789 | ||
796 | /* FIXME: is this right? Shouldn't we only increment on success? */ | 790 | /* FIXME: is this right? Shouldn't we only increment on success? */ |
797 | ++dev->stats.tx_packets; | 791 | ++dev->stats.tx_packets; |
@@ -1036,6 +1030,9 @@ static struct ib_qp *ipoib_cm_create_tx_qp(struct net_device *dev, struct ipoib_ | |||
1036 | 1030 | ||
1037 | struct ib_qp *tx_qp; | 1031 | struct ib_qp *tx_qp; |
1038 | 1032 | ||
1033 | if (dev->features & NETIF_F_SG) | ||
1034 | attr.cap.max_send_sge = MAX_SKB_FRAGS + 1; | ||
1035 | |||
1039 | tx_qp = ib_create_qp(priv->pd, &attr); | 1036 | tx_qp = ib_create_qp(priv->pd, &attr); |
1040 | if (PTR_ERR(tx_qp) == -EINVAL) { | 1037 | if (PTR_ERR(tx_qp) == -EINVAL) { |
1041 | ipoib_warn(priv, "can't use GFP_NOIO for QPs on device %s, using GFP_KERNEL\n", | 1038 | ipoib_warn(priv, "can't use GFP_NOIO for QPs on device %s, using GFP_KERNEL\n", |
@@ -1170,7 +1167,7 @@ err_tx: | |||
1170 | static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p) | 1167 | static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p) |
1171 | { | 1168 | { |
1172 | struct ipoib_dev_priv *priv = netdev_priv(p->dev); | 1169 | struct ipoib_dev_priv *priv = netdev_priv(p->dev); |
1173 | struct ipoib_cm_tx_buf *tx_req; | 1170 | struct ipoib_tx_buf *tx_req; |
1174 | unsigned long begin; | 1171 | unsigned long begin; |
1175 | 1172 | ||
1176 | ipoib_dbg(priv, "Destroy active connection 0x%x head 0x%x tail 0x%x\n", | 1173 | ipoib_dbg(priv, "Destroy active connection 0x%x head 0x%x tail 0x%x\n", |
@@ -1197,8 +1194,7 @@ timeout: | |||
1197 | 1194 | ||
1198 | while ((int) p->tx_tail - (int) p->tx_head < 0) { | 1195 | while ((int) p->tx_tail - (int) p->tx_head < 0) { |
1199 | tx_req = &p->tx_ring[p->tx_tail & (ipoib_sendq_size - 1)]; | 1196 | tx_req = &p->tx_ring[p->tx_tail & (ipoib_sendq_size - 1)]; |
1200 | ib_dma_unmap_single(priv->ca, tx_req->mapping, tx_req->skb->len, | 1197 | ipoib_dma_unmap_tx(priv, tx_req); |
1201 | DMA_TO_DEVICE); | ||
1202 | dev_kfree_skb_any(tx_req->skb); | 1198 | dev_kfree_skb_any(tx_req->skb); |
1203 | ++p->tx_tail; | 1199 | ++p->tx_tail; |
1204 | netif_tx_lock_bh(p->dev); | 1200 | netif_tx_lock_bh(p->dev); |
@@ -1455,7 +1451,6 @@ static void ipoib_cm_stale_task(struct work_struct *work) | |||
1455 | spin_unlock_irq(&priv->lock); | 1451 | spin_unlock_irq(&priv->lock); |
1456 | } | 1452 | } |
1457 | 1453 | ||
1458 | |||
1459 | static ssize_t show_mode(struct device *d, struct device_attribute *attr, | 1454 | static ssize_t show_mode(struct device *d, struct device_attribute *attr, |
1460 | char *buf) | 1455 | char *buf) |
1461 | { | 1456 | { |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 63b92cbb29ad..d266667ca9b8 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -263,8 +263,7 @@ repost: | |||
263 | "for buf %d\n", wr_id); | 263 | "for buf %d\n", wr_id); |
264 | } | 264 | } |
265 | 265 | ||
266 | static int ipoib_dma_map_tx(struct ib_device *ca, | 266 | int ipoib_dma_map_tx(struct ib_device *ca, struct ipoib_tx_buf *tx_req) |
267 | struct ipoib_tx_buf *tx_req) | ||
268 | { | 267 | { |
269 | struct sk_buff *skb = tx_req->skb; | 268 | struct sk_buff *skb = tx_req->skb; |
270 | u64 *mapping = tx_req->mapping; | 269 | u64 *mapping = tx_req->mapping; |
@@ -305,8 +304,8 @@ partial_error: | |||
305 | return -EIO; | 304 | return -EIO; |
306 | } | 305 | } |
307 | 306 | ||
308 | static void ipoib_dma_unmap_tx(struct ib_device *ca, | 307 | void ipoib_dma_unmap_tx(struct ipoib_dev_priv *priv, |
309 | struct ipoib_tx_buf *tx_req) | 308 | struct ipoib_tx_buf *tx_req) |
310 | { | 309 | { |
311 | struct sk_buff *skb = tx_req->skb; | 310 | struct sk_buff *skb = tx_req->skb; |
312 | u64 *mapping = tx_req->mapping; | 311 | u64 *mapping = tx_req->mapping; |
@@ -314,7 +313,8 @@ static void ipoib_dma_unmap_tx(struct ib_device *ca, | |||
314 | int off; | 313 | int off; |
315 | 314 | ||
316 | if (skb_headlen(skb)) { | 315 | if (skb_headlen(skb)) { |
317 | ib_dma_unmap_single(ca, mapping[0], skb_headlen(skb), DMA_TO_DEVICE); | 316 | ib_dma_unmap_single(priv->ca, mapping[0], skb_headlen(skb), |
317 | DMA_TO_DEVICE); | ||
318 | off = 1; | 318 | off = 1; |
319 | } else | 319 | } else |
320 | off = 0; | 320 | off = 0; |
@@ -322,8 +322,8 @@ static void ipoib_dma_unmap_tx(struct ib_device *ca, | |||
322 | for (i = 0; i < skb_shinfo(skb)->nr_frags; ++i) { | 322 | for (i = 0; i < skb_shinfo(skb)->nr_frags; ++i) { |
323 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 323 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
324 | 324 | ||
325 | ib_dma_unmap_page(ca, mapping[i + off], skb_frag_size(frag), | 325 | ib_dma_unmap_page(priv->ca, mapping[i + off], |
326 | DMA_TO_DEVICE); | 326 | skb_frag_size(frag), DMA_TO_DEVICE); |
327 | } | 327 | } |
328 | } | 328 | } |
329 | 329 | ||
@@ -389,7 +389,7 @@ static void ipoib_ib_handle_tx_wc(struct net_device *dev, struct ib_wc *wc) | |||
389 | 389 | ||
390 | tx_req = &priv->tx_ring[wr_id]; | 390 | tx_req = &priv->tx_ring[wr_id]; |
391 | 391 | ||
392 | ipoib_dma_unmap_tx(priv->ca, tx_req); | 392 | ipoib_dma_unmap_tx(priv, tx_req); |
393 | 393 | ||
394 | ++dev->stats.tx_packets; | 394 | ++dev->stats.tx_packets; |
395 | dev->stats.tx_bytes += tx_req->skb->len; | 395 | dev->stats.tx_bytes += tx_req->skb->len; |
@@ -514,24 +514,10 @@ static inline int post_send(struct ipoib_dev_priv *priv, | |||
514 | void *head, int hlen) | 514 | void *head, int hlen) |
515 | { | 515 | { |
516 | struct ib_send_wr *bad_wr; | 516 | struct ib_send_wr *bad_wr; |
517 | int i, off; | ||
518 | struct sk_buff *skb = tx_req->skb; | 517 | struct sk_buff *skb = tx_req->skb; |
519 | skb_frag_t *frags = skb_shinfo(skb)->frags; | ||
520 | int nr_frags = skb_shinfo(skb)->nr_frags; | ||
521 | u64 *mapping = tx_req->mapping; | ||
522 | 518 | ||
523 | if (skb_headlen(skb)) { | 519 | ipoib_build_sge(priv, tx_req); |
524 | priv->tx_sge[0].addr = mapping[0]; | ||
525 | priv->tx_sge[0].length = skb_headlen(skb); | ||
526 | off = 1; | ||
527 | } else | ||
528 | off = 0; | ||
529 | 520 | ||
530 | for (i = 0; i < nr_frags; ++i) { | ||
531 | priv->tx_sge[i + off].addr = mapping[i + off]; | ||
532 | priv->tx_sge[i + off].length = skb_frag_size(&frags[i]); | ||
533 | } | ||
534 | priv->tx_wr.num_sge = nr_frags + off; | ||
535 | priv->tx_wr.wr_id = wr_id; | 521 | priv->tx_wr.wr_id = wr_id; |
536 | priv->tx_wr.wr.ud.remote_qpn = qpn; | 522 | priv->tx_wr.wr.ud.remote_qpn = qpn; |
537 | priv->tx_wr.wr.ud.ah = address; | 523 | priv->tx_wr.wr.ud.ah = address; |
@@ -617,7 +603,7 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb, | |||
617 | ipoib_warn(priv, "post_send failed, error %d\n", rc); | 603 | ipoib_warn(priv, "post_send failed, error %d\n", rc); |
618 | ++dev->stats.tx_errors; | 604 | ++dev->stats.tx_errors; |
619 | --priv->tx_outstanding; | 605 | --priv->tx_outstanding; |
620 | ipoib_dma_unmap_tx(priv->ca, tx_req); | 606 | ipoib_dma_unmap_tx(priv, tx_req); |
621 | dev_kfree_skb_any(skb); | 607 | dev_kfree_skb_any(skb); |
622 | if (netif_queue_stopped(dev)) | 608 | if (netif_queue_stopped(dev)) |
623 | netif_wake_queue(dev); | 609 | netif_wake_queue(dev); |
@@ -868,7 +854,7 @@ int ipoib_ib_dev_stop(struct net_device *dev) | |||
868 | while ((int) priv->tx_tail - (int) priv->tx_head < 0) { | 854 | while ((int) priv->tx_tail - (int) priv->tx_head < 0) { |
869 | tx_req = &priv->tx_ring[priv->tx_tail & | 855 | tx_req = &priv->tx_ring[priv->tx_tail & |
870 | (ipoib_sendq_size - 1)]; | 856 | (ipoib_sendq_size - 1)]; |
871 | ipoib_dma_unmap_tx(priv->ca, tx_req); | 857 | ipoib_dma_unmap_tx(priv, tx_req); |
872 | dev_kfree_skb_any(tx_req->skb); | 858 | dev_kfree_skb_any(tx_req->skb); |
873 | ++priv->tx_tail; | 859 | ++priv->tx_tail; |
874 | --priv->tx_outstanding; | 860 | --priv->tx_outstanding; |
@@ -985,20 +971,21 @@ static inline int update_child_pkey(struct ipoib_dev_priv *priv) | |||
985 | } | 971 | } |
986 | 972 | ||
987 | static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, | 973 | static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, |
988 | enum ipoib_flush_level level) | 974 | enum ipoib_flush_level level, |
975 | int nesting) | ||
989 | { | 976 | { |
990 | struct ipoib_dev_priv *cpriv; | 977 | struct ipoib_dev_priv *cpriv; |
991 | struct net_device *dev = priv->dev; | 978 | struct net_device *dev = priv->dev; |
992 | int result; | 979 | int result; |
993 | 980 | ||
994 | down_read(&priv->vlan_rwsem); | 981 | down_read_nested(&priv->vlan_rwsem, nesting); |
995 | 982 | ||
996 | /* | 983 | /* |
997 | * Flush any child interfaces too -- they might be up even if | 984 | * Flush any child interfaces too -- they might be up even if |
998 | * the parent is down. | 985 | * the parent is down. |
999 | */ | 986 | */ |
1000 | list_for_each_entry(cpriv, &priv->child_intfs, list) | 987 | list_for_each_entry(cpriv, &priv->child_intfs, list) |
1001 | __ipoib_ib_dev_flush(cpriv, level); | 988 | __ipoib_ib_dev_flush(cpriv, level, nesting + 1); |
1002 | 989 | ||
1003 | up_read(&priv->vlan_rwsem); | 990 | up_read(&priv->vlan_rwsem); |
1004 | 991 | ||
@@ -1076,7 +1063,7 @@ void ipoib_ib_dev_flush_light(struct work_struct *work) | |||
1076 | struct ipoib_dev_priv *priv = | 1063 | struct ipoib_dev_priv *priv = |
1077 | container_of(work, struct ipoib_dev_priv, flush_light); | 1064 | container_of(work, struct ipoib_dev_priv, flush_light); |
1078 | 1065 | ||
1079 | __ipoib_ib_dev_flush(priv, IPOIB_FLUSH_LIGHT); | 1066 | __ipoib_ib_dev_flush(priv, IPOIB_FLUSH_LIGHT, 0); |
1080 | } | 1067 | } |
1081 | 1068 | ||
1082 | void ipoib_ib_dev_flush_normal(struct work_struct *work) | 1069 | void ipoib_ib_dev_flush_normal(struct work_struct *work) |
@@ -1084,7 +1071,7 @@ void ipoib_ib_dev_flush_normal(struct work_struct *work) | |||
1084 | struct ipoib_dev_priv *priv = | 1071 | struct ipoib_dev_priv *priv = |
1085 | container_of(work, struct ipoib_dev_priv, flush_normal); | 1072 | container_of(work, struct ipoib_dev_priv, flush_normal); |
1086 | 1073 | ||
1087 | __ipoib_ib_dev_flush(priv, IPOIB_FLUSH_NORMAL); | 1074 | __ipoib_ib_dev_flush(priv, IPOIB_FLUSH_NORMAL, 0); |
1088 | } | 1075 | } |
1089 | 1076 | ||
1090 | void ipoib_ib_dev_flush_heavy(struct work_struct *work) | 1077 | void ipoib_ib_dev_flush_heavy(struct work_struct *work) |
@@ -1092,7 +1079,7 @@ void ipoib_ib_dev_flush_heavy(struct work_struct *work) | |||
1092 | struct ipoib_dev_priv *priv = | 1079 | struct ipoib_dev_priv *priv = |
1093 | container_of(work, struct ipoib_dev_priv, flush_heavy); | 1080 | container_of(work, struct ipoib_dev_priv, flush_heavy); |
1094 | 1081 | ||
1095 | __ipoib_ib_dev_flush(priv, IPOIB_FLUSH_HEAVY); | 1082 | __ipoib_ib_dev_flush(priv, IPOIB_FLUSH_HEAVY, 0); |
1096 | } | 1083 | } |
1097 | 1084 | ||
1098 | void ipoib_ib_dev_cleanup(struct net_device *dev) | 1085 | void ipoib_ib_dev_cleanup(struct net_device *dev) |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index da149c278cb8..b2943c84a5dd 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -190,7 +190,7 @@ static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_featu | |||
190 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 190 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
191 | 191 | ||
192 | if (test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags)) | 192 | if (test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags)) |
193 | features &= ~(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO); | 193 | features &= ~(NETIF_F_IP_CSUM | NETIF_F_TSO); |
194 | 194 | ||
195 | return features; | 195 | return features; |
196 | } | 196 | } |
@@ -232,6 +232,7 @@ int ipoib_set_mode(struct net_device *dev, const char *buf) | |||
232 | ipoib_warn(priv, "enabling connected mode " | 232 | ipoib_warn(priv, "enabling connected mode " |
233 | "will cause multicast packet drops\n"); | 233 | "will cause multicast packet drops\n"); |
234 | netdev_update_features(dev); | 234 | netdev_update_features(dev); |
235 | dev_set_mtu(dev, ipoib_cm_max_mtu(dev)); | ||
235 | rtnl_unlock(); | 236 | rtnl_unlock(); |
236 | priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM; | 237 | priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM; |
237 | 238 | ||
@@ -1577,7 +1578,8 @@ static struct net_device *ipoib_add_port(const char *format, | |||
1577 | SET_NETDEV_DEV(priv->dev, hca->dma_device); | 1578 | SET_NETDEV_DEV(priv->dev, hca->dma_device); |
1578 | priv->dev->dev_id = port - 1; | 1579 | priv->dev->dev_id = port - 1; |
1579 | 1580 | ||
1580 | if (!ib_query_port(hca, port, &attr)) | 1581 | result = ib_query_port(hca, port, &attr); |
1582 | if (!result) | ||
1581 | priv->max_ib_mtu = ib_mtu_enum_to_int(attr.max_mtu); | 1583 | priv->max_ib_mtu = ib_mtu_enum_to_int(attr.max_mtu); |
1582 | else { | 1584 | else { |
1583 | printk(KERN_WARNING "%s: ib_query_port %d failed\n", | 1585 | printk(KERN_WARNING "%s: ib_query_port %d failed\n", |
@@ -1598,7 +1600,8 @@ static struct net_device *ipoib_add_port(const char *format, | |||
1598 | goto device_init_failed; | 1600 | goto device_init_failed; |
1599 | } | 1601 | } |
1600 | 1602 | ||
1601 | if (ipoib_set_dev_features(priv, hca)) | 1603 | result = ipoib_set_dev_features(priv, hca); |
1604 | if (result) | ||
1602 | goto device_init_failed; | 1605 | goto device_init_failed; |
1603 | 1606 | ||
1604 | /* | 1607 | /* |
@@ -1684,7 +1687,7 @@ static void ipoib_add_one(struct ib_device *device) | |||
1684 | struct list_head *dev_list; | 1687 | struct list_head *dev_list; |
1685 | struct net_device *dev; | 1688 | struct net_device *dev; |
1686 | struct ipoib_dev_priv *priv; | 1689 | struct ipoib_dev_priv *priv; |
1687 | int s, e, p; | 1690 | int p; |
1688 | int count = 0; | 1691 | int count = 0; |
1689 | 1692 | ||
1690 | dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL); | 1693 | dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL); |
@@ -1693,15 +1696,7 @@ static void ipoib_add_one(struct ib_device *device) | |||
1693 | 1696 | ||
1694 | INIT_LIST_HEAD(dev_list); | 1697 | INIT_LIST_HEAD(dev_list); |
1695 | 1698 | ||
1696 | if (device->node_type == RDMA_NODE_IB_SWITCH) { | 1699 | for (p = rdma_start_port(device); p <= rdma_end_port(device); ++p) { |
1697 | s = 0; | ||
1698 | e = 0; | ||
1699 | } else { | ||
1700 | s = 1; | ||
1701 | e = device->phys_port_cnt; | ||
1702 | } | ||
1703 | |||
1704 | for (p = s; p <= e; ++p) { | ||
1705 | if (!rdma_protocol_ib(device, p)) | 1700 | if (!rdma_protocol_ib(device, p)) |
1706 | continue; | 1701 | continue; |
1707 | dev = ipoib_add_port("ib%d", device, p); | 1702 | dev = ipoib_add_port("ib%d", device, p); |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 267dc4f75502..31a20b462266 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -161,13 +161,10 @@ static int srp_tmo_set(const char *val, const struct kernel_param *kp) | |||
161 | { | 161 | { |
162 | int tmo, res; | 162 | int tmo, res; |
163 | 163 | ||
164 | if (strncmp(val, "off", 3) != 0) { | 164 | res = srp_parse_tmo(&tmo, val); |
165 | res = kstrtoint(val, 0, &tmo); | 165 | if (res) |
166 | if (res) | 166 | goto out; |
167 | goto out; | 167 | |
168 | } else { | ||
169 | tmo = -1; | ||
170 | } | ||
171 | if (kp->arg == &srp_reconnect_delay) | 168 | if (kp->arg == &srp_reconnect_delay) |
172 | res = srp_tmo_valid(tmo, srp_fast_io_fail_tmo, | 169 | res = srp_tmo_valid(tmo, srp_fast_io_fail_tmo, |
173 | srp_dev_loss_tmo); | 170 | srp_dev_loss_tmo); |
@@ -3379,7 +3376,7 @@ static void srp_add_one(struct ib_device *device) | |||
3379 | struct srp_device *srp_dev; | 3376 | struct srp_device *srp_dev; |
3380 | struct ib_device_attr *dev_attr; | 3377 | struct ib_device_attr *dev_attr; |
3381 | struct srp_host *host; | 3378 | struct srp_host *host; |
3382 | int mr_page_shift, s, e, p; | 3379 | int mr_page_shift, p; |
3383 | u64 max_pages_per_mr; | 3380 | u64 max_pages_per_mr; |
3384 | 3381 | ||
3385 | dev_attr = kmalloc(sizeof *dev_attr, GFP_KERNEL); | 3382 | dev_attr = kmalloc(sizeof *dev_attr, GFP_KERNEL); |
@@ -3443,15 +3440,7 @@ static void srp_add_one(struct ib_device *device) | |||
3443 | if (IS_ERR(srp_dev->mr)) | 3440 | if (IS_ERR(srp_dev->mr)) |
3444 | goto err_pd; | 3441 | goto err_pd; |
3445 | 3442 | ||
3446 | if (device->node_type == RDMA_NODE_IB_SWITCH) { | 3443 | for (p = rdma_start_port(device); p <= rdma_end_port(device); ++p) { |
3447 | s = 0; | ||
3448 | e = 0; | ||
3449 | } else { | ||
3450 | s = 1; | ||
3451 | e = device->phys_port_cnt; | ||
3452 | } | ||
3453 | |||
3454 | for (p = s; p <= e; ++p) { | ||
3455 | host = srp_add_port(srp_dev, p); | 3444 | host = srp_add_port(srp_dev, p); |
3456 | if (host) | 3445 | if (host) |
3457 | list_add_tail(&host->list, &srp_dev->dev_list); | 3446 | list_add_tail(&host->list, &srp_dev->dev_list); |
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 82897ca17f32..60ff0a2390e5 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -302,7 +302,7 @@ static void srpt_get_iou(struct ib_dm_mad *mad) | |||
302 | int i; | 302 | int i; |
303 | 303 | ||
304 | ioui = (struct ib_dm_iou_info *)mad->data; | 304 | ioui = (struct ib_dm_iou_info *)mad->data; |
305 | ioui->change_id = __constant_cpu_to_be16(1); | 305 | ioui->change_id = cpu_to_be16(1); |
306 | ioui->max_controllers = 16; | 306 | ioui->max_controllers = 16; |
307 | 307 | ||
308 | /* set present for slot 1 and empty for the rest */ | 308 | /* set present for slot 1 and empty for the rest */ |
@@ -330,13 +330,13 @@ static void srpt_get_ioc(struct srpt_port *sport, u32 slot, | |||
330 | 330 | ||
331 | if (!slot || slot > 16) { | 331 | if (!slot || slot > 16) { |
332 | mad->mad_hdr.status | 332 | mad->mad_hdr.status |
333 | = __constant_cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD); | 333 | = cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD); |
334 | return; | 334 | return; |
335 | } | 335 | } |
336 | 336 | ||
337 | if (slot > 2) { | 337 | if (slot > 2) { |
338 | mad->mad_hdr.status | 338 | mad->mad_hdr.status |
339 | = __constant_cpu_to_be16(DM_MAD_STATUS_NO_IOC); | 339 | = cpu_to_be16(DM_MAD_STATUS_NO_IOC); |
340 | return; | 340 | return; |
341 | } | 341 | } |
342 | 342 | ||
@@ -348,10 +348,10 @@ static void srpt_get_ioc(struct srpt_port *sport, u32 slot, | |||
348 | iocp->device_version = cpu_to_be16(sdev->dev_attr.hw_ver); | 348 | iocp->device_version = cpu_to_be16(sdev->dev_attr.hw_ver); |
349 | iocp->subsys_vendor_id = cpu_to_be32(sdev->dev_attr.vendor_id); | 349 | iocp->subsys_vendor_id = cpu_to_be32(sdev->dev_attr.vendor_id); |
350 | iocp->subsys_device_id = 0x0; | 350 | iocp->subsys_device_id = 0x0; |
351 | iocp->io_class = __constant_cpu_to_be16(SRP_REV16A_IB_IO_CLASS); | 351 | iocp->io_class = cpu_to_be16(SRP_REV16A_IB_IO_CLASS); |
352 | iocp->io_subclass = __constant_cpu_to_be16(SRP_IO_SUBCLASS); | 352 | iocp->io_subclass = cpu_to_be16(SRP_IO_SUBCLASS); |
353 | iocp->protocol = __constant_cpu_to_be16(SRP_PROTOCOL); | 353 | iocp->protocol = cpu_to_be16(SRP_PROTOCOL); |
354 | iocp->protocol_version = __constant_cpu_to_be16(SRP_PROTOCOL_VERSION); | 354 | iocp->protocol_version = cpu_to_be16(SRP_PROTOCOL_VERSION); |
355 | iocp->send_queue_depth = cpu_to_be16(sdev->srq_size); | 355 | iocp->send_queue_depth = cpu_to_be16(sdev->srq_size); |
356 | iocp->rdma_read_depth = 4; | 356 | iocp->rdma_read_depth = 4; |
357 | iocp->send_size = cpu_to_be32(srp_max_req_size); | 357 | iocp->send_size = cpu_to_be32(srp_max_req_size); |
@@ -379,13 +379,13 @@ static void srpt_get_svc_entries(u64 ioc_guid, | |||
379 | 379 | ||
380 | if (!slot || slot > 16) { | 380 | if (!slot || slot > 16) { |
381 | mad->mad_hdr.status | 381 | mad->mad_hdr.status |
382 | = __constant_cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD); | 382 | = cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD); |
383 | return; | 383 | return; |
384 | } | 384 | } |
385 | 385 | ||
386 | if (slot > 2 || lo > hi || hi > 1) { | 386 | if (slot > 2 || lo > hi || hi > 1) { |
387 | mad->mad_hdr.status | 387 | mad->mad_hdr.status |
388 | = __constant_cpu_to_be16(DM_MAD_STATUS_NO_IOC); | 388 | = cpu_to_be16(DM_MAD_STATUS_NO_IOC); |
389 | return; | 389 | return; |
390 | } | 390 | } |
391 | 391 | ||
@@ -436,7 +436,7 @@ static void srpt_mgmt_method_get(struct srpt_port *sp, struct ib_mad *rq_mad, | |||
436 | break; | 436 | break; |
437 | default: | 437 | default: |
438 | rsp_mad->mad_hdr.status = | 438 | rsp_mad->mad_hdr.status = |
439 | __constant_cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD_ATTR); | 439 | cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD_ATTR); |
440 | break; | 440 | break; |
441 | } | 441 | } |
442 | } | 442 | } |
@@ -493,11 +493,11 @@ static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent, | |||
493 | break; | 493 | break; |
494 | case IB_MGMT_METHOD_SET: | 494 | case IB_MGMT_METHOD_SET: |
495 | dm_mad->mad_hdr.status = | 495 | dm_mad->mad_hdr.status = |
496 | __constant_cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD_ATTR); | 496 | cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD_ATTR); |
497 | break; | 497 | break; |
498 | default: | 498 | default: |
499 | dm_mad->mad_hdr.status = | 499 | dm_mad->mad_hdr.status = |
500 | __constant_cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD); | 500 | cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD); |
501 | break; | 501 | break; |
502 | } | 502 | } |
503 | 503 | ||
@@ -1535,7 +1535,7 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch, | |||
1535 | memset(srp_rsp, 0, sizeof *srp_rsp); | 1535 | memset(srp_rsp, 0, sizeof *srp_rsp); |
1536 | srp_rsp->opcode = SRP_RSP; | 1536 | srp_rsp->opcode = SRP_RSP; |
1537 | srp_rsp->req_lim_delta = | 1537 | srp_rsp->req_lim_delta = |
1538 | __constant_cpu_to_be32(1 + atomic_xchg(&ch->req_lim_delta, 0)); | 1538 | cpu_to_be32(1 + atomic_xchg(&ch->req_lim_delta, 0)); |
1539 | srp_rsp->tag = tag; | 1539 | srp_rsp->tag = tag; |
1540 | srp_rsp->status = status; | 1540 | srp_rsp->status = status; |
1541 | 1541 | ||
@@ -1585,8 +1585,8 @@ static int srpt_build_tskmgmt_rsp(struct srpt_rdma_ch *ch, | |||
1585 | memset(srp_rsp, 0, sizeof *srp_rsp); | 1585 | memset(srp_rsp, 0, sizeof *srp_rsp); |
1586 | 1586 | ||
1587 | srp_rsp->opcode = SRP_RSP; | 1587 | srp_rsp->opcode = SRP_RSP; |
1588 | srp_rsp->req_lim_delta = __constant_cpu_to_be32(1 | 1588 | srp_rsp->req_lim_delta = |
1589 | + atomic_xchg(&ch->req_lim_delta, 0)); | 1589 | cpu_to_be32(1 + atomic_xchg(&ch->req_lim_delta, 0)); |
1590 | srp_rsp->tag = tag; | 1590 | srp_rsp->tag = tag; |
1591 | 1591 | ||
1592 | srp_rsp->flags |= SRP_RSP_FLAG_RSPVALID; | 1592 | srp_rsp->flags |= SRP_RSP_FLAG_RSPVALID; |
@@ -1630,7 +1630,7 @@ static uint64_t srpt_unpack_lun(const uint8_t *lun, int len) | |||
1630 | switch (len) { | 1630 | switch (len) { |
1631 | case 8: | 1631 | case 8: |
1632 | if ((*((__be64 *)lun) & | 1632 | if ((*((__be64 *)lun) & |
1633 | __constant_cpu_to_be64(0x0000FFFFFFFFFFFFLL)) != 0) | 1633 | cpu_to_be64(0x0000FFFFFFFFFFFFLL)) != 0) |
1634 | goto out_err; | 1634 | goto out_err; |
1635 | break; | 1635 | break; |
1636 | case 4: | 1636 | case 4: |
@@ -2449,8 +2449,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, | |||
2449 | } | 2449 | } |
2450 | 2450 | ||
2451 | if (it_iu_len > srp_max_req_size || it_iu_len < 64) { | 2451 | if (it_iu_len > srp_max_req_size || it_iu_len < 64) { |
2452 | rej->reason = __constant_cpu_to_be32( | 2452 | rej->reason = cpu_to_be32( |
2453 | SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE); | 2453 | SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE); |
2454 | ret = -EINVAL; | 2454 | ret = -EINVAL; |
2455 | pr_err("rejected SRP_LOGIN_REQ because its" | 2455 | pr_err("rejected SRP_LOGIN_REQ because its" |
2456 | " length (%d bytes) is out of range (%d .. %d)\n", | 2456 | " length (%d bytes) is out of range (%d .. %d)\n", |
@@ -2459,8 +2459,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, | |||
2459 | } | 2459 | } |
2460 | 2460 | ||
2461 | if (!sport->enabled) { | 2461 | if (!sport->enabled) { |
2462 | rej->reason = __constant_cpu_to_be32( | 2462 | rej->reason = cpu_to_be32( |
2463 | SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); | 2463 | SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); |
2464 | ret = -EINVAL; | 2464 | ret = -EINVAL; |
2465 | pr_err("rejected SRP_LOGIN_REQ because the target port" | 2465 | pr_err("rejected SRP_LOGIN_REQ because the target port" |
2466 | " has not yet been enabled\n"); | 2466 | " has not yet been enabled\n"); |
@@ -2505,8 +2505,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, | |||
2505 | if (*(__be64 *)req->target_port_id != cpu_to_be64(srpt_service_guid) | 2505 | if (*(__be64 *)req->target_port_id != cpu_to_be64(srpt_service_guid) |
2506 | || *(__be64 *)(req->target_port_id + 8) != | 2506 | || *(__be64 *)(req->target_port_id + 8) != |
2507 | cpu_to_be64(srpt_service_guid)) { | 2507 | cpu_to_be64(srpt_service_guid)) { |
2508 | rej->reason = __constant_cpu_to_be32( | 2508 | rej->reason = cpu_to_be32( |
2509 | SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL); | 2509 | SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL); |
2510 | ret = -ENOMEM; | 2510 | ret = -ENOMEM; |
2511 | pr_err("rejected SRP_LOGIN_REQ because it" | 2511 | pr_err("rejected SRP_LOGIN_REQ because it" |
2512 | " has an invalid target port identifier.\n"); | 2512 | " has an invalid target port identifier.\n"); |
@@ -2515,8 +2515,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, | |||
2515 | 2515 | ||
2516 | ch = kzalloc(sizeof *ch, GFP_KERNEL); | 2516 | ch = kzalloc(sizeof *ch, GFP_KERNEL); |
2517 | if (!ch) { | 2517 | if (!ch) { |
2518 | rej->reason = __constant_cpu_to_be32( | 2518 | rej->reason = cpu_to_be32( |
2519 | SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); | 2519 | SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); |
2520 | pr_err("rejected SRP_LOGIN_REQ because no memory.\n"); | 2520 | pr_err("rejected SRP_LOGIN_REQ because no memory.\n"); |
2521 | ret = -ENOMEM; | 2521 | ret = -ENOMEM; |
2522 | goto reject; | 2522 | goto reject; |
@@ -2552,8 +2552,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, | |||
2552 | 2552 | ||
2553 | ret = srpt_create_ch_ib(ch); | 2553 | ret = srpt_create_ch_ib(ch); |
2554 | if (ret) { | 2554 | if (ret) { |
2555 | rej->reason = __constant_cpu_to_be32( | 2555 | rej->reason = cpu_to_be32( |
2556 | SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); | 2556 | SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); |
2557 | pr_err("rejected SRP_LOGIN_REQ because creating" | 2557 | pr_err("rejected SRP_LOGIN_REQ because creating" |
2558 | " a new RDMA channel failed.\n"); | 2558 | " a new RDMA channel failed.\n"); |
2559 | goto free_ring; | 2559 | goto free_ring; |
@@ -2561,8 +2561,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, | |||
2561 | 2561 | ||
2562 | ret = srpt_ch_qp_rtr(ch, ch->qp); | 2562 | ret = srpt_ch_qp_rtr(ch, ch->qp); |
2563 | if (ret) { | 2563 | if (ret) { |
2564 | rej->reason = __constant_cpu_to_be32( | 2564 | rej->reason = cpu_to_be32(SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); |
2565 | SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); | ||
2566 | pr_err("rejected SRP_LOGIN_REQ because enabling" | 2565 | pr_err("rejected SRP_LOGIN_REQ because enabling" |
2567 | " RTR failed (error code = %d)\n", ret); | 2566 | " RTR failed (error code = %d)\n", ret); |
2568 | goto destroy_ib; | 2567 | goto destroy_ib; |
@@ -2580,15 +2579,15 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, | |||
2580 | if (!nacl) { | 2579 | if (!nacl) { |
2581 | pr_info("Rejected login because no ACL has been" | 2580 | pr_info("Rejected login because no ACL has been" |
2582 | " configured yet for initiator %s.\n", ch->sess_name); | 2581 | " configured yet for initiator %s.\n", ch->sess_name); |
2583 | rej->reason = __constant_cpu_to_be32( | 2582 | rej->reason = cpu_to_be32( |
2584 | SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED); | 2583 | SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED); |
2585 | goto destroy_ib; | 2584 | goto destroy_ib; |
2586 | } | 2585 | } |
2587 | 2586 | ||
2588 | ch->sess = transport_init_session(TARGET_PROT_NORMAL); | 2587 | ch->sess = transport_init_session(TARGET_PROT_NORMAL); |
2589 | if (IS_ERR(ch->sess)) { | 2588 | if (IS_ERR(ch->sess)) { |
2590 | rej->reason = __constant_cpu_to_be32( | 2589 | rej->reason = cpu_to_be32( |
2591 | SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); | 2590 | SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); |
2592 | pr_debug("Failed to create session\n"); | 2591 | pr_debug("Failed to create session\n"); |
2593 | goto deregister_session; | 2592 | goto deregister_session; |
2594 | } | 2593 | } |
@@ -2604,8 +2603,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, | |||
2604 | rsp->max_it_iu_len = req->req_it_iu_len; | 2603 | rsp->max_it_iu_len = req->req_it_iu_len; |
2605 | rsp->max_ti_iu_len = req->req_it_iu_len; | 2604 | rsp->max_ti_iu_len = req->req_it_iu_len; |
2606 | ch->max_ti_iu_len = it_iu_len; | 2605 | ch->max_ti_iu_len = it_iu_len; |
2607 | rsp->buf_fmt = __constant_cpu_to_be16(SRP_BUF_FORMAT_DIRECT | 2606 | rsp->buf_fmt = cpu_to_be16(SRP_BUF_FORMAT_DIRECT |
2608 | | SRP_BUF_FORMAT_INDIRECT); | 2607 | | SRP_BUF_FORMAT_INDIRECT); |
2609 | rsp->req_lim_delta = cpu_to_be32(ch->rq_size); | 2608 | rsp->req_lim_delta = cpu_to_be32(ch->rq_size); |
2610 | atomic_set(&ch->req_lim, ch->rq_size); | 2609 | atomic_set(&ch->req_lim, ch->rq_size); |
2611 | atomic_set(&ch->req_lim_delta, 0); | 2610 | atomic_set(&ch->req_lim_delta, 0); |
@@ -2655,8 +2654,8 @@ free_ch: | |||
2655 | reject: | 2654 | reject: |
2656 | rej->opcode = SRP_LOGIN_REJ; | 2655 | rej->opcode = SRP_LOGIN_REJ; |
2657 | rej->tag = req->tag; | 2656 | rej->tag = req->tag; |
2658 | rej->buf_fmt = __constant_cpu_to_be16(SRP_BUF_FORMAT_DIRECT | 2657 | rej->buf_fmt = cpu_to_be16(SRP_BUF_FORMAT_DIRECT |
2659 | | SRP_BUF_FORMAT_INDIRECT); | 2658 | | SRP_BUF_FORMAT_INDIRECT); |
2660 | 2659 | ||
2661 | ib_send_cm_rej(cm_id, IB_CM_REJ_CONSUMER_DEFINED, NULL, 0, | 2660 | ib_send_cm_rej(cm_id, IB_CM_REJ_CONSUMER_DEFINED, NULL, 0, |
2662 | (void *)rej, sizeof *rej); | 2661 | (void *)rej, sizeof *rej); |
diff --git a/drivers/input/input-leds.c b/drivers/input/input-leds.c index 074a65ed17bb..766bf2660116 100644 --- a/drivers/input/input-leds.c +++ b/drivers/input/input-leds.c | |||
@@ -71,6 +71,18 @@ static void input_leds_event(struct input_handle *handle, unsigned int type, | |||
71 | { | 71 | { |
72 | } | 72 | } |
73 | 73 | ||
74 | static int input_leds_get_count(struct input_dev *dev) | ||
75 | { | ||
76 | unsigned int led_code; | ||
77 | int count = 0; | ||
78 | |||
79 | for_each_set_bit(led_code, dev->ledbit, LED_CNT) | ||
80 | if (input_led_info[led_code].name) | ||
81 | count++; | ||
82 | |||
83 | return count; | ||
84 | } | ||
85 | |||
74 | static int input_leds_connect(struct input_handler *handler, | 86 | static int input_leds_connect(struct input_handler *handler, |
75 | struct input_dev *dev, | 87 | struct input_dev *dev, |
76 | const struct input_device_id *id) | 88 | const struct input_device_id *id) |
@@ -81,7 +93,7 @@ static int input_leds_connect(struct input_handler *handler, | |||
81 | int led_no; | 93 | int led_no; |
82 | int error; | 94 | int error; |
83 | 95 | ||
84 | num_leds = bitmap_weight(dev->ledbit, LED_CNT); | 96 | num_leds = input_leds_get_count(dev); |
85 | if (!num_leds) | 97 | if (!num_leds) |
86 | return -ENXIO; | 98 | return -ENXIO; |
87 | 99 | ||
@@ -112,7 +124,7 @@ static int input_leds_connect(struct input_handler *handler, | |||
112 | led->handle = &leds->handle; | 124 | led->handle = &leds->handle; |
113 | led->code = led_code; | 125 | led->code = led_code; |
114 | 126 | ||
115 | if (WARN_ON(!input_led_info[led_code].name)) | 127 | if (!input_led_info[led_code].name) |
116 | continue; | 128 | continue; |
117 | 129 | ||
118 | led->cdev.name = kasprintf(GFP_KERNEL, "%s::%s", | 130 | led->cdev.name = kasprintf(GFP_KERNEL, "%s::%s", |
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index 62641f2adaf7..5b5f403d8ce6 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c | |||
@@ -771,7 +771,7 @@ static const struct attribute_group *elan_sysfs_groups[] = { | |||
771 | */ | 771 | */ |
772 | static void elan_report_contact(struct elan_tp_data *data, | 772 | static void elan_report_contact(struct elan_tp_data *data, |
773 | int contact_num, bool contact_valid, | 773 | int contact_num, bool contact_valid, |
774 | bool hover_event, u8 *finger_data) | 774 | u8 *finger_data) |
775 | { | 775 | { |
776 | struct input_dev *input = data->input; | 776 | struct input_dev *input = data->input; |
777 | unsigned int pos_x, pos_y; | 777 | unsigned int pos_x, pos_y; |
@@ -815,9 +815,7 @@ static void elan_report_contact(struct elan_tp_data *data, | |||
815 | input_mt_report_slot_state(input, MT_TOOL_FINGER, true); | 815 | input_mt_report_slot_state(input, MT_TOOL_FINGER, true); |
816 | input_report_abs(input, ABS_MT_POSITION_X, pos_x); | 816 | input_report_abs(input, ABS_MT_POSITION_X, pos_x); |
817 | input_report_abs(input, ABS_MT_POSITION_Y, data->max_y - pos_y); | 817 | input_report_abs(input, ABS_MT_POSITION_Y, data->max_y - pos_y); |
818 | input_report_abs(input, ABS_MT_DISTANCE, hover_event); | 818 | input_report_abs(input, ABS_MT_PRESSURE, scaled_pressure); |
819 | input_report_abs(input, ABS_MT_PRESSURE, | ||
820 | hover_event ? 0 : scaled_pressure); | ||
821 | input_report_abs(input, ABS_TOOL_WIDTH, mk_x); | 819 | input_report_abs(input, ABS_TOOL_WIDTH, mk_x); |
822 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, major); | 820 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, major); |
823 | input_report_abs(input, ABS_MT_TOUCH_MINOR, minor); | 821 | input_report_abs(input, ABS_MT_TOUCH_MINOR, minor); |
@@ -839,14 +837,14 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet) | |||
839 | hover_event = hover_info & 0x40; | 837 | hover_event = hover_info & 0x40; |
840 | for (i = 0; i < ETP_MAX_FINGERS; i++) { | 838 | for (i = 0; i < ETP_MAX_FINGERS; i++) { |
841 | contact_valid = tp_info & (1U << (3 + i)); | 839 | contact_valid = tp_info & (1U << (3 + i)); |
842 | elan_report_contact(data, i, contact_valid, hover_event, | 840 | elan_report_contact(data, i, contact_valid, finger_data); |
843 | finger_data); | ||
844 | 841 | ||
845 | if (contact_valid) | 842 | if (contact_valid) |
846 | finger_data += ETP_FINGER_DATA_LEN; | 843 | finger_data += ETP_FINGER_DATA_LEN; |
847 | } | 844 | } |
848 | 845 | ||
849 | input_report_key(input, BTN_LEFT, tp_info & 0x01); | 846 | input_report_key(input, BTN_LEFT, tp_info & 0x01); |
847 | input_report_abs(input, ABS_DISTANCE, hover_event != 0); | ||
850 | input_mt_report_pointer_emulation(input, true); | 848 | input_mt_report_pointer_emulation(input, true); |
851 | input_sync(input); | 849 | input_sync(input); |
852 | } | 850 | } |
@@ -922,6 +920,7 @@ static int elan_setup_input_device(struct elan_tp_data *data) | |||
922 | input_abs_set_res(input, ABS_Y, data->y_res); | 920 | input_abs_set_res(input, ABS_Y, data->y_res); |
923 | input_set_abs_params(input, ABS_PRESSURE, 0, ETP_MAX_PRESSURE, 0, 0); | 921 | input_set_abs_params(input, ABS_PRESSURE, 0, ETP_MAX_PRESSURE, 0, 0); |
924 | input_set_abs_params(input, ABS_TOOL_WIDTH, 0, ETP_FINGER_WIDTH, 0, 0); | 922 | input_set_abs_params(input, ABS_TOOL_WIDTH, 0, ETP_FINGER_WIDTH, 0, 0); |
923 | input_set_abs_params(input, ABS_DISTANCE, 0, 1, 0, 0); | ||
925 | 924 | ||
926 | /* And MT parameters */ | 925 | /* And MT parameters */ |
927 | input_set_abs_params(input, ABS_MT_POSITION_X, 0, data->max_x, 0, 0); | 926 | input_set_abs_params(input, ABS_MT_POSITION_X, 0, data->max_x, 0, 0); |
@@ -934,7 +933,6 @@ static int elan_setup_input_device(struct elan_tp_data *data) | |||
934 | ETP_FINGER_WIDTH * max_width, 0, 0); | 933 | ETP_FINGER_WIDTH * max_width, 0, 0); |
935 | input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, | 934 | input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, |
936 | ETP_FINGER_WIDTH * min_width, 0, 0); | 935 | ETP_FINGER_WIDTH * min_width, 0, 0); |
937 | input_set_abs_params(input, ABS_MT_DISTANCE, 0, 1, 0, 0); | ||
938 | 936 | ||
939 | data->input = input; | 937 | data->input = input; |
940 | 938 | ||
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index ce3d40004458..22b9ca901f4e 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -1167,7 +1167,7 @@ static int elantech_set_input_params(struct psmouse *psmouse) | |||
1167 | struct input_dev *dev = psmouse->dev; | 1167 | struct input_dev *dev = psmouse->dev; |
1168 | struct elantech_data *etd = psmouse->private; | 1168 | struct elantech_data *etd = psmouse->private; |
1169 | unsigned int x_min = 0, y_min = 0, x_max = 0, y_max = 0, width = 0; | 1169 | unsigned int x_min = 0, y_min = 0, x_max = 0, y_max = 0, width = 0; |
1170 | unsigned int x_res = 0, y_res = 0; | 1170 | unsigned int x_res = 31, y_res = 31; |
1171 | 1171 | ||
1172 | if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width)) | 1172 | if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width)) |
1173 | return -1; | 1173 | return -1; |
@@ -1232,8 +1232,6 @@ static int elantech_set_input_params(struct psmouse *psmouse) | |||
1232 | /* For X to recognize me as touchpad. */ | 1232 | /* For X to recognize me as touchpad. */ |
1233 | input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0); | 1233 | input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0); |
1234 | input_set_abs_params(dev, ABS_Y, y_min, y_max, 0, 0); | 1234 | input_set_abs_params(dev, ABS_Y, y_min, y_max, 0, 0); |
1235 | input_abs_set_res(dev, ABS_X, x_res); | ||
1236 | input_abs_set_res(dev, ABS_Y, y_res); | ||
1237 | /* | 1235 | /* |
1238 | * range of pressure and width is the same as v2, | 1236 | * range of pressure and width is the same as v2, |
1239 | * report ABS_PRESSURE, ABS_TOOL_WIDTH for compatibility. | 1237 | * report ABS_PRESSURE, ABS_TOOL_WIDTH for compatibility. |
@@ -1246,8 +1244,6 @@ static int elantech_set_input_params(struct psmouse *psmouse) | |||
1246 | input_mt_init_slots(dev, ETP_MAX_FINGERS, 0); | 1244 | input_mt_init_slots(dev, ETP_MAX_FINGERS, 0); |
1247 | input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0); | 1245 | input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0); |
1248 | input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0); | 1246 | input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0); |
1249 | input_abs_set_res(dev, ABS_MT_POSITION_X, x_res); | ||
1250 | input_abs_set_res(dev, ABS_MT_POSITION_Y, y_res); | ||
1251 | input_set_abs_params(dev, ABS_MT_PRESSURE, ETP_PMIN_V2, | 1247 | input_set_abs_params(dev, ABS_MT_PRESSURE, ETP_PMIN_V2, |
1252 | ETP_PMAX_V2, 0, 0); | 1248 | ETP_PMAX_V2, 0, 0); |
1253 | /* | 1249 | /* |
@@ -1259,6 +1255,13 @@ static int elantech_set_input_params(struct psmouse *psmouse) | |||
1259 | break; | 1255 | break; |
1260 | } | 1256 | } |
1261 | 1257 | ||
1258 | input_abs_set_res(dev, ABS_X, x_res); | ||
1259 | input_abs_set_res(dev, ABS_Y, y_res); | ||
1260 | if (etd->hw_version > 1) { | ||
1261 | input_abs_set_res(dev, ABS_MT_POSITION_X, x_res); | ||
1262 | input_abs_set_res(dev, ABS_MT_POSITION_Y, y_res); | ||
1263 | } | ||
1264 | |||
1262 | etd->y_max = y_max; | 1265 | etd->y_max = y_max; |
1263 | etd->width = width; | 1266 | etd->width = width; |
1264 | 1267 | ||
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 35c8d0ceabee..3a32caf06bf1 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -1199,7 +1199,7 @@ static void set_input_params(struct psmouse *psmouse, | |||
1199 | ABS_MT_POSITION_Y); | 1199 | ABS_MT_POSITION_Y); |
1200 | /* Image sensors can report per-contact pressure */ | 1200 | /* Image sensors can report per-contact pressure */ |
1201 | input_set_abs_params(dev, ABS_MT_PRESSURE, 0, 255, 0, 0); | 1201 | input_set_abs_params(dev, ABS_MT_PRESSURE, 0, 255, 0, 0); |
1202 | input_mt_init_slots(dev, 3, INPUT_MT_POINTER | INPUT_MT_TRACK); | 1202 | input_mt_init_slots(dev, 2, INPUT_MT_POINTER | INPUT_MT_TRACK); |
1203 | 1203 | ||
1204 | /* Image sensors can signal 4 and 5 finger clicks */ | 1204 | /* Image sensors can signal 4 and 5 finger clicks */ |
1205 | __set_bit(BTN_TOOL_QUADTAP, dev->keybit); | 1205 | __set_bit(BTN_TOOL_QUADTAP, dev->keybit); |
diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index b4d12e29abff..e36162b28c2a 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c | |||
@@ -15,6 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/dmi.h> | ||
18 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
19 | #include <linux/input.h> | 20 | #include <linux/input.h> |
20 | #include <linux/input/mt.h> | 21 | #include <linux/input/mt.h> |
@@ -34,6 +35,7 @@ struct goodix_ts_data { | |||
34 | int abs_y_max; | 35 | int abs_y_max; |
35 | unsigned int max_touch_num; | 36 | unsigned int max_touch_num; |
36 | unsigned int int_trigger_type; | 37 | unsigned int int_trigger_type; |
38 | bool rotated_screen; | ||
37 | }; | 39 | }; |
38 | 40 | ||
39 | #define GOODIX_MAX_HEIGHT 4096 | 41 | #define GOODIX_MAX_HEIGHT 4096 |
@@ -60,6 +62,30 @@ static const unsigned long goodix_irq_flags[] = { | |||
60 | IRQ_TYPE_LEVEL_HIGH, | 62 | IRQ_TYPE_LEVEL_HIGH, |
61 | }; | 63 | }; |
62 | 64 | ||
65 | /* | ||
66 | * Those tablets have their coordinates origin at the bottom right | ||
67 | * of the tablet, as if rotated 180 degrees | ||
68 | */ | ||
69 | static const struct dmi_system_id rotated_screen[] = { | ||
70 | #if defined(CONFIG_DMI) && defined(CONFIG_X86) | ||
71 | { | ||
72 | .ident = "WinBook TW100", | ||
73 | .matches = { | ||
74 | DMI_MATCH(DMI_SYS_VENDOR, "WinBook"), | ||
75 | DMI_MATCH(DMI_PRODUCT_NAME, "TW100") | ||
76 | } | ||
77 | }, | ||
78 | { | ||
79 | .ident = "WinBook TW700", | ||
80 | .matches = { | ||
81 | DMI_MATCH(DMI_SYS_VENDOR, "WinBook"), | ||
82 | DMI_MATCH(DMI_PRODUCT_NAME, "TW700") | ||
83 | }, | ||
84 | }, | ||
85 | #endif | ||
86 | {} | ||
87 | }; | ||
88 | |||
63 | /** | 89 | /** |
64 | * goodix_i2c_read - read data from a register of the i2c slave device. | 90 | * goodix_i2c_read - read data from a register of the i2c slave device. |
65 | * | 91 | * |
@@ -129,6 +155,11 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) | |||
129 | int input_y = get_unaligned_le16(&coor_data[3]); | 155 | int input_y = get_unaligned_le16(&coor_data[3]); |
130 | int input_w = get_unaligned_le16(&coor_data[5]); | 156 | int input_w = get_unaligned_le16(&coor_data[5]); |
131 | 157 | ||
158 | if (ts->rotated_screen) { | ||
159 | input_x = ts->abs_x_max - input_x; | ||
160 | input_y = ts->abs_y_max - input_y; | ||
161 | } | ||
162 | |||
132 | input_mt_slot(ts->input_dev, id); | 163 | input_mt_slot(ts->input_dev, id); |
133 | input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); | 164 | input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); |
134 | input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x); | 165 | input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x); |
@@ -223,6 +254,11 @@ static void goodix_read_config(struct goodix_ts_data *ts) | |||
223 | ts->abs_y_max = GOODIX_MAX_HEIGHT; | 254 | ts->abs_y_max = GOODIX_MAX_HEIGHT; |
224 | ts->max_touch_num = GOODIX_MAX_CONTACTS; | 255 | ts->max_touch_num = GOODIX_MAX_CONTACTS; |
225 | } | 256 | } |
257 | |||
258 | ts->rotated_screen = dmi_check_system(rotated_screen); | ||
259 | if (ts->rotated_screen) | ||
260 | dev_dbg(&ts->client->dev, | ||
261 | "Applying '180 degrees rotated screen' quirk\n"); | ||
226 | } | 262 | } |
227 | 263 | ||
228 | /** | 264 | /** |
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index f2c6c352c55a..2c41107240de 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
@@ -627,6 +627,9 @@ static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) | |||
627 | goto err_out; | 627 | goto err_out; |
628 | } | 628 | } |
629 | 629 | ||
630 | /* TSC-25 data sheet specifies a delay after the RESET command */ | ||
631 | msleep(150); | ||
632 | |||
630 | /* set coordinate output rate */ | 633 | /* set coordinate output rate */ |
631 | buf[0] = buf[1] = 0xFF; | 634 | buf[0] = buf[1] = 0xFF; |
632 | ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0), | 635 | ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0), |
diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index f58a196521a9..80285c71786e 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c | |||
@@ -429,7 +429,7 @@ static int zforce_read_packet(struct zforce_ts *ts, u8 *buf) | |||
429 | goto unlock; | 429 | goto unlock; |
430 | } | 430 | } |
431 | 431 | ||
432 | if (buf[PAYLOAD_LENGTH] == 0) { | 432 | if (buf[PAYLOAD_LENGTH] == 0 || buf[PAYLOAD_LENGTH] > FRAME_MAXSIZE) { |
433 | dev_err(&client->dev, "invalid payload length: %d\n", | 433 | dev_err(&client->dev, "invalid payload length: %d\n", |
434 | buf[PAYLOAD_LENGTH]); | 434 | buf[PAYLOAD_LENGTH]); |
435 | ret = -EIO; | 435 | ret = -EIO; |
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 8e9ec81ce4bb..da902baaa794 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c | |||
@@ -199,9 +199,10 @@ | |||
199 | * Stream table. | 199 | * Stream table. |
200 | * | 200 | * |
201 | * Linear: Enough to cover 1 << IDR1.SIDSIZE entries | 201 | * Linear: Enough to cover 1 << IDR1.SIDSIZE entries |
202 | * 2lvl: 8k L1 entries, 256 lazy entries per table (each table covers a PCI bus) | 202 | * 2lvl: 128k L1 entries, |
203 | * 256 lazy entries per table (each table covers a PCI bus) | ||
203 | */ | 204 | */ |
204 | #define STRTAB_L1_SZ_SHIFT 16 | 205 | #define STRTAB_L1_SZ_SHIFT 20 |
205 | #define STRTAB_SPLIT 8 | 206 | #define STRTAB_SPLIT 8 |
206 | 207 | ||
207 | #define STRTAB_L1_DESC_DWORDS 1 | 208 | #define STRTAB_L1_DESC_DWORDS 1 |
@@ -269,10 +270,10 @@ | |||
269 | #define ARM64_TCR_TG0_SHIFT 14 | 270 | #define ARM64_TCR_TG0_SHIFT 14 |
270 | #define ARM64_TCR_TG0_MASK 0x3UL | 271 | #define ARM64_TCR_TG0_MASK 0x3UL |
271 | #define CTXDESC_CD_0_TCR_IRGN0_SHIFT 8 | 272 | #define CTXDESC_CD_0_TCR_IRGN0_SHIFT 8 |
272 | #define ARM64_TCR_IRGN0_SHIFT 24 | 273 | #define ARM64_TCR_IRGN0_SHIFT 8 |
273 | #define ARM64_TCR_IRGN0_MASK 0x3UL | 274 | #define ARM64_TCR_IRGN0_MASK 0x3UL |
274 | #define CTXDESC_CD_0_TCR_ORGN0_SHIFT 10 | 275 | #define CTXDESC_CD_0_TCR_ORGN0_SHIFT 10 |
275 | #define ARM64_TCR_ORGN0_SHIFT 26 | 276 | #define ARM64_TCR_ORGN0_SHIFT 10 |
276 | #define ARM64_TCR_ORGN0_MASK 0x3UL | 277 | #define ARM64_TCR_ORGN0_MASK 0x3UL |
277 | #define CTXDESC_CD_0_TCR_SH0_SHIFT 12 | 278 | #define CTXDESC_CD_0_TCR_SH0_SHIFT 12 |
278 | #define ARM64_TCR_SH0_SHIFT 12 | 279 | #define ARM64_TCR_SH0_SHIFT 12 |
@@ -542,6 +543,9 @@ struct arm_smmu_device { | |||
542 | #define ARM_SMMU_FEAT_HYP (1 << 12) | 543 | #define ARM_SMMU_FEAT_HYP (1 << 12) |
543 | u32 features; | 544 | u32 features; |
544 | 545 | ||
546 | #define ARM_SMMU_OPT_SKIP_PREFETCH (1 << 0) | ||
547 | u32 options; | ||
548 | |||
545 | struct arm_smmu_cmdq cmdq; | 549 | struct arm_smmu_cmdq cmdq; |
546 | struct arm_smmu_evtq evtq; | 550 | struct arm_smmu_evtq evtq; |
547 | struct arm_smmu_priq priq; | 551 | struct arm_smmu_priq priq; |
@@ -602,11 +606,35 @@ struct arm_smmu_domain { | |||
602 | static DEFINE_SPINLOCK(arm_smmu_devices_lock); | 606 | static DEFINE_SPINLOCK(arm_smmu_devices_lock); |
603 | static LIST_HEAD(arm_smmu_devices); | 607 | static LIST_HEAD(arm_smmu_devices); |
604 | 608 | ||
609 | struct arm_smmu_option_prop { | ||
610 | u32 opt; | ||
611 | const char *prop; | ||
612 | }; | ||
613 | |||
614 | static struct arm_smmu_option_prop arm_smmu_options[] = { | ||
615 | { ARM_SMMU_OPT_SKIP_PREFETCH, "hisilicon,broken-prefetch-cmd" }, | ||
616 | { 0, NULL}, | ||
617 | }; | ||
618 | |||
605 | static struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom) | 619 | static struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom) |
606 | { | 620 | { |
607 | return container_of(dom, struct arm_smmu_domain, domain); | 621 | return container_of(dom, struct arm_smmu_domain, domain); |
608 | } | 622 | } |
609 | 623 | ||
624 | static void parse_driver_options(struct arm_smmu_device *smmu) | ||
625 | { | ||
626 | int i = 0; | ||
627 | |||
628 | do { | ||
629 | if (of_property_read_bool(smmu->dev->of_node, | ||
630 | arm_smmu_options[i].prop)) { | ||
631 | smmu->options |= arm_smmu_options[i].opt; | ||
632 | dev_notice(smmu->dev, "option %s\n", | ||
633 | arm_smmu_options[i].prop); | ||
634 | } | ||
635 | } while (arm_smmu_options[++i].opt); | ||
636 | } | ||
637 | |||
610 | /* Low-level queue manipulation functions */ | 638 | /* Low-level queue manipulation functions */ |
611 | static bool queue_full(struct arm_smmu_queue *q) | 639 | static bool queue_full(struct arm_smmu_queue *q) |
612 | { | 640 | { |
@@ -1036,7 +1064,8 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid, | |||
1036 | arm_smmu_sync_ste_for_sid(smmu, sid); | 1064 | arm_smmu_sync_ste_for_sid(smmu, sid); |
1037 | 1065 | ||
1038 | /* It's likely that we'll want to use the new STE soon */ | 1066 | /* It's likely that we'll want to use the new STE soon */ |
1039 | arm_smmu_cmdq_issue_cmd(smmu, &prefetch_cmd); | 1067 | if (!(smmu->options & ARM_SMMU_OPT_SKIP_PREFETCH)) |
1068 | arm_smmu_cmdq_issue_cmd(smmu, &prefetch_cmd); | ||
1040 | } | 1069 | } |
1041 | 1070 | ||
1042 | static void arm_smmu_init_bypass_stes(u64 *strtab, unsigned int nent) | 1071 | static void arm_smmu_init_bypass_stes(u64 *strtab, unsigned int nent) |
@@ -1064,7 +1093,7 @@ static int arm_smmu_init_l2_strtab(struct arm_smmu_device *smmu, u32 sid) | |||
1064 | return 0; | 1093 | return 0; |
1065 | 1094 | ||
1066 | size = 1 << (STRTAB_SPLIT + ilog2(STRTAB_STE_DWORDS) + 3); | 1095 | size = 1 << (STRTAB_SPLIT + ilog2(STRTAB_STE_DWORDS) + 3); |
1067 | strtab = &cfg->strtab[sid >> STRTAB_SPLIT << STRTAB_L1_DESC_DWORDS]; | 1096 | strtab = &cfg->strtab[(sid >> STRTAB_SPLIT) * STRTAB_L1_DESC_DWORDS]; |
1068 | 1097 | ||
1069 | desc->span = STRTAB_SPLIT + 1; | 1098 | desc->span = STRTAB_SPLIT + 1; |
1070 | desc->l2ptr = dma_zalloc_coherent(smmu->dev, size, &desc->l2ptr_dma, | 1099 | desc->l2ptr = dma_zalloc_coherent(smmu->dev, size, &desc->l2ptr_dma, |
@@ -2020,21 +2049,23 @@ static int arm_smmu_init_strtab_2lvl(struct arm_smmu_device *smmu) | |||
2020 | { | 2049 | { |
2021 | void *strtab; | 2050 | void *strtab; |
2022 | u64 reg; | 2051 | u64 reg; |
2023 | u32 size; | 2052 | u32 size, l1size; |
2024 | int ret; | 2053 | int ret; |
2025 | struct arm_smmu_strtab_cfg *cfg = &smmu->strtab_cfg; | 2054 | struct arm_smmu_strtab_cfg *cfg = &smmu->strtab_cfg; |
2026 | 2055 | ||
2027 | /* Calculate the L1 size, capped to the SIDSIZE */ | 2056 | /* Calculate the L1 size, capped to the SIDSIZE */ |
2028 | size = STRTAB_L1_SZ_SHIFT - (ilog2(STRTAB_L1_DESC_DWORDS) + 3); | 2057 | size = STRTAB_L1_SZ_SHIFT - (ilog2(STRTAB_L1_DESC_DWORDS) + 3); |
2029 | size = min(size, smmu->sid_bits - STRTAB_SPLIT); | 2058 | size = min(size, smmu->sid_bits - STRTAB_SPLIT); |
2030 | if (size + STRTAB_SPLIT < smmu->sid_bits) | 2059 | cfg->num_l1_ents = 1 << size; |
2060 | |||
2061 | size += STRTAB_SPLIT; | ||
2062 | if (size < smmu->sid_bits) | ||
2031 | dev_warn(smmu->dev, | 2063 | dev_warn(smmu->dev, |
2032 | "2-level strtab only covers %u/%u bits of SID\n", | 2064 | "2-level strtab only covers %u/%u bits of SID\n", |
2033 | size + STRTAB_SPLIT, smmu->sid_bits); | 2065 | size, smmu->sid_bits); |
2034 | 2066 | ||
2035 | cfg->num_l1_ents = 1 << size; | 2067 | l1size = cfg->num_l1_ents * (STRTAB_L1_DESC_DWORDS << 3); |
2036 | size = cfg->num_l1_ents * (STRTAB_L1_DESC_DWORDS << 3); | 2068 | strtab = dma_zalloc_coherent(smmu->dev, l1size, &cfg->strtab_dma, |
2037 | strtab = dma_zalloc_coherent(smmu->dev, size, &cfg->strtab_dma, | ||
2038 | GFP_KERNEL); | 2069 | GFP_KERNEL); |
2039 | if (!strtab) { | 2070 | if (!strtab) { |
2040 | dev_err(smmu->dev, | 2071 | dev_err(smmu->dev, |
@@ -2055,8 +2086,7 @@ static int arm_smmu_init_strtab_2lvl(struct arm_smmu_device *smmu) | |||
2055 | ret = arm_smmu_init_l1_strtab(smmu); | 2086 | ret = arm_smmu_init_l1_strtab(smmu); |
2056 | if (ret) | 2087 | if (ret) |
2057 | dma_free_coherent(smmu->dev, | 2088 | dma_free_coherent(smmu->dev, |
2058 | cfg->num_l1_ents * | 2089 | l1size, |
2059 | (STRTAB_L1_DESC_DWORDS << 3), | ||
2060 | strtab, | 2090 | strtab, |
2061 | cfg->strtab_dma); | 2091 | cfg->strtab_dma); |
2062 | return ret; | 2092 | return ret; |
@@ -2573,6 +2603,8 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) | |||
2573 | if (irq > 0) | 2603 | if (irq > 0) |
2574 | smmu->gerr_irq = irq; | 2604 | smmu->gerr_irq = irq; |
2575 | 2605 | ||
2606 | parse_driver_options(smmu); | ||
2607 | |||
2576 | /* Probe the h/w */ | 2608 | /* Probe the h/w */ |
2577 | ret = arm_smmu_device_probe(smmu); | 2609 | ret = arm_smmu_device_probe(smmu); |
2578 | if (ret) | 2610 | if (ret) |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index a98a7b27aca1..0649b94f5958 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -1830,8 +1830,9 @@ static int domain_init(struct dmar_domain *domain, int guest_width) | |||
1830 | 1830 | ||
1831 | static void domain_exit(struct dmar_domain *domain) | 1831 | static void domain_exit(struct dmar_domain *domain) |
1832 | { | 1832 | { |
1833 | struct dmar_drhd_unit *drhd; | ||
1834 | struct intel_iommu *iommu; | ||
1833 | struct page *freelist = NULL; | 1835 | struct page *freelist = NULL; |
1834 | int i; | ||
1835 | 1836 | ||
1836 | /* Domain 0 is reserved, so dont process it */ | 1837 | /* Domain 0 is reserved, so dont process it */ |
1837 | if (!domain) | 1838 | if (!domain) |
@@ -1851,8 +1852,10 @@ static void domain_exit(struct dmar_domain *domain) | |||
1851 | 1852 | ||
1852 | /* clear attached or cached domains */ | 1853 | /* clear attached or cached domains */ |
1853 | rcu_read_lock(); | 1854 | rcu_read_lock(); |
1854 | for_each_set_bit(i, domain->iommu_bmp, g_num_of_iommus) | 1855 | for_each_active_iommu(iommu, drhd) |
1855 | iommu_detach_domain(domain, g_iommus[i]); | 1856 | if (domain_type_is_vm(domain) || |
1857 | test_bit(iommu->seq_id, domain->iommu_bmp)) | ||
1858 | iommu_detach_domain(domain, iommu); | ||
1856 | rcu_read_unlock(); | 1859 | rcu_read_unlock(); |
1857 | 1860 | ||
1858 | dma_free_pagelist(freelist); | 1861 | dma_free_pagelist(freelist); |
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 63dbdec2f05b..1df956afb937 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c | |||
@@ -74,6 +74,13 @@ struct its_node { | |||
74 | 74 | ||
75 | #define ITS_ITT_ALIGN SZ_256 | 75 | #define ITS_ITT_ALIGN SZ_256 |
76 | 76 | ||
77 | struct event_lpi_map { | ||
78 | unsigned long *lpi_map; | ||
79 | u16 *col_map; | ||
80 | irq_hw_number_t lpi_base; | ||
81 | int nr_lpis; | ||
82 | }; | ||
83 | |||
77 | /* | 84 | /* |
78 | * The ITS view of a device - belongs to an ITS, a collection, owns an | 85 | * The ITS view of a device - belongs to an ITS, a collection, owns an |
79 | * interrupt translation table, and a list of interrupts. | 86 | * interrupt translation table, and a list of interrupts. |
@@ -81,11 +88,8 @@ struct its_node { | |||
81 | struct its_device { | 88 | struct its_device { |
82 | struct list_head entry; | 89 | struct list_head entry; |
83 | struct its_node *its; | 90 | struct its_node *its; |
84 | struct its_collection *collection; | 91 | struct event_lpi_map event_map; |
85 | void *itt; | 92 | void *itt; |
86 | unsigned long *lpi_map; | ||
87 | irq_hw_number_t lpi_base; | ||
88 | int nr_lpis; | ||
89 | u32 nr_ites; | 93 | u32 nr_ites; |
90 | u32 device_id; | 94 | u32 device_id; |
91 | }; | 95 | }; |
@@ -98,6 +102,14 @@ static struct rdists *gic_rdists; | |||
98 | #define gic_data_rdist() (raw_cpu_ptr(gic_rdists->rdist)) | 102 | #define gic_data_rdist() (raw_cpu_ptr(gic_rdists->rdist)) |
99 | #define gic_data_rdist_rd_base() (gic_data_rdist()->rd_base) | 103 | #define gic_data_rdist_rd_base() (gic_data_rdist()->rd_base) |
100 | 104 | ||
105 | static struct its_collection *dev_event_to_col(struct its_device *its_dev, | ||
106 | u32 event) | ||
107 | { | ||
108 | struct its_node *its = its_dev->its; | ||
109 | |||
110 | return its->collections + its_dev->event_map.col_map[event]; | ||
111 | } | ||
112 | |||
101 | /* | 113 | /* |
102 | * ITS command descriptors - parameters to be encoded in a command | 114 | * ITS command descriptors - parameters to be encoded in a command |
103 | * block. | 115 | * block. |
@@ -133,7 +145,7 @@ struct its_cmd_desc { | |||
133 | struct { | 145 | struct { |
134 | struct its_device *dev; | 146 | struct its_device *dev; |
135 | struct its_collection *col; | 147 | struct its_collection *col; |
136 | u32 id; | 148 | u32 event_id; |
137 | } its_movi_cmd; | 149 | } its_movi_cmd; |
138 | 150 | ||
139 | struct { | 151 | struct { |
@@ -240,7 +252,7 @@ static struct its_collection *its_build_mapd_cmd(struct its_cmd_block *cmd, | |||
240 | 252 | ||
241 | its_fixup_cmd(cmd); | 253 | its_fixup_cmd(cmd); |
242 | 254 | ||
243 | return desc->its_mapd_cmd.dev->collection; | 255 | return NULL; |
244 | } | 256 | } |
245 | 257 | ||
246 | static struct its_collection *its_build_mapc_cmd(struct its_cmd_block *cmd, | 258 | static struct its_collection *its_build_mapc_cmd(struct its_cmd_block *cmd, |
@@ -259,52 +271,72 @@ static struct its_collection *its_build_mapc_cmd(struct its_cmd_block *cmd, | |||
259 | static struct its_collection *its_build_mapvi_cmd(struct its_cmd_block *cmd, | 271 | static struct its_collection *its_build_mapvi_cmd(struct its_cmd_block *cmd, |
260 | struct its_cmd_desc *desc) | 272 | struct its_cmd_desc *desc) |
261 | { | 273 | { |
274 | struct its_collection *col; | ||
275 | |||
276 | col = dev_event_to_col(desc->its_mapvi_cmd.dev, | ||
277 | desc->its_mapvi_cmd.event_id); | ||
278 | |||
262 | its_encode_cmd(cmd, GITS_CMD_MAPVI); | 279 | its_encode_cmd(cmd, GITS_CMD_MAPVI); |
263 | its_encode_devid(cmd, desc->its_mapvi_cmd.dev->device_id); | 280 | its_encode_devid(cmd, desc->its_mapvi_cmd.dev->device_id); |
264 | its_encode_event_id(cmd, desc->its_mapvi_cmd.event_id); | 281 | its_encode_event_id(cmd, desc->its_mapvi_cmd.event_id); |
265 | its_encode_phys_id(cmd, desc->its_mapvi_cmd.phys_id); | 282 | its_encode_phys_id(cmd, desc->its_mapvi_cmd.phys_id); |
266 | its_encode_collection(cmd, desc->its_mapvi_cmd.dev->collection->col_id); | 283 | its_encode_collection(cmd, col->col_id); |
267 | 284 | ||
268 | its_fixup_cmd(cmd); | 285 | its_fixup_cmd(cmd); |
269 | 286 | ||
270 | return desc->its_mapvi_cmd.dev->collection; | 287 | return col; |
271 | } | 288 | } |
272 | 289 | ||
273 | static struct its_collection *its_build_movi_cmd(struct its_cmd_block *cmd, | 290 | static struct its_collection *its_build_movi_cmd(struct its_cmd_block *cmd, |
274 | struct its_cmd_desc *desc) | 291 | struct its_cmd_desc *desc) |
275 | { | 292 | { |
293 | struct its_collection *col; | ||
294 | |||
295 | col = dev_event_to_col(desc->its_movi_cmd.dev, | ||
296 | desc->its_movi_cmd.event_id); | ||
297 | |||
276 | its_encode_cmd(cmd, GITS_CMD_MOVI); | 298 | its_encode_cmd(cmd, GITS_CMD_MOVI); |
277 | its_encode_devid(cmd, desc->its_movi_cmd.dev->device_id); | 299 | its_encode_devid(cmd, desc->its_movi_cmd.dev->device_id); |
278 | its_encode_event_id(cmd, desc->its_movi_cmd.id); | 300 | its_encode_event_id(cmd, desc->its_movi_cmd.event_id); |
279 | its_encode_collection(cmd, desc->its_movi_cmd.col->col_id); | 301 | its_encode_collection(cmd, desc->its_movi_cmd.col->col_id); |
280 | 302 | ||
281 | its_fixup_cmd(cmd); | 303 | its_fixup_cmd(cmd); |
282 | 304 | ||
283 | return desc->its_movi_cmd.dev->collection; | 305 | return col; |
284 | } | 306 | } |
285 | 307 | ||
286 | static struct its_collection *its_build_discard_cmd(struct its_cmd_block *cmd, | 308 | static struct its_collection *its_build_discard_cmd(struct its_cmd_block *cmd, |
287 | struct its_cmd_desc *desc) | 309 | struct its_cmd_desc *desc) |
288 | { | 310 | { |
311 | struct its_collection *col; | ||
312 | |||
313 | col = dev_event_to_col(desc->its_discard_cmd.dev, | ||
314 | desc->its_discard_cmd.event_id); | ||
315 | |||
289 | its_encode_cmd(cmd, GITS_CMD_DISCARD); | 316 | its_encode_cmd(cmd, GITS_CMD_DISCARD); |
290 | its_encode_devid(cmd, desc->its_discard_cmd.dev->device_id); | 317 | its_encode_devid(cmd, desc->its_discard_cmd.dev->device_id); |
291 | its_encode_event_id(cmd, desc->its_discard_cmd.event_id); | 318 | its_encode_event_id(cmd, desc->its_discard_cmd.event_id); |
292 | 319 | ||
293 | its_fixup_cmd(cmd); | 320 | its_fixup_cmd(cmd); |
294 | 321 | ||
295 | return desc->its_discard_cmd.dev->collection; | 322 | return col; |
296 | } | 323 | } |
297 | 324 | ||
298 | static struct its_collection *its_build_inv_cmd(struct its_cmd_block *cmd, | 325 | static struct its_collection *its_build_inv_cmd(struct its_cmd_block *cmd, |
299 | struct its_cmd_desc *desc) | 326 | struct its_cmd_desc *desc) |
300 | { | 327 | { |
328 | struct its_collection *col; | ||
329 | |||
330 | col = dev_event_to_col(desc->its_inv_cmd.dev, | ||
331 | desc->its_inv_cmd.event_id); | ||
332 | |||
301 | its_encode_cmd(cmd, GITS_CMD_INV); | 333 | its_encode_cmd(cmd, GITS_CMD_INV); |
302 | its_encode_devid(cmd, desc->its_inv_cmd.dev->device_id); | 334 | its_encode_devid(cmd, desc->its_inv_cmd.dev->device_id); |
303 | its_encode_event_id(cmd, desc->its_inv_cmd.event_id); | 335 | its_encode_event_id(cmd, desc->its_inv_cmd.event_id); |
304 | 336 | ||
305 | its_fixup_cmd(cmd); | 337 | its_fixup_cmd(cmd); |
306 | 338 | ||
307 | return desc->its_inv_cmd.dev->collection; | 339 | return col; |
308 | } | 340 | } |
309 | 341 | ||
310 | static struct its_collection *its_build_invall_cmd(struct its_cmd_block *cmd, | 342 | static struct its_collection *its_build_invall_cmd(struct its_cmd_block *cmd, |
@@ -496,7 +528,7 @@ static void its_send_movi(struct its_device *dev, | |||
496 | 528 | ||
497 | desc.its_movi_cmd.dev = dev; | 529 | desc.its_movi_cmd.dev = dev; |
498 | desc.its_movi_cmd.col = col; | 530 | desc.its_movi_cmd.col = col; |
499 | desc.its_movi_cmd.id = id; | 531 | desc.its_movi_cmd.event_id = id; |
500 | 532 | ||
501 | its_send_single_command(dev->its, its_build_movi_cmd, &desc); | 533 | its_send_single_command(dev->its, its_build_movi_cmd, &desc); |
502 | } | 534 | } |
@@ -527,7 +559,7 @@ static void its_send_invall(struct its_node *its, struct its_collection *col) | |||
527 | static inline u32 its_get_event_id(struct irq_data *d) | 559 | static inline u32 its_get_event_id(struct irq_data *d) |
528 | { | 560 | { |
529 | struct its_device *its_dev = irq_data_get_irq_chip_data(d); | 561 | struct its_device *its_dev = irq_data_get_irq_chip_data(d); |
530 | return d->hwirq - its_dev->lpi_base; | 562 | return d->hwirq - its_dev->event_map.lpi_base; |
531 | } | 563 | } |
532 | 564 | ||
533 | static void lpi_set_config(struct irq_data *d, bool enable) | 565 | static void lpi_set_config(struct irq_data *d, bool enable) |
@@ -582,7 +614,7 @@ static int its_set_affinity(struct irq_data *d, const struct cpumask *mask_val, | |||
582 | 614 | ||
583 | target_col = &its_dev->its->collections[cpu]; | 615 | target_col = &its_dev->its->collections[cpu]; |
584 | its_send_movi(its_dev, target_col, id); | 616 | its_send_movi(its_dev, target_col, id); |
585 | its_dev->collection = target_col; | 617 | its_dev->event_map.col_map[id] = cpu; |
586 | 618 | ||
587 | return IRQ_SET_MASK_OK_DONE; | 619 | return IRQ_SET_MASK_OK_DONE; |
588 | } | 620 | } |
@@ -712,8 +744,10 @@ out: | |||
712 | return bitmap; | 744 | return bitmap; |
713 | } | 745 | } |
714 | 746 | ||
715 | static void its_lpi_free(unsigned long *bitmap, int base, int nr_ids) | 747 | static void its_lpi_free(struct event_lpi_map *map) |
716 | { | 748 | { |
749 | int base = map->lpi_base; | ||
750 | int nr_ids = map->nr_lpis; | ||
717 | int lpi; | 751 | int lpi; |
718 | 752 | ||
719 | spin_lock(&lpi_lock); | 753 | spin_lock(&lpi_lock); |
@@ -730,7 +764,8 @@ static void its_lpi_free(unsigned long *bitmap, int base, int nr_ids) | |||
730 | 764 | ||
731 | spin_unlock(&lpi_lock); | 765 | spin_unlock(&lpi_lock); |
732 | 766 | ||
733 | kfree(bitmap); | 767 | kfree(map->lpi_map); |
768 | kfree(map->col_map); | ||
734 | } | 769 | } |
735 | 770 | ||
736 | /* | 771 | /* |
@@ -1098,11 +1133,11 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id, | |||
1098 | struct its_device *dev; | 1133 | struct its_device *dev; |
1099 | unsigned long *lpi_map; | 1134 | unsigned long *lpi_map; |
1100 | unsigned long flags; | 1135 | unsigned long flags; |
1136 | u16 *col_map = NULL; | ||
1101 | void *itt; | 1137 | void *itt; |
1102 | int lpi_base; | 1138 | int lpi_base; |
1103 | int nr_lpis; | 1139 | int nr_lpis; |
1104 | int nr_ites; | 1140 | int nr_ites; |
1105 | int cpu; | ||
1106 | int sz; | 1141 | int sz; |
1107 | 1142 | ||
1108 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 1143 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
@@ -1116,20 +1151,24 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id, | |||
1116 | sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1; | 1151 | sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1; |
1117 | itt = kzalloc(sz, GFP_KERNEL); | 1152 | itt = kzalloc(sz, GFP_KERNEL); |
1118 | lpi_map = its_lpi_alloc_chunks(nvecs, &lpi_base, &nr_lpis); | 1153 | lpi_map = its_lpi_alloc_chunks(nvecs, &lpi_base, &nr_lpis); |
1154 | if (lpi_map) | ||
1155 | col_map = kzalloc(sizeof(*col_map) * nr_lpis, GFP_KERNEL); | ||
1119 | 1156 | ||
1120 | if (!dev || !itt || !lpi_map) { | 1157 | if (!dev || !itt || !lpi_map || !col_map) { |
1121 | kfree(dev); | 1158 | kfree(dev); |
1122 | kfree(itt); | 1159 | kfree(itt); |
1123 | kfree(lpi_map); | 1160 | kfree(lpi_map); |
1161 | kfree(col_map); | ||
1124 | return NULL; | 1162 | return NULL; |
1125 | } | 1163 | } |
1126 | 1164 | ||
1127 | dev->its = its; | 1165 | dev->its = its; |
1128 | dev->itt = itt; | 1166 | dev->itt = itt; |
1129 | dev->nr_ites = nr_ites; | 1167 | dev->nr_ites = nr_ites; |
1130 | dev->lpi_map = lpi_map; | 1168 | dev->event_map.lpi_map = lpi_map; |
1131 | dev->lpi_base = lpi_base; | 1169 | dev->event_map.col_map = col_map; |
1132 | dev->nr_lpis = nr_lpis; | 1170 | dev->event_map.lpi_base = lpi_base; |
1171 | dev->event_map.nr_lpis = nr_lpis; | ||
1133 | dev->device_id = dev_id; | 1172 | dev->device_id = dev_id; |
1134 | INIT_LIST_HEAD(&dev->entry); | 1173 | INIT_LIST_HEAD(&dev->entry); |
1135 | 1174 | ||
@@ -1137,10 +1176,6 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id, | |||
1137 | list_add(&dev->entry, &its->its_device_list); | 1176 | list_add(&dev->entry, &its->its_device_list); |
1138 | raw_spin_unlock_irqrestore(&its->lock, flags); | 1177 | raw_spin_unlock_irqrestore(&its->lock, flags); |
1139 | 1178 | ||
1140 | /* Bind the device to the first possible CPU */ | ||
1141 | cpu = cpumask_first(cpu_online_mask); | ||
1142 | dev->collection = &its->collections[cpu]; | ||
1143 | |||
1144 | /* Map device to its ITT */ | 1179 | /* Map device to its ITT */ |
1145 | its_send_mapd(dev, 1); | 1180 | its_send_mapd(dev, 1); |
1146 | 1181 | ||
@@ -1162,12 +1197,13 @@ static int its_alloc_device_irq(struct its_device *dev, irq_hw_number_t *hwirq) | |||
1162 | { | 1197 | { |
1163 | int idx; | 1198 | int idx; |
1164 | 1199 | ||
1165 | idx = find_first_zero_bit(dev->lpi_map, dev->nr_lpis); | 1200 | idx = find_first_zero_bit(dev->event_map.lpi_map, |
1166 | if (idx == dev->nr_lpis) | 1201 | dev->event_map.nr_lpis); |
1202 | if (idx == dev->event_map.nr_lpis) | ||
1167 | return -ENOSPC; | 1203 | return -ENOSPC; |
1168 | 1204 | ||
1169 | *hwirq = dev->lpi_base + idx; | 1205 | *hwirq = dev->event_map.lpi_base + idx; |
1170 | set_bit(idx, dev->lpi_map); | 1206 | set_bit(idx, dev->event_map.lpi_map); |
1171 | 1207 | ||
1172 | return 0; | 1208 | return 0; |
1173 | } | 1209 | } |
@@ -1287,7 +1323,8 @@ static int its_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, | |||
1287 | irq_domain_set_hwirq_and_chip(domain, virq + i, | 1323 | irq_domain_set_hwirq_and_chip(domain, virq + i, |
1288 | hwirq, &its_irq_chip, its_dev); | 1324 | hwirq, &its_irq_chip, its_dev); |
1289 | dev_dbg(info->scratchpad[1].ptr, "ID:%d pID:%d vID:%d\n", | 1325 | dev_dbg(info->scratchpad[1].ptr, "ID:%d pID:%d vID:%d\n", |
1290 | (int)(hwirq - its_dev->lpi_base), (int)hwirq, virq + i); | 1326 | (int)(hwirq - its_dev->event_map.lpi_base), |
1327 | (int)hwirq, virq + i); | ||
1291 | } | 1328 | } |
1292 | 1329 | ||
1293 | return 0; | 1330 | return 0; |
@@ -1299,6 +1336,9 @@ static void its_irq_domain_activate(struct irq_domain *domain, | |||
1299 | struct its_device *its_dev = irq_data_get_irq_chip_data(d); | 1336 | struct its_device *its_dev = irq_data_get_irq_chip_data(d); |
1300 | u32 event = its_get_event_id(d); | 1337 | u32 event = its_get_event_id(d); |
1301 | 1338 | ||
1339 | /* Bind the LPI to the first possible CPU */ | ||
1340 | its_dev->event_map.col_map[event] = cpumask_first(cpu_online_mask); | ||
1341 | |||
1302 | /* Map the GIC IRQ and event to the device */ | 1342 | /* Map the GIC IRQ and event to the device */ |
1303 | its_send_mapvi(its_dev, d->hwirq, event); | 1343 | its_send_mapvi(its_dev, d->hwirq, event); |
1304 | } | 1344 | } |
@@ -1326,17 +1366,16 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, | |||
1326 | u32 event = its_get_event_id(data); | 1366 | u32 event = its_get_event_id(data); |
1327 | 1367 | ||
1328 | /* Mark interrupt index as unused */ | 1368 | /* Mark interrupt index as unused */ |
1329 | clear_bit(event, its_dev->lpi_map); | 1369 | clear_bit(event, its_dev->event_map.lpi_map); |
1330 | 1370 | ||
1331 | /* Nuke the entry in the domain */ | 1371 | /* Nuke the entry in the domain */ |
1332 | irq_domain_reset_irq_data(data); | 1372 | irq_domain_reset_irq_data(data); |
1333 | } | 1373 | } |
1334 | 1374 | ||
1335 | /* If all interrupts have been freed, start mopping the floor */ | 1375 | /* If all interrupts have been freed, start mopping the floor */ |
1336 | if (bitmap_empty(its_dev->lpi_map, its_dev->nr_lpis)) { | 1376 | if (bitmap_empty(its_dev->event_map.lpi_map, |
1337 | its_lpi_free(its_dev->lpi_map, | 1377 | its_dev->event_map.nr_lpis)) { |
1338 | its_dev->lpi_base, | 1378 | its_lpi_free(&its_dev->event_map); |
1339 | its_dev->nr_lpis); | ||
1340 | 1379 | ||
1341 | /* Unmap device/itt */ | 1380 | /* Unmap device/itt */ |
1342 | its_send_mapd(its_dev, 0); | 1381 | its_send_mapd(its_dev, 0); |
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 80fde37076c4..29c544d0aaa9 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
@@ -1051,7 +1051,7 @@ gic_acpi_parse_madt_cpu(struct acpi_subtable_header *header, | |||
1051 | 1051 | ||
1052 | processor = (struct acpi_madt_generic_interrupt *)header; | 1052 | processor = (struct acpi_madt_generic_interrupt *)header; |
1053 | 1053 | ||
1054 | if (BAD_MADT_ENTRY(processor, end)) | 1054 | if (BAD_MADT_GICC_ENTRY(processor, end)) |
1055 | return -EINVAL; | 1055 | return -EINVAL; |
1056 | 1056 | ||
1057 | /* | 1057 | /* |
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c index e670f651166d..2d36eca76bef 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c | |||
@@ -256,16 +256,6 @@ int gic_get_c0_fdc_int(void) | |||
256 | return MIPS_CPU_IRQ_BASE + cp0_fdc_irq; | 256 | return MIPS_CPU_IRQ_BASE + cp0_fdc_irq; |
257 | } | 257 | } |
258 | 258 | ||
259 | /* | ||
260 | * Some cores claim the FDC is routable but it doesn't actually seem to | ||
261 | * be connected. | ||
262 | */ | ||
263 | switch (current_cpu_type()) { | ||
264 | case CPU_INTERAPTIV: | ||
265 | case CPU_PROAPTIV: | ||
266 | return -1; | ||
267 | } | ||
268 | |||
269 | return irq_create_mapping(gic_irq_domain, | 259 | return irq_create_mapping(gic_irq_domain, |
270 | GIC_LOCAL_TO_HWIRQ(GIC_LOCAL_INT_FDC)); | 260 | GIC_LOCAL_TO_HWIRQ(GIC_LOCAL_INT_FDC)); |
271 | } | 261 | } |
diff --git a/drivers/irqchip/spear-shirq.c b/drivers/irqchip/spear-shirq.c index ee175d2b9926..4cbd9c5dc1e6 100644 --- a/drivers/irqchip/spear-shirq.c +++ b/drivers/irqchip/spear-shirq.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * SPEAr platform shared irq layer source file | 2 | * SPEAr platform shared irq layer source file |
3 | * | 3 | * |
4 | * Copyright (C) 2009-2012 ST Microelectronics | 4 | * Copyright (C) 2009-2012 ST Microelectronics |
5 | * Viresh Kumar <viresh.linux@gmail.com> | 5 | * Viresh Kumar <vireshk@kernel.org> |
6 | * | 6 | * |
7 | * Copyright (C) 2012 ST Microelectronics | 7 | * Copyright (C) 2012 ST Microelectronics |
8 | * Shiraz Hashim <shiraz.linux.kernel@gmail.com> | 8 | * Shiraz Hashim <shiraz.linux.kernel@gmail.com> |
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c index 8c91fd5eb6fd..375be509e95f 100644 --- a/drivers/isdn/gigaset/ser-gigaset.c +++ b/drivers/isdn/gigaset/ser-gigaset.c | |||
@@ -524,9 +524,18 @@ gigaset_tty_open(struct tty_struct *tty) | |||
524 | cs->hw.ser->tty = tty; | 524 | cs->hw.ser->tty = tty; |
525 | atomic_set(&cs->hw.ser->refcnt, 1); | 525 | atomic_set(&cs->hw.ser->refcnt, 1); |
526 | init_completion(&cs->hw.ser->dead_cmp); | 526 | init_completion(&cs->hw.ser->dead_cmp); |
527 | |||
528 | tty->disc_data = cs; | 527 | tty->disc_data = cs; |
529 | 528 | ||
529 | /* Set the amount of data we're willing to receive per call | ||
530 | * from the hardware driver to half of the input buffer size | ||
531 | * to leave some reserve. | ||
532 | * Note: We don't do flow control towards the hardware driver. | ||
533 | * If more data is received than will fit into the input buffer, | ||
534 | * it will be dropped and an error will be logged. This should | ||
535 | * never happen as the device is slow and the buffer size ample. | ||
536 | */ | ||
537 | tty->receive_room = RBUFSIZE/2; | ||
538 | |||
530 | /* OK.. Initialization of the datastructures and the HW is done.. Now | 539 | /* OK.. Initialization of the datastructures and the HW is done.. Now |
531 | * startup system and notify the LL that we are ready to run | 540 | * startup system and notify the LL that we are ready to run |
532 | */ | 541 | */ |
@@ -598,28 +607,6 @@ static int gigaset_tty_hangup(struct tty_struct *tty) | |||
598 | } | 607 | } |
599 | 608 | ||
600 | /* | 609 | /* |
601 | * Read on the tty. | ||
602 | * Unused, received data goes only to the Gigaset driver. | ||
603 | */ | ||
604 | static ssize_t | ||
605 | gigaset_tty_read(struct tty_struct *tty, struct file *file, | ||
606 | unsigned char __user *buf, size_t count) | ||
607 | { | ||
608 | return -EAGAIN; | ||
609 | } | ||
610 | |||
611 | /* | ||
612 | * Write on the tty. | ||
613 | * Unused, transmit data comes only from the Gigaset driver. | ||
614 | */ | ||
615 | static ssize_t | ||
616 | gigaset_tty_write(struct tty_struct *tty, struct file *file, | ||
617 | const unsigned char *buf, size_t count) | ||
618 | { | ||
619 | return -EAGAIN; | ||
620 | } | ||
621 | |||
622 | /* | ||
623 | * Ioctl on the tty. | 610 | * Ioctl on the tty. |
624 | * Called in process context only. | 611 | * Called in process context only. |
625 | * May be re-entered by multiple ioctl calling threads. | 612 | * May be re-entered by multiple ioctl calling threads. |
@@ -752,8 +739,6 @@ static struct tty_ldisc_ops gigaset_ldisc = { | |||
752 | .open = gigaset_tty_open, | 739 | .open = gigaset_tty_open, |
753 | .close = gigaset_tty_close, | 740 | .close = gigaset_tty_close, |
754 | .hangup = gigaset_tty_hangup, | 741 | .hangup = gigaset_tty_hangup, |
755 | .read = gigaset_tty_read, | ||
756 | .write = gigaset_tty_write, | ||
757 | .ioctl = gigaset_tty_ioctl, | 742 | .ioctl = gigaset_tty_ioctl, |
758 | .receive_buf = gigaset_tty_receive, | 743 | .receive_buf = gigaset_tty_receive, |
759 | .write_wakeup = gigaset_tty_wakeup, | 744 | .write_wakeup = gigaset_tty_wakeup, |
diff --git a/drivers/md/bcache/closure.h b/drivers/md/bcache/closure.h index a08e3eeac3c5..79a6d63e8ed3 100644 --- a/drivers/md/bcache/closure.h +++ b/drivers/md/bcache/closure.h | |||
@@ -320,7 +320,6 @@ static inline void closure_wake_up(struct closure_waitlist *list) | |||
320 | do { \ | 320 | do { \ |
321 | set_closure_fn(_cl, _fn, _wq); \ | 321 | set_closure_fn(_cl, _fn, _wq); \ |
322 | closure_sub(_cl, CLOSURE_RUNNING + 1); \ | 322 | closure_sub(_cl, CLOSURE_RUNNING + 1); \ |
323 | return; \ | ||
324 | } while (0) | 323 | } while (0) |
325 | 324 | ||
326 | /** | 325 | /** |
@@ -349,7 +348,6 @@ do { \ | |||
349 | do { \ | 348 | do { \ |
350 | set_closure_fn(_cl, _fn, _wq); \ | 349 | set_closure_fn(_cl, _fn, _wq); \ |
351 | closure_queue(_cl); \ | 350 | closure_queue(_cl); \ |
352 | return; \ | ||
353 | } while (0) | 351 | } while (0) |
354 | 352 | ||
355 | /** | 353 | /** |
@@ -365,7 +363,6 @@ do { \ | |||
365 | do { \ | 363 | do { \ |
366 | set_closure_fn(_cl, _destructor, NULL); \ | 364 | set_closure_fn(_cl, _destructor, NULL); \ |
367 | closure_sub(_cl, CLOSURE_RUNNING - CLOSURE_DESTRUCTOR + 1); \ | 365 | closure_sub(_cl, CLOSURE_RUNNING - CLOSURE_DESTRUCTOR + 1); \ |
368 | return; \ | ||
369 | } while (0) | 366 | } while (0) |
370 | 367 | ||
371 | /** | 368 | /** |
diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c index cb64e64a4789..bf6a9ca18403 100644 --- a/drivers/md/bcache/io.c +++ b/drivers/md/bcache/io.c | |||
@@ -105,6 +105,7 @@ void bch_generic_make_request(struct bio *bio, struct bio_split_pool *p) | |||
105 | } while (n != bio); | 105 | } while (n != bio); |
106 | 106 | ||
107 | continue_at(&s->cl, bch_bio_submit_split_done, NULL); | 107 | continue_at(&s->cl, bch_bio_submit_split_done, NULL); |
108 | return; | ||
108 | submit: | 109 | submit: |
109 | generic_make_request(bio); | 110 | generic_make_request(bio); |
110 | } | 111 | } |
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index ce64fc851251..418607a6ba33 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c | |||
@@ -592,12 +592,14 @@ static void journal_write_unlocked(struct closure *cl) | |||
592 | 592 | ||
593 | if (!w->need_write) { | 593 | if (!w->need_write) { |
594 | closure_return_with_destructor(cl, journal_write_unlock); | 594 | closure_return_with_destructor(cl, journal_write_unlock); |
595 | return; | ||
595 | } else if (journal_full(&c->journal)) { | 596 | } else if (journal_full(&c->journal)) { |
596 | journal_reclaim(c); | 597 | journal_reclaim(c); |
597 | spin_unlock(&c->journal.lock); | 598 | spin_unlock(&c->journal.lock); |
598 | 599 | ||
599 | btree_flush_write(c); | 600 | btree_flush_write(c); |
600 | continue_at(cl, journal_write, system_wq); | 601 | continue_at(cl, journal_write, system_wq); |
602 | return; | ||
601 | } | 603 | } |
602 | 604 | ||
603 | c->journal.blocks_free -= set_blocks(w->data, block_bytes(c)); | 605 | c->journal.blocks_free -= set_blocks(w->data, block_bytes(c)); |
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 4afb2d26b148..f292790997d7 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c | |||
@@ -88,8 +88,10 @@ static void bch_data_insert_keys(struct closure *cl) | |||
88 | if (journal_ref) | 88 | if (journal_ref) |
89 | atomic_dec_bug(journal_ref); | 89 | atomic_dec_bug(journal_ref); |
90 | 90 | ||
91 | if (!op->insert_data_done) | 91 | if (!op->insert_data_done) { |
92 | continue_at(cl, bch_data_insert_start, op->wq); | 92 | continue_at(cl, bch_data_insert_start, op->wq); |
93 | return; | ||
94 | } | ||
93 | 95 | ||
94 | bch_keylist_free(&op->insert_keys); | 96 | bch_keylist_free(&op->insert_keys); |
95 | closure_return(cl); | 97 | closure_return(cl); |
@@ -216,8 +218,10 @@ static void bch_data_insert_start(struct closure *cl) | |||
216 | /* 1 for the device pointer and 1 for the chksum */ | 218 | /* 1 for the device pointer and 1 for the chksum */ |
217 | if (bch_keylist_realloc(&op->insert_keys, | 219 | if (bch_keylist_realloc(&op->insert_keys, |
218 | 3 + (op->csum ? 1 : 0), | 220 | 3 + (op->csum ? 1 : 0), |
219 | op->c)) | 221 | op->c)) { |
220 | continue_at(cl, bch_data_insert_keys, op->wq); | 222 | continue_at(cl, bch_data_insert_keys, op->wq); |
223 | return; | ||
224 | } | ||
221 | 225 | ||
222 | k = op->insert_keys.top; | 226 | k = op->insert_keys.top; |
223 | bkey_init(k); | 227 | bkey_init(k); |
@@ -255,6 +259,7 @@ static void bch_data_insert_start(struct closure *cl) | |||
255 | 259 | ||
256 | op->insert_data_done = true; | 260 | op->insert_data_done = true; |
257 | continue_at(cl, bch_data_insert_keys, op->wq); | 261 | continue_at(cl, bch_data_insert_keys, op->wq); |
262 | return; | ||
258 | err: | 263 | err: |
259 | /* bch_alloc_sectors() blocks if s->writeback = true */ | 264 | /* bch_alloc_sectors() blocks if s->writeback = true */ |
260 | BUG_ON(op->writeback); | 265 | BUG_ON(op->writeback); |
@@ -576,8 +581,10 @@ static void cache_lookup(struct closure *cl) | |||
576 | ret = bch_btree_map_keys(&s->op, s->iop.c, | 581 | ret = bch_btree_map_keys(&s->op, s->iop.c, |
577 | &KEY(s->iop.inode, bio->bi_iter.bi_sector, 0), | 582 | &KEY(s->iop.inode, bio->bi_iter.bi_sector, 0), |
578 | cache_lookup_fn, MAP_END_KEY); | 583 | cache_lookup_fn, MAP_END_KEY); |
579 | if (ret == -EAGAIN) | 584 | if (ret == -EAGAIN) { |
580 | continue_at(cl, cache_lookup, bcache_wq); | 585 | continue_at(cl, cache_lookup, bcache_wq); |
586 | return; | ||
587 | } | ||
581 | 588 | ||
582 | closure_return(cl); | 589 | closure_return(cl); |
583 | } | 590 | } |
@@ -1085,6 +1092,7 @@ static void flash_dev_make_request(struct request_queue *q, struct bio *bio) | |||
1085 | continue_at_nobarrier(&s->cl, | 1092 | continue_at_nobarrier(&s->cl, |
1086 | flash_dev_nodata, | 1093 | flash_dev_nodata, |
1087 | bcache_wq); | 1094 | bcache_wq); |
1095 | return; | ||
1088 | } else if (rw) { | 1096 | } else if (rw) { |
1089 | bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys, | 1097 | bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys, |
1090 | &KEY(d->id, bio->bi_iter.bi_sector, 0), | 1098 | &KEY(d->id, bio->bi_iter.bi_sector, 0), |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index ed2346ddf4c9..e51de52eeb94 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -494,7 +494,7 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap) | |||
494 | bitmap_super_t *sb; | 494 | bitmap_super_t *sb; |
495 | unsigned long chunksize, daemon_sleep, write_behind; | 495 | unsigned long chunksize, daemon_sleep, write_behind; |
496 | 496 | ||
497 | bitmap->storage.sb_page = alloc_page(GFP_KERNEL); | 497 | bitmap->storage.sb_page = alloc_page(GFP_KERNEL | __GFP_ZERO); |
498 | if (bitmap->storage.sb_page == NULL) | 498 | if (bitmap->storage.sb_page == NULL) |
499 | return -ENOMEM; | 499 | return -ENOMEM; |
500 | bitmap->storage.sb_page->index = 0; | 500 | bitmap->storage.sb_page->index = 0; |
@@ -541,6 +541,7 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap) | |||
541 | sb->state = cpu_to_le32(bitmap->flags); | 541 | sb->state = cpu_to_le32(bitmap->flags); |
542 | bitmap->events_cleared = bitmap->mddev->events; | 542 | bitmap->events_cleared = bitmap->mddev->events; |
543 | sb->events_cleared = cpu_to_le64(bitmap->mddev->events); | 543 | sb->events_cleared = cpu_to_le64(bitmap->mddev->events); |
544 | bitmap->mddev->bitmap_info.nodes = 0; | ||
544 | 545 | ||
545 | kunmap_atomic(sb); | 546 | kunmap_atomic(sb); |
546 | 547 | ||
@@ -558,6 +559,7 @@ static int bitmap_read_sb(struct bitmap *bitmap) | |||
558 | unsigned long sectors_reserved = 0; | 559 | unsigned long sectors_reserved = 0; |
559 | int err = -EINVAL; | 560 | int err = -EINVAL; |
560 | struct page *sb_page; | 561 | struct page *sb_page; |
562 | loff_t offset = bitmap->mddev->bitmap_info.offset; | ||
561 | 563 | ||
562 | if (!bitmap->storage.file && !bitmap->mddev->bitmap_info.offset) { | 564 | if (!bitmap->storage.file && !bitmap->mddev->bitmap_info.offset) { |
563 | chunksize = 128 * 1024 * 1024; | 565 | chunksize = 128 * 1024 * 1024; |
@@ -584,9 +586,9 @@ re_read: | |||
584 | bm_blocks = ((bm_blocks+7) >> 3) + sizeof(bitmap_super_t); | 586 | bm_blocks = ((bm_blocks+7) >> 3) + sizeof(bitmap_super_t); |
585 | /* to 4k blocks */ | 587 | /* to 4k blocks */ |
586 | bm_blocks = DIV_ROUND_UP_SECTOR_T(bm_blocks, 4096); | 588 | bm_blocks = DIV_ROUND_UP_SECTOR_T(bm_blocks, 4096); |
587 | bitmap->mddev->bitmap_info.offset += bitmap->cluster_slot * (bm_blocks << 3); | 589 | offset = bitmap->mddev->bitmap_info.offset + (bitmap->cluster_slot * (bm_blocks << 3)); |
588 | pr_info("%s:%d bm slot: %d offset: %llu\n", __func__, __LINE__, | 590 | pr_info("%s:%d bm slot: %d offset: %llu\n", __func__, __LINE__, |
589 | bitmap->cluster_slot, (unsigned long long)bitmap->mddev->bitmap_info.offset); | 591 | bitmap->cluster_slot, offset); |
590 | } | 592 | } |
591 | 593 | ||
592 | if (bitmap->storage.file) { | 594 | if (bitmap->storage.file) { |
@@ -597,7 +599,7 @@ re_read: | |||
597 | bitmap, bytes, sb_page); | 599 | bitmap, bytes, sb_page); |
598 | } else { | 600 | } else { |
599 | err = read_sb_page(bitmap->mddev, | 601 | err = read_sb_page(bitmap->mddev, |
600 | bitmap->mddev->bitmap_info.offset, | 602 | offset, |
601 | sb_page, | 603 | sb_page, |
602 | 0, sizeof(bitmap_super_t)); | 604 | 0, sizeof(bitmap_super_t)); |
603 | } | 605 | } |
@@ -611,8 +613,16 @@ re_read: | |||
611 | daemon_sleep = le32_to_cpu(sb->daemon_sleep) * HZ; | 613 | daemon_sleep = le32_to_cpu(sb->daemon_sleep) * HZ; |
612 | write_behind = le32_to_cpu(sb->write_behind); | 614 | write_behind = le32_to_cpu(sb->write_behind); |
613 | sectors_reserved = le32_to_cpu(sb->sectors_reserved); | 615 | sectors_reserved = le32_to_cpu(sb->sectors_reserved); |
614 | nodes = le32_to_cpu(sb->nodes); | 616 | /* XXX: This is a hack to ensure that we don't use clustering |
615 | strlcpy(bitmap->mddev->bitmap_info.cluster_name, sb->cluster_name, 64); | 617 | * in case: |
618 | * - dm-raid is in use and | ||
619 | * - the nodes written in bitmap_sb is erroneous. | ||
620 | */ | ||
621 | if (!bitmap->mddev->sync_super) { | ||
622 | nodes = le32_to_cpu(sb->nodes); | ||
623 | strlcpy(bitmap->mddev->bitmap_info.cluster_name, | ||
624 | sb->cluster_name, 64); | ||
625 | } | ||
616 | 626 | ||
617 | /* verify that the bitmap-specific fields are valid */ | 627 | /* verify that the bitmap-specific fields are valid */ |
618 | if (sb->magic != cpu_to_le32(BITMAP_MAGIC)) | 628 | if (sb->magic != cpu_to_le32(BITMAP_MAGIC)) |
@@ -671,7 +681,7 @@ out: | |||
671 | kunmap_atomic(sb); | 681 | kunmap_atomic(sb); |
672 | /* Assiging chunksize is required for "re_read" */ | 682 | /* Assiging chunksize is required for "re_read" */ |
673 | bitmap->mddev->bitmap_info.chunksize = chunksize; | 683 | bitmap->mddev->bitmap_info.chunksize = chunksize; |
674 | if (nodes && (bitmap->cluster_slot < 0)) { | 684 | if (err == 0 && nodes && (bitmap->cluster_slot < 0)) { |
675 | err = md_setup_cluster(bitmap->mddev, nodes); | 685 | err = md_setup_cluster(bitmap->mddev, nodes); |
676 | if (err) { | 686 | if (err) { |
677 | pr_err("%s: Could not setup cluster service (%d)\n", | 687 | pr_err("%s: Could not setup cluster service (%d)\n", |
@@ -1866,10 +1876,6 @@ int bitmap_copy_from_slot(struct mddev *mddev, int slot, | |||
1866 | if (IS_ERR(bitmap)) | 1876 | if (IS_ERR(bitmap)) |
1867 | return PTR_ERR(bitmap); | 1877 | return PTR_ERR(bitmap); |
1868 | 1878 | ||
1869 | rv = bitmap_read_sb(bitmap); | ||
1870 | if (rv) | ||
1871 | goto err; | ||
1872 | |||
1873 | rv = bitmap_init_from_disk(bitmap, 0); | 1879 | rv = bitmap_init_from_disk(bitmap, 0); |
1874 | if (rv) | 1880 | if (rv) |
1875 | goto err; | 1881 | goto err; |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 1b4e1756b169..b680da5d7b93 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -424,7 +424,6 @@ static void free_migration(struct dm_cache_migration *mg) | |||
424 | wake_up(&cache->migration_wait); | 424 | wake_up(&cache->migration_wait); |
425 | 425 | ||
426 | mempool_free(mg, cache->migration_pool); | 426 | mempool_free(mg, cache->migration_pool); |
427 | wake_worker(cache); | ||
428 | } | 427 | } |
429 | 428 | ||
430 | static int prealloc_data_structs(struct cache *cache, struct prealloc *p) | 429 | static int prealloc_data_structs(struct cache *cache, struct prealloc *p) |
@@ -1947,6 +1946,7 @@ static int commit_if_needed(struct cache *cache) | |||
1947 | 1946 | ||
1948 | static void process_deferred_bios(struct cache *cache) | 1947 | static void process_deferred_bios(struct cache *cache) |
1949 | { | 1948 | { |
1949 | bool prealloc_used = false; | ||
1950 | unsigned long flags; | 1950 | unsigned long flags; |
1951 | struct bio_list bios; | 1951 | struct bio_list bios; |
1952 | struct bio *bio; | 1952 | struct bio *bio; |
@@ -1981,13 +1981,16 @@ static void process_deferred_bios(struct cache *cache) | |||
1981 | process_discard_bio(cache, &structs, bio); | 1981 | process_discard_bio(cache, &structs, bio); |
1982 | else | 1982 | else |
1983 | process_bio(cache, &structs, bio); | 1983 | process_bio(cache, &structs, bio); |
1984 | prealloc_used = true; | ||
1984 | } | 1985 | } |
1985 | 1986 | ||
1986 | prealloc_free_structs(cache, &structs); | 1987 | if (prealloc_used) |
1988 | prealloc_free_structs(cache, &structs); | ||
1987 | } | 1989 | } |
1988 | 1990 | ||
1989 | static void process_deferred_cells(struct cache *cache) | 1991 | static void process_deferred_cells(struct cache *cache) |
1990 | { | 1992 | { |
1993 | bool prealloc_used = false; | ||
1991 | unsigned long flags; | 1994 | unsigned long flags; |
1992 | struct dm_bio_prison_cell *cell, *tmp; | 1995 | struct dm_bio_prison_cell *cell, *tmp; |
1993 | struct list_head cells; | 1996 | struct list_head cells; |
@@ -2015,9 +2018,11 @@ static void process_deferred_cells(struct cache *cache) | |||
2015 | } | 2018 | } |
2016 | 2019 | ||
2017 | process_cell(cache, &structs, cell); | 2020 | process_cell(cache, &structs, cell); |
2021 | prealloc_used = true; | ||
2018 | } | 2022 | } |
2019 | 2023 | ||
2020 | prealloc_free_structs(cache, &structs); | 2024 | if (prealloc_used) |
2025 | prealloc_free_structs(cache, &structs); | ||
2021 | } | 2026 | } |
2022 | 2027 | ||
2023 | static void process_deferred_flush_bios(struct cache *cache, bool submit_bios) | 2028 | static void process_deferred_flush_bios(struct cache *cache, bool submit_bios) |
@@ -2062,7 +2067,7 @@ static void process_deferred_writethrough_bios(struct cache *cache) | |||
2062 | 2067 | ||
2063 | static void writeback_some_dirty_blocks(struct cache *cache) | 2068 | static void writeback_some_dirty_blocks(struct cache *cache) |
2064 | { | 2069 | { |
2065 | int r = 0; | 2070 | bool prealloc_used = false; |
2066 | dm_oblock_t oblock; | 2071 | dm_oblock_t oblock; |
2067 | dm_cblock_t cblock; | 2072 | dm_cblock_t cblock; |
2068 | struct prealloc structs; | 2073 | struct prealloc structs; |
@@ -2072,23 +2077,21 @@ static void writeback_some_dirty_blocks(struct cache *cache) | |||
2072 | memset(&structs, 0, sizeof(structs)); | 2077 | memset(&structs, 0, sizeof(structs)); |
2073 | 2078 | ||
2074 | while (spare_migration_bandwidth(cache)) { | 2079 | while (spare_migration_bandwidth(cache)) { |
2075 | if (prealloc_data_structs(cache, &structs)) | 2080 | if (policy_writeback_work(cache->policy, &oblock, &cblock, busy)) |
2076 | break; | 2081 | break; /* no work to do */ |
2077 | 2082 | ||
2078 | r = policy_writeback_work(cache->policy, &oblock, &cblock, busy); | 2083 | if (prealloc_data_structs(cache, &structs) || |
2079 | if (r) | 2084 | get_cell(cache, oblock, &structs, &old_ocell)) { |
2080 | break; | ||
2081 | |||
2082 | r = get_cell(cache, oblock, &structs, &old_ocell); | ||
2083 | if (r) { | ||
2084 | policy_set_dirty(cache->policy, oblock); | 2085 | policy_set_dirty(cache->policy, oblock); |
2085 | break; | 2086 | break; |
2086 | } | 2087 | } |
2087 | 2088 | ||
2088 | writeback(cache, &structs, oblock, cblock, old_ocell); | 2089 | writeback(cache, &structs, oblock, cblock, old_ocell); |
2090 | prealloc_used = true; | ||
2089 | } | 2091 | } |
2090 | 2092 | ||
2091 | prealloc_free_structs(cache, &structs); | 2093 | if (prealloc_used) |
2094 | prealloc_free_structs(cache, &structs); | ||
2092 | } | 2095 | } |
2093 | 2096 | ||
2094 | /*---------------------------------------------------------------- | 2097 | /*---------------------------------------------------------------- |
@@ -3496,7 +3499,7 @@ static void cache_resume(struct dm_target *ti) | |||
3496 | * <#demotions> <#promotions> <#dirty> | 3499 | * <#demotions> <#promotions> <#dirty> |
3497 | * <#features> <features>* | 3500 | * <#features> <features>* |
3498 | * <#core args> <core args> | 3501 | * <#core args> <core args> |
3499 | * <policy name> <#policy args> <policy args>* <cache metadata mode> | 3502 | * <policy name> <#policy args> <policy args>* <cache metadata mode> <needs_check> |
3500 | */ | 3503 | */ |
3501 | static void cache_status(struct dm_target *ti, status_type_t type, | 3504 | static void cache_status(struct dm_target *ti, status_type_t type, |
3502 | unsigned status_flags, char *result, unsigned maxlen) | 3505 | unsigned status_flags, char *result, unsigned maxlen) |
@@ -3582,6 +3585,11 @@ static void cache_status(struct dm_target *ti, status_type_t type, | |||
3582 | else | 3585 | else |
3583 | DMEMIT("rw "); | 3586 | DMEMIT("rw "); |
3584 | 3587 | ||
3588 | if (dm_cache_metadata_needs_check(cache->cmd)) | ||
3589 | DMEMIT("needs_check "); | ||
3590 | else | ||
3591 | DMEMIT("- "); | ||
3592 | |||
3585 | break; | 3593 | break; |
3586 | 3594 | ||
3587 | case STATUSTYPE_TABLE: | 3595 | case STATUSTYPE_TABLE: |
@@ -3820,7 +3828,7 @@ static void cache_io_hints(struct dm_target *ti, struct queue_limits *limits) | |||
3820 | 3828 | ||
3821 | static struct target_type cache_target = { | 3829 | static struct target_type cache_target = { |
3822 | .name = "cache", | 3830 | .name = "cache", |
3823 | .version = {1, 7, 0}, | 3831 | .version = {1, 8, 0}, |
3824 | .module = THIS_MODULE, | 3832 | .module = THIS_MODULE, |
3825 | .ctr = cache_ctr, | 3833 | .ctr = cache_ctr, |
3826 | .dtr = cache_dtr, | 3834 | .dtr = cache_dtr, |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index c33f61a4cc28..1c50c580215c 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/vmalloc.h> | ||
21 | #include <linux/sort.h> | 22 | #include <linux/sort.h> |
22 | #include <linux/rbtree.h> | 23 | #include <linux/rbtree.h> |
23 | 24 | ||
@@ -268,7 +269,7 @@ struct pool { | |||
268 | process_mapping_fn process_prepared_mapping; | 269 | process_mapping_fn process_prepared_mapping; |
269 | process_mapping_fn process_prepared_discard; | 270 | process_mapping_fn process_prepared_discard; |
270 | 271 | ||
271 | struct dm_bio_prison_cell *cell_sort_array[CELL_SORT_ARRAY_SIZE]; | 272 | struct dm_bio_prison_cell **cell_sort_array; |
272 | }; | 273 | }; |
273 | 274 | ||
274 | static enum pool_mode get_pool_mode(struct pool *pool); | 275 | static enum pool_mode get_pool_mode(struct pool *pool); |
@@ -2281,18 +2282,23 @@ static void do_waker(struct work_struct *ws) | |||
2281 | queue_delayed_work(pool->wq, &pool->waker, COMMIT_PERIOD); | 2282 | queue_delayed_work(pool->wq, &pool->waker, COMMIT_PERIOD); |
2282 | } | 2283 | } |
2283 | 2284 | ||
2285 | static void notify_of_pool_mode_change_to_oods(struct pool *pool); | ||
2286 | |||
2284 | /* | 2287 | /* |
2285 | * We're holding onto IO to allow userland time to react. After the | 2288 | * We're holding onto IO to allow userland time to react. After the |
2286 | * timeout either the pool will have been resized (and thus back in | 2289 | * timeout either the pool will have been resized (and thus back in |
2287 | * PM_WRITE mode), or we degrade to PM_READ_ONLY and start erroring IO. | 2290 | * PM_WRITE mode), or we degrade to PM_OUT_OF_DATA_SPACE w/ error_if_no_space. |
2288 | */ | 2291 | */ |
2289 | static void do_no_space_timeout(struct work_struct *ws) | 2292 | static void do_no_space_timeout(struct work_struct *ws) |
2290 | { | 2293 | { |
2291 | struct pool *pool = container_of(to_delayed_work(ws), struct pool, | 2294 | struct pool *pool = container_of(to_delayed_work(ws), struct pool, |
2292 | no_space_timeout); | 2295 | no_space_timeout); |
2293 | 2296 | ||
2294 | if (get_pool_mode(pool) == PM_OUT_OF_DATA_SPACE && !pool->pf.error_if_no_space) | 2297 | if (get_pool_mode(pool) == PM_OUT_OF_DATA_SPACE && !pool->pf.error_if_no_space) { |
2295 | set_pool_mode(pool, PM_READ_ONLY); | 2298 | pool->pf.error_if_no_space = true; |
2299 | notify_of_pool_mode_change_to_oods(pool); | ||
2300 | error_retry_list(pool); | ||
2301 | } | ||
2296 | } | 2302 | } |
2297 | 2303 | ||
2298 | /*----------------------------------------------------------------*/ | 2304 | /*----------------------------------------------------------------*/ |
@@ -2370,6 +2376,14 @@ static void notify_of_pool_mode_change(struct pool *pool, const char *new_mode) | |||
2370 | dm_device_name(pool->pool_md), new_mode); | 2376 | dm_device_name(pool->pool_md), new_mode); |
2371 | } | 2377 | } |
2372 | 2378 | ||
2379 | static void notify_of_pool_mode_change_to_oods(struct pool *pool) | ||
2380 | { | ||
2381 | if (!pool->pf.error_if_no_space) | ||
2382 | notify_of_pool_mode_change(pool, "out-of-data-space (queue IO)"); | ||
2383 | else | ||
2384 | notify_of_pool_mode_change(pool, "out-of-data-space (error IO)"); | ||
2385 | } | ||
2386 | |||
2373 | static bool passdown_enabled(struct pool_c *pt) | 2387 | static bool passdown_enabled(struct pool_c *pt) |
2374 | { | 2388 | { |
2375 | return pt->adjusted_pf.discard_passdown; | 2389 | return pt->adjusted_pf.discard_passdown; |
@@ -2454,7 +2468,7 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) | |||
2454 | * frequently seeing this mode. | 2468 | * frequently seeing this mode. |
2455 | */ | 2469 | */ |
2456 | if (old_mode != new_mode) | 2470 | if (old_mode != new_mode) |
2457 | notify_of_pool_mode_change(pool, "out-of-data-space"); | 2471 | notify_of_pool_mode_change_to_oods(pool); |
2458 | pool->process_bio = process_bio_read_only; | 2472 | pool->process_bio = process_bio_read_only; |
2459 | pool->process_discard = process_discard_bio; | 2473 | pool->process_discard = process_discard_bio; |
2460 | pool->process_cell = process_cell_read_only; | 2474 | pool->process_cell = process_cell_read_only; |
@@ -2777,6 +2791,7 @@ static void __pool_destroy(struct pool *pool) | |||
2777 | { | 2791 | { |
2778 | __pool_table_remove(pool); | 2792 | __pool_table_remove(pool); |
2779 | 2793 | ||
2794 | vfree(pool->cell_sort_array); | ||
2780 | if (dm_pool_metadata_close(pool->pmd) < 0) | 2795 | if (dm_pool_metadata_close(pool->pmd) < 0) |
2781 | DMWARN("%s: dm_pool_metadata_close() failed.", __func__); | 2796 | DMWARN("%s: dm_pool_metadata_close() failed.", __func__); |
2782 | 2797 | ||
@@ -2889,6 +2904,13 @@ static struct pool *pool_create(struct mapped_device *pool_md, | |||
2889 | goto bad_mapping_pool; | 2904 | goto bad_mapping_pool; |
2890 | } | 2905 | } |
2891 | 2906 | ||
2907 | pool->cell_sort_array = vmalloc(sizeof(*pool->cell_sort_array) * CELL_SORT_ARRAY_SIZE); | ||
2908 | if (!pool->cell_sort_array) { | ||
2909 | *error = "Error allocating cell sort array"; | ||
2910 | err_p = ERR_PTR(-ENOMEM); | ||
2911 | goto bad_sort_array; | ||
2912 | } | ||
2913 | |||
2892 | pool->ref_count = 1; | 2914 | pool->ref_count = 1; |
2893 | pool->last_commit_jiffies = jiffies; | 2915 | pool->last_commit_jiffies = jiffies; |
2894 | pool->pool_md = pool_md; | 2916 | pool->pool_md = pool_md; |
@@ -2897,6 +2919,8 @@ static struct pool *pool_create(struct mapped_device *pool_md, | |||
2897 | 2919 | ||
2898 | return pool; | 2920 | return pool; |
2899 | 2921 | ||
2922 | bad_sort_array: | ||
2923 | mempool_destroy(pool->mapping_pool); | ||
2900 | bad_mapping_pool: | 2924 | bad_mapping_pool: |
2901 | dm_deferred_set_destroy(pool->all_io_ds); | 2925 | dm_deferred_set_destroy(pool->all_io_ds); |
2902 | bad_all_io_ds: | 2926 | bad_all_io_ds: |
@@ -3714,6 +3738,7 @@ static void emit_flags(struct pool_features *pf, char *result, | |||
3714 | * Status line is: | 3738 | * Status line is: |
3715 | * <transaction id> <used metadata sectors>/<total metadata sectors> | 3739 | * <transaction id> <used metadata sectors>/<total metadata sectors> |
3716 | * <used data sectors>/<total data sectors> <held metadata root> | 3740 | * <used data sectors>/<total data sectors> <held metadata root> |
3741 | * <pool mode> <discard config> <no space config> <needs_check> | ||
3717 | */ | 3742 | */ |
3718 | static void pool_status(struct dm_target *ti, status_type_t type, | 3743 | static void pool_status(struct dm_target *ti, status_type_t type, |
3719 | unsigned status_flags, char *result, unsigned maxlen) | 3744 | unsigned status_flags, char *result, unsigned maxlen) |
@@ -3815,6 +3840,11 @@ static void pool_status(struct dm_target *ti, status_type_t type, | |||
3815 | else | 3840 | else |
3816 | DMEMIT("queue_if_no_space "); | 3841 | DMEMIT("queue_if_no_space "); |
3817 | 3842 | ||
3843 | if (dm_pool_metadata_needs_check(pool->pmd)) | ||
3844 | DMEMIT("needs_check "); | ||
3845 | else | ||
3846 | DMEMIT("- "); | ||
3847 | |||
3818 | break; | 3848 | break; |
3819 | 3849 | ||
3820 | case STATUSTYPE_TABLE: | 3850 | case STATUSTYPE_TABLE: |
@@ -3918,7 +3948,7 @@ static struct target_type pool_target = { | |||
3918 | .name = "thin-pool", | 3948 | .name = "thin-pool", |
3919 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | | 3949 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | |
3920 | DM_TARGET_IMMUTABLE, | 3950 | DM_TARGET_IMMUTABLE, |
3921 | .version = {1, 15, 0}, | 3951 | .version = {1, 16, 0}, |
3922 | .module = THIS_MODULE, | 3952 | .module = THIS_MODULE, |
3923 | .ctr = pool_ctr, | 3953 | .ctr = pool_ctr, |
3924 | .dtr = pool_dtr, | 3954 | .dtr = pool_dtr, |
@@ -4305,7 +4335,7 @@ static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits) | |||
4305 | 4335 | ||
4306 | static struct target_type thin_target = { | 4336 | static struct target_type thin_target = { |
4307 | .name = "thin", | 4337 | .name = "thin", |
4308 | .version = {1, 15, 0}, | 4338 | .version = {1, 16, 0}, |
4309 | .module = THIS_MODULE, | 4339 | .module = THIS_MODULE, |
4310 | .ctr = thin_ctr, | 4340 | .ctr = thin_ctr, |
4311 | .dtr = thin_dtr, | 4341 | .dtr = thin_dtr, |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index f331d888e7f5..ab37ae114e94 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -1067,13 +1067,10 @@ static void rq_end_stats(struct mapped_device *md, struct request *orig) | |||
1067 | */ | 1067 | */ |
1068 | static void rq_completed(struct mapped_device *md, int rw, bool run_queue) | 1068 | static void rq_completed(struct mapped_device *md, int rw, bool run_queue) |
1069 | { | 1069 | { |
1070 | int nr_requests_pending; | ||
1071 | |||
1072 | atomic_dec(&md->pending[rw]); | 1070 | atomic_dec(&md->pending[rw]); |
1073 | 1071 | ||
1074 | /* nudge anyone waiting on suspend queue */ | 1072 | /* nudge anyone waiting on suspend queue */ |
1075 | nr_requests_pending = md_in_flight(md); | 1073 | if (!md_in_flight(md)) |
1076 | if (!nr_requests_pending) | ||
1077 | wake_up(&md->wait); | 1074 | wake_up(&md->wait); |
1078 | 1075 | ||
1079 | /* | 1076 | /* |
@@ -1085,8 +1082,7 @@ static void rq_completed(struct mapped_device *md, int rw, bool run_queue) | |||
1085 | if (run_queue) { | 1082 | if (run_queue) { |
1086 | if (md->queue->mq_ops) | 1083 | if (md->queue->mq_ops) |
1087 | blk_mq_run_hw_queues(md->queue, true); | 1084 | blk_mq_run_hw_queues(md->queue, true); |
1088 | else if (!nr_requests_pending || | 1085 | else |
1089 | (nr_requests_pending >= md->queue->nr_congestion_on)) | ||
1090 | blk_run_queue_async(md->queue); | 1086 | blk_run_queue_async(md->queue); |
1091 | } | 1087 | } |
1092 | 1088 | ||
@@ -2281,8 +2277,6 @@ static void dm_init_old_md_queue(struct mapped_device *md) | |||
2281 | 2277 | ||
2282 | static void cleanup_mapped_device(struct mapped_device *md) | 2278 | static void cleanup_mapped_device(struct mapped_device *md) |
2283 | { | 2279 | { |
2284 | cleanup_srcu_struct(&md->io_barrier); | ||
2285 | |||
2286 | if (md->wq) | 2280 | if (md->wq) |
2287 | destroy_workqueue(md->wq); | 2281 | destroy_workqueue(md->wq); |
2288 | if (md->kworker_task) | 2282 | if (md->kworker_task) |
@@ -2294,6 +2288,8 @@ static void cleanup_mapped_device(struct mapped_device *md) | |||
2294 | if (md->bs) | 2288 | if (md->bs) |
2295 | bioset_free(md->bs); | 2289 | bioset_free(md->bs); |
2296 | 2290 | ||
2291 | cleanup_srcu_struct(&md->io_barrier); | ||
2292 | |||
2297 | if (md->disk) { | 2293 | if (md->disk) { |
2298 | spin_lock(&_minor_lock); | 2294 | spin_lock(&_minor_lock); |
2299 | md->disk->private_data = NULL; | 2295 | md->disk->private_data = NULL; |
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c index fcfc4b9b2672..0072190515e0 100644 --- a/drivers/md/md-cluster.c +++ b/drivers/md/md-cluster.c | |||
@@ -44,6 +44,7 @@ struct resync_info { | |||
44 | 44 | ||
45 | /* md_cluster_info flags */ | 45 | /* md_cluster_info flags */ |
46 | #define MD_CLUSTER_WAITING_FOR_NEWDISK 1 | 46 | #define MD_CLUSTER_WAITING_FOR_NEWDISK 1 |
47 | #define MD_CLUSTER_SUSPEND_READ_BALANCING 2 | ||
47 | 48 | ||
48 | 49 | ||
49 | struct md_cluster_info { | 50 | struct md_cluster_info { |
@@ -275,6 +276,9 @@ clear_bit: | |||
275 | 276 | ||
276 | static void recover_prep(void *arg) | 277 | static void recover_prep(void *arg) |
277 | { | 278 | { |
279 | struct mddev *mddev = arg; | ||
280 | struct md_cluster_info *cinfo = mddev->cluster_info; | ||
281 | set_bit(MD_CLUSTER_SUSPEND_READ_BALANCING, &cinfo->state); | ||
278 | } | 282 | } |
279 | 283 | ||
280 | static void recover_slot(void *arg, struct dlm_slot *slot) | 284 | static void recover_slot(void *arg, struct dlm_slot *slot) |
@@ -307,6 +311,7 @@ static void recover_done(void *arg, struct dlm_slot *slots, | |||
307 | 311 | ||
308 | cinfo->slot_number = our_slot; | 312 | cinfo->slot_number = our_slot; |
309 | complete(&cinfo->completion); | 313 | complete(&cinfo->completion); |
314 | clear_bit(MD_CLUSTER_SUSPEND_READ_BALANCING, &cinfo->state); | ||
310 | } | 315 | } |
311 | 316 | ||
312 | static const struct dlm_lockspace_ops md_ls_ops = { | 317 | static const struct dlm_lockspace_ops md_ls_ops = { |
@@ -816,12 +821,17 @@ static void resync_finish(struct mddev *mddev) | |||
816 | resync_send(mddev, RESYNCING, 0, 0); | 821 | resync_send(mddev, RESYNCING, 0, 0); |
817 | } | 822 | } |
818 | 823 | ||
819 | static int area_resyncing(struct mddev *mddev, sector_t lo, sector_t hi) | 824 | static int area_resyncing(struct mddev *mddev, int direction, |
825 | sector_t lo, sector_t hi) | ||
820 | { | 826 | { |
821 | struct md_cluster_info *cinfo = mddev->cluster_info; | 827 | struct md_cluster_info *cinfo = mddev->cluster_info; |
822 | int ret = 0; | 828 | int ret = 0; |
823 | struct suspend_info *s; | 829 | struct suspend_info *s; |
824 | 830 | ||
831 | if ((direction == READ) && | ||
832 | test_bit(MD_CLUSTER_SUSPEND_READ_BALANCING, &cinfo->state)) | ||
833 | return 1; | ||
834 | |||
825 | spin_lock_irq(&cinfo->suspend_lock); | 835 | spin_lock_irq(&cinfo->suspend_lock); |
826 | if (list_empty(&cinfo->suspend_list)) | 836 | if (list_empty(&cinfo->suspend_list)) |
827 | goto out; | 837 | goto out; |
diff --git a/drivers/md/md-cluster.h b/drivers/md/md-cluster.h index 6817ee00e053..00defe2badbc 100644 --- a/drivers/md/md-cluster.h +++ b/drivers/md/md-cluster.h | |||
@@ -18,7 +18,7 @@ struct md_cluster_operations { | |||
18 | int (*metadata_update_start)(struct mddev *mddev); | 18 | int (*metadata_update_start)(struct mddev *mddev); |
19 | int (*metadata_update_finish)(struct mddev *mddev); | 19 | int (*metadata_update_finish)(struct mddev *mddev); |
20 | int (*metadata_update_cancel)(struct mddev *mddev); | 20 | int (*metadata_update_cancel)(struct mddev *mddev); |
21 | int (*area_resyncing)(struct mddev *mddev, sector_t lo, sector_t hi); | 21 | int (*area_resyncing)(struct mddev *mddev, int direction, sector_t lo, sector_t hi); |
22 | int (*add_new_disk_start)(struct mddev *mddev, struct md_rdev *rdev); | 22 | int (*add_new_disk_start)(struct mddev *mddev, struct md_rdev *rdev); |
23 | int (*add_new_disk_finish)(struct mddev *mddev); | 23 | int (*add_new_disk_finish)(struct mddev *mddev); |
24 | int (*new_disk_ack)(struct mddev *mddev, bool ack); | 24 | int (*new_disk_ack)(struct mddev *mddev, bool ack); |
diff --git a/drivers/md/md.c b/drivers/md/md.c index d429c30cd514..0c2a4e8b873c 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -5382,6 +5382,8 @@ static void __md_stop(struct mddev *mddev) | |||
5382 | { | 5382 | { |
5383 | struct md_personality *pers = mddev->pers; | 5383 | struct md_personality *pers = mddev->pers; |
5384 | mddev_detach(mddev); | 5384 | mddev_detach(mddev); |
5385 | /* Ensure ->event_work is done */ | ||
5386 | flush_workqueue(md_misc_wq); | ||
5385 | spin_lock(&mddev->lock); | 5387 | spin_lock(&mddev->lock); |
5386 | mddev->ready = 0; | 5388 | mddev->ready = 0; |
5387 | mddev->pers = NULL; | 5389 | mddev->pers = NULL; |
@@ -7437,7 +7439,7 @@ int md_setup_cluster(struct mddev *mddev, int nodes) | |||
7437 | err = request_module("md-cluster"); | 7439 | err = request_module("md-cluster"); |
7438 | if (err) { | 7440 | if (err) { |
7439 | pr_err("md-cluster module not found.\n"); | 7441 | pr_err("md-cluster module not found.\n"); |
7440 | return err; | 7442 | return -ENOENT; |
7441 | } | 7443 | } |
7442 | 7444 | ||
7443 | spin_lock(&pers_lock); | 7445 | spin_lock(&pers_lock); |
diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c index e04cfd2d60ef..9836c0ae897c 100644 --- a/drivers/md/persistent-data/dm-btree-remove.c +++ b/drivers/md/persistent-data/dm-btree-remove.c | |||
@@ -309,8 +309,8 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent, | |||
309 | 309 | ||
310 | if (s < 0 && nr_center < -s) { | 310 | if (s < 0 && nr_center < -s) { |
311 | /* not enough in central node */ | 311 | /* not enough in central node */ |
312 | shift(left, center, nr_center); | 312 | shift(left, center, -nr_center); |
313 | s = nr_center - target; | 313 | s += nr_center; |
314 | shift(left, right, s); | 314 | shift(left, right, s); |
315 | nr_right += s; | 315 | nr_right += s; |
316 | } else | 316 | } else |
@@ -323,7 +323,7 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent, | |||
323 | if (s > 0 && nr_center < s) { | 323 | if (s > 0 && nr_center < s) { |
324 | /* not enough in central node */ | 324 | /* not enough in central node */ |
325 | shift(center, right, nr_center); | 325 | shift(center, right, nr_center); |
326 | s = target - nr_center; | 326 | s -= nr_center; |
327 | shift(left, right, s); | 327 | shift(left, right, s); |
328 | nr_left -= s; | 328 | nr_left -= s; |
329 | } else | 329 | } else |
diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c index 200ac12a1d40..fdd3793e22f9 100644 --- a/drivers/md/persistent-data/dm-btree.c +++ b/drivers/md/persistent-data/dm-btree.c | |||
@@ -255,7 +255,7 @@ int dm_btree_del(struct dm_btree_info *info, dm_block_t root) | |||
255 | int r; | 255 | int r; |
256 | struct del_stack *s; | 256 | struct del_stack *s; |
257 | 257 | ||
258 | s = kmalloc(sizeof(*s), GFP_KERNEL); | 258 | s = kmalloc(sizeof(*s), GFP_NOIO); |
259 | if (!s) | 259 | if (!s) |
260 | return -ENOMEM; | 260 | return -ENOMEM; |
261 | s->info = info; | 261 | s->info = info; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index f80f1af61ce7..94f5b55069e0 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -336,7 +336,7 @@ static void raid1_end_read_request(struct bio *bio, int error) | |||
336 | spin_lock_irqsave(&conf->device_lock, flags); | 336 | spin_lock_irqsave(&conf->device_lock, flags); |
337 | if (r1_bio->mddev->degraded == conf->raid_disks || | 337 | if (r1_bio->mddev->degraded == conf->raid_disks || |
338 | (r1_bio->mddev->degraded == conf->raid_disks-1 && | 338 | (r1_bio->mddev->degraded == conf->raid_disks-1 && |
339 | !test_bit(Faulty, &conf->mirrors[mirror].rdev->flags))) | 339 | test_bit(In_sync, &conf->mirrors[mirror].rdev->flags))) |
340 | uptodate = 1; | 340 | uptodate = 1; |
341 | spin_unlock_irqrestore(&conf->device_lock, flags); | 341 | spin_unlock_irqrestore(&conf->device_lock, flags); |
342 | } | 342 | } |
@@ -541,7 +541,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect | |||
541 | 541 | ||
542 | if ((conf->mddev->recovery_cp < this_sector + sectors) || | 542 | if ((conf->mddev->recovery_cp < this_sector + sectors) || |
543 | (mddev_is_clustered(conf->mddev) && | 543 | (mddev_is_clustered(conf->mddev) && |
544 | md_cluster_ops->area_resyncing(conf->mddev, this_sector, | 544 | md_cluster_ops->area_resyncing(conf->mddev, READ, this_sector, |
545 | this_sector + sectors))) | 545 | this_sector + sectors))) |
546 | choose_first = 1; | 546 | choose_first = 1; |
547 | else | 547 | else |
@@ -1111,7 +1111,8 @@ static void make_request(struct mddev *mddev, struct bio * bio) | |||
1111 | ((bio_end_sector(bio) > mddev->suspend_lo && | 1111 | ((bio_end_sector(bio) > mddev->suspend_lo && |
1112 | bio->bi_iter.bi_sector < mddev->suspend_hi) || | 1112 | bio->bi_iter.bi_sector < mddev->suspend_hi) || |
1113 | (mddev_is_clustered(mddev) && | 1113 | (mddev_is_clustered(mddev) && |
1114 | md_cluster_ops->area_resyncing(mddev, bio->bi_iter.bi_sector, bio_end_sector(bio))))) { | 1114 | md_cluster_ops->area_resyncing(mddev, WRITE, |
1115 | bio->bi_iter.bi_sector, bio_end_sector(bio))))) { | ||
1115 | /* As the suspend_* range is controlled by | 1116 | /* As the suspend_* range is controlled by |
1116 | * userspace, we want an interruptible | 1117 | * userspace, we want an interruptible |
1117 | * wait. | 1118 | * wait. |
@@ -1124,7 +1125,7 @@ static void make_request(struct mddev *mddev, struct bio * bio) | |||
1124 | if (bio_end_sector(bio) <= mddev->suspend_lo || | 1125 | if (bio_end_sector(bio) <= mddev->suspend_lo || |
1125 | bio->bi_iter.bi_sector >= mddev->suspend_hi || | 1126 | bio->bi_iter.bi_sector >= mddev->suspend_hi || |
1126 | (mddev_is_clustered(mddev) && | 1127 | (mddev_is_clustered(mddev) && |
1127 | !md_cluster_ops->area_resyncing(mddev, | 1128 | !md_cluster_ops->area_resyncing(mddev, WRITE, |
1128 | bio->bi_iter.bi_sector, bio_end_sector(bio)))) | 1129 | bio->bi_iter.bi_sector, bio_end_sector(bio)))) |
1129 | break; | 1130 | break; |
1130 | schedule(); | 1131 | schedule(); |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 940f2f365461..38c58e19cfce 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -3556,6 +3556,7 @@ static struct r10conf *setup_conf(struct mddev *mddev) | |||
3556 | /* far_copies must be 1 */ | 3556 | /* far_copies must be 1 */ |
3557 | conf->prev.stride = conf->dev_sectors; | 3557 | conf->prev.stride = conf->dev_sectors; |
3558 | } | 3558 | } |
3559 | conf->reshape_safe = conf->reshape_progress; | ||
3559 | spin_lock_init(&conf->device_lock); | 3560 | spin_lock_init(&conf->device_lock); |
3560 | INIT_LIST_HEAD(&conf->retry_list); | 3561 | INIT_LIST_HEAD(&conf->retry_list); |
3561 | 3562 | ||
@@ -3760,7 +3761,6 @@ static int run(struct mddev *mddev) | |||
3760 | } | 3761 | } |
3761 | conf->offset_diff = min_offset_diff; | 3762 | conf->offset_diff = min_offset_diff; |
3762 | 3763 | ||
3763 | conf->reshape_safe = conf->reshape_progress; | ||
3764 | clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); | 3764 | clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); |
3765 | clear_bit(MD_RECOVERY_CHECK, &mddev->recovery); | 3765 | clear_bit(MD_RECOVERY_CHECK, &mddev->recovery); |
3766 | set_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); | 3766 | set_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); |
@@ -4103,6 +4103,7 @@ static int raid10_start_reshape(struct mddev *mddev) | |||
4103 | conf->reshape_progress = size; | 4103 | conf->reshape_progress = size; |
4104 | } else | 4104 | } else |
4105 | conf->reshape_progress = 0; | 4105 | conf->reshape_progress = 0; |
4106 | conf->reshape_safe = conf->reshape_progress; | ||
4106 | spin_unlock_irq(&conf->device_lock); | 4107 | spin_unlock_irq(&conf->device_lock); |
4107 | 4108 | ||
4108 | if (mddev->delta_disks && mddev->bitmap) { | 4109 | if (mddev->delta_disks && mddev->bitmap) { |
@@ -4170,6 +4171,7 @@ abort: | |||
4170 | rdev->new_data_offset = rdev->data_offset; | 4171 | rdev->new_data_offset = rdev->data_offset; |
4171 | smp_wmb(); | 4172 | smp_wmb(); |
4172 | conf->reshape_progress = MaxSector; | 4173 | conf->reshape_progress = MaxSector; |
4174 | conf->reshape_safe = MaxSector; | ||
4173 | mddev->reshape_position = MaxSector; | 4175 | mddev->reshape_position = MaxSector; |
4174 | spin_unlock_irq(&conf->device_lock); | 4176 | spin_unlock_irq(&conf->device_lock); |
4175 | return ret; | 4177 | return ret; |
@@ -4524,6 +4526,7 @@ static void end_reshape(struct r10conf *conf) | |||
4524 | md_finish_reshape(conf->mddev); | 4526 | md_finish_reshape(conf->mddev); |
4525 | smp_wmb(); | 4527 | smp_wmb(); |
4526 | conf->reshape_progress = MaxSector; | 4528 | conf->reshape_progress = MaxSector; |
4529 | conf->reshape_safe = MaxSector; | ||
4527 | spin_unlock_irq(&conf->device_lock); | 4530 | spin_unlock_irq(&conf->device_lock); |
4528 | 4531 | ||
4529 | /* read-ahead size must cover two whole stripes, which is | 4532 | /* read-ahead size must cover two whole stripes, which is |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 59e44e99eef3..643d217bfa13 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -2162,6 +2162,9 @@ static int resize_stripes(struct r5conf *conf, int newsize) | |||
2162 | if (!sc) | 2162 | if (!sc) |
2163 | return -ENOMEM; | 2163 | return -ENOMEM; |
2164 | 2164 | ||
2165 | /* Need to ensure auto-resizing doesn't interfere */ | ||
2166 | mutex_lock(&conf->cache_size_mutex); | ||
2167 | |||
2165 | for (i = conf->max_nr_stripes; i; i--) { | 2168 | for (i = conf->max_nr_stripes; i; i--) { |
2166 | nsh = alloc_stripe(sc, GFP_KERNEL); | 2169 | nsh = alloc_stripe(sc, GFP_KERNEL); |
2167 | if (!nsh) | 2170 | if (!nsh) |
@@ -2178,6 +2181,7 @@ static int resize_stripes(struct r5conf *conf, int newsize) | |||
2178 | kmem_cache_free(sc, nsh); | 2181 | kmem_cache_free(sc, nsh); |
2179 | } | 2182 | } |
2180 | kmem_cache_destroy(sc); | 2183 | kmem_cache_destroy(sc); |
2184 | mutex_unlock(&conf->cache_size_mutex); | ||
2181 | return -ENOMEM; | 2185 | return -ENOMEM; |
2182 | } | 2186 | } |
2183 | /* Step 2 - Must use GFP_NOIO now. | 2187 | /* Step 2 - Must use GFP_NOIO now. |
@@ -2224,6 +2228,7 @@ static int resize_stripes(struct r5conf *conf, int newsize) | |||
2224 | } else | 2228 | } else |
2225 | err = -ENOMEM; | 2229 | err = -ENOMEM; |
2226 | 2230 | ||
2231 | mutex_unlock(&conf->cache_size_mutex); | ||
2227 | /* Step 4, return new stripes to service */ | 2232 | /* Step 4, return new stripes to service */ |
2228 | while(!list_empty(&newstripes)) { | 2233 | while(!list_empty(&newstripes)) { |
2229 | nsh = list_entry(newstripes.next, struct stripe_head, lru); | 2234 | nsh = list_entry(newstripes.next, struct stripe_head, lru); |
@@ -4061,8 +4066,10 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) | |||
4061 | &first_bad, &bad_sectors)) | 4066 | &first_bad, &bad_sectors)) |
4062 | set_bit(R5_ReadRepl, &dev->flags); | 4067 | set_bit(R5_ReadRepl, &dev->flags); |
4063 | else { | 4068 | else { |
4064 | if (rdev) | 4069 | if (rdev && !test_bit(Faulty, &rdev->flags)) |
4065 | set_bit(R5_NeedReplace, &dev->flags); | 4070 | set_bit(R5_NeedReplace, &dev->flags); |
4071 | else | ||
4072 | clear_bit(R5_NeedReplace, &dev->flags); | ||
4066 | rdev = rcu_dereference(conf->disks[i].rdev); | 4073 | rdev = rcu_dereference(conf->disks[i].rdev); |
4067 | clear_bit(R5_ReadRepl, &dev->flags); | 4074 | clear_bit(R5_ReadRepl, &dev->flags); |
4068 | } | 4075 | } |
@@ -5857,12 +5864,14 @@ static void raid5d(struct md_thread *thread) | |||
5857 | pr_debug("%d stripes handled\n", handled); | 5864 | pr_debug("%d stripes handled\n", handled); |
5858 | 5865 | ||
5859 | spin_unlock_irq(&conf->device_lock); | 5866 | spin_unlock_irq(&conf->device_lock); |
5860 | if (test_and_clear_bit(R5_ALLOC_MORE, &conf->cache_state)) { | 5867 | if (test_and_clear_bit(R5_ALLOC_MORE, &conf->cache_state) && |
5868 | mutex_trylock(&conf->cache_size_mutex)) { | ||
5861 | grow_one_stripe(conf, __GFP_NOWARN); | 5869 | grow_one_stripe(conf, __GFP_NOWARN); |
5862 | /* Set flag even if allocation failed. This helps | 5870 | /* Set flag even if allocation failed. This helps |
5863 | * slow down allocation requests when mem is short | 5871 | * slow down allocation requests when mem is short |
5864 | */ | 5872 | */ |
5865 | set_bit(R5_DID_ALLOC, &conf->cache_state); | 5873 | set_bit(R5_DID_ALLOC, &conf->cache_state); |
5874 | mutex_unlock(&conf->cache_size_mutex); | ||
5866 | } | 5875 | } |
5867 | 5876 | ||
5868 | async_tx_issue_pending_all(); | 5877 | async_tx_issue_pending_all(); |
@@ -5894,18 +5903,22 @@ raid5_set_cache_size(struct mddev *mddev, int size) | |||
5894 | return -EINVAL; | 5903 | return -EINVAL; |
5895 | 5904 | ||
5896 | conf->min_nr_stripes = size; | 5905 | conf->min_nr_stripes = size; |
5906 | mutex_lock(&conf->cache_size_mutex); | ||
5897 | while (size < conf->max_nr_stripes && | 5907 | while (size < conf->max_nr_stripes && |
5898 | drop_one_stripe(conf)) | 5908 | drop_one_stripe(conf)) |
5899 | ; | 5909 | ; |
5910 | mutex_unlock(&conf->cache_size_mutex); | ||
5900 | 5911 | ||
5901 | 5912 | ||
5902 | err = md_allow_write(mddev); | 5913 | err = md_allow_write(mddev); |
5903 | if (err) | 5914 | if (err) |
5904 | return err; | 5915 | return err; |
5905 | 5916 | ||
5917 | mutex_lock(&conf->cache_size_mutex); | ||
5906 | while (size > conf->max_nr_stripes) | 5918 | while (size > conf->max_nr_stripes) |
5907 | if (!grow_one_stripe(conf, GFP_KERNEL)) | 5919 | if (!grow_one_stripe(conf, GFP_KERNEL)) |
5908 | break; | 5920 | break; |
5921 | mutex_unlock(&conf->cache_size_mutex); | ||
5909 | 5922 | ||
5910 | return 0; | 5923 | return 0; |
5911 | } | 5924 | } |
@@ -6371,11 +6384,18 @@ static unsigned long raid5_cache_scan(struct shrinker *shrink, | |||
6371 | struct shrink_control *sc) | 6384 | struct shrink_control *sc) |
6372 | { | 6385 | { |
6373 | struct r5conf *conf = container_of(shrink, struct r5conf, shrinker); | 6386 | struct r5conf *conf = container_of(shrink, struct r5conf, shrinker); |
6374 | int ret = 0; | 6387 | unsigned long ret = SHRINK_STOP; |
6375 | while (ret < sc->nr_to_scan) { | 6388 | |
6376 | if (drop_one_stripe(conf) == 0) | 6389 | if (mutex_trylock(&conf->cache_size_mutex)) { |
6377 | return SHRINK_STOP; | 6390 | ret= 0; |
6378 | ret++; | 6391 | while (ret < sc->nr_to_scan) { |
6392 | if (drop_one_stripe(conf) == 0) { | ||
6393 | ret = SHRINK_STOP; | ||
6394 | break; | ||
6395 | } | ||
6396 | ret++; | ||
6397 | } | ||
6398 | mutex_unlock(&conf->cache_size_mutex); | ||
6379 | } | 6399 | } |
6380 | return ret; | 6400 | return ret; |
6381 | } | 6401 | } |
@@ -6444,6 +6464,7 @@ static struct r5conf *setup_conf(struct mddev *mddev) | |||
6444 | goto abort; | 6464 | goto abort; |
6445 | spin_lock_init(&conf->device_lock); | 6465 | spin_lock_init(&conf->device_lock); |
6446 | seqcount_init(&conf->gen_lock); | 6466 | seqcount_init(&conf->gen_lock); |
6467 | mutex_init(&conf->cache_size_mutex); | ||
6447 | init_waitqueue_head(&conf->wait_for_quiescent); | 6468 | init_waitqueue_head(&conf->wait_for_quiescent); |
6448 | for (i = 0; i < NR_STRIPE_HASH_LOCKS; i++) { | 6469 | for (i = 0; i < NR_STRIPE_HASH_LOCKS; i++) { |
6449 | init_waitqueue_head(&conf->wait_for_stripe[i]); | 6470 | init_waitqueue_head(&conf->wait_for_stripe[i]); |
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 02c3bf8fbfe7..d05144278690 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h | |||
@@ -482,7 +482,8 @@ struct r5conf { | |||
482 | */ | 482 | */ |
483 | int active_name; | 483 | int active_name; |
484 | char cache_name[2][32]; | 484 | char cache_name[2][32]; |
485 | struct kmem_cache *slab_cache; /* for allocating stripes */ | 485 | struct kmem_cache *slab_cache; /* for allocating stripes */ |
486 | struct mutex cache_size_mutex; /* Protect changes to cache size */ | ||
486 | 487 | ||
487 | int seq_flush, seq_write; | 488 | int seq_flush, seq_write; |
488 | int quiesce; | 489 | int quiesce; |
diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c index 4cb365d4ffdc..8b95eefb610b 100644 --- a/drivers/media/pci/ivtv/ivtvfb.c +++ b/drivers/media/pci/ivtv/ivtvfb.c | |||
@@ -38,6 +38,8 @@ | |||
38 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 38 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
42 | |||
41 | #include <linux/module.h> | 43 | #include <linux/module.h> |
42 | #include <linux/kernel.h> | 44 | #include <linux/kernel.h> |
43 | #include <linux/fb.h> | 45 | #include <linux/fb.h> |
@@ -1171,6 +1173,13 @@ static int ivtvfb_init_card(struct ivtv *itv) | |||
1171 | { | 1173 | { |
1172 | int rc; | 1174 | int rc; |
1173 | 1175 | ||
1176 | #ifdef CONFIG_X86_64 | ||
1177 | if (pat_enabled()) { | ||
1178 | pr_warn("ivtvfb needs PAT disabled, boot with nopat kernel parameter\n"); | ||
1179 | return -ENODEV; | ||
1180 | } | ||
1181 | #endif | ||
1182 | |||
1174 | if (itv->osd_info) { | 1183 | if (itv->osd_info) { |
1175 | IVTVFB_ERR("Card %d already initialised\n", ivtvfb_card_id); | 1184 | IVTVFB_ERR("Card %d already initialised\n", ivtvfb_card_id); |
1176 | return -EBUSY; | 1185 | return -EBUSY; |
@@ -1265,12 +1274,6 @@ static int __init ivtvfb_init(void) | |||
1265 | int registered = 0; | 1274 | int registered = 0; |
1266 | int err; | 1275 | int err; |
1267 | 1276 | ||
1268 | #ifdef CONFIG_X86_64 | ||
1269 | if (WARN(pat_enabled(), | ||
1270 | "ivtvfb needs PAT disabled, boot with nopat kernel parameter\n")) { | ||
1271 | return -ENODEV; | ||
1272 | } | ||
1273 | #endif | ||
1274 | 1277 | ||
1275 | if (ivtvfb_card_id < -1 || ivtvfb_card_id >= IVTV_MAX_CARDS) { | 1278 | if (ivtvfb_card_id < -1 || ivtvfb_card_id >= IVTV_MAX_CARDS) { |
1276 | printk(KERN_ERR "ivtvfb: ivtvfb_card_id parameter is out of range (valid range: -1 - %d)\n", | 1279 | printk(KERN_ERR "ivtvfb: ivtvfb_card_id parameter is out of range (valid range: -1 - %d)\n", |
diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index 8911e51d410a..3a27a84ad3ec 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c | |||
@@ -2074,14 +2074,8 @@ static int gpmc_probe_dt(struct platform_device *pdev) | |||
2074 | ret = gpmc_probe_nand_child(pdev, child); | 2074 | ret = gpmc_probe_nand_child(pdev, child); |
2075 | else if (of_node_cmp(child->name, "onenand") == 0) | 2075 | else if (of_node_cmp(child->name, "onenand") == 0) |
2076 | ret = gpmc_probe_onenand_child(pdev, child); | 2076 | ret = gpmc_probe_onenand_child(pdev, child); |
2077 | else if (of_node_cmp(child->name, "ethernet") == 0 || | 2077 | else |
2078 | of_node_cmp(child->name, "nor") == 0 || | ||
2079 | of_node_cmp(child->name, "uart") == 0) | ||
2080 | ret = gpmc_probe_generic_child(pdev, child); | 2078 | ret = gpmc_probe_generic_child(pdev, child); |
2081 | |||
2082 | if (WARN(ret < 0, "%s: probing gpmc child %s failed\n", | ||
2083 | __func__, child->full_name)) | ||
2084 | of_node_put(child); | ||
2085 | } | 2079 | } |
2086 | 2080 | ||
2087 | return 0; | 2081 | return 0; |
diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c index 5c054031c3f8..e14c8c9d189b 100644 --- a/drivers/mfd/stmpe-i2c.c +++ b/drivers/mfd/stmpe-i2c.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * License Terms: GNU General Public License, version 2 | 7 | * License Terms: GNU General Public License, version 2 |
8 | * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson | 8 | * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson |
9 | * Author: Viresh Kumar <viresh.linux@gmail.com> for ST Microelectronics | 9 | * Author: Viresh Kumar <vireshk@kernel.org> for ST Microelectronics |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/i2c.h> | 12 | #include <linux/i2c.h> |
diff --git a/drivers/mfd/stmpe-spi.c b/drivers/mfd/stmpe-spi.c index a81badbaa917..6fdb30e84a2b 100644 --- a/drivers/mfd/stmpe-spi.c +++ b/drivers/mfd/stmpe-spi.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright (C) ST Microelectronics SA 2011 | 4 | * Copyright (C) ST Microelectronics SA 2011 |
5 | * | 5 | * |
6 | * License Terms: GNU General Public License, version 2 | 6 | * License Terms: GNU General Public License, version 2 |
7 | * Author: Viresh Kumar <viresh.linux@gmail.com> for ST Microelectronics | 7 | * Author: Viresh Kumar <vireshk@kernel.org> for ST Microelectronics |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/spi/spi.h> | 10 | #include <linux/spi/spi.h> |
@@ -146,4 +146,4 @@ module_exit(stmpe_exit); | |||
146 | 146 | ||
147 | MODULE_LICENSE("GPL v2"); | 147 | MODULE_LICENSE("GPL v2"); |
148 | MODULE_DESCRIPTION("STMPE MFD SPI Interface Driver"); | 148 | MODULE_DESCRIPTION("STMPE MFD SPI Interface Driver"); |
149 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); | 149 | MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>"); |
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c index 0c77240ae2fc..729e0851167d 100644 --- a/drivers/misc/cxl/api.c +++ b/drivers/misc/cxl/api.c | |||
@@ -23,6 +23,7 @@ struct cxl_context *cxl_dev_context_init(struct pci_dev *dev) | |||
23 | 23 | ||
24 | afu = cxl_pci_to_afu(dev); | 24 | afu = cxl_pci_to_afu(dev); |
25 | 25 | ||
26 | get_device(&afu->dev); | ||
26 | ctx = cxl_context_alloc(); | 27 | ctx = cxl_context_alloc(); |
27 | if (IS_ERR(ctx)) | 28 | if (IS_ERR(ctx)) |
28 | return ctx; | 29 | return ctx; |
@@ -31,6 +32,7 @@ struct cxl_context *cxl_dev_context_init(struct pci_dev *dev) | |||
31 | rc = cxl_context_init(ctx, afu, false, NULL); | 32 | rc = cxl_context_init(ctx, afu, false, NULL); |
32 | if (rc) { | 33 | if (rc) { |
33 | kfree(ctx); | 34 | kfree(ctx); |
35 | put_device(&afu->dev); | ||
34 | return ERR_PTR(-ENOMEM); | 36 | return ERR_PTR(-ENOMEM); |
35 | } | 37 | } |
36 | cxl_assign_psn_space(ctx); | 38 | cxl_assign_psn_space(ctx); |
@@ -60,6 +62,8 @@ int cxl_release_context(struct cxl_context *ctx) | |||
60 | if (ctx->status != CLOSED) | 62 | if (ctx->status != CLOSED) |
61 | return -EBUSY; | 63 | return -EBUSY; |
62 | 64 | ||
65 | put_device(&ctx->afu->dev); | ||
66 | |||
63 | cxl_context_free(ctx); | 67 | cxl_context_free(ctx); |
64 | 68 | ||
65 | return 0; | 69 | return 0; |
@@ -159,7 +163,6 @@ int cxl_start_context(struct cxl_context *ctx, u64 wed, | |||
159 | } | 163 | } |
160 | 164 | ||
161 | ctx->status = STARTED; | 165 | ctx->status = STARTED; |
162 | get_device(&ctx->afu->dev); | ||
163 | out: | 166 | out: |
164 | mutex_unlock(&ctx->status_mutex); | 167 | mutex_unlock(&ctx->status_mutex); |
165 | return rc; | 168 | return rc; |
@@ -175,12 +178,7 @@ EXPORT_SYMBOL_GPL(cxl_process_element); | |||
175 | /* Stop a context. Returns 0 on success, otherwise -Errno */ | 178 | /* Stop a context. Returns 0 on success, otherwise -Errno */ |
176 | int cxl_stop_context(struct cxl_context *ctx) | 179 | int cxl_stop_context(struct cxl_context *ctx) |
177 | { | 180 | { |
178 | int rc; | 181 | return __detach_context(ctx); |
179 | |||
180 | rc = __detach_context(ctx); | ||
181 | if (!rc) | ||
182 | put_device(&ctx->afu->dev); | ||
183 | return rc; | ||
184 | } | 182 | } |
185 | EXPORT_SYMBOL_GPL(cxl_stop_context); | 183 | EXPORT_SYMBOL_GPL(cxl_stop_context); |
186 | 184 | ||
diff --git a/drivers/misc/cxl/context.c b/drivers/misc/cxl/context.c index 2a4c80ac322a..1287148629c0 100644 --- a/drivers/misc/cxl/context.c +++ b/drivers/misc/cxl/context.c | |||
@@ -113,11 +113,11 @@ static int cxl_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
113 | 113 | ||
114 | if (ctx->afu->current_mode == CXL_MODE_DEDICATED) { | 114 | if (ctx->afu->current_mode == CXL_MODE_DEDICATED) { |
115 | area = ctx->afu->psn_phys; | 115 | area = ctx->afu->psn_phys; |
116 | if (offset > ctx->afu->adapter->ps_size) | 116 | if (offset >= ctx->afu->adapter->ps_size) |
117 | return VM_FAULT_SIGBUS; | 117 | return VM_FAULT_SIGBUS; |
118 | } else { | 118 | } else { |
119 | area = ctx->psn_phys; | 119 | area = ctx->psn_phys; |
120 | if (offset > ctx->psn_size) | 120 | if (offset >= ctx->psn_size) |
121 | return VM_FAULT_SIGBUS; | 121 | return VM_FAULT_SIGBUS; |
122 | } | 122 | } |
123 | 123 | ||
@@ -145,8 +145,16 @@ static const struct vm_operations_struct cxl_mmap_vmops = { | |||
145 | */ | 145 | */ |
146 | int cxl_context_iomap(struct cxl_context *ctx, struct vm_area_struct *vma) | 146 | int cxl_context_iomap(struct cxl_context *ctx, struct vm_area_struct *vma) |
147 | { | 147 | { |
148 | u64 start = vma->vm_pgoff << PAGE_SHIFT; | ||
148 | u64 len = vma->vm_end - vma->vm_start; | 149 | u64 len = vma->vm_end - vma->vm_start; |
149 | len = min(len, ctx->psn_size); | 150 | |
151 | if (ctx->afu->current_mode == CXL_MODE_DEDICATED) { | ||
152 | if (start + len > ctx->afu->adapter->ps_size) | ||
153 | return -EINVAL; | ||
154 | } else { | ||
155 | if (start + len > ctx->psn_size) | ||
156 | return -EINVAL; | ||
157 | } | ||
150 | 158 | ||
151 | if (ctx->afu->current_mode != CXL_MODE_DEDICATED) { | 159 | if (ctx->afu->current_mode != CXL_MODE_DEDICATED) { |
152 | /* make sure there is a valid per process space for this AFU */ | 160 | /* make sure there is a valid per process space for this AFU */ |
diff --git a/drivers/misc/cxl/main.c b/drivers/misc/cxl/main.c index 833348e2c9cb..4a164ab8b35a 100644 --- a/drivers/misc/cxl/main.c +++ b/drivers/misc/cxl/main.c | |||
@@ -73,7 +73,7 @@ static inline void cxl_slbia_core(struct mm_struct *mm) | |||
73 | spin_lock(&adapter->afu_list_lock); | 73 | spin_lock(&adapter->afu_list_lock); |
74 | for (slice = 0; slice < adapter->slices; slice++) { | 74 | for (slice = 0; slice < adapter->slices; slice++) { |
75 | afu = adapter->afu[slice]; | 75 | afu = adapter->afu[slice]; |
76 | if (!afu->enabled) | 76 | if (!afu || !afu->enabled) |
77 | continue; | 77 | continue; |
78 | rcu_read_lock(); | 78 | rcu_read_lock(); |
79 | idr_for_each_entry(&afu->contexts_idr, ctx, id) | 79 | idr_for_each_entry(&afu->contexts_idr, ctx, id) |
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c index c68ef5806dbe..32ad09705949 100644 --- a/drivers/misc/cxl/pci.c +++ b/drivers/misc/cxl/pci.c | |||
@@ -539,7 +539,7 @@ err: | |||
539 | 539 | ||
540 | static void cxl_unmap_slice_regs(struct cxl_afu *afu) | 540 | static void cxl_unmap_slice_regs(struct cxl_afu *afu) |
541 | { | 541 | { |
542 | if (afu->p1n_mmio) | 542 | if (afu->p2n_mmio) |
543 | iounmap(afu->p2n_mmio); | 543 | iounmap(afu->p2n_mmio); |
544 | if (afu->p1n_mmio) | 544 | if (afu->p1n_mmio) |
545 | iounmap(afu->p1n_mmio); | 545 | iounmap(afu->p1n_mmio); |
diff --git a/drivers/misc/cxl/vphb.c b/drivers/misc/cxl/vphb.c index b1d1983a84a5..2eba002b580b 100644 --- a/drivers/misc/cxl/vphb.c +++ b/drivers/misc/cxl/vphb.c | |||
@@ -112,9 +112,10 @@ static int cxl_pcie_config_info(struct pci_bus *bus, unsigned int devfn, | |||
112 | unsigned long addr; | 112 | unsigned long addr; |
113 | 113 | ||
114 | phb = pci_bus_to_host(bus); | 114 | phb = pci_bus_to_host(bus); |
115 | afu = (struct cxl_afu *)phb->private_data; | ||
116 | if (phb == NULL) | 115 | if (phb == NULL) |
117 | return PCIBIOS_DEVICE_NOT_FOUND; | 116 | return PCIBIOS_DEVICE_NOT_FOUND; |
117 | afu = (struct cxl_afu *)phb->private_data; | ||
118 | |||
118 | if (cxl_pcie_cfg_record(bus->number, devfn) > afu->crs_num) | 119 | if (cxl_pcie_cfg_record(bus->number, devfn) > afu->crs_num) |
119 | return PCIBIOS_DEVICE_NOT_FOUND; | 120 | return PCIBIOS_DEVICE_NOT_FOUND; |
120 | if (offset >= (unsigned long)phb->cfg_data) | 121 | if (offset >= (unsigned long)phb->cfg_data) |
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index 8eb0a9500a90..e9513d651cd3 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
@@ -682,7 +682,7 @@ int mei_register(struct mei_device *dev, struct device *parent) | |||
682 | /* Fill in the data structures */ | 682 | /* Fill in the data structures */ |
683 | devno = MKDEV(MAJOR(mei_devt), dev->minor); | 683 | devno = MKDEV(MAJOR(mei_devt), dev->minor); |
684 | cdev_init(&dev->cdev, &mei_fops); | 684 | cdev_init(&dev->cdev, &mei_fops); |
685 | dev->cdev.owner = mei_fops.owner; | 685 | dev->cdev.owner = parent->driver->owner; |
686 | 686 | ||
687 | /* Add the device */ | 687 | /* Add the device */ |
688 | ret = cdev_add(&dev->cdev, devno, 1); | 688 | ret = cdev_add(&dev->cdev, devno, 1); |
diff --git a/drivers/misc/mic/scif/scif_nodeqp.c b/drivers/misc/mic/scif/scif_nodeqp.c index 41e3bdb10061..6dfdae3452d6 100644 --- a/drivers/misc/mic/scif/scif_nodeqp.c +++ b/drivers/misc/mic/scif/scif_nodeqp.c | |||
@@ -357,7 +357,7 @@ static void scif_p2p_freesg(struct scatterlist *sg) | |||
357 | } | 357 | } |
358 | 358 | ||
359 | static struct scatterlist * | 359 | static struct scatterlist * |
360 | scif_p2p_setsg(void __iomem *va, int page_size, int page_cnt) | 360 | scif_p2p_setsg(phys_addr_t pa, int page_size, int page_cnt) |
361 | { | 361 | { |
362 | struct scatterlist *sg; | 362 | struct scatterlist *sg; |
363 | struct page *page; | 363 | struct page *page; |
@@ -368,16 +368,11 @@ scif_p2p_setsg(void __iomem *va, int page_size, int page_cnt) | |||
368 | return NULL; | 368 | return NULL; |
369 | sg_init_table(sg, page_cnt); | 369 | sg_init_table(sg, page_cnt); |
370 | for (i = 0; i < page_cnt; i++) { | 370 | for (i = 0; i < page_cnt; i++) { |
371 | page = vmalloc_to_page((void __force *)va); | 371 | page = pfn_to_page(pa >> PAGE_SHIFT); |
372 | if (!page) | ||
373 | goto p2p_sg_err; | ||
374 | sg_set_page(&sg[i], page, page_size, 0); | 372 | sg_set_page(&sg[i], page, page_size, 0); |
375 | va += page_size; | 373 | pa += page_size; |
376 | } | 374 | } |
377 | return sg; | 375 | return sg; |
378 | p2p_sg_err: | ||
379 | kfree(sg); | ||
380 | return NULL; | ||
381 | } | 376 | } |
382 | 377 | ||
383 | /* Init p2p mappings required to access peerdev from scifdev */ | 378 | /* Init p2p mappings required to access peerdev from scifdev */ |
@@ -395,14 +390,14 @@ scif_init_p2p_info(struct scif_dev *scifdev, struct scif_dev *peerdev) | |||
395 | p2p = kzalloc(sizeof(*p2p), GFP_KERNEL); | 390 | p2p = kzalloc(sizeof(*p2p), GFP_KERNEL); |
396 | if (!p2p) | 391 | if (!p2p) |
397 | return NULL; | 392 | return NULL; |
398 | p2p->ppi_sg[SCIF_PPI_MMIO] = scif_p2p_setsg(psdev->mmio->va, | 393 | p2p->ppi_sg[SCIF_PPI_MMIO] = scif_p2p_setsg(psdev->mmio->pa, |
399 | PAGE_SIZE, num_mmio_pages); | 394 | PAGE_SIZE, num_mmio_pages); |
400 | if (!p2p->ppi_sg[SCIF_PPI_MMIO]) | 395 | if (!p2p->ppi_sg[SCIF_PPI_MMIO]) |
401 | goto free_p2p; | 396 | goto free_p2p; |
402 | p2p->sg_nentries[SCIF_PPI_MMIO] = num_mmio_pages; | 397 | p2p->sg_nentries[SCIF_PPI_MMIO] = num_mmio_pages; |
403 | sg_page_shift = get_order(min(psdev->aper->len, (u64)(1 << 30))); | 398 | sg_page_shift = get_order(min(psdev->aper->len, (u64)(1 << 30))); |
404 | num_aper_chunks = num_aper_pages >> (sg_page_shift - PAGE_SHIFT); | 399 | num_aper_chunks = num_aper_pages >> (sg_page_shift - PAGE_SHIFT); |
405 | p2p->ppi_sg[SCIF_PPI_APER] = scif_p2p_setsg(psdev->aper->va, | 400 | p2p->ppi_sg[SCIF_PPI_APER] = scif_p2p_setsg(psdev->aper->pa, |
406 | 1 << sg_page_shift, | 401 | 1 << sg_page_shift, |
407 | num_aper_chunks); | 402 | num_aper_chunks); |
408 | p2p->sg_nentries[SCIF_PPI_APER] = num_aper_chunks; | 403 | p2p->sg_nentries[SCIF_PPI_APER] = num_aper_chunks; |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index c9c3d20b784b..a1b820fcb2a6 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -208,6 +208,8 @@ static ssize_t power_ro_lock_show(struct device *dev, | |||
208 | 208 | ||
209 | ret = snprintf(buf, PAGE_SIZE, "%d\n", locked); | 209 | ret = snprintf(buf, PAGE_SIZE, "%d\n", locked); |
210 | 210 | ||
211 | mmc_blk_put(md); | ||
212 | |||
211 | return ret; | 213 | return ret; |
212 | } | 214 | } |
213 | 215 | ||
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index fd9a58e216a5..6a0f9c79be26 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig | |||
@@ -779,6 +779,7 @@ config MMC_TOSHIBA_PCI | |||
779 | 779 | ||
780 | config MMC_MTK | 780 | config MMC_MTK |
781 | tristate "MediaTek SD/MMC Card Interface support" | 781 | tristate "MediaTek SD/MMC Card Interface support" |
782 | depends on HAS_DMA | ||
782 | help | 783 | help |
783 | This selects the MediaTek(R) Secure digital and Multimedia card Interface. | 784 | This selects the MediaTek(R) Secure digital and Multimedia card Interface. |
784 | If you have a machine with a integrated SD/MMC card reader, say Y or M here. | 785 | If you have a machine with a integrated SD/MMC card reader, say Y or M here. |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index b2b411da297b..4d1203236890 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -1062,9 +1062,14 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status) | |||
1062 | 1062 | ||
1063 | if (status & (CTO_EN | CCRC_EN)) | 1063 | if (status & (CTO_EN | CCRC_EN)) |
1064 | end_cmd = 1; | 1064 | end_cmd = 1; |
1065 | if (host->data || host->response_busy) { | ||
1066 | end_trans = !end_cmd; | ||
1067 | host->response_busy = 0; | ||
1068 | } | ||
1065 | if (status & (CTO_EN | DTO_EN)) | 1069 | if (status & (CTO_EN | DTO_EN)) |
1066 | hsmmc_command_incomplete(host, -ETIMEDOUT, end_cmd); | 1070 | hsmmc_command_incomplete(host, -ETIMEDOUT, end_cmd); |
1067 | else if (status & (CCRC_EN | DCRC_EN)) | 1071 | else if (status & (CCRC_EN | DCRC_EN | DEB_EN | CEB_EN | |
1072 | BADA_EN)) | ||
1068 | hsmmc_command_incomplete(host, -EILSEQ, end_cmd); | 1073 | hsmmc_command_incomplete(host, -EILSEQ, end_cmd); |
1069 | 1074 | ||
1070 | if (status & ACE_EN) { | 1075 | if (status & ACE_EN) { |
@@ -1081,10 +1086,6 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status) | |||
1081 | } | 1086 | } |
1082 | dev_dbg(mmc_dev(host->mmc), "AC12 err: 0x%x\n", ac12); | 1087 | dev_dbg(mmc_dev(host->mmc), "AC12 err: 0x%x\n", ac12); |
1083 | } | 1088 | } |
1084 | if (host->data || host->response_busy) { | ||
1085 | end_trans = !end_cmd; | ||
1086 | host->response_busy = 0; | ||
1087 | } | ||
1088 | } | 1089 | } |
1089 | 1090 | ||
1090 | OMAP_HSMMC_WRITE(host->base, STAT, status); | 1091 | OMAP_HSMMC_WRITE(host->base, STAT, status); |
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index faf0cb910c96..c6b9f6492e1a 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | |||
@@ -581,13 +581,8 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg) | |||
581 | static unsigned int esdhc_pltfm_get_max_clock(struct sdhci_host *host) | 581 | static unsigned int esdhc_pltfm_get_max_clock(struct sdhci_host *host) |
582 | { | 582 | { |
583 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); | 583 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); |
584 | struct pltfm_imx_data *imx_data = pltfm_host->priv; | ||
585 | struct esdhc_platform_data *boarddata = &imx_data->boarddata; | ||
586 | 584 | ||
587 | if (boarddata->f_max && (boarddata->f_max < pltfm_host->clock)) | 585 | return pltfm_host->clock; |
588 | return boarddata->f_max; | ||
589 | else | ||
590 | return pltfm_host->clock; | ||
591 | } | 586 | } |
592 | 587 | ||
593 | static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host) | 588 | static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host) |
@@ -878,34 +873,19 @@ static const struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = { | |||
878 | static int | 873 | static int |
879 | sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, | 874 | sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, |
880 | struct sdhci_host *host, | 875 | struct sdhci_host *host, |
881 | struct esdhc_platform_data *boarddata) | 876 | struct pltfm_imx_data *imx_data) |
882 | { | 877 | { |
883 | struct device_node *np = pdev->dev.of_node; | 878 | struct device_node *np = pdev->dev.of_node; |
884 | 879 | struct esdhc_platform_data *boarddata = &imx_data->boarddata; | |
885 | if (!np) | 880 | int ret; |
886 | return -ENODEV; | ||
887 | |||
888 | if (of_get_property(np, "non-removable", NULL)) | ||
889 | boarddata->cd_type = ESDHC_CD_PERMANENT; | ||
890 | |||
891 | if (of_get_property(np, "fsl,cd-controller", NULL)) | ||
892 | boarddata->cd_type = ESDHC_CD_CONTROLLER; | ||
893 | 881 | ||
894 | if (of_get_property(np, "fsl,wp-controller", NULL)) | 882 | if (of_get_property(np, "fsl,wp-controller", NULL)) |
895 | boarddata->wp_type = ESDHC_WP_CONTROLLER; | 883 | boarddata->wp_type = ESDHC_WP_CONTROLLER; |
896 | 884 | ||
897 | boarddata->cd_gpio = of_get_named_gpio(np, "cd-gpios", 0); | ||
898 | if (gpio_is_valid(boarddata->cd_gpio)) | ||
899 | boarddata->cd_type = ESDHC_CD_GPIO; | ||
900 | |||
901 | boarddata->wp_gpio = of_get_named_gpio(np, "wp-gpios", 0); | 885 | boarddata->wp_gpio = of_get_named_gpio(np, "wp-gpios", 0); |
902 | if (gpio_is_valid(boarddata->wp_gpio)) | 886 | if (gpio_is_valid(boarddata->wp_gpio)) |
903 | boarddata->wp_type = ESDHC_WP_GPIO; | 887 | boarddata->wp_type = ESDHC_WP_GPIO; |
904 | 888 | ||
905 | of_property_read_u32(np, "bus-width", &boarddata->max_bus_width); | ||
906 | |||
907 | of_property_read_u32(np, "max-frequency", &boarddata->f_max); | ||
908 | |||
909 | if (of_find_property(np, "no-1-8-v", NULL)) | 889 | if (of_find_property(np, "no-1-8-v", NULL)) |
910 | boarddata->support_vsel = false; | 890 | boarddata->support_vsel = false; |
911 | else | 891 | else |
@@ -916,29 +896,119 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, | |||
916 | 896 | ||
917 | mmc_of_parse_voltage(np, &host->ocr_mask); | 897 | mmc_of_parse_voltage(np, &host->ocr_mask); |
918 | 898 | ||
899 | /* sdr50 and sdr104 needs work on 1.8v signal voltage */ | ||
900 | if ((boarddata->support_vsel) && esdhc_is_usdhc(imx_data) && | ||
901 | !IS_ERR(imx_data->pins_default)) { | ||
902 | imx_data->pins_100mhz = pinctrl_lookup_state(imx_data->pinctrl, | ||
903 | ESDHC_PINCTRL_STATE_100MHZ); | ||
904 | imx_data->pins_200mhz = pinctrl_lookup_state(imx_data->pinctrl, | ||
905 | ESDHC_PINCTRL_STATE_200MHZ); | ||
906 | if (IS_ERR(imx_data->pins_100mhz) || | ||
907 | IS_ERR(imx_data->pins_200mhz)) { | ||
908 | dev_warn(mmc_dev(host->mmc), | ||
909 | "could not get ultra high speed state, work on normal mode\n"); | ||
910 | /* | ||
911 | * fall back to not support uhs by specify no 1.8v quirk | ||
912 | */ | ||
913 | host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; | ||
914 | } | ||
915 | } else { | ||
916 | host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; | ||
917 | } | ||
918 | |||
919 | /* call to generic mmc_of_parse to support additional capabilities */ | 919 | /* call to generic mmc_of_parse to support additional capabilities */ |
920 | return mmc_of_parse(host->mmc); | 920 | ret = mmc_of_parse(host->mmc); |
921 | if (ret) | ||
922 | return ret; | ||
923 | |||
924 | if (!IS_ERR_VALUE(mmc_gpio_get_cd(host->mmc))) | ||
925 | host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION; | ||
926 | |||
927 | return 0; | ||
921 | } | 928 | } |
922 | #else | 929 | #else |
923 | static inline int | 930 | static inline int |
924 | sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, | 931 | sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, |
925 | struct sdhci_host *host, | 932 | struct sdhci_host *host, |
926 | struct esdhc_platform_data *boarddata) | 933 | struct pltfm_imx_data *imx_data) |
927 | { | 934 | { |
928 | return -ENODEV; | 935 | return -ENODEV; |
929 | } | 936 | } |
930 | #endif | 937 | #endif |
931 | 938 | ||
939 | static int sdhci_esdhc_imx_probe_nondt(struct platform_device *pdev, | ||
940 | struct sdhci_host *host, | ||
941 | struct pltfm_imx_data *imx_data) | ||
942 | { | ||
943 | struct esdhc_platform_data *boarddata = &imx_data->boarddata; | ||
944 | int err; | ||
945 | |||
946 | if (!host->mmc->parent->platform_data) { | ||
947 | dev_err(mmc_dev(host->mmc), "no board data!\n"); | ||
948 | return -EINVAL; | ||
949 | } | ||
950 | |||
951 | imx_data->boarddata = *((struct esdhc_platform_data *) | ||
952 | host->mmc->parent->platform_data); | ||
953 | /* write_protect */ | ||
954 | if (boarddata->wp_type == ESDHC_WP_GPIO) { | ||
955 | err = mmc_gpio_request_ro(host->mmc, boarddata->wp_gpio); | ||
956 | if (err) { | ||
957 | dev_err(mmc_dev(host->mmc), | ||
958 | "failed to request write-protect gpio!\n"); | ||
959 | return err; | ||
960 | } | ||
961 | host->mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; | ||
962 | } | ||
963 | |||
964 | /* card_detect */ | ||
965 | switch (boarddata->cd_type) { | ||
966 | case ESDHC_CD_GPIO: | ||
967 | err = mmc_gpio_request_cd(host->mmc, boarddata->cd_gpio, 0); | ||
968 | if (err) { | ||
969 | dev_err(mmc_dev(host->mmc), | ||
970 | "failed to request card-detect gpio!\n"); | ||
971 | return err; | ||
972 | } | ||
973 | /* fall through */ | ||
974 | |||
975 | case ESDHC_CD_CONTROLLER: | ||
976 | /* we have a working card_detect back */ | ||
977 | host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION; | ||
978 | break; | ||
979 | |||
980 | case ESDHC_CD_PERMANENT: | ||
981 | host->mmc->caps |= MMC_CAP_NONREMOVABLE; | ||
982 | break; | ||
983 | |||
984 | case ESDHC_CD_NONE: | ||
985 | break; | ||
986 | } | ||
987 | |||
988 | switch (boarddata->max_bus_width) { | ||
989 | case 8: | ||
990 | host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA; | ||
991 | break; | ||
992 | case 4: | ||
993 | host->mmc->caps |= MMC_CAP_4_BIT_DATA; | ||
994 | break; | ||
995 | case 1: | ||
996 | default: | ||
997 | host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA; | ||
998 | break; | ||
999 | } | ||
1000 | |||
1001 | return 0; | ||
1002 | } | ||
1003 | |||
932 | static int sdhci_esdhc_imx_probe(struct platform_device *pdev) | 1004 | static int sdhci_esdhc_imx_probe(struct platform_device *pdev) |
933 | { | 1005 | { |
934 | const struct of_device_id *of_id = | 1006 | const struct of_device_id *of_id = |
935 | of_match_device(imx_esdhc_dt_ids, &pdev->dev); | 1007 | of_match_device(imx_esdhc_dt_ids, &pdev->dev); |
936 | struct sdhci_pltfm_host *pltfm_host; | 1008 | struct sdhci_pltfm_host *pltfm_host; |
937 | struct sdhci_host *host; | 1009 | struct sdhci_host *host; |
938 | struct esdhc_platform_data *boarddata; | ||
939 | int err; | 1010 | int err; |
940 | struct pltfm_imx_data *imx_data; | 1011 | struct pltfm_imx_data *imx_data; |
941 | bool dt = true; | ||
942 | 1012 | ||
943 | host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata, 0); | 1013 | host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata, 0); |
944 | if (IS_ERR(host)) | 1014 | if (IS_ERR(host)) |
@@ -1030,84 +1100,12 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) | |||
1030 | if (imx_data->socdata->flags & ESDHC_FLAG_ERR004536) | 1100 | if (imx_data->socdata->flags & ESDHC_FLAG_ERR004536) |
1031 | host->quirks |= SDHCI_QUIRK_BROKEN_ADMA; | 1101 | host->quirks |= SDHCI_QUIRK_BROKEN_ADMA; |
1032 | 1102 | ||
1033 | boarddata = &imx_data->boarddata; | 1103 | if (of_id) |
1034 | if (sdhci_esdhc_imx_probe_dt(pdev, host, boarddata) < 0) { | 1104 | err = sdhci_esdhc_imx_probe_dt(pdev, host, imx_data); |
1035 | if (!host->mmc->parent->platform_data) { | 1105 | else |
1036 | dev_err(mmc_dev(host->mmc), "no board data!\n"); | 1106 | err = sdhci_esdhc_imx_probe_nondt(pdev, host, imx_data); |
1037 | err = -EINVAL; | 1107 | if (err) |
1038 | goto disable_clk; | 1108 | goto disable_clk; |
1039 | } | ||
1040 | imx_data->boarddata = *((struct esdhc_platform_data *) | ||
1041 | host->mmc->parent->platform_data); | ||
1042 | dt = false; | ||
1043 | } | ||
1044 | /* write_protect */ | ||
1045 | if (boarddata->wp_type == ESDHC_WP_GPIO && !dt) { | ||
1046 | err = mmc_gpio_request_ro(host->mmc, boarddata->wp_gpio); | ||
1047 | if (err) { | ||
1048 | dev_err(mmc_dev(host->mmc), | ||
1049 | "failed to request write-protect gpio!\n"); | ||
1050 | goto disable_clk; | ||
1051 | } | ||
1052 | host->mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; | ||
1053 | } | ||
1054 | |||
1055 | /* card_detect */ | ||
1056 | switch (boarddata->cd_type) { | ||
1057 | case ESDHC_CD_GPIO: | ||
1058 | if (dt) | ||
1059 | break; | ||
1060 | err = mmc_gpio_request_cd(host->mmc, boarddata->cd_gpio, 0); | ||
1061 | if (err) { | ||
1062 | dev_err(mmc_dev(host->mmc), | ||
1063 | "failed to request card-detect gpio!\n"); | ||
1064 | goto disable_clk; | ||
1065 | } | ||
1066 | /* fall through */ | ||
1067 | |||
1068 | case ESDHC_CD_CONTROLLER: | ||
1069 | /* we have a working card_detect back */ | ||
1070 | host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION; | ||
1071 | break; | ||
1072 | |||
1073 | case ESDHC_CD_PERMANENT: | ||
1074 | host->mmc->caps |= MMC_CAP_NONREMOVABLE; | ||
1075 | break; | ||
1076 | |||
1077 | case ESDHC_CD_NONE: | ||
1078 | break; | ||
1079 | } | ||
1080 | |||
1081 | switch (boarddata->max_bus_width) { | ||
1082 | case 8: | ||
1083 | host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA; | ||
1084 | break; | ||
1085 | case 4: | ||
1086 | host->mmc->caps |= MMC_CAP_4_BIT_DATA; | ||
1087 | break; | ||
1088 | case 1: | ||
1089 | default: | ||
1090 | host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA; | ||
1091 | break; | ||
1092 | } | ||
1093 | |||
1094 | /* sdr50 and sdr104 needs work on 1.8v signal voltage */ | ||
1095 | if ((boarddata->support_vsel) && esdhc_is_usdhc(imx_data) && | ||
1096 | !IS_ERR(imx_data->pins_default)) { | ||
1097 | imx_data->pins_100mhz = pinctrl_lookup_state(imx_data->pinctrl, | ||
1098 | ESDHC_PINCTRL_STATE_100MHZ); | ||
1099 | imx_data->pins_200mhz = pinctrl_lookup_state(imx_data->pinctrl, | ||
1100 | ESDHC_PINCTRL_STATE_200MHZ); | ||
1101 | if (IS_ERR(imx_data->pins_100mhz) || | ||
1102 | IS_ERR(imx_data->pins_200mhz)) { | ||
1103 | dev_warn(mmc_dev(host->mmc), | ||
1104 | "could not get ultra high speed state, work on normal mode\n"); | ||
1105 | /* fall back to not support uhs by specify no 1.8v quirk */ | ||
1106 | host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; | ||
1107 | } | ||
1108 | } else { | ||
1109 | host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; | ||
1110 | } | ||
1111 | 1109 | ||
1112 | err = sdhci_add_host(host); | 1110 | err = sdhci_add_host(host); |
1113 | if (err) | 1111 | if (err) |
diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h index 3497cfaf683c..a870c42731d7 100644 --- a/drivers/mmc/host/sdhci-esdhc.h +++ b/drivers/mmc/host/sdhci-esdhc.h | |||
@@ -45,6 +45,6 @@ | |||
45 | #define ESDHC_DMA_SYSCTL 0x40c | 45 | #define ESDHC_DMA_SYSCTL 0x40c |
46 | #define ESDHC_DMA_SNOOP 0x00000040 | 46 | #define ESDHC_DMA_SNOOP 0x00000040 |
47 | 47 | ||
48 | #define ESDHC_HOST_CONTROL_RES 0x05 | 48 | #define ESDHC_HOST_CONTROL_RES 0x01 |
49 | 49 | ||
50 | #endif /* _DRIVERS_MMC_SDHCI_ESDHC_H */ | 50 | #endif /* _DRIVERS_MMC_SDHCI_ESDHC_H */ |
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c index 9cd5fc62f130..946d37f94a31 100644 --- a/drivers/mmc/host/sdhci-pxav3.c +++ b/drivers/mmc/host/sdhci-pxav3.c | |||
@@ -411,6 +411,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) | |||
411 | goto err_of_parse; | 411 | goto err_of_parse; |
412 | sdhci_get_of_property(pdev); | 412 | sdhci_get_of_property(pdev); |
413 | pdata = pxav3_get_mmc_pdata(dev); | 413 | pdata = pxav3_get_mmc_pdata(dev); |
414 | pdev->dev.platform_data = pdata; | ||
414 | } else if (pdata) { | 415 | } else if (pdata) { |
415 | /* on-chip device */ | 416 | /* on-chip device */ |
416 | if (pdata->flags & PXA_FLAG_CARD_PERMANENT) | 417 | if (pdata->flags & PXA_FLAG_CARD_PERMANENT) |
diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c index df088343d60f..255a896769b8 100644 --- a/drivers/mmc/host/sdhci-spear.c +++ b/drivers/mmc/host/sdhci-spear.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Support of SDHCI platform devices for spear soc family | 4 | * Support of SDHCI platform devices for spear soc family |
5 | * | 5 | * |
6 | * Copyright (C) 2010 ST Microelectronics | 6 | * Copyright (C) 2010 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * Inspired by sdhci-pltfm.c | 9 | * Inspired by sdhci-pltfm.c |
10 | * | 10 | * |
@@ -211,5 +211,5 @@ static struct platform_driver sdhci_driver = { | |||
211 | module_platform_driver(sdhci_driver); | 211 | module_platform_driver(sdhci_driver); |
212 | 212 | ||
213 | MODULE_DESCRIPTION("SPEAr Secure Digital Host Controller Interface driver"); | 213 | MODULE_DESCRIPTION("SPEAr Secure Digital Host Controller Interface driver"); |
214 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); | 214 | MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>"); |
215 | MODULE_LICENSE("GPL v2"); | 215 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index bc1445238fb3..1dbe93232030 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -2866,6 +2866,7 @@ int sdhci_add_host(struct sdhci_host *host) | |||
2866 | u32 max_current_caps; | 2866 | u32 max_current_caps; |
2867 | unsigned int ocr_avail; | 2867 | unsigned int ocr_avail; |
2868 | unsigned int override_timeout_clk; | 2868 | unsigned int override_timeout_clk; |
2869 | u32 max_clk; | ||
2869 | int ret; | 2870 | int ret; |
2870 | 2871 | ||
2871 | WARN_ON(host == NULL); | 2872 | WARN_ON(host == NULL); |
@@ -2978,8 +2979,11 @@ int sdhci_add_host(struct sdhci_host *host) | |||
2978 | GFP_KERNEL); | 2979 | GFP_KERNEL); |
2979 | host->align_buffer = kmalloc(host->align_buffer_sz, GFP_KERNEL); | 2980 | host->align_buffer = kmalloc(host->align_buffer_sz, GFP_KERNEL); |
2980 | if (!host->adma_table || !host->align_buffer) { | 2981 | if (!host->adma_table || !host->align_buffer) { |
2981 | dma_free_coherent(mmc_dev(mmc), host->adma_table_sz, | 2982 | if (host->adma_table) |
2982 | host->adma_table, host->adma_addr); | 2983 | dma_free_coherent(mmc_dev(mmc), |
2984 | host->adma_table_sz, | ||
2985 | host->adma_table, | ||
2986 | host->adma_addr); | ||
2983 | kfree(host->align_buffer); | 2987 | kfree(host->align_buffer); |
2984 | pr_warn("%s: Unable to allocate ADMA buffers - falling back to standard DMA\n", | 2988 | pr_warn("%s: Unable to allocate ADMA buffers - falling back to standard DMA\n", |
2985 | mmc_hostname(mmc)); | 2989 | mmc_hostname(mmc)); |
@@ -3047,18 +3051,22 @@ int sdhci_add_host(struct sdhci_host *host) | |||
3047 | * Set host parameters. | 3051 | * Set host parameters. |
3048 | */ | 3052 | */ |
3049 | mmc->ops = &sdhci_ops; | 3053 | mmc->ops = &sdhci_ops; |
3050 | mmc->f_max = host->max_clk; | 3054 | max_clk = host->max_clk; |
3055 | |||
3051 | if (host->ops->get_min_clock) | 3056 | if (host->ops->get_min_clock) |
3052 | mmc->f_min = host->ops->get_min_clock(host); | 3057 | mmc->f_min = host->ops->get_min_clock(host); |
3053 | else if (host->version >= SDHCI_SPEC_300) { | 3058 | else if (host->version >= SDHCI_SPEC_300) { |
3054 | if (host->clk_mul) { | 3059 | if (host->clk_mul) { |
3055 | mmc->f_min = (host->max_clk * host->clk_mul) / 1024; | 3060 | mmc->f_min = (host->max_clk * host->clk_mul) / 1024; |
3056 | mmc->f_max = host->max_clk * host->clk_mul; | 3061 | max_clk = host->max_clk * host->clk_mul; |
3057 | } else | 3062 | } else |
3058 | mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300; | 3063 | mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300; |
3059 | } else | 3064 | } else |
3060 | mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200; | 3065 | mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200; |
3061 | 3066 | ||
3067 | if (!mmc->f_max || (mmc->f_max && (mmc->f_max > max_clk))) | ||
3068 | mmc->f_max = max_clk; | ||
3069 | |||
3062 | if (!(host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK)) { | 3070 | if (!(host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK)) { |
3063 | host->timeout_clk = (caps[0] & SDHCI_TIMEOUT_CLK_MASK) >> | 3071 | host->timeout_clk = (caps[0] & SDHCI_TIMEOUT_CLK_MASK) >> |
3064 | SDHCI_TIMEOUT_CLK_SHIFT; | 3072 | SDHCI_TIMEOUT_CLK_SHIFT; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 19eb990d398c..e1ccefce9a9d 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -625,6 +625,23 @@ static void bond_set_dev_addr(struct net_device *bond_dev, | |||
625 | call_netdevice_notifiers(NETDEV_CHANGEADDR, bond_dev); | 625 | call_netdevice_notifiers(NETDEV_CHANGEADDR, bond_dev); |
626 | } | 626 | } |
627 | 627 | ||
628 | static struct slave *bond_get_old_active(struct bonding *bond, | ||
629 | struct slave *new_active) | ||
630 | { | ||
631 | struct slave *slave; | ||
632 | struct list_head *iter; | ||
633 | |||
634 | bond_for_each_slave(bond, slave, iter) { | ||
635 | if (slave == new_active) | ||
636 | continue; | ||
637 | |||
638 | if (ether_addr_equal(bond->dev->dev_addr, slave->dev->dev_addr)) | ||
639 | return slave; | ||
640 | } | ||
641 | |||
642 | return NULL; | ||
643 | } | ||
644 | |||
628 | /* bond_do_fail_over_mac | 645 | /* bond_do_fail_over_mac |
629 | * | 646 | * |
630 | * Perform special MAC address swapping for fail_over_mac settings | 647 | * Perform special MAC address swapping for fail_over_mac settings |
@@ -652,6 +669,9 @@ static void bond_do_fail_over_mac(struct bonding *bond, | |||
652 | if (!new_active) | 669 | if (!new_active) |
653 | return; | 670 | return; |
654 | 671 | ||
672 | if (!old_active) | ||
673 | old_active = bond_get_old_active(bond, new_active); | ||
674 | |||
655 | if (old_active) { | 675 | if (old_active) { |
656 | ether_addr_copy(tmp_mac, new_active->dev->dev_addr); | 676 | ether_addr_copy(tmp_mac, new_active->dev->dev_addr); |
657 | ether_addr_copy(saddr.sa_data, | 677 | ether_addr_copy(saddr.sa_data, |
@@ -689,40 +709,57 @@ out: | |||
689 | 709 | ||
690 | } | 710 | } |
691 | 711 | ||
692 | static bool bond_should_change_active(struct bonding *bond) | 712 | static struct slave *bond_choose_primary_or_current(struct bonding *bond) |
693 | { | 713 | { |
694 | struct slave *prim = rtnl_dereference(bond->primary_slave); | 714 | struct slave *prim = rtnl_dereference(bond->primary_slave); |
695 | struct slave *curr = rtnl_dereference(bond->curr_active_slave); | 715 | struct slave *curr = rtnl_dereference(bond->curr_active_slave); |
696 | 716 | ||
697 | if (!prim || !curr || curr->link != BOND_LINK_UP) | 717 | if (!prim || prim->link != BOND_LINK_UP) { |
698 | return true; | 718 | if (!curr || curr->link != BOND_LINK_UP) |
719 | return NULL; | ||
720 | return curr; | ||
721 | } | ||
722 | |||
699 | if (bond->force_primary) { | 723 | if (bond->force_primary) { |
700 | bond->force_primary = false; | 724 | bond->force_primary = false; |
701 | return true; | 725 | return prim; |
726 | } | ||
727 | |||
728 | if (!curr || curr->link != BOND_LINK_UP) | ||
729 | return prim; | ||
730 | |||
731 | /* At this point, prim and curr are both up */ | ||
732 | switch (bond->params.primary_reselect) { | ||
733 | case BOND_PRI_RESELECT_ALWAYS: | ||
734 | return prim; | ||
735 | case BOND_PRI_RESELECT_BETTER: | ||
736 | if (prim->speed < curr->speed) | ||
737 | return curr; | ||
738 | if (prim->speed == curr->speed && prim->duplex <= curr->duplex) | ||
739 | return curr; | ||
740 | return prim; | ||
741 | case BOND_PRI_RESELECT_FAILURE: | ||
742 | return curr; | ||
743 | default: | ||
744 | netdev_err(bond->dev, "impossible primary_reselect %d\n", | ||
745 | bond->params.primary_reselect); | ||
746 | return curr; | ||
702 | } | 747 | } |
703 | if (bond->params.primary_reselect == BOND_PRI_RESELECT_BETTER && | ||
704 | (prim->speed < curr->speed || | ||
705 | (prim->speed == curr->speed && prim->duplex <= curr->duplex))) | ||
706 | return false; | ||
707 | if (bond->params.primary_reselect == BOND_PRI_RESELECT_FAILURE) | ||
708 | return false; | ||
709 | return true; | ||
710 | } | 748 | } |
711 | 749 | ||
712 | /** | 750 | /** |
713 | * find_best_interface - select the best available slave to be the active one | 751 | * bond_find_best_slave - select the best available slave to be the active one |
714 | * @bond: our bonding struct | 752 | * @bond: our bonding struct |
715 | */ | 753 | */ |
716 | static struct slave *bond_find_best_slave(struct bonding *bond) | 754 | static struct slave *bond_find_best_slave(struct bonding *bond) |
717 | { | 755 | { |
718 | struct slave *slave, *bestslave = NULL, *primary; | 756 | struct slave *slave, *bestslave = NULL; |
719 | struct list_head *iter; | 757 | struct list_head *iter; |
720 | int mintime = bond->params.updelay; | 758 | int mintime = bond->params.updelay; |
721 | 759 | ||
722 | primary = rtnl_dereference(bond->primary_slave); | 760 | slave = bond_choose_primary_or_current(bond); |
723 | if (primary && primary->link == BOND_LINK_UP && | 761 | if (slave) |
724 | bond_should_change_active(bond)) | 762 | return slave; |
725 | return primary; | ||
726 | 763 | ||
727 | bond_for_each_slave(bond, slave, iter) { | 764 | bond_for_each_slave(bond, slave, iter) { |
728 | if (slave->link == BOND_LINK_UP) | 765 | if (slave->link == BOND_LINK_UP) |
@@ -1708,9 +1745,16 @@ err_free: | |||
1708 | 1745 | ||
1709 | err_undo_flags: | 1746 | err_undo_flags: |
1710 | /* Enslave of first slave has failed and we need to fix master's mac */ | 1747 | /* Enslave of first slave has failed and we need to fix master's mac */ |
1711 | if (!bond_has_slaves(bond) && | 1748 | if (!bond_has_slaves(bond)) { |
1712 | ether_addr_equal_64bits(bond_dev->dev_addr, slave_dev->dev_addr)) | 1749 | if (ether_addr_equal_64bits(bond_dev->dev_addr, |
1713 | eth_hw_addr_random(bond_dev); | 1750 | slave_dev->dev_addr)) |
1751 | eth_hw_addr_random(bond_dev); | ||
1752 | if (bond_dev->type != ARPHRD_ETHER) { | ||
1753 | ether_setup(bond_dev); | ||
1754 | bond_dev->flags |= IFF_MASTER; | ||
1755 | bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING; | ||
1756 | } | ||
1757 | } | ||
1714 | 1758 | ||
1715 | return res; | 1759 | return res; |
1716 | } | 1760 | } |
@@ -1899,6 +1943,7 @@ static int bond_release_and_destroy(struct net_device *bond_dev, | |||
1899 | bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; | 1943 | bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; |
1900 | netdev_info(bond_dev, "Destroying bond %s\n", | 1944 | netdev_info(bond_dev, "Destroying bond %s\n", |
1901 | bond_dev->name); | 1945 | bond_dev->name); |
1946 | bond_remove_proc_entry(bond); | ||
1902 | unregister_netdevice(bond_dev); | 1947 | unregister_netdevice(bond_dev); |
1903 | } | 1948 | } |
1904 | return ret; | 1949 | return ret; |
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index f4e40aa4d2a2..945c0955a967 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c | |||
@@ -577,10 +577,10 @@ static void at91_rx_overflow_err(struct net_device *dev) | |||
577 | 577 | ||
578 | cf->can_id |= CAN_ERR_CRTL; | 578 | cf->can_id |= CAN_ERR_CRTL; |
579 | cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; | 579 | cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; |
580 | netif_receive_skb(skb); | ||
581 | 580 | ||
582 | stats->rx_packets++; | 581 | stats->rx_packets++; |
583 | stats->rx_bytes += cf->can_dlc; | 582 | stats->rx_bytes += cf->can_dlc; |
583 | netif_receive_skb(skb); | ||
584 | } | 584 | } |
585 | 585 | ||
586 | /** | 586 | /** |
@@ -642,10 +642,10 @@ static void at91_read_msg(struct net_device *dev, unsigned int mb) | |||
642 | } | 642 | } |
643 | 643 | ||
644 | at91_read_mb(dev, mb, cf); | 644 | at91_read_mb(dev, mb, cf); |
645 | netif_receive_skb(skb); | ||
646 | 645 | ||
647 | stats->rx_packets++; | 646 | stats->rx_packets++; |
648 | stats->rx_bytes += cf->can_dlc; | 647 | stats->rx_bytes += cf->can_dlc; |
648 | netif_receive_skb(skb); | ||
649 | 649 | ||
650 | can_led_event(dev, CAN_LED_EVENT_RX); | 650 | can_led_event(dev, CAN_LED_EVENT_RX); |
651 | } | 651 | } |
@@ -802,10 +802,10 @@ static int at91_poll_err(struct net_device *dev, int quota, u32 reg_sr) | |||
802 | return 0; | 802 | return 0; |
803 | 803 | ||
804 | at91_poll_err_frame(dev, cf, reg_sr); | 804 | at91_poll_err_frame(dev, cf, reg_sr); |
805 | netif_receive_skb(skb); | ||
806 | 805 | ||
807 | dev->stats.rx_packets++; | 806 | dev->stats.rx_packets++; |
808 | dev->stats.rx_bytes += cf->can_dlc; | 807 | dev->stats.rx_bytes += cf->can_dlc; |
808 | netif_receive_skb(skb); | ||
809 | 809 | ||
810 | return 1; | 810 | return 1; |
811 | } | 811 | } |
@@ -1067,10 +1067,10 @@ static void at91_irq_err(struct net_device *dev) | |||
1067 | return; | 1067 | return; |
1068 | 1068 | ||
1069 | at91_irq_err_state(dev, cf, new_state); | 1069 | at91_irq_err_state(dev, cf, new_state); |
1070 | netif_rx(skb); | ||
1071 | 1070 | ||
1072 | dev->stats.rx_packets++; | 1071 | dev->stats.rx_packets++; |
1073 | dev->stats.rx_bytes += cf->can_dlc; | 1072 | dev->stats.rx_bytes += cf->can_dlc; |
1073 | netif_rx(skb); | ||
1074 | 1074 | ||
1075 | priv->can.state = new_state; | 1075 | priv->can.state = new_state; |
1076 | } | 1076 | } |
diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c index 27ad312e7abf..57dadd52b428 100644 --- a/drivers/net/can/bfin_can.c +++ b/drivers/net/can/bfin_can.c | |||
@@ -424,10 +424,9 @@ static void bfin_can_rx(struct net_device *dev, u16 isrc) | |||
424 | cf->data[6 - i] = (6 - i) < cf->can_dlc ? (val >> 8) : 0; | 424 | cf->data[6 - i] = (6 - i) < cf->can_dlc ? (val >> 8) : 0; |
425 | } | 425 | } |
426 | 426 | ||
427 | netif_rx(skb); | ||
428 | |||
429 | stats->rx_packets++; | 427 | stats->rx_packets++; |
430 | stats->rx_bytes += cf->can_dlc; | 428 | stats->rx_bytes += cf->can_dlc; |
429 | netif_rx(skb); | ||
431 | } | 430 | } |
432 | 431 | ||
433 | static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status) | 432 | static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status) |
@@ -508,10 +507,9 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status) | |||
508 | 507 | ||
509 | priv->can.state = state; | 508 | priv->can.state = state; |
510 | 509 | ||
511 | netif_rx(skb); | ||
512 | |||
513 | stats->rx_packets++; | 510 | stats->rx_packets++; |
514 | stats->rx_bytes += cf->can_dlc; | 511 | stats->rx_bytes += cf->can_dlc; |
512 | netif_rx(skb); | ||
515 | 513 | ||
516 | return 0; | 514 | return 0; |
517 | } | 515 | } |
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index 041525d2595c..5d214d135332 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c | |||
@@ -592,6 +592,7 @@ static int c_can_start(struct net_device *dev) | |||
592 | { | 592 | { |
593 | struct c_can_priv *priv = netdev_priv(dev); | 593 | struct c_can_priv *priv = netdev_priv(dev); |
594 | int err; | 594 | int err; |
595 | struct pinctrl *p; | ||
595 | 596 | ||
596 | /* basic c_can configuration */ | 597 | /* basic c_can configuration */ |
597 | err = c_can_chip_config(dev); | 598 | err = c_can_chip_config(dev); |
@@ -604,8 +605,13 @@ static int c_can_start(struct net_device *dev) | |||
604 | 605 | ||
605 | priv->can.state = CAN_STATE_ERROR_ACTIVE; | 606 | priv->can.state = CAN_STATE_ERROR_ACTIVE; |
606 | 607 | ||
607 | /* activate pins */ | 608 | /* Attempt to use "active" if available else use "default" */ |
608 | pinctrl_pm_select_default_state(dev->dev.parent); | 609 | p = pinctrl_get_select(priv->device, "active"); |
610 | if (!IS_ERR(p)) | ||
611 | pinctrl_put(p); | ||
612 | else | ||
613 | pinctrl_pm_select_default_state(priv->device); | ||
614 | |||
609 | return 0; | 615 | return 0; |
610 | } | 616 | } |
611 | 617 | ||
diff --git a/drivers/net/can/cc770/cc770.c b/drivers/net/can/cc770/cc770.c index c11d44984036..70a8cbb29e75 100644 --- a/drivers/net/can/cc770/cc770.c +++ b/drivers/net/can/cc770/cc770.c | |||
@@ -504,10 +504,10 @@ static void cc770_rx(struct net_device *dev, unsigned int mo, u8 ctrl1) | |||
504 | for (i = 0; i < cf->can_dlc; i++) | 504 | for (i = 0; i < cf->can_dlc; i++) |
505 | cf->data[i] = cc770_read_reg(priv, msgobj[mo].data[i]); | 505 | cf->data[i] = cc770_read_reg(priv, msgobj[mo].data[i]); |
506 | } | 506 | } |
507 | netif_rx(skb); | ||
508 | 507 | ||
509 | stats->rx_packets++; | 508 | stats->rx_packets++; |
510 | stats->rx_bytes += cf->can_dlc; | 509 | stats->rx_bytes += cf->can_dlc; |
510 | netif_rx(skb); | ||
511 | } | 511 | } |
512 | 512 | ||
513 | static int cc770_err(struct net_device *dev, u8 status) | 513 | static int cc770_err(struct net_device *dev, u8 status) |
@@ -584,10 +584,10 @@ static int cc770_err(struct net_device *dev, u8 status) | |||
584 | } | 584 | } |
585 | } | 585 | } |
586 | 586 | ||
587 | netif_rx(skb); | ||
588 | 587 | ||
589 | stats->rx_packets++; | 588 | stats->rx_packets++; |
590 | stats->rx_bytes += cf->can_dlc; | 589 | stats->rx_bytes += cf->can_dlc; |
590 | netif_rx(skb); | ||
591 | 591 | ||
592 | return 0; | 592 | return 0; |
593 | } | 593 | } |
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index e9b1810d319f..aede704605c6 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
@@ -440,9 +440,6 @@ unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx) | |||
440 | struct can_frame *cf = (struct can_frame *)skb->data; | 440 | struct can_frame *cf = (struct can_frame *)skb->data; |
441 | u8 dlc = cf->can_dlc; | 441 | u8 dlc = cf->can_dlc; |
442 | 442 | ||
443 | if (!(skb->tstamp.tv64)) | ||
444 | __net_timestamp(skb); | ||
445 | |||
446 | netif_rx(priv->echo_skb[idx]); | 443 | netif_rx(priv->echo_skb[idx]); |
447 | priv->echo_skb[idx] = NULL; | 444 | priv->echo_skb[idx] = NULL; |
448 | 445 | ||
@@ -578,7 +575,6 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) | |||
578 | if (unlikely(!skb)) | 575 | if (unlikely(!skb)) |
579 | return NULL; | 576 | return NULL; |
580 | 577 | ||
581 | __net_timestamp(skb); | ||
582 | skb->protocol = htons(ETH_P_CAN); | 578 | skb->protocol = htons(ETH_P_CAN); |
583 | skb->pkt_type = PACKET_BROADCAST; | 579 | skb->pkt_type = PACKET_BROADCAST; |
584 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 580 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -589,6 +585,7 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) | |||
589 | 585 | ||
590 | can_skb_reserve(skb); | 586 | can_skb_reserve(skb); |
591 | can_skb_prv(skb)->ifindex = dev->ifindex; | 587 | can_skb_prv(skb)->ifindex = dev->ifindex; |
588 | can_skb_prv(skb)->skbcnt = 0; | ||
592 | 589 | ||
593 | *cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame)); | 590 | *cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame)); |
594 | memset(*cf, 0, sizeof(struct can_frame)); | 591 | memset(*cf, 0, sizeof(struct can_frame)); |
@@ -607,7 +604,6 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev, | |||
607 | if (unlikely(!skb)) | 604 | if (unlikely(!skb)) |
608 | return NULL; | 605 | return NULL; |
609 | 606 | ||
610 | __net_timestamp(skb); | ||
611 | skb->protocol = htons(ETH_P_CANFD); | 607 | skb->protocol = htons(ETH_P_CANFD); |
612 | skb->pkt_type = PACKET_BROADCAST; | 608 | skb->pkt_type = PACKET_BROADCAST; |
613 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 609 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -618,6 +614,7 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev, | |||
618 | 614 | ||
619 | can_skb_reserve(skb); | 615 | can_skb_reserve(skb); |
620 | can_skb_prv(skb)->ifindex = dev->ifindex; | 616 | can_skb_prv(skb)->ifindex = dev->ifindex; |
617 | can_skb_prv(skb)->skbcnt = 0; | ||
621 | 618 | ||
622 | *cfd = (struct canfd_frame *)skb_put(skb, sizeof(struct canfd_frame)); | 619 | *cfd = (struct canfd_frame *)skb_put(skb, sizeof(struct canfd_frame)); |
623 | memset(*cfd, 0, sizeof(struct canfd_frame)); | 620 | memset(*cfd, 0, sizeof(struct canfd_frame)); |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 6201c5a1a884..b1e8d729851c 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -577,10 +577,10 @@ static int flexcan_poll_bus_err(struct net_device *dev, u32 reg_esr) | |||
577 | return 0; | 577 | return 0; |
578 | 578 | ||
579 | do_bus_err(dev, cf, reg_esr); | 579 | do_bus_err(dev, cf, reg_esr); |
580 | netif_receive_skb(skb); | ||
581 | 580 | ||
582 | dev->stats.rx_packets++; | 581 | dev->stats.rx_packets++; |
583 | dev->stats.rx_bytes += cf->can_dlc; | 582 | dev->stats.rx_bytes += cf->can_dlc; |
583 | netif_receive_skb(skb); | ||
584 | 584 | ||
585 | return 1; | 585 | return 1; |
586 | } | 586 | } |
@@ -622,10 +622,9 @@ static int flexcan_poll_state(struct net_device *dev, u32 reg_esr) | |||
622 | if (unlikely(new_state == CAN_STATE_BUS_OFF)) | 622 | if (unlikely(new_state == CAN_STATE_BUS_OFF)) |
623 | can_bus_off(dev); | 623 | can_bus_off(dev); |
624 | 624 | ||
625 | netif_receive_skb(skb); | ||
626 | |||
627 | dev->stats.rx_packets++; | 625 | dev->stats.rx_packets++; |
628 | dev->stats.rx_bytes += cf->can_dlc; | 626 | dev->stats.rx_bytes += cf->can_dlc; |
627 | netif_receive_skb(skb); | ||
629 | 628 | ||
630 | return 1; | 629 | return 1; |
631 | } | 630 | } |
@@ -670,10 +669,10 @@ static int flexcan_read_frame(struct net_device *dev) | |||
670 | } | 669 | } |
671 | 670 | ||
672 | flexcan_read_fifo(dev, cf); | 671 | flexcan_read_fifo(dev, cf); |
673 | netif_receive_skb(skb); | ||
674 | 672 | ||
675 | stats->rx_packets++; | 673 | stats->rx_packets++; |
676 | stats->rx_bytes += cf->can_dlc; | 674 | stats->rx_bytes += cf->can_dlc; |
675 | netif_receive_skb(skb); | ||
677 | 676 | ||
678 | can_led_event(dev, CAN_LED_EVENT_RX); | 677 | can_led_event(dev, CAN_LED_EVENT_RX); |
679 | 678 | ||
diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c index e3d7e22a4fa0..db9538d4b358 100644 --- a/drivers/net/can/grcan.c +++ b/drivers/net/can/grcan.c | |||
@@ -1216,11 +1216,12 @@ static int grcan_receive(struct net_device *dev, int budget) | |||
1216 | cf->data[i] = (u8)(slot[j] >> shift); | 1216 | cf->data[i] = (u8)(slot[j] >> shift); |
1217 | } | 1217 | } |
1218 | } | 1218 | } |
1219 | netif_receive_skb(skb); | ||
1220 | 1219 | ||
1221 | /* Update statistics and read pointer */ | 1220 | /* Update statistics and read pointer */ |
1222 | stats->rx_packets++; | 1221 | stats->rx_packets++; |
1223 | stats->rx_bytes += cf->can_dlc; | 1222 | stats->rx_bytes += cf->can_dlc; |
1223 | netif_receive_skb(skb); | ||
1224 | |||
1224 | rd = grcan_ring_add(rd, GRCAN_MSG_SIZE, dma->rx.size); | 1225 | rd = grcan_ring_add(rd, GRCAN_MSG_SIZE, dma->rx.size); |
1225 | } | 1226 | } |
1226 | 1227 | ||
diff --git a/drivers/net/can/rcar_can.c b/drivers/net/can/rcar_can.c index 7deb80dcbe8c..7bd54191f962 100644 --- a/drivers/net/can/rcar_can.c +++ b/drivers/net/can/rcar_can.c | |||
@@ -508,7 +508,8 @@ static int rcar_can_open(struct net_device *ndev) | |||
508 | 508 | ||
509 | err = clk_prepare_enable(priv->clk); | 509 | err = clk_prepare_enable(priv->clk); |
510 | if (err) { | 510 | if (err) { |
511 | netdev_err(ndev, "failed to enable periperal clock, error %d\n", | 511 | netdev_err(ndev, |
512 | "failed to enable peripheral clock, error %d\n", | ||
512 | err); | 513 | err); |
513 | goto out; | 514 | goto out; |
514 | } | 515 | } |
@@ -526,7 +527,8 @@ static int rcar_can_open(struct net_device *ndev) | |||
526 | napi_enable(&priv->napi); | 527 | napi_enable(&priv->napi); |
527 | err = request_irq(ndev->irq, rcar_can_interrupt, 0, ndev->name, ndev); | 528 | err = request_irq(ndev->irq, rcar_can_interrupt, 0, ndev->name, ndev); |
528 | if (err) { | 529 | if (err) { |
529 | netdev_err(ndev, "error requesting interrupt %x\n", ndev->irq); | 530 | netdev_err(ndev, "request_irq(%d) failed, error %d\n", |
531 | ndev->irq, err); | ||
530 | goto out_close; | 532 | goto out_close; |
531 | } | 533 | } |
532 | can_led_event(ndev, CAN_LED_EVENT_OPEN); | 534 | can_led_event(ndev, CAN_LED_EVENT_OPEN); |
@@ -758,8 +760,9 @@ static int rcar_can_probe(struct platform_device *pdev) | |||
758 | } | 760 | } |
759 | 761 | ||
760 | irq = platform_get_irq(pdev, 0); | 762 | irq = platform_get_irq(pdev, 0); |
761 | if (!irq) { | 763 | if (irq < 0) { |
762 | dev_err(&pdev->dev, "No IRQ resource\n"); | 764 | dev_err(&pdev->dev, "No IRQ resource\n"); |
765 | err = irq; | ||
763 | goto fail; | 766 | goto fail; |
764 | } | 767 | } |
765 | 768 | ||
@@ -782,7 +785,8 @@ static int rcar_can_probe(struct platform_device *pdev) | |||
782 | priv->clk = devm_clk_get(&pdev->dev, "clkp1"); | 785 | priv->clk = devm_clk_get(&pdev->dev, "clkp1"); |
783 | if (IS_ERR(priv->clk)) { | 786 | if (IS_ERR(priv->clk)) { |
784 | err = PTR_ERR(priv->clk); | 787 | err = PTR_ERR(priv->clk); |
785 | dev_err(&pdev->dev, "cannot get peripheral clock: %d\n", err); | 788 | dev_err(&pdev->dev, "cannot get peripheral clock, error %d\n", |
789 | err); | ||
786 | goto fail_clk; | 790 | goto fail_clk; |
787 | } | 791 | } |
788 | 792 | ||
@@ -794,7 +798,7 @@ static int rcar_can_probe(struct platform_device *pdev) | |||
794 | priv->can_clk = devm_clk_get(&pdev->dev, clock_names[clock_select]); | 798 | priv->can_clk = devm_clk_get(&pdev->dev, clock_names[clock_select]); |
795 | if (IS_ERR(priv->can_clk)) { | 799 | if (IS_ERR(priv->can_clk)) { |
796 | err = PTR_ERR(priv->can_clk); | 800 | err = PTR_ERR(priv->can_clk); |
797 | dev_err(&pdev->dev, "cannot get CAN clock: %d\n", err); | 801 | dev_err(&pdev->dev, "cannot get CAN clock, error %d\n", err); |
798 | goto fail_clk; | 802 | goto fail_clk; |
799 | } | 803 | } |
800 | 804 | ||
@@ -823,7 +827,7 @@ static int rcar_can_probe(struct platform_device *pdev) | |||
823 | 827 | ||
824 | devm_can_led_init(ndev); | 828 | devm_can_led_init(ndev); |
825 | 829 | ||
826 | dev_info(&pdev->dev, "device registered (reg_base=%p, irq=%u)\n", | 830 | dev_info(&pdev->dev, "device registered (regs @ %p, IRQ%d)\n", |
827 | priv->regs, ndev->irq); | 831 | priv->regs, ndev->irq); |
828 | 832 | ||
829 | return 0; | 833 | return 0; |
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index 32bd7f451aa4..7b92e911a616 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c | |||
@@ -377,10 +377,9 @@ static void sja1000_rx(struct net_device *dev) | |||
377 | /* release receive buffer */ | 377 | /* release receive buffer */ |
378 | sja1000_write_cmdreg(priv, CMD_RRB); | 378 | sja1000_write_cmdreg(priv, CMD_RRB); |
379 | 379 | ||
380 | netif_rx(skb); | ||
381 | |||
382 | stats->rx_packets++; | 380 | stats->rx_packets++; |
383 | stats->rx_bytes += cf->can_dlc; | 381 | stats->rx_bytes += cf->can_dlc; |
382 | netif_rx(skb); | ||
384 | 383 | ||
385 | can_led_event(dev, CAN_LED_EVENT_RX); | 384 | can_led_event(dev, CAN_LED_EVENT_RX); |
386 | } | 385 | } |
@@ -484,10 +483,9 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) | |||
484 | can_bus_off(dev); | 483 | can_bus_off(dev); |
485 | } | 484 | } |
486 | 485 | ||
487 | netif_rx(skb); | ||
488 | |||
489 | stats->rx_packets++; | 486 | stats->rx_packets++; |
490 | stats->rx_bytes += cf->can_dlc; | 487 | stats->rx_bytes += cf->can_dlc; |
488 | netif_rx(skb); | ||
491 | 489 | ||
492 | return 0; | 490 | return 0; |
493 | } | 491 | } |
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c index f64f5290d6f8..9a3f15cb7ef4 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c | |||
@@ -207,7 +207,6 @@ static void slc_bump(struct slcan *sl) | |||
207 | if (!skb) | 207 | if (!skb) |
208 | return; | 208 | return; |
209 | 209 | ||
210 | __net_timestamp(skb); | ||
211 | skb->dev = sl->dev; | 210 | skb->dev = sl->dev; |
212 | skb->protocol = htons(ETH_P_CAN); | 211 | skb->protocol = htons(ETH_P_CAN); |
213 | skb->pkt_type = PACKET_BROADCAST; | 212 | skb->pkt_type = PACKET_BROADCAST; |
@@ -215,13 +214,14 @@ static void slc_bump(struct slcan *sl) | |||
215 | 214 | ||
216 | can_skb_reserve(skb); | 215 | can_skb_reserve(skb); |
217 | can_skb_prv(skb)->ifindex = sl->dev->ifindex; | 216 | can_skb_prv(skb)->ifindex = sl->dev->ifindex; |
217 | can_skb_prv(skb)->skbcnt = 0; | ||
218 | 218 | ||
219 | memcpy(skb_put(skb, sizeof(struct can_frame)), | 219 | memcpy(skb_put(skb, sizeof(struct can_frame)), |
220 | &cf, sizeof(struct can_frame)); | 220 | &cf, sizeof(struct can_frame)); |
221 | netif_rx_ni(skb); | ||
222 | 221 | ||
223 | sl->dev->stats.rx_packets++; | 222 | sl->dev->stats.rx_packets++; |
224 | sl->dev->stats.rx_bytes += cf.can_dlc; | 223 | sl->dev->stats.rx_bytes += cf.can_dlc; |
224 | netif_rx_ni(skb); | ||
225 | } | 225 | } |
226 | 226 | ||
227 | /* parse tty input stream */ | 227 | /* parse tty input stream */ |
diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c index c1a95a34d62e..b7e83c212023 100644 --- a/drivers/net/can/spi/mcp251x.c +++ b/drivers/net/can/spi/mcp251x.c | |||
@@ -1086,8 +1086,8 @@ static int mcp251x_can_probe(struct spi_device *spi) | |||
1086 | if (ret) | 1086 | if (ret) |
1087 | goto out_clk; | 1087 | goto out_clk; |
1088 | 1088 | ||
1089 | priv->power = devm_regulator_get(&spi->dev, "vdd"); | 1089 | priv->power = devm_regulator_get_optional(&spi->dev, "vdd"); |
1090 | priv->transceiver = devm_regulator_get(&spi->dev, "xceiver"); | 1090 | priv->transceiver = devm_regulator_get_optional(&spi->dev, "xceiver"); |
1091 | if ((PTR_ERR(priv->power) == -EPROBE_DEFER) || | 1091 | if ((PTR_ERR(priv->power) == -EPROBE_DEFER) || |
1092 | (PTR_ERR(priv->transceiver) == -EPROBE_DEFER)) { | 1092 | (PTR_ERR(priv->transceiver) == -EPROBE_DEFER)) { |
1093 | ret = -EPROBE_DEFER; | 1093 | ret = -EPROBE_DEFER; |
@@ -1222,17 +1222,16 @@ static int __maybe_unused mcp251x_can_resume(struct device *dev) | |||
1222 | struct spi_device *spi = to_spi_device(dev); | 1222 | struct spi_device *spi = to_spi_device(dev); |
1223 | struct mcp251x_priv *priv = spi_get_drvdata(spi); | 1223 | struct mcp251x_priv *priv = spi_get_drvdata(spi); |
1224 | 1224 | ||
1225 | if (priv->after_suspend & AFTER_SUSPEND_POWER) { | 1225 | if (priv->after_suspend & AFTER_SUSPEND_POWER) |
1226 | mcp251x_power_enable(priv->power, 1); | 1226 | mcp251x_power_enable(priv->power, 1); |
1227 | |||
1228 | if (priv->after_suspend & AFTER_SUSPEND_UP) { | ||
1229 | mcp251x_power_enable(priv->transceiver, 1); | ||
1227 | queue_work(priv->wq, &priv->restart_work); | 1230 | queue_work(priv->wq, &priv->restart_work); |
1228 | } else { | 1231 | } else { |
1229 | if (priv->after_suspend & AFTER_SUSPEND_UP) { | 1232 | priv->after_suspend = 0; |
1230 | mcp251x_power_enable(priv->transceiver, 1); | ||
1231 | queue_work(priv->wq, &priv->restart_work); | ||
1232 | } else { | ||
1233 | priv->after_suspend = 0; | ||
1234 | } | ||
1235 | } | 1233 | } |
1234 | |||
1236 | priv->force_quit = 0; | 1235 | priv->force_quit = 0; |
1237 | enable_irq(spi->irq); | 1236 | enable_irq(spi->irq); |
1238 | return 0; | 1237 | return 0; |
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c index e95a9e1a889f..cf345cbfe819 100644 --- a/drivers/net/can/ti_hecc.c +++ b/drivers/net/can/ti_hecc.c | |||
@@ -747,9 +747,9 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, | |||
747 | } | 747 | } |
748 | } | 748 | } |
749 | 749 | ||
750 | netif_rx(skb); | ||
751 | stats->rx_packets++; | 750 | stats->rx_packets++; |
752 | stats->rx_bytes += cf->can_dlc; | 751 | stats->rx_bytes += cf->can_dlc; |
752 | netif_rx(skb); | ||
753 | 753 | ||
754 | return 0; | 754 | return 0; |
755 | } | 755 | } |
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index 866bac0ae7e9..2d390384ef3b 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c | |||
@@ -324,10 +324,9 @@ static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg) | |||
324 | cf->data[i] = msg->msg.can_msg.msg[i]; | 324 | cf->data[i] = msg->msg.can_msg.msg[i]; |
325 | } | 325 | } |
326 | 326 | ||
327 | netif_rx(skb); | ||
328 | |||
329 | stats->rx_packets++; | 327 | stats->rx_packets++; |
330 | stats->rx_bytes += cf->can_dlc; | 328 | stats->rx_bytes += cf->can_dlc; |
329 | netif_rx(skb); | ||
331 | } | 330 | } |
332 | 331 | ||
333 | static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg) | 332 | static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg) |
@@ -400,10 +399,9 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg) | |||
400 | stats->rx_errors++; | 399 | stats->rx_errors++; |
401 | } | 400 | } |
402 | 401 | ||
403 | netif_rx(skb); | ||
404 | |||
405 | stats->rx_packets++; | 402 | stats->rx_packets++; |
406 | stats->rx_bytes += cf->can_dlc; | 403 | stats->rx_bytes += cf->can_dlc; |
404 | netif_rx(skb); | ||
407 | } | 405 | } |
408 | 406 | ||
409 | /* | 407 | /* |
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c index 411c1af92c62..0e5a4493ba4f 100644 --- a/drivers/net/can/usb/esd_usb2.c +++ b/drivers/net/can/usb/esd_usb2.c | |||
@@ -301,13 +301,12 @@ static void esd_usb2_rx_event(struct esd_usb2_net_priv *priv, | |||
301 | cf->data[7] = rxerr; | 301 | cf->data[7] = rxerr; |
302 | } | 302 | } |
303 | 303 | ||
304 | netif_rx(skb); | ||
305 | |||
306 | priv->bec.txerr = txerr; | 304 | priv->bec.txerr = txerr; |
307 | priv->bec.rxerr = rxerr; | 305 | priv->bec.rxerr = rxerr; |
308 | 306 | ||
309 | stats->rx_packets++; | 307 | stats->rx_packets++; |
310 | stats->rx_bytes += cf->can_dlc; | 308 | stats->rx_bytes += cf->can_dlc; |
309 | netif_rx(skb); | ||
311 | } | 310 | } |
312 | } | 311 | } |
313 | 312 | ||
@@ -347,10 +346,9 @@ static void esd_usb2_rx_can_msg(struct esd_usb2_net_priv *priv, | |||
347 | cf->data[i] = msg->msg.rx.data[i]; | 346 | cf->data[i] = msg->msg.rx.data[i]; |
348 | } | 347 | } |
349 | 348 | ||
350 | netif_rx(skb); | ||
351 | |||
352 | stats->rx_packets++; | 349 | stats->rx_packets++; |
353 | stats->rx_bytes += cf->can_dlc; | 350 | stats->rx_bytes += cf->can_dlc; |
351 | netif_rx(skb); | ||
354 | } | 352 | } |
355 | 353 | ||
356 | return; | 354 | return; |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c index 72427f21edff..6b94007ae052 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb.c | |||
@@ -526,9 +526,9 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n, | |||
526 | hwts->hwtstamp = timeval_to_ktime(tv); | 526 | hwts->hwtstamp = timeval_to_ktime(tv); |
527 | } | 527 | } |
528 | 528 | ||
529 | netif_rx(skb); | ||
530 | mc->netdev->stats.rx_packets++; | 529 | mc->netdev->stats.rx_packets++; |
531 | mc->netdev->stats.rx_bytes += cf->can_dlc; | 530 | mc->netdev->stats.rx_bytes += cf->can_dlc; |
531 | netif_rx(skb); | ||
532 | 532 | ||
533 | return 0; | 533 | return 0; |
534 | } | 534 | } |
@@ -659,12 +659,11 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len) | |||
659 | hwts = skb_hwtstamps(skb); | 659 | hwts = skb_hwtstamps(skb); |
660 | hwts->hwtstamp = timeval_to_ktime(tv); | 660 | hwts->hwtstamp = timeval_to_ktime(tv); |
661 | 661 | ||
662 | /* push the skb */ | ||
663 | netif_rx(skb); | ||
664 | |||
665 | /* update statistics */ | 662 | /* update statistics */ |
666 | mc->netdev->stats.rx_packets++; | 663 | mc->netdev->stats.rx_packets++; |
667 | mc->netdev->stats.rx_bytes += cf->can_dlc; | 664 | mc->netdev->stats.rx_bytes += cf->can_dlc; |
665 | /* push the skb */ | ||
666 | netif_rx(skb); | ||
668 | 667 | ||
669 | return 0; | 668 | return 0; |
670 | 669 | ||
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c index dec51717635e..7d61b3279798 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c | |||
@@ -553,9 +553,9 @@ static int pcan_usb_pro_handle_canmsg(struct pcan_usb_pro_interface *usb_if, | |||
553 | hwts = skb_hwtstamps(skb); | 553 | hwts = skb_hwtstamps(skb); |
554 | hwts->hwtstamp = timeval_to_ktime(tv); | 554 | hwts->hwtstamp = timeval_to_ktime(tv); |
555 | 555 | ||
556 | netif_rx(skb); | ||
557 | netdev->stats.rx_packets++; | 556 | netdev->stats.rx_packets++; |
558 | netdev->stats.rx_bytes += can_frame->can_dlc; | 557 | netdev->stats.rx_bytes += can_frame->can_dlc; |
558 | netif_rx(skb); | ||
559 | 559 | ||
560 | return 0; | 560 | return 0; |
561 | } | 561 | } |
@@ -670,9 +670,9 @@ static int pcan_usb_pro_handle_error(struct pcan_usb_pro_interface *usb_if, | |||
670 | peak_usb_get_ts_tv(&usb_if->time_ref, le32_to_cpu(er->ts32), &tv); | 670 | peak_usb_get_ts_tv(&usb_if->time_ref, le32_to_cpu(er->ts32), &tv); |
671 | hwts = skb_hwtstamps(skb); | 671 | hwts = skb_hwtstamps(skb); |
672 | hwts->hwtstamp = timeval_to_ktime(tv); | 672 | hwts->hwtstamp = timeval_to_ktime(tv); |
673 | netif_rx(skb); | ||
674 | netdev->stats.rx_packets++; | 673 | netdev->stats.rx_packets++; |
675 | netdev->stats.rx_bytes += can_frame->can_dlc; | 674 | netdev->stats.rx_bytes += can_frame->can_dlc; |
675 | netif_rx(skb); | ||
676 | 676 | ||
677 | return 0; | 677 | return 0; |
678 | } | 678 | } |
diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c index dd52c7a4c80d..de95b1ccba3e 100644 --- a/drivers/net/can/usb/usb_8dev.c +++ b/drivers/net/can/usb/usb_8dev.c | |||
@@ -461,10 +461,9 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *priv, | |||
461 | priv->bec.txerr = txerr; | 461 | priv->bec.txerr = txerr; |
462 | priv->bec.rxerr = rxerr; | 462 | priv->bec.rxerr = rxerr; |
463 | 463 | ||
464 | netif_rx(skb); | ||
465 | |||
466 | stats->rx_packets++; | 464 | stats->rx_packets++; |
467 | stats->rx_bytes += cf->can_dlc; | 465 | stats->rx_bytes += cf->can_dlc; |
466 | netif_rx(skb); | ||
468 | } | 467 | } |
469 | 468 | ||
470 | /* Read data and status frames */ | 469 | /* Read data and status frames */ |
@@ -494,10 +493,9 @@ static void usb_8dev_rx_can_msg(struct usb_8dev_priv *priv, | |||
494 | else | 493 | else |
495 | memcpy(cf->data, msg->data, cf->can_dlc); | 494 | memcpy(cf->data, msg->data, cf->can_dlc); |
496 | 495 | ||
497 | netif_rx(skb); | ||
498 | |||
499 | stats->rx_packets++; | 496 | stats->rx_packets++; |
500 | stats->rx_bytes += cf->can_dlc; | 497 | stats->rx_bytes += cf->can_dlc; |
498 | netif_rx(skb); | ||
501 | 499 | ||
502 | can_led_event(priv->netdev, CAN_LED_EVENT_RX); | 500 | can_led_event(priv->netdev, CAN_LED_EVENT_RX); |
503 | } else { | 501 | } else { |
diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c index 0ce868de855d..674f367087c5 100644 --- a/drivers/net/can/vcan.c +++ b/drivers/net/can/vcan.c | |||
@@ -78,9 +78,6 @@ static void vcan_rx(struct sk_buff *skb, struct net_device *dev) | |||
78 | skb->dev = dev; | 78 | skb->dev = dev; |
79 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 79 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
80 | 80 | ||
81 | if (!(skb->tstamp.tv64)) | ||
82 | __net_timestamp(skb); | ||
83 | |||
84 | netif_rx_ni(skb); | 81 | netif_rx_ni(skb); |
85 | } | 82 | } |
86 | 83 | ||
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index 972982f8bea7..079897b3a955 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c | |||
@@ -696,9 +696,20 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds) | |||
696 | } | 696 | } |
697 | 697 | ||
698 | /* Include the pseudo-PHY address and the broadcast PHY address to | 698 | /* Include the pseudo-PHY address and the broadcast PHY address to |
699 | * divert reads towards our workaround | 699 | * divert reads towards our workaround. This is only required for |
700 | * 7445D0, since 7445E0 disconnects the internal switch pseudo-PHY such | ||
701 | * that we can use the regular SWITCH_MDIO master controller instead. | ||
702 | * | ||
703 | * By default, DSA initializes ds->phys_mii_mask to ds->phys_port_mask | ||
704 | * to have a 1:1 mapping between Port address and PHY address in order | ||
705 | * to utilize the slave_mii_bus instance to read from Port PHYs. This is | ||
706 | * not what we want here, so we initialize phys_mii_mask 0 to always | ||
707 | * utilize the "master" MDIO bus backed by the "mdio-unimac" driver. | ||
700 | */ | 708 | */ |
701 | ds->phys_mii_mask |= ((1 << BRCM_PSEUDO_PHY_ADDR) | (1 << 0)); | 709 | if (of_machine_is_compatible("brcm,bcm7445d0")) |
710 | ds->phys_mii_mask |= ((1 << BRCM_PSEUDO_PHY_ADDR) | (1 << 0)); | ||
711 | else | ||
712 | ds->phys_mii_mask = 0; | ||
702 | 713 | ||
703 | rev = reg_readl(priv, REG_SWITCH_REVISION); | 714 | rev = reg_readl(priv, REG_SWITCH_REVISION); |
704 | priv->hw_params.top_rev = (rev >> SWITCH_TOP_REV_SHIFT) & | 715 | priv->hw_params.top_rev = (rev >> SWITCH_TOP_REV_SHIFT) & |
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c index fd8547c2b79d..561342466076 100644 --- a/drivers/net/dsa/mv88e6xxx.c +++ b/drivers/net/dsa/mv88e6xxx.c | |||
@@ -1163,7 +1163,7 @@ int mv88e6xxx_leave_bridge(struct dsa_switch *ds, int port, u32 br_port_mask) | |||
1163 | 1163 | ||
1164 | newfid = __ffs(ps->fid_mask); | 1164 | newfid = __ffs(ps->fid_mask); |
1165 | ps->fid[port] = newfid; | 1165 | ps->fid[port] = newfid; |
1166 | ps->fid_mask &= (1 << newfid); | 1166 | ps->fid_mask &= ~(1 << newfid); |
1167 | ps->bridge_mask[fid] &= ~(1 << port); | 1167 | ps->bridge_mask[fid] &= ~(1 << port); |
1168 | ps->bridge_mask[newfid] = 1 << port; | 1168 | ps->bridge_mask[newfid] = 1 << port; |
1169 | 1169 | ||
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c index 41095ebad97f..2d1ce3c5d0dd 100644 --- a/drivers/net/ethernet/3com/3c59x.c +++ b/drivers/net/ethernet/3com/3c59x.c | |||
@@ -2382,6 +2382,7 @@ boomerang_interrupt(int irq, void *dev_id) | |||
2382 | void __iomem *ioaddr; | 2382 | void __iomem *ioaddr; |
2383 | int status; | 2383 | int status; |
2384 | int work_done = max_interrupt_work; | 2384 | int work_done = max_interrupt_work; |
2385 | int handled = 0; | ||
2385 | 2386 | ||
2386 | ioaddr = vp->ioaddr; | 2387 | ioaddr = vp->ioaddr; |
2387 | 2388 | ||
@@ -2400,6 +2401,7 @@ boomerang_interrupt(int irq, void *dev_id) | |||
2400 | 2401 | ||
2401 | if ((status & IntLatch) == 0) | 2402 | if ((status & IntLatch) == 0) |
2402 | goto handler_exit; /* No interrupt: shared IRQs can cause this */ | 2403 | goto handler_exit; /* No interrupt: shared IRQs can cause this */ |
2404 | handled = 1; | ||
2403 | 2405 | ||
2404 | if (status == 0xffff) { /* h/w no longer present (hotplug)? */ | 2406 | if (status == 0xffff) { /* h/w no longer present (hotplug)? */ |
2405 | if (vortex_debug > 1) | 2407 | if (vortex_debug > 1) |
@@ -2501,7 +2503,7 @@ boomerang_interrupt(int irq, void *dev_id) | |||
2501 | handler_exit: | 2503 | handler_exit: |
2502 | vp->handling_irq = 0; | 2504 | vp->handling_irq = 0; |
2503 | spin_unlock(&vp->lock); | 2505 | spin_unlock(&vp->lock); |
2504 | return IRQ_HANDLED; | 2506 | return IRQ_RETVAL(handled); |
2505 | } | 2507 | } |
2506 | 2508 | ||
2507 | static int vortex_rx(struct net_device *dev) | 2509 | static int vortex_rx(struct net_device *dev) |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-desc.c b/drivers/net/ethernet/amd/xgbe/xgbe-desc.c index 661cdaa7ea96..b3bc87fe3764 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-desc.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-desc.c | |||
@@ -303,7 +303,8 @@ static void xgbe_set_buffer_data(struct xgbe_buffer_data *bd, | |||
303 | get_page(pa->pages); | 303 | get_page(pa->pages); |
304 | bd->pa = *pa; | 304 | bd->pa = *pa; |
305 | 305 | ||
306 | bd->dma = pa->pages_dma + pa->pages_offset; | 306 | bd->dma_base = pa->pages_dma; |
307 | bd->dma_off = pa->pages_offset; | ||
307 | bd->dma_len = len; | 308 | bd->dma_len = len; |
308 | 309 | ||
309 | pa->pages_offset += len; | 310 | pa->pages_offset += len; |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c index 506e832c9e9a..a4473d8ff4fa 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c | |||
@@ -1110,6 +1110,7 @@ static void xgbe_rx_desc_reset(struct xgbe_prv_data *pdata, | |||
1110 | unsigned int rx_usecs = pdata->rx_usecs; | 1110 | unsigned int rx_usecs = pdata->rx_usecs; |
1111 | unsigned int rx_frames = pdata->rx_frames; | 1111 | unsigned int rx_frames = pdata->rx_frames; |
1112 | unsigned int inte; | 1112 | unsigned int inte; |
1113 | dma_addr_t hdr_dma, buf_dma; | ||
1113 | 1114 | ||
1114 | if (!rx_usecs && !rx_frames) { | 1115 | if (!rx_usecs && !rx_frames) { |
1115 | /* No coalescing, interrupt for every descriptor */ | 1116 | /* No coalescing, interrupt for every descriptor */ |
@@ -1129,10 +1130,12 @@ static void xgbe_rx_desc_reset(struct xgbe_prv_data *pdata, | |||
1129 | * Set buffer 2 (hi) address to buffer dma address (hi) and | 1130 | * Set buffer 2 (hi) address to buffer dma address (hi) and |
1130 | * set control bits OWN and INTE | 1131 | * set control bits OWN and INTE |
1131 | */ | 1132 | */ |
1132 | rdesc->desc0 = cpu_to_le32(lower_32_bits(rdata->rx.hdr.dma)); | 1133 | hdr_dma = rdata->rx.hdr.dma_base + rdata->rx.hdr.dma_off; |
1133 | rdesc->desc1 = cpu_to_le32(upper_32_bits(rdata->rx.hdr.dma)); | 1134 | buf_dma = rdata->rx.buf.dma_base + rdata->rx.buf.dma_off; |
1134 | rdesc->desc2 = cpu_to_le32(lower_32_bits(rdata->rx.buf.dma)); | 1135 | rdesc->desc0 = cpu_to_le32(lower_32_bits(hdr_dma)); |
1135 | rdesc->desc3 = cpu_to_le32(upper_32_bits(rdata->rx.buf.dma)); | 1136 | rdesc->desc1 = cpu_to_le32(upper_32_bits(hdr_dma)); |
1137 | rdesc->desc2 = cpu_to_le32(lower_32_bits(buf_dma)); | ||
1138 | rdesc->desc3 = cpu_to_le32(upper_32_bits(buf_dma)); | ||
1136 | 1139 | ||
1137 | XGMAC_SET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, INTE, inte); | 1140 | XGMAC_SET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, INTE, inte); |
1138 | 1141 | ||
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index 1e9c28d19ef8..aae9d5ecd182 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c | |||
@@ -1765,8 +1765,9 @@ static struct sk_buff *xgbe_create_skb(struct xgbe_prv_data *pdata, | |||
1765 | /* Start with the header buffer which may contain just the header | 1765 | /* Start with the header buffer which may contain just the header |
1766 | * or the header plus data | 1766 | * or the header plus data |
1767 | */ | 1767 | */ |
1768 | dma_sync_single_for_cpu(pdata->dev, rdata->rx.hdr.dma, | 1768 | dma_sync_single_range_for_cpu(pdata->dev, rdata->rx.hdr.dma_base, |
1769 | rdata->rx.hdr.dma_len, DMA_FROM_DEVICE); | 1769 | rdata->rx.hdr.dma_off, |
1770 | rdata->rx.hdr.dma_len, DMA_FROM_DEVICE); | ||
1770 | 1771 | ||
1771 | packet = page_address(rdata->rx.hdr.pa.pages) + | 1772 | packet = page_address(rdata->rx.hdr.pa.pages) + |
1772 | rdata->rx.hdr.pa.pages_offset; | 1773 | rdata->rx.hdr.pa.pages_offset; |
@@ -1778,8 +1779,11 @@ static struct sk_buff *xgbe_create_skb(struct xgbe_prv_data *pdata, | |||
1778 | len -= copy_len; | 1779 | len -= copy_len; |
1779 | if (len) { | 1780 | if (len) { |
1780 | /* Add the remaining data as a frag */ | 1781 | /* Add the remaining data as a frag */ |
1781 | dma_sync_single_for_cpu(pdata->dev, rdata->rx.buf.dma, | 1782 | dma_sync_single_range_for_cpu(pdata->dev, |
1782 | rdata->rx.buf.dma_len, DMA_FROM_DEVICE); | 1783 | rdata->rx.buf.dma_base, |
1784 | rdata->rx.buf.dma_off, | ||
1785 | rdata->rx.buf.dma_len, | ||
1786 | DMA_FROM_DEVICE); | ||
1783 | 1787 | ||
1784 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, | 1788 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, |
1785 | rdata->rx.buf.pa.pages, | 1789 | rdata->rx.buf.pa.pages, |
@@ -1945,8 +1949,9 @@ read_again: | |||
1945 | if (!skb) | 1949 | if (!skb) |
1946 | error = 1; | 1950 | error = 1; |
1947 | } else if (rdesc_len) { | 1951 | } else if (rdesc_len) { |
1948 | dma_sync_single_for_cpu(pdata->dev, | 1952 | dma_sync_single_range_for_cpu(pdata->dev, |
1949 | rdata->rx.buf.dma, | 1953 | rdata->rx.buf.dma_base, |
1954 | rdata->rx.buf.dma_off, | ||
1950 | rdata->rx.buf.dma_len, | 1955 | rdata->rx.buf.dma_len, |
1951 | DMA_FROM_DEVICE); | 1956 | DMA_FROM_DEVICE); |
1952 | 1957 | ||
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h index 63d72a140053..717ce21b6077 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe.h +++ b/drivers/net/ethernet/amd/xgbe/xgbe.h | |||
@@ -337,7 +337,8 @@ struct xgbe_buffer_data { | |||
337 | struct xgbe_page_alloc pa; | 337 | struct xgbe_page_alloc pa; |
338 | struct xgbe_page_alloc pa_unmap; | 338 | struct xgbe_page_alloc pa_unmap; |
339 | 339 | ||
340 | dma_addr_t dma; | 340 | dma_addr_t dma_base; |
341 | unsigned long dma_off; | ||
341 | unsigned int dma_len; | 342 | unsigned int dma_len; |
342 | }; | 343 | }; |
343 | 344 | ||
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 909ad7a0d480..4566cdf0bc39 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
@@ -1793,7 +1793,7 @@ static int bcm_sysport_probe(struct platform_device *pdev) | |||
1793 | macaddr = of_get_mac_address(dn); | 1793 | macaddr = of_get_mac_address(dn); |
1794 | if (!macaddr || !is_valid_ether_addr(macaddr)) { | 1794 | if (!macaddr || !is_valid_ether_addr(macaddr)) { |
1795 | dev_warn(&pdev->dev, "using random Ethernet MAC\n"); | 1795 | dev_warn(&pdev->dev, "using random Ethernet MAC\n"); |
1796 | random_ether_addr(dev->dev_addr); | 1796 | eth_hw_addr_random(dev); |
1797 | } else { | 1797 | } else { |
1798 | ether_addr_copy(dev->dev_addr, macaddr); | 1798 | ether_addr_copy(dev->dev_addr, macaddr); |
1799 | } | 1799 | } |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index b43b2cb9b830..64c1e9db6b0b 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | |||
@@ -1230,7 +1230,6 @@ static struct sk_buff *bcmgenet_put_tx_csum(struct net_device *dev, | |||
1230 | new_skb = skb_realloc_headroom(skb, sizeof(*status)); | 1230 | new_skb = skb_realloc_headroom(skb, sizeof(*status)); |
1231 | dev_kfree_skb(skb); | 1231 | dev_kfree_skb(skb); |
1232 | if (!new_skb) { | 1232 | if (!new_skb) { |
1233 | dev->stats.tx_errors++; | ||
1234 | dev->stats.tx_dropped++; | 1233 | dev->stats.tx_dropped++; |
1235 | return NULL; | 1234 | return NULL; |
1236 | } | 1235 | } |
@@ -1465,7 +1464,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring, | |||
1465 | 1464 | ||
1466 | if (unlikely(!skb)) { | 1465 | if (unlikely(!skb)) { |
1467 | dev->stats.rx_dropped++; | 1466 | dev->stats.rx_dropped++; |
1468 | dev->stats.rx_errors++; | ||
1469 | goto next; | 1467 | goto next; |
1470 | } | 1468 | } |
1471 | 1469 | ||
@@ -1493,7 +1491,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring, | |||
1493 | if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) { | 1491 | if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) { |
1494 | netif_err(priv, rx_status, dev, | 1492 | netif_err(priv, rx_status, dev, |
1495 | "dropping fragmented packet!\n"); | 1493 | "dropping fragmented packet!\n"); |
1496 | dev->stats.rx_dropped++; | ||
1497 | dev->stats.rx_errors++; | 1494 | dev->stats.rx_errors++; |
1498 | dev_kfree_skb_any(skb); | 1495 | dev_kfree_skb_any(skb); |
1499 | goto next; | 1496 | goto next; |
@@ -1515,7 +1512,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring, | |||
1515 | dev->stats.rx_frame_errors++; | 1512 | dev->stats.rx_frame_errors++; |
1516 | if (dma_flag & DMA_RX_LG) | 1513 | if (dma_flag & DMA_RX_LG) |
1517 | dev->stats.rx_length_errors++; | 1514 | dev->stats.rx_length_errors++; |
1518 | dev->stats.rx_dropped++; | ||
1519 | dev->stats.rx_errors++; | 1515 | dev->stats.rx_errors++; |
1520 | dev_kfree_skb_any(skb); | 1516 | dev_kfree_skb_any(skb); |
1521 | goto next; | 1517 | goto next; |
diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c index ac27e24264a5..f557a2aaec23 100644 --- a/drivers/net/ethernet/broadcom/sb1250-mac.c +++ b/drivers/net/ethernet/broadcom/sb1250-mac.c | |||
@@ -1508,16 +1508,7 @@ static void sbmac_channel_start(struct sbmac_softc *s) | |||
1508 | __raw_writeq(reg, port); | 1508 | __raw_writeq(reg, port); |
1509 | port = s->sbm_base + R_MAC_ETHERNET_ADDR; | 1509 | port = s->sbm_base + R_MAC_ETHERNET_ADDR; |
1510 | 1510 | ||
1511 | #ifdef CONFIG_SB1_PASS_1_WORKAROUNDS | ||
1512 | /* | ||
1513 | * Pass1 SOCs do not receive packets addressed to the | ||
1514 | * destination address in the R_MAC_ETHERNET_ADDR register. | ||
1515 | * Set the value to zero. | ||
1516 | */ | ||
1517 | __raw_writeq(0, port); | ||
1518 | #else | ||
1519 | __raw_writeq(reg, port); | 1511 | __raw_writeq(reg, port); |
1520 | #endif | ||
1521 | 1512 | ||
1522 | /* | 1513 | /* |
1523 | * Set the receive filter for no packets, and write values | 1514 | * Set the receive filter for no packets, and write values |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c index 484eb8c37489..a11485fbb33f 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | |||
@@ -952,16 +952,23 @@ static int devlog_show(struct seq_file *seq, void *v) | |||
952 | * eventually have to put a format interpreter in here ... | 952 | * eventually have to put a format interpreter in here ... |
953 | */ | 953 | */ |
954 | seq_printf(seq, "%10d %15llu %8s %8s ", | 954 | seq_printf(seq, "%10d %15llu %8s %8s ", |
955 | e->seqno, e->timestamp, | 955 | be32_to_cpu(e->seqno), |
956 | be64_to_cpu(e->timestamp), | ||
956 | (e->level < ARRAY_SIZE(devlog_level_strings) | 957 | (e->level < ARRAY_SIZE(devlog_level_strings) |
957 | ? devlog_level_strings[e->level] | 958 | ? devlog_level_strings[e->level] |
958 | : "UNKNOWN"), | 959 | : "UNKNOWN"), |
959 | (e->facility < ARRAY_SIZE(devlog_facility_strings) | 960 | (e->facility < ARRAY_SIZE(devlog_facility_strings) |
960 | ? devlog_facility_strings[e->facility] | 961 | ? devlog_facility_strings[e->facility] |
961 | : "UNKNOWN")); | 962 | : "UNKNOWN")); |
962 | seq_printf(seq, e->fmt, e->params[0], e->params[1], | 963 | seq_printf(seq, e->fmt, |
963 | e->params[2], e->params[3], e->params[4], | 964 | be32_to_cpu(e->params[0]), |
964 | e->params[5], e->params[6], e->params[7]); | 965 | be32_to_cpu(e->params[1]), |
966 | be32_to_cpu(e->params[2]), | ||
967 | be32_to_cpu(e->params[3]), | ||
968 | be32_to_cpu(e->params[4]), | ||
969 | be32_to_cpu(e->params[5]), | ||
970 | be32_to_cpu(e->params[6]), | ||
971 | be32_to_cpu(e->params[7])); | ||
965 | } | 972 | } |
966 | return 0; | 973 | return 0; |
967 | } | 974 | } |
@@ -1043,23 +1050,17 @@ static int devlog_open(struct inode *inode, struct file *file) | |||
1043 | return ret; | 1050 | return ret; |
1044 | } | 1051 | } |
1045 | 1052 | ||
1046 | /* Translate log multi-byte integral elements into host native format | 1053 | /* Find the earliest (lowest Sequence Number) log entry in the |
1047 | * and determine where the first entry in the log is. | 1054 | * circular Device Log. |
1048 | */ | 1055 | */ |
1049 | for (fseqno = ~((u32)0), index = 0; index < dinfo->nentries; index++) { | 1056 | for (fseqno = ~((u32)0), index = 0; index < dinfo->nentries; index++) { |
1050 | struct fw_devlog_e *e = &dinfo->log[index]; | 1057 | struct fw_devlog_e *e = &dinfo->log[index]; |
1051 | int i; | ||
1052 | __u32 seqno; | 1058 | __u32 seqno; |
1053 | 1059 | ||
1054 | if (e->timestamp == 0) | 1060 | if (e->timestamp == 0) |
1055 | continue; | 1061 | continue; |
1056 | 1062 | ||
1057 | e->timestamp = (__force __be64)be64_to_cpu(e->timestamp); | ||
1058 | seqno = be32_to_cpu(e->seqno); | 1063 | seqno = be32_to_cpu(e->seqno); |
1059 | for (i = 0; i < 8; i++) | ||
1060 | e->params[i] = | ||
1061 | (__force __be32)be32_to_cpu(e->params[i]); | ||
1062 | |||
1063 | if (seqno < fseqno) { | 1064 | if (seqno < fseqno) { |
1064 | fseqno = seqno; | 1065 | fseqno = seqno; |
1065 | dinfo->first = index; | 1066 | dinfo->first = index; |
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index da2004e2a741..918a8e42139b 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
@@ -1170,7 +1170,7 @@ static int enic_poll(struct napi_struct *napi, int budget) | |||
1170 | wq_work_done, | 1170 | wq_work_done, |
1171 | 0 /* dont unmask intr */, | 1171 | 0 /* dont unmask intr */, |
1172 | 0 /* dont reset intr timer */); | 1172 | 0 /* dont reset intr timer */); |
1173 | return rq_work_done; | 1173 | return budget; |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | if (budget > 0) | 1176 | if (budget > 0) |
@@ -1191,6 +1191,7 @@ static int enic_poll(struct napi_struct *napi, int budget) | |||
1191 | 0 /* don't reset intr timer */); | 1191 | 0 /* don't reset intr timer */); |
1192 | 1192 | ||
1193 | err = vnic_rq_fill(&enic->rq[0], enic_rq_alloc_buf); | 1193 | err = vnic_rq_fill(&enic->rq[0], enic_rq_alloc_buf); |
1194 | enic_poll_unlock_napi(&enic->rq[cq_rq], napi); | ||
1194 | 1195 | ||
1195 | /* Buffer allocation failed. Stay in polling | 1196 | /* Buffer allocation failed. Stay in polling |
1196 | * mode so we can try to fill the ring again. | 1197 | * mode so we can try to fill the ring again. |
@@ -1208,7 +1209,6 @@ static int enic_poll(struct napi_struct *napi, int budget) | |||
1208 | napi_complete(napi); | 1209 | napi_complete(napi); |
1209 | vnic_intr_unmask(&enic->intr[intr]); | 1210 | vnic_intr_unmask(&enic->intr[intr]); |
1210 | } | 1211 | } |
1211 | enic_poll_unlock_napi(&enic->rq[cq_rq], napi); | ||
1212 | 1212 | ||
1213 | return rq_work_done; | 1213 | return rq_work_done; |
1214 | } | 1214 | } |
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 370e20ed224c..62e48bc0cb23 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
@@ -1462,7 +1462,7 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, | |||
1462 | struct mvneta_rx_queue *rxq) | 1462 | struct mvneta_rx_queue *rxq) |
1463 | { | 1463 | { |
1464 | struct net_device *dev = pp->dev; | 1464 | struct net_device *dev = pp->dev; |
1465 | int rx_done, rx_filled; | 1465 | int rx_done; |
1466 | u32 rcvd_pkts = 0; | 1466 | u32 rcvd_pkts = 0; |
1467 | u32 rcvd_bytes = 0; | 1467 | u32 rcvd_bytes = 0; |
1468 | 1468 | ||
@@ -1473,7 +1473,6 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, | |||
1473 | rx_todo = rx_done; | 1473 | rx_todo = rx_done; |
1474 | 1474 | ||
1475 | rx_done = 0; | 1475 | rx_done = 0; |
1476 | rx_filled = 0; | ||
1477 | 1476 | ||
1478 | /* Fairness NAPI loop */ | 1477 | /* Fairness NAPI loop */ |
1479 | while (rx_done < rx_todo) { | 1478 | while (rx_done < rx_todo) { |
@@ -1484,7 +1483,6 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, | |||
1484 | int rx_bytes, err; | 1483 | int rx_bytes, err; |
1485 | 1484 | ||
1486 | rx_done++; | 1485 | rx_done++; |
1487 | rx_filled++; | ||
1488 | rx_status = rx_desc->status; | 1486 | rx_status = rx_desc->status; |
1489 | rx_bytes = rx_desc->data_size - (ETH_FCS_LEN + MVNETA_MH_SIZE); | 1487 | rx_bytes = rx_desc->data_size - (ETH_FCS_LEN + MVNETA_MH_SIZE); |
1490 | data = (unsigned char *)rx_desc->buf_cookie; | 1488 | data = (unsigned char *)rx_desc->buf_cookie; |
@@ -1524,6 +1522,14 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, | |||
1524 | continue; | 1522 | continue; |
1525 | } | 1523 | } |
1526 | 1524 | ||
1525 | /* Refill processing */ | ||
1526 | err = mvneta_rx_refill(pp, rx_desc); | ||
1527 | if (err) { | ||
1528 | netdev_err(dev, "Linux processing - Can't refill\n"); | ||
1529 | rxq->missed++; | ||
1530 | goto err_drop_frame; | ||
1531 | } | ||
1532 | |||
1527 | skb = build_skb(data, pp->frag_size > PAGE_SIZE ? 0 : pp->frag_size); | 1533 | skb = build_skb(data, pp->frag_size > PAGE_SIZE ? 0 : pp->frag_size); |
1528 | if (!skb) | 1534 | if (!skb) |
1529 | goto err_drop_frame; | 1535 | goto err_drop_frame; |
@@ -1543,14 +1549,6 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, | |||
1543 | mvneta_rx_csum(pp, rx_status, skb); | 1549 | mvneta_rx_csum(pp, rx_status, skb); |
1544 | 1550 | ||
1545 | napi_gro_receive(&pp->napi, skb); | 1551 | napi_gro_receive(&pp->napi, skb); |
1546 | |||
1547 | /* Refill processing */ | ||
1548 | err = mvneta_rx_refill(pp, rx_desc); | ||
1549 | if (err) { | ||
1550 | netdev_err(dev, "Linux processing - Can't refill\n"); | ||
1551 | rxq->missed++; | ||
1552 | rx_filled--; | ||
1553 | } | ||
1554 | } | 1552 | } |
1555 | 1553 | ||
1556 | if (rcvd_pkts) { | 1554 | if (rcvd_pkts) { |
@@ -1563,7 +1561,7 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, | |||
1563 | } | 1561 | } |
1564 | 1562 | ||
1565 | /* Update rxq management counters */ | 1563 | /* Update rxq management counters */ |
1566 | mvneta_rxq_desc_num_update(pp, rxq, rx_done, rx_filled); | 1564 | mvneta_rxq_desc_num_update(pp, rxq, rx_done, rx_done); |
1567 | 1565 | ||
1568 | return rx_done; | 1566 | return rx_done; |
1569 | } | 1567 | } |
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index fd9745714d90..78849dd4ef8e 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c | |||
@@ -228,9 +228,7 @@ static void ravb_ring_format(struct net_device *ndev, int q) | |||
228 | struct ravb_desc *desc = NULL; | 228 | struct ravb_desc *desc = NULL; |
229 | int rx_ring_size = sizeof(*rx_desc) * priv->num_rx_ring[q]; | 229 | int rx_ring_size = sizeof(*rx_desc) * priv->num_rx_ring[q]; |
230 | int tx_ring_size = sizeof(*tx_desc) * priv->num_tx_ring[q]; | 230 | int tx_ring_size = sizeof(*tx_desc) * priv->num_tx_ring[q]; |
231 | struct sk_buff *skb; | ||
232 | dma_addr_t dma_addr; | 231 | dma_addr_t dma_addr; |
233 | void *buffer; | ||
234 | int i; | 232 | int i; |
235 | 233 | ||
236 | priv->cur_rx[q] = 0; | 234 | priv->cur_rx[q] = 0; |
@@ -241,41 +239,28 @@ static void ravb_ring_format(struct net_device *ndev, int q) | |||
241 | memset(priv->rx_ring[q], 0, rx_ring_size); | 239 | memset(priv->rx_ring[q], 0, rx_ring_size); |
242 | /* Build RX ring buffer */ | 240 | /* Build RX ring buffer */ |
243 | for (i = 0; i < priv->num_rx_ring[q]; i++) { | 241 | for (i = 0; i < priv->num_rx_ring[q]; i++) { |
244 | priv->rx_skb[q][i] = NULL; | ||
245 | skb = netdev_alloc_skb(ndev, PKT_BUF_SZ + RAVB_ALIGN - 1); | ||
246 | if (!skb) | ||
247 | break; | ||
248 | ravb_set_buffer_align(skb); | ||
249 | /* RX descriptor */ | 242 | /* RX descriptor */ |
250 | rx_desc = &priv->rx_ring[q][i]; | 243 | rx_desc = &priv->rx_ring[q][i]; |
251 | /* The size of the buffer should be on 16-byte boundary. */ | 244 | /* The size of the buffer should be on 16-byte boundary. */ |
252 | rx_desc->ds_cc = cpu_to_le16(ALIGN(PKT_BUF_SZ, 16)); | 245 | rx_desc->ds_cc = cpu_to_le16(ALIGN(PKT_BUF_SZ, 16)); |
253 | dma_addr = dma_map_single(&ndev->dev, skb->data, | 246 | dma_addr = dma_map_single(&ndev->dev, priv->rx_skb[q][i]->data, |
254 | ALIGN(PKT_BUF_SZ, 16), | 247 | ALIGN(PKT_BUF_SZ, 16), |
255 | DMA_FROM_DEVICE); | 248 | DMA_FROM_DEVICE); |
256 | if (dma_mapping_error(&ndev->dev, dma_addr)) { | 249 | /* We just set the data size to 0 for a failed mapping which |
257 | dev_kfree_skb(skb); | 250 | * should prevent DMA from happening... |
258 | break; | 251 | */ |
259 | } | 252 | if (dma_mapping_error(&ndev->dev, dma_addr)) |
260 | priv->rx_skb[q][i] = skb; | 253 | rx_desc->ds_cc = cpu_to_le16(0); |
261 | rx_desc->dptr = cpu_to_le32(dma_addr); | 254 | rx_desc->dptr = cpu_to_le32(dma_addr); |
262 | rx_desc->die_dt = DT_FEMPTY; | 255 | rx_desc->die_dt = DT_FEMPTY; |
263 | } | 256 | } |
264 | rx_desc = &priv->rx_ring[q][i]; | 257 | rx_desc = &priv->rx_ring[q][i]; |
265 | rx_desc->dptr = cpu_to_le32((u32)priv->rx_desc_dma[q]); | 258 | rx_desc->dptr = cpu_to_le32((u32)priv->rx_desc_dma[q]); |
266 | rx_desc->die_dt = DT_LINKFIX; /* type */ | 259 | rx_desc->die_dt = DT_LINKFIX; /* type */ |
267 | priv->dirty_rx[q] = (u32)(i - priv->num_rx_ring[q]); | ||
268 | 260 | ||
269 | memset(priv->tx_ring[q], 0, tx_ring_size); | 261 | memset(priv->tx_ring[q], 0, tx_ring_size); |
270 | /* Build TX ring buffer */ | 262 | /* Build TX ring buffer */ |
271 | for (i = 0; i < priv->num_tx_ring[q]; i++) { | 263 | for (i = 0; i < priv->num_tx_ring[q]; i++) { |
272 | priv->tx_skb[q][i] = NULL; | ||
273 | priv->tx_buffers[q][i] = NULL; | ||
274 | buffer = kmalloc(PKT_BUF_SZ + RAVB_ALIGN - 1, GFP_KERNEL); | ||
275 | if (!buffer) | ||
276 | break; | ||
277 | /* Aligned TX buffer */ | ||
278 | priv->tx_buffers[q][i] = buffer; | ||
279 | tx_desc = &priv->tx_ring[q][i]; | 264 | tx_desc = &priv->tx_ring[q][i]; |
280 | tx_desc->die_dt = DT_EEMPTY; | 265 | tx_desc->die_dt = DT_EEMPTY; |
281 | } | 266 | } |
@@ -298,7 +283,10 @@ static void ravb_ring_format(struct net_device *ndev, int q) | |||
298 | static int ravb_ring_init(struct net_device *ndev, int q) | 283 | static int ravb_ring_init(struct net_device *ndev, int q) |
299 | { | 284 | { |
300 | struct ravb_private *priv = netdev_priv(ndev); | 285 | struct ravb_private *priv = netdev_priv(ndev); |
286 | struct sk_buff *skb; | ||
301 | int ring_size; | 287 | int ring_size; |
288 | void *buffer; | ||
289 | int i; | ||
302 | 290 | ||
303 | /* Allocate RX and TX skb rings */ | 291 | /* Allocate RX and TX skb rings */ |
304 | priv->rx_skb[q] = kcalloc(priv->num_rx_ring[q], | 292 | priv->rx_skb[q] = kcalloc(priv->num_rx_ring[q], |
@@ -308,12 +296,28 @@ static int ravb_ring_init(struct net_device *ndev, int q) | |||
308 | if (!priv->rx_skb[q] || !priv->tx_skb[q]) | 296 | if (!priv->rx_skb[q] || !priv->tx_skb[q]) |
309 | goto error; | 297 | goto error; |
310 | 298 | ||
299 | for (i = 0; i < priv->num_rx_ring[q]; i++) { | ||
300 | skb = netdev_alloc_skb(ndev, PKT_BUF_SZ + RAVB_ALIGN - 1); | ||
301 | if (!skb) | ||
302 | goto error; | ||
303 | ravb_set_buffer_align(skb); | ||
304 | priv->rx_skb[q][i] = skb; | ||
305 | } | ||
306 | |||
311 | /* Allocate rings for the aligned buffers */ | 307 | /* Allocate rings for the aligned buffers */ |
312 | priv->tx_buffers[q] = kcalloc(priv->num_tx_ring[q], | 308 | priv->tx_buffers[q] = kcalloc(priv->num_tx_ring[q], |
313 | sizeof(*priv->tx_buffers[q]), GFP_KERNEL); | 309 | sizeof(*priv->tx_buffers[q]), GFP_KERNEL); |
314 | if (!priv->tx_buffers[q]) | 310 | if (!priv->tx_buffers[q]) |
315 | goto error; | 311 | goto error; |
316 | 312 | ||
313 | for (i = 0; i < priv->num_tx_ring[q]; i++) { | ||
314 | buffer = kmalloc(PKT_BUF_SZ + RAVB_ALIGN - 1, GFP_KERNEL); | ||
315 | if (!buffer) | ||
316 | goto error; | ||
317 | /* Aligned TX buffer */ | ||
318 | priv->tx_buffers[q][i] = buffer; | ||
319 | } | ||
320 | |||
317 | /* Allocate all RX descriptors. */ | 321 | /* Allocate all RX descriptors. */ |
318 | ring_size = sizeof(struct ravb_ex_rx_desc) * (priv->num_rx_ring[q] + 1); | 322 | ring_size = sizeof(struct ravb_ex_rx_desc) * (priv->num_rx_ring[q] + 1); |
319 | priv->rx_ring[q] = dma_alloc_coherent(NULL, ring_size, | 323 | priv->rx_ring[q] = dma_alloc_coherent(NULL, ring_size, |
@@ -524,6 +528,10 @@ static bool ravb_rx(struct net_device *ndev, int *quota, int q) | |||
524 | if (--boguscnt < 0) | 528 | if (--boguscnt < 0) |
525 | break; | 529 | break; |
526 | 530 | ||
531 | /* We use 0-byte descriptors to mark the DMA mapping errors */ | ||
532 | if (!pkt_len) | ||
533 | continue; | ||
534 | |||
527 | if (desc_status & MSC_MC) | 535 | if (desc_status & MSC_MC) |
528 | stats->multicast++; | 536 | stats->multicast++; |
529 | 537 | ||
@@ -543,10 +551,9 @@ static bool ravb_rx(struct net_device *ndev, int *quota, int q) | |||
543 | 551 | ||
544 | skb = priv->rx_skb[q][entry]; | 552 | skb = priv->rx_skb[q][entry]; |
545 | priv->rx_skb[q][entry] = NULL; | 553 | priv->rx_skb[q][entry] = NULL; |
546 | dma_sync_single_for_cpu(&ndev->dev, | 554 | dma_unmap_single(&ndev->dev, le32_to_cpu(desc->dptr), |
547 | le32_to_cpu(desc->dptr), | 555 | ALIGN(PKT_BUF_SZ, 16), |
548 | ALIGN(PKT_BUF_SZ, 16), | 556 | DMA_FROM_DEVICE); |
549 | DMA_FROM_DEVICE); | ||
550 | get_ts &= (q == RAVB_NC) ? | 557 | get_ts &= (q == RAVB_NC) ? |
551 | RAVB_RXTSTAMP_TYPE_V2_L2_EVENT : | 558 | RAVB_RXTSTAMP_TYPE_V2_L2_EVENT : |
552 | ~RAVB_RXTSTAMP_TYPE_V2_L2_EVENT; | 559 | ~RAVB_RXTSTAMP_TYPE_V2_L2_EVENT; |
@@ -584,17 +591,15 @@ static bool ravb_rx(struct net_device *ndev, int *quota, int q) | |||
584 | if (!skb) | 591 | if (!skb) |
585 | break; /* Better luck next round. */ | 592 | break; /* Better luck next round. */ |
586 | ravb_set_buffer_align(skb); | 593 | ravb_set_buffer_align(skb); |
587 | dma_unmap_single(&ndev->dev, le32_to_cpu(desc->dptr), | ||
588 | ALIGN(PKT_BUF_SZ, 16), | ||
589 | DMA_FROM_DEVICE); | ||
590 | dma_addr = dma_map_single(&ndev->dev, skb->data, | 594 | dma_addr = dma_map_single(&ndev->dev, skb->data, |
591 | le16_to_cpu(desc->ds_cc), | 595 | le16_to_cpu(desc->ds_cc), |
592 | DMA_FROM_DEVICE); | 596 | DMA_FROM_DEVICE); |
593 | skb_checksum_none_assert(skb); | 597 | skb_checksum_none_assert(skb); |
594 | if (dma_mapping_error(&ndev->dev, dma_addr)) { | 598 | /* We just set the data size to 0 for a failed mapping |
595 | dev_kfree_skb_any(skb); | 599 | * which should prevent DMA from happening... |
596 | break; | 600 | */ |
597 | } | 601 | if (dma_mapping_error(&ndev->dev, dma_addr)) |
602 | desc->ds_cc = cpu_to_le16(0); | ||
598 | desc->dptr = cpu_to_le32(dma_addr); | 603 | desc->dptr = cpu_to_le32(dma_addr); |
599 | priv->rx_skb[q][entry] = skb; | 604 | priv->rx_skb[q][entry] = skb; |
600 | } | 605 | } |
@@ -1279,7 +1284,6 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
1279 | u32 dma_addr; | 1284 | u32 dma_addr; |
1280 | void *buffer; | 1285 | void *buffer; |
1281 | u32 entry; | 1286 | u32 entry; |
1282 | u32 tccr; | ||
1283 | 1287 | ||
1284 | spin_lock_irqsave(&priv->lock, flags); | 1288 | spin_lock_irqsave(&priv->lock, flags); |
1285 | if (priv->cur_tx[q] - priv->dirty_tx[q] >= priv->num_tx_ring[q]) { | 1289 | if (priv->cur_tx[q] - priv->dirty_tx[q] >= priv->num_tx_ring[q]) { |
@@ -1328,9 +1332,7 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
1328 | dma_wmb(); | 1332 | dma_wmb(); |
1329 | desc->die_dt = DT_FSINGLE; | 1333 | desc->die_dt = DT_FSINGLE; |
1330 | 1334 | ||
1331 | tccr = ravb_read(ndev, TCCR); | 1335 | ravb_write(ndev, ravb_read(ndev, TCCR) | (TCCR_TSRQ0 << q), TCCR); |
1332 | if (!(tccr & (TCCR_TSRQ0 << q))) | ||
1333 | ravb_write(ndev, tccr | (TCCR_TSRQ0 << q), TCCR); | ||
1334 | 1336 | ||
1335 | priv->cur_tx[q]++; | 1337 | priv->cur_tx[q]++; |
1336 | if (priv->cur_tx[q] - priv->dirty_tx[q] >= priv->num_tx_ring[q] && | 1338 | if (priv->cur_tx[q] - priv->dirty_tx[q] >= priv->num_tx_ring[q] && |
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index 847643455468..605cc8948594 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c | |||
@@ -101,6 +101,11 @@ static unsigned int efx_ef10_mem_map_size(struct efx_nic *efx) | |||
101 | return resource_size(&efx->pci_dev->resource[bar]); | 101 | return resource_size(&efx->pci_dev->resource[bar]); |
102 | } | 102 | } |
103 | 103 | ||
104 | static bool efx_ef10_is_vf(struct efx_nic *efx) | ||
105 | { | ||
106 | return efx->type->is_vf; | ||
107 | } | ||
108 | |||
104 | static int efx_ef10_get_pf_index(struct efx_nic *efx) | 109 | static int efx_ef10_get_pf_index(struct efx_nic *efx) |
105 | { | 110 | { |
106 | MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_FUNCTION_INFO_OUT_LEN); | 111 | MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_FUNCTION_INFO_OUT_LEN); |
@@ -677,6 +682,48 @@ static int efx_ef10_probe_pf(struct efx_nic *efx) | |||
677 | return efx_ef10_probe(efx); | 682 | return efx_ef10_probe(efx); |
678 | } | 683 | } |
679 | 684 | ||
685 | int efx_ef10_vadaptor_alloc(struct efx_nic *efx, unsigned int port_id) | ||
686 | { | ||
687 | MCDI_DECLARE_BUF(inbuf, MC_CMD_VADAPTOR_ALLOC_IN_LEN); | ||
688 | |||
689 | MCDI_SET_DWORD(inbuf, VADAPTOR_ALLOC_IN_UPSTREAM_PORT_ID, port_id); | ||
690 | return efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_ALLOC, inbuf, sizeof(inbuf), | ||
691 | NULL, 0, NULL); | ||
692 | } | ||
693 | |||
694 | int efx_ef10_vadaptor_free(struct efx_nic *efx, unsigned int port_id) | ||
695 | { | ||
696 | MCDI_DECLARE_BUF(inbuf, MC_CMD_VADAPTOR_FREE_IN_LEN); | ||
697 | |||
698 | MCDI_SET_DWORD(inbuf, VADAPTOR_FREE_IN_UPSTREAM_PORT_ID, port_id); | ||
699 | return efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_FREE, inbuf, sizeof(inbuf), | ||
700 | NULL, 0, NULL); | ||
701 | } | ||
702 | |||
703 | int efx_ef10_vport_add_mac(struct efx_nic *efx, | ||
704 | unsigned int port_id, u8 *mac) | ||
705 | { | ||
706 | MCDI_DECLARE_BUF(inbuf, MC_CMD_VPORT_ADD_MAC_ADDRESS_IN_LEN); | ||
707 | |||
708 | MCDI_SET_DWORD(inbuf, VPORT_ADD_MAC_ADDRESS_IN_VPORT_ID, port_id); | ||
709 | ether_addr_copy(MCDI_PTR(inbuf, VPORT_ADD_MAC_ADDRESS_IN_MACADDR), mac); | ||
710 | |||
711 | return efx_mcdi_rpc(efx, MC_CMD_VPORT_ADD_MAC_ADDRESS, inbuf, | ||
712 | sizeof(inbuf), NULL, 0, NULL); | ||
713 | } | ||
714 | |||
715 | int efx_ef10_vport_del_mac(struct efx_nic *efx, | ||
716 | unsigned int port_id, u8 *mac) | ||
717 | { | ||
718 | MCDI_DECLARE_BUF(inbuf, MC_CMD_VPORT_DEL_MAC_ADDRESS_IN_LEN); | ||
719 | |||
720 | MCDI_SET_DWORD(inbuf, VPORT_DEL_MAC_ADDRESS_IN_VPORT_ID, port_id); | ||
721 | ether_addr_copy(MCDI_PTR(inbuf, VPORT_DEL_MAC_ADDRESS_IN_MACADDR), mac); | ||
722 | |||
723 | return efx_mcdi_rpc(efx, MC_CMD_VPORT_DEL_MAC_ADDRESS, inbuf, | ||
724 | sizeof(inbuf), NULL, 0, NULL); | ||
725 | } | ||
726 | |||
680 | #ifdef CONFIG_SFC_SRIOV | 727 | #ifdef CONFIG_SFC_SRIOV |
681 | static int efx_ef10_probe_vf(struct efx_nic *efx) | 728 | static int efx_ef10_probe_vf(struct efx_nic *efx) |
682 | { | 729 | { |
@@ -3804,6 +3851,72 @@ static void efx_ef10_filter_sync_rx_mode(struct efx_nic *efx) | |||
3804 | WARN_ON(remove_failed); | 3851 | WARN_ON(remove_failed); |
3805 | } | 3852 | } |
3806 | 3853 | ||
3854 | static int efx_ef10_vport_set_mac_address(struct efx_nic *efx) | ||
3855 | { | ||
3856 | struct efx_ef10_nic_data *nic_data = efx->nic_data; | ||
3857 | u8 mac_old[ETH_ALEN]; | ||
3858 | int rc, rc2; | ||
3859 | |||
3860 | /* Only reconfigure a PF-created vport */ | ||
3861 | if (is_zero_ether_addr(nic_data->vport_mac)) | ||
3862 | return 0; | ||
3863 | |||
3864 | efx_device_detach_sync(efx); | ||
3865 | efx_net_stop(efx->net_dev); | ||
3866 | down_write(&efx->filter_sem); | ||
3867 | efx_ef10_filter_table_remove(efx); | ||
3868 | up_write(&efx->filter_sem); | ||
3869 | |||
3870 | rc = efx_ef10_vadaptor_free(efx, nic_data->vport_id); | ||
3871 | if (rc) | ||
3872 | goto restore_filters; | ||
3873 | |||
3874 | ether_addr_copy(mac_old, nic_data->vport_mac); | ||
3875 | rc = efx_ef10_vport_del_mac(efx, nic_data->vport_id, | ||
3876 | nic_data->vport_mac); | ||
3877 | if (rc) | ||
3878 | goto restore_vadaptor; | ||
3879 | |||
3880 | rc = efx_ef10_vport_add_mac(efx, nic_data->vport_id, | ||
3881 | efx->net_dev->dev_addr); | ||
3882 | if (!rc) { | ||
3883 | ether_addr_copy(nic_data->vport_mac, efx->net_dev->dev_addr); | ||
3884 | } else { | ||
3885 | rc2 = efx_ef10_vport_add_mac(efx, nic_data->vport_id, mac_old); | ||
3886 | if (rc2) { | ||
3887 | /* Failed to add original MAC, so clear vport_mac */ | ||
3888 | eth_zero_addr(nic_data->vport_mac); | ||
3889 | goto reset_nic; | ||
3890 | } | ||
3891 | } | ||
3892 | |||
3893 | restore_vadaptor: | ||
3894 | rc2 = efx_ef10_vadaptor_alloc(efx, nic_data->vport_id); | ||
3895 | if (rc2) | ||
3896 | goto reset_nic; | ||
3897 | restore_filters: | ||
3898 | down_write(&efx->filter_sem); | ||
3899 | rc2 = efx_ef10_filter_table_probe(efx); | ||
3900 | up_write(&efx->filter_sem); | ||
3901 | if (rc2) | ||
3902 | goto reset_nic; | ||
3903 | |||
3904 | rc2 = efx_net_open(efx->net_dev); | ||
3905 | if (rc2) | ||
3906 | goto reset_nic; | ||
3907 | |||
3908 | netif_device_attach(efx->net_dev); | ||
3909 | |||
3910 | return rc; | ||
3911 | |||
3912 | reset_nic: | ||
3913 | netif_err(efx, drv, efx->net_dev, | ||
3914 | "Failed to restore when changing MAC address - scheduling reset\n"); | ||
3915 | efx_schedule_reset(efx, RESET_TYPE_DATAPATH); | ||
3916 | |||
3917 | return rc ? rc : rc2; | ||
3918 | } | ||
3919 | |||
3807 | static int efx_ef10_set_mac_address(struct efx_nic *efx) | 3920 | static int efx_ef10_set_mac_address(struct efx_nic *efx) |
3808 | { | 3921 | { |
3809 | MCDI_DECLARE_BUF(inbuf, MC_CMD_VADAPTOR_SET_MAC_IN_LEN); | 3922 | MCDI_DECLARE_BUF(inbuf, MC_CMD_VADAPTOR_SET_MAC_IN_LEN); |
@@ -3820,8 +3933,8 @@ static int efx_ef10_set_mac_address(struct efx_nic *efx) | |||
3820 | efx->net_dev->dev_addr); | 3933 | efx->net_dev->dev_addr); |
3821 | MCDI_SET_DWORD(inbuf, VADAPTOR_SET_MAC_IN_UPSTREAM_PORT_ID, | 3934 | MCDI_SET_DWORD(inbuf, VADAPTOR_SET_MAC_IN_UPSTREAM_PORT_ID, |
3822 | nic_data->vport_id); | 3935 | nic_data->vport_id); |
3823 | rc = efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_SET_MAC, inbuf, | 3936 | rc = efx_mcdi_rpc_quiet(efx, MC_CMD_VADAPTOR_SET_MAC, inbuf, |
3824 | sizeof(inbuf), NULL, 0, NULL); | 3937 | sizeof(inbuf), NULL, 0, NULL); |
3825 | 3938 | ||
3826 | efx_ef10_filter_table_probe(efx); | 3939 | efx_ef10_filter_table_probe(efx); |
3827 | up_write(&efx->filter_sem); | 3940 | up_write(&efx->filter_sem); |
@@ -3829,38 +3942,27 @@ static int efx_ef10_set_mac_address(struct efx_nic *efx) | |||
3829 | efx_net_open(efx->net_dev); | 3942 | efx_net_open(efx->net_dev); |
3830 | netif_device_attach(efx->net_dev); | 3943 | netif_device_attach(efx->net_dev); |
3831 | 3944 | ||
3832 | #if !defined(CONFIG_SFC_SRIOV) | 3945 | #ifdef CONFIG_SFC_SRIOV |
3833 | if (rc == -EPERM) | 3946 | if (efx->pci_dev->is_virtfn && efx->pci_dev->physfn) { |
3834 | netif_err(efx, drv, efx->net_dev, | ||
3835 | "Cannot change MAC address; use sfboot to enable mac-spoofing" | ||
3836 | " on this interface\n"); | ||
3837 | #else | ||
3838 | if (rc == -EPERM) { | ||
3839 | struct pci_dev *pci_dev_pf = efx->pci_dev->physfn; | 3947 | struct pci_dev *pci_dev_pf = efx->pci_dev->physfn; |
3840 | 3948 | ||
3841 | /* Switch to PF and change MAC address on vport */ | 3949 | if (rc == -EPERM) { |
3842 | if (efx->pci_dev->is_virtfn && pci_dev_pf) { | 3950 | struct efx_nic *efx_pf; |
3843 | struct efx_nic *efx_pf = pci_get_drvdata(pci_dev_pf); | ||
3844 | 3951 | ||
3845 | if (!efx_ef10_sriov_set_vf_mac(efx_pf, | 3952 | /* Switch to PF and change MAC address on vport */ |
3846 | nic_data->vf_index, | 3953 | efx_pf = pci_get_drvdata(pci_dev_pf); |
3847 | efx->net_dev->dev_addr)) | ||
3848 | return 0; | ||
3849 | } | ||
3850 | netif_err(efx, drv, efx->net_dev, | ||
3851 | "Cannot change MAC address; use sfboot to enable mac-spoofing" | ||
3852 | " on this interface\n"); | ||
3853 | } else if (efx->pci_dev->is_virtfn) { | ||
3854 | /* Successfully changed by VF (with MAC spoofing), so update the | ||
3855 | * parent PF if possible. | ||
3856 | */ | ||
3857 | struct pci_dev *pci_dev_pf = efx->pci_dev->physfn; | ||
3858 | 3954 | ||
3859 | if (pci_dev_pf) { | 3955 | rc = efx_ef10_sriov_set_vf_mac(efx_pf, |
3956 | nic_data->vf_index, | ||
3957 | efx->net_dev->dev_addr); | ||
3958 | } else if (!rc) { | ||
3860 | struct efx_nic *efx_pf = pci_get_drvdata(pci_dev_pf); | 3959 | struct efx_nic *efx_pf = pci_get_drvdata(pci_dev_pf); |
3861 | struct efx_ef10_nic_data *nic_data = efx_pf->nic_data; | 3960 | struct efx_ef10_nic_data *nic_data = efx_pf->nic_data; |
3862 | unsigned int i; | 3961 | unsigned int i; |
3863 | 3962 | ||
3963 | /* MAC address successfully changed by VF (with MAC | ||
3964 | * spoofing) so update the parent PF if possible. | ||
3965 | */ | ||
3864 | for (i = 0; i < efx_pf->vf_count; ++i) { | 3966 | for (i = 0; i < efx_pf->vf_count; ++i) { |
3865 | struct ef10_vf *vf = nic_data->vf + i; | 3967 | struct ef10_vf *vf = nic_data->vf + i; |
3866 | 3968 | ||
@@ -3871,8 +3973,24 @@ static int efx_ef10_set_mac_address(struct efx_nic *efx) | |||
3871 | } | 3973 | } |
3872 | } | 3974 | } |
3873 | } | 3975 | } |
3874 | } | 3976 | } else |
3875 | #endif | 3977 | #endif |
3978 | if (rc == -EPERM) { | ||
3979 | netif_err(efx, drv, efx->net_dev, | ||
3980 | "Cannot change MAC address; use sfboot to enable" | ||
3981 | " mac-spoofing on this interface\n"); | ||
3982 | } else if (rc == -ENOSYS && !efx_ef10_is_vf(efx)) { | ||
3983 | /* If the active MCFW does not support MC_CMD_VADAPTOR_SET_MAC | ||
3984 | * fall-back to the method of changing the MAC address on the | ||
3985 | * vport. This only applies to PFs because such versions of | ||
3986 | * MCFW do not support VFs. | ||
3987 | */ | ||
3988 | rc = efx_ef10_vport_set_mac_address(efx); | ||
3989 | } else { | ||
3990 | efx_mcdi_display_error(efx, MC_CMD_VADAPTOR_SET_MAC, | ||
3991 | sizeof(inbuf), NULL, 0, rc); | ||
3992 | } | ||
3993 | |||
3876 | return rc; | 3994 | return rc; |
3877 | } | 3995 | } |
3878 | 3996 | ||
diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/sfc/ef10_sriov.c index 6c9b6e45509a..3c17f274e802 100644 --- a/drivers/net/ethernet/sfc/ef10_sriov.c +++ b/drivers/net/ethernet/sfc/ef10_sriov.c | |||
@@ -29,30 +29,6 @@ static int efx_ef10_evb_port_assign(struct efx_nic *efx, unsigned int port_id, | |||
29 | NULL, 0, NULL); | 29 | NULL, 0, NULL); |
30 | } | 30 | } |
31 | 31 | ||
32 | static int efx_ef10_vport_add_mac(struct efx_nic *efx, | ||
33 | unsigned int port_id, u8 *mac) | ||
34 | { | ||
35 | MCDI_DECLARE_BUF(inbuf, MC_CMD_VPORT_ADD_MAC_ADDRESS_IN_LEN); | ||
36 | |||
37 | MCDI_SET_DWORD(inbuf, VPORT_ADD_MAC_ADDRESS_IN_VPORT_ID, port_id); | ||
38 | ether_addr_copy(MCDI_PTR(inbuf, VPORT_ADD_MAC_ADDRESS_IN_MACADDR), mac); | ||
39 | |||
40 | return efx_mcdi_rpc(efx, MC_CMD_VPORT_ADD_MAC_ADDRESS, inbuf, | ||
41 | sizeof(inbuf), NULL, 0, NULL); | ||
42 | } | ||
43 | |||
44 | static int efx_ef10_vport_del_mac(struct efx_nic *efx, | ||
45 | unsigned int port_id, u8 *mac) | ||
46 | { | ||
47 | MCDI_DECLARE_BUF(inbuf, MC_CMD_VPORT_DEL_MAC_ADDRESS_IN_LEN); | ||
48 | |||
49 | MCDI_SET_DWORD(inbuf, VPORT_DEL_MAC_ADDRESS_IN_VPORT_ID, port_id); | ||
50 | ether_addr_copy(MCDI_PTR(inbuf, VPORT_DEL_MAC_ADDRESS_IN_MACADDR), mac); | ||
51 | |||
52 | return efx_mcdi_rpc(efx, MC_CMD_VPORT_DEL_MAC_ADDRESS, inbuf, | ||
53 | sizeof(inbuf), NULL, 0, NULL); | ||
54 | } | ||
55 | |||
56 | static int efx_ef10_vswitch_alloc(struct efx_nic *efx, unsigned int port_id, | 32 | static int efx_ef10_vswitch_alloc(struct efx_nic *efx, unsigned int port_id, |
57 | unsigned int vswitch_type) | 33 | unsigned int vswitch_type) |
58 | { | 34 | { |
@@ -136,24 +112,6 @@ static int efx_ef10_vport_free(struct efx_nic *efx, unsigned int port_id) | |||
136 | NULL, 0, NULL); | 112 | NULL, 0, NULL); |
137 | } | 113 | } |
138 | 114 | ||
139 | static int efx_ef10_vadaptor_alloc(struct efx_nic *efx, unsigned int port_id) | ||
140 | { | ||
141 | MCDI_DECLARE_BUF(inbuf, MC_CMD_VADAPTOR_ALLOC_IN_LEN); | ||
142 | |||
143 | MCDI_SET_DWORD(inbuf, VADAPTOR_ALLOC_IN_UPSTREAM_PORT_ID, port_id); | ||
144 | return efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_ALLOC, inbuf, sizeof(inbuf), | ||
145 | NULL, 0, NULL); | ||
146 | } | ||
147 | |||
148 | static int efx_ef10_vadaptor_free(struct efx_nic *efx, unsigned int port_id) | ||
149 | { | ||
150 | MCDI_DECLARE_BUF(inbuf, MC_CMD_VADAPTOR_FREE_IN_LEN); | ||
151 | |||
152 | MCDI_SET_DWORD(inbuf, VADAPTOR_FREE_IN_UPSTREAM_PORT_ID, port_id); | ||
153 | return efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_FREE, inbuf, sizeof(inbuf), | ||
154 | NULL, 0, NULL); | ||
155 | } | ||
156 | |||
157 | static void efx_ef10_sriov_free_vf_vports(struct efx_nic *efx) | 115 | static void efx_ef10_sriov_free_vf_vports(struct efx_nic *efx) |
158 | { | 116 | { |
159 | struct efx_ef10_nic_data *nic_data = efx->nic_data; | 117 | struct efx_ef10_nic_data *nic_data = efx->nic_data; |
@@ -640,21 +598,21 @@ int efx_ef10_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i, u16 vlan, | |||
640 | MC_CMD_VPORT_ALLOC_IN_VPORT_TYPE_NORMAL, | 598 | MC_CMD_VPORT_ALLOC_IN_VPORT_TYPE_NORMAL, |
641 | vf->vlan, &vf->vport_id); | 599 | vf->vlan, &vf->vport_id); |
642 | if (rc) | 600 | if (rc) |
643 | goto reset_nic; | 601 | goto reset_nic_up_write; |
644 | 602 | ||
645 | restore_mac: | 603 | restore_mac: |
646 | if (!is_zero_ether_addr(vf->mac)) { | 604 | if (!is_zero_ether_addr(vf->mac)) { |
647 | rc2 = efx_ef10_vport_add_mac(efx, vf->vport_id, vf->mac); | 605 | rc2 = efx_ef10_vport_add_mac(efx, vf->vport_id, vf->mac); |
648 | if (rc2) { | 606 | if (rc2) { |
649 | eth_zero_addr(vf->mac); | 607 | eth_zero_addr(vf->mac); |
650 | goto reset_nic; | 608 | goto reset_nic_up_write; |
651 | } | 609 | } |
652 | } | 610 | } |
653 | 611 | ||
654 | restore_evb_port: | 612 | restore_evb_port: |
655 | rc2 = efx_ef10_evb_port_assign(efx, vf->vport_id, vf_i); | 613 | rc2 = efx_ef10_evb_port_assign(efx, vf->vport_id, vf_i); |
656 | if (rc2) | 614 | if (rc2) |
657 | goto reset_nic; | 615 | goto reset_nic_up_write; |
658 | else | 616 | else |
659 | vf->vport_assigned = 1; | 617 | vf->vport_assigned = 1; |
660 | 618 | ||
@@ -662,14 +620,16 @@ restore_vadaptor: | |||
662 | if (vf->efx) { | 620 | if (vf->efx) { |
663 | rc2 = efx_ef10_vadaptor_alloc(vf->efx, EVB_PORT_ID_ASSIGNED); | 621 | rc2 = efx_ef10_vadaptor_alloc(vf->efx, EVB_PORT_ID_ASSIGNED); |
664 | if (rc2) | 622 | if (rc2) |
665 | goto reset_nic; | 623 | goto reset_nic_up_write; |
666 | } | 624 | } |
667 | 625 | ||
668 | restore_filters: | 626 | restore_filters: |
669 | if (vf->efx) { | 627 | if (vf->efx) { |
670 | rc2 = vf->efx->type->filter_table_probe(vf->efx); | 628 | rc2 = vf->efx->type->filter_table_probe(vf->efx); |
671 | if (rc2) | 629 | if (rc2) |
672 | goto reset_nic; | 630 | goto reset_nic_up_write; |
631 | |||
632 | up_write(&vf->efx->filter_sem); | ||
673 | 633 | ||
674 | up_write(&vf->efx->filter_sem); | 634 | up_write(&vf->efx->filter_sem); |
675 | 635 | ||
@@ -681,9 +641,12 @@ restore_filters: | |||
681 | } | 641 | } |
682 | return rc; | 642 | return rc; |
683 | 643 | ||
644 | reset_nic_up_write: | ||
645 | if (vf->efx) | ||
646 | up_write(&vf->efx->filter_sem); | ||
647 | |||
684 | reset_nic: | 648 | reset_nic: |
685 | if (vf->efx) { | 649 | if (vf->efx) { |
686 | up_write(&vf->efx->filter_sem); | ||
687 | netif_err(efx, drv, efx->net_dev, | 650 | netif_err(efx, drv, efx->net_dev, |
688 | "Failed to restore VF - scheduling reset.\n"); | 651 | "Failed to restore VF - scheduling reset.\n"); |
689 | efx_schedule_reset(vf->efx, RESET_TYPE_DATAPATH); | 652 | efx_schedule_reset(vf->efx, RESET_TYPE_DATAPATH); |
diff --git a/drivers/net/ethernet/sfc/ef10_sriov.h b/drivers/net/ethernet/sfc/ef10_sriov.h index db4ef537c610..6d25b92cb45e 100644 --- a/drivers/net/ethernet/sfc/ef10_sriov.h +++ b/drivers/net/ethernet/sfc/ef10_sriov.h | |||
@@ -65,5 +65,11 @@ int efx_ef10_vswitching_restore_pf(struct efx_nic *efx); | |||
65 | int efx_ef10_vswitching_restore_vf(struct efx_nic *efx); | 65 | int efx_ef10_vswitching_restore_vf(struct efx_nic *efx); |
66 | void efx_ef10_vswitching_remove_pf(struct efx_nic *efx); | 66 | void efx_ef10_vswitching_remove_pf(struct efx_nic *efx); |
67 | void efx_ef10_vswitching_remove_vf(struct efx_nic *efx); | 67 | void efx_ef10_vswitching_remove_vf(struct efx_nic *efx); |
68 | int efx_ef10_vport_add_mac(struct efx_nic *efx, | ||
69 | unsigned int port_id, u8 *mac); | ||
70 | int efx_ef10_vport_del_mac(struct efx_nic *efx, | ||
71 | unsigned int port_id, u8 *mac); | ||
72 | int efx_ef10_vadaptor_alloc(struct efx_nic *efx, unsigned int port_id); | ||
73 | int efx_ef10_vadaptor_free(struct efx_nic *efx, unsigned int port_id); | ||
68 | 74 | ||
69 | #endif /* EF10_SRIOV_H */ | 75 | #endif /* EF10_SRIOV_H */ |
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 804b9ad553d3..03bc03b67f08 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c | |||
@@ -245,11 +245,17 @@ static int efx_check_disabled(struct efx_nic *efx) | |||
245 | */ | 245 | */ |
246 | static int efx_process_channel(struct efx_channel *channel, int budget) | 246 | static int efx_process_channel(struct efx_channel *channel, int budget) |
247 | { | 247 | { |
248 | struct efx_tx_queue *tx_queue; | ||
248 | int spent; | 249 | int spent; |
249 | 250 | ||
250 | if (unlikely(!channel->enabled)) | 251 | if (unlikely(!channel->enabled)) |
251 | return 0; | 252 | return 0; |
252 | 253 | ||
254 | efx_for_each_channel_tx_queue(tx_queue, channel) { | ||
255 | tx_queue->pkts_compl = 0; | ||
256 | tx_queue->bytes_compl = 0; | ||
257 | } | ||
258 | |||
253 | spent = efx_nic_process_eventq(channel, budget); | 259 | spent = efx_nic_process_eventq(channel, budget); |
254 | if (spent && efx_channel_has_rx_queue(channel)) { | 260 | if (spent && efx_channel_has_rx_queue(channel)) { |
255 | struct efx_rx_queue *rx_queue = | 261 | struct efx_rx_queue *rx_queue = |
@@ -259,6 +265,14 @@ static int efx_process_channel(struct efx_channel *channel, int budget) | |||
259 | efx_fast_push_rx_descriptors(rx_queue, true); | 265 | efx_fast_push_rx_descriptors(rx_queue, true); |
260 | } | 266 | } |
261 | 267 | ||
268 | /* Update BQL */ | ||
269 | efx_for_each_channel_tx_queue(tx_queue, channel) { | ||
270 | if (tx_queue->bytes_compl) { | ||
271 | netdev_tx_completed_queue(tx_queue->core_txq, | ||
272 | tx_queue->pkts_compl, tx_queue->bytes_compl); | ||
273 | } | ||
274 | } | ||
275 | |||
262 | return spent; | 276 | return spent; |
263 | } | 277 | } |
264 | 278 | ||
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index d72f522bf9c3..47d1e3a96522 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h | |||
@@ -241,6 +241,8 @@ struct efx_tx_queue { | |||
241 | unsigned int read_count ____cacheline_aligned_in_smp; | 241 | unsigned int read_count ____cacheline_aligned_in_smp; |
242 | unsigned int old_write_count; | 242 | unsigned int old_write_count; |
243 | unsigned int merge_events; | 243 | unsigned int merge_events; |
244 | unsigned int bytes_compl; | ||
245 | unsigned int pkts_compl; | ||
244 | 246 | ||
245 | /* Members used only on the xmit path */ | 247 | /* Members used only on the xmit path */ |
246 | unsigned int insert_count ____cacheline_aligned_in_smp; | 248 | unsigned int insert_count ____cacheline_aligned_in_smp; |
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c index aaf2987512b5..1833a0146571 100644 --- a/drivers/net/ethernet/sfc/tx.c +++ b/drivers/net/ethernet/sfc/tx.c | |||
@@ -617,7 +617,8 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index) | |||
617 | EFX_BUG_ON_PARANOID(index > tx_queue->ptr_mask); | 617 | EFX_BUG_ON_PARANOID(index > tx_queue->ptr_mask); |
618 | 618 | ||
619 | efx_dequeue_buffers(tx_queue, index, &pkts_compl, &bytes_compl); | 619 | efx_dequeue_buffers(tx_queue, index, &pkts_compl, &bytes_compl); |
620 | netdev_tx_completed_queue(tx_queue->core_txq, pkts_compl, bytes_compl); | 620 | tx_queue->pkts_compl += pkts_compl; |
621 | tx_queue->bytes_compl += bytes_compl; | ||
621 | 622 | ||
622 | if (pkts_compl > 1) | 623 | if (pkts_compl > 1) |
623 | ++tx_queue->merge_events; | 624 | ++tx_queue->merge_events; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 50f7a7a26821..864b476f7fd5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -2843,7 +2843,7 @@ int stmmac_dvr_probe(struct device *device, | |||
2843 | if (res->mac) | 2843 | if (res->mac) |
2844 | memcpy(priv->dev->dev_addr, res->mac, ETH_ALEN); | 2844 | memcpy(priv->dev->dev_addr, res->mac, ETH_ALEN); |
2845 | 2845 | ||
2846 | dev_set_drvdata(device, priv); | 2846 | dev_set_drvdata(device, priv->dev); |
2847 | 2847 | ||
2848 | /* Verify driver arguments */ | 2848 | /* Verify driver arguments */ |
2849 | stmmac_verify_args(); | 2849 | stmmac_verify_args(); |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 462820514fae..d155bf2573cd 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -138,19 +138,6 @@ do { \ | |||
138 | #define CPSW_CMINTMAX_INTVL (1000 / CPSW_CMINTMIN_CNT) | 138 | #define CPSW_CMINTMAX_INTVL (1000 / CPSW_CMINTMIN_CNT) |
139 | #define CPSW_CMINTMIN_INTVL ((1000 / CPSW_CMINTMAX_CNT) + 1) | 139 | #define CPSW_CMINTMIN_INTVL ((1000 / CPSW_CMINTMAX_CNT) + 1) |
140 | 140 | ||
141 | #define cpsw_enable_irq(priv) \ | ||
142 | do { \ | ||
143 | u32 i; \ | ||
144 | for (i = 0; i < priv->num_irqs; i++) \ | ||
145 | enable_irq(priv->irqs_table[i]); \ | ||
146 | } while (0) | ||
147 | #define cpsw_disable_irq(priv) \ | ||
148 | do { \ | ||
149 | u32 i; \ | ||
150 | for (i = 0; i < priv->num_irqs; i++) \ | ||
151 | disable_irq_nosync(priv->irqs_table[i]); \ | ||
152 | } while (0) | ||
153 | |||
154 | #define cpsw_slave_index(priv) \ | 141 | #define cpsw_slave_index(priv) \ |
155 | ((priv->data.dual_emac) ? priv->emac_port : \ | 142 | ((priv->data.dual_emac) ? priv->emac_port : \ |
156 | priv->data.active_slave) | 143 | priv->data.active_slave) |
@@ -509,9 +496,11 @@ static const struct cpsw_stats cpsw_gstrings_stats[] = { | |||
509 | (func)(slave++, ##arg); \ | 496 | (func)(slave++, ##arg); \ |
510 | } while (0) | 497 | } while (0) |
511 | #define cpsw_get_slave_ndev(priv, __slave_no__) \ | 498 | #define cpsw_get_slave_ndev(priv, __slave_no__) \ |
512 | (priv->slaves[__slave_no__].ndev) | 499 | ((__slave_no__ < priv->data.slaves) ? \ |
500 | priv->slaves[__slave_no__].ndev : NULL) | ||
513 | #define cpsw_get_slave_priv(priv, __slave_no__) \ | 501 | #define cpsw_get_slave_priv(priv, __slave_no__) \ |
514 | ((priv->slaves[__slave_no__].ndev) ? \ | 502 | (((__slave_no__ < priv->data.slaves) && \ |
503 | (priv->slaves[__slave_no__].ndev)) ? \ | ||
515 | netdev_priv(priv->slaves[__slave_no__].ndev) : NULL) \ | 504 | netdev_priv(priv->slaves[__slave_no__].ndev) : NULL) \ |
516 | 505 | ||
517 | #define cpsw_dual_emac_src_port_detect(status, priv, ndev, skb) \ | 506 | #define cpsw_dual_emac_src_port_detect(status, priv, ndev, skb) \ |
@@ -781,7 +770,7 @@ static irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id) | |||
781 | 770 | ||
782 | cpsw_intr_disable(priv); | 771 | cpsw_intr_disable(priv); |
783 | if (priv->irq_enabled == true) { | 772 | if (priv->irq_enabled == true) { |
784 | cpsw_disable_irq(priv); | 773 | disable_irq_nosync(priv->irqs_table[0]); |
785 | priv->irq_enabled = false; | 774 | priv->irq_enabled = false; |
786 | } | 775 | } |
787 | 776 | ||
@@ -804,9 +793,7 @@ static irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id) | |||
804 | static int cpsw_poll(struct napi_struct *napi, int budget) | 793 | static int cpsw_poll(struct napi_struct *napi, int budget) |
805 | { | 794 | { |
806 | struct cpsw_priv *priv = napi_to_priv(napi); | 795 | struct cpsw_priv *priv = napi_to_priv(napi); |
807 | int num_tx, num_rx; | 796 | int num_rx; |
808 | |||
809 | num_tx = cpdma_chan_process(priv->txch, 128); | ||
810 | 797 | ||
811 | num_rx = cpdma_chan_process(priv->rxch, budget); | 798 | num_rx = cpdma_chan_process(priv->rxch, budget); |
812 | if (num_rx < budget) { | 799 | if (num_rx < budget) { |
@@ -817,13 +804,12 @@ static int cpsw_poll(struct napi_struct *napi, int budget) | |||
817 | prim_cpsw = cpsw_get_slave_priv(priv, 0); | 804 | prim_cpsw = cpsw_get_slave_priv(priv, 0); |
818 | if (prim_cpsw->irq_enabled == false) { | 805 | if (prim_cpsw->irq_enabled == false) { |
819 | prim_cpsw->irq_enabled = true; | 806 | prim_cpsw->irq_enabled = true; |
820 | cpsw_enable_irq(priv); | 807 | enable_irq(priv->irqs_table[0]); |
821 | } | 808 | } |
822 | } | 809 | } |
823 | 810 | ||
824 | if (num_rx || num_tx) | 811 | if (num_rx) |
825 | cpsw_dbg(priv, intr, "poll %d rx, %d tx pkts\n", | 812 | cpsw_dbg(priv, intr, "poll %d rx pkts\n", num_rx); |
826 | num_rx, num_tx); | ||
827 | 813 | ||
828 | return num_rx; | 814 | return num_rx; |
829 | } | 815 | } |
@@ -1333,7 +1319,7 @@ static int cpsw_ndo_open(struct net_device *ndev) | |||
1333 | if (prim_cpsw->irq_enabled == false) { | 1319 | if (prim_cpsw->irq_enabled == false) { |
1334 | if ((priv == prim_cpsw) || !netif_running(prim_cpsw->ndev)) { | 1320 | if ((priv == prim_cpsw) || !netif_running(prim_cpsw->ndev)) { |
1335 | prim_cpsw->irq_enabled = true; | 1321 | prim_cpsw->irq_enabled = true; |
1336 | cpsw_enable_irq(prim_cpsw); | 1322 | enable_irq(prim_cpsw->irqs_table[0]); |
1337 | } | 1323 | } |
1338 | } | 1324 | } |
1339 | 1325 | ||
diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c index 5ec4ed3f6c8d..ec8ed30196f3 100644 --- a/drivers/net/ethernet/ti/netcp_core.c +++ b/drivers/net/ethernet/ti/netcp_core.c | |||
@@ -1617,11 +1617,11 @@ static int netcp_ndo_open(struct net_device *ndev) | |||
1617 | } | 1617 | } |
1618 | mutex_unlock(&netcp_modules_lock); | 1618 | mutex_unlock(&netcp_modules_lock); |
1619 | 1619 | ||
1620 | netcp_rxpool_refill(netcp); | ||
1621 | napi_enable(&netcp->rx_napi); | 1620 | napi_enable(&netcp->rx_napi); |
1622 | napi_enable(&netcp->tx_napi); | 1621 | napi_enable(&netcp->tx_napi); |
1623 | knav_queue_enable_notify(netcp->tx_compl_q); | 1622 | knav_queue_enable_notify(netcp->tx_compl_q); |
1624 | knav_queue_enable_notify(netcp->rx_queue); | 1623 | knav_queue_enable_notify(netcp->rx_queue); |
1624 | netcp_rxpool_refill(netcp); | ||
1625 | netif_tx_wake_all_queues(ndev); | 1625 | netif_tx_wake_all_queues(ndev); |
1626 | dev_dbg(netcp->ndev_dev, "netcp device %s opened\n", ndev->name); | 1626 | dev_dbg(netcp->ndev_dev, "netcp device %s opened\n", ndev->name); |
1627 | return 0; | 1627 | return 0; |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 4208dd7ef101..d95f9aae95e7 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c | |||
@@ -1530,9 +1530,9 @@ static int axienet_probe(struct platform_device *pdev) | |||
1530 | /* Map device registers */ | 1530 | /* Map device registers */ |
1531 | ethres = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1531 | ethres = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1532 | lp->regs = devm_ioremap_resource(&pdev->dev, ethres); | 1532 | lp->regs = devm_ioremap_resource(&pdev->dev, ethres); |
1533 | if (!lp->regs) { | 1533 | if (IS_ERR(lp->regs)) { |
1534 | dev_err(&pdev->dev, "could not map Axi Ethernet regs.\n"); | 1534 | dev_err(&pdev->dev, "could not map Axi Ethernet regs.\n"); |
1535 | ret = -ENOMEM; | 1535 | ret = PTR_ERR(lp->regs); |
1536 | goto free_netdev; | 1536 | goto free_netdev; |
1537 | } | 1537 | } |
1538 | 1538 | ||
@@ -1599,9 +1599,9 @@ static int axienet_probe(struct platform_device *pdev) | |||
1599 | goto free_netdev; | 1599 | goto free_netdev; |
1600 | } | 1600 | } |
1601 | lp->dma_regs = devm_ioremap_resource(&pdev->dev, &dmares); | 1601 | lp->dma_regs = devm_ioremap_resource(&pdev->dev, &dmares); |
1602 | if (!lp->dma_regs) { | 1602 | if (IS_ERR(lp->dma_regs)) { |
1603 | dev_err(&pdev->dev, "could not map DMA regs\n"); | 1603 | dev_err(&pdev->dev, "could not map DMA regs\n"); |
1604 | ret = -ENOMEM; | 1604 | ret = PTR_ERR(lp->dma_regs); |
1605 | goto free_netdev; | 1605 | goto free_netdev; |
1606 | } | 1606 | } |
1607 | lp->rx_irq = irq_of_parse_and_map(np, 1); | 1607 | lp->rx_irq = irq_of_parse_and_map(np, 1); |
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index 7856b6ccf5c5..d95a50ae996d 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c | |||
@@ -482,6 +482,7 @@ static void bpq_setup(struct net_device *dev) | |||
482 | memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN); | 482 | memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN); |
483 | 483 | ||
484 | dev->flags = 0; | 484 | dev->flags = 0; |
485 | dev->features = NETIF_F_LLTX; /* Allow recursion */ | ||
485 | 486 | ||
486 | #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) | 487 | #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) |
487 | dev->header_ops = &ax25_header_ops; | 488 | dev->header_ops = &ax25_header_ops; |
diff --git a/drivers/net/ipvlan/ipvlan.h b/drivers/net/ipvlan/ipvlan.h index 953a97492fab..9542b7bac61a 100644 --- a/drivers/net/ipvlan/ipvlan.h +++ b/drivers/net/ipvlan/ipvlan.h | |||
@@ -67,8 +67,6 @@ struct ipvl_dev { | |||
67 | struct ipvl_port *port; | 67 | struct ipvl_port *port; |
68 | struct net_device *phy_dev; | 68 | struct net_device *phy_dev; |
69 | struct list_head addrs; | 69 | struct list_head addrs; |
70 | int ipv4cnt; | ||
71 | int ipv6cnt; | ||
72 | struct ipvl_pcpu_stats __percpu *pcpu_stats; | 70 | struct ipvl_pcpu_stats __percpu *pcpu_stats; |
73 | DECLARE_BITMAP(mac_filters, IPVLAN_MAC_FILTER_SIZE); | 71 | DECLARE_BITMAP(mac_filters, IPVLAN_MAC_FILTER_SIZE); |
74 | netdev_features_t sfeatures; | 72 | netdev_features_t sfeatures; |
@@ -106,6 +104,11 @@ static inline struct ipvl_port *ipvlan_port_get_rcu(const struct net_device *d) | |||
106 | return rcu_dereference(d->rx_handler_data); | 104 | return rcu_dereference(d->rx_handler_data); |
107 | } | 105 | } |
108 | 106 | ||
107 | static inline struct ipvl_port *ipvlan_port_get_rcu_bh(const struct net_device *d) | ||
108 | { | ||
109 | return rcu_dereference_bh(d->rx_handler_data); | ||
110 | } | ||
111 | |||
109 | static inline struct ipvl_port *ipvlan_port_get_rtnl(const struct net_device *d) | 112 | static inline struct ipvl_port *ipvlan_port_get_rtnl(const struct net_device *d) |
110 | { | 113 | { |
111 | return rtnl_dereference(d->rx_handler_data); | 114 | return rtnl_dereference(d->rx_handler_data); |
@@ -124,5 +127,5 @@ struct ipvl_addr *ipvlan_find_addr(const struct ipvl_dev *ipvlan, | |||
124 | bool ipvlan_addr_busy(struct ipvl_port *port, void *iaddr, bool is_v6); | 127 | bool ipvlan_addr_busy(struct ipvl_port *port, void *iaddr, bool is_v6); |
125 | struct ipvl_addr *ipvlan_ht_addr_lookup(const struct ipvl_port *port, | 128 | struct ipvl_addr *ipvlan_ht_addr_lookup(const struct ipvl_port *port, |
126 | const void *iaddr, bool is_v6); | 129 | const void *iaddr, bool is_v6); |
127 | void ipvlan_ht_addr_del(struct ipvl_addr *addr, bool sync); | 130 | void ipvlan_ht_addr_del(struct ipvl_addr *addr); |
128 | #endif /* __IPVLAN_H */ | 131 | #endif /* __IPVLAN_H */ |
diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c index 8afbedad620d..207f62e8de9a 100644 --- a/drivers/net/ipvlan/ipvlan_core.c +++ b/drivers/net/ipvlan/ipvlan_core.c | |||
@@ -85,11 +85,9 @@ void ipvlan_ht_addr_add(struct ipvl_dev *ipvlan, struct ipvl_addr *addr) | |||
85 | hlist_add_head_rcu(&addr->hlnode, &port->hlhead[hash]); | 85 | hlist_add_head_rcu(&addr->hlnode, &port->hlhead[hash]); |
86 | } | 86 | } |
87 | 87 | ||
88 | void ipvlan_ht_addr_del(struct ipvl_addr *addr, bool sync) | 88 | void ipvlan_ht_addr_del(struct ipvl_addr *addr) |
89 | { | 89 | { |
90 | hlist_del_init_rcu(&addr->hlnode); | 90 | hlist_del_init_rcu(&addr->hlnode); |
91 | if (sync) | ||
92 | synchronize_rcu(); | ||
93 | } | 91 | } |
94 | 92 | ||
95 | struct ipvl_addr *ipvlan_find_addr(const struct ipvl_dev *ipvlan, | 93 | struct ipvl_addr *ipvlan_find_addr(const struct ipvl_dev *ipvlan, |
@@ -531,7 +529,7 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev) | |||
531 | int ipvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev) | 529 | int ipvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev) |
532 | { | 530 | { |
533 | struct ipvl_dev *ipvlan = netdev_priv(dev); | 531 | struct ipvl_dev *ipvlan = netdev_priv(dev); |
534 | struct ipvl_port *port = ipvlan_port_get_rcu(ipvlan->phy_dev); | 532 | struct ipvl_port *port = ipvlan_port_get_rcu_bh(ipvlan->phy_dev); |
535 | 533 | ||
536 | if (!port) | 534 | if (!port) |
537 | goto out; | 535 | goto out; |
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index 1acc283160d9..20b58bdecf75 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c | |||
@@ -153,10 +153,9 @@ static int ipvlan_open(struct net_device *dev) | |||
153 | else | 153 | else |
154 | dev->flags &= ~IFF_NOARP; | 154 | dev->flags &= ~IFF_NOARP; |
155 | 155 | ||
156 | if (ipvlan->ipv6cnt > 0 || ipvlan->ipv4cnt > 0) { | 156 | list_for_each_entry(addr, &ipvlan->addrs, anode) |
157 | list_for_each_entry(addr, &ipvlan->addrs, anode) | 157 | ipvlan_ht_addr_add(ipvlan, addr); |
158 | ipvlan_ht_addr_add(ipvlan, addr); | 158 | |
159 | } | ||
160 | return dev_uc_add(phy_dev, phy_dev->dev_addr); | 159 | return dev_uc_add(phy_dev, phy_dev->dev_addr); |
161 | } | 160 | } |
162 | 161 | ||
@@ -171,10 +170,9 @@ static int ipvlan_stop(struct net_device *dev) | |||
171 | 170 | ||
172 | dev_uc_del(phy_dev, phy_dev->dev_addr); | 171 | dev_uc_del(phy_dev, phy_dev->dev_addr); |
173 | 172 | ||
174 | if (ipvlan->ipv6cnt > 0 || ipvlan->ipv4cnt > 0) { | 173 | list_for_each_entry(addr, &ipvlan->addrs, anode) |
175 | list_for_each_entry(addr, &ipvlan->addrs, anode) | 174 | ipvlan_ht_addr_del(addr); |
176 | ipvlan_ht_addr_del(addr, !dev->dismantle); | 175 | |
177 | } | ||
178 | return 0; | 176 | return 0; |
179 | } | 177 | } |
180 | 178 | ||
@@ -471,8 +469,6 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev, | |||
471 | ipvlan->port = port; | 469 | ipvlan->port = port; |
472 | ipvlan->sfeatures = IPVLAN_FEATURES; | 470 | ipvlan->sfeatures = IPVLAN_FEATURES; |
473 | INIT_LIST_HEAD(&ipvlan->addrs); | 471 | INIT_LIST_HEAD(&ipvlan->addrs); |
474 | ipvlan->ipv4cnt = 0; | ||
475 | ipvlan->ipv6cnt = 0; | ||
476 | 472 | ||
477 | /* TODO Probably put random address here to be presented to the | 473 | /* TODO Probably put random address here to be presented to the |
478 | * world but keep using the physical-dev address for the outgoing | 474 | * world but keep using the physical-dev address for the outgoing |
@@ -508,12 +504,12 @@ static void ipvlan_link_delete(struct net_device *dev, struct list_head *head) | |||
508 | struct ipvl_dev *ipvlan = netdev_priv(dev); | 504 | struct ipvl_dev *ipvlan = netdev_priv(dev); |
509 | struct ipvl_addr *addr, *next; | 505 | struct ipvl_addr *addr, *next; |
510 | 506 | ||
511 | if (ipvlan->ipv6cnt > 0 || ipvlan->ipv4cnt > 0) { | 507 | list_for_each_entry_safe(addr, next, &ipvlan->addrs, anode) { |
512 | list_for_each_entry_safe(addr, next, &ipvlan->addrs, anode) { | 508 | ipvlan_ht_addr_del(addr); |
513 | ipvlan_ht_addr_del(addr, !dev->dismantle); | 509 | list_del(&addr->anode); |
514 | list_del(&addr->anode); | 510 | kfree_rcu(addr, rcu); |
515 | } | ||
516 | } | 511 | } |
512 | |||
517 | list_del_rcu(&ipvlan->pnode); | 513 | list_del_rcu(&ipvlan->pnode); |
518 | unregister_netdevice_queue(dev, head); | 514 | unregister_netdevice_queue(dev, head); |
519 | netdev_upper_dev_unlink(ipvlan->phy_dev, dev); | 515 | netdev_upper_dev_unlink(ipvlan->phy_dev, dev); |
@@ -627,7 +623,7 @@ static int ipvlan_add_addr6(struct ipvl_dev *ipvlan, struct in6_addr *ip6_addr) | |||
627 | memcpy(&addr->ip6addr, ip6_addr, sizeof(struct in6_addr)); | 623 | memcpy(&addr->ip6addr, ip6_addr, sizeof(struct in6_addr)); |
628 | addr->atype = IPVL_IPV6; | 624 | addr->atype = IPVL_IPV6; |
629 | list_add_tail(&addr->anode, &ipvlan->addrs); | 625 | list_add_tail(&addr->anode, &ipvlan->addrs); |
630 | ipvlan->ipv6cnt++; | 626 | |
631 | /* If the interface is not up, the address will be added to the hash | 627 | /* If the interface is not up, the address will be added to the hash |
632 | * list by ipvlan_open. | 628 | * list by ipvlan_open. |
633 | */ | 629 | */ |
@@ -645,10 +641,8 @@ static void ipvlan_del_addr6(struct ipvl_dev *ipvlan, struct in6_addr *ip6_addr) | |||
645 | if (!addr) | 641 | if (!addr) |
646 | return; | 642 | return; |
647 | 643 | ||
648 | ipvlan_ht_addr_del(addr, true); | 644 | ipvlan_ht_addr_del(addr); |
649 | list_del(&addr->anode); | 645 | list_del(&addr->anode); |
650 | ipvlan->ipv6cnt--; | ||
651 | WARN_ON(ipvlan->ipv6cnt < 0); | ||
652 | kfree_rcu(addr, rcu); | 646 | kfree_rcu(addr, rcu); |
653 | 647 | ||
654 | return; | 648 | return; |
@@ -661,6 +655,10 @@ static int ipvlan_addr6_event(struct notifier_block *unused, | |||
661 | struct net_device *dev = (struct net_device *)if6->idev->dev; | 655 | struct net_device *dev = (struct net_device *)if6->idev->dev; |
662 | struct ipvl_dev *ipvlan = netdev_priv(dev); | 656 | struct ipvl_dev *ipvlan = netdev_priv(dev); |
663 | 657 | ||
658 | /* FIXME IPv6 autoconf calls us from bh without RTNL */ | ||
659 | if (in_softirq()) | ||
660 | return NOTIFY_DONE; | ||
661 | |||
664 | if (!netif_is_ipvlan(dev)) | 662 | if (!netif_is_ipvlan(dev)) |
665 | return NOTIFY_DONE; | 663 | return NOTIFY_DONE; |
666 | 664 | ||
@@ -699,7 +697,7 @@ static int ipvlan_add_addr4(struct ipvl_dev *ipvlan, struct in_addr *ip4_addr) | |||
699 | memcpy(&addr->ip4addr, ip4_addr, sizeof(struct in_addr)); | 697 | memcpy(&addr->ip4addr, ip4_addr, sizeof(struct in_addr)); |
700 | addr->atype = IPVL_IPV4; | 698 | addr->atype = IPVL_IPV4; |
701 | list_add_tail(&addr->anode, &ipvlan->addrs); | 699 | list_add_tail(&addr->anode, &ipvlan->addrs); |
702 | ipvlan->ipv4cnt++; | 700 | |
703 | /* If the interface is not up, the address will be added to the hash | 701 | /* If the interface is not up, the address will be added to the hash |
704 | * list by ipvlan_open. | 702 | * list by ipvlan_open. |
705 | */ | 703 | */ |
@@ -717,10 +715,8 @@ static void ipvlan_del_addr4(struct ipvl_dev *ipvlan, struct in_addr *ip4_addr) | |||
717 | if (!addr) | 715 | if (!addr) |
718 | return; | 716 | return; |
719 | 717 | ||
720 | ipvlan_ht_addr_del(addr, true); | 718 | ipvlan_ht_addr_del(addr); |
721 | list_del(&addr->anode); | 719 | list_del(&addr->anode); |
722 | ipvlan->ipv4cnt--; | ||
723 | WARN_ON(ipvlan->ipv4cnt < 0); | ||
724 | kfree_rcu(addr, rcu); | 720 | kfree_rcu(addr, rcu); |
725 | 721 | ||
726 | return; | 722 | return; |
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index f8370808a018..3b933bb5a8d5 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -1355,6 +1355,7 @@ static void macvtap_exit(void) | |||
1355 | class_unregister(macvtap_class); | 1355 | class_unregister(macvtap_class); |
1356 | cdev_del(&macvtap_cdev); | 1356 | cdev_del(&macvtap_cdev); |
1357 | unregister_chrdev_region(macvtap_major, MACVTAP_NUM_DEVS); | 1357 | unregister_chrdev_region(macvtap_major, MACVTAP_NUM_DEVS); |
1358 | idr_destroy(&minor_idr); | ||
1358 | } | 1359 | } |
1359 | module_exit(macvtap_exit); | 1360 | module_exit(macvtap_exit); |
1360 | 1361 | ||
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index cf18940f4e84..cb86d7a01542 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -191,7 +191,7 @@ config MDIO_BUS_MUX_GPIO | |||
191 | 191 | ||
192 | config MDIO_BUS_MUX_MMIOREG | 192 | config MDIO_BUS_MUX_MMIOREG |
193 | tristate "Support for MMIO device-controlled MDIO bus multiplexers" | 193 | tristate "Support for MMIO device-controlled MDIO bus multiplexers" |
194 | depends on OF_MDIO | 194 | depends on OF_MDIO && HAS_IOMEM |
195 | select MDIO_BUS_MUX | 195 | select MDIO_BUS_MUX |
196 | help | 196 | help |
197 | This module provides a driver for MDIO bus multiplexers that | 197 | This module provides a driver for MDIO bus multiplexers that |
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index c7a12e2e07b7..8a3bf5469892 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c | |||
@@ -164,7 +164,7 @@ static int dp83867_config_init(struct phy_device *phydev) | |||
164 | return ret; | 164 | return ret; |
165 | } | 165 | } |
166 | 166 | ||
167 | if ((phydev->interface >= PHY_INTERFACE_MODE_RGMII_ID) || | 167 | if ((phydev->interface >= PHY_INTERFACE_MODE_RGMII_ID) && |
168 | (phydev->interface <= PHY_INTERFACE_MODE_RGMII_RXID)) { | 168 | (phydev->interface <= PHY_INTERFACE_MODE_RGMII_RXID)) { |
169 | val = phy_read_mmd_indirect(phydev, DP83867_RGMIICTL, | 169 | val = phy_read_mmd_indirect(phydev, DP83867_RGMIICTL, |
170 | DP83867_DEVADDR, phydev->addr); | 170 | DP83867_DEVADDR, phydev->addr); |
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 095ef3fe369a..46a14cbb0215 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -421,6 +421,8 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv) | |||
421 | { | 421 | { |
422 | struct phy_device *phydev = to_phy_device(dev); | 422 | struct phy_device *phydev = to_phy_device(dev); |
423 | struct phy_driver *phydrv = to_phy_driver(drv); | 423 | struct phy_driver *phydrv = to_phy_driver(drv); |
424 | const int num_ids = ARRAY_SIZE(phydev->c45_ids.device_ids); | ||
425 | int i; | ||
424 | 426 | ||
425 | if (of_driver_match_device(dev, drv)) | 427 | if (of_driver_match_device(dev, drv)) |
426 | return 1; | 428 | return 1; |
@@ -428,8 +430,21 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv) | |||
428 | if (phydrv->match_phy_device) | 430 | if (phydrv->match_phy_device) |
429 | return phydrv->match_phy_device(phydev); | 431 | return phydrv->match_phy_device(phydev); |
430 | 432 | ||
431 | return (phydrv->phy_id & phydrv->phy_id_mask) == | 433 | if (phydev->is_c45) { |
432 | (phydev->phy_id & phydrv->phy_id_mask); | 434 | for (i = 1; i < num_ids; i++) { |
435 | if (!(phydev->c45_ids.devices_in_package & (1 << i))) | ||
436 | continue; | ||
437 | |||
438 | if ((phydrv->phy_id & phydrv->phy_id_mask) == | ||
439 | (phydev->c45_ids.device_ids[i] & | ||
440 | phydrv->phy_id_mask)) | ||
441 | return 1; | ||
442 | } | ||
443 | return 0; | ||
444 | } else { | ||
445 | return (phydrv->phy_id & phydrv->phy_id_mask) == | ||
446 | (phydev->phy_id & phydrv->phy_id_mask); | ||
447 | } | ||
433 | } | 448 | } |
434 | 449 | ||
435 | #ifdef CONFIG_PM | 450 | #ifdef CONFIG_PM |
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 4545e78840b0..35a2bffe848a 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -523,6 +523,7 @@ static const struct driver_info wwan_info = { | |||
523 | #define REALTEK_VENDOR_ID 0x0bda | 523 | #define REALTEK_VENDOR_ID 0x0bda |
524 | #define SAMSUNG_VENDOR_ID 0x04e8 | 524 | #define SAMSUNG_VENDOR_ID 0x04e8 |
525 | #define LENOVO_VENDOR_ID 0x17ef | 525 | #define LENOVO_VENDOR_ID 0x17ef |
526 | #define NVIDIA_VENDOR_ID 0x0955 | ||
526 | 527 | ||
527 | static const struct usb_device_id products[] = { | 528 | static const struct usb_device_id products[] = { |
528 | /* BLACKLIST !! | 529 | /* BLACKLIST !! |
@@ -710,6 +711,13 @@ static const struct usb_device_id products[] = { | |||
710 | .driver_info = 0, | 711 | .driver_info = 0, |
711 | }, | 712 | }, |
712 | 713 | ||
714 | /* NVIDIA Tegra USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */ | ||
715 | { | ||
716 | USB_DEVICE_AND_INTERFACE_INFO(NVIDIA_VENDOR_ID, 0x09ff, USB_CLASS_COMM, | ||
717 | USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), | ||
718 | .driver_info = 0, | ||
719 | }, | ||
720 | |||
713 | /* WHITELIST!!! | 721 | /* WHITELIST!!! |
714 | * | 722 | * |
715 | * CDC Ether uses two interfaces, not necessarily consecutive. | 723 | * CDC Ether uses two interfaces, not necessarily consecutive. |
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c index e4b7a47a825c..efc18e05af0a 100644 --- a/drivers/net/usb/cdc_mbim.c +++ b/drivers/net/usb/cdc_mbim.c | |||
@@ -158,7 +158,7 @@ static int cdc_mbim_bind(struct usbnet *dev, struct usb_interface *intf) | |||
158 | if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) | 158 | if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) |
159 | goto err; | 159 | goto err; |
160 | 160 | ||
161 | ret = cdc_ncm_bind_common(dev, intf, data_altsetting); | 161 | ret = cdc_ncm_bind_common(dev, intf, data_altsetting, 0); |
162 | if (ret) | 162 | if (ret) |
163 | goto err; | 163 | goto err; |
164 | 164 | ||
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 8067b8fbb0ee..db40175b1a0b 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Original author: Hans Petter Selasky <hans.petter.selasky@stericsson.com> | 6 | * Original author: Hans Petter Selasky <hans.petter.selasky@stericsson.com> |
7 | * | 7 | * |
8 | * USB Host Driver for Network Control Model (NCM) | 8 | * USB Host Driver for Network Control Model (NCM) |
9 | * http://www.usb.org/developers/devclass_docs/NCM10.zip | 9 | * http://www.usb.org/developers/docs/devclass_docs/NCM10_012011.zip |
10 | * | 10 | * |
11 | * The NCM encoding, decoding and initialization logic | 11 | * The NCM encoding, decoding and initialization logic |
12 | * derives from FreeBSD 8.x. if_cdce.c and if_cdcereg.h | 12 | * derives from FreeBSD 8.x. if_cdce.c and if_cdcereg.h |
@@ -684,10 +684,12 @@ static void cdc_ncm_free(struct cdc_ncm_ctx *ctx) | |||
684 | ctx->tx_curr_skb = NULL; | 684 | ctx->tx_curr_skb = NULL; |
685 | } | 685 | } |
686 | 686 | ||
687 | kfree(ctx->delayed_ndp16); | ||
688 | |||
687 | kfree(ctx); | 689 | kfree(ctx); |
688 | } | 690 | } |
689 | 691 | ||
690 | int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting) | 692 | int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags) |
691 | { | 693 | { |
692 | const struct usb_cdc_union_desc *union_desc = NULL; | 694 | const struct usb_cdc_union_desc *union_desc = NULL; |
693 | struct cdc_ncm_ctx *ctx; | 695 | struct cdc_ncm_ctx *ctx; |
@@ -855,6 +857,17 @@ advance: | |||
855 | /* finish setting up the device specific data */ | 857 | /* finish setting up the device specific data */ |
856 | cdc_ncm_setup(dev); | 858 | cdc_ncm_setup(dev); |
857 | 859 | ||
860 | /* Device-specific flags */ | ||
861 | ctx->drvflags = drvflags; | ||
862 | |||
863 | /* Allocate the delayed NDP if needed. */ | ||
864 | if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) { | ||
865 | ctx->delayed_ndp16 = kzalloc(ctx->max_ndp_size, GFP_KERNEL); | ||
866 | if (!ctx->delayed_ndp16) | ||
867 | goto error2; | ||
868 | dev_info(&intf->dev, "NDP will be placed at end of frame for this device."); | ||
869 | } | ||
870 | |||
858 | /* override ethtool_ops */ | 871 | /* override ethtool_ops */ |
859 | dev->net->ethtool_ops = &cdc_ncm_ethtool_ops; | 872 | dev->net->ethtool_ops = &cdc_ncm_ethtool_ops; |
860 | 873 | ||
@@ -954,8 +967,11 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) | |||
954 | if (cdc_ncm_select_altsetting(intf) != CDC_NCM_COMM_ALTSETTING_NCM) | 967 | if (cdc_ncm_select_altsetting(intf) != CDC_NCM_COMM_ALTSETTING_NCM) |
955 | return -ENODEV; | 968 | return -ENODEV; |
956 | 969 | ||
957 | /* The NCM data altsetting is fixed */ | 970 | /* The NCM data altsetting is fixed, so we hard-coded it. |
958 | ret = cdc_ncm_bind_common(dev, intf, CDC_NCM_DATA_ALTSETTING_NCM); | 971 | * Additionally, generic NCM devices are assumed to accept arbitrarily |
972 | * placed NDP. | ||
973 | */ | ||
974 | ret = cdc_ncm_bind_common(dev, intf, CDC_NCM_DATA_ALTSETTING_NCM, 0); | ||
959 | 975 | ||
960 | /* | 976 | /* |
961 | * We should get an event when network connection is "connected" or | 977 | * We should get an event when network connection is "connected" or |
@@ -986,6 +1002,14 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm_ndp(struct cdc_ncm_ctx *ctx, struct sk_ | |||
986 | struct usb_cdc_ncm_nth16 *nth16 = (void *)skb->data; | 1002 | struct usb_cdc_ncm_nth16 *nth16 = (void *)skb->data; |
987 | size_t ndpoffset = le16_to_cpu(nth16->wNdpIndex); | 1003 | size_t ndpoffset = le16_to_cpu(nth16->wNdpIndex); |
988 | 1004 | ||
1005 | /* If NDP should be moved to the end of the NCM package, we can't follow the | ||
1006 | * NTH16 header as we would normally do. NDP isn't written to the SKB yet, and | ||
1007 | * the wNdpIndex field in the header is actually not consistent with reality. It will be later. | ||
1008 | */ | ||
1009 | if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) | ||
1010 | if (ctx->delayed_ndp16->dwSignature == sign) | ||
1011 | return ctx->delayed_ndp16; | ||
1012 | |||
989 | /* follow the chain of NDPs, looking for a match */ | 1013 | /* follow the chain of NDPs, looking for a match */ |
990 | while (ndpoffset) { | 1014 | while (ndpoffset) { |
991 | ndp16 = (struct usb_cdc_ncm_ndp16 *)(skb->data + ndpoffset); | 1015 | ndp16 = (struct usb_cdc_ncm_ndp16 *)(skb->data + ndpoffset); |
@@ -995,7 +1019,8 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm_ndp(struct cdc_ncm_ctx *ctx, struct sk_ | |||
995 | } | 1019 | } |
996 | 1020 | ||
997 | /* align new NDP */ | 1021 | /* align new NDP */ |
998 | cdc_ncm_align_tail(skb, ctx->tx_ndp_modulus, 0, ctx->tx_max); | 1022 | if (!(ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)) |
1023 | cdc_ncm_align_tail(skb, ctx->tx_ndp_modulus, 0, ctx->tx_max); | ||
999 | 1024 | ||
1000 | /* verify that there is room for the NDP and the datagram (reserve) */ | 1025 | /* verify that there is room for the NDP and the datagram (reserve) */ |
1001 | if ((ctx->tx_max - skb->len - reserve) < ctx->max_ndp_size) | 1026 | if ((ctx->tx_max - skb->len - reserve) < ctx->max_ndp_size) |
@@ -1008,7 +1033,11 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm_ndp(struct cdc_ncm_ctx *ctx, struct sk_ | |||
1008 | nth16->wNdpIndex = cpu_to_le16(skb->len); | 1033 | nth16->wNdpIndex = cpu_to_le16(skb->len); |
1009 | 1034 | ||
1010 | /* push a new empty NDP */ | 1035 | /* push a new empty NDP */ |
1011 | ndp16 = (struct usb_cdc_ncm_ndp16 *)memset(skb_put(skb, ctx->max_ndp_size), 0, ctx->max_ndp_size); | 1036 | if (!(ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)) |
1037 | ndp16 = (struct usb_cdc_ncm_ndp16 *)memset(skb_put(skb, ctx->max_ndp_size), 0, ctx->max_ndp_size); | ||
1038 | else | ||
1039 | ndp16 = ctx->delayed_ndp16; | ||
1040 | |||
1012 | ndp16->dwSignature = sign; | 1041 | ndp16->dwSignature = sign; |
1013 | ndp16->wLength = cpu_to_le16(sizeof(struct usb_cdc_ncm_ndp16) + sizeof(struct usb_cdc_ncm_dpe16)); | 1042 | ndp16->wLength = cpu_to_le16(sizeof(struct usb_cdc_ncm_ndp16) + sizeof(struct usb_cdc_ncm_dpe16)); |
1014 | return ndp16; | 1043 | return ndp16; |
@@ -1023,6 +1052,15 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign) | |||
1023 | struct sk_buff *skb_out; | 1052 | struct sk_buff *skb_out; |
1024 | u16 n = 0, index, ndplen; | 1053 | u16 n = 0, index, ndplen; |
1025 | u8 ready2send = 0; | 1054 | u8 ready2send = 0; |
1055 | u32 delayed_ndp_size; | ||
1056 | |||
1057 | /* When our NDP gets written in cdc_ncm_ndp(), then skb_out->len gets updated | ||
1058 | * accordingly. Otherwise, we should check here. | ||
1059 | */ | ||
1060 | if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) | ||
1061 | delayed_ndp_size = ctx->max_ndp_size; | ||
1062 | else | ||
1063 | delayed_ndp_size = 0; | ||
1026 | 1064 | ||
1027 | /* if there is a remaining skb, it gets priority */ | 1065 | /* if there is a remaining skb, it gets priority */ |
1028 | if (skb != NULL) { | 1066 | if (skb != NULL) { |
@@ -1077,7 +1115,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign) | |||
1077 | cdc_ncm_align_tail(skb_out, ctx->tx_modulus, ctx->tx_remainder, ctx->tx_max); | 1115 | cdc_ncm_align_tail(skb_out, ctx->tx_modulus, ctx->tx_remainder, ctx->tx_max); |
1078 | 1116 | ||
1079 | /* check if we had enough room left for both NDP and frame */ | 1117 | /* check if we had enough room left for both NDP and frame */ |
1080 | if (!ndp16 || skb_out->len + skb->len > ctx->tx_max) { | 1118 | if (!ndp16 || skb_out->len + skb->len + delayed_ndp_size > ctx->tx_max) { |
1081 | if (n == 0) { | 1119 | if (n == 0) { |
1082 | /* won't fit, MTU problem? */ | 1120 | /* won't fit, MTU problem? */ |
1083 | dev_kfree_skb_any(skb); | 1121 | dev_kfree_skb_any(skb); |
@@ -1150,6 +1188,17 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign) | |||
1150 | /* variables will be reset at next call */ | 1188 | /* variables will be reset at next call */ |
1151 | } | 1189 | } |
1152 | 1190 | ||
1191 | /* If requested, put NDP at end of frame. */ | ||
1192 | if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) { | ||
1193 | nth16 = (struct usb_cdc_ncm_nth16 *)skb_out->data; | ||
1194 | cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_max); | ||
1195 | nth16->wNdpIndex = cpu_to_le16(skb_out->len); | ||
1196 | memcpy(skb_put(skb_out, ctx->max_ndp_size), ctx->delayed_ndp16, ctx->max_ndp_size); | ||
1197 | |||
1198 | /* Zero out delayed NDP - signature checking will naturally fail. */ | ||
1199 | ndp16 = memset(ctx->delayed_ndp16, 0, ctx->max_ndp_size); | ||
1200 | } | ||
1201 | |||
1153 | /* If collected data size is less or equal ctx->min_tx_pkt | 1202 | /* If collected data size is less or equal ctx->min_tx_pkt |
1154 | * bytes, we send buffers as it is. If we get more data, it | 1203 | * bytes, we send buffers as it is. If we get more data, it |
1155 | * would be more efficient for USB HS mobile device with DMA | 1204 | * would be more efficient for USB HS mobile device with DMA |
diff --git a/drivers/net/usb/huawei_cdc_ncm.c b/drivers/net/usb/huawei_cdc_ncm.c index 735f7dadb9a0..2680a65cd5e4 100644 --- a/drivers/net/usb/huawei_cdc_ncm.c +++ b/drivers/net/usb/huawei_cdc_ncm.c | |||
@@ -73,11 +73,14 @@ static int huawei_cdc_ncm_bind(struct usbnet *usbnet_dev, | |||
73 | struct usb_driver *subdriver = ERR_PTR(-ENODEV); | 73 | struct usb_driver *subdriver = ERR_PTR(-ENODEV); |
74 | int ret = -ENODEV; | 74 | int ret = -ENODEV; |
75 | struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data; | 75 | struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data; |
76 | int drvflags = 0; | ||
76 | 77 | ||
77 | /* altsetting should always be 1 for NCM devices - so we hard-coded | 78 | /* altsetting should always be 1 for NCM devices - so we hard-coded |
78 | * it here | 79 | * it here. Some huawei devices will need the NDP part of the NCM package to |
80 | * be at the end of the frame. | ||
79 | */ | 81 | */ |
80 | ret = cdc_ncm_bind_common(usbnet_dev, intf, 1); | 82 | drvflags |= CDC_NCM_FLAG_NDP_TO_END; |
83 | ret = cdc_ncm_bind_common(usbnet_dev, intf, 1, drvflags); | ||
81 | if (ret) | 84 | if (ret) |
82 | goto err; | 85 | goto err; |
83 | 86 | ||
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index f603f362504b..9d43460ce3c7 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -757,6 +757,7 @@ static const struct usb_device_id products[] = { | |||
757 | {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ | 757 | {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ |
758 | {QMI_FIXED_INTF(0x1199, 0x901f, 8)}, /* Sierra Wireless EM7355 */ | 758 | {QMI_FIXED_INTF(0x1199, 0x901f, 8)}, /* Sierra Wireless EM7355 */ |
759 | {QMI_FIXED_INTF(0x1199, 0x9041, 8)}, /* Sierra Wireless MC7305/MC7355 */ | 759 | {QMI_FIXED_INTF(0x1199, 0x9041, 8)}, /* Sierra Wireless MC7305/MC7355 */ |
760 | {QMI_FIXED_INTF(0x1199, 0x9041, 10)}, /* Sierra Wireless MC7305/MC7355 */ | ||
760 | {QMI_FIXED_INTF(0x1199, 0x9051, 8)}, /* Netgear AirCard 340U */ | 761 | {QMI_FIXED_INTF(0x1199, 0x9051, 8)}, /* Netgear AirCard 340U */ |
761 | {QMI_FIXED_INTF(0x1199, 0x9053, 8)}, /* Sierra Wireless Modem */ | 762 | {QMI_FIXED_INTF(0x1199, 0x9053, 8)}, /* Sierra Wireless Modem */ |
762 | {QMI_FIXED_INTF(0x1199, 0x9054, 8)}, /* Sierra Wireless Modem */ | 763 | {QMI_FIXED_INTF(0x1199, 0x9054, 8)}, /* Sierra Wireless Modem */ |
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index aafa1a1898e4..7f6419ebb5e1 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -494,6 +494,7 @@ enum rtl8152_flags { | |||
494 | #define VENDOR_ID_REALTEK 0x0bda | 494 | #define VENDOR_ID_REALTEK 0x0bda |
495 | #define VENDOR_ID_SAMSUNG 0x04e8 | 495 | #define VENDOR_ID_SAMSUNG 0x04e8 |
496 | #define VENDOR_ID_LENOVO 0x17ef | 496 | #define VENDOR_ID_LENOVO 0x17ef |
497 | #define VENDOR_ID_NVIDIA 0x0955 | ||
497 | 498 | ||
498 | #define MCU_TYPE_PLA 0x0100 | 499 | #define MCU_TYPE_PLA 0x0100 |
499 | #define MCU_TYPE_USB 0x0000 | 500 | #define MCU_TYPE_USB 0x0000 |
@@ -4117,6 +4118,7 @@ static struct usb_device_id rtl8152_table[] = { | |||
4117 | {REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101)}, | 4118 | {REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101)}, |
4118 | {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205)}, | 4119 | {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205)}, |
4119 | {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f)}, | 4120 | {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f)}, |
4121 | {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff)}, | ||
4120 | {} | 4122 | {} |
4121 | }; | 4123 | }; |
4122 | 4124 | ||
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 63c7810e1545..7fbca37a1adf 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -1828,7 +1828,8 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
1828 | else | 1828 | else |
1829 | vi->hdr_len = sizeof(struct virtio_net_hdr); | 1829 | vi->hdr_len = sizeof(struct virtio_net_hdr); |
1830 | 1830 | ||
1831 | if (virtio_has_feature(vdev, VIRTIO_F_ANY_LAYOUT)) | 1831 | if (virtio_has_feature(vdev, VIRTIO_F_ANY_LAYOUT) || |
1832 | virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) | ||
1832 | vi->any_header_sg = true; | 1833 | vi->any_header_sg = true; |
1833 | 1834 | ||
1834 | if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ)) | 1835 | if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ)) |
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index da11bb5e9c7f..46f4caddccbe 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -1216,7 +1216,7 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq, | |||
1216 | static const u32 rxprod_reg[2] = { | 1216 | static const u32 rxprod_reg[2] = { |
1217 | VMXNET3_REG_RXPROD, VMXNET3_REG_RXPROD2 | 1217 | VMXNET3_REG_RXPROD, VMXNET3_REG_RXPROD2 |
1218 | }; | 1218 | }; |
1219 | u32 num_rxd = 0; | 1219 | u32 num_pkts = 0; |
1220 | bool skip_page_frags = false; | 1220 | bool skip_page_frags = false; |
1221 | struct Vmxnet3_RxCompDesc *rcd; | 1221 | struct Vmxnet3_RxCompDesc *rcd; |
1222 | struct vmxnet3_rx_ctx *ctx = &rq->rx_ctx; | 1222 | struct vmxnet3_rx_ctx *ctx = &rq->rx_ctx; |
@@ -1235,13 +1235,12 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq, | |||
1235 | struct Vmxnet3_RxDesc *rxd; | 1235 | struct Vmxnet3_RxDesc *rxd; |
1236 | u32 idx, ring_idx; | 1236 | u32 idx, ring_idx; |
1237 | struct vmxnet3_cmd_ring *ring = NULL; | 1237 | struct vmxnet3_cmd_ring *ring = NULL; |
1238 | if (num_rxd >= quota) { | 1238 | if (num_pkts >= quota) { |
1239 | /* we may stop even before we see the EOP desc of | 1239 | /* we may stop even before we see the EOP desc of |
1240 | * the current pkt | 1240 | * the current pkt |
1241 | */ | 1241 | */ |
1242 | break; | 1242 | break; |
1243 | } | 1243 | } |
1244 | num_rxd++; | ||
1245 | BUG_ON(rcd->rqID != rq->qid && rcd->rqID != rq->qid2); | 1244 | BUG_ON(rcd->rqID != rq->qid && rcd->rqID != rq->qid2); |
1246 | idx = rcd->rxdIdx; | 1245 | idx = rcd->rxdIdx; |
1247 | ring_idx = rcd->rqID < adapter->num_rx_queues ? 0 : 1; | 1246 | ring_idx = rcd->rqID < adapter->num_rx_queues ? 0 : 1; |
@@ -1413,6 +1412,7 @@ not_lro: | |||
1413 | napi_gro_receive(&rq->napi, skb); | 1412 | napi_gro_receive(&rq->napi, skb); |
1414 | 1413 | ||
1415 | ctx->skb = NULL; | 1414 | ctx->skb = NULL; |
1415 | num_pkts++; | ||
1416 | } | 1416 | } |
1417 | 1417 | ||
1418 | rcd_done: | 1418 | rcd_done: |
@@ -1443,7 +1443,7 @@ rcd_done: | |||
1443 | &rq->comp_ring.base[rq->comp_ring.next2proc].rcd, &rxComp); | 1443 | &rq->comp_ring.base[rq->comp_ring.next2proc].rcd, &rxComp); |
1444 | } | 1444 | } |
1445 | 1445 | ||
1446 | return num_rxd; | 1446 | return num_pkts; |
1447 | } | 1447 | } |
1448 | 1448 | ||
1449 | 1449 | ||
diff --git a/drivers/net/wan/z85230.c b/drivers/net/wan/z85230.c index feacc3b994b7..2f0bd6955f33 100644 --- a/drivers/net/wan/z85230.c +++ b/drivers/net/wan/z85230.c | |||
@@ -1044,7 +1044,7 @@ EXPORT_SYMBOL(z8530_sync_dma_close); | |||
1044 | * @dev: The network device to attach | 1044 | * @dev: The network device to attach |
1045 | * @c: The Z8530 channel to configure in sync DMA mode. | 1045 | * @c: The Z8530 channel to configure in sync DMA mode. |
1046 | * | 1046 | * |
1047 | * Set up a Z85x30 device for synchronous DMA tranmission. One | 1047 | * Set up a Z85x30 device for synchronous DMA transmission. One |
1048 | * ISA DMA channel must be available for this to work. The receive | 1048 | * ISA DMA channel must be available for this to work. The receive |
1049 | * side is run in PIO mode, but then it has the bigger FIFO. | 1049 | * side is run in PIO mode, but then it has the bigger FIFO. |
1050 | */ | 1050 | */ |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 5e15e8e10ed3..a31a6804dc34 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -279,6 +279,7 @@ static void ath9k_hw_read_revisions(struct ath_hw *ah) | |||
279 | return; | 279 | return; |
280 | case AR9300_DEVID_QCA956X: | 280 | case AR9300_DEVID_QCA956X: |
281 | ah->hw_version.macVersion = AR_SREV_VERSION_9561; | 281 | ah->hw_version.macVersion = AR_SREV_VERSION_9561; |
282 | return; | ||
282 | } | 283 | } |
283 | 284 | ||
284 | val = REG_READ(ah, AR_SREV) & AR_SREV_ID; | 285 | val = REG_READ(ah, AR_SREV) & AR_SREV_ID; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h index d56064861a9c..d45dc021cda2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fh.h +++ b/drivers/net/wireless/iwlwifi/iwl-fh.h | |||
@@ -438,6 +438,12 @@ static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl) | |||
438 | #define RX_QUEUE_MASK 255 | 438 | #define RX_QUEUE_MASK 255 |
439 | #define RX_QUEUE_SIZE_LOG 8 | 439 | #define RX_QUEUE_SIZE_LOG 8 |
440 | 440 | ||
441 | /* | ||
442 | * RX related structures and functions | ||
443 | */ | ||
444 | #define RX_FREE_BUFFERS 64 | ||
445 | #define RX_LOW_WATERMARK 8 | ||
446 | |||
441 | /** | 447 | /** |
442 | * struct iwl_rb_status - reserve buffer status | 448 | * struct iwl_rb_status - reserve buffer status |
443 | * host memory mapped FH registers | 449 | * host memory mapped FH registers |
diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c index 80fefe7d7b8c..3b8e85e51002 100644 --- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c | |||
@@ -540,13 +540,11 @@ static void iwl_set_hw_address_family_8000(struct device *dev, | |||
540 | hw_addr = (const u8 *)(mac_override + | 540 | hw_addr = (const u8 *)(mac_override + |
541 | MAC_ADDRESS_OVERRIDE_FAMILY_8000); | 541 | MAC_ADDRESS_OVERRIDE_FAMILY_8000); |
542 | 542 | ||
543 | /* The byte order is little endian 16 bit, meaning 214365 */ | 543 | /* |
544 | data->hw_addr[0] = hw_addr[1]; | 544 | * Store the MAC address from MAO section. |
545 | data->hw_addr[1] = hw_addr[0]; | 545 | * No byte swapping is required in MAO section |
546 | data->hw_addr[2] = hw_addr[3]; | 546 | */ |
547 | data->hw_addr[3] = hw_addr[2]; | 547 | memcpy(data->hw_addr, hw_addr, ETH_ALEN); |
548 | data->hw_addr[4] = hw_addr[5]; | ||
549 | data->hw_addr[5] = hw_addr[4]; | ||
550 | 548 | ||
551 | /* | 549 | /* |
552 | * Force the use of the OTP MAC address in case of reserved MAC | 550 | * Force the use of the OTP MAC address in case of reserved MAC |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h index 5e4cbdb44c60..737774a01c74 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h | |||
@@ -660,7 +660,8 @@ struct iwl_scan_config { | |||
660 | * iwl_umac_scan_flags | 660 | * iwl_umac_scan_flags |
661 | *@IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request | 661 | *@IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request |
662 | * can be preempted by other scan requests with higher priority. | 662 | * can be preempted by other scan requests with higher priority. |
663 | * The low priority scan is aborted. | 663 | * The low priority scan will be resumed when the higher proirity scan is |
664 | * completed. | ||
664 | *@IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver | 665 | *@IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver |
665 | * when scan starts. | 666 | * when scan starts. |
666 | */ | 667 | */ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 5de144968723..5000bfcded61 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
@@ -1109,6 +1109,9 @@ static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
1109 | cmd->uid = cpu_to_le32(uid); | 1109 | cmd->uid = cpu_to_le32(uid); |
1110 | cmd->general_flags = cpu_to_le32(iwl_mvm_scan_umac_flags(mvm, params)); | 1110 | cmd->general_flags = cpu_to_le32(iwl_mvm_scan_umac_flags(mvm, params)); |
1111 | 1111 | ||
1112 | if (type == IWL_MVM_SCAN_SCHED) | ||
1113 | cmd->flags = cpu_to_le32(IWL_UMAC_SCAN_FLAG_PREEMPTIVE); | ||
1114 | |||
1112 | if (iwl_mvm_scan_use_ebs(mvm, vif, n_iterations)) | 1115 | if (iwl_mvm_scan_use_ebs(mvm, vif, n_iterations)) |
1113 | cmd->channel_flags = IWL_SCAN_CHANNEL_FLAG_EBS | | 1116 | cmd->channel_flags = IWL_SCAN_CHANNEL_FLAG_EBS | |
1114 | IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE | | 1117 | IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE | |
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c index d68dc697a4a0..26f076e82149 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/iwlwifi/mvm/sta.c | |||
@@ -1401,6 +1401,7 @@ int iwl_mvm_set_sta_key(struct iwl_mvm *mvm, | |||
1401 | bool mcast = !(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE); | 1401 | bool mcast = !(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE); |
1402 | u8 sta_id; | 1402 | u8 sta_id; |
1403 | int ret; | 1403 | int ret; |
1404 | static const u8 __maybe_unused zero_addr[ETH_ALEN] = {0}; | ||
1404 | 1405 | ||
1405 | lockdep_assert_held(&mvm->mutex); | 1406 | lockdep_assert_held(&mvm->mutex); |
1406 | 1407 | ||
@@ -1467,7 +1468,7 @@ int iwl_mvm_set_sta_key(struct iwl_mvm *mvm, | |||
1467 | end: | 1468 | end: |
1468 | IWL_DEBUG_WEP(mvm, "key: cipher=%x len=%d idx=%d sta=%pM ret=%d\n", | 1469 | IWL_DEBUG_WEP(mvm, "key: cipher=%x len=%d idx=%d sta=%pM ret=%d\n", |
1469 | keyconf->cipher, keyconf->keylen, keyconf->keyidx, | 1470 | keyconf->cipher, keyconf->keylen, keyconf->keyidx, |
1470 | sta->addr, ret); | 1471 | sta ? sta->addr : zero_addr, ret); |
1471 | return ret; | 1472 | return ret; |
1472 | } | 1473 | } |
1473 | 1474 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/time-event.c b/drivers/net/wireless/iwlwifi/mvm/time-event.c index d24b6a83e68c..e472729e5f14 100644 --- a/drivers/net/wireless/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/iwlwifi/mvm/time-event.c | |||
@@ -86,7 +86,7 @@ void iwl_mvm_te_clear_data(struct iwl_mvm *mvm, | |||
86 | { | 86 | { |
87 | lockdep_assert_held(&mvm->time_event_lock); | 87 | lockdep_assert_held(&mvm->time_event_lock); |
88 | 88 | ||
89 | if (te_data->id == TE_MAX) | 89 | if (!te_data->vif) |
90 | return; | 90 | return; |
91 | 91 | ||
92 | list_del(&te_data->list); | 92 | list_del(&te_data->list); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c index 7ba7a118ff5c..89116864d2a0 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c | |||
@@ -252,7 +252,7 @@ void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct iwl_tx_cmd *tx_cmd, | |||
252 | 252 | ||
253 | if (info->band == IEEE80211_BAND_2GHZ && | 253 | if (info->band == IEEE80211_BAND_2GHZ && |
254 | !iwl_mvm_bt_coex_is_shared_ant_avail(mvm)) | 254 | !iwl_mvm_bt_coex_is_shared_ant_avail(mvm)) |
255 | rate_flags = BIT(mvm->cfg->non_shared_ant) << RATE_MCS_ANT_POS; | 255 | rate_flags = mvm->cfg->non_shared_ant << RATE_MCS_ANT_POS; |
256 | else | 256 | else |
257 | rate_flags = | 257 | rate_flags = |
258 | BIT(mvm->mgmt_last_antenna_idx) << RATE_MCS_ANT_POS; | 258 | BIT(mvm->mgmt_last_antenna_idx) << RATE_MCS_ANT_POS; |
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index 2ed1e4d2774d..9f65c1cff1b1 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
@@ -368,12 +368,14 @@ static const struct pci_device_id iwl_hw_card_ids[] = { | |||
368 | /* 3165 Series */ | 368 | /* 3165 Series */ |
369 | {IWL_PCI_DEVICE(0x3165, 0x4010, iwl3165_2ac_cfg)}, | 369 | {IWL_PCI_DEVICE(0x3165, 0x4010, iwl3165_2ac_cfg)}, |
370 | {IWL_PCI_DEVICE(0x3165, 0x4012, iwl3165_2ac_cfg)}, | 370 | {IWL_PCI_DEVICE(0x3165, 0x4012, iwl3165_2ac_cfg)}, |
371 | {IWL_PCI_DEVICE(0x3166, 0x4212, iwl3165_2ac_cfg)}, | ||
371 | {IWL_PCI_DEVICE(0x3165, 0x4410, iwl3165_2ac_cfg)}, | 372 | {IWL_PCI_DEVICE(0x3165, 0x4410, iwl3165_2ac_cfg)}, |
372 | {IWL_PCI_DEVICE(0x3165, 0x4510, iwl3165_2ac_cfg)}, | 373 | {IWL_PCI_DEVICE(0x3165, 0x4510, iwl3165_2ac_cfg)}, |
373 | {IWL_PCI_DEVICE(0x3165, 0x4110, iwl3165_2ac_cfg)}, | 374 | {IWL_PCI_DEVICE(0x3165, 0x4110, iwl3165_2ac_cfg)}, |
374 | {IWL_PCI_DEVICE(0x3166, 0x4310, iwl3165_2ac_cfg)}, | 375 | {IWL_PCI_DEVICE(0x3166, 0x4310, iwl3165_2ac_cfg)}, |
375 | {IWL_PCI_DEVICE(0x3166, 0x4210, iwl3165_2ac_cfg)}, | 376 | {IWL_PCI_DEVICE(0x3166, 0x4210, iwl3165_2ac_cfg)}, |
376 | {IWL_PCI_DEVICE(0x3165, 0x8010, iwl3165_2ac_cfg)}, | 377 | {IWL_PCI_DEVICE(0x3165, 0x8010, iwl3165_2ac_cfg)}, |
378 | {IWL_PCI_DEVICE(0x3165, 0x8110, iwl3165_2ac_cfg)}, | ||
377 | 379 | ||
378 | /* 7265 Series */ | 380 | /* 7265 Series */ |
379 | {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, | 381 | {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, |
@@ -426,9 +428,8 @@ static const struct pci_device_id iwl_hw_card_ids[] = { | |||
426 | {IWL_PCI_DEVICE(0x24F4, 0x1130, iwl8260_2ac_cfg)}, | 428 | {IWL_PCI_DEVICE(0x24F4, 0x1130, iwl8260_2ac_cfg)}, |
427 | {IWL_PCI_DEVICE(0x24F4, 0x1030, iwl8260_2ac_cfg)}, | 429 | {IWL_PCI_DEVICE(0x24F4, 0x1030, iwl8260_2ac_cfg)}, |
428 | {IWL_PCI_DEVICE(0x24F3, 0xC010, iwl8260_2ac_cfg)}, | 430 | {IWL_PCI_DEVICE(0x24F3, 0xC010, iwl8260_2ac_cfg)}, |
431 | {IWL_PCI_DEVICE(0x24F3, 0xC110, iwl8260_2ac_cfg)}, | ||
429 | {IWL_PCI_DEVICE(0x24F3, 0xD010, iwl8260_2ac_cfg)}, | 432 | {IWL_PCI_DEVICE(0x24F3, 0xD010, iwl8260_2ac_cfg)}, |
430 | {IWL_PCI_DEVICE(0x24F4, 0xC030, iwl8260_2ac_cfg)}, | ||
431 | {IWL_PCI_DEVICE(0x24F4, 0xD030, iwl8260_2ac_cfg)}, | ||
432 | {IWL_PCI_DEVICE(0x24F3, 0xC050, iwl8260_2ac_cfg)}, | 433 | {IWL_PCI_DEVICE(0x24F3, 0xC050, iwl8260_2ac_cfg)}, |
433 | {IWL_PCI_DEVICE(0x24F3, 0xD050, iwl8260_2ac_cfg)}, | 434 | {IWL_PCI_DEVICE(0x24F3, 0xD050, iwl8260_2ac_cfg)}, |
434 | {IWL_PCI_DEVICE(0x24F3, 0x8010, iwl8260_2ac_cfg)}, | 435 | {IWL_PCI_DEVICE(0x24F3, 0x8010, iwl8260_2ac_cfg)}, |
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h index 31f72a61cc3f..376b84e54ad7 100644 --- a/drivers/net/wireless/iwlwifi/pcie/internal.h +++ b/drivers/net/wireless/iwlwifi/pcie/internal.h | |||
@@ -44,15 +44,6 @@ | |||
44 | #include "iwl-io.h" | 44 | #include "iwl-io.h" |
45 | #include "iwl-op-mode.h" | 45 | #include "iwl-op-mode.h" |
46 | 46 | ||
47 | /* | ||
48 | * RX related structures and functions | ||
49 | */ | ||
50 | #define RX_NUM_QUEUES 1 | ||
51 | #define RX_POST_REQ_ALLOC 2 | ||
52 | #define RX_CLAIM_REQ_ALLOC 8 | ||
53 | #define RX_POOL_SIZE ((RX_CLAIM_REQ_ALLOC - RX_POST_REQ_ALLOC) * RX_NUM_QUEUES) | ||
54 | #define RX_LOW_WATERMARK 8 | ||
55 | |||
56 | struct iwl_host_cmd; | 47 | struct iwl_host_cmd; |
57 | 48 | ||
58 | /*This file includes the declaration that are internal to the | 49 | /*This file includes the declaration that are internal to the |
@@ -86,29 +77,29 @@ struct isr_statistics { | |||
86 | * struct iwl_rxq - Rx queue | 77 | * struct iwl_rxq - Rx queue |
87 | * @bd: driver's pointer to buffer of receive buffer descriptors (rbd) | 78 | * @bd: driver's pointer to buffer of receive buffer descriptors (rbd) |
88 | * @bd_dma: bus address of buffer of receive buffer descriptors (rbd) | 79 | * @bd_dma: bus address of buffer of receive buffer descriptors (rbd) |
80 | * @pool: | ||
81 | * @queue: | ||
89 | * @read: Shared index to newest available Rx buffer | 82 | * @read: Shared index to newest available Rx buffer |
90 | * @write: Shared index to oldest written Rx packet | 83 | * @write: Shared index to oldest written Rx packet |
91 | * @free_count: Number of pre-allocated buffers in rx_free | 84 | * @free_count: Number of pre-allocated buffers in rx_free |
92 | * @used_count: Number of RBDs handled to allocator to use for allocation | ||
93 | * @write_actual: | 85 | * @write_actual: |
94 | * @rx_free: list of RBDs with allocated RB ready for use | 86 | * @rx_free: list of free SKBs for use |
95 | * @rx_used: list of RBDs with no RB attached | 87 | * @rx_used: List of Rx buffers with no SKB |
96 | * @need_update: flag to indicate we need to update read/write index | 88 | * @need_update: flag to indicate we need to update read/write index |
97 | * @rb_stts: driver's pointer to receive buffer status | 89 | * @rb_stts: driver's pointer to receive buffer status |
98 | * @rb_stts_dma: bus address of receive buffer status | 90 | * @rb_stts_dma: bus address of receive buffer status |
99 | * @lock: | 91 | * @lock: |
100 | * @pool: initial pool of iwl_rx_mem_buffer for the queue | ||
101 | * @queue: actual rx queue | ||
102 | * | 92 | * |
103 | * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers | 93 | * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers |
104 | */ | 94 | */ |
105 | struct iwl_rxq { | 95 | struct iwl_rxq { |
106 | __le32 *bd; | 96 | __le32 *bd; |
107 | dma_addr_t bd_dma; | 97 | dma_addr_t bd_dma; |
98 | struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; | ||
99 | struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE]; | ||
108 | u32 read; | 100 | u32 read; |
109 | u32 write; | 101 | u32 write; |
110 | u32 free_count; | 102 | u32 free_count; |
111 | u32 used_count; | ||
112 | u32 write_actual; | 103 | u32 write_actual; |
113 | struct list_head rx_free; | 104 | struct list_head rx_free; |
114 | struct list_head rx_used; | 105 | struct list_head rx_used; |
@@ -116,32 +107,6 @@ struct iwl_rxq { | |||
116 | struct iwl_rb_status *rb_stts; | 107 | struct iwl_rb_status *rb_stts; |
117 | dma_addr_t rb_stts_dma; | 108 | dma_addr_t rb_stts_dma; |
118 | spinlock_t lock; | 109 | spinlock_t lock; |
119 | struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE]; | ||
120 | struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE]; | ||
121 | }; | ||
122 | |||
123 | /** | ||
124 | * struct iwl_rb_allocator - Rx allocator | ||
125 | * @pool: initial pool of allocator | ||
126 | * @req_pending: number of requests the allcator had not processed yet | ||
127 | * @req_ready: number of requests honored and ready for claiming | ||
128 | * @rbd_allocated: RBDs with pages allocated and ready to be handled to | ||
129 | * the queue. This is a list of &struct iwl_rx_mem_buffer | ||
130 | * @rbd_empty: RBDs with no page attached for allocator use. This is a list | ||
131 | * of &struct iwl_rx_mem_buffer | ||
132 | * @lock: protects the rbd_allocated and rbd_empty lists | ||
133 | * @alloc_wq: work queue for background calls | ||
134 | * @rx_alloc: work struct for background calls | ||
135 | */ | ||
136 | struct iwl_rb_allocator { | ||
137 | struct iwl_rx_mem_buffer pool[RX_POOL_SIZE]; | ||
138 | atomic_t req_pending; | ||
139 | atomic_t req_ready; | ||
140 | struct list_head rbd_allocated; | ||
141 | struct list_head rbd_empty; | ||
142 | spinlock_t lock; | ||
143 | struct workqueue_struct *alloc_wq; | ||
144 | struct work_struct rx_alloc; | ||
145 | }; | 110 | }; |
146 | 111 | ||
147 | struct iwl_dma_ptr { | 112 | struct iwl_dma_ptr { |
@@ -285,7 +250,7 @@ iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx) | |||
285 | /** | 250 | /** |
286 | * struct iwl_trans_pcie - PCIe transport specific data | 251 | * struct iwl_trans_pcie - PCIe transport specific data |
287 | * @rxq: all the RX queue data | 252 | * @rxq: all the RX queue data |
288 | * @rba: allocator for RX replenishing | 253 | * @rx_replenish: work that will be called when buffers need to be allocated |
289 | * @drv - pointer to iwl_drv | 254 | * @drv - pointer to iwl_drv |
290 | * @trans: pointer to the generic transport area | 255 | * @trans: pointer to the generic transport area |
291 | * @scd_base_addr: scheduler sram base address in SRAM | 256 | * @scd_base_addr: scheduler sram base address in SRAM |
@@ -308,7 +273,7 @@ iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx) | |||
308 | */ | 273 | */ |
309 | struct iwl_trans_pcie { | 274 | struct iwl_trans_pcie { |
310 | struct iwl_rxq rxq; | 275 | struct iwl_rxq rxq; |
311 | struct iwl_rb_allocator rba; | 276 | struct work_struct rx_replenish; |
312 | struct iwl_trans *trans; | 277 | struct iwl_trans *trans; |
313 | struct iwl_drv *drv; | 278 | struct iwl_drv *drv; |
314 | 279 | ||
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c index a3fbaa0ef5e0..adad8d0fae7f 100644 --- a/drivers/net/wireless/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/iwlwifi/pcie/rx.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. | 3 | * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. |
4 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH | 4 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
5 | * | 5 | * |
6 | * Portions of this file are derived from the ipw3945 project, as well | 6 | * Portions of this file are derived from the ipw3945 project, as well |
7 | * as portions of the ieee80211 subsystem header files. | 7 | * as portions of the ieee80211 subsystem header files. |
@@ -74,29 +74,16 @@ | |||
74 | * resets the Rx queue buffers with new memory. | 74 | * resets the Rx queue buffers with new memory. |
75 | * | 75 | * |
76 | * The management in the driver is as follows: | 76 | * The management in the driver is as follows: |
77 | * + A list of pre-allocated RBDs is stored in iwl->rxq->rx_free. | 77 | * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When |
78 | * When the interrupt handler is called, the request is processed. | 78 | * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled |
79 | * The page is either stolen - transferred to the upper layer | 79 | * to replenish the iwl->rxq->rx_free. |
80 | * or reused - added immediately to the iwl->rxq->rx_free list. | 80 | * + In iwl_pcie_rx_replenish (scheduled) if 'processed' != 'read' then the |
81 | * + When the page is stolen - the driver updates the matching queue's used | 81 | * iwl->rxq is replenished and the READ INDEX is updated (updating the |
82 | * count, detaches the RBD and transfers it to the queue used list. | 82 | * 'processed' and 'read' driver indexes as well) |
83 | * When there are two used RBDs - they are transferred to the allocator empty | ||
84 | * list. Work is then scheduled for the allocator to start allocating | ||
85 | * eight buffers. | ||
86 | * When there are another 6 used RBDs - they are transferred to the allocator | ||
87 | * empty list and the driver tries to claim the pre-allocated buffers and | ||
88 | * add them to iwl->rxq->rx_free. If it fails - it continues to claim them | ||
89 | * until ready. | ||
90 | * When there are 8+ buffers in the free list - either from allocation or from | ||
91 | * 8 reused unstolen pages - restock is called to update the FW and indexes. | ||
92 | * + In order to make sure the allocator always has RBDs to use for allocation | ||
93 | * the allocator has initial pool in the size of num_queues*(8-2) - the | ||
94 | * maximum missing RBDs per allocation request (request posted with 2 | ||
95 | * empty RBDs, there is no guarantee when the other 6 RBDs are supplied). | ||
96 | * The queues supplies the recycle of the rest of the RBDs. | ||
97 | * + A received packet is processed and handed to the kernel network stack, | 83 | * + A received packet is processed and handed to the kernel network stack, |
98 | * detached from the iwl->rxq. The driver 'processed' index is updated. | 84 | * detached from the iwl->rxq. The driver 'processed' index is updated. |
99 | * + If there are no allocated buffers in iwl->rxq->rx_free, | 85 | * + The Host/Firmware iwl->rxq is replenished at irq thread time from the |
86 | * rx_free list. If there are no allocated buffers in iwl->rxq->rx_free, | ||
100 | * the READ INDEX is not incremented and iwl->status(RX_STALLED) is set. | 87 | * the READ INDEX is not incremented and iwl->status(RX_STALLED) is set. |
101 | * If there were enough free buffers and RX_STALLED is set it is cleared. | 88 | * If there were enough free buffers and RX_STALLED is set it is cleared. |
102 | * | 89 | * |
@@ -105,32 +92,18 @@ | |||
105 | * | 92 | * |
106 | * iwl_rxq_alloc() Allocates rx_free | 93 | * iwl_rxq_alloc() Allocates rx_free |
107 | * iwl_pcie_rx_replenish() Replenishes rx_free list from rx_used, and calls | 94 | * iwl_pcie_rx_replenish() Replenishes rx_free list from rx_used, and calls |
108 | * iwl_pcie_rxq_restock. | 95 | * iwl_pcie_rxq_restock |
109 | * Used only during initialization. | ||
110 | * iwl_pcie_rxq_restock() Moves available buffers from rx_free into Rx | 96 | * iwl_pcie_rxq_restock() Moves available buffers from rx_free into Rx |
111 | * queue, updates firmware pointers, and updates | 97 | * queue, updates firmware pointers, and updates |
112 | * the WRITE index. | 98 | * the WRITE index. If insufficient rx_free buffers |
113 | * iwl_pcie_rx_allocator() Background work for allocating pages. | 99 | * are available, schedules iwl_pcie_rx_replenish |
114 | * | 100 | * |
115 | * -- enable interrupts -- | 101 | * -- enable interrupts -- |
116 | * ISR - iwl_rx() Detach iwl_rx_mem_buffers from pool up to the | 102 | * ISR - iwl_rx() Detach iwl_rx_mem_buffers from pool up to the |
117 | * READ INDEX, detaching the SKB from the pool. | 103 | * READ INDEX, detaching the SKB from the pool. |
118 | * Moves the packet buffer from queue to rx_used. | 104 | * Moves the packet buffer from queue to rx_used. |
119 | * Posts and claims requests to the allocator. | ||
120 | * Calls iwl_pcie_rxq_restock to refill any empty | 105 | * Calls iwl_pcie_rxq_restock to refill any empty |
121 | * slots. | 106 | * slots. |
122 | * | ||
123 | * RBD life-cycle: | ||
124 | * | ||
125 | * Init: | ||
126 | * rxq.pool -> rxq.rx_used -> rxq.rx_free -> rxq.queue | ||
127 | * | ||
128 | * Regular Receive interrupt: | ||
129 | * Page Stolen: | ||
130 | * rxq.queue -> rxq.rx_used -> allocator.rbd_empty -> | ||
131 | * allocator.rbd_allocated -> rxq.rx_free -> rxq.queue | ||
132 | * Page not Stolen: | ||
133 | * rxq.queue -> rxq.rx_free -> rxq.queue | ||
134 | * ... | 107 | * ... |
135 | * | 108 | * |
136 | */ | 109 | */ |
@@ -267,6 +240,10 @@ static void iwl_pcie_rxq_restock(struct iwl_trans *trans) | |||
267 | rxq->free_count--; | 240 | rxq->free_count--; |
268 | } | 241 | } |
269 | spin_unlock(&rxq->lock); | 242 | spin_unlock(&rxq->lock); |
243 | /* If the pre-allocated buffer pool is dropping low, schedule to | ||
244 | * refill it */ | ||
245 | if (rxq->free_count <= RX_LOW_WATERMARK) | ||
246 | schedule_work(&trans_pcie->rx_replenish); | ||
270 | 247 | ||
271 | /* If we've added more space for the firmware to place data, tell it. | 248 | /* If we've added more space for the firmware to place data, tell it. |
272 | * Increment device's write pointer in multiples of 8. */ | 249 | * Increment device's write pointer in multiples of 8. */ |
@@ -278,44 +255,6 @@ static void iwl_pcie_rxq_restock(struct iwl_trans *trans) | |||
278 | } | 255 | } |
279 | 256 | ||
280 | /* | 257 | /* |
281 | * iwl_pcie_rx_alloc_page - allocates and returns a page. | ||
282 | * | ||
283 | */ | ||
284 | static struct page *iwl_pcie_rx_alloc_page(struct iwl_trans *trans) | ||
285 | { | ||
286 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
287 | struct iwl_rxq *rxq = &trans_pcie->rxq; | ||
288 | struct page *page; | ||
289 | gfp_t gfp_mask = GFP_KERNEL; | ||
290 | |||
291 | if (rxq->free_count > RX_LOW_WATERMARK) | ||
292 | gfp_mask |= __GFP_NOWARN; | ||
293 | |||
294 | if (trans_pcie->rx_page_order > 0) | ||
295 | gfp_mask |= __GFP_COMP; | ||
296 | |||
297 | /* Alloc a new receive buffer */ | ||
298 | page = alloc_pages(gfp_mask, trans_pcie->rx_page_order); | ||
299 | if (!page) { | ||
300 | if (net_ratelimit()) | ||
301 | IWL_DEBUG_INFO(trans, "alloc_pages failed, order: %d\n", | ||
302 | trans_pcie->rx_page_order); | ||
303 | /* Issue an error if the hardware has consumed more than half | ||
304 | * of its free buffer list and we don't have enough | ||
305 | * pre-allocated buffers. | ||
306 | ` */ | ||
307 | if (rxq->free_count <= RX_LOW_WATERMARK && | ||
308 | iwl_rxq_space(rxq) > (RX_QUEUE_SIZE / 2) && | ||
309 | net_ratelimit()) | ||
310 | IWL_CRIT(trans, | ||
311 | "Failed to alloc_pages with GFP_KERNEL. Only %u free buffers remaining.\n", | ||
312 | rxq->free_count); | ||
313 | return NULL; | ||
314 | } | ||
315 | return page; | ||
316 | } | ||
317 | |||
318 | /* | ||
319 | * iwl_pcie_rxq_alloc_rbs - allocate a page for each used RBD | 258 | * iwl_pcie_rxq_alloc_rbs - allocate a page for each used RBD |
320 | * | 259 | * |
321 | * A used RBD is an Rx buffer that has been given to the stack. To use it again | 260 | * A used RBD is an Rx buffer that has been given to the stack. To use it again |
@@ -324,12 +263,13 @@ static struct page *iwl_pcie_rx_alloc_page(struct iwl_trans *trans) | |||
324 | * iwl_pcie_rxq_restock. The latter function will update the HW to use the newly | 263 | * iwl_pcie_rxq_restock. The latter function will update the HW to use the newly |
325 | * allocated buffers. | 264 | * allocated buffers. |
326 | */ | 265 | */ |
327 | static void iwl_pcie_rxq_alloc_rbs(struct iwl_trans *trans) | 266 | static void iwl_pcie_rxq_alloc_rbs(struct iwl_trans *trans, gfp_t priority) |
328 | { | 267 | { |
329 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 268 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
330 | struct iwl_rxq *rxq = &trans_pcie->rxq; | 269 | struct iwl_rxq *rxq = &trans_pcie->rxq; |
331 | struct iwl_rx_mem_buffer *rxb; | 270 | struct iwl_rx_mem_buffer *rxb; |
332 | struct page *page; | 271 | struct page *page; |
272 | gfp_t gfp_mask = priority; | ||
333 | 273 | ||
334 | while (1) { | 274 | while (1) { |
335 | spin_lock(&rxq->lock); | 275 | spin_lock(&rxq->lock); |
@@ -339,10 +279,32 @@ static void iwl_pcie_rxq_alloc_rbs(struct iwl_trans *trans) | |||
339 | } | 279 | } |
340 | spin_unlock(&rxq->lock); | 280 | spin_unlock(&rxq->lock); |
341 | 281 | ||
282 | if (rxq->free_count > RX_LOW_WATERMARK) | ||
283 | gfp_mask |= __GFP_NOWARN; | ||
284 | |||
285 | if (trans_pcie->rx_page_order > 0) | ||
286 | gfp_mask |= __GFP_COMP; | ||
287 | |||
342 | /* Alloc a new receive buffer */ | 288 | /* Alloc a new receive buffer */ |
343 | page = iwl_pcie_rx_alloc_page(trans); | 289 | page = alloc_pages(gfp_mask, trans_pcie->rx_page_order); |
344 | if (!page) | 290 | if (!page) { |
291 | if (net_ratelimit()) | ||
292 | IWL_DEBUG_INFO(trans, "alloc_pages failed, " | ||
293 | "order: %d\n", | ||
294 | trans_pcie->rx_page_order); | ||
295 | |||
296 | if ((rxq->free_count <= RX_LOW_WATERMARK) && | ||
297 | net_ratelimit()) | ||
298 | IWL_CRIT(trans, "Failed to alloc_pages with %s." | ||
299 | "Only %u free buffers remaining.\n", | ||
300 | priority == GFP_ATOMIC ? | ||
301 | "GFP_ATOMIC" : "GFP_KERNEL", | ||
302 | rxq->free_count); | ||
303 | /* We don't reschedule replenish work here -- we will | ||
304 | * call the restock method and if it still needs | ||
305 | * more buffers it will schedule replenish */ | ||
345 | return; | 306 | return; |
307 | } | ||
346 | 308 | ||
347 | spin_lock(&rxq->lock); | 309 | spin_lock(&rxq->lock); |
348 | 310 | ||
@@ -393,7 +355,7 @@ static void iwl_pcie_rxq_free_rbs(struct iwl_trans *trans) | |||
393 | 355 | ||
394 | lockdep_assert_held(&rxq->lock); | 356 | lockdep_assert_held(&rxq->lock); |
395 | 357 | ||
396 | for (i = 0; i < RX_QUEUE_SIZE; i++) { | 358 | for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) { |
397 | if (!rxq->pool[i].page) | 359 | if (!rxq->pool[i].page) |
398 | continue; | 360 | continue; |
399 | dma_unmap_page(trans->dev, rxq->pool[i].page_dma, | 361 | dma_unmap_page(trans->dev, rxq->pool[i].page_dma, |
@@ -410,144 +372,32 @@ static void iwl_pcie_rxq_free_rbs(struct iwl_trans *trans) | |||
410 | * When moving to rx_free an page is allocated for the slot. | 372 | * When moving to rx_free an page is allocated for the slot. |
411 | * | 373 | * |
412 | * Also restock the Rx queue via iwl_pcie_rxq_restock. | 374 | * Also restock the Rx queue via iwl_pcie_rxq_restock. |
413 | * This is called only during initialization | 375 | * This is called as a scheduled work item (except for during initialization) |
414 | */ | 376 | */ |
415 | static void iwl_pcie_rx_replenish(struct iwl_trans *trans) | 377 | static void iwl_pcie_rx_replenish(struct iwl_trans *trans, gfp_t gfp) |
416 | { | 378 | { |
417 | iwl_pcie_rxq_alloc_rbs(trans); | 379 | iwl_pcie_rxq_alloc_rbs(trans, gfp); |
418 | 380 | ||
419 | iwl_pcie_rxq_restock(trans); | 381 | iwl_pcie_rxq_restock(trans); |
420 | } | 382 | } |
421 | 383 | ||
422 | /* | 384 | static void iwl_pcie_rx_replenish_work(struct work_struct *data) |
423 | * iwl_pcie_rx_allocator - Allocates pages in the background for RX queues | ||
424 | * | ||
425 | * Allocates for each received request 8 pages | ||
426 | * Called as a scheduled work item. | ||
427 | */ | ||
428 | static void iwl_pcie_rx_allocator(struct iwl_trans *trans) | ||
429 | { | ||
430 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
431 | struct iwl_rb_allocator *rba = &trans_pcie->rba; | ||
432 | |||
433 | while (atomic_read(&rba->req_pending)) { | ||
434 | int i; | ||
435 | struct list_head local_empty; | ||
436 | struct list_head local_allocated; | ||
437 | |||
438 | INIT_LIST_HEAD(&local_allocated); | ||
439 | spin_lock(&rba->lock); | ||
440 | /* swap out the entire rba->rbd_empty to a local list */ | ||
441 | list_replace_init(&rba->rbd_empty, &local_empty); | ||
442 | spin_unlock(&rba->lock); | ||
443 | |||
444 | for (i = 0; i < RX_CLAIM_REQ_ALLOC;) { | ||
445 | struct iwl_rx_mem_buffer *rxb; | ||
446 | struct page *page; | ||
447 | |||
448 | /* List should never be empty - each reused RBD is | ||
449 | * returned to the list, and initial pool covers any | ||
450 | * possible gap between the time the page is allocated | ||
451 | * to the time the RBD is added. | ||
452 | */ | ||
453 | BUG_ON(list_empty(&local_empty)); | ||
454 | /* Get the first rxb from the rbd list */ | ||
455 | rxb = list_first_entry(&local_empty, | ||
456 | struct iwl_rx_mem_buffer, list); | ||
457 | BUG_ON(rxb->page); | ||
458 | |||
459 | /* Alloc a new receive buffer */ | ||
460 | page = iwl_pcie_rx_alloc_page(trans); | ||
461 | if (!page) | ||
462 | continue; | ||
463 | rxb->page = page; | ||
464 | |||
465 | /* Get physical address of the RB */ | ||
466 | rxb->page_dma = dma_map_page(trans->dev, page, 0, | ||
467 | PAGE_SIZE << trans_pcie->rx_page_order, | ||
468 | DMA_FROM_DEVICE); | ||
469 | if (dma_mapping_error(trans->dev, rxb->page_dma)) { | ||
470 | rxb->page = NULL; | ||
471 | __free_pages(page, trans_pcie->rx_page_order); | ||
472 | continue; | ||
473 | } | ||
474 | /* dma address must be no more than 36 bits */ | ||
475 | BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36)); | ||
476 | /* and also 256 byte aligned! */ | ||
477 | BUG_ON(rxb->page_dma & DMA_BIT_MASK(8)); | ||
478 | |||
479 | /* move the allocated entry to the out list */ | ||
480 | list_move(&rxb->list, &local_allocated); | ||
481 | i++; | ||
482 | } | ||
483 | |||
484 | spin_lock(&rba->lock); | ||
485 | /* add the allocated rbds to the allocator allocated list */ | ||
486 | list_splice_tail(&local_allocated, &rba->rbd_allocated); | ||
487 | /* add the unused rbds back to the allocator empty list */ | ||
488 | list_splice_tail(&local_empty, &rba->rbd_empty); | ||
489 | spin_unlock(&rba->lock); | ||
490 | |||
491 | atomic_dec(&rba->req_pending); | ||
492 | atomic_inc(&rba->req_ready); | ||
493 | } | ||
494 | } | ||
495 | |||
496 | /* | ||
497 | * iwl_pcie_rx_allocator_get - Returns the pre-allocated pages | ||
498 | .* | ||
499 | .* Called by queue when the queue posted allocation request and | ||
500 | * has freed 8 RBDs in order to restock itself. | ||
501 | */ | ||
502 | static int iwl_pcie_rx_allocator_get(struct iwl_trans *trans, | ||
503 | struct iwl_rx_mem_buffer | ||
504 | *out[RX_CLAIM_REQ_ALLOC]) | ||
505 | { | ||
506 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
507 | struct iwl_rb_allocator *rba = &trans_pcie->rba; | ||
508 | int i; | ||
509 | |||
510 | if (atomic_dec_return(&rba->req_ready) < 0) { | ||
511 | atomic_inc(&rba->req_ready); | ||
512 | IWL_DEBUG_RX(trans, | ||
513 | "Allocation request not ready, pending requests = %d\n", | ||
514 | atomic_read(&rba->req_pending)); | ||
515 | return -ENOMEM; | ||
516 | } | ||
517 | |||
518 | spin_lock(&rba->lock); | ||
519 | for (i = 0; i < RX_CLAIM_REQ_ALLOC; i++) { | ||
520 | /* Get next free Rx buffer, remove it from free list */ | ||
521 | out[i] = list_first_entry(&rba->rbd_allocated, | ||
522 | struct iwl_rx_mem_buffer, list); | ||
523 | list_del(&out[i]->list); | ||
524 | } | ||
525 | spin_unlock(&rba->lock); | ||
526 | |||
527 | return 0; | ||
528 | } | ||
529 | |||
530 | static void iwl_pcie_rx_allocator_work(struct work_struct *data) | ||
531 | { | 385 | { |
532 | struct iwl_rb_allocator *rba_p = | ||
533 | container_of(data, struct iwl_rb_allocator, rx_alloc); | ||
534 | struct iwl_trans_pcie *trans_pcie = | 386 | struct iwl_trans_pcie *trans_pcie = |
535 | container_of(rba_p, struct iwl_trans_pcie, rba); | 387 | container_of(data, struct iwl_trans_pcie, rx_replenish); |
536 | 388 | ||
537 | iwl_pcie_rx_allocator(trans_pcie->trans); | 389 | iwl_pcie_rx_replenish(trans_pcie->trans, GFP_KERNEL); |
538 | } | 390 | } |
539 | 391 | ||
540 | static int iwl_pcie_rx_alloc(struct iwl_trans *trans) | 392 | static int iwl_pcie_rx_alloc(struct iwl_trans *trans) |
541 | { | 393 | { |
542 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 394 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
543 | struct iwl_rxq *rxq = &trans_pcie->rxq; | 395 | struct iwl_rxq *rxq = &trans_pcie->rxq; |
544 | struct iwl_rb_allocator *rba = &trans_pcie->rba; | ||
545 | struct device *dev = trans->dev; | 396 | struct device *dev = trans->dev; |
546 | 397 | ||
547 | memset(&trans_pcie->rxq, 0, sizeof(trans_pcie->rxq)); | 398 | memset(&trans_pcie->rxq, 0, sizeof(trans_pcie->rxq)); |
548 | 399 | ||
549 | spin_lock_init(&rxq->lock); | 400 | spin_lock_init(&rxq->lock); |
550 | spin_lock_init(&rba->lock); | ||
551 | 401 | ||
552 | if (WARN_ON(rxq->bd || rxq->rb_stts)) | 402 | if (WARN_ON(rxq->bd || rxq->rb_stts)) |
553 | return -EINVAL; | 403 | return -EINVAL; |
@@ -637,49 +487,15 @@ static void iwl_pcie_rx_init_rxb_lists(struct iwl_rxq *rxq) | |||
637 | INIT_LIST_HEAD(&rxq->rx_free); | 487 | INIT_LIST_HEAD(&rxq->rx_free); |
638 | INIT_LIST_HEAD(&rxq->rx_used); | 488 | INIT_LIST_HEAD(&rxq->rx_used); |
639 | rxq->free_count = 0; | 489 | rxq->free_count = 0; |
640 | rxq->used_count = 0; | ||
641 | 490 | ||
642 | for (i = 0; i < RX_QUEUE_SIZE; i++) | 491 | for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) |
643 | list_add(&rxq->pool[i].list, &rxq->rx_used); | 492 | list_add(&rxq->pool[i].list, &rxq->rx_used); |
644 | } | 493 | } |
645 | 494 | ||
646 | static void iwl_pcie_rx_init_rba(struct iwl_rb_allocator *rba) | ||
647 | { | ||
648 | int i; | ||
649 | |||
650 | lockdep_assert_held(&rba->lock); | ||
651 | |||
652 | INIT_LIST_HEAD(&rba->rbd_allocated); | ||
653 | INIT_LIST_HEAD(&rba->rbd_empty); | ||
654 | |||
655 | for (i = 0; i < RX_POOL_SIZE; i++) | ||
656 | list_add(&rba->pool[i].list, &rba->rbd_empty); | ||
657 | } | ||
658 | |||
659 | static void iwl_pcie_rx_free_rba(struct iwl_trans *trans) | ||
660 | { | ||
661 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
662 | struct iwl_rb_allocator *rba = &trans_pcie->rba; | ||
663 | int i; | ||
664 | |||
665 | lockdep_assert_held(&rba->lock); | ||
666 | |||
667 | for (i = 0; i < RX_POOL_SIZE; i++) { | ||
668 | if (!rba->pool[i].page) | ||
669 | continue; | ||
670 | dma_unmap_page(trans->dev, rba->pool[i].page_dma, | ||
671 | PAGE_SIZE << trans_pcie->rx_page_order, | ||
672 | DMA_FROM_DEVICE); | ||
673 | __free_pages(rba->pool[i].page, trans_pcie->rx_page_order); | ||
674 | rba->pool[i].page = NULL; | ||
675 | } | ||
676 | } | ||
677 | |||
678 | int iwl_pcie_rx_init(struct iwl_trans *trans) | 495 | int iwl_pcie_rx_init(struct iwl_trans *trans) |
679 | { | 496 | { |
680 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 497 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
681 | struct iwl_rxq *rxq = &trans_pcie->rxq; | 498 | struct iwl_rxq *rxq = &trans_pcie->rxq; |
682 | struct iwl_rb_allocator *rba = &trans_pcie->rba; | ||
683 | int i, err; | 499 | int i, err; |
684 | 500 | ||
685 | if (!rxq->bd) { | 501 | if (!rxq->bd) { |
@@ -687,21 +503,11 @@ int iwl_pcie_rx_init(struct iwl_trans *trans) | |||
687 | if (err) | 503 | if (err) |
688 | return err; | 504 | return err; |
689 | } | 505 | } |
690 | if (!rba->alloc_wq) | ||
691 | rba->alloc_wq = alloc_workqueue("rb_allocator", | ||
692 | WQ_HIGHPRI | WQ_UNBOUND, 1); | ||
693 | INIT_WORK(&rba->rx_alloc, iwl_pcie_rx_allocator_work); | ||
694 | |||
695 | spin_lock(&rba->lock); | ||
696 | atomic_set(&rba->req_pending, 0); | ||
697 | atomic_set(&rba->req_ready, 0); | ||
698 | /* free all first - we might be reconfigured for a different size */ | ||
699 | iwl_pcie_rx_free_rba(trans); | ||
700 | iwl_pcie_rx_init_rba(rba); | ||
701 | spin_unlock(&rba->lock); | ||
702 | 506 | ||
703 | spin_lock(&rxq->lock); | 507 | spin_lock(&rxq->lock); |
704 | 508 | ||
509 | INIT_WORK(&trans_pcie->rx_replenish, iwl_pcie_rx_replenish_work); | ||
510 | |||
705 | /* free all first - we might be reconfigured for a different size */ | 511 | /* free all first - we might be reconfigured for a different size */ |
706 | iwl_pcie_rxq_free_rbs(trans); | 512 | iwl_pcie_rxq_free_rbs(trans); |
707 | iwl_pcie_rx_init_rxb_lists(rxq); | 513 | iwl_pcie_rx_init_rxb_lists(rxq); |
@@ -716,7 +522,7 @@ int iwl_pcie_rx_init(struct iwl_trans *trans) | |||
716 | memset(rxq->rb_stts, 0, sizeof(*rxq->rb_stts)); | 522 | memset(rxq->rb_stts, 0, sizeof(*rxq->rb_stts)); |
717 | spin_unlock(&rxq->lock); | 523 | spin_unlock(&rxq->lock); |
718 | 524 | ||
719 | iwl_pcie_rx_replenish(trans); | 525 | iwl_pcie_rx_replenish(trans, GFP_KERNEL); |
720 | 526 | ||
721 | iwl_pcie_rx_hw_init(trans, rxq); | 527 | iwl_pcie_rx_hw_init(trans, rxq); |
722 | 528 | ||
@@ -731,7 +537,6 @@ void iwl_pcie_rx_free(struct iwl_trans *trans) | |||
731 | { | 537 | { |
732 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 538 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
733 | struct iwl_rxq *rxq = &trans_pcie->rxq; | 539 | struct iwl_rxq *rxq = &trans_pcie->rxq; |
734 | struct iwl_rb_allocator *rba = &trans_pcie->rba; | ||
735 | 540 | ||
736 | /*if rxq->bd is NULL, it means that nothing has been allocated, | 541 | /*if rxq->bd is NULL, it means that nothing has been allocated, |
737 | * exit now */ | 542 | * exit now */ |
@@ -740,15 +545,7 @@ void iwl_pcie_rx_free(struct iwl_trans *trans) | |||
740 | return; | 545 | return; |
741 | } | 546 | } |
742 | 547 | ||
743 | cancel_work_sync(&rba->rx_alloc); | 548 | cancel_work_sync(&trans_pcie->rx_replenish); |
744 | if (rba->alloc_wq) { | ||
745 | destroy_workqueue(rba->alloc_wq); | ||
746 | rba->alloc_wq = NULL; | ||
747 | } | ||
748 | |||
749 | spin_lock(&rba->lock); | ||
750 | iwl_pcie_rx_free_rba(trans); | ||
751 | spin_unlock(&rba->lock); | ||
752 | 549 | ||
753 | spin_lock(&rxq->lock); | 550 | spin_lock(&rxq->lock); |
754 | iwl_pcie_rxq_free_rbs(trans); | 551 | iwl_pcie_rxq_free_rbs(trans); |
@@ -769,43 +566,6 @@ void iwl_pcie_rx_free(struct iwl_trans *trans) | |||
769 | rxq->rb_stts = NULL; | 566 | rxq->rb_stts = NULL; |
770 | } | 567 | } |
771 | 568 | ||
772 | /* | ||
773 | * iwl_pcie_rx_reuse_rbd - Recycle used RBDs | ||
774 | * | ||
775 | * Called when a RBD can be reused. The RBD is transferred to the allocator. | ||
776 | * When there are 2 empty RBDs - a request for allocation is posted | ||
777 | */ | ||
778 | static void iwl_pcie_rx_reuse_rbd(struct iwl_trans *trans, | ||
779 | struct iwl_rx_mem_buffer *rxb, | ||
780 | struct iwl_rxq *rxq) | ||
781 | { | ||
782 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
783 | struct iwl_rb_allocator *rba = &trans_pcie->rba; | ||
784 | |||
785 | /* Count the used RBDs */ | ||
786 | rxq->used_count++; | ||
787 | |||
788 | /* Move the RBD to the used list, will be moved to allocator in batches | ||
789 | * before claiming or posting a request*/ | ||
790 | list_add_tail(&rxb->list, &rxq->rx_used); | ||
791 | |||
792 | /* If we have RX_POST_REQ_ALLOC new released rx buffers - | ||
793 | * issue a request for allocator. Modulo RX_CLAIM_REQ_ALLOC is | ||
794 | * used for the case we failed to claim RX_CLAIM_REQ_ALLOC, | ||
795 | * after but we still need to post another request. | ||
796 | */ | ||
797 | if ((rxq->used_count % RX_CLAIM_REQ_ALLOC) == RX_POST_REQ_ALLOC) { | ||
798 | /* Move the 2 RBDs to the allocator ownership. | ||
799 | Allocator has another 6 from pool for the request completion*/ | ||
800 | spin_lock(&rba->lock); | ||
801 | list_splice_tail_init(&rxq->rx_used, &rba->rbd_empty); | ||
802 | spin_unlock(&rba->lock); | ||
803 | |||
804 | atomic_inc(&rba->req_pending); | ||
805 | queue_work(rba->alloc_wq, &rba->rx_alloc); | ||
806 | } | ||
807 | } | ||
808 | |||
809 | static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans, | 569 | static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans, |
810 | struct iwl_rx_mem_buffer *rxb) | 570 | struct iwl_rx_mem_buffer *rxb) |
811 | { | 571 | { |
@@ -928,13 +688,13 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans, | |||
928 | */ | 688 | */ |
929 | __free_pages(rxb->page, trans_pcie->rx_page_order); | 689 | __free_pages(rxb->page, trans_pcie->rx_page_order); |
930 | rxb->page = NULL; | 690 | rxb->page = NULL; |
931 | iwl_pcie_rx_reuse_rbd(trans, rxb, rxq); | 691 | list_add_tail(&rxb->list, &rxq->rx_used); |
932 | } else { | 692 | } else { |
933 | list_add_tail(&rxb->list, &rxq->rx_free); | 693 | list_add_tail(&rxb->list, &rxq->rx_free); |
934 | rxq->free_count++; | 694 | rxq->free_count++; |
935 | } | 695 | } |
936 | } else | 696 | } else |
937 | iwl_pcie_rx_reuse_rbd(trans, rxb, rxq); | 697 | list_add_tail(&rxb->list, &rxq->rx_used); |
938 | } | 698 | } |
939 | 699 | ||
940 | /* | 700 | /* |
@@ -944,7 +704,10 @@ static void iwl_pcie_rx_handle(struct iwl_trans *trans) | |||
944 | { | 704 | { |
945 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 705 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
946 | struct iwl_rxq *rxq = &trans_pcie->rxq; | 706 | struct iwl_rxq *rxq = &trans_pcie->rxq; |
947 | u32 r, i, j; | 707 | u32 r, i; |
708 | u8 fill_rx = 0; | ||
709 | u32 count = 8; | ||
710 | int total_empty; | ||
948 | 711 | ||
949 | restart: | 712 | restart: |
950 | spin_lock(&rxq->lock); | 713 | spin_lock(&rxq->lock); |
@@ -957,6 +720,14 @@ restart: | |||
957 | if (i == r) | 720 | if (i == r) |
958 | IWL_DEBUG_RX(trans, "HW = SW = %d\n", r); | 721 | IWL_DEBUG_RX(trans, "HW = SW = %d\n", r); |
959 | 722 | ||
723 | /* calculate total frames need to be restock after handling RX */ | ||
724 | total_empty = r - rxq->write_actual; | ||
725 | if (total_empty < 0) | ||
726 | total_empty += RX_QUEUE_SIZE; | ||
727 | |||
728 | if (total_empty > (RX_QUEUE_SIZE / 2)) | ||
729 | fill_rx = 1; | ||
730 | |||
960 | while (i != r) { | 731 | while (i != r) { |
961 | struct iwl_rx_mem_buffer *rxb; | 732 | struct iwl_rx_mem_buffer *rxb; |
962 | 733 | ||
@@ -968,48 +739,29 @@ restart: | |||
968 | iwl_pcie_rx_handle_rb(trans, rxb); | 739 | iwl_pcie_rx_handle_rb(trans, rxb); |
969 | 740 | ||
970 | i = (i + 1) & RX_QUEUE_MASK; | 741 | i = (i + 1) & RX_QUEUE_MASK; |
971 | 742 | /* If there are a lot of unused frames, | |
972 | /* If we have RX_CLAIM_REQ_ALLOC released rx buffers - | 743 | * restock the Rx queue so ucode wont assert. */ |
973 | * try to claim the pre-allocated buffers from the allocator */ | 744 | if (fill_rx) { |
974 | if (rxq->used_count >= RX_CLAIM_REQ_ALLOC) { | 745 | count++; |
975 | struct iwl_rb_allocator *rba = &trans_pcie->rba; | 746 | if (count >= 8) { |
976 | struct iwl_rx_mem_buffer *out[RX_CLAIM_REQ_ALLOC]; | 747 | rxq->read = i; |
977 | 748 | spin_unlock(&rxq->lock); | |
978 | /* Add the remaining 6 empty RBDs for allocator use */ | 749 | iwl_pcie_rx_replenish(trans, GFP_ATOMIC); |
979 | spin_lock(&rba->lock); | 750 | count = 0; |
980 | list_splice_tail_init(&rxq->rx_used, &rba->rbd_empty); | 751 | goto restart; |
981 | spin_unlock(&rba->lock); | ||
982 | |||
983 | /* If not ready - continue, will try to reclaim later. | ||
984 | * No need to reschedule work - allocator exits only on | ||
985 | * success */ | ||
986 | if (!iwl_pcie_rx_allocator_get(trans, out)) { | ||
987 | /* If success - then RX_CLAIM_REQ_ALLOC | ||
988 | * buffers were retrieved and should be added | ||
989 | * to free list */ | ||
990 | rxq->used_count -= RX_CLAIM_REQ_ALLOC; | ||
991 | for (j = 0; j < RX_CLAIM_REQ_ALLOC; j++) { | ||
992 | list_add_tail(&out[j]->list, | ||
993 | &rxq->rx_free); | ||
994 | rxq->free_count++; | ||
995 | } | ||
996 | } | 752 | } |
997 | } | 753 | } |
998 | /* handle restock for two cases: | ||
999 | * - we just pulled buffers from the allocator | ||
1000 | * - we have 8+ unstolen pages accumulated */ | ||
1001 | if (rxq->free_count >= RX_CLAIM_REQ_ALLOC) { | ||
1002 | rxq->read = i; | ||
1003 | spin_unlock(&rxq->lock); | ||
1004 | iwl_pcie_rxq_restock(trans); | ||
1005 | goto restart; | ||
1006 | } | ||
1007 | } | 754 | } |
1008 | 755 | ||
1009 | /* Backtrack one entry */ | 756 | /* Backtrack one entry */ |
1010 | rxq->read = i; | 757 | rxq->read = i; |
1011 | spin_unlock(&rxq->lock); | 758 | spin_unlock(&rxq->lock); |
1012 | 759 | ||
760 | if (fill_rx) | ||
761 | iwl_pcie_rx_replenish(trans, GFP_ATOMIC); | ||
762 | else | ||
763 | iwl_pcie_rxq_restock(trans); | ||
764 | |||
1013 | if (trans_pcie->napi.poll) | 765 | if (trans_pcie->napi.poll) |
1014 | napi_gro_flush(&trans_pcie->napi, false); | 766 | napi_gro_flush(&trans_pcie->napi, false); |
1015 | } | 767 | } |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 43ae658af6ec..6203c4ad9bba 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -182,7 +182,7 @@ static void iwl_trans_pcie_write_shr(struct iwl_trans *trans, u32 reg, u32 val) | |||
182 | 182 | ||
183 | static void iwl_pcie_set_pwr(struct iwl_trans *trans, bool vaux) | 183 | static void iwl_pcie_set_pwr(struct iwl_trans *trans, bool vaux) |
184 | { | 184 | { |
185 | if (!trans->cfg->apmg_not_supported) | 185 | if (trans->cfg->apmg_not_supported) |
186 | return; | 186 | return; |
187 | 187 | ||
188 | if (vaux && pci_pme_capable(to_pci_dev(trans->dev), PCI_D3cold)) | 188 | if (vaux && pci_pme_capable(to_pci_dev(trans->dev), PCI_D3cold)) |
@@ -2459,7 +2459,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
2459 | struct iwl_trans_pcie *trans_pcie; | 2459 | struct iwl_trans_pcie *trans_pcie; |
2460 | struct iwl_trans *trans; | 2460 | struct iwl_trans *trans; |
2461 | u16 pci_cmd; | 2461 | u16 pci_cmd; |
2462 | int err; | 2462 | int ret; |
2463 | 2463 | ||
2464 | trans = iwl_trans_alloc(sizeof(struct iwl_trans_pcie), | 2464 | trans = iwl_trans_alloc(sizeof(struct iwl_trans_pcie), |
2465 | &pdev->dev, cfg, &trans_ops_pcie, 0); | 2465 | &pdev->dev, cfg, &trans_ops_pcie, 0); |
@@ -2474,8 +2474,8 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
2474 | spin_lock_init(&trans_pcie->ref_lock); | 2474 | spin_lock_init(&trans_pcie->ref_lock); |
2475 | init_waitqueue_head(&trans_pcie->ucode_write_waitq); | 2475 | init_waitqueue_head(&trans_pcie->ucode_write_waitq); |
2476 | 2476 | ||
2477 | err = pci_enable_device(pdev); | 2477 | ret = pci_enable_device(pdev); |
2478 | if (err) | 2478 | if (ret) |
2479 | goto out_no_pci; | 2479 | goto out_no_pci; |
2480 | 2480 | ||
2481 | if (!cfg->base_params->pcie_l1_allowed) { | 2481 | if (!cfg->base_params->pcie_l1_allowed) { |
@@ -2491,23 +2491,23 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
2491 | 2491 | ||
2492 | pci_set_master(pdev); | 2492 | pci_set_master(pdev); |
2493 | 2493 | ||
2494 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(36)); | 2494 | ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(36)); |
2495 | if (!err) | 2495 | if (!ret) |
2496 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(36)); | 2496 | ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(36)); |
2497 | if (err) { | 2497 | if (ret) { |
2498 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | 2498 | ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); |
2499 | if (!err) | 2499 | if (!ret) |
2500 | err = pci_set_consistent_dma_mask(pdev, | 2500 | ret = pci_set_consistent_dma_mask(pdev, |
2501 | DMA_BIT_MASK(32)); | 2501 | DMA_BIT_MASK(32)); |
2502 | /* both attempts failed: */ | 2502 | /* both attempts failed: */ |
2503 | if (err) { | 2503 | if (ret) { |
2504 | dev_err(&pdev->dev, "No suitable DMA available\n"); | 2504 | dev_err(&pdev->dev, "No suitable DMA available\n"); |
2505 | goto out_pci_disable_device; | 2505 | goto out_pci_disable_device; |
2506 | } | 2506 | } |
2507 | } | 2507 | } |
2508 | 2508 | ||
2509 | err = pci_request_regions(pdev, DRV_NAME); | 2509 | ret = pci_request_regions(pdev, DRV_NAME); |
2510 | if (err) { | 2510 | if (ret) { |
2511 | dev_err(&pdev->dev, "pci_request_regions failed\n"); | 2511 | dev_err(&pdev->dev, "pci_request_regions failed\n"); |
2512 | goto out_pci_disable_device; | 2512 | goto out_pci_disable_device; |
2513 | } | 2513 | } |
@@ -2515,7 +2515,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
2515 | trans_pcie->hw_base = pci_ioremap_bar(pdev, 0); | 2515 | trans_pcie->hw_base = pci_ioremap_bar(pdev, 0); |
2516 | if (!trans_pcie->hw_base) { | 2516 | if (!trans_pcie->hw_base) { |
2517 | dev_err(&pdev->dev, "pci_ioremap_bar failed\n"); | 2517 | dev_err(&pdev->dev, "pci_ioremap_bar failed\n"); |
2518 | err = -ENODEV; | 2518 | ret = -ENODEV; |
2519 | goto out_pci_release_regions; | 2519 | goto out_pci_release_regions; |
2520 | } | 2520 | } |
2521 | 2521 | ||
@@ -2527,9 +2527,9 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
2527 | trans_pcie->pci_dev = pdev; | 2527 | trans_pcie->pci_dev = pdev; |
2528 | iwl_disable_interrupts(trans); | 2528 | iwl_disable_interrupts(trans); |
2529 | 2529 | ||
2530 | err = pci_enable_msi(pdev); | 2530 | ret = pci_enable_msi(pdev); |
2531 | if (err) { | 2531 | if (ret) { |
2532 | dev_err(&pdev->dev, "pci_enable_msi failed(0X%x)\n", err); | 2532 | dev_err(&pdev->dev, "pci_enable_msi failed(0X%x)\n", ret); |
2533 | /* enable rfkill interrupt: hw bug w/a */ | 2533 | /* enable rfkill interrupt: hw bug w/a */ |
2534 | pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd); | 2534 | pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd); |
2535 | if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { | 2535 | if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { |
@@ -2547,11 +2547,16 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
2547 | */ | 2547 | */ |
2548 | if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) { | 2548 | if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) { |
2549 | unsigned long flags; | 2549 | unsigned long flags; |
2550 | int ret; | ||
2551 | 2550 | ||
2552 | trans->hw_rev = (trans->hw_rev & 0xfff0) | | 2551 | trans->hw_rev = (trans->hw_rev & 0xfff0) | |
2553 | (CSR_HW_REV_STEP(trans->hw_rev << 2) << 2); | 2552 | (CSR_HW_REV_STEP(trans->hw_rev << 2) << 2); |
2554 | 2553 | ||
2554 | ret = iwl_pcie_prepare_card_hw(trans); | ||
2555 | if (ret) { | ||
2556 | IWL_WARN(trans, "Exit HW not ready\n"); | ||
2557 | goto out_pci_disable_msi; | ||
2558 | } | ||
2559 | |||
2555 | /* | 2560 | /* |
2556 | * in-order to recognize C step driver should read chip version | 2561 | * in-order to recognize C step driver should read chip version |
2557 | * id located at the AUX bus MISC address space. | 2562 | * id located at the AUX bus MISC address space. |
@@ -2591,13 +2596,14 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
2591 | /* Initialize the wait queue for commands */ | 2596 | /* Initialize the wait queue for commands */ |
2592 | init_waitqueue_head(&trans_pcie->wait_command_queue); | 2597 | init_waitqueue_head(&trans_pcie->wait_command_queue); |
2593 | 2598 | ||
2594 | if (iwl_pcie_alloc_ict(trans)) | 2599 | ret = iwl_pcie_alloc_ict(trans); |
2600 | if (ret) | ||
2595 | goto out_pci_disable_msi; | 2601 | goto out_pci_disable_msi; |
2596 | 2602 | ||
2597 | err = request_threaded_irq(pdev->irq, iwl_pcie_isr, | 2603 | ret = request_threaded_irq(pdev->irq, iwl_pcie_isr, |
2598 | iwl_pcie_irq_handler, | 2604 | iwl_pcie_irq_handler, |
2599 | IRQF_SHARED, DRV_NAME, trans); | 2605 | IRQF_SHARED, DRV_NAME, trans); |
2600 | if (err) { | 2606 | if (ret) { |
2601 | IWL_ERR(trans, "Error allocating IRQ %d\n", pdev->irq); | 2607 | IWL_ERR(trans, "Error allocating IRQ %d\n", pdev->irq); |
2602 | goto out_free_ict; | 2608 | goto out_free_ict; |
2603 | } | 2609 | } |
@@ -2617,5 +2623,5 @@ out_pci_disable_device: | |||
2617 | pci_disable_device(pdev); | 2623 | pci_disable_device(pdev); |
2618 | out_no_pci: | 2624 | out_no_pci: |
2619 | iwl_trans_free(trans); | 2625 | iwl_trans_free(trans); |
2620 | return ERR_PTR(err); | 2626 | return ERR_PTR(ret); |
2621 | } | 2627 | } |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 880d0d63e872..7d50711476fe 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
@@ -1566,13 +1566,13 @@ static inline void xenvif_tx_dealloc_action(struct xenvif_queue *queue) | |||
1566 | smp_rmb(); | 1566 | smp_rmb(); |
1567 | 1567 | ||
1568 | while (dc != dp) { | 1568 | while (dc != dp) { |
1569 | BUG_ON(gop - queue->tx_unmap_ops > MAX_PENDING_REQS); | 1569 | BUG_ON(gop - queue->tx_unmap_ops >= MAX_PENDING_REQS); |
1570 | pending_idx = | 1570 | pending_idx = |
1571 | queue->dealloc_ring[pending_index(dc++)]; | 1571 | queue->dealloc_ring[pending_index(dc++)]; |
1572 | 1572 | ||
1573 | pending_idx_release[gop-queue->tx_unmap_ops] = | 1573 | pending_idx_release[gop - queue->tx_unmap_ops] = |
1574 | pending_idx; | 1574 | pending_idx; |
1575 | queue->pages_to_unmap[gop-queue->tx_unmap_ops] = | 1575 | queue->pages_to_unmap[gop - queue->tx_unmap_ops] = |
1576 | queue->mmap_pages[pending_idx]; | 1576 | queue->mmap_pages[pending_idx]; |
1577 | gnttab_set_unmap_op(gop, | 1577 | gnttab_set_unmap_op(gop, |
1578 | idx_to_kaddr(queue, pending_idx), | 1578 | idx_to_kaddr(queue, pending_idx), |
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index 8eb22c0ca7ce..7e2c43f701bc 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c | |||
@@ -535,8 +535,6 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm, | |||
535 | __func__, dimm_name, cmd_name, i); | 535 | __func__, dimm_name, cmd_name, i); |
536 | return -ENXIO; | 536 | return -ENXIO; |
537 | } | 537 | } |
538 | if (!access_ok(VERIFY_READ, p + in_len, in_size)) | ||
539 | return -EFAULT; | ||
540 | if (in_len < sizeof(in_env)) | 538 | if (in_len < sizeof(in_env)) |
541 | copy = min_t(u32, sizeof(in_env) - in_len, in_size); | 539 | copy = min_t(u32, sizeof(in_env) - in_len, in_size); |
542 | else | 540 | else |
@@ -557,8 +555,6 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm, | |||
557 | __func__, dimm_name, cmd_name, i); | 555 | __func__, dimm_name, cmd_name, i); |
558 | return -EFAULT; | 556 | return -EFAULT; |
559 | } | 557 | } |
560 | if (!access_ok(VERIFY_WRITE, p + in_len + out_len, out_size)) | ||
561 | return -EFAULT; | ||
562 | if (out_len < sizeof(out_env)) | 558 | if (out_len < sizeof(out_env)) |
563 | copy = min_t(u32, sizeof(out_env) - out_len, out_size); | 559 | copy = min_t(u32, sizeof(out_env) - out_len, out_size); |
564 | else | 560 | else |
@@ -570,9 +566,6 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm, | |||
570 | } | 566 | } |
571 | 567 | ||
572 | buf_len = out_len + in_len; | 568 | buf_len = out_len + in_len; |
573 | if (!access_ok(VERIFY_WRITE, p, sizeof(buf_len))) | ||
574 | return -EFAULT; | ||
575 | |||
576 | if (buf_len > ND_IOCTL_MAX_BUFLEN) { | 569 | if (buf_len > ND_IOCTL_MAX_BUFLEN) { |
577 | dev_dbg(dev, "%s:%s cmd: %s buf_len: %zu > %d\n", __func__, | 570 | dev_dbg(dev, "%s:%s cmd: %s buf_len: %zu > %d\n", __func__, |
578 | dimm_name, cmd_name, buf_len, | 571 | dimm_name, cmd_name, buf_len, |
@@ -706,8 +699,10 @@ int __init nvdimm_bus_init(void) | |||
706 | nvdimm_major = rc; | 699 | nvdimm_major = rc; |
707 | 700 | ||
708 | nd_class = class_create(THIS_MODULE, "nd"); | 701 | nd_class = class_create(THIS_MODULE, "nd"); |
709 | if (IS_ERR(nd_class)) | 702 | if (IS_ERR(nd_class)) { |
703 | rc = PTR_ERR(nd_class); | ||
710 | goto err_class; | 704 | goto err_class; |
705 | } | ||
711 | 706 | ||
712 | return 0; | 707 | return 0; |
713 | 708 | ||
diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index a5233422f9dc..7384455792bf 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c | |||
@@ -458,10 +458,15 @@ static void nd_region_notify_driver_action(struct nvdimm_bus *nvdimm_bus, | |||
458 | nvdimm_bus_unlock(dev); | 458 | nvdimm_bus_unlock(dev); |
459 | } | 459 | } |
460 | if (is_nd_btt(dev) && probe) { | 460 | if (is_nd_btt(dev) && probe) { |
461 | struct nd_btt *nd_btt = to_nd_btt(dev); | ||
462 | |||
461 | nd_region = to_nd_region(dev->parent); | 463 | nd_region = to_nd_region(dev->parent); |
462 | nvdimm_bus_lock(dev); | 464 | nvdimm_bus_lock(dev); |
463 | if (nd_region->btt_seed == dev) | 465 | if (nd_region->btt_seed == dev) |
464 | nd_region_create_btt_seed(nd_region); | 466 | nd_region_create_btt_seed(nd_region); |
467 | if (nd_region->ns_seed == &nd_btt->ndns->dev && | ||
468 | is_nd_blk(dev->parent)) | ||
469 | nd_region_create_blk_seed(nd_region); | ||
465 | nvdimm_bus_unlock(dev); | 470 | nvdimm_bus_unlock(dev); |
466 | } | 471 | } |
467 | } | 472 | } |
diff --git a/drivers/parport/share.c b/drivers/parport/share.c index 8067f54ce050..5ce5ef211bdb 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c | |||
@@ -891,8 +891,10 @@ parport_register_dev_model(struct parport *port, const char *name, | |||
891 | par_dev->dev.release = free_pardevice; | 891 | par_dev->dev.release = free_pardevice; |
892 | par_dev->devmodel = true; | 892 | par_dev->devmodel = true; |
893 | ret = device_register(&par_dev->dev); | 893 | ret = device_register(&par_dev->dev); |
894 | if (ret) | 894 | if (ret) { |
895 | goto err_put_dev; | 895 | put_device(&par_dev->dev); |
896 | goto err_put_port; | ||
897 | } | ||
896 | 898 | ||
897 | /* Chain this onto the list */ | 899 | /* Chain this onto the list */ |
898 | par_dev->prev = NULL; | 900 | par_dev->prev = NULL; |
@@ -907,7 +909,8 @@ parport_register_dev_model(struct parport *port, const char *name, | |||
907 | spin_unlock(&port->physport->pardevice_lock); | 909 | spin_unlock(&port->physport->pardevice_lock); |
908 | pr_debug("%s: cannot grant exclusive access for device %s\n", | 910 | pr_debug("%s: cannot grant exclusive access for device %s\n", |
909 | port->name, name); | 911 | port->name, name); |
910 | goto err_put_dev; | 912 | device_unregister(&par_dev->dev); |
913 | goto err_put_port; | ||
911 | } | 914 | } |
912 | port->flags |= PARPORT_FLAG_EXCL; | 915 | port->flags |= PARPORT_FLAG_EXCL; |
913 | } | 916 | } |
@@ -938,8 +941,6 @@ parport_register_dev_model(struct parport *port, const char *name, | |||
938 | 941 | ||
939 | return par_dev; | 942 | return par_dev; |
940 | 943 | ||
941 | err_put_dev: | ||
942 | put_device(&par_dev->dev); | ||
943 | err_free_devname: | 944 | err_free_devname: |
944 | kfree(devname); | 945 | kfree(devname); |
945 | err_free_par_dev: | 946 | err_free_par_dev: |
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index c0e6ede3e27d..6b8dd162f644 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
@@ -56,6 +56,7 @@ config PHY_EXYNOS_MIPI_VIDEO | |||
56 | 56 | ||
57 | config PHY_PXA_28NM_HSIC | 57 | config PHY_PXA_28NM_HSIC |
58 | tristate "Marvell USB HSIC 28nm PHY Driver" | 58 | tristate "Marvell USB HSIC 28nm PHY Driver" |
59 | depends on HAS_IOMEM | ||
59 | select GENERIC_PHY | 60 | select GENERIC_PHY |
60 | help | 61 | help |
61 | Enable this to support Marvell USB HSIC PHY driver for Marvell | 62 | Enable this to support Marvell USB HSIC PHY driver for Marvell |
@@ -66,6 +67,7 @@ config PHY_PXA_28NM_HSIC | |||
66 | 67 | ||
67 | config PHY_PXA_28NM_USB2 | 68 | config PHY_PXA_28NM_USB2 |
68 | tristate "Marvell USB 2.0 28nm PHY Driver" | 69 | tristate "Marvell USB 2.0 28nm PHY Driver" |
70 | depends on HAS_IOMEM | ||
69 | select GENERIC_PHY | 71 | select GENERIC_PHY |
70 | help | 72 | help |
71 | Enable this to support Marvell USB 2.0 PHY driver for Marvell | 73 | Enable this to support Marvell USB 2.0 PHY driver for Marvell |
diff --git a/drivers/phy/phy-berlin-usb.c b/drivers/phy/phy-berlin-usb.c index c6fc95b53083..335e06d66ed9 100644 --- a/drivers/phy/phy-berlin-usb.c +++ b/drivers/phy/phy-berlin-usb.c | |||
@@ -105,9 +105,9 @@ | |||
105 | 105 | ||
106 | static const u32 phy_berlin_pll_dividers[] = { | 106 | static const u32 phy_berlin_pll_dividers[] = { |
107 | /* Berlin 2 */ | 107 | /* Berlin 2 */ |
108 | CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54), | ||
109 | /* Berlin 2CD */ | ||
110 | CLK_REF_DIV(0x6) | FEEDBACK_CLK_DIV(0x55), | 108 | CLK_REF_DIV(0x6) | FEEDBACK_CLK_DIV(0x55), |
109 | /* Berlin 2CD/Q */ | ||
110 | CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54), | ||
111 | }; | 111 | }; |
112 | 112 | ||
113 | struct phy_berlin_usb_priv { | 113 | struct phy_berlin_usb_priv { |
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index 53f295c1bab1..3510b81db3fa 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/phy/omap_control_phy.h> | 29 | #include <linux/phy/omap_control_phy.h> |
30 | #include <linux/of_platform.h> | 30 | #include <linux/of_platform.h> |
31 | #include <linux/spinlock.h> | ||
32 | 31 | ||
33 | #define PLL_STATUS 0x00000004 | 32 | #define PLL_STATUS 0x00000004 |
34 | #define PLL_GO 0x00000008 | 33 | #define PLL_GO 0x00000008 |
@@ -83,10 +82,6 @@ struct ti_pipe3 { | |||
83 | struct clk *refclk; | 82 | struct clk *refclk; |
84 | struct clk *div_clk; | 83 | struct clk *div_clk; |
85 | struct pipe3_dpll_map *dpll_map; | 84 | struct pipe3_dpll_map *dpll_map; |
86 | bool enabled; | ||
87 | spinlock_t lock; /* serialize clock enable/disable */ | ||
88 | /* the below flag is needed specifically for SATA */ | ||
89 | bool refclk_enabled; | ||
90 | }; | 85 | }; |
91 | 86 | ||
92 | static struct pipe3_dpll_map dpll_map_usb[] = { | 87 | static struct pipe3_dpll_map dpll_map_usb[] = { |
@@ -137,6 +132,9 @@ static struct pipe3_dpll_params *ti_pipe3_get_dpll_params(struct ti_pipe3 *phy) | |||
137 | return NULL; | 132 | return NULL; |
138 | } | 133 | } |
139 | 134 | ||
135 | static int ti_pipe3_enable_clocks(struct ti_pipe3 *phy); | ||
136 | static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy); | ||
137 | |||
140 | static int ti_pipe3_power_off(struct phy *x) | 138 | static int ti_pipe3_power_off(struct phy *x) |
141 | { | 139 | { |
142 | struct ti_pipe3 *phy = phy_get_drvdata(x); | 140 | struct ti_pipe3 *phy = phy_get_drvdata(x); |
@@ -217,6 +215,7 @@ static int ti_pipe3_init(struct phy *x) | |||
217 | u32 val; | 215 | u32 val; |
218 | int ret = 0; | 216 | int ret = 0; |
219 | 217 | ||
218 | ti_pipe3_enable_clocks(phy); | ||
220 | /* | 219 | /* |
221 | * Set pcie_pcs register to 0x96 for proper functioning of phy | 220 | * Set pcie_pcs register to 0x96 for proper functioning of phy |
222 | * as recommended in AM572x TRM SPRUHZ6, section 18.5.2.2, table | 221 | * as recommended in AM572x TRM SPRUHZ6, section 18.5.2.2, table |
@@ -250,33 +249,35 @@ static int ti_pipe3_exit(struct phy *x) | |||
250 | u32 val; | 249 | u32 val; |
251 | unsigned long timeout; | 250 | unsigned long timeout; |
252 | 251 | ||
253 | /* SATA DPLL can't be powered down due to Errata i783 and PCIe | 252 | /* SATA DPLL can't be powered down due to Errata i783 */ |
254 | * does not have internal DPLL | 253 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata")) |
255 | */ | ||
256 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata") || | ||
257 | of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) | ||
258 | return 0; | 254 | return 0; |
259 | 255 | ||
260 | /* Put DPLL in IDLE mode */ | 256 | /* PCIe doesn't have internal DPLL */ |
261 | val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION2); | 257 | if (!of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) { |
262 | val |= PLL_IDLE; | 258 | /* Put DPLL in IDLE mode */ |
263 | ti_pipe3_writel(phy->pll_ctrl_base, PLL_CONFIGURATION2, val); | 259 | val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION2); |
264 | 260 | val |= PLL_IDLE; | |
265 | /* wait for LDO and Oscillator to power down */ | 261 | ti_pipe3_writel(phy->pll_ctrl_base, PLL_CONFIGURATION2, val); |
266 | timeout = jiffies + msecs_to_jiffies(PLL_IDLE_TIME); | ||
267 | do { | ||
268 | cpu_relax(); | ||
269 | val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS); | ||
270 | if ((val & PLL_TICOPWDN) && (val & PLL_LDOPWDN)) | ||
271 | break; | ||
272 | } while (!time_after(jiffies, timeout)); | ||
273 | 262 | ||
274 | if (!(val & PLL_TICOPWDN) || !(val & PLL_LDOPWDN)) { | 263 | /* wait for LDO and Oscillator to power down */ |
275 | dev_err(phy->dev, "Failed to power down: PLL_STATUS 0x%x\n", | 264 | timeout = jiffies + msecs_to_jiffies(PLL_IDLE_TIME); |
276 | val); | 265 | do { |
277 | return -EBUSY; | 266 | cpu_relax(); |
267 | val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS); | ||
268 | if ((val & PLL_TICOPWDN) && (val & PLL_LDOPWDN)) | ||
269 | break; | ||
270 | } while (!time_after(jiffies, timeout)); | ||
271 | |||
272 | if (!(val & PLL_TICOPWDN) || !(val & PLL_LDOPWDN)) { | ||
273 | dev_err(phy->dev, "Failed to power down: PLL_STATUS 0x%x\n", | ||
274 | val); | ||
275 | return -EBUSY; | ||
276 | } | ||
278 | } | 277 | } |
279 | 278 | ||
279 | ti_pipe3_disable_clocks(phy); | ||
280 | |||
280 | return 0; | 281 | return 0; |
281 | } | 282 | } |
282 | static struct phy_ops ops = { | 283 | static struct phy_ops ops = { |
@@ -306,7 +307,6 @@ static int ti_pipe3_probe(struct platform_device *pdev) | |||
306 | return -ENOMEM; | 307 | return -ENOMEM; |
307 | 308 | ||
308 | phy->dev = &pdev->dev; | 309 | phy->dev = &pdev->dev; |
309 | spin_lock_init(&phy->lock); | ||
310 | 310 | ||
311 | if (!of_device_is_compatible(node, "ti,phy-pipe3-pcie")) { | 311 | if (!of_device_is_compatible(node, "ti,phy-pipe3-pcie")) { |
312 | match = of_match_device(ti_pipe3_id_table, &pdev->dev); | 312 | match = of_match_device(ti_pipe3_id_table, &pdev->dev); |
@@ -402,6 +402,10 @@ static int ti_pipe3_probe(struct platform_device *pdev) | |||
402 | 402 | ||
403 | platform_set_drvdata(pdev, phy); | 403 | platform_set_drvdata(pdev, phy); |
404 | pm_runtime_enable(phy->dev); | 404 | pm_runtime_enable(phy->dev); |
405 | /* Prevent auto-disable of refclk for SATA PHY due to Errata i783 */ | ||
406 | if (of_device_is_compatible(node, "ti,phy-pipe3-sata")) | ||
407 | if (!IS_ERR(phy->refclk)) | ||
408 | clk_prepare_enable(phy->refclk); | ||
405 | 409 | ||
406 | generic_phy = devm_phy_create(phy->dev, NULL, &ops); | 410 | generic_phy = devm_phy_create(phy->dev, NULL, &ops); |
407 | if (IS_ERR(generic_phy)) | 411 | if (IS_ERR(generic_phy)) |
@@ -413,63 +417,33 @@ static int ti_pipe3_probe(struct platform_device *pdev) | |||
413 | if (IS_ERR(phy_provider)) | 417 | if (IS_ERR(phy_provider)) |
414 | return PTR_ERR(phy_provider); | 418 | return PTR_ERR(phy_provider); |
415 | 419 | ||
416 | pm_runtime_get(&pdev->dev); | ||
417 | |||
418 | return 0; | 420 | return 0; |
419 | } | 421 | } |
420 | 422 | ||
421 | static int ti_pipe3_remove(struct platform_device *pdev) | 423 | static int ti_pipe3_remove(struct platform_device *pdev) |
422 | { | 424 | { |
423 | if (!pm_runtime_suspended(&pdev->dev)) | ||
424 | pm_runtime_put(&pdev->dev); | ||
425 | pm_runtime_disable(&pdev->dev); | 425 | pm_runtime_disable(&pdev->dev); |
426 | 426 | ||
427 | return 0; | 427 | return 0; |
428 | } | 428 | } |
429 | 429 | ||
430 | #ifdef CONFIG_PM | 430 | static int ti_pipe3_enable_clocks(struct ti_pipe3 *phy) |
431 | static int ti_pipe3_enable_refclk(struct ti_pipe3 *phy) | ||
432 | { | 431 | { |
433 | if (!IS_ERR(phy->refclk) && !phy->refclk_enabled) { | 432 | int ret = 0; |
434 | int ret; | ||
435 | 433 | ||
434 | if (!IS_ERR(phy->refclk)) { | ||
436 | ret = clk_prepare_enable(phy->refclk); | 435 | ret = clk_prepare_enable(phy->refclk); |
437 | if (ret) { | 436 | if (ret) { |
438 | dev_err(phy->dev, "Failed to enable refclk %d\n", ret); | 437 | dev_err(phy->dev, "Failed to enable refclk %d\n", ret); |
439 | return ret; | 438 | return ret; |
440 | } | 439 | } |
441 | phy->refclk_enabled = true; | ||
442 | } | 440 | } |
443 | 441 | ||
444 | return 0; | ||
445 | } | ||
446 | |||
447 | static void ti_pipe3_disable_refclk(struct ti_pipe3 *phy) | ||
448 | { | ||
449 | if (!IS_ERR(phy->refclk)) | ||
450 | clk_disable_unprepare(phy->refclk); | ||
451 | |||
452 | phy->refclk_enabled = false; | ||
453 | } | ||
454 | |||
455 | static int ti_pipe3_enable_clocks(struct ti_pipe3 *phy) | ||
456 | { | ||
457 | int ret = 0; | ||
458 | unsigned long flags; | ||
459 | |||
460 | spin_lock_irqsave(&phy->lock, flags); | ||
461 | if (phy->enabled) | ||
462 | goto err1; | ||
463 | |||
464 | ret = ti_pipe3_enable_refclk(phy); | ||
465 | if (ret) | ||
466 | goto err1; | ||
467 | |||
468 | if (!IS_ERR(phy->wkupclk)) { | 442 | if (!IS_ERR(phy->wkupclk)) { |
469 | ret = clk_prepare_enable(phy->wkupclk); | 443 | ret = clk_prepare_enable(phy->wkupclk); |
470 | if (ret) { | 444 | if (ret) { |
471 | dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret); | 445 | dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret); |
472 | goto err2; | 446 | goto disable_refclk; |
473 | } | 447 | } |
474 | } | 448 | } |
475 | 449 | ||
@@ -477,96 +451,33 @@ static int ti_pipe3_enable_clocks(struct ti_pipe3 *phy) | |||
477 | ret = clk_prepare_enable(phy->div_clk); | 451 | ret = clk_prepare_enable(phy->div_clk); |
478 | if (ret) { | 452 | if (ret) { |
479 | dev_err(phy->dev, "Failed to enable div_clk %d\n", ret); | 453 | dev_err(phy->dev, "Failed to enable div_clk %d\n", ret); |
480 | goto err3; | 454 | goto disable_wkupclk; |
481 | } | 455 | } |
482 | } | 456 | } |
483 | 457 | ||
484 | phy->enabled = true; | ||
485 | spin_unlock_irqrestore(&phy->lock, flags); | ||
486 | return 0; | 458 | return 0; |
487 | 459 | ||
488 | err3: | 460 | disable_wkupclk: |
489 | if (!IS_ERR(phy->wkupclk)) | 461 | if (!IS_ERR(phy->wkupclk)) |
490 | clk_disable_unprepare(phy->wkupclk); | 462 | clk_disable_unprepare(phy->wkupclk); |
491 | 463 | ||
492 | err2: | 464 | disable_refclk: |
493 | if (!IS_ERR(phy->refclk)) | 465 | if (!IS_ERR(phy->refclk)) |
494 | clk_disable_unprepare(phy->refclk); | 466 | clk_disable_unprepare(phy->refclk); |
495 | 467 | ||
496 | ti_pipe3_disable_refclk(phy); | ||
497 | err1: | ||
498 | spin_unlock_irqrestore(&phy->lock, flags); | ||
499 | return ret; | 468 | return ret; |
500 | } | 469 | } |
501 | 470 | ||
502 | static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy) | 471 | static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy) |
503 | { | 472 | { |
504 | unsigned long flags; | ||
505 | |||
506 | spin_lock_irqsave(&phy->lock, flags); | ||
507 | if (!phy->enabled) { | ||
508 | spin_unlock_irqrestore(&phy->lock, flags); | ||
509 | return; | ||
510 | } | ||
511 | |||
512 | if (!IS_ERR(phy->wkupclk)) | 473 | if (!IS_ERR(phy->wkupclk)) |
513 | clk_disable_unprepare(phy->wkupclk); | 474 | clk_disable_unprepare(phy->wkupclk); |
514 | /* Don't disable refclk for SATA PHY due to Errata i783 */ | 475 | if (!IS_ERR(phy->refclk)) |
515 | if (!of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata")) | 476 | clk_disable_unprepare(phy->refclk); |
516 | ti_pipe3_disable_refclk(phy); | ||
517 | if (!IS_ERR(phy->div_clk)) | 477 | if (!IS_ERR(phy->div_clk)) |
518 | clk_disable_unprepare(phy->div_clk); | 478 | clk_disable_unprepare(phy->div_clk); |
519 | phy->enabled = false; | ||
520 | spin_unlock_irqrestore(&phy->lock, flags); | ||
521 | } | ||
522 | |||
523 | static int ti_pipe3_runtime_suspend(struct device *dev) | ||
524 | { | ||
525 | struct ti_pipe3 *phy = dev_get_drvdata(dev); | ||
526 | |||
527 | ti_pipe3_disable_clocks(phy); | ||
528 | return 0; | ||
529 | } | 479 | } |
530 | 480 | ||
531 | static int ti_pipe3_runtime_resume(struct device *dev) | ||
532 | { | ||
533 | struct ti_pipe3 *phy = dev_get_drvdata(dev); | ||
534 | int ret = 0; | ||
535 | |||
536 | ret = ti_pipe3_enable_clocks(phy); | ||
537 | return ret; | ||
538 | } | ||
539 | |||
540 | static int ti_pipe3_suspend(struct device *dev) | ||
541 | { | ||
542 | struct ti_pipe3 *phy = dev_get_drvdata(dev); | ||
543 | |||
544 | ti_pipe3_disable_clocks(phy); | ||
545 | return 0; | ||
546 | } | ||
547 | |||
548 | static int ti_pipe3_resume(struct device *dev) | ||
549 | { | ||
550 | struct ti_pipe3 *phy = dev_get_drvdata(dev); | ||
551 | int ret; | ||
552 | |||
553 | ret = ti_pipe3_enable_clocks(phy); | ||
554 | if (ret) | ||
555 | return ret; | ||
556 | |||
557 | pm_runtime_disable(dev); | ||
558 | pm_runtime_set_active(dev); | ||
559 | pm_runtime_enable(dev); | ||
560 | return 0; | ||
561 | } | ||
562 | #endif | ||
563 | |||
564 | static const struct dev_pm_ops ti_pipe3_pm_ops = { | ||
565 | SET_RUNTIME_PM_OPS(ti_pipe3_runtime_suspend, | ||
566 | ti_pipe3_runtime_resume, NULL) | ||
567 | SET_SYSTEM_SLEEP_PM_OPS(ti_pipe3_suspend, ti_pipe3_resume) | ||
568 | }; | ||
569 | |||
570 | static const struct of_device_id ti_pipe3_id_table[] = { | 481 | static const struct of_device_id ti_pipe3_id_table[] = { |
571 | { | 482 | { |
572 | .compatible = "ti,phy-usb3", | 483 | .compatible = "ti,phy-usb3", |
@@ -592,7 +503,6 @@ static struct platform_driver ti_pipe3_driver = { | |||
592 | .remove = ti_pipe3_remove, | 503 | .remove = ti_pipe3_remove, |
593 | .driver = { | 504 | .driver = { |
594 | .name = "ti-pipe3", | 505 | .name = "ti-pipe3", |
595 | .pm = &ti_pipe3_pm_ops, | ||
596 | .of_match_table = ti_pipe3_id_table, | 506 | .of_match_table = ti_pipe3_id_table, |
597 | }, | 507 | }, |
598 | }; | 508 | }; |
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index efcf2a2b3975..6177315ab74e 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c | |||
@@ -473,6 +473,8 @@ static void bcm2835_gpio_irq_disable(struct irq_data *data) | |||
473 | 473 | ||
474 | spin_lock_irqsave(&pc->irq_lock[bank], flags); | 474 | spin_lock_irqsave(&pc->irq_lock[bank], flags); |
475 | bcm2835_gpio_irq_config(pc, gpio, false); | 475 | bcm2835_gpio_irq_config(pc, gpio, false); |
476 | /* Clear events that were latched prior to clearing event sources */ | ||
477 | bcm2835_gpio_set_bit(pc, GPEDS0, gpio); | ||
476 | clear_bit(offset, &pc->enabled_irq_map[bank]); | 478 | clear_bit(offset, &pc->enabled_irq_map[bank]); |
477 | spin_unlock_irqrestore(&pc->irq_lock[bank], flags); | 479 | spin_unlock_irqrestore(&pc->irq_lock[bank], flags); |
478 | } | 480 | } |
diff --git a/drivers/pinctrl/freescale/pinctrl-imx1-core.c b/drivers/pinctrl/freescale/pinctrl-imx1-core.c index 5fd4437cee15..88a7fac11bd4 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx1-core.c +++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c | |||
@@ -403,14 +403,13 @@ static int imx1_pinconf_set(struct pinctrl_dev *pctldev, | |||
403 | unsigned num_configs) | 403 | unsigned num_configs) |
404 | { | 404 | { |
405 | struct imx1_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev); | 405 | struct imx1_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev); |
406 | const struct imx1_pinctrl_soc_info *info = ipctl->info; | ||
407 | int i; | 406 | int i; |
408 | 407 | ||
409 | for (i = 0; i != num_configs; ++i) { | 408 | for (i = 0; i != num_configs; ++i) { |
410 | imx1_write_bit(ipctl, pin_id, configs[i] & 0x01, MX1_PUEN); | 409 | imx1_write_bit(ipctl, pin_id, configs[i] & 0x01, MX1_PUEN); |
411 | 410 | ||
412 | dev_dbg(ipctl->dev, "pinconf set pullup pin %s\n", | 411 | dev_dbg(ipctl->dev, "pinconf set pullup pin %s\n", |
413 | info->pins[pin_id].name); | 412 | pin_desc_get(pctldev, pin_id)->name); |
414 | } | 413 | } |
415 | 414 | ||
416 | return 0; | 415 | return 0; |
diff --git a/drivers/pinctrl/nomadik/pinctrl-abx500.c b/drivers/pinctrl/nomadik/pinctrl-abx500.c index 557d0f2a3031..97681fac082e 100644 --- a/drivers/pinctrl/nomadik/pinctrl-abx500.c +++ b/drivers/pinctrl/nomadik/pinctrl-abx500.c | |||
@@ -787,7 +787,6 @@ static const struct pinmux_ops abx500_pinmux_ops = { | |||
787 | .set_mux = abx500_pmx_set, | 787 | .set_mux = abx500_pmx_set, |
788 | .gpio_request_enable = abx500_gpio_request_enable, | 788 | .gpio_request_enable = abx500_gpio_request_enable, |
789 | .gpio_disable_free = abx500_gpio_disable_free, | 789 | .gpio_disable_free = abx500_gpio_disable_free, |
790 | .strict = true, | ||
791 | }; | 790 | }; |
792 | 791 | ||
793 | static int abx500_get_groups_cnt(struct pinctrl_dev *pctldev) | 792 | static int abx500_get_groups_cnt(struct pinctrl_dev *pctldev) |
diff --git a/drivers/pinctrl/pinctrl-lpc18xx.c b/drivers/pinctrl/pinctrl-lpc18xx.c index ef0b697639a7..347c763a6a78 100644 --- a/drivers/pinctrl/pinctrl-lpc18xx.c +++ b/drivers/pinctrl/pinctrl-lpc18xx.c | |||
@@ -823,7 +823,7 @@ static int lpc18xx_pconf_set_i2c0(struct pinctrl_dev *pctldev, | |||
823 | break; | 823 | break; |
824 | 824 | ||
825 | case PIN_CONFIG_INPUT_SCHMITT_ENABLE: | 825 | case PIN_CONFIG_INPUT_SCHMITT_ENABLE: |
826 | if (param) | 826 | if (param_val) |
827 | *reg &= ~(LPC18XX_SCU_I2C0_ZIF << shift); | 827 | *reg &= ~(LPC18XX_SCU_I2C0_ZIF << shift); |
828 | else | 828 | else |
829 | *reg |= (LPC18XX_SCU_I2C0_ZIF << shift); | 829 | *reg |= (LPC18XX_SCU_I2C0_ZIF << shift); |
@@ -876,7 +876,7 @@ static int lpc18xx_pconf_set_pin(struct pinctrl_dev *pctldev, | |||
876 | break; | 876 | break; |
877 | 877 | ||
878 | case PIN_CONFIG_INPUT_SCHMITT_ENABLE: | 878 | case PIN_CONFIG_INPUT_SCHMITT_ENABLE: |
879 | if (param) | 879 | if (param_val) |
880 | *reg &= ~LPC18XX_SCU_PIN_ZIF; | 880 | *reg &= ~LPC18XX_SCU_PIN_ZIF; |
881 | else | 881 | else |
882 | *reg |= LPC18XX_SCU_PIN_ZIF; | 882 | *reg |= LPC18XX_SCU_PIN_ZIF; |
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index b2de09d3b1a0..0b8d480171a3 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c | |||
@@ -1760,7 +1760,8 @@ static int pcs_irq_init_chained_handler(struct pcs_device *pcs, | |||
1760 | int res; | 1760 | int res; |
1761 | 1761 | ||
1762 | res = request_irq(pcs_soc->irq, pcs_irq_handler, | 1762 | res = request_irq(pcs_soc->irq, pcs_irq_handler, |
1763 | IRQF_SHARED | IRQF_NO_SUSPEND, | 1763 | IRQF_SHARED | IRQF_NO_SUSPEND | |
1764 | IRQF_NO_THREAD, | ||
1764 | name, pcs_soc); | 1765 | name, pcs_soc); |
1765 | if (res) { | 1766 | if (res) { |
1766 | pcs_soc->irq = -1; | 1767 | pcs_soc->irq = -1; |
diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index 3dd5a3b2ac62..c760bf43d116 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.c +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c | |||
@@ -33,11 +33,6 @@ | |||
33 | #include "../core.h" | 33 | #include "../core.h" |
34 | #include "pinctrl-samsung.h" | 34 | #include "pinctrl-samsung.h" |
35 | 35 | ||
36 | #define GROUP_SUFFIX "-grp" | ||
37 | #define GSUFFIX_LEN sizeof(GROUP_SUFFIX) | ||
38 | #define FUNCTION_SUFFIX "-mux" | ||
39 | #define FSUFFIX_LEN sizeof(FUNCTION_SUFFIX) | ||
40 | |||
41 | /* list of all possible config options supported */ | 36 | /* list of all possible config options supported */ |
42 | static struct pin_config { | 37 | static struct pin_config { |
43 | const char *property; | 38 | const char *property; |
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h index c7508d5f6886..0874cfee6889 100644 --- a/drivers/pinctrl/sh-pfc/sh_pfc.h +++ b/drivers/pinctrl/sh-pfc/sh_pfc.h | |||
@@ -224,7 +224,7 @@ struct sh_pfc_soc_info { | |||
224 | 224 | ||
225 | /* PINMUX_GPIO_GP_ALL - Expand to a list of sh_pfc_pin entries */ | 225 | /* PINMUX_GPIO_GP_ALL - Expand to a list of sh_pfc_pin entries */ |
226 | #define _GP_GPIO(bank, _pin, _name, sfx) \ | 226 | #define _GP_GPIO(bank, _pin, _name, sfx) \ |
227 | [(bank * 32) + _pin] = { \ | 227 | { \ |
228 | .pin = (bank * 32) + _pin, \ | 228 | .pin = (bank * 32) + _pin, \ |
229 | .name = __stringify(_name), \ | 229 | .name = __stringify(_name), \ |
230 | .enum_id = _name##_DATA, \ | 230 | .enum_id = _name##_DATA, \ |
diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c index f87a5eaf75da..0afaf79a4e51 100644 --- a/drivers/pinctrl/spear/pinctrl-spear.c +++ b/drivers/pinctrl/spear/pinctrl-spear.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Driver for the ST Microelectronics SPEAr pinmux | 2 | * Driver for the ST Microelectronics SPEAr pinmux |
3 | * | 3 | * |
4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
5 | * Viresh Kumar <viresh.linux@gmail.com> | 5 | * Viresh Kumar <vireshk@kernel.org> |
6 | * | 6 | * |
7 | * Inspired from: | 7 | * Inspired from: |
8 | * - U300 Pinctl drivers | 8 | * - U300 Pinctl drivers |
diff --git a/drivers/pinctrl/spear/pinctrl-spear.h b/drivers/pinctrl/spear/pinctrl-spear.h index dc8bf85ecb2a..27c2cc8d83ad 100644 --- a/drivers/pinctrl/spear/pinctrl-spear.h +++ b/drivers/pinctrl/spear/pinctrl-spear.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * Driver header file for the ST Microelectronics SPEAr pinmux | 2 | * Driver header file for the ST Microelectronics SPEAr pinmux |
3 | * | 3 | * |
4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
5 | * Viresh Kumar <viresh.linux@gmail.com> | 5 | * Viresh Kumar <vireshk@kernel.org> |
6 | * | 6 | * |
7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/pinctrl/spear/pinctrl-spear1310.c b/drivers/pinctrl/spear/pinctrl-spear1310.c index a7bdc537efa7..92611bb757ac 100644 --- a/drivers/pinctrl/spear/pinctrl-spear1310.c +++ b/drivers/pinctrl/spear/pinctrl-spear1310.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Driver for the ST Microelectronics SPEAr1310 pinmux | 2 | * Driver for the ST Microelectronics SPEAr1310 pinmux |
3 | * | 3 | * |
4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
5 | * Viresh Kumar <viresh.linux@gmail.com> | 5 | * Viresh Kumar <vireshk@kernel.org> |
6 | * | 6 | * |
7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
@@ -2730,7 +2730,7 @@ static void __exit spear1310_pinctrl_exit(void) | |||
2730 | } | 2730 | } |
2731 | module_exit(spear1310_pinctrl_exit); | 2731 | module_exit(spear1310_pinctrl_exit); |
2732 | 2732 | ||
2733 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); | 2733 | MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>"); |
2734 | MODULE_DESCRIPTION("ST Microelectronics SPEAr1310 pinctrl driver"); | 2734 | MODULE_DESCRIPTION("ST Microelectronics SPEAr1310 pinctrl driver"); |
2735 | MODULE_LICENSE("GPL v2"); | 2735 | MODULE_LICENSE("GPL v2"); |
2736 | MODULE_DEVICE_TABLE(of, spear1310_pinctrl_of_match); | 2736 | MODULE_DEVICE_TABLE(of, spear1310_pinctrl_of_match); |
diff --git a/drivers/pinctrl/spear/pinctrl-spear1340.c b/drivers/pinctrl/spear/pinctrl-spear1340.c index f43ec85a0328..f842e9dc40d0 100644 --- a/drivers/pinctrl/spear/pinctrl-spear1340.c +++ b/drivers/pinctrl/spear/pinctrl-spear1340.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Driver for the ST Microelectronics SPEAr1340 pinmux | 2 | * Driver for the ST Microelectronics SPEAr1340 pinmux |
3 | * | 3 | * |
4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
5 | * Viresh Kumar <viresh.linux@gmail.com> | 5 | * Viresh Kumar <vireshk@kernel.org> |
6 | * | 6 | * |
7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
@@ -2046,7 +2046,7 @@ static void __exit spear1340_pinctrl_exit(void) | |||
2046 | } | 2046 | } |
2047 | module_exit(spear1340_pinctrl_exit); | 2047 | module_exit(spear1340_pinctrl_exit); |
2048 | 2048 | ||
2049 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); | 2049 | MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>"); |
2050 | MODULE_DESCRIPTION("ST Microelectronics SPEAr1340 pinctrl driver"); | 2050 | MODULE_DESCRIPTION("ST Microelectronics SPEAr1340 pinctrl driver"); |
2051 | MODULE_LICENSE("GPL v2"); | 2051 | MODULE_LICENSE("GPL v2"); |
2052 | MODULE_DEVICE_TABLE(of, spear1340_pinctrl_of_match); | 2052 | MODULE_DEVICE_TABLE(of, spear1340_pinctrl_of_match); |
diff --git a/drivers/pinctrl/spear/pinctrl-spear300.c b/drivers/pinctrl/spear/pinctrl-spear300.c index da8990a8eeef..d998a2ccff48 100644 --- a/drivers/pinctrl/spear/pinctrl-spear300.c +++ b/drivers/pinctrl/spear/pinctrl-spear300.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Driver for the ST Microelectronics SPEAr300 pinmux | 2 | * Driver for the ST Microelectronics SPEAr300 pinmux |
3 | * | 3 | * |
4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
5 | * Viresh Kumar <viresh.linux@gmail.com> | 5 | * Viresh Kumar <vireshk@kernel.org> |
6 | * | 6 | * |
7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
@@ -703,7 +703,7 @@ static void __exit spear300_pinctrl_exit(void) | |||
703 | } | 703 | } |
704 | module_exit(spear300_pinctrl_exit); | 704 | module_exit(spear300_pinctrl_exit); |
705 | 705 | ||
706 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); | 706 | MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>"); |
707 | MODULE_DESCRIPTION("ST Microelectronics SPEAr300 pinctrl driver"); | 707 | MODULE_DESCRIPTION("ST Microelectronics SPEAr300 pinctrl driver"); |
708 | MODULE_LICENSE("GPL v2"); | 708 | MODULE_LICENSE("GPL v2"); |
709 | MODULE_DEVICE_TABLE(of, spear300_pinctrl_of_match); | 709 | MODULE_DEVICE_TABLE(of, spear300_pinctrl_of_match); |
diff --git a/drivers/pinctrl/spear/pinctrl-spear310.c b/drivers/pinctrl/spear/pinctrl-spear310.c index 31ede51e819b..609b18aceb16 100644 --- a/drivers/pinctrl/spear/pinctrl-spear310.c +++ b/drivers/pinctrl/spear/pinctrl-spear310.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Driver for the ST Microelectronics SPEAr310 pinmux | 2 | * Driver for the ST Microelectronics SPEAr310 pinmux |
3 | * | 3 | * |
4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
5 | * Viresh Kumar <viresh.linux@gmail.com> | 5 | * Viresh Kumar <vireshk@kernel.org> |
6 | * | 6 | * |
7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
@@ -426,7 +426,7 @@ static void __exit spear310_pinctrl_exit(void) | |||
426 | } | 426 | } |
427 | module_exit(spear310_pinctrl_exit); | 427 | module_exit(spear310_pinctrl_exit); |
428 | 428 | ||
429 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); | 429 | MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>"); |
430 | MODULE_DESCRIPTION("ST Microelectronics SPEAr310 pinctrl driver"); | 430 | MODULE_DESCRIPTION("ST Microelectronics SPEAr310 pinctrl driver"); |
431 | MODULE_LICENSE("GPL v2"); | 431 | MODULE_LICENSE("GPL v2"); |
432 | MODULE_DEVICE_TABLE(of, spear310_pinctrl_of_match); | 432 | MODULE_DEVICE_TABLE(of, spear310_pinctrl_of_match); |
diff --git a/drivers/pinctrl/spear/pinctrl-spear320.c b/drivers/pinctrl/spear/pinctrl-spear320.c index 506e40b641e0..c07114431bd4 100644 --- a/drivers/pinctrl/spear/pinctrl-spear320.c +++ b/drivers/pinctrl/spear/pinctrl-spear320.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Driver for the ST Microelectronics SPEAr320 pinmux | 2 | * Driver for the ST Microelectronics SPEAr320 pinmux |
3 | * | 3 | * |
4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
5 | * Viresh Kumar <viresh.linux@gmail.com> | 5 | * Viresh Kumar <vireshk@kernel.org> |
6 | * | 6 | * |
7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
@@ -3467,7 +3467,7 @@ static void __exit spear320_pinctrl_exit(void) | |||
3467 | } | 3467 | } |
3468 | module_exit(spear320_pinctrl_exit); | 3468 | module_exit(spear320_pinctrl_exit); |
3469 | 3469 | ||
3470 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); | 3470 | MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>"); |
3471 | MODULE_DESCRIPTION("ST Microelectronics SPEAr320 pinctrl driver"); | 3471 | MODULE_DESCRIPTION("ST Microelectronics SPEAr320 pinctrl driver"); |
3472 | MODULE_LICENSE("GPL v2"); | 3472 | MODULE_LICENSE("GPL v2"); |
3473 | MODULE_DEVICE_TABLE(of, spear320_pinctrl_of_match); | 3473 | MODULE_DEVICE_TABLE(of, spear320_pinctrl_of_match); |
diff --git a/drivers/pinctrl/spear/pinctrl-spear3xx.c b/drivers/pinctrl/spear/pinctrl-spear3xx.c index 12ee21af766b..d3119aafe709 100644 --- a/drivers/pinctrl/spear/pinctrl-spear3xx.c +++ b/drivers/pinctrl/spear/pinctrl-spear3xx.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Driver for the ST Microelectronics SPEAr3xx pinmux | 2 | * Driver for the ST Microelectronics SPEAr3xx pinmux |
3 | * | 3 | * |
4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
5 | * Viresh Kumar <viresh.linux@gmail.com> | 5 | * Viresh Kumar <vireshk@kernel.org> |
6 | * | 6 | * |
7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/pinctrl/spear/pinctrl-spear3xx.h b/drivers/pinctrl/spear/pinctrl-spear3xx.h index 7860b36053c4..ce19dcf8f08b 100644 --- a/drivers/pinctrl/spear/pinctrl-spear3xx.h +++ b/drivers/pinctrl/spear/pinctrl-spear3xx.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * Header file for the ST Microelectronics SPEAr3xx pinmux | 2 | * Header file for the ST Microelectronics SPEAr3xx pinmux |
3 | * | 3 | * |
4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
5 | * Viresh Kumar <viresh.linux@gmail.com> | 5 | * Viresh Kumar <vireshk@kernel.org> |
6 | * | 6 | * |
7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index ed317ccac4a2..aaeeae81e3a9 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c | |||
@@ -309,12 +309,15 @@ static const struct dmi_system_id dell_quirks[] __initconst = { | |||
309 | static struct calling_interface_buffer *buffer; | 309 | static struct calling_interface_buffer *buffer; |
310 | static DEFINE_MUTEX(buffer_mutex); | 310 | static DEFINE_MUTEX(buffer_mutex); |
311 | 311 | ||
312 | static int hwswitch_state; | 312 | static void clear_buffer(void) |
313 | { | ||
314 | memset(buffer, 0, sizeof(struct calling_interface_buffer)); | ||
315 | } | ||
313 | 316 | ||
314 | static void get_buffer(void) | 317 | static void get_buffer(void) |
315 | { | 318 | { |
316 | mutex_lock(&buffer_mutex); | 319 | mutex_lock(&buffer_mutex); |
317 | memset(buffer, 0, sizeof(struct calling_interface_buffer)); | 320 | clear_buffer(); |
318 | } | 321 | } |
319 | 322 | ||
320 | static void release_buffer(void) | 323 | static void release_buffer(void) |
@@ -548,21 +551,41 @@ static int dell_rfkill_set(void *data, bool blocked) | |||
548 | int disable = blocked ? 1 : 0; | 551 | int disable = blocked ? 1 : 0; |
549 | unsigned long radio = (unsigned long)data; | 552 | unsigned long radio = (unsigned long)data; |
550 | int hwswitch_bit = (unsigned long)data - 1; | 553 | int hwswitch_bit = (unsigned long)data - 1; |
554 | int hwswitch; | ||
555 | int status; | ||
556 | int ret; | ||
551 | 557 | ||
552 | get_buffer(); | 558 | get_buffer(); |
559 | |||
560 | dell_send_request(buffer, 17, 11); | ||
561 | ret = buffer->output[0]; | ||
562 | status = buffer->output[1]; | ||
563 | |||
564 | if (ret != 0) | ||
565 | goto out; | ||
566 | |||
567 | clear_buffer(); | ||
568 | |||
569 | buffer->input[0] = 0x2; | ||
553 | dell_send_request(buffer, 17, 11); | 570 | dell_send_request(buffer, 17, 11); |
571 | ret = buffer->output[0]; | ||
572 | hwswitch = buffer->output[1]; | ||
554 | 573 | ||
555 | /* If the hardware switch controls this radio, and the hardware | 574 | /* If the hardware switch controls this radio, and the hardware |
556 | switch is disabled, always disable the radio */ | 575 | switch is disabled, always disable the radio */ |
557 | if ((hwswitch_state & BIT(hwswitch_bit)) && | 576 | if (ret == 0 && (hwswitch & BIT(hwswitch_bit)) && |
558 | !(buffer->output[1] & BIT(16))) | 577 | (status & BIT(0)) && !(status & BIT(16))) |
559 | disable = 1; | 578 | disable = 1; |
560 | 579 | ||
580 | clear_buffer(); | ||
581 | |||
561 | buffer->input[0] = (1 | (radio<<8) | (disable << 16)); | 582 | buffer->input[0] = (1 | (radio<<8) | (disable << 16)); |
562 | dell_send_request(buffer, 17, 11); | 583 | dell_send_request(buffer, 17, 11); |
584 | ret = buffer->output[0]; | ||
563 | 585 | ||
586 | out: | ||
564 | release_buffer(); | 587 | release_buffer(); |
565 | return 0; | 588 | return dell_smi_error(ret); |
566 | } | 589 | } |
567 | 590 | ||
568 | /* Must be called with the buffer held */ | 591 | /* Must be called with the buffer held */ |
@@ -572,6 +595,7 @@ static void dell_rfkill_update_sw_state(struct rfkill *rfkill, int radio, | |||
572 | if (status & BIT(0)) { | 595 | if (status & BIT(0)) { |
573 | /* Has hw-switch, sync sw_state to BIOS */ | 596 | /* Has hw-switch, sync sw_state to BIOS */ |
574 | int block = rfkill_blocked(rfkill); | 597 | int block = rfkill_blocked(rfkill); |
598 | clear_buffer(); | ||
575 | buffer->input[0] = (1 | (radio << 8) | (block << 16)); | 599 | buffer->input[0] = (1 | (radio << 8) | (block << 16)); |
576 | dell_send_request(buffer, 17, 11); | 600 | dell_send_request(buffer, 17, 11); |
577 | } else { | 601 | } else { |
@@ -581,23 +605,43 @@ static void dell_rfkill_update_sw_state(struct rfkill *rfkill, int radio, | |||
581 | } | 605 | } |
582 | 606 | ||
583 | static void dell_rfkill_update_hw_state(struct rfkill *rfkill, int radio, | 607 | static void dell_rfkill_update_hw_state(struct rfkill *rfkill, int radio, |
584 | int status) | 608 | int status, int hwswitch) |
585 | { | 609 | { |
586 | if (hwswitch_state & (BIT(radio - 1))) | 610 | if (hwswitch & (BIT(radio - 1))) |
587 | rfkill_set_hw_state(rfkill, !(status & BIT(16))); | 611 | rfkill_set_hw_state(rfkill, !(status & BIT(16))); |
588 | } | 612 | } |
589 | 613 | ||
590 | static void dell_rfkill_query(struct rfkill *rfkill, void *data) | 614 | static void dell_rfkill_query(struct rfkill *rfkill, void *data) |
591 | { | 615 | { |
616 | int radio = ((unsigned long)data & 0xF); | ||
617 | int hwswitch; | ||
592 | int status; | 618 | int status; |
619 | int ret; | ||
593 | 620 | ||
594 | get_buffer(); | 621 | get_buffer(); |
622 | |||
595 | dell_send_request(buffer, 17, 11); | 623 | dell_send_request(buffer, 17, 11); |
624 | ret = buffer->output[0]; | ||
596 | status = buffer->output[1]; | 625 | status = buffer->output[1]; |
597 | 626 | ||
598 | dell_rfkill_update_hw_state(rfkill, (unsigned long)data, status); | 627 | if (ret != 0 || !(status & BIT(0))) { |
628 | release_buffer(); | ||
629 | return; | ||
630 | } | ||
631 | |||
632 | clear_buffer(); | ||
633 | |||
634 | buffer->input[0] = 0x2; | ||
635 | dell_send_request(buffer, 17, 11); | ||
636 | ret = buffer->output[0]; | ||
637 | hwswitch = buffer->output[1]; | ||
599 | 638 | ||
600 | release_buffer(); | 639 | release_buffer(); |
640 | |||
641 | if (ret != 0) | ||
642 | return; | ||
643 | |||
644 | dell_rfkill_update_hw_state(rfkill, radio, status, hwswitch); | ||
601 | } | 645 | } |
602 | 646 | ||
603 | static const struct rfkill_ops dell_rfkill_ops = { | 647 | static const struct rfkill_ops dell_rfkill_ops = { |
@@ -609,13 +653,27 @@ static struct dentry *dell_laptop_dir; | |||
609 | 653 | ||
610 | static int dell_debugfs_show(struct seq_file *s, void *data) | 654 | static int dell_debugfs_show(struct seq_file *s, void *data) |
611 | { | 655 | { |
656 | int hwswitch_state; | ||
657 | int hwswitch_ret; | ||
612 | int status; | 658 | int status; |
659 | int ret; | ||
613 | 660 | ||
614 | get_buffer(); | 661 | get_buffer(); |
662 | |||
615 | dell_send_request(buffer, 17, 11); | 663 | dell_send_request(buffer, 17, 11); |
664 | ret = buffer->output[0]; | ||
616 | status = buffer->output[1]; | 665 | status = buffer->output[1]; |
666 | |||
667 | clear_buffer(); | ||
668 | |||
669 | buffer->input[0] = 0x2; | ||
670 | dell_send_request(buffer, 17, 11); | ||
671 | hwswitch_ret = buffer->output[0]; | ||
672 | hwswitch_state = buffer->output[1]; | ||
673 | |||
617 | release_buffer(); | 674 | release_buffer(); |
618 | 675 | ||
676 | seq_printf(s, "return:\t%d\n", ret); | ||
619 | seq_printf(s, "status:\t0x%X\n", status); | 677 | seq_printf(s, "status:\t0x%X\n", status); |
620 | seq_printf(s, "Bit 0 : Hardware switch supported: %lu\n", | 678 | seq_printf(s, "Bit 0 : Hardware switch supported: %lu\n", |
621 | status & BIT(0)); | 679 | status & BIT(0)); |
@@ -657,7 +715,8 @@ static int dell_debugfs_show(struct seq_file *s, void *data) | |||
657 | seq_printf(s, "Bit 21: WiGig is blocked: %lu\n", | 715 | seq_printf(s, "Bit 21: WiGig is blocked: %lu\n", |
658 | (status & BIT(21)) >> 21); | 716 | (status & BIT(21)) >> 21); |
659 | 717 | ||
660 | seq_printf(s, "\nhwswitch_state:\t0x%X\n", hwswitch_state); | 718 | seq_printf(s, "\nhwswitch_return:\t%d\n", hwswitch_ret); |
719 | seq_printf(s, "hwswitch_state:\t0x%X\n", hwswitch_state); | ||
661 | seq_printf(s, "Bit 0 : Wifi controlled by switch: %lu\n", | 720 | seq_printf(s, "Bit 0 : Wifi controlled by switch: %lu\n", |
662 | hwswitch_state & BIT(0)); | 721 | hwswitch_state & BIT(0)); |
663 | seq_printf(s, "Bit 1 : Bluetooth controlled by switch: %lu\n", | 722 | seq_printf(s, "Bit 1 : Bluetooth controlled by switch: %lu\n", |
@@ -693,25 +752,43 @@ static const struct file_operations dell_debugfs_fops = { | |||
693 | 752 | ||
694 | static void dell_update_rfkill(struct work_struct *ignored) | 753 | static void dell_update_rfkill(struct work_struct *ignored) |
695 | { | 754 | { |
755 | int hwswitch = 0; | ||
696 | int status; | 756 | int status; |
757 | int ret; | ||
697 | 758 | ||
698 | get_buffer(); | 759 | get_buffer(); |
760 | |||
699 | dell_send_request(buffer, 17, 11); | 761 | dell_send_request(buffer, 17, 11); |
762 | ret = buffer->output[0]; | ||
700 | status = buffer->output[1]; | 763 | status = buffer->output[1]; |
701 | 764 | ||
765 | if (ret != 0) | ||
766 | goto out; | ||
767 | |||
768 | clear_buffer(); | ||
769 | |||
770 | buffer->input[0] = 0x2; | ||
771 | dell_send_request(buffer, 17, 11); | ||
772 | ret = buffer->output[0]; | ||
773 | |||
774 | if (ret == 0 && (status & BIT(0))) | ||
775 | hwswitch = buffer->output[1]; | ||
776 | |||
702 | if (wifi_rfkill) { | 777 | if (wifi_rfkill) { |
703 | dell_rfkill_update_hw_state(wifi_rfkill, 1, status); | 778 | dell_rfkill_update_hw_state(wifi_rfkill, 1, status, hwswitch); |
704 | dell_rfkill_update_sw_state(wifi_rfkill, 1, status); | 779 | dell_rfkill_update_sw_state(wifi_rfkill, 1, status); |
705 | } | 780 | } |
706 | if (bluetooth_rfkill) { | 781 | if (bluetooth_rfkill) { |
707 | dell_rfkill_update_hw_state(bluetooth_rfkill, 2, status); | 782 | dell_rfkill_update_hw_state(bluetooth_rfkill, 2, status, |
783 | hwswitch); | ||
708 | dell_rfkill_update_sw_state(bluetooth_rfkill, 2, status); | 784 | dell_rfkill_update_sw_state(bluetooth_rfkill, 2, status); |
709 | } | 785 | } |
710 | if (wwan_rfkill) { | 786 | if (wwan_rfkill) { |
711 | dell_rfkill_update_hw_state(wwan_rfkill, 3, status); | 787 | dell_rfkill_update_hw_state(wwan_rfkill, 3, status, hwswitch); |
712 | dell_rfkill_update_sw_state(wwan_rfkill, 3, status); | 788 | dell_rfkill_update_sw_state(wwan_rfkill, 3, status); |
713 | } | 789 | } |
714 | 790 | ||
791 | out: | ||
715 | release_buffer(); | 792 | release_buffer(); |
716 | } | 793 | } |
717 | static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill); | 794 | static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill); |
@@ -773,21 +850,17 @@ static int __init dell_setup_rfkill(void) | |||
773 | 850 | ||
774 | get_buffer(); | 851 | get_buffer(); |
775 | dell_send_request(buffer, 17, 11); | 852 | dell_send_request(buffer, 17, 11); |
853 | ret = buffer->output[0]; | ||
776 | status = buffer->output[1]; | 854 | status = buffer->output[1]; |
777 | buffer->input[0] = 0x2; | ||
778 | dell_send_request(buffer, 17, 11); | ||
779 | hwswitch_state = buffer->output[1]; | ||
780 | release_buffer(); | 855 | release_buffer(); |
781 | 856 | ||
782 | if (!(status & BIT(0))) { | 857 | /* dell wireless info smbios call is not supported */ |
783 | if (force_rfkill) { | 858 | if (ret != 0) |
784 | /* No hwsitch, clear all hw-controlled bits */ | 859 | return 0; |
785 | hwswitch_state &= ~7; | 860 | |
786 | } else { | 861 | /* rfkill is only tested on laptops with a hwswitch */ |
787 | /* rfkill is only tested on laptops with a hwswitch */ | 862 | if (!(status & BIT(0)) && !force_rfkill) |
788 | return 0; | 863 | return 0; |
789 | } | ||
790 | } | ||
791 | 864 | ||
792 | if ((status & (1<<2|1<<8)) == (1<<2|1<<8)) { | 865 | if ((status & (1<<2|1<<8)) == (1<<2|1<<8)) { |
793 | wifi_rfkill = rfkill_alloc("dell-wifi", &platform_device->dev, | 866 | wifi_rfkill = rfkill_alloc("dell-wifi", &platform_device->dev, |
@@ -932,47 +1005,50 @@ static void dell_cleanup_rfkill(void) | |||
932 | 1005 | ||
933 | static int dell_send_intensity(struct backlight_device *bd) | 1006 | static int dell_send_intensity(struct backlight_device *bd) |
934 | { | 1007 | { |
935 | int ret = 0; | 1008 | int token; |
1009 | int ret; | ||
1010 | |||
1011 | token = find_token_location(BRIGHTNESS_TOKEN); | ||
1012 | if (token == -1) | ||
1013 | return -ENODEV; | ||
936 | 1014 | ||
937 | get_buffer(); | 1015 | get_buffer(); |
938 | buffer->input[0] = find_token_location(BRIGHTNESS_TOKEN); | 1016 | buffer->input[0] = token; |
939 | buffer->input[1] = bd->props.brightness; | 1017 | buffer->input[1] = bd->props.brightness; |
940 | 1018 | ||
941 | if (buffer->input[0] == -1) { | ||
942 | ret = -ENODEV; | ||
943 | goto out; | ||
944 | } | ||
945 | |||
946 | if (power_supply_is_system_supplied() > 0) | 1019 | if (power_supply_is_system_supplied() > 0) |
947 | dell_send_request(buffer, 1, 2); | 1020 | dell_send_request(buffer, 1, 2); |
948 | else | 1021 | else |
949 | dell_send_request(buffer, 1, 1); | 1022 | dell_send_request(buffer, 1, 1); |
950 | 1023 | ||
951 | out: | 1024 | ret = dell_smi_error(buffer->output[0]); |
1025 | |||
952 | release_buffer(); | 1026 | release_buffer(); |
953 | return ret; | 1027 | return ret; |
954 | } | 1028 | } |
955 | 1029 | ||
956 | static int dell_get_intensity(struct backlight_device *bd) | 1030 | static int dell_get_intensity(struct backlight_device *bd) |
957 | { | 1031 | { |
958 | int ret = 0; | 1032 | int token; |
1033 | int ret; | ||
959 | 1034 | ||
960 | get_buffer(); | 1035 | token = find_token_location(BRIGHTNESS_TOKEN); |
961 | buffer->input[0] = find_token_location(BRIGHTNESS_TOKEN); | 1036 | if (token == -1) |
1037 | return -ENODEV; | ||
962 | 1038 | ||
963 | if (buffer->input[0] == -1) { | 1039 | get_buffer(); |
964 | ret = -ENODEV; | 1040 | buffer->input[0] = token; |
965 | goto out; | ||
966 | } | ||
967 | 1041 | ||
968 | if (power_supply_is_system_supplied() > 0) | 1042 | if (power_supply_is_system_supplied() > 0) |
969 | dell_send_request(buffer, 0, 2); | 1043 | dell_send_request(buffer, 0, 2); |
970 | else | 1044 | else |
971 | dell_send_request(buffer, 0, 1); | 1045 | dell_send_request(buffer, 0, 1); |
972 | 1046 | ||
973 | ret = buffer->output[1]; | 1047 | if (buffer->output[0]) |
1048 | ret = dell_smi_error(buffer->output[0]); | ||
1049 | else | ||
1050 | ret = buffer->output[1]; | ||
974 | 1051 | ||
975 | out: | ||
976 | release_buffer(); | 1052 | release_buffer(); |
977 | return ret; | 1053 | return ret; |
978 | } | 1054 | } |
@@ -2036,6 +2112,7 @@ static void kbd_led_exit(void) | |||
2036 | static int __init dell_init(void) | 2112 | static int __init dell_init(void) |
2037 | { | 2113 | { |
2038 | int max_intensity = 0; | 2114 | int max_intensity = 0; |
2115 | int token; | ||
2039 | int ret; | 2116 | int ret; |
2040 | 2117 | ||
2041 | if (!dmi_check_system(dell_device_table)) | 2118 | if (!dmi_check_system(dell_device_table)) |
@@ -2094,13 +2171,15 @@ static int __init dell_init(void) | |||
2094 | if (acpi_video_get_backlight_type() != acpi_backlight_vendor) | 2171 | if (acpi_video_get_backlight_type() != acpi_backlight_vendor) |
2095 | return 0; | 2172 | return 0; |
2096 | 2173 | ||
2097 | get_buffer(); | 2174 | token = find_token_location(BRIGHTNESS_TOKEN); |
2098 | buffer->input[0] = find_token_location(BRIGHTNESS_TOKEN); | 2175 | if (token != -1) { |
2099 | if (buffer->input[0] != -1) { | 2176 | get_buffer(); |
2177 | buffer->input[0] = token; | ||
2100 | dell_send_request(buffer, 0, 2); | 2178 | dell_send_request(buffer, 0, 2); |
2101 | max_intensity = buffer->output[3]; | 2179 | if (buffer->output[0] == 0) |
2180 | max_intensity = buffer->output[3]; | ||
2181 | release_buffer(); | ||
2102 | } | 2182 | } |
2103 | release_buffer(); | ||
2104 | 2183 | ||
2105 | if (max_intensity) { | 2184 | if (max_intensity) { |
2106 | struct backlight_properties props; | 2185 | struct backlight_properties props; |
diff --git a/drivers/platform/x86/intel_pmc_ipc.c b/drivers/platform/x86/intel_pmc_ipc.c index d734763dab69..105cfffe82c6 100644 --- a/drivers/platform/x86/intel_pmc_ipc.c +++ b/drivers/platform/x86/intel_pmc_ipc.c | |||
@@ -96,18 +96,18 @@ static struct intel_pmc_ipc_dev { | |||
96 | struct completion cmd_complete; | 96 | struct completion cmd_complete; |
97 | 97 | ||
98 | /* The following PMC BARs share the same ACPI device with the IPC */ | 98 | /* The following PMC BARs share the same ACPI device with the IPC */ |
99 | void *acpi_io_base; | 99 | resource_size_t acpi_io_base; |
100 | int acpi_io_size; | 100 | int acpi_io_size; |
101 | struct platform_device *tco_dev; | 101 | struct platform_device *tco_dev; |
102 | 102 | ||
103 | /* gcr */ | 103 | /* gcr */ |
104 | void *gcr_base; | 104 | resource_size_t gcr_base; |
105 | int gcr_size; | 105 | int gcr_size; |
106 | 106 | ||
107 | /* punit */ | 107 | /* punit */ |
108 | void *punit_base; | 108 | resource_size_t punit_base; |
109 | int punit_size; | 109 | int punit_size; |
110 | void *punit_base2; | 110 | resource_size_t punit_base2; |
111 | int punit_size2; | 111 | int punit_size2; |
112 | struct platform_device *punit_dev; | 112 | struct platform_device *punit_dev; |
113 | } ipcdev; | 113 | } ipcdev; |
@@ -210,10 +210,15 @@ static int intel_pmc_ipc_check_status(void) | |||
210 | return ret; | 210 | return ret; |
211 | } | 211 | } |
212 | 212 | ||
213 | /* | 213 | /** |
214 | * intel_pmc_ipc_simple_command | 214 | * intel_pmc_ipc_simple_command() - Simple IPC command |
215 | * @cmd: command | 215 | * @cmd: IPC command code. |
216 | * @sub: sub type | 216 | * @sub: IPC command sub type. |
217 | * | ||
218 | * Send a simple IPC command to PMC when don't need to specify | ||
219 | * input/output data and source/dest pointers. | ||
220 | * | ||
221 | * Return: an IPC error code or 0 on success. | ||
217 | */ | 222 | */ |
218 | int intel_pmc_ipc_simple_command(int cmd, int sub) | 223 | int intel_pmc_ipc_simple_command(int cmd, int sub) |
219 | { | 224 | { |
@@ -232,16 +237,20 @@ int intel_pmc_ipc_simple_command(int cmd, int sub) | |||
232 | } | 237 | } |
233 | EXPORT_SYMBOL_GPL(intel_pmc_ipc_simple_command); | 238 | EXPORT_SYMBOL_GPL(intel_pmc_ipc_simple_command); |
234 | 239 | ||
235 | /* | 240 | /** |
236 | * intel_pmc_ipc_raw_cmd | 241 | * intel_pmc_ipc_raw_cmd() - IPC command with data and pointers |
237 | * @cmd: command | 242 | * @cmd: IPC command code. |
238 | * @sub: sub type | 243 | * @sub: IPC command sub type. |
239 | * @in: input data | 244 | * @in: input data of this IPC command. |
240 | * @inlen: input length in bytes | 245 | * @inlen: input data length in bytes. |
241 | * @out: output data | 246 | * @out: output data of this IPC command. |
242 | * @outlen: output length in dwords | 247 | * @outlen: output data length in dwords. |
243 | * @sptr: data writing to SPTR register | 248 | * @sptr: data writing to SPTR register. |
244 | * @dptr: data writing to DPTR register | 249 | * @dptr: data writing to DPTR register. |
250 | * | ||
251 | * Send an IPC command to PMC with input/output data and source/dest pointers. | ||
252 | * | ||
253 | * Return: an IPC error code or 0 on success. | ||
245 | */ | 254 | */ |
246 | int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen, u32 *out, | 255 | int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen, u32 *out, |
247 | u32 outlen, u32 dptr, u32 sptr) | 256 | u32 outlen, u32 dptr, u32 sptr) |
@@ -278,14 +287,18 @@ int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen, u32 *out, | |||
278 | } | 287 | } |
279 | EXPORT_SYMBOL_GPL(intel_pmc_ipc_raw_cmd); | 288 | EXPORT_SYMBOL_GPL(intel_pmc_ipc_raw_cmd); |
280 | 289 | ||
281 | /* | 290 | /** |
282 | * intel_pmc_ipc_command | 291 | * intel_pmc_ipc_command() - IPC command with input/output data |
283 | * @cmd: command | 292 | * @cmd: IPC command code. |
284 | * @sub: sub type | 293 | * @sub: IPC command sub type. |
285 | * @in: input data | 294 | * @in: input data of this IPC command. |
286 | * @inlen: input length in bytes | 295 | * @inlen: input data length in bytes. |
287 | * @out: output data | 296 | * @out: output data of this IPC command. |
288 | * @outlen: output length in dwords | 297 | * @outlen: output data length in dwords. |
298 | * | ||
299 | * Send an IPC command to PMC with input/output data. | ||
300 | * | ||
301 | * Return: an IPC error code or 0 on success. | ||
289 | */ | 302 | */ |
290 | int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen, | 303 | int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen, |
291 | u32 *out, u32 outlen) | 304 | u32 *out, u32 outlen) |
@@ -480,11 +493,11 @@ static int ipc_create_punit_device(void) | |||
480 | pdev->dev.parent = ipcdev.dev; | 493 | pdev->dev.parent = ipcdev.dev; |
481 | 494 | ||
482 | res = punit_res; | 495 | res = punit_res; |
483 | res->start = (resource_size_t)ipcdev.punit_base; | 496 | res->start = ipcdev.punit_base; |
484 | res->end = res->start + ipcdev.punit_size - 1; | 497 | res->end = res->start + ipcdev.punit_size - 1; |
485 | 498 | ||
486 | res = punit_res + PUNIT_RESOURCE_INTER; | 499 | res = punit_res + PUNIT_RESOURCE_INTER; |
487 | res->start = (resource_size_t)ipcdev.punit_base2; | 500 | res->start = ipcdev.punit_base2; |
488 | res->end = res->start + ipcdev.punit_size2 - 1; | 501 | res->end = res->start + ipcdev.punit_size2 - 1; |
489 | 502 | ||
490 | ret = platform_device_add_resources(pdev, punit_res, | 503 | ret = platform_device_add_resources(pdev, punit_res, |
@@ -522,15 +535,15 @@ static int ipc_create_tco_device(void) | |||
522 | pdev->dev.parent = ipcdev.dev; | 535 | pdev->dev.parent = ipcdev.dev; |
523 | 536 | ||
524 | res = tco_res + TCO_RESOURCE_ACPI_IO; | 537 | res = tco_res + TCO_RESOURCE_ACPI_IO; |
525 | res->start = (resource_size_t)ipcdev.acpi_io_base + TCO_BASE_OFFSET; | 538 | res->start = ipcdev.acpi_io_base + TCO_BASE_OFFSET; |
526 | res->end = res->start + TCO_REGS_SIZE - 1; | 539 | res->end = res->start + TCO_REGS_SIZE - 1; |
527 | 540 | ||
528 | res = tco_res + TCO_RESOURCE_SMI_EN_IO; | 541 | res = tco_res + TCO_RESOURCE_SMI_EN_IO; |
529 | res->start = (resource_size_t)ipcdev.acpi_io_base + SMI_EN_OFFSET; | 542 | res->start = ipcdev.acpi_io_base + SMI_EN_OFFSET; |
530 | res->end = res->start + SMI_EN_SIZE - 1; | 543 | res->end = res->start + SMI_EN_SIZE - 1; |
531 | 544 | ||
532 | res = tco_res + TCO_RESOURCE_GCR_MEM; | 545 | res = tco_res + TCO_RESOURCE_GCR_MEM; |
533 | res->start = (resource_size_t)ipcdev.gcr_base; | 546 | res->start = ipcdev.gcr_base; |
534 | res->end = res->start + ipcdev.gcr_size - 1; | 547 | res->end = res->start + ipcdev.gcr_size - 1; |
535 | 548 | ||
536 | ret = platform_device_add_resources(pdev, tco_res, ARRAY_SIZE(tco_res)); | 549 | ret = platform_device_add_resources(pdev, tco_res, ARRAY_SIZE(tco_res)); |
@@ -589,7 +602,7 @@ static int ipc_plat_get_res(struct platform_device *pdev) | |||
589 | return -ENXIO; | 602 | return -ENXIO; |
590 | } | 603 | } |
591 | size = resource_size(res); | 604 | size = resource_size(res); |
592 | ipcdev.acpi_io_base = (void *)res->start; | 605 | ipcdev.acpi_io_base = res->start; |
593 | ipcdev.acpi_io_size = size; | 606 | ipcdev.acpi_io_size = size; |
594 | dev_info(&pdev->dev, "io res: %llx %x\n", | 607 | dev_info(&pdev->dev, "io res: %llx %x\n", |
595 | (long long)res->start, (int)resource_size(res)); | 608 | (long long)res->start, (int)resource_size(res)); |
@@ -601,7 +614,7 @@ static int ipc_plat_get_res(struct platform_device *pdev) | |||
601 | return -ENXIO; | 614 | return -ENXIO; |
602 | } | 615 | } |
603 | size = resource_size(res); | 616 | size = resource_size(res); |
604 | ipcdev.punit_base = (void *)res->start; | 617 | ipcdev.punit_base = res->start; |
605 | ipcdev.punit_size = size; | 618 | ipcdev.punit_size = size; |
606 | dev_info(&pdev->dev, "punit data res: %llx %x\n", | 619 | dev_info(&pdev->dev, "punit data res: %llx %x\n", |
607 | (long long)res->start, (int)resource_size(res)); | 620 | (long long)res->start, (int)resource_size(res)); |
@@ -613,7 +626,7 @@ static int ipc_plat_get_res(struct platform_device *pdev) | |||
613 | return -ENXIO; | 626 | return -ENXIO; |
614 | } | 627 | } |
615 | size = resource_size(res); | 628 | size = resource_size(res); |
616 | ipcdev.punit_base2 = (void *)res->start; | 629 | ipcdev.punit_base2 = res->start; |
617 | ipcdev.punit_size2 = size; | 630 | ipcdev.punit_size2 = size; |
618 | dev_info(&pdev->dev, "punit interface res: %llx %x\n", | 631 | dev_info(&pdev->dev, "punit interface res: %llx %x\n", |
619 | (long long)res->start, (int)resource_size(res)); | 632 | (long long)res->start, (int)resource_size(res)); |
@@ -637,7 +650,7 @@ static int ipc_plat_get_res(struct platform_device *pdev) | |||
637 | } | 650 | } |
638 | ipcdev.ipc_base = addr; | 651 | ipcdev.ipc_base = addr; |
639 | 652 | ||
640 | ipcdev.gcr_base = (void *)(res->start + size); | 653 | ipcdev.gcr_base = res->start + size; |
641 | ipcdev.gcr_size = PLAT_RESOURCE_GCR_SIZE; | 654 | ipcdev.gcr_size = PLAT_RESOURCE_GCR_SIZE; |
642 | dev_info(&pdev->dev, "ipc res: %llx %x\n", | 655 | dev_info(&pdev->dev, "ipc res: %llx %x\n", |
643 | (long long)res->start, (int)resource_size(res)); | 656 | (long long)res->start, (int)resource_size(res)); |
diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c index 001b199a8c33..187d1086d15c 100644 --- a/drivers/platform/x86/intel_scu_ipc.c +++ b/drivers/platform/x86/intel_scu_ipc.c | |||
@@ -216,13 +216,13 @@ static int pwr_reg_rdwr(u16 *addr, u8 *data, u32 count, u32 op, u32 id) | |||
216 | int nc; | 216 | int nc; |
217 | u32 offset = 0; | 217 | u32 offset = 0; |
218 | int err; | 218 | int err; |
219 | u8 cbuf[IPC_WWBUF_SIZE] = { }; | 219 | u8 cbuf[IPC_WWBUF_SIZE]; |
220 | u32 *wbuf = (u32 *)&cbuf; | 220 | u32 *wbuf = (u32 *)&cbuf; |
221 | 221 | ||
222 | mutex_lock(&ipclock); | ||
223 | |||
224 | memset(cbuf, 0, sizeof(cbuf)); | 222 | memset(cbuf, 0, sizeof(cbuf)); |
225 | 223 | ||
224 | mutex_lock(&ipclock); | ||
225 | |||
226 | if (ipcdev.pdev == NULL) { | 226 | if (ipcdev.pdev == NULL) { |
227 | mutex_unlock(&ipclock); | 227 | mutex_unlock(&ipclock); |
228 | return -ENODEV; | 228 | return -ENODEV; |
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c index 515f33882ab8..49c1720df59a 100644 --- a/drivers/pnp/system.c +++ b/drivers/pnp/system.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * Bjorn Helgaas <bjorn.helgaas@hp.com> | 7 | * Bjorn Helgaas <bjorn.helgaas@hp.com> |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/acpi.h> | ||
11 | #include <linux/pnp.h> | 10 | #include <linux/pnp.h> |
12 | #include <linux/device.h> | 11 | #include <linux/device.h> |
13 | #include <linux/init.h> | 12 | #include <linux/init.h> |
@@ -23,41 +22,25 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
23 | {"", 0} | 22 | {"", 0} |
24 | }; | 23 | }; |
25 | 24 | ||
26 | #ifdef CONFIG_ACPI | ||
27 | static bool __reserve_range(u64 start, unsigned int length, bool io, char *desc) | ||
28 | { | ||
29 | u8 space_id = io ? ACPI_ADR_SPACE_SYSTEM_IO : ACPI_ADR_SPACE_SYSTEM_MEMORY; | ||
30 | return !acpi_reserve_region(start, length, space_id, IORESOURCE_BUSY, desc); | ||
31 | } | ||
32 | #else | ||
33 | static bool __reserve_range(u64 start, unsigned int length, bool io, char *desc) | ||
34 | { | ||
35 | struct resource *res; | ||
36 | |||
37 | res = io ? request_region(start, length, desc) : | ||
38 | request_mem_region(start, length, desc); | ||
39 | if (res) { | ||
40 | res->flags &= ~IORESOURCE_BUSY; | ||
41 | return true; | ||
42 | } | ||
43 | return false; | ||
44 | } | ||
45 | #endif | ||
46 | |||
47 | static void reserve_range(struct pnp_dev *dev, struct resource *r, int port) | 25 | static void reserve_range(struct pnp_dev *dev, struct resource *r, int port) |
48 | { | 26 | { |
49 | char *regionid; | 27 | char *regionid; |
50 | const char *pnpid = dev_name(&dev->dev); | 28 | const char *pnpid = dev_name(&dev->dev); |
51 | resource_size_t start = r->start, end = r->end; | 29 | resource_size_t start = r->start, end = r->end; |
52 | bool reserved; | 30 | struct resource *res; |
53 | 31 | ||
54 | regionid = kmalloc(16, GFP_KERNEL); | 32 | regionid = kmalloc(16, GFP_KERNEL); |
55 | if (!regionid) | 33 | if (!regionid) |
56 | return; | 34 | return; |
57 | 35 | ||
58 | snprintf(regionid, 16, "pnp %s", pnpid); | 36 | snprintf(regionid, 16, "pnp %s", pnpid); |
59 | reserved = __reserve_range(start, end - start + 1, !!port, regionid); | 37 | if (port) |
60 | if (!reserved) | 38 | res = request_region(start, end - start + 1, regionid); |
39 | else | ||
40 | res = request_mem_region(start, end - start + 1, regionid); | ||
41 | if (res) | ||
42 | res->flags &= ~IORESOURCE_BUSY; | ||
43 | else | ||
61 | kfree(regionid); | 44 | kfree(regionid); |
62 | 45 | ||
63 | /* | 46 | /* |
@@ -66,7 +49,7 @@ static void reserve_range(struct pnp_dev *dev, struct resource *r, int port) | |||
66 | * have double reservations. | 49 | * have double reservations. |
67 | */ | 50 | */ |
68 | dev_info(&dev->dev, "%pR %s reserved\n", r, | 51 | dev_info(&dev->dev, "%pR %s reserved\n", r, |
69 | reserved ? "has been" : "could not be"); | 52 | res ? "has been" : "could not be"); |
70 | } | 53 | } |
71 | 54 | ||
72 | static void reserve_resources_of_dev(struct pnp_dev *dev) | 55 | static void reserve_resources_of_dev(struct pnp_dev *dev) |
diff --git a/drivers/regulator/88pm800.c b/drivers/regulator/88pm800.c index 832932bdc977..7fd4f511d78f 100644 --- a/drivers/regulator/88pm800.c +++ b/drivers/regulator/88pm800.c | |||
@@ -130,7 +130,7 @@ struct pm800_regulators { | |||
130 | .owner = THIS_MODULE, \ | 130 | .owner = THIS_MODULE, \ |
131 | .n_voltages = ARRAY_SIZE(ldo_volt_table), \ | 131 | .n_voltages = ARRAY_SIZE(ldo_volt_table), \ |
132 | .vsel_reg = PM800_##vreg##_VOUT, \ | 132 | .vsel_reg = PM800_##vreg##_VOUT, \ |
133 | .vsel_mask = 0x1f, \ | 133 | .vsel_mask = 0xf, \ |
134 | .enable_reg = PM800_##ereg, \ | 134 | .enable_reg = PM800_##ereg, \ |
135 | .enable_mask = 1 << (ebit), \ | 135 | .enable_mask = 1 << (ebit), \ |
136 | .volt_table = ldo_volt_table, \ | 136 | .volt_table = ldo_volt_table, \ |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index c9f72019bd68..78387a6cbae5 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -109,6 +109,7 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev, | |||
109 | static struct regulator *create_regulator(struct regulator_dev *rdev, | 109 | static struct regulator *create_regulator(struct regulator_dev *rdev, |
110 | struct device *dev, | 110 | struct device *dev, |
111 | const char *supply_name); | 111 | const char *supply_name); |
112 | static void _regulator_put(struct regulator *regulator); | ||
112 | 113 | ||
113 | static const char *rdev_get_name(struct regulator_dev *rdev) | 114 | static const char *rdev_get_name(struct regulator_dev *rdev) |
114 | { | 115 | { |
@@ -1105,6 +1106,9 @@ static int set_supply(struct regulator_dev *rdev, | |||
1105 | 1106 | ||
1106 | rdev_info(rdev, "supplied by %s\n", rdev_get_name(supply_rdev)); | 1107 | rdev_info(rdev, "supplied by %s\n", rdev_get_name(supply_rdev)); |
1107 | 1108 | ||
1109 | if (!try_module_get(supply_rdev->owner)) | ||
1110 | return -ENODEV; | ||
1111 | |||
1108 | rdev->supply = create_regulator(supply_rdev, &rdev->dev, "SUPPLY"); | 1112 | rdev->supply = create_regulator(supply_rdev, &rdev->dev, "SUPPLY"); |
1109 | if (rdev->supply == NULL) { | 1113 | if (rdev->supply == NULL) { |
1110 | err = -ENOMEM; | 1114 | err = -ENOMEM; |
@@ -1381,9 +1385,13 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) | |||
1381 | } | 1385 | } |
1382 | 1386 | ||
1383 | if (!r) { | 1387 | if (!r) { |
1384 | dev_err(dev, "Failed to resolve %s-supply for %s\n", | 1388 | if (have_full_constraints()) { |
1385 | rdev->supply_name, rdev->desc->name); | 1389 | r = dummy_regulator_rdev; |
1386 | return -EPROBE_DEFER; | 1390 | } else { |
1391 | dev_err(dev, "Failed to resolve %s-supply for %s\n", | ||
1392 | rdev->supply_name, rdev->desc->name); | ||
1393 | return -EPROBE_DEFER; | ||
1394 | } | ||
1387 | } | 1395 | } |
1388 | 1396 | ||
1389 | /* Recursively resolve the supply of the supply */ | 1397 | /* Recursively resolve the supply of the supply */ |
@@ -1398,8 +1406,11 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) | |||
1398 | /* Cascade always-on state to supply */ | 1406 | /* Cascade always-on state to supply */ |
1399 | if (_regulator_is_enabled(rdev)) { | 1407 | if (_regulator_is_enabled(rdev)) { |
1400 | ret = regulator_enable(rdev->supply); | 1408 | ret = regulator_enable(rdev->supply); |
1401 | if (ret < 0) | 1409 | if (ret < 0) { |
1410 | if (rdev->supply) | ||
1411 | _regulator_put(rdev->supply); | ||
1402 | return ret; | 1412 | return ret; |
1413 | } | ||
1403 | } | 1414 | } |
1404 | 1415 | ||
1405 | return 0; | 1416 | return 0; |
diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c index 6f2bdad8b4d8..e94ddcf97722 100644 --- a/drivers/regulator/max8973-regulator.c +++ b/drivers/regulator/max8973-regulator.c | |||
@@ -450,7 +450,7 @@ static struct max8973_regulator_platform_data *max8973_parse_dt( | |||
450 | pdata->control_flags |= MAX8973_CONTROL_FREQ_SHIFT_9PER_ENABLE; | 450 | pdata->control_flags |= MAX8973_CONTROL_FREQ_SHIFT_9PER_ENABLE; |
451 | 451 | ||
452 | if (of_property_read_bool(np, "maxim,enable-bias-control")) | 452 | if (of_property_read_bool(np, "maxim,enable-bias-control")) |
453 | pdata->control_flags |= MAX8973_BIAS_ENABLE; | 453 | pdata->control_flags |= MAX8973_CONTROL_BIAS_ENABLE; |
454 | 454 | ||
455 | return pdata; | 455 | return pdata; |
456 | } | 456 | } |
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 326ffb553371..72fc3c32db49 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c | |||
@@ -34,6 +34,8 @@ | |||
34 | #include <linux/mfd/samsung/s2mps14.h> | 34 | #include <linux/mfd/samsung/s2mps14.h> |
35 | #include <linux/mfd/samsung/s2mpu02.h> | 35 | #include <linux/mfd/samsung/s2mpu02.h> |
36 | 36 | ||
37 | /* The highest number of possible regulators for supported devices. */ | ||
38 | #define S2MPS_REGULATOR_MAX S2MPS13_REGULATOR_MAX | ||
37 | struct s2mps11_info { | 39 | struct s2mps11_info { |
38 | unsigned int rdev_num; | 40 | unsigned int rdev_num; |
39 | int ramp_delay2; | 41 | int ramp_delay2; |
@@ -49,7 +51,7 @@ struct s2mps11_info { | |||
49 | * One bit for each S2MPS13/S2MPS14/S2MPU02 regulator whether | 51 | * One bit for each S2MPS13/S2MPS14/S2MPU02 regulator whether |
50 | * the suspend mode was enabled. | 52 | * the suspend mode was enabled. |
51 | */ | 53 | */ |
52 | unsigned long long s2mps14_suspend_state:50; | 54 | DECLARE_BITMAP(suspend_state, S2MPS_REGULATOR_MAX); |
53 | 55 | ||
54 | /* Array of size rdev_num with GPIO-s for external sleep control */ | 56 | /* Array of size rdev_num with GPIO-s for external sleep control */ |
55 | int *ext_control_gpio; | 57 | int *ext_control_gpio; |
@@ -500,7 +502,7 @@ static int s2mps14_regulator_enable(struct regulator_dev *rdev) | |||
500 | switch (s2mps11->dev_type) { | 502 | switch (s2mps11->dev_type) { |
501 | case S2MPS13X: | 503 | case S2MPS13X: |
502 | case S2MPS14X: | 504 | case S2MPS14X: |
503 | if (s2mps11->s2mps14_suspend_state & (1 << rdev_get_id(rdev))) | 505 | if (test_bit(rdev_get_id(rdev), s2mps11->suspend_state)) |
504 | val = S2MPS14_ENABLE_SUSPEND; | 506 | val = S2MPS14_ENABLE_SUSPEND; |
505 | else if (gpio_is_valid(s2mps11->ext_control_gpio[rdev_get_id(rdev)])) | 507 | else if (gpio_is_valid(s2mps11->ext_control_gpio[rdev_get_id(rdev)])) |
506 | val = S2MPS14_ENABLE_EXT_CONTROL; | 508 | val = S2MPS14_ENABLE_EXT_CONTROL; |
@@ -508,7 +510,7 @@ static int s2mps14_regulator_enable(struct regulator_dev *rdev) | |||
508 | val = rdev->desc->enable_mask; | 510 | val = rdev->desc->enable_mask; |
509 | break; | 511 | break; |
510 | case S2MPU02: | 512 | case S2MPU02: |
511 | if (s2mps11->s2mps14_suspend_state & (1 << rdev_get_id(rdev))) | 513 | if (test_bit(rdev_get_id(rdev), s2mps11->suspend_state)) |
512 | val = S2MPU02_ENABLE_SUSPEND; | 514 | val = S2MPU02_ENABLE_SUSPEND; |
513 | else | 515 | else |
514 | val = rdev->desc->enable_mask; | 516 | val = rdev->desc->enable_mask; |
@@ -562,7 +564,7 @@ static int s2mps14_regulator_set_suspend_disable(struct regulator_dev *rdev) | |||
562 | if (ret < 0) | 564 | if (ret < 0) |
563 | return ret; | 565 | return ret; |
564 | 566 | ||
565 | s2mps11->s2mps14_suspend_state |= (1 << rdev_get_id(rdev)); | 567 | set_bit(rdev_get_id(rdev), s2mps11->suspend_state); |
566 | /* | 568 | /* |
567 | * Don't enable suspend mode if regulator is already disabled because | 569 | * Don't enable suspend mode if regulator is already disabled because |
568 | * this would effectively for a short time turn on the regulator after | 570 | * this would effectively for a short time turn on the regulator after |
@@ -960,18 +962,22 @@ static int s2mps11_pmic_probe(struct platform_device *pdev) | |||
960 | case S2MPS11X: | 962 | case S2MPS11X: |
961 | s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators); | 963 | s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators); |
962 | regulators = s2mps11_regulators; | 964 | regulators = s2mps11_regulators; |
965 | BUILD_BUG_ON(S2MPS_REGULATOR_MAX < s2mps11->rdev_num); | ||
963 | break; | 966 | break; |
964 | case S2MPS13X: | 967 | case S2MPS13X: |
965 | s2mps11->rdev_num = ARRAY_SIZE(s2mps13_regulators); | 968 | s2mps11->rdev_num = ARRAY_SIZE(s2mps13_regulators); |
966 | regulators = s2mps13_regulators; | 969 | regulators = s2mps13_regulators; |
970 | BUILD_BUG_ON(S2MPS_REGULATOR_MAX < s2mps11->rdev_num); | ||
967 | break; | 971 | break; |
968 | case S2MPS14X: | 972 | case S2MPS14X: |
969 | s2mps11->rdev_num = ARRAY_SIZE(s2mps14_regulators); | 973 | s2mps11->rdev_num = ARRAY_SIZE(s2mps14_regulators); |
970 | regulators = s2mps14_regulators; | 974 | regulators = s2mps14_regulators; |
975 | BUILD_BUG_ON(S2MPS_REGULATOR_MAX < s2mps11->rdev_num); | ||
971 | break; | 976 | break; |
972 | case S2MPU02: | 977 | case S2MPU02: |
973 | s2mps11->rdev_num = ARRAY_SIZE(s2mpu02_regulators); | 978 | s2mps11->rdev_num = ARRAY_SIZE(s2mpu02_regulators); |
974 | regulators = s2mpu02_regulators; | 979 | regulators = s2mpu02_regulators; |
980 | BUILD_BUG_ON(S2MPS_REGULATOR_MAX < s2mps11->rdev_num); | ||
975 | break; | 981 | break; |
976 | default: | 982 | default: |
977 | dev_err(&pdev->dev, "Invalid device type: %u\n", | 983 | dev_err(&pdev->dev, "Invalid device type: %u\n", |
diff --git a/drivers/rtc/rtc-armada38x.c b/drivers/rtc/rtc-armada38x.c index 4b62d1a875e4..2b08cac62f07 100644 --- a/drivers/rtc/rtc-armada38x.c +++ b/drivers/rtc/rtc-armada38x.c | |||
@@ -88,7 +88,7 @@ static int armada38x_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
88 | { | 88 | { |
89 | struct armada38x_rtc *rtc = dev_get_drvdata(dev); | 89 | struct armada38x_rtc *rtc = dev_get_drvdata(dev); |
90 | int ret = 0; | 90 | int ret = 0; |
91 | unsigned long time, flags; | 91 | unsigned long time; |
92 | 92 | ||
93 | ret = rtc_tm_to_time(tm, &time); | 93 | ret = rtc_tm_to_time(tm, &time); |
94 | 94 | ||
diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index c0090b698ff3..eab230be5a54 100644 --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c | |||
@@ -343,6 +343,8 @@ static int mtk_rtc_probe(struct platform_device *pdev) | |||
343 | goto out_dispose_irq; | 343 | goto out_dispose_irq; |
344 | } | 344 | } |
345 | 345 | ||
346 | device_init_wakeup(&pdev->dev, 1); | ||
347 | |||
346 | rtc->rtc_dev = rtc_device_register("mt6397-rtc", &pdev->dev, | 348 | rtc->rtc_dev = rtc_device_register("mt6397-rtc", &pdev->dev, |
347 | &mtk_rtc_ops, THIS_MODULE); | 349 | &mtk_rtc_ops, THIS_MODULE); |
348 | if (IS_ERR(rtc->rtc_dev)) { | 350 | if (IS_ERR(rtc->rtc_dev)) { |
@@ -351,8 +353,6 @@ static int mtk_rtc_probe(struct platform_device *pdev) | |||
351 | goto out_free_irq; | 353 | goto out_free_irq; |
352 | } | 354 | } |
353 | 355 | ||
354 | device_init_wakeup(&pdev->dev, 1); | ||
355 | |||
356 | return 0; | 356 | return 0; |
357 | 357 | ||
358 | out_free_irq: | 358 | out_free_irq: |
diff --git a/drivers/s390/Makefile b/drivers/s390/Makefile index 95bccfd3f169..e5225ad9c5b1 100644 --- a/drivers/s390/Makefile +++ b/drivers/s390/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the S/390 specific device drivers | 2 | # Makefile for the S/390 specific device drivers |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y += cio/ block/ char/ crypto/ net/ scsi/ kvm/ | 5 | obj-y += cio/ block/ char/ crypto/ net/ scsi/ virtio/ |
6 | 6 | ||
7 | drivers-y += drivers/s390/built-in.o | 7 | drivers-y += drivers/s390/built-in.o |
8 | 8 | ||
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 1aec8ff0b587..f73d2f579a7e 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -1863,6 +1863,33 @@ static void __dasd_device_check_expire(struct dasd_device *device) | |||
1863 | } | 1863 | } |
1864 | 1864 | ||
1865 | /* | 1865 | /* |
1866 | * return 1 when device is not eligible for IO | ||
1867 | */ | ||
1868 | static int __dasd_device_is_unusable(struct dasd_device *device, | ||
1869 | struct dasd_ccw_req *cqr) | ||
1870 | { | ||
1871 | int mask = ~(DASD_STOPPED_DC_WAIT | DASD_UNRESUMED_PM); | ||
1872 | |||
1873 | if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) { | ||
1874 | /* dasd is being set offline. */ | ||
1875 | return 1; | ||
1876 | } | ||
1877 | if (device->stopped) { | ||
1878 | if (device->stopped & mask) { | ||
1879 | /* stopped and CQR will not change that. */ | ||
1880 | return 1; | ||
1881 | } | ||
1882 | if (!test_bit(DASD_CQR_VERIFY_PATH, &cqr->flags)) { | ||
1883 | /* CQR is not able to change device to | ||
1884 | * operational. */ | ||
1885 | return 1; | ||
1886 | } | ||
1887 | /* CQR required to get device operational. */ | ||
1888 | } | ||
1889 | return 0; | ||
1890 | } | ||
1891 | |||
1892 | /* | ||
1866 | * Take a look at the first request on the ccw queue and check | 1893 | * Take a look at the first request on the ccw queue and check |
1867 | * if it needs to be started. | 1894 | * if it needs to be started. |
1868 | */ | 1895 | */ |
@@ -1876,13 +1903,8 @@ static void __dasd_device_start_head(struct dasd_device *device) | |||
1876 | cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, devlist); | 1903 | cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, devlist); |
1877 | if (cqr->status != DASD_CQR_QUEUED) | 1904 | if (cqr->status != DASD_CQR_QUEUED) |
1878 | return; | 1905 | return; |
1879 | /* when device is stopped, return request to previous layer | 1906 | /* if device is not usable return request to upper layer */ |
1880 | * exception: only the disconnect or unresumed bits are set and the | 1907 | if (__dasd_device_is_unusable(device, cqr)) { |
1881 | * cqr is a path verification request | ||
1882 | */ | ||
1883 | if (device->stopped && | ||
1884 | !(!(device->stopped & ~(DASD_STOPPED_DC_WAIT | DASD_UNRESUMED_PM)) | ||
1885 | && test_bit(DASD_CQR_VERIFY_PATH, &cqr->flags))) { | ||
1886 | cqr->intrc = -EAGAIN; | 1908 | cqr->intrc = -EAGAIN; |
1887 | cqr->status = DASD_CQR_CLEARED; | 1909 | cqr->status = DASD_CQR_CLEARED; |
1888 | dasd_schedule_device_bh(device); | 1910 | dasd_schedule_device_bh(device); |
diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c index a2597e683e79..ee3a6faae22a 100644 --- a/drivers/s390/block/dasd_alias.c +++ b/drivers/s390/block/dasd_alias.c | |||
@@ -699,7 +699,8 @@ struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *base_device) | |||
699 | struct dasd_device, alias_list); | 699 | struct dasd_device, alias_list); |
700 | spin_unlock_irqrestore(&lcu->lock, flags); | 700 | spin_unlock_irqrestore(&lcu->lock, flags); |
701 | alias_priv = (struct dasd_eckd_private *) alias_device->private; | 701 | alias_priv = (struct dasd_eckd_private *) alias_device->private; |
702 | if ((alias_priv->count < private->count) && !alias_device->stopped) | 702 | if ((alias_priv->count < private->count) && !alias_device->stopped && |
703 | !test_bit(DASD_FLAG_OFFLINE, &alias_device->flags)) | ||
703 | return alias_device; | 704 | return alias_device; |
704 | else | 705 | else |
705 | return NULL; | 706 | return NULL; |
diff --git a/drivers/s390/char/sclp_early.c b/drivers/s390/char/sclp_early.c index aeed7969fd79..7bc6df3100ef 100644 --- a/drivers/s390/char/sclp_early.c +++ b/drivers/s390/char/sclp_early.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #define KMSG_COMPONENT "sclp_early" | 7 | #define KMSG_COMPONENT "sclp_early" |
8 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | 8 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt |
9 | 9 | ||
10 | #include <linux/errno.h> | ||
10 | #include <asm/ctl_reg.h> | 11 | #include <asm/ctl_reg.h> |
11 | #include <asm/sclp.h> | 12 | #include <asm/sclp.h> |
12 | #include <asm/ipl.h> | 13 | #include <asm/ipl.h> |
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 08f1830cbfc4..01bf1f5cf2e9 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c | |||
@@ -54,6 +54,10 @@ MODULE_DESCRIPTION("Cryptographic Coprocessor interface, " \ | |||
54 | "Copyright IBM Corp. 2001, 2012"); | 54 | "Copyright IBM Corp. 2001, 2012"); |
55 | MODULE_LICENSE("GPL"); | 55 | MODULE_LICENSE("GPL"); |
56 | 56 | ||
57 | static int zcrypt_hwrng_seed = 1; | ||
58 | module_param_named(hwrng_seed, zcrypt_hwrng_seed, int, S_IRUSR|S_IRGRP); | ||
59 | MODULE_PARM_DESC(hwrng_seed, "Turn on/off hwrng auto seed, default is 1 (on)."); | ||
60 | |||
57 | static DEFINE_SPINLOCK(zcrypt_device_lock); | 61 | static DEFINE_SPINLOCK(zcrypt_device_lock); |
58 | static LIST_HEAD(zcrypt_device_list); | 62 | static LIST_HEAD(zcrypt_device_list); |
59 | static int zcrypt_device_count = 0; | 63 | static int zcrypt_device_count = 0; |
@@ -1373,6 +1377,7 @@ static int zcrypt_rng_data_read(struct hwrng *rng, u32 *data) | |||
1373 | static struct hwrng zcrypt_rng_dev = { | 1377 | static struct hwrng zcrypt_rng_dev = { |
1374 | .name = "zcrypt", | 1378 | .name = "zcrypt", |
1375 | .data_read = zcrypt_rng_data_read, | 1379 | .data_read = zcrypt_rng_data_read, |
1380 | .quality = 990, | ||
1376 | }; | 1381 | }; |
1377 | 1382 | ||
1378 | static int zcrypt_rng_device_add(void) | 1383 | static int zcrypt_rng_device_add(void) |
@@ -1387,6 +1392,8 @@ static int zcrypt_rng_device_add(void) | |||
1387 | goto out; | 1392 | goto out; |
1388 | } | 1393 | } |
1389 | zcrypt_rng_buffer_index = 0; | 1394 | zcrypt_rng_buffer_index = 0; |
1395 | if (!zcrypt_hwrng_seed) | ||
1396 | zcrypt_rng_dev.quality = 0; | ||
1390 | rc = hwrng_register(&zcrypt_rng_dev); | 1397 | rc = hwrng_register(&zcrypt_rng_dev); |
1391 | if (rc) | 1398 | if (rc) |
1392 | goto out_free; | 1399 | goto out_free; |
diff --git a/drivers/s390/kvm/Makefile b/drivers/s390/virtio/Makefile index 241891a57caf..241891a57caf 100644 --- a/drivers/s390/kvm/Makefile +++ b/drivers/s390/virtio/Makefile | |||
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/virtio/kvm_virtio.c index 53fb975c404b..53fb975c404b 100644 --- a/drivers/s390/kvm/kvm_virtio.c +++ b/drivers/s390/virtio/kvm_virtio.c | |||
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c index f8d8fdb26b72..f8d8fdb26b72 100644 --- a/drivers/s390/kvm/virtio_ccw.c +++ b/drivers/s390/virtio/virtio_ccw.c | |||
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 1ac38e73df7e..9ad41168d26d 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -859,7 +859,7 @@ sdev_store_queue_depth(struct device *dev, struct device_attribute *attr, | |||
859 | 859 | ||
860 | depth = simple_strtoul(buf, NULL, 0); | 860 | depth = simple_strtoul(buf, NULL, 0); |
861 | 861 | ||
862 | if (depth < 1 || depth > sht->can_queue) | 862 | if (depth < 1 || depth > sdev->host->can_queue) |
863 | return -EINVAL; | 863 | return -EINVAL; |
864 | 864 | ||
865 | retval = sht->change_queue_depth(sdev, depth); | 865 | retval = sht->change_queue_depth(sdev, depth); |
diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index a85292b1d09d..e3cd3ece4412 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c | |||
@@ -203,7 +203,7 @@ static ssize_t srp_show_tmo(char *buf, int tmo) | |||
203 | return tmo >= 0 ? sprintf(buf, "%d\n", tmo) : sprintf(buf, "off\n"); | 203 | return tmo >= 0 ? sprintf(buf, "%d\n", tmo) : sprintf(buf, "off\n"); |
204 | } | 204 | } |
205 | 205 | ||
206 | static int srp_parse_tmo(int *tmo, const char *buf) | 206 | int srp_parse_tmo(int *tmo, const char *buf) |
207 | { | 207 | { |
208 | int res = 0; | 208 | int res = 0; |
209 | 209 | ||
@@ -214,6 +214,7 @@ static int srp_parse_tmo(int *tmo, const char *buf) | |||
214 | 214 | ||
215 | return res; | 215 | return res; |
216 | } | 216 | } |
217 | EXPORT_SYMBOL(srp_parse_tmo); | ||
217 | 218 | ||
218 | static ssize_t show_reconnect_delay(struct device *dev, | 219 | static ssize_t show_reconnect_delay(struct device *dev, |
219 | struct device_attribute *attr, char *buf) | 220 | struct device_attribute *attr, char *buf) |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 3f25b8fa921d..871f3553987d 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -1329,9 +1329,9 @@ static int st_open(struct inode *inode, struct file *filp) | |||
1329 | spin_lock(&st_use_lock); | 1329 | spin_lock(&st_use_lock); |
1330 | STp->in_use = 0; | 1330 | STp->in_use = 0; |
1331 | spin_unlock(&st_use_lock); | 1331 | spin_unlock(&st_use_lock); |
1332 | scsi_tape_put(STp); | ||
1333 | if (resumed) | 1332 | if (resumed) |
1334 | scsi_autopm_put_device(STp->device); | 1333 | scsi_autopm_put_device(STp->device); |
1334 | scsi_tape_put(STp); | ||
1335 | return retval; | 1335 | return retval; |
1336 | 1336 | ||
1337 | } | 1337 | } |
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 285f77544c36..7dbbb29d24c6 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c | |||
@@ -949,7 +949,7 @@ static int virtscsi_probe(struct virtio_device *vdev) | |||
949 | { | 949 | { |
950 | struct Scsi_Host *shost; | 950 | struct Scsi_Host *shost; |
951 | struct virtio_scsi *vscsi; | 951 | struct virtio_scsi *vscsi; |
952 | int err, host_prot; | 952 | int err; |
953 | u32 sg_elems, num_targets; | 953 | u32 sg_elems, num_targets; |
954 | u32 cmd_per_lun; | 954 | u32 cmd_per_lun; |
955 | u32 num_queues; | 955 | u32 num_queues; |
@@ -1009,6 +1009,8 @@ static int virtscsi_probe(struct virtio_device *vdev) | |||
1009 | 1009 | ||
1010 | #ifdef CONFIG_BLK_DEV_INTEGRITY | 1010 | #ifdef CONFIG_BLK_DEV_INTEGRITY |
1011 | if (virtio_has_feature(vdev, VIRTIO_SCSI_F_T10_PI)) { | 1011 | if (virtio_has_feature(vdev, VIRTIO_SCSI_F_T10_PI)) { |
1012 | int host_prot; | ||
1013 | |||
1012 | host_prot = SHOST_DIF_TYPE1_PROTECTION | SHOST_DIF_TYPE2_PROTECTION | | 1014 | host_prot = SHOST_DIF_TYPE1_PROTECTION | SHOST_DIF_TYPE2_PROTECTION | |
1013 | SHOST_DIF_TYPE3_PROTECTION | SHOST_DIX_TYPE1_PROTECTION | | 1015 | SHOST_DIF_TYPE3_PROTECTION | SHOST_DIX_TYPE1_PROTECTION | |
1014 | SHOST_DIX_TYPE2_PROTECTION | SHOST_DIX_TYPE3_PROTECTION; | 1016 | SHOST_DIX_TYPE2_PROTECTION | SHOST_DIX_TYPE3_PROTECTION; |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 0cae1694014d..b0f30fb68914 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -612,7 +612,7 @@ config SPI_XTENSA_XTFPGA | |||
612 | 612 | ||
613 | config SPI_ZYNQMP_GQSPI | 613 | config SPI_ZYNQMP_GQSPI |
614 | tristate "Xilinx ZynqMP GQSPI controller" | 614 | tristate "Xilinx ZynqMP GQSPI controller" |
615 | depends on SPI_MASTER | 615 | depends on SPI_MASTER && HAS_DMA |
616 | help | 616 | help |
617 | Enables Xilinx GQSPI controller driver for Zynq UltraScale+ MPSoC. | 617 | Enables Xilinx GQSPI controller driver for Zynq UltraScale+ MPSoC. |
618 | 618 | ||
diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c index 788e2b176a4f..acce90ac7371 100644 --- a/drivers/spi/spi-img-spfi.c +++ b/drivers/spi/spi-img-spfi.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #define SPFI_CONTROL_SOFT_RESET BIT(11) | 40 | #define SPFI_CONTROL_SOFT_RESET BIT(11) |
41 | #define SPFI_CONTROL_SEND_DMA BIT(10) | 41 | #define SPFI_CONTROL_SEND_DMA BIT(10) |
42 | #define SPFI_CONTROL_GET_DMA BIT(9) | 42 | #define SPFI_CONTROL_GET_DMA BIT(9) |
43 | #define SPFI_CONTROL_SE BIT(8) | ||
43 | #define SPFI_CONTROL_TMODE_SHIFT 5 | 44 | #define SPFI_CONTROL_TMODE_SHIFT 5 |
44 | #define SPFI_CONTROL_TMODE_MASK 0x7 | 45 | #define SPFI_CONTROL_TMODE_MASK 0x7 |
45 | #define SPFI_CONTROL_TMODE_SINGLE 0 | 46 | #define SPFI_CONTROL_TMODE_SINGLE 0 |
@@ -491,6 +492,7 @@ static void img_spfi_config(struct spi_master *master, struct spi_device *spi, | |||
491 | else if (xfer->tx_nbits == SPI_NBITS_QUAD && | 492 | else if (xfer->tx_nbits == SPI_NBITS_QUAD && |
492 | xfer->rx_nbits == SPI_NBITS_QUAD) | 493 | xfer->rx_nbits == SPI_NBITS_QUAD) |
493 | val |= SPFI_CONTROL_TMODE_QUAD << SPFI_CONTROL_TMODE_SHIFT; | 494 | val |= SPFI_CONTROL_TMODE_QUAD << SPFI_CONTROL_TMODE_SHIFT; |
495 | val |= SPFI_CONTROL_SE; | ||
494 | spfi_writel(spfi, val, SPFI_CONTROL); | 496 | spfi_writel(spfi, val, SPFI_CONTROL); |
495 | } | 497 | } |
496 | 498 | ||
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index eb7d3a6fb14c..f9deb84e4e55 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c | |||
@@ -201,8 +201,9 @@ static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi, | |||
201 | { | 201 | { |
202 | struct spi_imx_data *spi_imx = spi_master_get_devdata(master); | 202 | struct spi_imx_data *spi_imx = spi_master_get_devdata(master); |
203 | 203 | ||
204 | if (spi_imx->dma_is_inited && (transfer->len > spi_imx->rx_wml) | 204 | if (spi_imx->dma_is_inited |
205 | && (transfer->len > spi_imx->tx_wml)) | 205 | && transfer->len > spi_imx->rx_wml * sizeof(u32) |
206 | && transfer->len > spi_imx->tx_wml * sizeof(u32)) | ||
206 | return true; | 207 | return true; |
207 | return false; | 208 | return false; |
208 | } | 209 | } |
diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c index 87b20a511a6b..f23f36ebaf3d 100644 --- a/drivers/spi/spi-zynqmp-gqspi.c +++ b/drivers/spi/spi-zynqmp-gqspi.c | |||
@@ -214,6 +214,7 @@ static void zynqmp_gqspi_selectslave(struct zynqmp_qspi *instanceptr, | |||
214 | case GQSPI_SELECT_FLASH_CS_BOTH: | 214 | case GQSPI_SELECT_FLASH_CS_BOTH: |
215 | instanceptr->genfifocs = GQSPI_GENFIFO_CS_LOWER | | 215 | instanceptr->genfifocs = GQSPI_GENFIFO_CS_LOWER | |
216 | GQSPI_GENFIFO_CS_UPPER; | 216 | GQSPI_GENFIFO_CS_UPPER; |
217 | break; | ||
217 | case GQSPI_SELECT_FLASH_CS_UPPER: | 218 | case GQSPI_SELECT_FLASH_CS_UPPER: |
218 | instanceptr->genfifocs = GQSPI_GENFIFO_CS_UPPER; | 219 | instanceptr->genfifocs = GQSPI_GENFIFO_CS_UPPER; |
219 | break; | 220 | break; |
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index dd616ff0ffc5..c7de64171c45 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c | |||
@@ -693,6 +693,7 @@ static struct class *spidev_class; | |||
693 | #ifdef CONFIG_OF | 693 | #ifdef CONFIG_OF |
694 | static const struct of_device_id spidev_dt_ids[] = { | 694 | static const struct of_device_id spidev_dt_ids[] = { |
695 | { .compatible = "rohm,dh2228fv" }, | 695 | { .compatible = "rohm,dh2228fv" }, |
696 | { .compatible = "lineartechnology,ltc2488" }, | ||
696 | {}, | 697 | {}, |
697 | }; | 698 | }; |
698 | MODULE_DEVICE_TABLE(of, spidev_dt_ids); | 699 | MODULE_DEVICE_TABLE(of, spidev_dt_ids); |
diff --git a/drivers/staging/board/Kconfig b/drivers/staging/board/Kconfig index b8ee81840666..3f287c48e082 100644 --- a/drivers/staging/board/Kconfig +++ b/drivers/staging/board/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config STAGING_BOARD | 1 | config STAGING_BOARD |
2 | bool "Staging Board Support" | 2 | bool "Staging Board Support" |
3 | depends on OF_ADDRESS | 3 | depends on OF_ADDRESS && OF_IRQ && CLKDEV_LOOKUP |
4 | help | 4 | help |
5 | Select to enable per-board staging support code. | 5 | Select to enable per-board staging support code. |
6 | 6 | ||
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index 7125eb955ae5..8a9d4a0de129 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h | |||
@@ -31,7 +31,6 @@ | |||
31 | #define DEBUG_PORTAL_ALLOC | 31 | #define DEBUG_PORTAL_ALLOC |
32 | #define DEBUG_SUBSYSTEM S_LND | 32 | #define DEBUG_SUBSYSTEM S_LND |
33 | 33 | ||
34 | #include <asm/irq.h> | ||
35 | #include <linux/crc32.h> | 34 | #include <linux/crc32.h> |
36 | #include <linux/errno.h> | 35 | #include <linux/errno.h> |
37 | #include <linux/if.h> | 36 | #include <linux/if.h> |
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index ed040fbb7df8..b0c8e235b982 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c | |||
@@ -1418,7 +1418,7 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, | |||
1418 | 1418 | ||
1419 | priv->current_aid = conf->aid; | 1419 | priv->current_aid = conf->aid; |
1420 | 1420 | ||
1421 | if (changed & BSS_CHANGED_BSSID) { | 1421 | if (changed & BSS_CHANGED_BSSID && conf->bssid) { |
1422 | unsigned long flags; | 1422 | unsigned long flags; |
1423 | 1423 | ||
1424 | spin_lock_irqsave(&priv->lock, flags); | 1424 | spin_lock_irqsave(&priv->lock, flags); |
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index f97323f19acf..af572d718135 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c | |||
@@ -701,7 +701,7 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, | |||
701 | 701 | ||
702 | priv->current_aid = conf->aid; | 702 | priv->current_aid = conf->aid; |
703 | 703 | ||
704 | if (changed & BSS_CHANGED_BSSID) | 704 | if (changed & BSS_CHANGED_BSSID && conf->bssid) |
705 | vnt_mac_set_bssid_addr(priv, (u8 *)conf->bssid); | 705 | vnt_mac_set_bssid_addr(priv, (u8 *)conf->bssid); |
706 | 706 | ||
707 | 707 | ||
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index c9c27f69e101..ee8bfacf2071 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -1108,19 +1108,29 @@ static void eraser(unsigned char c, struct tty_struct *tty) | |||
1108 | * Locking: ctrl_lock | 1108 | * Locking: ctrl_lock |
1109 | */ | 1109 | */ |
1110 | 1110 | ||
1111 | static void isig(int sig, struct tty_struct *tty) | 1111 | static void __isig(int sig, struct tty_struct *tty) |
1112 | { | 1112 | { |
1113 | struct n_tty_data *ldata = tty->disc_data; | ||
1114 | struct pid *tty_pgrp = tty_get_pgrp(tty); | 1113 | struct pid *tty_pgrp = tty_get_pgrp(tty); |
1115 | if (tty_pgrp) { | 1114 | if (tty_pgrp) { |
1116 | kill_pgrp(tty_pgrp, sig, 1); | 1115 | kill_pgrp(tty_pgrp, sig, 1); |
1117 | put_pid(tty_pgrp); | 1116 | put_pid(tty_pgrp); |
1118 | } | 1117 | } |
1118 | } | ||
1119 | 1119 | ||
1120 | if (!L_NOFLSH(tty)) { | 1120 | static void isig(int sig, struct tty_struct *tty) |
1121 | { | ||
1122 | struct n_tty_data *ldata = tty->disc_data; | ||
1123 | |||
1124 | if (L_NOFLSH(tty)) { | ||
1125 | /* signal only */ | ||
1126 | __isig(sig, tty); | ||
1127 | |||
1128 | } else { /* signal and flush */ | ||
1121 | up_read(&tty->termios_rwsem); | 1129 | up_read(&tty->termios_rwsem); |
1122 | down_write(&tty->termios_rwsem); | 1130 | down_write(&tty->termios_rwsem); |
1123 | 1131 | ||
1132 | __isig(sig, tty); | ||
1133 | |||
1124 | /* clear echo buffer */ | 1134 | /* clear echo buffer */ |
1125 | mutex_lock(&ldata->output_lock); | 1135 | mutex_lock(&ldata->output_lock); |
1126 | ldata->echo_head = ldata->echo_tail = 0; | 1136 | ldata->echo_head = ldata->echo_tail = 0; |
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 76e65b714471..15b4079a335e 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig | |||
@@ -1185,7 +1185,7 @@ config SERIAL_SC16IS7XX_CORE | |||
1185 | config SERIAL_SC16IS7XX | 1185 | config SERIAL_SC16IS7XX |
1186 | tristate "SC16IS7xx serial support" | 1186 | tristate "SC16IS7xx serial support" |
1187 | select SERIAL_CORE | 1187 | select SERIAL_CORE |
1188 | depends on I2C || SPI_MASTER | 1188 | depends on (SPI_MASTER && !I2C) || I2C |
1189 | help | 1189 | help |
1190 | This selects support for SC16IS7xx serial ports. | 1190 | This selects support for SC16IS7xx serial ports. |
1191 | Supported ICs are SC16IS740, SC16IS741, SC16IS750, SC16IS752, | 1191 | Supported ICs are SC16IS740, SC16IS741, SC16IS750, SC16IS752, |
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 50cf5b10ceed..fd27e986b1dd 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -2310,8 +2310,8 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, | |||
2310 | void __iomem *base; | 2310 | void __iomem *base; |
2311 | 2311 | ||
2312 | base = devm_ioremap_resource(dev, mmiobase); | 2312 | base = devm_ioremap_resource(dev, mmiobase); |
2313 | if (!base) | 2313 | if (IS_ERR(base)) |
2314 | return -ENOMEM; | 2314 | return PTR_ERR(base); |
2315 | 2315 | ||
2316 | index = pl011_probe_dt_alias(index, dev); | 2316 | index = pl011_probe_dt_alias(index, dev); |
2317 | 2317 | ||
diff --git a/drivers/tty/serial/etraxfs-uart.c b/drivers/tty/serial/etraxfs-uart.c index a57301a6fe42..679709f51fd4 100644 --- a/drivers/tty/serial/etraxfs-uart.c +++ b/drivers/tty/serial/etraxfs-uart.c | |||
@@ -950,7 +950,7 @@ static int etraxfs_uart_remove(struct platform_device *pdev) | |||
950 | 950 | ||
951 | port = platform_get_drvdata(pdev); | 951 | port = platform_get_drvdata(pdev); |
952 | uart_remove_one_port(&etraxfs_uart_driver, port); | 952 | uart_remove_one_port(&etraxfs_uart_driver, port); |
953 | etraxfs_uart_ports[pdev->id] = NULL; | 953 | etraxfs_uart_ports[port->line] = NULL; |
954 | 954 | ||
955 | return 0; | 955 | return 0; |
956 | } | 956 | } |
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 2c90dc31bfaa..54fdc7866ea1 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -1121,11 +1121,6 @@ static int imx_startup(struct uart_port *port) | |||
1121 | 1121 | ||
1122 | writel(temp & ~UCR4_DREN, sport->port.membase + UCR4); | 1122 | writel(temp & ~UCR4_DREN, sport->port.membase + UCR4); |
1123 | 1123 | ||
1124 | /* Can we enable the DMA support? */ | ||
1125 | if (is_imx6q_uart(sport) && !uart_console(port) && | ||
1126 | !sport->dma_is_inited) | ||
1127 | imx_uart_dma_init(sport); | ||
1128 | |||
1129 | spin_lock_irqsave(&sport->port.lock, flags); | 1124 | spin_lock_irqsave(&sport->port.lock, flags); |
1130 | /* Reset fifo's and state machines */ | 1125 | /* Reset fifo's and state machines */ |
1131 | i = 100; | 1126 | i = 100; |
@@ -1143,9 +1138,6 @@ static int imx_startup(struct uart_port *port) | |||
1143 | writel(USR1_RTSD, sport->port.membase + USR1); | 1138 | writel(USR1_RTSD, sport->port.membase + USR1); |
1144 | writel(USR2_ORE, sport->port.membase + USR2); | 1139 | writel(USR2_ORE, sport->port.membase + USR2); |
1145 | 1140 | ||
1146 | if (sport->dma_is_inited && !sport->dma_is_enabled) | ||
1147 | imx_enable_dma(sport); | ||
1148 | |||
1149 | temp = readl(sport->port.membase + UCR1); | 1141 | temp = readl(sport->port.membase + UCR1); |
1150 | temp |= UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN; | 1142 | temp |= UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN; |
1151 | 1143 | ||
@@ -1316,6 +1308,11 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1316 | } else { | 1308 | } else { |
1317 | ucr2 |= UCR2_CTSC; | 1309 | ucr2 |= UCR2_CTSC; |
1318 | } | 1310 | } |
1311 | |||
1312 | /* Can we enable the DMA support? */ | ||
1313 | if (is_imx6q_uart(sport) && !uart_console(port) | ||
1314 | && !sport->dma_is_inited) | ||
1315 | imx_uart_dma_init(sport); | ||
1319 | } else { | 1316 | } else { |
1320 | termios->c_cflag &= ~CRTSCTS; | 1317 | termios->c_cflag &= ~CRTSCTS; |
1321 | } | 1318 | } |
@@ -1432,6 +1429,8 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1432 | if (UART_ENABLE_MS(&sport->port, termios->c_cflag)) | 1429 | if (UART_ENABLE_MS(&sport->port, termios->c_cflag)) |
1433 | imx_enable_ms(&sport->port); | 1430 | imx_enable_ms(&sport->port); |
1434 | 1431 | ||
1432 | if (sport->dma_is_inited && !sport->dma_is_enabled) | ||
1433 | imx_enable_dma(sport); | ||
1435 | spin_unlock_irqrestore(&sport->port.lock, flags); | 1434 | spin_unlock_irqrestore(&sport->port.lock, flags); |
1436 | } | 1435 | } |
1437 | 1436 | ||
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 9e6576004a42..5ccc698cbbfa 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c | |||
@@ -354,6 +354,26 @@ static void sc16is7xx_port_write(struct uart_port *port, u8 reg, u8 val) | |||
354 | (reg << SC16IS7XX_REG_SHIFT) | port->line, val); | 354 | (reg << SC16IS7XX_REG_SHIFT) | port->line, val); |
355 | } | 355 | } |
356 | 356 | ||
357 | static void sc16is7xx_fifo_read(struct uart_port *port, unsigned int rxlen) | ||
358 | { | ||
359 | struct sc16is7xx_port *s = dev_get_drvdata(port->dev); | ||
360 | u8 addr = (SC16IS7XX_RHR_REG << SC16IS7XX_REG_SHIFT) | port->line; | ||
361 | |||
362 | regcache_cache_bypass(s->regmap, true); | ||
363 | regmap_raw_read(s->regmap, addr, s->buf, rxlen); | ||
364 | regcache_cache_bypass(s->regmap, false); | ||
365 | } | ||
366 | |||
367 | static void sc16is7xx_fifo_write(struct uart_port *port, u8 to_send) | ||
368 | { | ||
369 | struct sc16is7xx_port *s = dev_get_drvdata(port->dev); | ||
370 | u8 addr = (SC16IS7XX_THR_REG << SC16IS7XX_REG_SHIFT) | port->line; | ||
371 | |||
372 | regcache_cache_bypass(s->regmap, true); | ||
373 | regmap_raw_write(s->regmap, addr, s->buf, to_send); | ||
374 | regcache_cache_bypass(s->regmap, false); | ||
375 | } | ||
376 | |||
357 | static void sc16is7xx_port_update(struct uart_port *port, u8 reg, | 377 | static void sc16is7xx_port_update(struct uart_port *port, u8 reg, |
358 | u8 mask, u8 val) | 378 | u8 mask, u8 val) |
359 | { | 379 | { |
@@ -508,10 +528,7 @@ static void sc16is7xx_handle_rx(struct uart_port *port, unsigned int rxlen, | |||
508 | s->buf[0] = sc16is7xx_port_read(port, SC16IS7XX_RHR_REG); | 528 | s->buf[0] = sc16is7xx_port_read(port, SC16IS7XX_RHR_REG); |
509 | bytes_read = 1; | 529 | bytes_read = 1; |
510 | } else { | 530 | } else { |
511 | regcache_cache_bypass(s->regmap, true); | 531 | sc16is7xx_fifo_read(port, rxlen); |
512 | regmap_raw_read(s->regmap, SC16IS7XX_RHR_REG, | ||
513 | s->buf, rxlen); | ||
514 | regcache_cache_bypass(s->regmap, false); | ||
515 | bytes_read = rxlen; | 532 | bytes_read = rxlen; |
516 | } | 533 | } |
517 | 534 | ||
@@ -591,9 +608,8 @@ static void sc16is7xx_handle_tx(struct uart_port *port) | |||
591 | s->buf[i] = xmit->buf[xmit->tail]; | 608 | s->buf[i] = xmit->buf[xmit->tail]; |
592 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); | 609 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); |
593 | } | 610 | } |
594 | regcache_cache_bypass(s->regmap, true); | 611 | |
595 | regmap_raw_write(s->regmap, SC16IS7XX_THR_REG, s->buf, to_send); | 612 | sc16is7xx_fifo_write(port, to_send); |
596 | regcache_cache_bypass(s->regmap, false); | ||
597 | } | 613 | } |
598 | 614 | ||
599 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | 615 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 7ae1592f7ec9..f36852067f20 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
@@ -1418,7 +1418,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp) | |||
1418 | mutex_lock(&port->mutex); | 1418 | mutex_lock(&port->mutex); |
1419 | uart_shutdown(tty, state); | 1419 | uart_shutdown(tty, state); |
1420 | tty_port_tty_set(port, NULL); | 1420 | tty_port_tty_set(port, NULL); |
1421 | tty->closing = 0; | 1421 | |
1422 | spin_lock_irqsave(&port->lock, flags); | 1422 | spin_lock_irqsave(&port->lock, flags); |
1423 | 1423 | ||
1424 | if (port->blocked_open) { | 1424 | if (port->blocked_open) { |
@@ -1444,6 +1444,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp) | |||
1444 | mutex_unlock(&port->mutex); | 1444 | mutex_unlock(&port->mutex); |
1445 | 1445 | ||
1446 | tty_ldisc_flush(tty); | 1446 | tty_ldisc_flush(tty); |
1447 | tty->closing = 0; | ||
1447 | } | 1448 | } |
1448 | 1449 | ||
1449 | static void uart_wait_until_sent(struct tty_struct *tty, int timeout) | 1450 | static void uart_wait_until_sent(struct tty_struct *tty, int timeout) |
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c index ea27804d87af..381a2b13682c 100644 --- a/drivers/tty/vt/selection.c +++ b/drivers/tty/vt/selection.c | |||
@@ -356,6 +356,7 @@ int paste_selection(struct tty_struct *tty) | |||
356 | schedule(); | 356 | schedule(); |
357 | continue; | 357 | continue; |
358 | } | 358 | } |
359 | __set_current_state(TASK_RUNNING); | ||
359 | count = sel_buffer_lth - pasted; | 360 | count = sel_buffer_lth - pasted; |
360 | count = tty_ldisc_receive_buf(ld, sel_buffer + pasted, NULL, | 361 | count = tty_ldisc_receive_buf(ld, sel_buffer + pasted, NULL, |
361 | count); | 362 | count); |
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 8fe52989b380..4462d167900c 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -742,6 +742,8 @@ static void visual_init(struct vc_data *vc, int num, int init) | |||
742 | __module_get(vc->vc_sw->owner); | 742 | __module_get(vc->vc_sw->owner); |
743 | vc->vc_num = num; | 743 | vc->vc_num = num; |
744 | vc->vc_display_fg = &master_display_fg; | 744 | vc->vc_display_fg = &master_display_fg; |
745 | if (vc->vc_uni_pagedir_loc) | ||
746 | con_free_unimap(vc); | ||
745 | vc->vc_uni_pagedir_loc = &vc->vc_uni_pagedir; | 747 | vc->vc_uni_pagedir_loc = &vc->vc_uni_pagedir; |
746 | vc->vc_uni_pagedir = NULL; | 748 | vc->vc_uni_pagedir = NULL; |
747 | vc->vc_hi_font_mask = 0; | 749 | vc->vc_hi_font_mask = 0; |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 519a77ba214c..b30e7423549b 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -1944,6 +1944,7 @@ static void __exit acm_exit(void) | |||
1944 | usb_deregister(&acm_driver); | 1944 | usb_deregister(&acm_driver); |
1945 | tty_unregister_driver(acm_tty_driver); | 1945 | tty_unregister_driver(acm_tty_driver); |
1946 | put_tty_driver(acm_tty_driver); | 1946 | put_tty_driver(acm_tty_driver); |
1947 | idr_destroy(&acm_minors); | ||
1947 | } | 1948 | } |
1948 | 1949 | ||
1949 | module_init(acm_init); | 1950 | module_init(acm_init); |
diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c index 0e6f968e93fe..01c0c0477a9e 100644 --- a/drivers/usb/common/ulpi.c +++ b/drivers/usb/common/ulpi.c | |||
@@ -242,7 +242,7 @@ static int __init ulpi_init(void) | |||
242 | { | 242 | { |
243 | return bus_register(&ulpi_bus); | 243 | return bus_register(&ulpi_bus); |
244 | } | 244 | } |
245 | module_init(ulpi_init); | 245 | subsys_initcall(ulpi_init); |
246 | 246 | ||
247 | static void __exit ulpi_exit(void) | 247 | static void __exit ulpi_exit(void) |
248 | { | 248 | { |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index be5b2074f906..cbcd0920fb51 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1022,9 +1022,12 @@ static int register_root_hub(struct usb_hcd *hcd) | |||
1022 | dev_name(&usb_dev->dev), retval); | 1022 | dev_name(&usb_dev->dev), retval); |
1023 | return (retval < 0) ? retval : -EMSGSIZE; | 1023 | return (retval < 0) ? retval : -EMSGSIZE; |
1024 | } | 1024 | } |
1025 | if (usb_dev->speed == USB_SPEED_SUPER) { | 1025 | |
1026 | if (le16_to_cpu(usb_dev->descriptor.bcdUSB) >= 0x0201) { | ||
1026 | retval = usb_get_bos_descriptor(usb_dev); | 1027 | retval = usb_get_bos_descriptor(usb_dev); |
1027 | if (retval < 0) { | 1028 | if (!retval) { |
1029 | usb_dev->lpm_capable = usb_device_supports_lpm(usb_dev); | ||
1030 | } else if (usb_dev->speed == USB_SPEED_SUPER) { | ||
1028 | mutex_unlock(&usb_bus_list_lock); | 1031 | mutex_unlock(&usb_bus_list_lock); |
1029 | dev_dbg(parent_dev, "can't read %s bos descriptor %d\n", | 1032 | dev_dbg(parent_dev, "can't read %s bos descriptor %d\n", |
1030 | dev_name(&usb_dev->dev), retval); | 1033 | dev_name(&usb_dev->dev), retval); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 43cb2f2e3b43..73dfa194160b 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -122,7 +122,7 @@ struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev) | |||
122 | return usb_get_intfdata(hdev->actconfig->interface[0]); | 122 | return usb_get_intfdata(hdev->actconfig->interface[0]); |
123 | } | 123 | } |
124 | 124 | ||
125 | static int usb_device_supports_lpm(struct usb_device *udev) | 125 | int usb_device_supports_lpm(struct usb_device *udev) |
126 | { | 126 | { |
127 | /* USB 2.1 (and greater) devices indicate LPM support through | 127 | /* USB 2.1 (and greater) devices indicate LPM support through |
128 | * their USB 2.0 Extended Capabilities BOS descriptor. | 128 | * their USB 2.0 Extended Capabilities BOS descriptor. |
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index 7eb1e26798e5..457255a3306a 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h | |||
@@ -65,6 +65,7 @@ extern int usb_hub_init(void); | |||
65 | extern void usb_hub_cleanup(void); | 65 | extern void usb_hub_cleanup(void); |
66 | extern int usb_major_init(void); | 66 | extern int usb_major_init(void); |
67 | extern void usb_major_cleanup(void); | 67 | extern void usb_major_cleanup(void); |
68 | extern int usb_device_supports_lpm(struct usb_device *udev); | ||
68 | 69 | ||
69 | #ifdef CONFIG_PM | 70 | #ifdef CONFIG_PM |
70 | 71 | ||
diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index e5b546f1152e..c3cc1a78d1e2 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c | |||
@@ -72,17 +72,7 @@ static int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg) | |||
72 | dev_dbg(hsotg->dev, "%s\n", __func__); | 72 | dev_dbg(hsotg->dev, "%s\n", __func__); |
73 | 73 | ||
74 | /* Backup Host regs */ | 74 | /* Backup Host regs */ |
75 | hr = hsotg->hr_backup; | 75 | hr = &hsotg->hr_backup; |
76 | if (!hr) { | ||
77 | hr = devm_kzalloc(hsotg->dev, sizeof(*hr), GFP_KERNEL); | ||
78 | if (!hr) { | ||
79 | dev_err(hsotg->dev, "%s: can't allocate host regs\n", | ||
80 | __func__); | ||
81 | return -ENOMEM; | ||
82 | } | ||
83 | |||
84 | hsotg->hr_backup = hr; | ||
85 | } | ||
86 | hr->hcfg = readl(hsotg->regs + HCFG); | 76 | hr->hcfg = readl(hsotg->regs + HCFG); |
87 | hr->haintmsk = readl(hsotg->regs + HAINTMSK); | 77 | hr->haintmsk = readl(hsotg->regs + HAINTMSK); |
88 | for (i = 0; i < hsotg->core_params->host_channels; ++i) | 78 | for (i = 0; i < hsotg->core_params->host_channels; ++i) |
@@ -90,6 +80,7 @@ static int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg) | |||
90 | 80 | ||
91 | hr->hprt0 = readl(hsotg->regs + HPRT0); | 81 | hr->hprt0 = readl(hsotg->regs + HPRT0); |
92 | hr->hfir = readl(hsotg->regs + HFIR); | 82 | hr->hfir = readl(hsotg->regs + HFIR); |
83 | hr->valid = true; | ||
93 | 84 | ||
94 | return 0; | 85 | return 0; |
95 | } | 86 | } |
@@ -109,12 +100,13 @@ static int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg) | |||
109 | dev_dbg(hsotg->dev, "%s\n", __func__); | 100 | dev_dbg(hsotg->dev, "%s\n", __func__); |
110 | 101 | ||
111 | /* Restore host regs */ | 102 | /* Restore host regs */ |
112 | hr = hsotg->hr_backup; | 103 | hr = &hsotg->hr_backup; |
113 | if (!hr) { | 104 | if (!hr->valid) { |
114 | dev_err(hsotg->dev, "%s: no host registers to restore\n", | 105 | dev_err(hsotg->dev, "%s: no host registers to restore\n", |
115 | __func__); | 106 | __func__); |
116 | return -EINVAL; | 107 | return -EINVAL; |
117 | } | 108 | } |
109 | hr->valid = false; | ||
118 | 110 | ||
119 | writel(hr->hcfg, hsotg->regs + HCFG); | 111 | writel(hr->hcfg, hsotg->regs + HCFG); |
120 | writel(hr->haintmsk, hsotg->regs + HAINTMSK); | 112 | writel(hr->haintmsk, hsotg->regs + HAINTMSK); |
@@ -152,17 +144,7 @@ static int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg) | |||
152 | dev_dbg(hsotg->dev, "%s\n", __func__); | 144 | dev_dbg(hsotg->dev, "%s\n", __func__); |
153 | 145 | ||
154 | /* Backup dev regs */ | 146 | /* Backup dev regs */ |
155 | dr = hsotg->dr_backup; | 147 | dr = &hsotg->dr_backup; |
156 | if (!dr) { | ||
157 | dr = devm_kzalloc(hsotg->dev, sizeof(*dr), GFP_KERNEL); | ||
158 | if (!dr) { | ||
159 | dev_err(hsotg->dev, "%s: can't allocate device regs\n", | ||
160 | __func__); | ||
161 | return -ENOMEM; | ||
162 | } | ||
163 | |||
164 | hsotg->dr_backup = dr; | ||
165 | } | ||
166 | 148 | ||
167 | dr->dcfg = readl(hsotg->regs + DCFG); | 149 | dr->dcfg = readl(hsotg->regs + DCFG); |
168 | dr->dctl = readl(hsotg->regs + DCTL); | 150 | dr->dctl = readl(hsotg->regs + DCTL); |
@@ -195,7 +177,7 @@ static int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg) | |||
195 | dr->doeptsiz[i] = readl(hsotg->regs + DOEPTSIZ(i)); | 177 | dr->doeptsiz[i] = readl(hsotg->regs + DOEPTSIZ(i)); |
196 | dr->doepdma[i] = readl(hsotg->regs + DOEPDMA(i)); | 178 | dr->doepdma[i] = readl(hsotg->regs + DOEPDMA(i)); |
197 | } | 179 | } |
198 | 180 | dr->valid = true; | |
199 | return 0; | 181 | return 0; |
200 | } | 182 | } |
201 | 183 | ||
@@ -215,12 +197,13 @@ static int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg) | |||
215 | dev_dbg(hsotg->dev, "%s\n", __func__); | 197 | dev_dbg(hsotg->dev, "%s\n", __func__); |
216 | 198 | ||
217 | /* Restore dev regs */ | 199 | /* Restore dev regs */ |
218 | dr = hsotg->dr_backup; | 200 | dr = &hsotg->dr_backup; |
219 | if (!dr) { | 201 | if (!dr->valid) { |
220 | dev_err(hsotg->dev, "%s: no device registers to restore\n", | 202 | dev_err(hsotg->dev, "%s: no device registers to restore\n", |
221 | __func__); | 203 | __func__); |
222 | return -EINVAL; | 204 | return -EINVAL; |
223 | } | 205 | } |
206 | dr->valid = false; | ||
224 | 207 | ||
225 | writel(dr->dcfg, hsotg->regs + DCFG); | 208 | writel(dr->dcfg, hsotg->regs + DCFG); |
226 | writel(dr->dctl, hsotg->regs + DCTL); | 209 | writel(dr->dctl, hsotg->regs + DCTL); |
@@ -268,17 +251,7 @@ static int dwc2_backup_global_registers(struct dwc2_hsotg *hsotg) | |||
268 | int i; | 251 | int i; |
269 | 252 | ||
270 | /* Backup global regs */ | 253 | /* Backup global regs */ |
271 | gr = hsotg->gr_backup; | 254 | gr = &hsotg->gr_backup; |
272 | if (!gr) { | ||
273 | gr = devm_kzalloc(hsotg->dev, sizeof(*gr), GFP_KERNEL); | ||
274 | if (!gr) { | ||
275 | dev_err(hsotg->dev, "%s: can't allocate global regs\n", | ||
276 | __func__); | ||
277 | return -ENOMEM; | ||
278 | } | ||
279 | |||
280 | hsotg->gr_backup = gr; | ||
281 | } | ||
282 | 255 | ||
283 | gr->gotgctl = readl(hsotg->regs + GOTGCTL); | 256 | gr->gotgctl = readl(hsotg->regs + GOTGCTL); |
284 | gr->gintmsk = readl(hsotg->regs + GINTMSK); | 257 | gr->gintmsk = readl(hsotg->regs + GINTMSK); |
@@ -291,6 +264,7 @@ static int dwc2_backup_global_registers(struct dwc2_hsotg *hsotg) | |||
291 | for (i = 0; i < MAX_EPS_CHANNELS; i++) | 264 | for (i = 0; i < MAX_EPS_CHANNELS; i++) |
292 | gr->dtxfsiz[i] = readl(hsotg->regs + DPTXFSIZN(i)); | 265 | gr->dtxfsiz[i] = readl(hsotg->regs + DPTXFSIZN(i)); |
293 | 266 | ||
267 | gr->valid = true; | ||
294 | return 0; | 268 | return 0; |
295 | } | 269 | } |
296 | 270 | ||
@@ -309,12 +283,13 @@ static int dwc2_restore_global_registers(struct dwc2_hsotg *hsotg) | |||
309 | dev_dbg(hsotg->dev, "%s\n", __func__); | 283 | dev_dbg(hsotg->dev, "%s\n", __func__); |
310 | 284 | ||
311 | /* Restore global regs */ | 285 | /* Restore global regs */ |
312 | gr = hsotg->gr_backup; | 286 | gr = &hsotg->gr_backup; |
313 | if (!gr) { | 287 | if (!gr->valid) { |
314 | dev_err(hsotg->dev, "%s: no global registers to restore\n", | 288 | dev_err(hsotg->dev, "%s: no global registers to restore\n", |
315 | __func__); | 289 | __func__); |
316 | return -EINVAL; | 290 | return -EINVAL; |
317 | } | 291 | } |
292 | gr->valid = false; | ||
318 | 293 | ||
319 | writel(0xffffffff, hsotg->regs + GINTSTS); | 294 | writel(0xffffffff, hsotg->regs + GINTSTS); |
320 | writel(gr->gotgctl, hsotg->regs + GOTGCTL); | 295 | writel(gr->gotgctl, hsotg->regs + GOTGCTL); |
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 53b8de03f102..0ed87620941b 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h | |||
@@ -492,6 +492,7 @@ struct dwc2_gregs_backup { | |||
492 | u32 gdfifocfg; | 492 | u32 gdfifocfg; |
493 | u32 dtxfsiz[MAX_EPS_CHANNELS]; | 493 | u32 dtxfsiz[MAX_EPS_CHANNELS]; |
494 | u32 gpwrdn; | 494 | u32 gpwrdn; |
495 | bool valid; | ||
495 | }; | 496 | }; |
496 | 497 | ||
497 | /** | 498 | /** |
@@ -521,6 +522,7 @@ struct dwc2_dregs_backup { | |||
521 | u32 doepctl[MAX_EPS_CHANNELS]; | 522 | u32 doepctl[MAX_EPS_CHANNELS]; |
522 | u32 doeptsiz[MAX_EPS_CHANNELS]; | 523 | u32 doeptsiz[MAX_EPS_CHANNELS]; |
523 | u32 doepdma[MAX_EPS_CHANNELS]; | 524 | u32 doepdma[MAX_EPS_CHANNELS]; |
525 | bool valid; | ||
524 | }; | 526 | }; |
525 | 527 | ||
526 | /** | 528 | /** |
@@ -538,6 +540,7 @@ struct dwc2_hregs_backup { | |||
538 | u32 hcintmsk[MAX_EPS_CHANNELS]; | 540 | u32 hcintmsk[MAX_EPS_CHANNELS]; |
539 | u32 hprt0; | 541 | u32 hprt0; |
540 | u32 hfir; | 542 | u32 hfir; |
543 | bool valid; | ||
541 | }; | 544 | }; |
542 | 545 | ||
543 | /** | 546 | /** |
@@ -705,9 +708,9 @@ struct dwc2_hsotg { | |||
705 | struct work_struct wf_otg; | 708 | struct work_struct wf_otg; |
706 | struct timer_list wkp_timer; | 709 | struct timer_list wkp_timer; |
707 | enum dwc2_lx_state lx_state; | 710 | enum dwc2_lx_state lx_state; |
708 | struct dwc2_gregs_backup *gr_backup; | 711 | struct dwc2_gregs_backup gr_backup; |
709 | struct dwc2_dregs_backup *dr_backup; | 712 | struct dwc2_dregs_backup dr_backup; |
710 | struct dwc2_hregs_backup *hr_backup; | 713 | struct dwc2_hregs_backup hr_backup; |
711 | 714 | ||
712 | struct dentry *debug_root; | 715 | struct dentry *debug_root; |
713 | struct debugfs_regset32 *regset; | 716 | struct debugfs_regset32 *regset; |
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index b10377c65064..f845c41fe9e5 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c | |||
@@ -359,10 +359,9 @@ void dwc2_hcd_stop(struct dwc2_hsotg *hsotg) | |||
359 | 359 | ||
360 | /* Caller must hold driver lock */ | 360 | /* Caller must hold driver lock */ |
361 | static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, | 361 | static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, |
362 | struct dwc2_hcd_urb *urb, void **ep_handle, | 362 | struct dwc2_hcd_urb *urb, struct dwc2_qh *qh, |
363 | gfp_t mem_flags) | 363 | struct dwc2_qtd *qtd) |
364 | { | 364 | { |
365 | struct dwc2_qtd *qtd; | ||
366 | u32 intr_mask; | 365 | u32 intr_mask; |
367 | int retval; | 366 | int retval; |
368 | int dev_speed; | 367 | int dev_speed; |
@@ -386,18 +385,15 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, | |||
386 | return -ENODEV; | 385 | return -ENODEV; |
387 | } | 386 | } |
388 | 387 | ||
389 | qtd = kzalloc(sizeof(*qtd), mem_flags); | ||
390 | if (!qtd) | 388 | if (!qtd) |
391 | return -ENOMEM; | 389 | return -EINVAL; |
392 | 390 | ||
393 | dwc2_hcd_qtd_init(qtd, urb); | 391 | dwc2_hcd_qtd_init(qtd, urb); |
394 | retval = dwc2_hcd_qtd_add(hsotg, qtd, (struct dwc2_qh **)ep_handle, | 392 | retval = dwc2_hcd_qtd_add(hsotg, qtd, qh); |
395 | mem_flags); | ||
396 | if (retval) { | 393 | if (retval) { |
397 | dev_err(hsotg->dev, | 394 | dev_err(hsotg->dev, |
398 | "DWC OTG HCD URB Enqueue failed adding QTD. Error status %d\n", | 395 | "DWC OTG HCD URB Enqueue failed adding QTD. Error status %d\n", |
399 | retval); | 396 | retval); |
400 | kfree(qtd); | ||
401 | return retval; | 397 | return retval; |
402 | } | 398 | } |
403 | 399 | ||
@@ -2445,6 +2441,9 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
2445 | u32 tflags = 0; | 2441 | u32 tflags = 0; |
2446 | void *buf; | 2442 | void *buf; |
2447 | unsigned long flags; | 2443 | unsigned long flags; |
2444 | struct dwc2_qh *qh; | ||
2445 | bool qh_allocated = false; | ||
2446 | struct dwc2_qtd *qtd; | ||
2448 | 2447 | ||
2449 | if (dbg_urb(urb)) { | 2448 | if (dbg_urb(urb)) { |
2450 | dev_vdbg(hsotg->dev, "DWC OTG HCD URB Enqueue\n"); | 2449 | dev_vdbg(hsotg->dev, "DWC OTG HCD URB Enqueue\n"); |
@@ -2523,15 +2522,32 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
2523 | urb->iso_frame_desc[i].length); | 2522 | urb->iso_frame_desc[i].length); |
2524 | 2523 | ||
2525 | urb->hcpriv = dwc2_urb; | 2524 | urb->hcpriv = dwc2_urb; |
2525 | qh = (struct dwc2_qh *) ep->hcpriv; | ||
2526 | /* Create QH for the endpoint if it doesn't exist */ | ||
2527 | if (!qh) { | ||
2528 | qh = dwc2_hcd_qh_create(hsotg, dwc2_urb, mem_flags); | ||
2529 | if (!qh) { | ||
2530 | retval = -ENOMEM; | ||
2531 | goto fail0; | ||
2532 | } | ||
2533 | ep->hcpriv = qh; | ||
2534 | qh_allocated = true; | ||
2535 | } | ||
2536 | |||
2537 | qtd = kzalloc(sizeof(*qtd), mem_flags); | ||
2538 | if (!qtd) { | ||
2539 | retval = -ENOMEM; | ||
2540 | goto fail1; | ||
2541 | } | ||
2526 | 2542 | ||
2527 | spin_lock_irqsave(&hsotg->lock, flags); | 2543 | spin_lock_irqsave(&hsotg->lock, flags); |
2528 | retval = usb_hcd_link_urb_to_ep(hcd, urb); | 2544 | retval = usb_hcd_link_urb_to_ep(hcd, urb); |
2529 | if (retval) | 2545 | if (retval) |
2530 | goto fail1; | 2546 | goto fail2; |
2531 | 2547 | ||
2532 | retval = dwc2_hcd_urb_enqueue(hsotg, dwc2_urb, &ep->hcpriv, mem_flags); | 2548 | retval = dwc2_hcd_urb_enqueue(hsotg, dwc2_urb, qh, qtd); |
2533 | if (retval) | 2549 | if (retval) |
2534 | goto fail2; | 2550 | goto fail3; |
2535 | 2551 | ||
2536 | if (alloc_bandwidth) { | 2552 | if (alloc_bandwidth) { |
2537 | dwc2_allocate_bus_bandwidth(hcd, | 2553 | dwc2_allocate_bus_bandwidth(hcd, |
@@ -2543,12 +2559,25 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
2543 | 2559 | ||
2544 | return 0; | 2560 | return 0; |
2545 | 2561 | ||
2546 | fail2: | 2562 | fail3: |
2547 | dwc2_urb->priv = NULL; | 2563 | dwc2_urb->priv = NULL; |
2548 | usb_hcd_unlink_urb_from_ep(hcd, urb); | 2564 | usb_hcd_unlink_urb_from_ep(hcd, urb); |
2549 | fail1: | 2565 | fail2: |
2550 | spin_unlock_irqrestore(&hsotg->lock, flags); | 2566 | spin_unlock_irqrestore(&hsotg->lock, flags); |
2551 | urb->hcpriv = NULL; | 2567 | urb->hcpriv = NULL; |
2568 | kfree(qtd); | ||
2569 | fail1: | ||
2570 | if (qh_allocated) { | ||
2571 | struct dwc2_qtd *qtd2, *qtd2_tmp; | ||
2572 | |||
2573 | ep->hcpriv = NULL; | ||
2574 | dwc2_hcd_qh_unlink(hsotg, qh); | ||
2575 | /* Free each QTD in the QH's QTD list */ | ||
2576 | list_for_each_entry_safe(qtd2, qtd2_tmp, &qh->qtd_list, | ||
2577 | qtd_list_entry) | ||
2578 | dwc2_hcd_qtd_unlink_and_free(hsotg, qtd2, qh); | ||
2579 | dwc2_hcd_qh_free(hsotg, qh); | ||
2580 | } | ||
2552 | fail0: | 2581 | fail0: |
2553 | kfree(dwc2_urb); | 2582 | kfree(dwc2_urb); |
2554 | 2583 | ||
diff --git a/drivers/usb/dwc2/hcd.h b/drivers/usb/dwc2/hcd.h index 7b5841c40033..fc1054965552 100644 --- a/drivers/usb/dwc2/hcd.h +++ b/drivers/usb/dwc2/hcd.h | |||
@@ -463,6 +463,9 @@ extern void dwc2_hcd_queue_transactions(struct dwc2_hsotg *hsotg, | |||
463 | /* Schedule Queue Functions */ | 463 | /* Schedule Queue Functions */ |
464 | /* Implemented in hcd_queue.c */ | 464 | /* Implemented in hcd_queue.c */ |
465 | extern void dwc2_hcd_init_usecs(struct dwc2_hsotg *hsotg); | 465 | extern void dwc2_hcd_init_usecs(struct dwc2_hsotg *hsotg); |
466 | extern struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg, | ||
467 | struct dwc2_hcd_urb *urb, | ||
468 | gfp_t mem_flags); | ||
466 | extern void dwc2_hcd_qh_free(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); | 469 | extern void dwc2_hcd_qh_free(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); |
467 | extern int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); | 470 | extern int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); |
468 | extern void dwc2_hcd_qh_unlink(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); | 471 | extern void dwc2_hcd_qh_unlink(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); |
@@ -471,7 +474,7 @@ extern void dwc2_hcd_qh_deactivate(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, | |||
471 | 474 | ||
472 | extern void dwc2_hcd_qtd_init(struct dwc2_qtd *qtd, struct dwc2_hcd_urb *urb); | 475 | extern void dwc2_hcd_qtd_init(struct dwc2_qtd *qtd, struct dwc2_hcd_urb *urb); |
473 | extern int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, | 476 | extern int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, |
474 | struct dwc2_qh **qh, gfp_t mem_flags); | 477 | struct dwc2_qh *qh); |
475 | 478 | ||
476 | /* Unlinks and frees a QTD */ | 479 | /* Unlinks and frees a QTD */ |
477 | static inline void dwc2_hcd_qtd_unlink_and_free(struct dwc2_hsotg *hsotg, | 480 | static inline void dwc2_hcd_qtd_unlink_and_free(struct dwc2_hsotg *hsotg, |
diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c index 9b5c36256627..3ad63d392e13 100644 --- a/drivers/usb/dwc2/hcd_queue.c +++ b/drivers/usb/dwc2/hcd_queue.c | |||
@@ -191,7 +191,7 @@ static void dwc2_qh_init(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, | |||
191 | * | 191 | * |
192 | * Return: Pointer to the newly allocated QH, or NULL on error | 192 | * Return: Pointer to the newly allocated QH, or NULL on error |
193 | */ | 193 | */ |
194 | static struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg, | 194 | struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg, |
195 | struct dwc2_hcd_urb *urb, | 195 | struct dwc2_hcd_urb *urb, |
196 | gfp_t mem_flags) | 196 | gfp_t mem_flags) |
197 | { | 197 | { |
@@ -767,57 +767,32 @@ void dwc2_hcd_qtd_init(struct dwc2_qtd *qtd, struct dwc2_hcd_urb *urb) | |||
767 | * | 767 | * |
768 | * @hsotg: The DWC HCD structure | 768 | * @hsotg: The DWC HCD structure |
769 | * @qtd: The QTD to add | 769 | * @qtd: The QTD to add |
770 | * @qh: Out parameter to return queue head | 770 | * @qh: Queue head to add qtd to |
771 | * @atomic_alloc: Flag to do atomic alloc if needed | ||
772 | * | 771 | * |
773 | * Return: 0 if successful, negative error code otherwise | 772 | * Return: 0 if successful, negative error code otherwise |
774 | * | 773 | * |
775 | * Finds the correct QH to place the QTD into. If it does not find a QH, it | 774 | * If the QH to which the QTD is added is not currently scheduled, it is placed |
776 | * will create a new QH. If the QH to which the QTD is added is not currently | 775 | * into the proper schedule based on its EP type. |
777 | * scheduled, it is placed into the proper schedule based on its EP type. | ||
778 | */ | 776 | */ |
779 | int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, | 777 | int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, |
780 | struct dwc2_qh **qh, gfp_t mem_flags) | 778 | struct dwc2_qh *qh) |
781 | { | 779 | { |
782 | struct dwc2_hcd_urb *urb = qtd->urb; | ||
783 | int allocated = 0; | ||
784 | int retval; | 780 | int retval; |
785 | 781 | ||
786 | /* | 782 | if (unlikely(!qh)) { |
787 | * Get the QH which holds the QTD-list to insert to. Create QH if it | 783 | dev_err(hsotg->dev, "%s: Invalid QH\n", __func__); |
788 | * doesn't exist. | 784 | retval = -EINVAL; |
789 | */ | 785 | goto fail; |
790 | if (*qh == NULL) { | ||
791 | *qh = dwc2_hcd_qh_create(hsotg, urb, mem_flags); | ||
792 | if (*qh == NULL) | ||
793 | return -ENOMEM; | ||
794 | allocated = 1; | ||
795 | } | 786 | } |
796 | 787 | ||
797 | retval = dwc2_hcd_qh_add(hsotg, *qh); | 788 | retval = dwc2_hcd_qh_add(hsotg, qh); |
798 | if (retval) | 789 | if (retval) |
799 | goto fail; | 790 | goto fail; |
800 | 791 | ||
801 | qtd->qh = *qh; | 792 | qtd->qh = qh; |
802 | list_add_tail(&qtd->qtd_list_entry, &(*qh)->qtd_list); | 793 | list_add_tail(&qtd->qtd_list_entry, &qh->qtd_list); |
803 | 794 | ||
804 | return 0; | 795 | return 0; |
805 | |||
806 | fail: | 796 | fail: |
807 | if (allocated) { | ||
808 | struct dwc2_qtd *qtd2, *qtd2_tmp; | ||
809 | struct dwc2_qh *qh_tmp = *qh; | ||
810 | |||
811 | *qh = NULL; | ||
812 | dwc2_hcd_qh_unlink(hsotg, qh_tmp); | ||
813 | |||
814 | /* Free each QTD in the QH's QTD list */ | ||
815 | list_for_each_entry_safe(qtd2, qtd2_tmp, &qh_tmp->qtd_list, | ||
816 | qtd_list_entry) | ||
817 | dwc2_hcd_qtd_unlink_and_free(hsotg, qtd2, qh_tmp); | ||
818 | |||
819 | dwc2_hcd_qh_free(hsotg, qh_tmp); | ||
820 | } | ||
821 | |||
822 | return retval; | 797 | return retval; |
823 | } | 798 | } |
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 5c110d8e293b..ff5773c66b84 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -446,10 +446,12 @@ static int dwc3_phy_setup(struct dwc3 *dwc) | |||
446 | /* Select the HS PHY interface */ | 446 | /* Select the HS PHY interface */ |
447 | switch (DWC3_GHWPARAMS3_HSPHY_IFC(dwc->hwparams.hwparams3)) { | 447 | switch (DWC3_GHWPARAMS3_HSPHY_IFC(dwc->hwparams.hwparams3)) { |
448 | case DWC3_GHWPARAMS3_HSPHY_IFC_UTMI_ULPI: | 448 | case DWC3_GHWPARAMS3_HSPHY_IFC_UTMI_ULPI: |
449 | if (!strncmp(dwc->hsphy_interface, "utmi", 4)) { | 449 | if (dwc->hsphy_interface && |
450 | !strncmp(dwc->hsphy_interface, "utmi", 4)) { | ||
450 | reg &= ~DWC3_GUSB2PHYCFG_ULPI_UTMI; | 451 | reg &= ~DWC3_GUSB2PHYCFG_ULPI_UTMI; |
451 | break; | 452 | break; |
452 | } else if (!strncmp(dwc->hsphy_interface, "ulpi", 4)) { | 453 | } else if (dwc->hsphy_interface && |
454 | !strncmp(dwc->hsphy_interface, "ulpi", 4)) { | ||
453 | reg |= DWC3_GUSB2PHYCFG_ULPI_UTMI; | 455 | reg |= DWC3_GUSB2PHYCFG_ULPI_UTMI; |
454 | dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); | 456 | dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); |
455 | } else { | 457 | } else { |
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 2ef3c8d6a9db..69e769c35cf5 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
@@ -727,6 +727,10 @@ static int dwc3_ep0_std_request(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) | |||
727 | dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_ISOCH_DELAY"); | 727 | dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_ISOCH_DELAY"); |
728 | ret = dwc3_ep0_set_isoch_delay(dwc, ctrl); | 728 | ret = dwc3_ep0_set_isoch_delay(dwc, ctrl); |
729 | break; | 729 | break; |
730 | case USB_REQ_SET_INTERFACE: | ||
731 | dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_INTERFACE"); | ||
732 | dwc->start_config_issued = false; | ||
733 | /* Fall through */ | ||
730 | default: | 734 | default: |
731 | dwc3_trace(trace_dwc3_ep0, "Forwarding to gadget driver"); | 735 | dwc3_trace(trace_dwc3_ep0, "Forwarding to gadget driver"); |
732 | ret = dwc3_ep0_delegate_req(dwc, ctrl); | 736 | ret = dwc3_ep0_delegate_req(dwc, ctrl); |
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 4e3447bbd097..58b4657fc721 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -1758,10 +1758,13 @@ unknown: | |||
1758 | * take such requests too, if that's ever needed: to work | 1758 | * take such requests too, if that's ever needed: to work |
1759 | * in config 0, etc. | 1759 | * in config 0, etc. |
1760 | */ | 1760 | */ |
1761 | list_for_each_entry(f, &cdev->config->functions, list) | 1761 | if (cdev->config) { |
1762 | if (f->req_match && f->req_match(f, ctrl)) | 1762 | list_for_each_entry(f, &cdev->config->functions, list) |
1763 | goto try_fun_setup; | 1763 | if (f->req_match && f->req_match(f, ctrl)) |
1764 | f = NULL; | 1764 | goto try_fun_setup; |
1765 | f = NULL; | ||
1766 | } | ||
1767 | |||
1765 | switch (ctrl->bRequestType & USB_RECIP_MASK) { | 1768 | switch (ctrl->bRequestType & USB_RECIP_MASK) { |
1766 | case USB_RECIP_INTERFACE: | 1769 | case USB_RECIP_INTERFACE: |
1767 | if (!cdev->config || intf >= MAX_CONFIG_INTERFACES) | 1770 | if (!cdev->config || intf >= MAX_CONFIG_INTERFACES) |
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 0495c94a23d7..289e20119fea 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c | |||
@@ -571,7 +571,7 @@ static struct config_group *function_make( | |||
571 | if (IS_ERR(fi)) | 571 | if (IS_ERR(fi)) |
572 | return ERR_CAST(fi); | 572 | return ERR_CAST(fi); |
573 | 573 | ||
574 | ret = config_item_set_name(&fi->group.cg_item, name); | 574 | ret = config_item_set_name(&fi->group.cg_item, "%s", name); |
575 | if (ret) { | 575 | if (ret) { |
576 | usb_put_function_instance(fi); | 576 | usb_put_function_instance(fi); |
577 | return ERR_PTR(ret); | 577 | return ERR_PTR(ret); |
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 45b8c8b338df..6e7be91e6097 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -924,7 +924,8 @@ static ssize_t ffs_epfile_write_iter(struct kiocb *kiocb, struct iov_iter *from) | |||
924 | 924 | ||
925 | kiocb->private = p; | 925 | kiocb->private = p; |
926 | 926 | ||
927 | kiocb_set_cancel_fn(kiocb, ffs_aio_cancel); | 927 | if (p->aio) |
928 | kiocb_set_cancel_fn(kiocb, ffs_aio_cancel); | ||
928 | 929 | ||
929 | res = ffs_epfile_io(kiocb->ki_filp, p); | 930 | res = ffs_epfile_io(kiocb->ki_filp, p); |
930 | if (res == -EIOCBQUEUED) | 931 | if (res == -EIOCBQUEUED) |
@@ -968,7 +969,8 @@ static ssize_t ffs_epfile_read_iter(struct kiocb *kiocb, struct iov_iter *to) | |||
968 | 969 | ||
969 | kiocb->private = p; | 970 | kiocb->private = p; |
970 | 971 | ||
971 | kiocb_set_cancel_fn(kiocb, ffs_aio_cancel); | 972 | if (p->aio) |
973 | kiocb_set_cancel_fn(kiocb, ffs_aio_cancel); | ||
972 | 974 | ||
973 | res = ffs_epfile_io(kiocb->ki_filp, p); | 975 | res = ffs_epfile_io(kiocb->ki_filp, p); |
974 | if (res == -EIOCBQUEUED) | 976 | if (res == -EIOCBQUEUED) |
diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c index d2259c663996..f936268d26c6 100644 --- a/drivers/usb/gadget/function/f_mass_storage.c +++ b/drivers/usb/gadget/function/f_mass_storage.c | |||
@@ -2786,7 +2786,7 @@ int fsg_common_set_nluns(struct fsg_common *common, int nluns) | |||
2786 | return -EINVAL; | 2786 | return -EINVAL; |
2787 | } | 2787 | } |
2788 | 2788 | ||
2789 | curlun = kcalloc(nluns, sizeof(*curlun), GFP_KERNEL); | 2789 | curlun = kcalloc(FSG_MAX_LUNS, sizeof(*curlun), GFP_KERNEL); |
2790 | if (unlikely(!curlun)) | 2790 | if (unlikely(!curlun)) |
2791 | return -ENOMEM; | 2791 | return -ENOMEM; |
2792 | 2792 | ||
@@ -2796,8 +2796,6 @@ int fsg_common_set_nluns(struct fsg_common *common, int nluns) | |||
2796 | common->luns = curlun; | 2796 | common->luns = curlun; |
2797 | common->nluns = nluns; | 2797 | common->nluns = nluns; |
2798 | 2798 | ||
2799 | pr_info("Number of LUNs=%d\n", common->nluns); | ||
2800 | |||
2801 | return 0; | 2799 | return 0; |
2802 | } | 2800 | } |
2803 | EXPORT_SYMBOL_GPL(fsg_common_set_nluns); | 2801 | EXPORT_SYMBOL_GPL(fsg_common_set_nluns); |
@@ -3563,14 +3561,26 @@ static struct usb_function *fsg_alloc(struct usb_function_instance *fi) | |||
3563 | struct fsg_opts *opts = fsg_opts_from_func_inst(fi); | 3561 | struct fsg_opts *opts = fsg_opts_from_func_inst(fi); |
3564 | struct fsg_common *common = opts->common; | 3562 | struct fsg_common *common = opts->common; |
3565 | struct fsg_dev *fsg; | 3563 | struct fsg_dev *fsg; |
3564 | unsigned nluns, i; | ||
3566 | 3565 | ||
3567 | fsg = kzalloc(sizeof(*fsg), GFP_KERNEL); | 3566 | fsg = kzalloc(sizeof(*fsg), GFP_KERNEL); |
3568 | if (unlikely(!fsg)) | 3567 | if (unlikely(!fsg)) |
3569 | return ERR_PTR(-ENOMEM); | 3568 | return ERR_PTR(-ENOMEM); |
3570 | 3569 | ||
3571 | mutex_lock(&opts->lock); | 3570 | mutex_lock(&opts->lock); |
3571 | if (!opts->refcnt) { | ||
3572 | for (nluns = i = 0; i < FSG_MAX_LUNS; ++i) | ||
3573 | if (common->luns[i]) | ||
3574 | nluns = i + 1; | ||
3575 | if (!nluns) | ||
3576 | pr_warn("No LUNS defined, continuing anyway\n"); | ||
3577 | else | ||
3578 | common->nluns = nluns; | ||
3579 | pr_info("Number of LUNs=%u\n", common->nluns); | ||
3580 | } | ||
3572 | opts->refcnt++; | 3581 | opts->refcnt++; |
3573 | mutex_unlock(&opts->lock); | 3582 | mutex_unlock(&opts->lock); |
3583 | |||
3574 | fsg->function.name = FSG_DRIVER_DESC; | 3584 | fsg->function.name = FSG_DRIVER_DESC; |
3575 | fsg->function.bind = fsg_bind; | 3585 | fsg->function.bind = fsg_bind; |
3576 | fsg->function.unbind = fsg_unbind; | 3586 | fsg->function.unbind = fsg_unbind; |
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index 6316aa5b1c49..ad50a67c1465 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b/drivers/usb/gadget/function/f_midi.c | |||
@@ -1145,7 +1145,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) | |||
1145 | if (opts->id && !midi->id) { | 1145 | if (opts->id && !midi->id) { |
1146 | status = -ENOMEM; | 1146 | status = -ENOMEM; |
1147 | mutex_unlock(&opts->lock); | 1147 | mutex_unlock(&opts->lock); |
1148 | goto kstrdup_fail; | 1148 | goto setup_fail; |
1149 | } | 1149 | } |
1150 | midi->in_ports = opts->in_ports; | 1150 | midi->in_ports = opts->in_ports; |
1151 | midi->out_ports = opts->out_ports; | 1151 | midi->out_ports = opts->out_ports; |
@@ -1164,8 +1164,6 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) | |||
1164 | 1164 | ||
1165 | return &midi->func; | 1165 | return &midi->func; |
1166 | 1166 | ||
1167 | kstrdup_fail: | ||
1168 | f_midi_unregister_card(midi); | ||
1169 | setup_fail: | 1167 | setup_fail: |
1170 | for (--i; i >= 0; i--) | 1168 | for (--i; i >= 0; i--) |
1171 | kfree(midi->in_port[i]); | 1169 | kfree(midi->in_port[i]); |
diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c index e547ea7f56b1..1137e3384218 100644 --- a/drivers/usb/gadget/udc/fotg210-udc.c +++ b/drivers/usb/gadget/udc/fotg210-udc.c | |||
@@ -1171,7 +1171,7 @@ static int fotg210_udc_probe(struct platform_device *pdev) | |||
1171 | udc_name, fotg210); | 1171 | udc_name, fotg210); |
1172 | if (ret < 0) { | 1172 | if (ret < 0) { |
1173 | pr_err("request_irq error (%d)\n", ret); | 1173 | pr_err("request_irq error (%d)\n", ret); |
1174 | goto err_irq; | 1174 | goto err_req; |
1175 | } | 1175 | } |
1176 | 1176 | ||
1177 | ret = usb_add_gadget_udc(&pdev->dev, &fotg210->gadget); | 1177 | ret = usb_add_gadget_udc(&pdev->dev, &fotg210->gadget); |
@@ -1183,7 +1183,6 @@ static int fotg210_udc_probe(struct platform_device *pdev) | |||
1183 | return 0; | 1183 | return 0; |
1184 | 1184 | ||
1185 | err_add_udc: | 1185 | err_add_udc: |
1186 | err_irq: | ||
1187 | free_irq(ires->start, fotg210); | 1186 | free_irq(ires->start, fotg210); |
1188 | 1187 | ||
1189 | err_req: | 1188 | err_req: |
diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c index d32160d6463f..5da37c957b53 100644 --- a/drivers/usb/gadget/udc/mv_udc_core.c +++ b/drivers/usb/gadget/udc/mv_udc_core.c | |||
@@ -2167,7 +2167,7 @@ static int mv_udc_probe(struct platform_device *pdev) | |||
2167 | return -ENODEV; | 2167 | return -ENODEV; |
2168 | } | 2168 | } |
2169 | 2169 | ||
2170 | udc->phy_regs = ioremap(r->start, resource_size(r)); | 2170 | udc->phy_regs = devm_ioremap(&pdev->dev, r->start, resource_size(r)); |
2171 | if (udc->phy_regs == NULL) { | 2171 | if (udc->phy_regs == NULL) { |
2172 | dev_err(&pdev->dev, "failed to map phy I/O memory\n"); | 2172 | dev_err(&pdev->dev, "failed to map phy I/O memory\n"); |
2173 | return -EBUSY; | 2173 | return -EBUSY; |
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index d69c35558f68..362ee8af5fce 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c | |||
@@ -60,13 +60,15 @@ static DEFINE_MUTEX(udc_lock); | |||
60 | int usb_gadget_map_request(struct usb_gadget *gadget, | 60 | int usb_gadget_map_request(struct usb_gadget *gadget, |
61 | struct usb_request *req, int is_in) | 61 | struct usb_request *req, int is_in) |
62 | { | 62 | { |
63 | struct device *dev = gadget->dev.parent; | ||
64 | |||
63 | if (req->length == 0) | 65 | if (req->length == 0) |
64 | return 0; | 66 | return 0; |
65 | 67 | ||
66 | if (req->num_sgs) { | 68 | if (req->num_sgs) { |
67 | int mapped; | 69 | int mapped; |
68 | 70 | ||
69 | mapped = dma_map_sg(&gadget->dev, req->sg, req->num_sgs, | 71 | mapped = dma_map_sg(dev, req->sg, req->num_sgs, |
70 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 72 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
71 | if (mapped == 0) { | 73 | if (mapped == 0) { |
72 | dev_err(&gadget->dev, "failed to map SGs\n"); | 74 | dev_err(&gadget->dev, "failed to map SGs\n"); |
@@ -75,11 +77,11 @@ int usb_gadget_map_request(struct usb_gadget *gadget, | |||
75 | 77 | ||
76 | req->num_mapped_sgs = mapped; | 78 | req->num_mapped_sgs = mapped; |
77 | } else { | 79 | } else { |
78 | req->dma = dma_map_single(&gadget->dev, req->buf, req->length, | 80 | req->dma = dma_map_single(dev, req->buf, req->length, |
79 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 81 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
80 | 82 | ||
81 | if (dma_mapping_error(&gadget->dev, req->dma)) { | 83 | if (dma_mapping_error(dev, req->dma)) { |
82 | dev_err(&gadget->dev, "failed to map buffer\n"); | 84 | dev_err(dev, "failed to map buffer\n"); |
83 | return -EFAULT; | 85 | return -EFAULT; |
84 | } | 86 | } |
85 | } | 87 | } |
@@ -95,12 +97,12 @@ void usb_gadget_unmap_request(struct usb_gadget *gadget, | |||
95 | return; | 97 | return; |
96 | 98 | ||
97 | if (req->num_mapped_sgs) { | 99 | if (req->num_mapped_sgs) { |
98 | dma_unmap_sg(&gadget->dev, req->sg, req->num_mapped_sgs, | 100 | dma_unmap_sg(gadget->dev.parent, req->sg, req->num_mapped_sgs, |
99 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 101 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
100 | 102 | ||
101 | req->num_mapped_sgs = 0; | 103 | req->num_mapped_sgs = 0; |
102 | } else { | 104 | } else { |
103 | dma_unmap_single(&gadget->dev, req->dma, req->length, | 105 | dma_unmap_single(gadget->dev.parent, req->dma, req->length, |
104 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 106 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
105 | } | 107 | } |
106 | } | 108 | } |
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c index f7d561ed3c23..d029bbe9eb36 100644 --- a/drivers/usb/host/ohci-q.c +++ b/drivers/usb/host/ohci-q.c | |||
@@ -981,10 +981,6 @@ rescan_all: | |||
981 | int completed, modified; | 981 | int completed, modified; |
982 | __hc32 *prev; | 982 | __hc32 *prev; |
983 | 983 | ||
984 | /* Is this ED already invisible to the hardware? */ | ||
985 | if (ed->state == ED_IDLE) | ||
986 | goto ed_idle; | ||
987 | |||
988 | /* only take off EDs that the HC isn't using, accounting for | 984 | /* only take off EDs that the HC isn't using, accounting for |
989 | * frame counter wraps and EDs with partially retired TDs | 985 | * frame counter wraps and EDs with partially retired TDs |
990 | */ | 986 | */ |
@@ -1012,12 +1008,10 @@ skip_ed: | |||
1012 | } | 1008 | } |
1013 | 1009 | ||
1014 | /* ED's now officially unlinked, hc doesn't see */ | 1010 | /* ED's now officially unlinked, hc doesn't see */ |
1015 | ed->state = ED_IDLE; | ||
1016 | ed->hwHeadP &= ~cpu_to_hc32(ohci, ED_H); | 1011 | ed->hwHeadP &= ~cpu_to_hc32(ohci, ED_H); |
1017 | ed->hwNextED = 0; | 1012 | ed->hwNextED = 0; |
1018 | wmb(); | 1013 | wmb(); |
1019 | ed->hwINFO &= ~cpu_to_hc32(ohci, ED_SKIP | ED_DEQUEUE); | 1014 | ed->hwINFO &= ~cpu_to_hc32(ohci, ED_SKIP | ED_DEQUEUE); |
1020 | ed_idle: | ||
1021 | 1015 | ||
1022 | /* reentrancy: if we drop the schedule lock, someone might | 1016 | /* reentrancy: if we drop the schedule lock, someone might |
1023 | * have modified this list. normally it's just prepending | 1017 | * have modified this list. normally it's just prepending |
@@ -1088,6 +1082,7 @@ rescan_this: | |||
1088 | if (list_empty(&ed->td_list)) { | 1082 | if (list_empty(&ed->td_list)) { |
1089 | *last = ed->ed_next; | 1083 | *last = ed->ed_next; |
1090 | ed->ed_next = NULL; | 1084 | ed->ed_next = NULL; |
1085 | ed->state = ED_IDLE; | ||
1091 | list_del(&ed->in_use_list); | 1086 | list_del(&ed->in_use_list); |
1092 | } else if (ohci->rh_state == OHCI_RH_RUNNING) { | 1087 | } else if (ohci->rh_state == OHCI_RH_RUNNING) { |
1093 | *last = ed->ed_next; | 1088 | *last = ed->ed_next; |
diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c index e9a6eec39142..cfcfadfc94fc 100644 --- a/drivers/usb/host/ohci-tmio.c +++ b/drivers/usb/host/ohci-tmio.c | |||
@@ -58,7 +58,7 @@ | |||
58 | #define CCR_PM_CKRNEN 0x0002 | 58 | #define CCR_PM_CKRNEN 0x0002 |
59 | #define CCR_PM_USBPW1 0x0004 | 59 | #define CCR_PM_USBPW1 0x0004 |
60 | #define CCR_PM_USBPW2 0x0008 | 60 | #define CCR_PM_USBPW2 0x0008 |
61 | #define CCR_PM_USBPW3 0x0008 | 61 | #define CCR_PM_USBPW3 0x0010 |
62 | #define CCR_PM_PMEE 0x0100 | 62 | #define CCR_PM_PMEE 0x0100 |
63 | #define CCR_PM_PMES 0x8000 | 63 | #define CCR_PM_PMES 0x8000 |
64 | 64 | ||
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index e75c565feb53..78241b5550df 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -484,10 +484,13 @@ static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci, | |||
484 | u32 pls = status_reg & PORT_PLS_MASK; | 484 | u32 pls = status_reg & PORT_PLS_MASK; |
485 | 485 | ||
486 | /* resume state is a xHCI internal state. | 486 | /* resume state is a xHCI internal state. |
487 | * Do not report it to usb core. | 487 | * Do not report it to usb core, instead, pretend to be U3, |
488 | * thus usb core knows it's not ready for transfer | ||
488 | */ | 489 | */ |
489 | if (pls == XDEV_RESUME) | 490 | if (pls == XDEV_RESUME) { |
491 | *status |= USB_SS_PORT_LS_U3; | ||
490 | return; | 492 | return; |
493 | } | ||
491 | 494 | ||
492 | /* When the CAS bit is set then warm reset | 495 | /* When the CAS bit is set then warm reset |
493 | * should be performed on port | 496 | * should be performed on port |
@@ -588,7 +591,14 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, | |||
588 | status |= USB_PORT_STAT_C_RESET << 16; | 591 | status |= USB_PORT_STAT_C_RESET << 16; |
589 | /* USB3.0 only */ | 592 | /* USB3.0 only */ |
590 | if (hcd->speed == HCD_USB3) { | 593 | if (hcd->speed == HCD_USB3) { |
591 | if ((raw_port_status & PORT_PLC)) | 594 | /* Port link change with port in resume state should not be |
595 | * reported to usbcore, as this is an internal state to be | ||
596 | * handled by xhci driver. Reporting PLC to usbcore may | ||
597 | * cause usbcore clearing PLC first and port change event | ||
598 | * irq won't be generated. | ||
599 | */ | ||
600 | if ((raw_port_status & PORT_PLC) && | ||
601 | (raw_port_status & PORT_PLS_MASK) != XDEV_RESUME) | ||
592 | status |= USB_PORT_STAT_C_LINK_STATE << 16; | 602 | status |= USB_PORT_STAT_C_LINK_STATE << 16; |
593 | if ((raw_port_status & PORT_WRC)) | 603 | if ((raw_port_status & PORT_WRC)) |
594 | status |= USB_PORT_STAT_C_BH_RESET << 16; | 604 | status |= USB_PORT_STAT_C_BH_RESET << 16; |
@@ -1120,10 +1130,10 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | |||
1120 | spin_lock_irqsave(&xhci->lock, flags); | 1130 | spin_lock_irqsave(&xhci->lock, flags); |
1121 | 1131 | ||
1122 | if (hcd->self.root_hub->do_remote_wakeup) { | 1132 | if (hcd->self.root_hub->do_remote_wakeup) { |
1123 | if (bus_state->resuming_ports) { | 1133 | if (bus_state->resuming_ports || /* USB2 */ |
1134 | bus_state->port_remote_wakeup) { /* USB3 */ | ||
1124 | spin_unlock_irqrestore(&xhci->lock, flags); | 1135 | spin_unlock_irqrestore(&xhci->lock, flags); |
1125 | xhci_dbg(xhci, "suspend failed because " | 1136 | xhci_dbg(xhci, "suspend failed because a port is resuming\n"); |
1126 | "a port is resuming\n"); | ||
1127 | return -EBUSY; | 1137 | return -EBUSY; |
1128 | } | 1138 | } |
1129 | } | 1139 | } |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index f8336408ef07..3e442f77a2b9 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -1427,10 +1427,10 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, | |||
1427 | /* Attempt to use the ring cache */ | 1427 | /* Attempt to use the ring cache */ |
1428 | if (virt_dev->num_rings_cached == 0) | 1428 | if (virt_dev->num_rings_cached == 0) |
1429 | return -ENOMEM; | 1429 | return -ENOMEM; |
1430 | virt_dev->num_rings_cached--; | ||
1430 | virt_dev->eps[ep_index].new_ring = | 1431 | virt_dev->eps[ep_index].new_ring = |
1431 | virt_dev->ring_cache[virt_dev->num_rings_cached]; | 1432 | virt_dev->ring_cache[virt_dev->num_rings_cached]; |
1432 | virt_dev->ring_cache[virt_dev->num_rings_cached] = NULL; | 1433 | virt_dev->ring_cache[virt_dev->num_rings_cached] = NULL; |
1433 | virt_dev->num_rings_cached--; | ||
1434 | xhci_reinit_cached_ring(xhci, virt_dev->eps[ep_index].new_ring, | 1434 | xhci_reinit_cached_ring(xhci, virt_dev->eps[ep_index].new_ring, |
1435 | 1, type); | 1435 | 1, type); |
1436 | } | 1436 | } |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 4a4cb1d91ac8..5590eac2b22d 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -23,10 +23,15 @@ | |||
23 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/acpi.h> | ||
26 | 27 | ||
27 | #include "xhci.h" | 28 | #include "xhci.h" |
28 | #include "xhci-trace.h" | 29 | #include "xhci-trace.h" |
29 | 30 | ||
31 | #define PORT2_SSIC_CONFIG_REG2 0x883c | ||
32 | #define PROG_DONE (1 << 30) | ||
33 | #define SSIC_PORT_UNUSED (1 << 31) | ||
34 | |||
30 | /* Device for a quirk */ | 35 | /* Device for a quirk */ |
31 | #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 | 36 | #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 |
32 | #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 | 37 | #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 |
@@ -176,20 +181,63 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
176 | } | 181 | } |
177 | 182 | ||
178 | /* | 183 | /* |
184 | * In some Intel xHCI controllers, in order to get D3 working, | ||
185 | * through a vendor specific SSIC CONFIG register at offset 0x883c, | ||
186 | * SSIC PORT need to be marked as "unused" before putting xHCI | ||
187 | * into D3. After D3 exit, the SSIC port need to be marked as "used". | ||
188 | * Without this change, xHCI might not enter D3 state. | ||
179 | * Make sure PME works on some Intel xHCI controllers by writing 1 to clear | 189 | * Make sure PME works on some Intel xHCI controllers by writing 1 to clear |
180 | * the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4 | 190 | * the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4 |
181 | */ | 191 | */ |
182 | static void xhci_pme_quirk(struct xhci_hcd *xhci) | 192 | static void xhci_pme_quirk(struct usb_hcd *hcd, bool suspend) |
183 | { | 193 | { |
194 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | ||
195 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | ||
184 | u32 val; | 196 | u32 val; |
185 | void __iomem *reg; | 197 | void __iomem *reg; |
186 | 198 | ||
199 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | ||
200 | pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI) { | ||
201 | |||
202 | reg = (void __iomem *) xhci->cap_regs + PORT2_SSIC_CONFIG_REG2; | ||
203 | |||
204 | /* Notify SSIC that SSIC profile programming is not done */ | ||
205 | val = readl(reg) & ~PROG_DONE; | ||
206 | writel(val, reg); | ||
207 | |||
208 | /* Mark SSIC port as unused(suspend) or used(resume) */ | ||
209 | val = readl(reg); | ||
210 | if (suspend) | ||
211 | val |= SSIC_PORT_UNUSED; | ||
212 | else | ||
213 | val &= ~SSIC_PORT_UNUSED; | ||
214 | writel(val, reg); | ||
215 | |||
216 | /* Notify SSIC that SSIC profile programming is done */ | ||
217 | val = readl(reg) | PROG_DONE; | ||
218 | writel(val, reg); | ||
219 | readl(reg); | ||
220 | } | ||
221 | |||
187 | reg = (void __iomem *) xhci->cap_regs + 0x80a4; | 222 | reg = (void __iomem *) xhci->cap_regs + 0x80a4; |
188 | val = readl(reg); | 223 | val = readl(reg); |
189 | writel(val | BIT(28), reg); | 224 | writel(val | BIT(28), reg); |
190 | readl(reg); | 225 | readl(reg); |
191 | } | 226 | } |
192 | 227 | ||
228 | #ifdef CONFIG_ACPI | ||
229 | static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) | ||
230 | { | ||
231 | static const u8 intel_dsm_uuid[] = { | ||
232 | 0xb7, 0x0c, 0x34, 0xac, 0x01, 0xe9, 0xbf, 0x45, | ||
233 | 0xb7, 0xe6, 0x2b, 0x34, 0xec, 0x93, 0x1e, 0x23, | ||
234 | }; | ||
235 | acpi_evaluate_dsm(ACPI_HANDLE(&dev->dev), intel_dsm_uuid, 3, 1, NULL); | ||
236 | } | ||
237 | #else | ||
238 | static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) { } | ||
239 | #endif /* CONFIG_ACPI */ | ||
240 | |||
193 | /* called during probe() after chip reset completes */ | 241 | /* called during probe() after chip reset completes */ |
194 | static int xhci_pci_setup(struct usb_hcd *hcd) | 242 | static int xhci_pci_setup(struct usb_hcd *hcd) |
195 | { | 243 | { |
@@ -263,6 +311,9 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
263 | HCC_MAX_PSA(xhci->hcc_params) >= 4) | 311 | HCC_MAX_PSA(xhci->hcc_params) >= 4) |
264 | xhci->shared_hcd->can_do_streams = 1; | 312 | xhci->shared_hcd->can_do_streams = 1; |
265 | 313 | ||
314 | if (xhci->quirks & XHCI_PME_STUCK_QUIRK) | ||
315 | xhci_pme_acpi_rtd3_enable(dev); | ||
316 | |||
266 | /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ | 317 | /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ |
267 | pm_runtime_put_noidle(&dev->dev); | 318 | pm_runtime_put_noidle(&dev->dev); |
268 | 319 | ||
@@ -307,7 +358,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) | |||
307 | pdev->no_d3cold = true; | 358 | pdev->no_d3cold = true; |
308 | 359 | ||
309 | if (xhci->quirks & XHCI_PME_STUCK_QUIRK) | 360 | if (xhci->quirks & XHCI_PME_STUCK_QUIRK) |
310 | xhci_pme_quirk(xhci); | 361 | xhci_pme_quirk(hcd, true); |
311 | 362 | ||
312 | return xhci_suspend(xhci, do_wakeup); | 363 | return xhci_suspend(xhci, do_wakeup); |
313 | } | 364 | } |
@@ -340,7 +391,7 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) | |||
340 | usb_enable_intel_xhci_ports(pdev); | 391 | usb_enable_intel_xhci_ports(pdev); |
341 | 392 | ||
342 | if (xhci->quirks & XHCI_PME_STUCK_QUIRK) | 393 | if (xhci->quirks & XHCI_PME_STUCK_QUIRK) |
343 | xhci_pme_quirk(xhci); | 394 | xhci_pme_quirk(hcd, false); |
344 | 395 | ||
345 | retval = xhci_resume(xhci, hibernated); | 396 | retval = xhci_resume(xhci, hibernated); |
346 | return retval; | 397 | return retval; |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 94416ff70810..6a8fc52aed58 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1546,6 +1546,9 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
1546 | usb_hcd_resume_root_hub(hcd); | 1546 | usb_hcd_resume_root_hub(hcd); |
1547 | } | 1547 | } |
1548 | 1548 | ||
1549 | if (hcd->speed == HCD_USB3 && (temp & PORT_PLS_MASK) == XDEV_INACTIVE) | ||
1550 | bus_state->port_remote_wakeup &= ~(1 << faked_port_index); | ||
1551 | |||
1549 | if ((temp & PORT_PLC) && (temp & PORT_PLS_MASK) == XDEV_RESUME) { | 1552 | if ((temp & PORT_PLC) && (temp & PORT_PLS_MASK) == XDEV_RESUME) { |
1550 | xhci_dbg(xhci, "port resume event for port %d\n", port_id); | 1553 | xhci_dbg(xhci, "port resume event for port %d\n", port_id); |
1551 | 1554 | ||
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 7da0d6043d33..526ebc0c7e72 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -3453,6 +3453,9 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
3453 | return -EINVAL; | 3453 | return -EINVAL; |
3454 | } | 3454 | } |
3455 | 3455 | ||
3456 | if (virt_dev->tt_info) | ||
3457 | old_active_eps = virt_dev->tt_info->active_eps; | ||
3458 | |||
3456 | if (virt_dev->udev != udev) { | 3459 | if (virt_dev->udev != udev) { |
3457 | /* If the virt_dev and the udev does not match, this virt_dev | 3460 | /* If the virt_dev and the udev does not match, this virt_dev |
3458 | * may belong to another udev. | 3461 | * may belong to another udev. |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 31e46cc55807..ed2ebf647c38 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -285,6 +285,7 @@ struct xhci_op_regs { | |||
285 | #define XDEV_U0 (0x0 << 5) | 285 | #define XDEV_U0 (0x0 << 5) |
286 | #define XDEV_U2 (0x2 << 5) | 286 | #define XDEV_U2 (0x2 << 5) |
287 | #define XDEV_U3 (0x3 << 5) | 287 | #define XDEV_U3 (0x3 << 5) |
288 | #define XDEV_INACTIVE (0x6 << 5) | ||
288 | #define XDEV_RESUME (0xf << 5) | 289 | #define XDEV_RESUME (0xf << 5) |
289 | /* true: port has power (see HCC_PPC) */ | 290 | /* true: port has power (see HCC_PPC) */ |
290 | #define PORT_POWER (1 << 9) | 291 | #define PORT_POWER (1 << 9) |
diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c index 30842bc195f5..92d5f718659b 100644 --- a/drivers/usb/musb/musb_virthub.c +++ b/drivers/usb/musb/musb_virthub.c | |||
@@ -275,9 +275,7 @@ static int musb_has_gadget(struct musb *musb) | |||
275 | #ifdef CONFIG_USB_MUSB_HOST | 275 | #ifdef CONFIG_USB_MUSB_HOST |
276 | return 1; | 276 | return 1; |
277 | #else | 277 | #else |
278 | if (musb->port_mode == MUSB_PORT_MODE_HOST) | 278 | return musb->port_mode == MUSB_PORT_MODE_HOST; |
279 | return 1; | ||
280 | return musb->g.dev.driver != NULL; | ||
281 | #endif | 279 | #endif |
282 | } | 280 | } |
283 | 281 | ||
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 8f7cb068d29b..3fcc0483a081 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c | |||
@@ -217,6 +217,9 @@ static bool mxs_phy_get_vbus_status(struct mxs_phy *mxs_phy) | |||
217 | { | 217 | { |
218 | unsigned int vbus_value; | 218 | unsigned int vbus_value; |
219 | 219 | ||
220 | if (!mxs_phy->regmap_anatop) | ||
221 | return false; | ||
222 | |||
220 | if (mxs_phy->port_id == 0) | 223 | if (mxs_phy->port_id == 0) |
221 | regmap_read(mxs_phy->regmap_anatop, | 224 | regmap_read(mxs_phy->regmap_anatop, |
222 | ANADIG_USB1_VBUS_DET_STAT, | 225 | ANADIG_USB1_VBUS_DET_STAT, |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index ffd739e31bfc..eac7ccaa3c85 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -187,6 +187,7 @@ static const struct usb_device_id id_table[] = { | |||
187 | { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */ | 187 | { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */ |
188 | { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */ | 188 | { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */ |
189 | { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */ | 189 | { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */ |
190 | { USB_DEVICE(0x2626, 0xEA60) }, /* Aruba Networks 7xxx USB Serial Console */ | ||
190 | { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ | 191 | { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ |
191 | { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ | 192 | { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ |
192 | { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ | 193 | { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ |
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 4f70df33975a..78b4f64c6b00 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -121,26 +121,26 @@ static DEFINE_SPINLOCK(release_lock); | |||
121 | static const unsigned int dummy; /* for clarity in register access fns */ | 121 | static const unsigned int dummy; /* for clarity in register access fns */ |
122 | 122 | ||
123 | enum mos_regs { | 123 | enum mos_regs { |
124 | THR, /* serial port regs */ | 124 | MOS7720_THR, /* serial port regs */ |
125 | RHR, | 125 | MOS7720_RHR, |
126 | IER, | 126 | MOS7720_IER, |
127 | FCR, | 127 | MOS7720_FCR, |
128 | ISR, | 128 | MOS7720_ISR, |
129 | LCR, | 129 | MOS7720_LCR, |
130 | MCR, | 130 | MOS7720_MCR, |
131 | LSR, | 131 | MOS7720_LSR, |
132 | MSR, | 132 | MOS7720_MSR, |
133 | SPR, | 133 | MOS7720_SPR, |
134 | DLL, | 134 | MOS7720_DLL, |
135 | DLM, | 135 | MOS7720_DLM, |
136 | DPR, /* parallel port regs */ | 136 | MOS7720_DPR, /* parallel port regs */ |
137 | DSR, | 137 | MOS7720_DSR, |
138 | DCR, | 138 | MOS7720_DCR, |
139 | ECR, | 139 | MOS7720_ECR, |
140 | SP1_REG, /* device control regs */ | 140 | MOS7720_SP1_REG, /* device control regs */ |
141 | SP2_REG, /* serial port 2 (7720 only) */ | 141 | MOS7720_SP2_REG, /* serial port 2 (7720 only) */ |
142 | PP_REG, | 142 | MOS7720_PP_REG, |
143 | SP_CONTROL_REG, | 143 | MOS7720_SP_CONTROL_REG, |
144 | }; | 144 | }; |
145 | 145 | ||
146 | /* | 146 | /* |
@@ -150,26 +150,26 @@ enum mos_regs { | |||
150 | static inline __u16 get_reg_index(enum mos_regs reg) | 150 | static inline __u16 get_reg_index(enum mos_regs reg) |
151 | { | 151 | { |
152 | static const __u16 mos7715_index_lookup_table[] = { | 152 | static const __u16 mos7715_index_lookup_table[] = { |
153 | 0x00, /* THR */ | 153 | 0x00, /* MOS7720_THR */ |
154 | 0x00, /* RHR */ | 154 | 0x00, /* MOS7720_RHR */ |
155 | 0x01, /* IER */ | 155 | 0x01, /* MOS7720_IER */ |
156 | 0x02, /* FCR */ | 156 | 0x02, /* MOS7720_FCR */ |
157 | 0x02, /* ISR */ | 157 | 0x02, /* MOS7720_ISR */ |
158 | 0x03, /* LCR */ | 158 | 0x03, /* MOS7720_LCR */ |
159 | 0x04, /* MCR */ | 159 | 0x04, /* MOS7720_MCR */ |
160 | 0x05, /* LSR */ | 160 | 0x05, /* MOS7720_LSR */ |
161 | 0x06, /* MSR */ | 161 | 0x06, /* MOS7720_MSR */ |
162 | 0x07, /* SPR */ | 162 | 0x07, /* MOS7720_SPR */ |
163 | 0x00, /* DLL */ | 163 | 0x00, /* MOS7720_DLL */ |
164 | 0x01, /* DLM */ | 164 | 0x01, /* MOS7720_DLM */ |
165 | 0x00, /* DPR */ | 165 | 0x00, /* MOS7720_DPR */ |
166 | 0x01, /* DSR */ | 166 | 0x01, /* MOS7720_DSR */ |
167 | 0x02, /* DCR */ | 167 | 0x02, /* MOS7720_DCR */ |
168 | 0x0a, /* ECR */ | 168 | 0x0a, /* MOS7720_ECR */ |
169 | 0x01, /* SP1_REG */ | 169 | 0x01, /* MOS7720_SP1_REG */ |
170 | 0x02, /* SP2_REG (7720 only) */ | 170 | 0x02, /* MOS7720_SP2_REG (7720 only) */ |
171 | 0x04, /* PP_REG (7715 only) */ | 171 | 0x04, /* MOS7720_PP_REG (7715 only) */ |
172 | 0x08, /* SP_CONTROL_REG */ | 172 | 0x08, /* MOS7720_SP_CONTROL_REG */ |
173 | }; | 173 | }; |
174 | return mos7715_index_lookup_table[reg]; | 174 | return mos7715_index_lookup_table[reg]; |
175 | } | 175 | } |
@@ -181,10 +181,10 @@ static inline __u16 get_reg_index(enum mos_regs reg) | |||
181 | static inline __u16 get_reg_value(enum mos_regs reg, | 181 | static inline __u16 get_reg_value(enum mos_regs reg, |
182 | unsigned int serial_portnum) | 182 | unsigned int serial_portnum) |
183 | { | 183 | { |
184 | if (reg >= SP1_REG) /* control reg */ | 184 | if (reg >= MOS7720_SP1_REG) /* control reg */ |
185 | return 0x0000; | 185 | return 0x0000; |
186 | 186 | ||
187 | else if (reg >= DPR) /* parallel port reg (7715 only) */ | 187 | else if (reg >= MOS7720_DPR) /* parallel port reg (7715 only) */ |
188 | return 0x0100; | 188 | return 0x0100; |
189 | 189 | ||
190 | else /* serial port reg */ | 190 | else /* serial port reg */ |
@@ -252,7 +252,8 @@ static inline int mos7715_change_mode(struct mos7715_parport *mos_parport, | |||
252 | enum mos7715_pp_modes mode) | 252 | enum mos7715_pp_modes mode) |
253 | { | 253 | { |
254 | mos_parport->shadowECR = mode; | 254 | mos_parport->shadowECR = mode; |
255 | write_mos_reg(mos_parport->serial, dummy, ECR, mos_parport->shadowECR); | 255 | write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR, |
256 | mos_parport->shadowECR); | ||
256 | return 0; | 257 | return 0; |
257 | } | 258 | } |
258 | 259 | ||
@@ -486,7 +487,7 @@ static void parport_mos7715_write_data(struct parport *pp, unsigned char d) | |||
486 | if (parport_prologue(pp) < 0) | 487 | if (parport_prologue(pp) < 0) |
487 | return; | 488 | return; |
488 | mos7715_change_mode(mos_parport, SPP); | 489 | mos7715_change_mode(mos_parport, SPP); |
489 | write_mos_reg(mos_parport->serial, dummy, DPR, (__u8)d); | 490 | write_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, (__u8)d); |
490 | parport_epilogue(pp); | 491 | parport_epilogue(pp); |
491 | } | 492 | } |
492 | 493 | ||
@@ -497,7 +498,7 @@ static unsigned char parport_mos7715_read_data(struct parport *pp) | |||
497 | 498 | ||
498 | if (parport_prologue(pp) < 0) | 499 | if (parport_prologue(pp) < 0) |
499 | return 0; | 500 | return 0; |
500 | read_mos_reg(mos_parport->serial, dummy, DPR, &d); | 501 | read_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, &d); |
501 | parport_epilogue(pp); | 502 | parport_epilogue(pp); |
502 | return d; | 503 | return d; |
503 | } | 504 | } |
@@ -510,7 +511,7 @@ static void parport_mos7715_write_control(struct parport *pp, unsigned char d) | |||
510 | if (parport_prologue(pp) < 0) | 511 | if (parport_prologue(pp) < 0) |
511 | return; | 512 | return; |
512 | data = ((__u8)d & 0x0f) | (mos_parport->shadowDCR & 0xf0); | 513 | data = ((__u8)d & 0x0f) | (mos_parport->shadowDCR & 0xf0); |
513 | write_mos_reg(mos_parport->serial, dummy, DCR, data); | 514 | write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, data); |
514 | mos_parport->shadowDCR = data; | 515 | mos_parport->shadowDCR = data; |
515 | parport_epilogue(pp); | 516 | parport_epilogue(pp); |
516 | } | 517 | } |
@@ -543,7 +544,8 @@ static unsigned char parport_mos7715_frob_control(struct parport *pp, | |||
543 | if (parport_prologue(pp) < 0) | 544 | if (parport_prologue(pp) < 0) |
544 | return 0; | 545 | return 0; |
545 | mos_parport->shadowDCR = (mos_parport->shadowDCR & (~mask)) ^ val; | 546 | mos_parport->shadowDCR = (mos_parport->shadowDCR & (~mask)) ^ val; |
546 | write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR); | 547 | write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, |
548 | mos_parport->shadowDCR); | ||
547 | dcr = mos_parport->shadowDCR & 0x0f; | 549 | dcr = mos_parport->shadowDCR & 0x0f; |
548 | parport_epilogue(pp); | 550 | parport_epilogue(pp); |
549 | return dcr; | 551 | return dcr; |
@@ -581,7 +583,8 @@ static void parport_mos7715_data_forward(struct parport *pp) | |||
581 | return; | 583 | return; |
582 | mos7715_change_mode(mos_parport, PS2); | 584 | mos7715_change_mode(mos_parport, PS2); |
583 | mos_parport->shadowDCR &= ~0x20; | 585 | mos_parport->shadowDCR &= ~0x20; |
584 | write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR); | 586 | write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, |
587 | mos_parport->shadowDCR); | ||
585 | parport_epilogue(pp); | 588 | parport_epilogue(pp); |
586 | } | 589 | } |
587 | 590 | ||
@@ -593,7 +596,8 @@ static void parport_mos7715_data_reverse(struct parport *pp) | |||
593 | return; | 596 | return; |
594 | mos7715_change_mode(mos_parport, PS2); | 597 | mos7715_change_mode(mos_parport, PS2); |
595 | mos_parport->shadowDCR |= 0x20; | 598 | mos_parport->shadowDCR |= 0x20; |
596 | write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR); | 599 | write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, |
600 | mos_parport->shadowDCR); | ||
597 | parport_epilogue(pp); | 601 | parport_epilogue(pp); |
598 | } | 602 | } |
599 | 603 | ||
@@ -633,8 +637,10 @@ static void parport_mos7715_restore_state(struct parport *pp, | |||
633 | spin_unlock(&release_lock); | 637 | spin_unlock(&release_lock); |
634 | return; | 638 | return; |
635 | } | 639 | } |
636 | write_parport_reg_nonblock(mos_parport, DCR, mos_parport->shadowDCR); | 640 | write_parport_reg_nonblock(mos_parport, MOS7720_DCR, |
637 | write_parport_reg_nonblock(mos_parport, ECR, mos_parport->shadowECR); | 641 | mos_parport->shadowDCR); |
642 | write_parport_reg_nonblock(mos_parport, MOS7720_ECR, | ||
643 | mos_parport->shadowECR); | ||
638 | spin_unlock(&release_lock); | 644 | spin_unlock(&release_lock); |
639 | } | 645 | } |
640 | 646 | ||
@@ -714,14 +720,16 @@ static int mos7715_parport_init(struct usb_serial *serial) | |||
714 | init_completion(&mos_parport->syncmsg_compl); | 720 | init_completion(&mos_parport->syncmsg_compl); |
715 | 721 | ||
716 | /* cycle parallel port reset bit */ | 722 | /* cycle parallel port reset bit */ |
717 | write_mos_reg(mos_parport->serial, dummy, PP_REG, (__u8)0x80); | 723 | write_mos_reg(mos_parport->serial, dummy, MOS7720_PP_REG, (__u8)0x80); |
718 | write_mos_reg(mos_parport->serial, dummy, PP_REG, (__u8)0x00); | 724 | write_mos_reg(mos_parport->serial, dummy, MOS7720_PP_REG, (__u8)0x00); |
719 | 725 | ||
720 | /* initialize device registers */ | 726 | /* initialize device registers */ |
721 | mos_parport->shadowDCR = DCR_INIT_VAL; | 727 | mos_parport->shadowDCR = DCR_INIT_VAL; |
722 | write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR); | 728 | write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, |
729 | mos_parport->shadowDCR); | ||
723 | mos_parport->shadowECR = ECR_INIT_VAL; | 730 | mos_parport->shadowECR = ECR_INIT_VAL; |
724 | write_mos_reg(mos_parport->serial, dummy, ECR, mos_parport->shadowECR); | 731 | write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR, |
732 | mos_parport->shadowECR); | ||
725 | 733 | ||
726 | /* register with parport core */ | 734 | /* register with parport core */ |
727 | mos_parport->pp = parport_register_port(0, PARPORT_IRQ_NONE, | 735 | mos_parport->pp = parport_register_port(0, PARPORT_IRQ_NONE, |
@@ -1033,45 +1041,49 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1033 | /* Initialize MCS7720 -- Write Init values to corresponding Registers | 1041 | /* Initialize MCS7720 -- Write Init values to corresponding Registers |
1034 | * | 1042 | * |
1035 | * Register Index | 1043 | * Register Index |
1036 | * 0 : THR/RHR | 1044 | * 0 : MOS7720_THR/MOS7720_RHR |
1037 | * 1 : IER | 1045 | * 1 : MOS7720_IER |
1038 | * 2 : FCR | 1046 | * 2 : MOS7720_FCR |
1039 | * 3 : LCR | 1047 | * 3 : MOS7720_LCR |
1040 | * 4 : MCR | 1048 | * 4 : MOS7720_MCR |
1041 | * 5 : LSR | 1049 | * 5 : MOS7720_LSR |
1042 | * 6 : MSR | 1050 | * 6 : MOS7720_MSR |
1043 | * 7 : SPR | 1051 | * 7 : MOS7720_SPR |
1044 | * | 1052 | * |
1045 | * 0x08 : SP1/2 Control Reg | 1053 | * 0x08 : SP1/2 Control Reg |
1046 | */ | 1054 | */ |
1047 | port_number = port->port_number; | 1055 | port_number = port->port_number; |
1048 | read_mos_reg(serial, port_number, LSR, &data); | 1056 | read_mos_reg(serial, port_number, MOS7720_LSR, &data); |
1049 | 1057 | ||
1050 | dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data); | 1058 | dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data); |
1051 | 1059 | ||
1052 | write_mos_reg(serial, dummy, SP1_REG, 0x02); | 1060 | write_mos_reg(serial, dummy, MOS7720_SP1_REG, 0x02); |
1053 | write_mos_reg(serial, dummy, SP2_REG, 0x02); | 1061 | write_mos_reg(serial, dummy, MOS7720_SP2_REG, 0x02); |
1054 | 1062 | ||
1055 | write_mos_reg(serial, port_number, IER, 0x00); | 1063 | write_mos_reg(serial, port_number, MOS7720_IER, 0x00); |
1056 | write_mos_reg(serial, port_number, FCR, 0x00); | 1064 | write_mos_reg(serial, port_number, MOS7720_FCR, 0x00); |
1057 | 1065 | ||
1058 | write_mos_reg(serial, port_number, FCR, 0xcf); | 1066 | write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf); |
1059 | mos7720_port->shadowLCR = 0x03; | 1067 | mos7720_port->shadowLCR = 0x03; |
1060 | write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); | 1068 | write_mos_reg(serial, port_number, MOS7720_LCR, |
1069 | mos7720_port->shadowLCR); | ||
1061 | mos7720_port->shadowMCR = 0x0b; | 1070 | mos7720_port->shadowMCR = 0x0b; |
1062 | write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR); | 1071 | write_mos_reg(serial, port_number, MOS7720_MCR, |
1072 | mos7720_port->shadowMCR); | ||
1063 | 1073 | ||
1064 | write_mos_reg(serial, port_number, SP_CONTROL_REG, 0x00); | 1074 | write_mos_reg(serial, port_number, MOS7720_SP_CONTROL_REG, 0x00); |
1065 | read_mos_reg(serial, dummy, SP_CONTROL_REG, &data); | 1075 | read_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, &data); |
1066 | data = data | (port->port_number + 1); | 1076 | data = data | (port->port_number + 1); |
1067 | write_mos_reg(serial, dummy, SP_CONTROL_REG, data); | 1077 | write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, data); |
1068 | mos7720_port->shadowLCR = 0x83; | 1078 | mos7720_port->shadowLCR = 0x83; |
1069 | write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); | 1079 | write_mos_reg(serial, port_number, MOS7720_LCR, |
1070 | write_mos_reg(serial, port_number, THR, 0x0c); | 1080 | mos7720_port->shadowLCR); |
1071 | write_mos_reg(serial, port_number, IER, 0x00); | 1081 | write_mos_reg(serial, port_number, MOS7720_THR, 0x0c); |
1082 | write_mos_reg(serial, port_number, MOS7720_IER, 0x00); | ||
1072 | mos7720_port->shadowLCR = 0x03; | 1083 | mos7720_port->shadowLCR = 0x03; |
1073 | write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); | 1084 | write_mos_reg(serial, port_number, MOS7720_LCR, |
1074 | write_mos_reg(serial, port_number, IER, 0x0c); | 1085 | mos7720_port->shadowLCR); |
1086 | write_mos_reg(serial, port_number, MOS7720_IER, 0x0c); | ||
1075 | 1087 | ||
1076 | response = usb_submit_urb(port->read_urb, GFP_KERNEL); | 1088 | response = usb_submit_urb(port->read_urb, GFP_KERNEL); |
1077 | if (response) | 1089 | if (response) |
@@ -1144,8 +1156,8 @@ static void mos7720_close(struct usb_serial_port *port) | |||
1144 | usb_kill_urb(port->write_urb); | 1156 | usb_kill_urb(port->write_urb); |
1145 | usb_kill_urb(port->read_urb); | 1157 | usb_kill_urb(port->read_urb); |
1146 | 1158 | ||
1147 | write_mos_reg(serial, port->port_number, MCR, 0x00); | 1159 | write_mos_reg(serial, port->port_number, MOS7720_MCR, 0x00); |
1148 | write_mos_reg(serial, port->port_number, IER, 0x00); | 1160 | write_mos_reg(serial, port->port_number, MOS7720_IER, 0x00); |
1149 | 1161 | ||
1150 | mos7720_port->open = 0; | 1162 | mos7720_port->open = 0; |
1151 | } | 1163 | } |
@@ -1169,7 +1181,8 @@ static void mos7720_break(struct tty_struct *tty, int break_state) | |||
1169 | data = mos7720_port->shadowLCR & ~UART_LCR_SBC; | 1181 | data = mos7720_port->shadowLCR & ~UART_LCR_SBC; |
1170 | 1182 | ||
1171 | mos7720_port->shadowLCR = data; | 1183 | mos7720_port->shadowLCR = data; |
1172 | write_mos_reg(serial, port->port_number, LCR, mos7720_port->shadowLCR); | 1184 | write_mos_reg(serial, port->port_number, MOS7720_LCR, |
1185 | mos7720_port->shadowLCR); | ||
1173 | } | 1186 | } |
1174 | 1187 | ||
1175 | /* | 1188 | /* |
@@ -1297,7 +1310,7 @@ static void mos7720_throttle(struct tty_struct *tty) | |||
1297 | /* if we are implementing RTS/CTS, toggle that line */ | 1310 | /* if we are implementing RTS/CTS, toggle that line */ |
1298 | if (tty->termios.c_cflag & CRTSCTS) { | 1311 | if (tty->termios.c_cflag & CRTSCTS) { |
1299 | mos7720_port->shadowMCR &= ~UART_MCR_RTS; | 1312 | mos7720_port->shadowMCR &= ~UART_MCR_RTS; |
1300 | write_mos_reg(port->serial, port->port_number, MCR, | 1313 | write_mos_reg(port->serial, port->port_number, MOS7720_MCR, |
1301 | mos7720_port->shadowMCR); | 1314 | mos7720_port->shadowMCR); |
1302 | } | 1315 | } |
1303 | } | 1316 | } |
@@ -1327,7 +1340,7 @@ static void mos7720_unthrottle(struct tty_struct *tty) | |||
1327 | /* if we are implementing RTS/CTS, toggle that line */ | 1340 | /* if we are implementing RTS/CTS, toggle that line */ |
1328 | if (tty->termios.c_cflag & CRTSCTS) { | 1341 | if (tty->termios.c_cflag & CRTSCTS) { |
1329 | mos7720_port->shadowMCR |= UART_MCR_RTS; | 1342 | mos7720_port->shadowMCR |= UART_MCR_RTS; |
1330 | write_mos_reg(port->serial, port->port_number, MCR, | 1343 | write_mos_reg(port->serial, port->port_number, MOS7720_MCR, |
1331 | mos7720_port->shadowMCR); | 1344 | mos7720_port->shadowMCR); |
1332 | } | 1345 | } |
1333 | } | 1346 | } |
@@ -1352,35 +1365,39 @@ static int set_higher_rates(struct moschip_port *mos7720_port, | |||
1352 | dev_dbg(&port->dev, "Sending Setting Commands ..........\n"); | 1365 | dev_dbg(&port->dev, "Sending Setting Commands ..........\n"); |
1353 | port_number = port->port_number; | 1366 | port_number = port->port_number; |
1354 | 1367 | ||
1355 | write_mos_reg(serial, port_number, IER, 0x00); | 1368 | write_mos_reg(serial, port_number, MOS7720_IER, 0x00); |
1356 | write_mos_reg(serial, port_number, FCR, 0x00); | 1369 | write_mos_reg(serial, port_number, MOS7720_FCR, 0x00); |
1357 | write_mos_reg(serial, port_number, FCR, 0xcf); | 1370 | write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf); |
1358 | mos7720_port->shadowMCR = 0x0b; | 1371 | mos7720_port->shadowMCR = 0x0b; |
1359 | write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR); | 1372 | write_mos_reg(serial, port_number, MOS7720_MCR, |
1360 | write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x00); | 1373 | mos7720_port->shadowMCR); |
1374 | write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, 0x00); | ||
1361 | 1375 | ||
1362 | /*********************************************** | 1376 | /*********************************************** |
1363 | * Set for higher rates * | 1377 | * Set for higher rates * |
1364 | ***********************************************/ | 1378 | ***********************************************/ |
1365 | /* writing baud rate verbatum into uart clock field clearly not right */ | 1379 | /* writing baud rate verbatum into uart clock field clearly not right */ |
1366 | if (port_number == 0) | 1380 | if (port_number == 0) |
1367 | sp_reg = SP1_REG; | 1381 | sp_reg = MOS7720_SP1_REG; |
1368 | else | 1382 | else |
1369 | sp_reg = SP2_REG; | 1383 | sp_reg = MOS7720_SP2_REG; |
1370 | write_mos_reg(serial, dummy, sp_reg, baud * 0x10); | 1384 | write_mos_reg(serial, dummy, sp_reg, baud * 0x10); |
1371 | write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x03); | 1385 | write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, 0x03); |
1372 | mos7720_port->shadowMCR = 0x2b; | 1386 | mos7720_port->shadowMCR = 0x2b; |
1373 | write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR); | 1387 | write_mos_reg(serial, port_number, MOS7720_MCR, |
1388 | mos7720_port->shadowMCR); | ||
1374 | 1389 | ||
1375 | /*********************************************** | 1390 | /*********************************************** |
1376 | * Set DLL/DLM | 1391 | * Set DLL/DLM |
1377 | ***********************************************/ | 1392 | ***********************************************/ |
1378 | mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB; | 1393 | mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB; |
1379 | write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); | 1394 | write_mos_reg(serial, port_number, MOS7720_LCR, |
1380 | write_mos_reg(serial, port_number, DLL, 0x01); | 1395 | mos7720_port->shadowLCR); |
1381 | write_mos_reg(serial, port_number, DLM, 0x00); | 1396 | write_mos_reg(serial, port_number, MOS7720_DLL, 0x01); |
1397 | write_mos_reg(serial, port_number, MOS7720_DLM, 0x00); | ||
1382 | mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB; | 1398 | mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB; |
1383 | write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); | 1399 | write_mos_reg(serial, port_number, MOS7720_LCR, |
1400 | mos7720_port->shadowLCR); | ||
1384 | 1401 | ||
1385 | return 0; | 1402 | return 0; |
1386 | } | 1403 | } |
@@ -1488,15 +1505,16 @@ static int send_cmd_write_baud_rate(struct moschip_port *mos7720_port, | |||
1488 | 1505 | ||
1489 | /* Enable access to divisor latch */ | 1506 | /* Enable access to divisor latch */ |
1490 | mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB; | 1507 | mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB; |
1491 | write_mos_reg(serial, number, LCR, mos7720_port->shadowLCR); | 1508 | write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR); |
1492 | 1509 | ||
1493 | /* Write the divisor */ | 1510 | /* Write the divisor */ |
1494 | write_mos_reg(serial, number, DLL, (__u8)(divisor & 0xff)); | 1511 | write_mos_reg(serial, number, MOS7720_DLL, (__u8)(divisor & 0xff)); |
1495 | write_mos_reg(serial, number, DLM, (__u8)((divisor & 0xff00) >> 8)); | 1512 | write_mos_reg(serial, number, MOS7720_DLM, |
1513 | (__u8)((divisor & 0xff00) >> 8)); | ||
1496 | 1514 | ||
1497 | /* Disable access to divisor latch */ | 1515 | /* Disable access to divisor latch */ |
1498 | mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB; | 1516 | mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB; |
1499 | write_mos_reg(serial, number, LCR, mos7720_port->shadowLCR); | 1517 | write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR); |
1500 | 1518 | ||
1501 | return status; | 1519 | return status; |
1502 | } | 1520 | } |
@@ -1600,14 +1618,16 @@ static void change_port_settings(struct tty_struct *tty, | |||
1600 | 1618 | ||
1601 | 1619 | ||
1602 | /* Disable Interrupts */ | 1620 | /* Disable Interrupts */ |
1603 | write_mos_reg(serial, port_number, IER, 0x00); | 1621 | write_mos_reg(serial, port_number, MOS7720_IER, 0x00); |
1604 | write_mos_reg(serial, port_number, FCR, 0x00); | 1622 | write_mos_reg(serial, port_number, MOS7720_FCR, 0x00); |
1605 | write_mos_reg(serial, port_number, FCR, 0xcf); | 1623 | write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf); |
1606 | 1624 | ||
1607 | /* Send the updated LCR value to the mos7720 */ | 1625 | /* Send the updated LCR value to the mos7720 */ |
1608 | write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); | 1626 | write_mos_reg(serial, port_number, MOS7720_LCR, |
1627 | mos7720_port->shadowLCR); | ||
1609 | mos7720_port->shadowMCR = 0x0b; | 1628 | mos7720_port->shadowMCR = 0x0b; |
1610 | write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR); | 1629 | write_mos_reg(serial, port_number, MOS7720_MCR, |
1630 | mos7720_port->shadowMCR); | ||
1611 | 1631 | ||
1612 | /* set up the MCR register and send it to the mos7720 */ | 1632 | /* set up the MCR register and send it to the mos7720 */ |
1613 | mos7720_port->shadowMCR = UART_MCR_OUT2; | 1633 | mos7720_port->shadowMCR = UART_MCR_OUT2; |
@@ -1619,14 +1639,17 @@ static void change_port_settings(struct tty_struct *tty, | |||
1619 | /* To set hardware flow control to the specified * | 1639 | /* To set hardware flow control to the specified * |
1620 | * serial port, in SP1/2_CONTROL_REG */ | 1640 | * serial port, in SP1/2_CONTROL_REG */ |
1621 | if (port_number) | 1641 | if (port_number) |
1622 | write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x01); | 1642 | write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, |
1643 | 0x01); | ||
1623 | else | 1644 | else |
1624 | write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x02); | 1645 | write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, |
1646 | 0x02); | ||
1625 | 1647 | ||
1626 | } else | 1648 | } else |
1627 | mos7720_port->shadowMCR &= ~(UART_MCR_XONANY); | 1649 | mos7720_port->shadowMCR &= ~(UART_MCR_XONANY); |
1628 | 1650 | ||
1629 | write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR); | 1651 | write_mos_reg(serial, port_number, MOS7720_MCR, |
1652 | mos7720_port->shadowMCR); | ||
1630 | 1653 | ||
1631 | /* Determine divisor based on baud rate */ | 1654 | /* Determine divisor based on baud rate */ |
1632 | baud = tty_get_baud_rate(tty); | 1655 | baud = tty_get_baud_rate(tty); |
@@ -1639,7 +1662,7 @@ static void change_port_settings(struct tty_struct *tty, | |||
1639 | if (baud >= 230400) { | 1662 | if (baud >= 230400) { |
1640 | set_higher_rates(mos7720_port, baud); | 1663 | set_higher_rates(mos7720_port, baud); |
1641 | /* Enable Interrupts */ | 1664 | /* Enable Interrupts */ |
1642 | write_mos_reg(serial, port_number, IER, 0x0c); | 1665 | write_mos_reg(serial, port_number, MOS7720_IER, 0x0c); |
1643 | return; | 1666 | return; |
1644 | } | 1667 | } |
1645 | 1668 | ||
@@ -1650,7 +1673,7 @@ static void change_port_settings(struct tty_struct *tty, | |||
1650 | if (cflag & CBAUD) | 1673 | if (cflag & CBAUD) |
1651 | tty_encode_baud_rate(tty, baud, baud); | 1674 | tty_encode_baud_rate(tty, baud, baud); |
1652 | /* Enable Interrupts */ | 1675 | /* Enable Interrupts */ |
1653 | write_mos_reg(serial, port_number, IER, 0x0c); | 1676 | write_mos_reg(serial, port_number, MOS7720_IER, 0x0c); |
1654 | 1677 | ||
1655 | if (port->read_urb->status != -EINPROGRESS) { | 1678 | if (port->read_urb->status != -EINPROGRESS) { |
1656 | status = usb_submit_urb(port->read_urb, GFP_KERNEL); | 1679 | status = usb_submit_urb(port->read_urb, GFP_KERNEL); |
@@ -1725,7 +1748,7 @@ static int get_lsr_info(struct tty_struct *tty, | |||
1725 | 1748 | ||
1726 | count = mos7720_chars_in_buffer(tty); | 1749 | count = mos7720_chars_in_buffer(tty); |
1727 | if (count == 0) { | 1750 | if (count == 0) { |
1728 | read_mos_reg(port->serial, port_number, LSR, &data); | 1751 | read_mos_reg(port->serial, port_number, MOS7720_LSR, &data); |
1729 | if ((data & (UART_LSR_TEMT | UART_LSR_THRE)) | 1752 | if ((data & (UART_LSR_TEMT | UART_LSR_THRE)) |
1730 | == (UART_LSR_TEMT | UART_LSR_THRE)) { | 1753 | == (UART_LSR_TEMT | UART_LSR_THRE)) { |
1731 | dev_dbg(&port->dev, "%s -- Empty\n", __func__); | 1754 | dev_dbg(&port->dev, "%s -- Empty\n", __func__); |
@@ -1782,7 +1805,7 @@ static int mos7720_tiocmset(struct tty_struct *tty, | |||
1782 | mcr &= ~UART_MCR_LOOP; | 1805 | mcr &= ~UART_MCR_LOOP; |
1783 | 1806 | ||
1784 | mos7720_port->shadowMCR = mcr; | 1807 | mos7720_port->shadowMCR = mcr; |
1785 | write_mos_reg(port->serial, port->port_number, MCR, | 1808 | write_mos_reg(port->serial, port->port_number, MOS7720_MCR, |
1786 | mos7720_port->shadowMCR); | 1809 | mos7720_port->shadowMCR); |
1787 | 1810 | ||
1788 | return 0; | 1811 | return 0; |
@@ -1827,7 +1850,7 @@ static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd, | |||
1827 | } | 1850 | } |
1828 | 1851 | ||
1829 | mos7720_port->shadowMCR = mcr; | 1852 | mos7720_port->shadowMCR = mcr; |
1830 | write_mos_reg(port->serial, port->port_number, MCR, | 1853 | write_mos_reg(port->serial, port->port_number, MOS7720_MCR, |
1831 | mos7720_port->shadowMCR); | 1854 | mos7720_port->shadowMCR); |
1832 | 1855 | ||
1833 | return 0; | 1856 | return 0; |
@@ -1942,7 +1965,7 @@ static int mos7720_startup(struct usb_serial *serial) | |||
1942 | } | 1965 | } |
1943 | #endif | 1966 | #endif |
1944 | /* LSR For Port 1 */ | 1967 | /* LSR For Port 1 */ |
1945 | read_mos_reg(serial, 0, LSR, &data); | 1968 | read_mos_reg(serial, 0, MOS7720_LSR, &data); |
1946 | dev_dbg(&dev->dev, "LSR:%x\n", data); | 1969 | dev_dbg(&dev->dev, "LSR:%x\n", data); |
1947 | 1970 | ||
1948 | return 0; | 1971 | return 0; |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index f0c0c53359ad..19b85ee98a72 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -1765,6 +1765,7 @@ static const struct usb_device_id option_ids[] = { | |||
1765 | { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) }, | 1765 | { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) }, |
1766 | { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ | 1766 | { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ |
1767 | { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ | 1767 | { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ |
1768 | { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ | ||
1768 | { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, | 1769 | { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, |
1769 | { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, | 1770 | { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, |
1770 | { } /* Terminating entry */ | 1771 | { } /* Terminating entry */ |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 529066bbc7e8..46f1f13b41f1 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -1306,6 +1306,7 @@ static void __exit usb_serial_exit(void) | |||
1306 | tty_unregister_driver(usb_serial_tty_driver); | 1306 | tty_unregister_driver(usb_serial_tty_driver); |
1307 | put_tty_driver(usb_serial_tty_driver); | 1307 | put_tty_driver(usb_serial_tty_driver); |
1308 | bus_unregister(&usb_serial_bus_type); | 1308 | bus_unregister(&usb_serial_bus_type); |
1309 | idr_destroy(&serial_minors); | ||
1309 | } | 1310 | } |
1310 | 1311 | ||
1311 | 1312 | ||
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index caf188800c67..6b2479123de7 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -2065,6 +2065,18 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200, | |||
2065 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 2065 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
2066 | US_FL_NO_READ_DISC_INFO ), | 2066 | US_FL_NO_READ_DISC_INFO ), |
2067 | 2067 | ||
2068 | /* Reported by Oliver Neukum <oneukum@suse.com> | ||
2069 | * This device morphes spontaneously into another device if the access | ||
2070 | * pattern of Windows isn't followed. Thus writable media would be dirty | ||
2071 | * if the initial instance is used. So the device is limited to its | ||
2072 | * virtual CD. | ||
2073 | * And yes, the concept that BCD goes up to 9 is not heeded */ | ||
2074 | UNUSUAL_DEV( 0x19d2, 0x1225, 0x0000, 0xffff, | ||
2075 | "ZTE,Incorporated", | ||
2076 | "ZTE WCDMA Technologies MSM", | ||
2077 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
2078 | US_FL_SINGLE_LUN ), | ||
2079 | |||
2068 | /* Reported by Sven Geggus <sven-usbst@geggus.net> | 2080 | /* Reported by Sven Geggus <sven-usbst@geggus.net> |
2069 | * This encrypted pen drive returns bogus data for the initial READ(10). | 2081 | * This encrypted pen drive returns bogus data for the initial READ(10). |
2070 | */ | 2082 | */ |
@@ -2074,6 +2086,17 @@ UNUSUAL_DEV( 0x1b1c, 0x1ab5, 0x0200, 0x0200, | |||
2074 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 2086 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
2075 | US_FL_INITIAL_READ10 ), | 2087 | US_FL_INITIAL_READ10 ), |
2076 | 2088 | ||
2089 | /* Reported by Hans de Goede <hdegoede@redhat.com> | ||
2090 | * These are mini projectors using USB for both power and video data transport | ||
2091 | * The usb-storage interface is a virtual windows driver CD, which the gm12u320 | ||
2092 | * driver automatically converts into framebuffer & kms dri device nodes. | ||
2093 | */ | ||
2094 | UNUSUAL_DEV( 0x1de1, 0xc102, 0x0000, 0xffff, | ||
2095 | "Grain-media Technology Corp.", | ||
2096 | "USB3.0 Device GM12U320", | ||
2097 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
2098 | US_FL_IGNORE_DEVICE ), | ||
2099 | |||
2077 | /* Patch by Richard Schütz <r.schtz@t-online.de> | 2100 | /* Patch by Richard Schütz <r.schtz@t-online.de> |
2078 | * This external hard drive enclosure uses a JMicron chip which | 2101 | * This external hard drive enclosure uses a JMicron chip which |
2079 | * needs the US_FL_IGNORE_RESIDUE flag to work properly. */ | 2102 | * needs the US_FL_IGNORE_RESIDUE flag to work properly. */ |
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 9e8e004bb1c3..a9fe859f43c8 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -22,14 +22,20 @@ | |||
22 | #include <linux/file.h> | 22 | #include <linux/file.h> |
23 | #include <linux/highmem.h> | 23 | #include <linux/highmem.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/vmalloc.h> | ||
25 | #include <linux/kthread.h> | 26 | #include <linux/kthread.h> |
26 | #include <linux/cgroup.h> | 27 | #include <linux/cgroup.h> |
27 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/sort.h> | ||
28 | 30 | ||
29 | #include "vhost.h" | 31 | #include "vhost.h" |
30 | 32 | ||
33 | static ushort max_mem_regions = 64; | ||
34 | module_param(max_mem_regions, ushort, 0444); | ||
35 | MODULE_PARM_DESC(max_mem_regions, | ||
36 | "Maximum number of memory regions in memory map. (default: 64)"); | ||
37 | |||
31 | enum { | 38 | enum { |
32 | VHOST_MEMORY_MAX_NREGIONS = 64, | ||
33 | VHOST_MEMORY_F_LOG = 0x1, | 39 | VHOST_MEMORY_F_LOG = 0x1, |
34 | }; | 40 | }; |
35 | 41 | ||
@@ -543,7 +549,7 @@ void vhost_dev_cleanup(struct vhost_dev *dev, bool locked) | |||
543 | fput(dev->log_file); | 549 | fput(dev->log_file); |
544 | dev->log_file = NULL; | 550 | dev->log_file = NULL; |
545 | /* No one will access memory at this point */ | 551 | /* No one will access memory at this point */ |
546 | kfree(dev->memory); | 552 | kvfree(dev->memory); |
547 | dev->memory = NULL; | 553 | dev->memory = NULL; |
548 | WARN_ON(!list_empty(&dev->work_list)); | 554 | WARN_ON(!list_empty(&dev->work_list)); |
549 | if (dev->worker) { | 555 | if (dev->worker) { |
@@ -663,6 +669,28 @@ int vhost_vq_access_ok(struct vhost_virtqueue *vq) | |||
663 | } | 669 | } |
664 | EXPORT_SYMBOL_GPL(vhost_vq_access_ok); | 670 | EXPORT_SYMBOL_GPL(vhost_vq_access_ok); |
665 | 671 | ||
672 | static int vhost_memory_reg_sort_cmp(const void *p1, const void *p2) | ||
673 | { | ||
674 | const struct vhost_memory_region *r1 = p1, *r2 = p2; | ||
675 | if (r1->guest_phys_addr < r2->guest_phys_addr) | ||
676 | return 1; | ||
677 | if (r1->guest_phys_addr > r2->guest_phys_addr) | ||
678 | return -1; | ||
679 | return 0; | ||
680 | } | ||
681 | |||
682 | static void *vhost_kvzalloc(unsigned long size) | ||
683 | { | ||
684 | void *n = kzalloc(size, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); | ||
685 | |||
686 | if (!n) { | ||
687 | n = vzalloc(size); | ||
688 | if (!n) | ||
689 | return ERR_PTR(-ENOMEM); | ||
690 | } | ||
691 | return n; | ||
692 | } | ||
693 | |||
666 | static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m) | 694 | static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m) |
667 | { | 695 | { |
668 | struct vhost_memory mem, *newmem, *oldmem; | 696 | struct vhost_memory mem, *newmem, *oldmem; |
@@ -673,21 +701,23 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m) | |||
673 | return -EFAULT; | 701 | return -EFAULT; |
674 | if (mem.padding) | 702 | if (mem.padding) |
675 | return -EOPNOTSUPP; | 703 | return -EOPNOTSUPP; |
676 | if (mem.nregions > VHOST_MEMORY_MAX_NREGIONS) | 704 | if (mem.nregions > max_mem_regions) |
677 | return -E2BIG; | 705 | return -E2BIG; |
678 | newmem = kmalloc(size + mem.nregions * sizeof *m->regions, GFP_KERNEL); | 706 | newmem = vhost_kvzalloc(size + mem.nregions * sizeof(*m->regions)); |
679 | if (!newmem) | 707 | if (!newmem) |
680 | return -ENOMEM; | 708 | return -ENOMEM; |
681 | 709 | ||
682 | memcpy(newmem, &mem, size); | 710 | memcpy(newmem, &mem, size); |
683 | if (copy_from_user(newmem->regions, m->regions, | 711 | if (copy_from_user(newmem->regions, m->regions, |
684 | mem.nregions * sizeof *m->regions)) { | 712 | mem.nregions * sizeof *m->regions)) { |
685 | kfree(newmem); | 713 | kvfree(newmem); |
686 | return -EFAULT; | 714 | return -EFAULT; |
687 | } | 715 | } |
716 | sort(newmem->regions, newmem->nregions, sizeof(*newmem->regions), | ||
717 | vhost_memory_reg_sort_cmp, NULL); | ||
688 | 718 | ||
689 | if (!memory_access_ok(d, newmem, 0)) { | 719 | if (!memory_access_ok(d, newmem, 0)) { |
690 | kfree(newmem); | 720 | kvfree(newmem); |
691 | return -EFAULT; | 721 | return -EFAULT; |
692 | } | 722 | } |
693 | oldmem = d->memory; | 723 | oldmem = d->memory; |
@@ -699,7 +729,7 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m) | |||
699 | d->vqs[i]->memory = newmem; | 729 | d->vqs[i]->memory = newmem; |
700 | mutex_unlock(&d->vqs[i]->mutex); | 730 | mutex_unlock(&d->vqs[i]->mutex); |
701 | } | 731 | } |
702 | kfree(oldmem); | 732 | kvfree(oldmem); |
703 | return 0; | 733 | return 0; |
704 | } | 734 | } |
705 | 735 | ||
@@ -992,17 +1022,22 @@ EXPORT_SYMBOL_GPL(vhost_dev_ioctl); | |||
992 | static const struct vhost_memory_region *find_region(struct vhost_memory *mem, | 1022 | static const struct vhost_memory_region *find_region(struct vhost_memory *mem, |
993 | __u64 addr, __u32 len) | 1023 | __u64 addr, __u32 len) |
994 | { | 1024 | { |
995 | struct vhost_memory_region *reg; | 1025 | const struct vhost_memory_region *reg; |
996 | int i; | 1026 | int start = 0, end = mem->nregions; |
997 | 1027 | ||
998 | /* linear search is not brilliant, but we really have on the order of 6 | 1028 | while (start < end) { |
999 | * regions in practice */ | 1029 | int slot = start + (end - start) / 2; |
1000 | for (i = 0; i < mem->nregions; ++i) { | 1030 | reg = mem->regions + slot; |
1001 | reg = mem->regions + i; | 1031 | if (addr >= reg->guest_phys_addr) |
1002 | if (reg->guest_phys_addr <= addr && | 1032 | end = slot; |
1003 | reg->guest_phys_addr + reg->memory_size - 1 >= addr) | 1033 | else |
1004 | return reg; | 1034 | start = slot + 1; |
1005 | } | 1035 | } |
1036 | |||
1037 | reg = mem->regions + start; | ||
1038 | if (addr >= reg->guest_phys_addr && | ||
1039 | reg->guest_phys_addr + reg->memory_size > addr) | ||
1040 | return reg; | ||
1006 | return NULL; | 1041 | return NULL; |
1007 | } | 1042 | } |
1008 | 1043 | ||
diff --git a/drivers/video/fbdev/stifb.c b/drivers/video/fbdev/stifb.c index 86621fabbb8b..735355b0e023 100644 --- a/drivers/video/fbdev/stifb.c +++ b/drivers/video/fbdev/stifb.c | |||
@@ -121,6 +121,7 @@ static int __initdata stifb_bpp_pref[MAX_STI_ROMS]; | |||
121 | #define REG_3 0x0004a0 | 121 | #define REG_3 0x0004a0 |
122 | #define REG_4 0x000600 | 122 | #define REG_4 0x000600 |
123 | #define REG_6 0x000800 | 123 | #define REG_6 0x000800 |
124 | #define REG_7 0x000804 | ||
124 | #define REG_8 0x000820 | 125 | #define REG_8 0x000820 |
125 | #define REG_9 0x000a04 | 126 | #define REG_9 0x000a04 |
126 | #define REG_10 0x018000 | 127 | #define REG_10 0x018000 |
@@ -135,6 +136,8 @@ static int __initdata stifb_bpp_pref[MAX_STI_ROMS]; | |||
135 | #define REG_21 0x200218 | 136 | #define REG_21 0x200218 |
136 | #define REG_22 0x0005a0 | 137 | #define REG_22 0x0005a0 |
137 | #define REG_23 0x0005c0 | 138 | #define REG_23 0x0005c0 |
139 | #define REG_24 0x000808 | ||
140 | #define REG_25 0x000b00 | ||
138 | #define REG_26 0x200118 | 141 | #define REG_26 0x200118 |
139 | #define REG_27 0x200308 | 142 | #define REG_27 0x200308 |
140 | #define REG_32 0x21003c | 143 | #define REG_32 0x21003c |
@@ -429,6 +432,9 @@ ARTIST_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb, int enable) | |||
429 | #define SET_LENXY_START_RECFILL(fb, lenxy) \ | 432 | #define SET_LENXY_START_RECFILL(fb, lenxy) \ |
430 | WRITE_WORD(lenxy, fb, REG_9) | 433 | WRITE_WORD(lenxy, fb, REG_9) |
431 | 434 | ||
435 | #define SETUP_COPYAREA(fb) \ | ||
436 | WRITE_BYTE(0, fb, REG_16b1) | ||
437 | |||
432 | static void | 438 | static void |
433 | HYPER_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb, int enable) | 439 | HYPER_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb, int enable) |
434 | { | 440 | { |
@@ -1004,6 +1010,36 @@ stifb_blank(int blank_mode, struct fb_info *info) | |||
1004 | return 0; | 1010 | return 0; |
1005 | } | 1011 | } |
1006 | 1012 | ||
1013 | static void | ||
1014 | stifb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | ||
1015 | { | ||
1016 | struct stifb_info *fb = container_of(info, struct stifb_info, info); | ||
1017 | |||
1018 | SETUP_COPYAREA(fb); | ||
1019 | |||
1020 | SETUP_HW(fb); | ||
1021 | if (fb->info.var.bits_per_pixel == 32) { | ||
1022 | WRITE_WORD(0xBBA0A000, fb, REG_10); | ||
1023 | |||
1024 | NGLE_REALLY_SET_IMAGE_PLANEMASK(fb, 0xffffffff); | ||
1025 | } else { | ||
1026 | WRITE_WORD(fb->id == S9000_ID_HCRX ? 0x13a02000 : 0x13a01000, fb, REG_10); | ||
1027 | |||
1028 | NGLE_REALLY_SET_IMAGE_PLANEMASK(fb, 0xff); | ||
1029 | } | ||
1030 | |||
1031 | NGLE_QUICK_SET_IMAGE_BITMAP_OP(fb, | ||
1032 | IBOvals(RopSrc, MaskAddrOffset(0), | ||
1033 | BitmapExtent08, StaticReg(1), | ||
1034 | DataDynamic, MaskOtc, BGx(0), FGx(0))); | ||
1035 | |||
1036 | WRITE_WORD(((area->sx << 16) | area->sy), fb, REG_24); | ||
1037 | WRITE_WORD(((area->width << 16) | area->height), fb, REG_7); | ||
1038 | WRITE_WORD(((area->dx << 16) | area->dy), fb, REG_25); | ||
1039 | |||
1040 | SETUP_FB(fb); | ||
1041 | } | ||
1042 | |||
1007 | static void __init | 1043 | static void __init |
1008 | stifb_init_display(struct stifb_info *fb) | 1044 | stifb_init_display(struct stifb_info *fb) |
1009 | { | 1045 | { |
@@ -1069,7 +1105,7 @@ static struct fb_ops stifb_ops = { | |||
1069 | .fb_setcolreg = stifb_setcolreg, | 1105 | .fb_setcolreg = stifb_setcolreg, |
1070 | .fb_blank = stifb_blank, | 1106 | .fb_blank = stifb_blank, |
1071 | .fb_fillrect = cfb_fillrect, | 1107 | .fb_fillrect = cfb_fillrect, |
1072 | .fb_copyarea = cfb_copyarea, | 1108 | .fb_copyarea = stifb_copyarea, |
1073 | .fb_imageblit = cfb_imageblit, | 1109 | .fb_imageblit = cfb_imageblit, |
1074 | }; | 1110 | }; |
1075 | 1111 | ||
@@ -1258,7 +1294,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) | |||
1258 | info->fbops = &stifb_ops; | 1294 | info->fbops = &stifb_ops; |
1259 | info->screen_base = ioremap_nocache(REGION_BASE(fb,1), fix->smem_len); | 1295 | info->screen_base = ioremap_nocache(REGION_BASE(fb,1), fix->smem_len); |
1260 | info->screen_size = fix->smem_len; | 1296 | info->screen_size = fix->smem_len; |
1261 | info->flags = FBINFO_DEFAULT; | 1297 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA; |
1262 | info->pseudo_palette = &fb->pseudo_palette; | 1298 | info->pseudo_palette = &fb->pseudo_palette; |
1263 | 1299 | ||
1264 | /* This has to be done !!! */ | 1300 | /* This has to be done !!! */ |
diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c index c1b03f4235b9..4e7fec36f5c3 100644 --- a/drivers/watchdog/sp805_wdt.c +++ b/drivers/watchdog/sp805_wdt.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Watchdog driver for ARM SP805 watchdog module | 4 | * Watchdog driver for ARM SP805 watchdog module |
5 | * | 5 | * |
6 | * Copyright (C) 2010 ST Microelectronics | 6 | * Copyright (C) 2010 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2 or later. This program is licensed "as is" without any | 10 | * License version 2 or later. This program is licensed "as is" without any |
@@ -303,6 +303,6 @@ static struct amba_driver sp805_wdt_driver = { | |||
303 | 303 | ||
304 | module_amba_driver(sp805_wdt_driver); | 304 | module_amba_driver(sp805_wdt_driver); |
305 | 305 | ||
306 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); | 306 | MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>"); |
307 | MODULE_DESCRIPTION("ARM SP805 Watchdog Driver"); | 307 | MODULE_DESCRIPTION("ARM SP805 Watchdog Driver"); |
308 | MODULE_LICENSE("GPL"); | 308 | MODULE_LICENSE("GPL"); |
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 510040b04c96..b1dc51888048 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -540,8 +540,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, | |||
540 | unlock_new_inode(inode); | 540 | unlock_new_inode(inode); |
541 | return inode; | 541 | return inode; |
542 | error: | 542 | error: |
543 | unlock_new_inode(inode); | 543 | iget_failed(inode); |
544 | iput(inode); | ||
545 | return ERR_PTR(retval); | 544 | return ERR_PTR(retval); |
546 | 545 | ||
547 | } | 546 | } |
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 09e4433717b8..e8aa57dc8d6d 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c | |||
@@ -149,8 +149,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, | |||
149 | unlock_new_inode(inode); | 149 | unlock_new_inode(inode); |
150 | return inode; | 150 | return inode; |
151 | error: | 151 | error: |
152 | unlock_new_inode(inode); | 152 | iget_failed(inode); |
153 | iput(inode); | ||
154 | return ERR_PTR(retval); | 153 | return ERR_PTR(retval); |
155 | 154 | ||
156 | } | 155 | } |
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 0ef5cc13fae2..81220b2203c6 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
@@ -44,6 +44,8 @@ | |||
44 | #define BTRFS_INODE_IN_DELALLOC_LIST 9 | 44 | #define BTRFS_INODE_IN_DELALLOC_LIST 9 |
45 | #define BTRFS_INODE_READDIO_NEED_LOCK 10 | 45 | #define BTRFS_INODE_READDIO_NEED_LOCK 10 |
46 | #define BTRFS_INODE_HAS_PROPS 11 | 46 | #define BTRFS_INODE_HAS_PROPS 11 |
47 | /* DIO is ready to submit */ | ||
48 | #define BTRFS_INODE_DIO_READY 12 | ||
47 | /* | 49 | /* |
48 | * The following 3 bits are meant only for the btree inode. | 50 | * The following 3 bits are meant only for the btree inode. |
49 | * When any of them is set, it means an error happened while writing an | 51 | * When any of them is set, it means an error happened while writing an |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 80a9aefb0c46..aac314e14188 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1778,6 +1778,7 @@ struct btrfs_fs_info { | |||
1778 | spinlock_t unused_bgs_lock; | 1778 | spinlock_t unused_bgs_lock; |
1779 | struct list_head unused_bgs; | 1779 | struct list_head unused_bgs; |
1780 | struct mutex unused_bg_unpin_mutex; | 1780 | struct mutex unused_bg_unpin_mutex; |
1781 | struct mutex delete_unused_bgs_mutex; | ||
1781 | 1782 | ||
1782 | /* For btrfs to record security options */ | 1783 | /* For btrfs to record security options */ |
1783 | struct security_mnt_opts security_opts; | 1784 | struct security_mnt_opts security_opts; |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 3f43bfea3684..a9aadb2ad525 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1751,6 +1751,7 @@ static int cleaner_kthread(void *arg) | |||
1751 | { | 1751 | { |
1752 | struct btrfs_root *root = arg; | 1752 | struct btrfs_root *root = arg; |
1753 | int again; | 1753 | int again; |
1754 | struct btrfs_trans_handle *trans; | ||
1754 | 1755 | ||
1755 | do { | 1756 | do { |
1756 | again = 0; | 1757 | again = 0; |
@@ -1772,7 +1773,6 @@ static int cleaner_kthread(void *arg) | |||
1772 | } | 1773 | } |
1773 | 1774 | ||
1774 | btrfs_run_delayed_iputs(root); | 1775 | btrfs_run_delayed_iputs(root); |
1775 | btrfs_delete_unused_bgs(root->fs_info); | ||
1776 | again = btrfs_clean_one_deleted_snapshot(root); | 1776 | again = btrfs_clean_one_deleted_snapshot(root); |
1777 | mutex_unlock(&root->fs_info->cleaner_mutex); | 1777 | mutex_unlock(&root->fs_info->cleaner_mutex); |
1778 | 1778 | ||
@@ -1781,6 +1781,16 @@ static int cleaner_kthread(void *arg) | |||
1781 | * needn't do anything special here. | 1781 | * needn't do anything special here. |
1782 | */ | 1782 | */ |
1783 | btrfs_run_defrag_inodes(root->fs_info); | 1783 | btrfs_run_defrag_inodes(root->fs_info); |
1784 | |||
1785 | /* | ||
1786 | * Acquires fs_info->delete_unused_bgs_mutex to avoid racing | ||
1787 | * with relocation (btrfs_relocate_chunk) and relocation | ||
1788 | * acquires fs_info->cleaner_mutex (btrfs_relocate_block_group) | ||
1789 | * after acquiring fs_info->delete_unused_bgs_mutex. So we | ||
1790 | * can't hold, nor need to, fs_info->cleaner_mutex when deleting | ||
1791 | * unused block groups. | ||
1792 | */ | ||
1793 | btrfs_delete_unused_bgs(root->fs_info); | ||
1784 | sleep: | 1794 | sleep: |
1785 | if (!try_to_freeze() && !again) { | 1795 | if (!try_to_freeze() && !again) { |
1786 | set_current_state(TASK_INTERRUPTIBLE); | 1796 | set_current_state(TASK_INTERRUPTIBLE); |
@@ -1789,6 +1799,34 @@ sleep: | |||
1789 | __set_current_state(TASK_RUNNING); | 1799 | __set_current_state(TASK_RUNNING); |
1790 | } | 1800 | } |
1791 | } while (!kthread_should_stop()); | 1801 | } while (!kthread_should_stop()); |
1802 | |||
1803 | /* | ||
1804 | * Transaction kthread is stopped before us and wakes us up. | ||
1805 | * However we might have started a new transaction and COWed some | ||
1806 | * tree blocks when deleting unused block groups for example. So | ||
1807 | * make sure we commit the transaction we started to have a clean | ||
1808 | * shutdown when evicting the btree inode - if it has dirty pages | ||
1809 | * when we do the final iput() on it, eviction will trigger a | ||
1810 | * writeback for it which will fail with null pointer dereferences | ||
1811 | * since work queues and other resources were already released and | ||
1812 | * destroyed by the time the iput/eviction/writeback is made. | ||
1813 | */ | ||
1814 | trans = btrfs_attach_transaction(root); | ||
1815 | if (IS_ERR(trans)) { | ||
1816 | if (PTR_ERR(trans) != -ENOENT) | ||
1817 | btrfs_err(root->fs_info, | ||
1818 | "cleaner transaction attach returned %ld", | ||
1819 | PTR_ERR(trans)); | ||
1820 | } else { | ||
1821 | int ret; | ||
1822 | |||
1823 | ret = btrfs_commit_transaction(trans, root); | ||
1824 | if (ret) | ||
1825 | btrfs_err(root->fs_info, | ||
1826 | "cleaner open transaction commit returned %d", | ||
1827 | ret); | ||
1828 | } | ||
1829 | |||
1792 | return 0; | 1830 | return 0; |
1793 | } | 1831 | } |
1794 | 1832 | ||
@@ -2492,6 +2530,7 @@ int open_ctree(struct super_block *sb, | |||
2492 | spin_lock_init(&fs_info->unused_bgs_lock); | 2530 | spin_lock_init(&fs_info->unused_bgs_lock); |
2493 | rwlock_init(&fs_info->tree_mod_log_lock); | 2531 | rwlock_init(&fs_info->tree_mod_log_lock); |
2494 | mutex_init(&fs_info->unused_bg_unpin_mutex); | 2532 | mutex_init(&fs_info->unused_bg_unpin_mutex); |
2533 | mutex_init(&fs_info->delete_unused_bgs_mutex); | ||
2495 | mutex_init(&fs_info->reloc_mutex); | 2534 | mutex_init(&fs_info->reloc_mutex); |
2496 | mutex_init(&fs_info->delalloc_root_mutex); | 2535 | mutex_init(&fs_info->delalloc_root_mutex); |
2497 | seqlock_init(&fs_info->profiles_lock); | 2536 | seqlock_init(&fs_info->profiles_lock); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 38b76cc02f48..171312d51799 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -2296,9 +2296,22 @@ static int run_one_delayed_ref(struct btrfs_trans_handle *trans, | |||
2296 | static inline struct btrfs_delayed_ref_node * | 2296 | static inline struct btrfs_delayed_ref_node * |
2297 | select_delayed_ref(struct btrfs_delayed_ref_head *head) | 2297 | select_delayed_ref(struct btrfs_delayed_ref_head *head) |
2298 | { | 2298 | { |
2299 | struct btrfs_delayed_ref_node *ref; | ||
2300 | |||
2299 | if (list_empty(&head->ref_list)) | 2301 | if (list_empty(&head->ref_list)) |
2300 | return NULL; | 2302 | return NULL; |
2301 | 2303 | ||
2304 | /* | ||
2305 | * Select a delayed ref of type BTRFS_ADD_DELAYED_REF first. | ||
2306 | * This is to prevent a ref count from going down to zero, which deletes | ||
2307 | * the extent item from the extent tree, when there still are references | ||
2308 | * to add, which would fail because they would not find the extent item. | ||
2309 | */ | ||
2310 | list_for_each_entry(ref, &head->ref_list, list) { | ||
2311 | if (ref->action == BTRFS_ADD_DELAYED_REF) | ||
2312 | return ref; | ||
2313 | } | ||
2314 | |||
2302 | return list_entry(head->ref_list.next, struct btrfs_delayed_ref_node, | 2315 | return list_entry(head->ref_list.next, struct btrfs_delayed_ref_node, |
2303 | list); | 2316 | list); |
2304 | } | 2317 | } |
@@ -9889,6 +9902,8 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info) | |||
9889 | } | 9902 | } |
9890 | spin_unlock(&fs_info->unused_bgs_lock); | 9903 | spin_unlock(&fs_info->unused_bgs_lock); |
9891 | 9904 | ||
9905 | mutex_lock(&root->fs_info->delete_unused_bgs_mutex); | ||
9906 | |||
9892 | /* Don't want to race with allocators so take the groups_sem */ | 9907 | /* Don't want to race with allocators so take the groups_sem */ |
9893 | down_write(&space_info->groups_sem); | 9908 | down_write(&space_info->groups_sem); |
9894 | spin_lock(&block_group->lock); | 9909 | spin_lock(&block_group->lock); |
@@ -9983,6 +9998,7 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info) | |||
9983 | end_trans: | 9998 | end_trans: |
9984 | btrfs_end_transaction(trans, root); | 9999 | btrfs_end_transaction(trans, root); |
9985 | next: | 10000 | next: |
10001 | mutex_unlock(&root->fs_info->delete_unused_bgs_mutex); | ||
9986 | btrfs_put_block_group(block_group); | 10002 | btrfs_put_block_group(block_group); |
9987 | spin_lock(&fs_info->unused_bgs_lock); | 10003 | spin_lock(&fs_info->unused_bgs_lock); |
9988 | } | 10004 | } |
diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c index f6a596d5a637..d4a582ac3f73 100644 --- a/fs/btrfs/inode-map.c +++ b/fs/btrfs/inode-map.c | |||
@@ -246,6 +246,7 @@ void btrfs_unpin_free_ino(struct btrfs_root *root) | |||
246 | { | 246 | { |
247 | struct btrfs_free_space_ctl *ctl = root->free_ino_ctl; | 247 | struct btrfs_free_space_ctl *ctl = root->free_ino_ctl; |
248 | struct rb_root *rbroot = &root->free_ino_pinned->free_space_offset; | 248 | struct rb_root *rbroot = &root->free_ino_pinned->free_space_offset; |
249 | spinlock_t *rbroot_lock = &root->free_ino_pinned->tree_lock; | ||
249 | struct btrfs_free_space *info; | 250 | struct btrfs_free_space *info; |
250 | struct rb_node *n; | 251 | struct rb_node *n; |
251 | u64 count; | 252 | u64 count; |
@@ -254,24 +255,30 @@ void btrfs_unpin_free_ino(struct btrfs_root *root) | |||
254 | return; | 255 | return; |
255 | 256 | ||
256 | while (1) { | 257 | while (1) { |
258 | bool add_to_ctl = true; | ||
259 | |||
260 | spin_lock(rbroot_lock); | ||
257 | n = rb_first(rbroot); | 261 | n = rb_first(rbroot); |
258 | if (!n) | 262 | if (!n) { |
263 | spin_unlock(rbroot_lock); | ||
259 | break; | 264 | break; |
265 | } | ||
260 | 266 | ||
261 | info = rb_entry(n, struct btrfs_free_space, offset_index); | 267 | info = rb_entry(n, struct btrfs_free_space, offset_index); |
262 | BUG_ON(info->bitmap); /* Logic error */ | 268 | BUG_ON(info->bitmap); /* Logic error */ |
263 | 269 | ||
264 | if (info->offset > root->ino_cache_progress) | 270 | if (info->offset > root->ino_cache_progress) |
265 | goto free; | 271 | add_to_ctl = false; |
266 | else if (info->offset + info->bytes > root->ino_cache_progress) | 272 | else if (info->offset + info->bytes > root->ino_cache_progress) |
267 | count = root->ino_cache_progress - info->offset + 1; | 273 | count = root->ino_cache_progress - info->offset + 1; |
268 | else | 274 | else |
269 | count = info->bytes; | 275 | count = info->bytes; |
270 | 276 | ||
271 | __btrfs_add_free_space(ctl, info->offset, count); | ||
272 | free: | ||
273 | rb_erase(&info->offset_index, rbroot); | 277 | rb_erase(&info->offset_index, rbroot); |
274 | kfree(info); | 278 | spin_unlock(rbroot_lock); |
279 | if (add_to_ctl) | ||
280 | __btrfs_add_free_space(ctl, info->offset, count); | ||
281 | kmem_cache_free(btrfs_free_space_cachep, info); | ||
275 | } | 282 | } |
276 | } | 283 | } |
277 | 284 | ||
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 855935f6671a..e33dff356460 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4209,7 +4209,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, | |||
4209 | u64 extent_num_bytes = 0; | 4209 | u64 extent_num_bytes = 0; |
4210 | u64 extent_offset = 0; | 4210 | u64 extent_offset = 0; |
4211 | u64 item_end = 0; | 4211 | u64 item_end = 0; |
4212 | u64 last_size = (u64)-1; | 4212 | u64 last_size = new_size; |
4213 | u32 found_type = (u8)-1; | 4213 | u32 found_type = (u8)-1; |
4214 | int found_extent; | 4214 | int found_extent; |
4215 | int del_item; | 4215 | int del_item; |
@@ -4493,8 +4493,7 @@ out: | |||
4493 | btrfs_abort_transaction(trans, root, ret); | 4493 | btrfs_abort_transaction(trans, root, ret); |
4494 | } | 4494 | } |
4495 | error: | 4495 | error: |
4496 | if (last_size != (u64)-1 && | 4496 | if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) |
4497 | root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) | ||
4498 | btrfs_ordered_update_i_size(inode, last_size, NULL); | 4497 | btrfs_ordered_update_i_size(inode, last_size, NULL); |
4499 | 4498 | ||
4500 | btrfs_free_path(path); | 4499 | btrfs_free_path(path); |
@@ -4989,8 +4988,9 @@ static void evict_inode_truncate_pages(struct inode *inode) | |||
4989 | /* | 4988 | /* |
4990 | * Keep looping until we have no more ranges in the io tree. | 4989 | * Keep looping until we have no more ranges in the io tree. |
4991 | * We can have ongoing bios started by readpages (called from readahead) | 4990 | * We can have ongoing bios started by readpages (called from readahead) |
4992 | * that didn't get their end io callbacks called yet or they are still | 4991 | * that have their endio callback (extent_io.c:end_bio_extent_readpage) |
4993 | * in progress ((extent_io.c:end_bio_extent_readpage()). This means some | 4992 | * still in progress (unlocked the pages in the bio but did not yet |
4993 | * unlocked the ranges in the io tree). Therefore this means some | ||
4994 | * ranges can still be locked and eviction started because before | 4994 | * ranges can still be locked and eviction started because before |
4995 | * submitting those bios, which are executed by a separate task (work | 4995 | * submitting those bios, which are executed by a separate task (work |
4996 | * queue kthread), inode references (inode->i_count) were not taken | 4996 | * queue kthread), inode references (inode->i_count) were not taken |
@@ -7546,6 +7546,7 @@ unlock: | |||
7546 | 7546 | ||
7547 | current->journal_info = outstanding_extents; | 7547 | current->journal_info = outstanding_extents; |
7548 | btrfs_free_reserved_data_space(inode, len); | 7548 | btrfs_free_reserved_data_space(inode, len); |
7549 | set_bit(BTRFS_INODE_DIO_READY, &BTRFS_I(inode)->runtime_flags); | ||
7549 | } | 7550 | } |
7550 | 7551 | ||
7551 | /* | 7552 | /* |
@@ -7871,8 +7872,6 @@ static void btrfs_endio_direct_write(struct bio *bio, int err) | |||
7871 | struct bio *dio_bio; | 7872 | struct bio *dio_bio; |
7872 | int ret; | 7873 | int ret; |
7873 | 7874 | ||
7874 | if (err) | ||
7875 | goto out_done; | ||
7876 | again: | 7875 | again: |
7877 | ret = btrfs_dec_test_first_ordered_pending(inode, &ordered, | 7876 | ret = btrfs_dec_test_first_ordered_pending(inode, &ordered, |
7878 | &ordered_offset, | 7877 | &ordered_offset, |
@@ -7895,7 +7894,6 @@ out_test: | |||
7895 | ordered = NULL; | 7894 | ordered = NULL; |
7896 | goto again; | 7895 | goto again; |
7897 | } | 7896 | } |
7898 | out_done: | ||
7899 | dio_bio = dip->dio_bio; | 7897 | dio_bio = dip->dio_bio; |
7900 | 7898 | ||
7901 | kfree(dip); | 7899 | kfree(dip); |
@@ -8163,9 +8161,8 @@ out_err: | |||
8163 | static void btrfs_submit_direct(int rw, struct bio *dio_bio, | 8161 | static void btrfs_submit_direct(int rw, struct bio *dio_bio, |
8164 | struct inode *inode, loff_t file_offset) | 8162 | struct inode *inode, loff_t file_offset) |
8165 | { | 8163 | { |
8166 | struct btrfs_root *root = BTRFS_I(inode)->root; | 8164 | struct btrfs_dio_private *dip = NULL; |
8167 | struct btrfs_dio_private *dip; | 8165 | struct bio *io_bio = NULL; |
8168 | struct bio *io_bio; | ||
8169 | struct btrfs_io_bio *btrfs_bio; | 8166 | struct btrfs_io_bio *btrfs_bio; |
8170 | int skip_sum; | 8167 | int skip_sum; |
8171 | int write = rw & REQ_WRITE; | 8168 | int write = rw & REQ_WRITE; |
@@ -8182,7 +8179,7 @@ static void btrfs_submit_direct(int rw, struct bio *dio_bio, | |||
8182 | dip = kzalloc(sizeof(*dip), GFP_NOFS); | 8179 | dip = kzalloc(sizeof(*dip), GFP_NOFS); |
8183 | if (!dip) { | 8180 | if (!dip) { |
8184 | ret = -ENOMEM; | 8181 | ret = -ENOMEM; |
8185 | goto free_io_bio; | 8182 | goto free_ordered; |
8186 | } | 8183 | } |
8187 | 8184 | ||
8188 | dip->private = dio_bio->bi_private; | 8185 | dip->private = dio_bio->bi_private; |
@@ -8210,25 +8207,55 @@ static void btrfs_submit_direct(int rw, struct bio *dio_bio, | |||
8210 | 8207 | ||
8211 | if (btrfs_bio->end_io) | 8208 | if (btrfs_bio->end_io) |
8212 | btrfs_bio->end_io(btrfs_bio, ret); | 8209 | btrfs_bio->end_io(btrfs_bio, ret); |
8213 | free_io_bio: | ||
8214 | bio_put(io_bio); | ||
8215 | 8210 | ||
8216 | free_ordered: | 8211 | free_ordered: |
8217 | /* | 8212 | /* |
8218 | * If this is a write, we need to clean up the reserved space and kill | 8213 | * If we arrived here it means either we failed to submit the dip |
8219 | * the ordered extent. | 8214 | * or we either failed to clone the dio_bio or failed to allocate the |
8215 | * dip. If we cloned the dio_bio and allocated the dip, we can just | ||
8216 | * call bio_endio against our io_bio so that we get proper resource | ||
8217 | * cleanup if we fail to submit the dip, otherwise, we must do the | ||
8218 | * same as btrfs_endio_direct_[write|read] because we can't call these | ||
8219 | * callbacks - they require an allocated dip and a clone of dio_bio. | ||
8220 | */ | 8220 | */ |
8221 | if (write) { | 8221 | if (io_bio && dip) { |
8222 | struct btrfs_ordered_extent *ordered; | 8222 | bio_endio(io_bio, ret); |
8223 | ordered = btrfs_lookup_ordered_extent(inode, file_offset); | 8223 | /* |
8224 | if (!test_bit(BTRFS_ORDERED_PREALLOC, &ordered->flags) && | 8224 | * The end io callbacks free our dip, do the final put on io_bio |
8225 | !test_bit(BTRFS_ORDERED_NOCOW, &ordered->flags)) | 8225 | * and all the cleanup and final put for dio_bio (through |
8226 | btrfs_free_reserved_extent(root, ordered->start, | 8226 | * dio_end_io()). |
8227 | ordered->disk_len, 1); | 8227 | */ |
8228 | btrfs_put_ordered_extent(ordered); | 8228 | dip = NULL; |
8229 | btrfs_put_ordered_extent(ordered); | 8229 | io_bio = NULL; |
8230 | } else { | ||
8231 | if (write) { | ||
8232 | struct btrfs_ordered_extent *ordered; | ||
8233 | |||
8234 | ordered = btrfs_lookup_ordered_extent(inode, | ||
8235 | file_offset); | ||
8236 | set_bit(BTRFS_ORDERED_IOERR, &ordered->flags); | ||
8237 | /* | ||
8238 | * Decrements our ref on the ordered extent and removes | ||
8239 | * the ordered extent from the inode's ordered tree, | ||
8240 | * doing all the proper resource cleanup such as for the | ||
8241 | * reserved space and waking up any waiters for this | ||
8242 | * ordered extent (through btrfs_remove_ordered_extent). | ||
8243 | */ | ||
8244 | btrfs_finish_ordered_io(ordered); | ||
8245 | } else { | ||
8246 | unlock_extent(&BTRFS_I(inode)->io_tree, file_offset, | ||
8247 | file_offset + dio_bio->bi_iter.bi_size - 1); | ||
8248 | } | ||
8249 | clear_bit(BIO_UPTODATE, &dio_bio->bi_flags); | ||
8250 | /* | ||
8251 | * Releases and cleans up our dio_bio, no need to bio_put() | ||
8252 | * nor bio_endio()/bio_io_error() against dio_bio. | ||
8253 | */ | ||
8254 | dio_end_io(dio_bio, ret); | ||
8230 | } | 8255 | } |
8231 | bio_endio(dio_bio, ret); | 8256 | if (io_bio) |
8257 | bio_put(io_bio); | ||
8258 | kfree(dip); | ||
8232 | } | 8259 | } |
8233 | 8260 | ||
8234 | static ssize_t check_direct_IO(struct btrfs_root *root, struct kiocb *iocb, | 8261 | static ssize_t check_direct_IO(struct btrfs_root *root, struct kiocb *iocb, |
@@ -8330,9 +8357,18 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, | |||
8330 | btrfs_submit_direct, flags); | 8357 | btrfs_submit_direct, flags); |
8331 | if (iov_iter_rw(iter) == WRITE) { | 8358 | if (iov_iter_rw(iter) == WRITE) { |
8332 | current->journal_info = NULL; | 8359 | current->journal_info = NULL; |
8333 | if (ret < 0 && ret != -EIOCBQUEUED) | 8360 | if (ret < 0 && ret != -EIOCBQUEUED) { |
8334 | btrfs_delalloc_release_space(inode, count); | 8361 | /* |
8335 | else if (ret >= 0 && (size_t)ret < count) | 8362 | * If the error comes from submitting stage, |
8363 | * btrfs_get_blocsk_direct() has free'd data space, | ||
8364 | * and metadata space will be handled by | ||
8365 | * finish_ordered_fn, don't do that again to make | ||
8366 | * sure bytes_may_use is correct. | ||
8367 | */ | ||
8368 | if (!test_and_clear_bit(BTRFS_INODE_DIO_READY, | ||
8369 | &BTRFS_I(inode)->runtime_flags)) | ||
8370 | btrfs_delalloc_release_space(inode, count); | ||
8371 | } else if (ret >= 0 && (size_t)ret < count) | ||
8336 | btrfs_delalloc_release_space(inode, | 8372 | btrfs_delalloc_release_space(inode, |
8337 | count - (size_t)ret); | 8373 | count - (size_t)ret); |
8338 | } | 8374 | } |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index c86b835da7a8..0770c91586ca 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -87,7 +87,8 @@ struct btrfs_ioctl_received_subvol_args_32 { | |||
87 | 87 | ||
88 | 88 | ||
89 | static int btrfs_clone(struct inode *src, struct inode *inode, | 89 | static int btrfs_clone(struct inode *src, struct inode *inode, |
90 | u64 off, u64 olen, u64 olen_aligned, u64 destoff); | 90 | u64 off, u64 olen, u64 olen_aligned, u64 destoff, |
91 | int no_time_update); | ||
91 | 92 | ||
92 | /* Mask out flags that are inappropriate for the given type of inode. */ | 93 | /* Mask out flags that are inappropriate for the given type of inode. */ |
93 | static inline __u32 btrfs_mask_flags(umode_t mode, __u32 flags) | 94 | static inline __u32 btrfs_mask_flags(umode_t mode, __u32 flags) |
@@ -2765,14 +2766,11 @@ out: | |||
2765 | return ret; | 2766 | return ret; |
2766 | } | 2767 | } |
2767 | 2768 | ||
2768 | static struct page *extent_same_get_page(struct inode *inode, u64 off) | 2769 | static struct page *extent_same_get_page(struct inode *inode, pgoff_t index) |
2769 | { | 2770 | { |
2770 | struct page *page; | 2771 | struct page *page; |
2771 | pgoff_t index; | ||
2772 | struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree; | 2772 | struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree; |
2773 | 2773 | ||
2774 | index = off >> PAGE_CACHE_SHIFT; | ||
2775 | |||
2776 | page = grab_cache_page(inode->i_mapping, index); | 2774 | page = grab_cache_page(inode->i_mapping, index); |
2777 | if (!page) | 2775 | if (!page) |
2778 | return NULL; | 2776 | return NULL; |
@@ -2793,6 +2791,20 @@ static struct page *extent_same_get_page(struct inode *inode, u64 off) | |||
2793 | return page; | 2791 | return page; |
2794 | } | 2792 | } |
2795 | 2793 | ||
2794 | static int gather_extent_pages(struct inode *inode, struct page **pages, | ||
2795 | int num_pages, u64 off) | ||
2796 | { | ||
2797 | int i; | ||
2798 | pgoff_t index = off >> PAGE_CACHE_SHIFT; | ||
2799 | |||
2800 | for (i = 0; i < num_pages; i++) { | ||
2801 | pages[i] = extent_same_get_page(inode, index + i); | ||
2802 | if (!pages[i]) | ||
2803 | return -ENOMEM; | ||
2804 | } | ||
2805 | return 0; | ||
2806 | } | ||
2807 | |||
2796 | static inline void lock_extent_range(struct inode *inode, u64 off, u64 len) | 2808 | static inline void lock_extent_range(struct inode *inode, u64 off, u64 len) |
2797 | { | 2809 | { |
2798 | /* do any pending delalloc/csum calc on src, one way or | 2810 | /* do any pending delalloc/csum calc on src, one way or |
@@ -2818,52 +2830,120 @@ static inline void lock_extent_range(struct inode *inode, u64 off, u64 len) | |||
2818 | } | 2830 | } |
2819 | } | 2831 | } |
2820 | 2832 | ||
2821 | static void btrfs_double_unlock(struct inode *inode1, u64 loff1, | 2833 | static void btrfs_double_inode_unlock(struct inode *inode1, struct inode *inode2) |
2822 | struct inode *inode2, u64 loff2, u64 len) | ||
2823 | { | 2834 | { |
2824 | unlock_extent(&BTRFS_I(inode1)->io_tree, loff1, loff1 + len - 1); | ||
2825 | unlock_extent(&BTRFS_I(inode2)->io_tree, loff2, loff2 + len - 1); | ||
2826 | |||
2827 | mutex_unlock(&inode1->i_mutex); | 2835 | mutex_unlock(&inode1->i_mutex); |
2828 | mutex_unlock(&inode2->i_mutex); | 2836 | mutex_unlock(&inode2->i_mutex); |
2829 | } | 2837 | } |
2830 | 2838 | ||
2831 | static void btrfs_double_lock(struct inode *inode1, u64 loff1, | 2839 | static void btrfs_double_inode_lock(struct inode *inode1, struct inode *inode2) |
2832 | struct inode *inode2, u64 loff2, u64 len) | 2840 | { |
2841 | if (inode1 < inode2) | ||
2842 | swap(inode1, inode2); | ||
2843 | |||
2844 | mutex_lock_nested(&inode1->i_mutex, I_MUTEX_PARENT); | ||
2845 | if (inode1 != inode2) | ||
2846 | mutex_lock_nested(&inode2->i_mutex, I_MUTEX_CHILD); | ||
2847 | } | ||
2848 | |||
2849 | static void btrfs_double_extent_unlock(struct inode *inode1, u64 loff1, | ||
2850 | struct inode *inode2, u64 loff2, u64 len) | ||
2851 | { | ||
2852 | unlock_extent(&BTRFS_I(inode1)->io_tree, loff1, loff1 + len - 1); | ||
2853 | unlock_extent(&BTRFS_I(inode2)->io_tree, loff2, loff2 + len - 1); | ||
2854 | } | ||
2855 | |||
2856 | static void btrfs_double_extent_lock(struct inode *inode1, u64 loff1, | ||
2857 | struct inode *inode2, u64 loff2, u64 len) | ||
2833 | { | 2858 | { |
2834 | if (inode1 < inode2) { | 2859 | if (inode1 < inode2) { |
2835 | swap(inode1, inode2); | 2860 | swap(inode1, inode2); |
2836 | swap(loff1, loff2); | 2861 | swap(loff1, loff2); |
2837 | } | 2862 | } |
2838 | |||
2839 | mutex_lock_nested(&inode1->i_mutex, I_MUTEX_PARENT); | ||
2840 | lock_extent_range(inode1, loff1, len); | 2863 | lock_extent_range(inode1, loff1, len); |
2841 | if (inode1 != inode2) { | 2864 | if (inode1 != inode2) |
2842 | mutex_lock_nested(&inode2->i_mutex, I_MUTEX_CHILD); | ||
2843 | lock_extent_range(inode2, loff2, len); | 2865 | lock_extent_range(inode2, loff2, len); |
2866 | } | ||
2867 | |||
2868 | struct cmp_pages { | ||
2869 | int num_pages; | ||
2870 | struct page **src_pages; | ||
2871 | struct page **dst_pages; | ||
2872 | }; | ||
2873 | |||
2874 | static void btrfs_cmp_data_free(struct cmp_pages *cmp) | ||
2875 | { | ||
2876 | int i; | ||
2877 | struct page *pg; | ||
2878 | |||
2879 | for (i = 0; i < cmp->num_pages; i++) { | ||
2880 | pg = cmp->src_pages[i]; | ||
2881 | if (pg) | ||
2882 | page_cache_release(pg); | ||
2883 | pg = cmp->dst_pages[i]; | ||
2884 | if (pg) | ||
2885 | page_cache_release(pg); | ||
2886 | } | ||
2887 | kfree(cmp->src_pages); | ||
2888 | kfree(cmp->dst_pages); | ||
2889 | } | ||
2890 | |||
2891 | static int btrfs_cmp_data_prepare(struct inode *src, u64 loff, | ||
2892 | struct inode *dst, u64 dst_loff, | ||
2893 | u64 len, struct cmp_pages *cmp) | ||
2894 | { | ||
2895 | int ret; | ||
2896 | int num_pages = PAGE_CACHE_ALIGN(len) >> PAGE_CACHE_SHIFT; | ||
2897 | struct page **src_pgarr, **dst_pgarr; | ||
2898 | |||
2899 | /* | ||
2900 | * We must gather up all the pages before we initiate our | ||
2901 | * extent locking. We use an array for the page pointers. Size | ||
2902 | * of the array is bounded by len, which is in turn bounded by | ||
2903 | * BTRFS_MAX_DEDUPE_LEN. | ||
2904 | */ | ||
2905 | src_pgarr = kzalloc(num_pages * sizeof(struct page *), GFP_NOFS); | ||
2906 | dst_pgarr = kzalloc(num_pages * sizeof(struct page *), GFP_NOFS); | ||
2907 | if (!src_pgarr || !dst_pgarr) { | ||
2908 | kfree(src_pgarr); | ||
2909 | kfree(dst_pgarr); | ||
2910 | return -ENOMEM; | ||
2844 | } | 2911 | } |
2912 | cmp->num_pages = num_pages; | ||
2913 | cmp->src_pages = src_pgarr; | ||
2914 | cmp->dst_pages = dst_pgarr; | ||
2915 | |||
2916 | ret = gather_extent_pages(src, cmp->src_pages, cmp->num_pages, loff); | ||
2917 | if (ret) | ||
2918 | goto out; | ||
2919 | |||
2920 | ret = gather_extent_pages(dst, cmp->dst_pages, cmp->num_pages, dst_loff); | ||
2921 | |||
2922 | out: | ||
2923 | if (ret) | ||
2924 | btrfs_cmp_data_free(cmp); | ||
2925 | return 0; | ||
2845 | } | 2926 | } |
2846 | 2927 | ||
2847 | static int btrfs_cmp_data(struct inode *src, u64 loff, struct inode *dst, | 2928 | static int btrfs_cmp_data(struct inode *src, u64 loff, struct inode *dst, |
2848 | u64 dst_loff, u64 len) | 2929 | u64 dst_loff, u64 len, struct cmp_pages *cmp) |
2849 | { | 2930 | { |
2850 | int ret = 0; | 2931 | int ret = 0; |
2932 | int i; | ||
2851 | struct page *src_page, *dst_page; | 2933 | struct page *src_page, *dst_page; |
2852 | unsigned int cmp_len = PAGE_CACHE_SIZE; | 2934 | unsigned int cmp_len = PAGE_CACHE_SIZE; |
2853 | void *addr, *dst_addr; | 2935 | void *addr, *dst_addr; |
2854 | 2936 | ||
2937 | i = 0; | ||
2855 | while (len) { | 2938 | while (len) { |
2856 | if (len < PAGE_CACHE_SIZE) | 2939 | if (len < PAGE_CACHE_SIZE) |
2857 | cmp_len = len; | 2940 | cmp_len = len; |
2858 | 2941 | ||
2859 | src_page = extent_same_get_page(src, loff); | 2942 | BUG_ON(i >= cmp->num_pages); |
2860 | if (!src_page) | 2943 | |
2861 | return -EINVAL; | 2944 | src_page = cmp->src_pages[i]; |
2862 | dst_page = extent_same_get_page(dst, dst_loff); | 2945 | dst_page = cmp->dst_pages[i]; |
2863 | if (!dst_page) { | 2946 | |
2864 | page_cache_release(src_page); | ||
2865 | return -EINVAL; | ||
2866 | } | ||
2867 | addr = kmap_atomic(src_page); | 2947 | addr = kmap_atomic(src_page); |
2868 | dst_addr = kmap_atomic(dst_page); | 2948 | dst_addr = kmap_atomic(dst_page); |
2869 | 2949 | ||
@@ -2875,15 +2955,12 @@ static int btrfs_cmp_data(struct inode *src, u64 loff, struct inode *dst, | |||
2875 | 2955 | ||
2876 | kunmap_atomic(addr); | 2956 | kunmap_atomic(addr); |
2877 | kunmap_atomic(dst_addr); | 2957 | kunmap_atomic(dst_addr); |
2878 | page_cache_release(src_page); | ||
2879 | page_cache_release(dst_page); | ||
2880 | 2958 | ||
2881 | if (ret) | 2959 | if (ret) |
2882 | break; | 2960 | break; |
2883 | 2961 | ||
2884 | loff += cmp_len; | ||
2885 | dst_loff += cmp_len; | ||
2886 | len -= cmp_len; | 2962 | len -= cmp_len; |
2963 | i++; | ||
2887 | } | 2964 | } |
2888 | 2965 | ||
2889 | return ret; | 2966 | return ret; |
@@ -2914,27 +2991,62 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen, | |||
2914 | { | 2991 | { |
2915 | int ret; | 2992 | int ret; |
2916 | u64 len = olen; | 2993 | u64 len = olen; |
2994 | struct cmp_pages cmp; | ||
2995 | int same_inode = 0; | ||
2996 | u64 same_lock_start = 0; | ||
2997 | u64 same_lock_len = 0; | ||
2917 | 2998 | ||
2918 | /* | ||
2919 | * btrfs_clone() can't handle extents in the same file | ||
2920 | * yet. Once that works, we can drop this check and replace it | ||
2921 | * with a check for the same inode, but overlapping extents. | ||
2922 | */ | ||
2923 | if (src == dst) | 2999 | if (src == dst) |
2924 | return -EINVAL; | 3000 | same_inode = 1; |
2925 | 3001 | ||
2926 | if (len == 0) | 3002 | if (len == 0) |
2927 | return 0; | 3003 | return 0; |
2928 | 3004 | ||
2929 | btrfs_double_lock(src, loff, dst, dst_loff, len); | 3005 | if (same_inode) { |
3006 | mutex_lock(&src->i_mutex); | ||
2930 | 3007 | ||
2931 | ret = extent_same_check_offsets(src, loff, &len, olen); | 3008 | ret = extent_same_check_offsets(src, loff, &len, olen); |
2932 | if (ret) | 3009 | if (ret) |
2933 | goto out_unlock; | 3010 | goto out_unlock; |
2934 | 3011 | ||
2935 | ret = extent_same_check_offsets(dst, dst_loff, &len, olen); | 3012 | /* |
2936 | if (ret) | 3013 | * Single inode case wants the same checks, except we |
2937 | goto out_unlock; | 3014 | * don't want our length pushed out past i_size as |
3015 | * comparing that data range makes no sense. | ||
3016 | * | ||
3017 | * extent_same_check_offsets() will do this for an | ||
3018 | * unaligned length at i_size, so catch it here and | ||
3019 | * reject the request. | ||
3020 | * | ||
3021 | * This effectively means we require aligned extents | ||
3022 | * for the single-inode case, whereas the other cases | ||
3023 | * allow an unaligned length so long as it ends at | ||
3024 | * i_size. | ||
3025 | */ | ||
3026 | if (len != olen) { | ||
3027 | ret = -EINVAL; | ||
3028 | goto out_unlock; | ||
3029 | } | ||
3030 | |||
3031 | /* Check for overlapping ranges */ | ||
3032 | if (dst_loff + len > loff && dst_loff < loff + len) { | ||
3033 | ret = -EINVAL; | ||
3034 | goto out_unlock; | ||
3035 | } | ||
3036 | |||
3037 | same_lock_start = min_t(u64, loff, dst_loff); | ||
3038 | same_lock_len = max_t(u64, loff, dst_loff) + len - same_lock_start; | ||
3039 | } else { | ||
3040 | btrfs_double_inode_lock(src, dst); | ||
3041 | |||
3042 | ret = extent_same_check_offsets(src, loff, &len, olen); | ||
3043 | if (ret) | ||
3044 | goto out_unlock; | ||
3045 | |||
3046 | ret = extent_same_check_offsets(dst, dst_loff, &len, olen); | ||
3047 | if (ret) | ||
3048 | goto out_unlock; | ||
3049 | } | ||
2938 | 3050 | ||
2939 | /* don't make the dst file partly checksummed */ | 3051 | /* don't make the dst file partly checksummed */ |
2940 | if ((BTRFS_I(src)->flags & BTRFS_INODE_NODATASUM) != | 3052 | if ((BTRFS_I(src)->flags & BTRFS_INODE_NODATASUM) != |
@@ -2943,12 +3055,32 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen, | |||
2943 | goto out_unlock; | 3055 | goto out_unlock; |
2944 | } | 3056 | } |
2945 | 3057 | ||
2946 | ret = btrfs_cmp_data(src, loff, dst, dst_loff, len); | 3058 | ret = btrfs_cmp_data_prepare(src, loff, dst, dst_loff, olen, &cmp); |
3059 | if (ret) | ||
3060 | goto out_unlock; | ||
3061 | |||
3062 | if (same_inode) | ||
3063 | lock_extent_range(src, same_lock_start, same_lock_len); | ||
3064 | else | ||
3065 | btrfs_double_extent_lock(src, loff, dst, dst_loff, len); | ||
3066 | |||
3067 | /* pass original length for comparison so we stay within i_size */ | ||
3068 | ret = btrfs_cmp_data(src, loff, dst, dst_loff, olen, &cmp); | ||
2947 | if (ret == 0) | 3069 | if (ret == 0) |
2948 | ret = btrfs_clone(src, dst, loff, olen, len, dst_loff); | 3070 | ret = btrfs_clone(src, dst, loff, olen, len, dst_loff, 1); |
3071 | |||
3072 | if (same_inode) | ||
3073 | unlock_extent(&BTRFS_I(src)->io_tree, same_lock_start, | ||
3074 | same_lock_start + same_lock_len - 1); | ||
3075 | else | ||
3076 | btrfs_double_extent_unlock(src, loff, dst, dst_loff, len); | ||
2949 | 3077 | ||
3078 | btrfs_cmp_data_free(&cmp); | ||
2950 | out_unlock: | 3079 | out_unlock: |
2951 | btrfs_double_unlock(src, loff, dst, dst_loff, len); | 3080 | if (same_inode) |
3081 | mutex_unlock(&src->i_mutex); | ||
3082 | else | ||
3083 | btrfs_double_inode_unlock(src, dst); | ||
2952 | 3084 | ||
2953 | return ret; | 3085 | return ret; |
2954 | } | 3086 | } |
@@ -2958,7 +3090,7 @@ out_unlock: | |||
2958 | static long btrfs_ioctl_file_extent_same(struct file *file, | 3090 | static long btrfs_ioctl_file_extent_same(struct file *file, |
2959 | struct btrfs_ioctl_same_args __user *argp) | 3091 | struct btrfs_ioctl_same_args __user *argp) |
2960 | { | 3092 | { |
2961 | struct btrfs_ioctl_same_args *same; | 3093 | struct btrfs_ioctl_same_args *same = NULL; |
2962 | struct btrfs_ioctl_same_extent_info *info; | 3094 | struct btrfs_ioctl_same_extent_info *info; |
2963 | struct inode *src = file_inode(file); | 3095 | struct inode *src = file_inode(file); |
2964 | u64 off; | 3096 | u64 off; |
@@ -2988,6 +3120,7 @@ static long btrfs_ioctl_file_extent_same(struct file *file, | |||
2988 | 3120 | ||
2989 | if (IS_ERR(same)) { | 3121 | if (IS_ERR(same)) { |
2990 | ret = PTR_ERR(same); | 3122 | ret = PTR_ERR(same); |
3123 | same = NULL; | ||
2991 | goto out; | 3124 | goto out; |
2992 | } | 3125 | } |
2993 | 3126 | ||
@@ -3058,6 +3191,7 @@ static long btrfs_ioctl_file_extent_same(struct file *file, | |||
3058 | 3191 | ||
3059 | out: | 3192 | out: |
3060 | mnt_drop_write_file(file); | 3193 | mnt_drop_write_file(file); |
3194 | kfree(same); | ||
3061 | return ret; | 3195 | return ret; |
3062 | } | 3196 | } |
3063 | 3197 | ||
@@ -3100,13 +3234,15 @@ static int clone_finish_inode_update(struct btrfs_trans_handle *trans, | |||
3100 | struct inode *inode, | 3234 | struct inode *inode, |
3101 | u64 endoff, | 3235 | u64 endoff, |
3102 | const u64 destoff, | 3236 | const u64 destoff, |
3103 | const u64 olen) | 3237 | const u64 olen, |
3238 | int no_time_update) | ||
3104 | { | 3239 | { |
3105 | struct btrfs_root *root = BTRFS_I(inode)->root; | 3240 | struct btrfs_root *root = BTRFS_I(inode)->root; |
3106 | int ret; | 3241 | int ret; |
3107 | 3242 | ||
3108 | inode_inc_iversion(inode); | 3243 | inode_inc_iversion(inode); |
3109 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 3244 | if (!no_time_update) |
3245 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
3110 | /* | 3246 | /* |
3111 | * We round up to the block size at eof when determining which | 3247 | * We round up to the block size at eof when determining which |
3112 | * extents to clone above, but shouldn't round up the file size. | 3248 | * extents to clone above, but shouldn't round up the file size. |
@@ -3191,13 +3327,13 @@ static void clone_update_extent_map(struct inode *inode, | |||
3191 | * @inode: Inode to clone to | 3327 | * @inode: Inode to clone to |
3192 | * @off: Offset within source to start clone from | 3328 | * @off: Offset within source to start clone from |
3193 | * @olen: Original length, passed by user, of range to clone | 3329 | * @olen: Original length, passed by user, of range to clone |
3194 | * @olen_aligned: Block-aligned value of olen, extent_same uses | 3330 | * @olen_aligned: Block-aligned value of olen |
3195 | * identical values here | ||
3196 | * @destoff: Offset within @inode to start clone | 3331 | * @destoff: Offset within @inode to start clone |
3332 | * @no_time_update: Whether to update mtime/ctime on the target inode | ||
3197 | */ | 3333 | */ |
3198 | static int btrfs_clone(struct inode *src, struct inode *inode, | 3334 | static int btrfs_clone(struct inode *src, struct inode *inode, |
3199 | const u64 off, const u64 olen, const u64 olen_aligned, | 3335 | const u64 off, const u64 olen, const u64 olen_aligned, |
3200 | const u64 destoff) | 3336 | const u64 destoff, int no_time_update) |
3201 | { | 3337 | { |
3202 | struct btrfs_root *root = BTRFS_I(inode)->root; | 3338 | struct btrfs_root *root = BTRFS_I(inode)->root; |
3203 | struct btrfs_path *path = NULL; | 3339 | struct btrfs_path *path = NULL; |
@@ -3452,6 +3588,20 @@ process_slot: | |||
3452 | u64 trim = 0; | 3588 | u64 trim = 0; |
3453 | u64 aligned_end = 0; | 3589 | u64 aligned_end = 0; |
3454 | 3590 | ||
3591 | /* | ||
3592 | * Don't copy an inline extent into an offset | ||
3593 | * greater than zero. Having an inline extent | ||
3594 | * at such an offset results in chaos as btrfs | ||
3595 | * isn't prepared for such cases. Just skip | ||
3596 | * this case for the same reasons as commented | ||
3597 | * at btrfs_ioctl_clone(). | ||
3598 | */ | ||
3599 | if (last_dest_end > 0) { | ||
3600 | ret = -EOPNOTSUPP; | ||
3601 | btrfs_end_transaction(trans, root); | ||
3602 | goto out; | ||
3603 | } | ||
3604 | |||
3455 | if (off > key.offset) { | 3605 | if (off > key.offset) { |
3456 | skip = off - key.offset; | 3606 | skip = off - key.offset; |
3457 | new_key.offset += skip; | 3607 | new_key.offset += skip; |
@@ -3521,7 +3671,8 @@ process_slot: | |||
3521 | root->sectorsize); | 3671 | root->sectorsize); |
3522 | ret = clone_finish_inode_update(trans, inode, | 3672 | ret = clone_finish_inode_update(trans, inode, |
3523 | last_dest_end, | 3673 | last_dest_end, |
3524 | destoff, olen); | 3674 | destoff, olen, |
3675 | no_time_update); | ||
3525 | if (ret) | 3676 | if (ret) |
3526 | goto out; | 3677 | goto out; |
3527 | if (new_key.offset + datal >= destoff + len) | 3678 | if (new_key.offset + datal >= destoff + len) |
@@ -3559,7 +3710,7 @@ process_slot: | |||
3559 | clone_update_extent_map(inode, trans, NULL, last_dest_end, | 3710 | clone_update_extent_map(inode, trans, NULL, last_dest_end, |
3560 | destoff + len - last_dest_end); | 3711 | destoff + len - last_dest_end); |
3561 | ret = clone_finish_inode_update(trans, inode, destoff + len, | 3712 | ret = clone_finish_inode_update(trans, inode, destoff + len, |
3562 | destoff, olen); | 3713 | destoff, olen, no_time_update); |
3563 | } | 3714 | } |
3564 | 3715 | ||
3565 | out: | 3716 | out: |
@@ -3696,7 +3847,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
3696 | lock_extent_range(inode, destoff, len); | 3847 | lock_extent_range(inode, destoff, len); |
3697 | } | 3848 | } |
3698 | 3849 | ||
3699 | ret = btrfs_clone(src, inode, off, olen, len, destoff); | 3850 | ret = btrfs_clone(src, inode, off, olen, len, destoff, 0); |
3700 | 3851 | ||
3701 | if (same_inode) { | 3852 | if (same_inode) { |
3702 | u64 lock_start = min_t(u64, off, destoff); | 3853 | u64 lock_start = min_t(u64, off, destoff); |
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 89656d799ff6..52170cf1757e 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
@@ -552,6 +552,10 @@ void btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry) | |||
552 | trace_btrfs_ordered_extent_put(entry->inode, entry); | 552 | trace_btrfs_ordered_extent_put(entry->inode, entry); |
553 | 553 | ||
554 | if (atomic_dec_and_test(&entry->refs)) { | 554 | if (atomic_dec_and_test(&entry->refs)) { |
555 | ASSERT(list_empty(&entry->log_list)); | ||
556 | ASSERT(list_empty(&entry->trans_list)); | ||
557 | ASSERT(list_empty(&entry->root_extent_list)); | ||
558 | ASSERT(RB_EMPTY_NODE(&entry->rb_node)); | ||
555 | if (entry->inode) | 559 | if (entry->inode) |
556 | btrfs_add_delayed_iput(entry->inode); | 560 | btrfs_add_delayed_iput(entry->inode); |
557 | while (!list_empty(&entry->list)) { | 561 | while (!list_empty(&entry->list)) { |
@@ -579,6 +583,7 @@ void btrfs_remove_ordered_extent(struct inode *inode, | |||
579 | spin_lock_irq(&tree->lock); | 583 | spin_lock_irq(&tree->lock); |
580 | node = &entry->rb_node; | 584 | node = &entry->rb_node; |
581 | rb_erase(node, &tree->tree); | 585 | rb_erase(node, &tree->tree); |
586 | RB_CLEAR_NODE(node); | ||
582 | if (tree->last == node) | 587 | if (tree->last == node) |
583 | tree->last = NULL; | 588 | tree->last = NULL; |
584 | set_bit(BTRFS_ORDERED_COMPLETE, &entry->flags); | 589 | set_bit(BTRFS_ORDERED_COMPLETE, &entry->flags); |
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index d5f1f033b7a0..e9ace099162c 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -1349,6 +1349,11 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, | |||
1349 | struct btrfs_root *quota_root; | 1349 | struct btrfs_root *quota_root; |
1350 | struct btrfs_qgroup *qgroup; | 1350 | struct btrfs_qgroup *qgroup; |
1351 | int ret = 0; | 1351 | int ret = 0; |
1352 | /* Sometimes we would want to clear the limit on this qgroup. | ||
1353 | * To meet this requirement, we treat the -1 as a special value | ||
1354 | * which tell kernel to clear the limit on this qgroup. | ||
1355 | */ | ||
1356 | const u64 CLEAR_VALUE = -1; | ||
1352 | 1357 | ||
1353 | mutex_lock(&fs_info->qgroup_ioctl_lock); | 1358 | mutex_lock(&fs_info->qgroup_ioctl_lock); |
1354 | quota_root = fs_info->quota_root; | 1359 | quota_root = fs_info->quota_root; |
@@ -1364,14 +1369,42 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, | |||
1364 | } | 1369 | } |
1365 | 1370 | ||
1366 | spin_lock(&fs_info->qgroup_lock); | 1371 | spin_lock(&fs_info->qgroup_lock); |
1367 | if (limit->flags & BTRFS_QGROUP_LIMIT_MAX_RFER) | 1372 | if (limit->flags & BTRFS_QGROUP_LIMIT_MAX_RFER) { |
1368 | qgroup->max_rfer = limit->max_rfer; | 1373 | if (limit->max_rfer == CLEAR_VALUE) { |
1369 | if (limit->flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) | 1374 | qgroup->lim_flags &= ~BTRFS_QGROUP_LIMIT_MAX_RFER; |
1370 | qgroup->max_excl = limit->max_excl; | 1375 | limit->flags &= ~BTRFS_QGROUP_LIMIT_MAX_RFER; |
1371 | if (limit->flags & BTRFS_QGROUP_LIMIT_RSV_RFER) | 1376 | qgroup->max_rfer = 0; |
1372 | qgroup->rsv_rfer = limit->rsv_rfer; | 1377 | } else { |
1373 | if (limit->flags & BTRFS_QGROUP_LIMIT_RSV_EXCL) | 1378 | qgroup->max_rfer = limit->max_rfer; |
1374 | qgroup->rsv_excl = limit->rsv_excl; | 1379 | } |
1380 | } | ||
1381 | if (limit->flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) { | ||
1382 | if (limit->max_excl == CLEAR_VALUE) { | ||
1383 | qgroup->lim_flags &= ~BTRFS_QGROUP_LIMIT_MAX_EXCL; | ||
1384 | limit->flags &= ~BTRFS_QGROUP_LIMIT_MAX_EXCL; | ||
1385 | qgroup->max_excl = 0; | ||
1386 | } else { | ||
1387 | qgroup->max_excl = limit->max_excl; | ||
1388 | } | ||
1389 | } | ||
1390 | if (limit->flags & BTRFS_QGROUP_LIMIT_RSV_RFER) { | ||
1391 | if (limit->rsv_rfer == CLEAR_VALUE) { | ||
1392 | qgroup->lim_flags &= ~BTRFS_QGROUP_LIMIT_RSV_RFER; | ||
1393 | limit->flags &= ~BTRFS_QGROUP_LIMIT_RSV_RFER; | ||
1394 | qgroup->rsv_rfer = 0; | ||
1395 | } else { | ||
1396 | qgroup->rsv_rfer = limit->rsv_rfer; | ||
1397 | } | ||
1398 | } | ||
1399 | if (limit->flags & BTRFS_QGROUP_LIMIT_RSV_EXCL) { | ||
1400 | if (limit->rsv_excl == CLEAR_VALUE) { | ||
1401 | qgroup->lim_flags &= ~BTRFS_QGROUP_LIMIT_RSV_EXCL; | ||
1402 | limit->flags &= ~BTRFS_QGROUP_LIMIT_RSV_EXCL; | ||
1403 | qgroup->rsv_excl = 0; | ||
1404 | } else { | ||
1405 | qgroup->rsv_excl = limit->rsv_excl; | ||
1406 | } | ||
1407 | } | ||
1375 | qgroup->lim_flags |= limit->flags; | 1408 | qgroup->lim_flags |= limit->flags; |
1376 | 1409 | ||
1377 | spin_unlock(&fs_info->qgroup_lock); | 1410 | spin_unlock(&fs_info->qgroup_lock); |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 827951fbf7fc..88cbb5995667 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -4049,7 +4049,7 @@ restart: | |||
4049 | if (trans && progress && err == -ENOSPC) { | 4049 | if (trans && progress && err == -ENOSPC) { |
4050 | ret = btrfs_force_chunk_alloc(trans, rc->extent_root, | 4050 | ret = btrfs_force_chunk_alloc(trans, rc->extent_root, |
4051 | rc->block_group->flags); | 4051 | rc->block_group->flags); |
4052 | if (ret == 0) { | 4052 | if (ret == 1) { |
4053 | err = 0; | 4053 | err = 0; |
4054 | progress = 0; | 4054 | progress = 0; |
4055 | goto restart; | 4055 | goto restart; |
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 9f2feabe99f2..94db0fa5225a 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -3571,7 +3571,6 @@ static noinline_for_stack int scrub_supers(struct scrub_ctx *sctx, | |||
3571 | static noinline_for_stack int scrub_workers_get(struct btrfs_fs_info *fs_info, | 3571 | static noinline_for_stack int scrub_workers_get(struct btrfs_fs_info *fs_info, |
3572 | int is_dev_replace) | 3572 | int is_dev_replace) |
3573 | { | 3573 | { |
3574 | int ret = 0; | ||
3575 | unsigned int flags = WQ_FREEZABLE | WQ_UNBOUND; | 3574 | unsigned int flags = WQ_FREEZABLE | WQ_UNBOUND; |
3576 | int max_active = fs_info->thread_pool_size; | 3575 | int max_active = fs_info->thread_pool_size; |
3577 | 3576 | ||
@@ -3584,34 +3583,36 @@ static noinline_for_stack int scrub_workers_get(struct btrfs_fs_info *fs_info, | |||
3584 | fs_info->scrub_workers = | 3583 | fs_info->scrub_workers = |
3585 | btrfs_alloc_workqueue("btrfs-scrub", flags, | 3584 | btrfs_alloc_workqueue("btrfs-scrub", flags, |
3586 | max_active, 4); | 3585 | max_active, 4); |
3587 | if (!fs_info->scrub_workers) { | 3586 | if (!fs_info->scrub_workers) |
3588 | ret = -ENOMEM; | 3587 | goto fail_scrub_workers; |
3589 | goto out; | 3588 | |
3590 | } | ||
3591 | fs_info->scrub_wr_completion_workers = | 3589 | fs_info->scrub_wr_completion_workers = |
3592 | btrfs_alloc_workqueue("btrfs-scrubwrc", flags, | 3590 | btrfs_alloc_workqueue("btrfs-scrubwrc", flags, |
3593 | max_active, 2); | 3591 | max_active, 2); |
3594 | if (!fs_info->scrub_wr_completion_workers) { | 3592 | if (!fs_info->scrub_wr_completion_workers) |
3595 | ret = -ENOMEM; | 3593 | goto fail_scrub_wr_completion_workers; |
3596 | goto out; | 3594 | |
3597 | } | ||
3598 | fs_info->scrub_nocow_workers = | 3595 | fs_info->scrub_nocow_workers = |
3599 | btrfs_alloc_workqueue("btrfs-scrubnc", flags, 1, 0); | 3596 | btrfs_alloc_workqueue("btrfs-scrubnc", flags, 1, 0); |
3600 | if (!fs_info->scrub_nocow_workers) { | 3597 | if (!fs_info->scrub_nocow_workers) |
3601 | ret = -ENOMEM; | 3598 | goto fail_scrub_nocow_workers; |
3602 | goto out; | ||
3603 | } | ||
3604 | fs_info->scrub_parity_workers = | 3599 | fs_info->scrub_parity_workers = |
3605 | btrfs_alloc_workqueue("btrfs-scrubparity", flags, | 3600 | btrfs_alloc_workqueue("btrfs-scrubparity", flags, |
3606 | max_active, 2); | 3601 | max_active, 2); |
3607 | if (!fs_info->scrub_parity_workers) { | 3602 | if (!fs_info->scrub_parity_workers) |
3608 | ret = -ENOMEM; | 3603 | goto fail_scrub_parity_workers; |
3609 | goto out; | ||
3610 | } | ||
3611 | } | 3604 | } |
3612 | ++fs_info->scrub_workers_refcnt; | 3605 | ++fs_info->scrub_workers_refcnt; |
3613 | out: | 3606 | return 0; |
3614 | return ret; | 3607 | |
3608 | fail_scrub_parity_workers: | ||
3609 | btrfs_destroy_workqueue(fs_info->scrub_nocow_workers); | ||
3610 | fail_scrub_nocow_workers: | ||
3611 | btrfs_destroy_workqueue(fs_info->scrub_wr_completion_workers); | ||
3612 | fail_scrub_wr_completion_workers: | ||
3613 | btrfs_destroy_workqueue(fs_info->scrub_workers); | ||
3614 | fail_scrub_workers: | ||
3615 | return -ENOMEM; | ||
3615 | } | 3616 | } |
3616 | 3617 | ||
3617 | static noinline_for_stack void scrub_workers_put(struct btrfs_fs_info *fs_info) | 3618 | static noinline_for_stack void scrub_workers_put(struct btrfs_fs_info *fs_info) |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index c0f18e7266b6..51e0f0d0053e 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -761,7 +761,7 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, | |||
761 | 761 | ||
762 | if (!list_empty(&trans->ordered)) { | 762 | if (!list_empty(&trans->ordered)) { |
763 | spin_lock(&info->trans_lock); | 763 | spin_lock(&info->trans_lock); |
764 | list_splice(&trans->ordered, &cur_trans->pending_ordered); | 764 | list_splice_init(&trans->ordered, &cur_trans->pending_ordered); |
765 | spin_unlock(&info->trans_lock); | 765 | spin_unlock(&info->trans_lock); |
766 | } | 766 | } |
767 | 767 | ||
@@ -1866,7 +1866,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1866 | } | 1866 | } |
1867 | 1867 | ||
1868 | spin_lock(&root->fs_info->trans_lock); | 1868 | spin_lock(&root->fs_info->trans_lock); |
1869 | list_splice(&trans->ordered, &cur_trans->pending_ordered); | 1869 | list_splice_init(&trans->ordered, &cur_trans->pending_ordered); |
1870 | if (cur_trans->state >= TRANS_STATE_COMMIT_START) { | 1870 | if (cur_trans->state >= TRANS_STATE_COMMIT_START) { |
1871 | spin_unlock(&root->fs_info->trans_lock); | 1871 | spin_unlock(&root->fs_info->trans_lock); |
1872 | atomic_inc(&cur_trans->use_count); | 1872 | atomic_inc(&cur_trans->use_count); |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 1ce80c1c4eb6..9c45431e69ab 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -4117,6 +4117,187 @@ static int logged_inode_size(struct btrfs_root *log, struct inode *inode, | |||
4117 | return 0; | 4117 | return 0; |
4118 | } | 4118 | } |
4119 | 4119 | ||
4120 | /* | ||
4121 | * At the moment we always log all xattrs. This is to figure out at log replay | ||
4122 | * time which xattrs must have their deletion replayed. If a xattr is missing | ||
4123 | * in the log tree and exists in the fs/subvol tree, we delete it. This is | ||
4124 | * because if a xattr is deleted, the inode is fsynced and a power failure | ||
4125 | * happens, causing the log to be replayed the next time the fs is mounted, | ||
4126 | * we want the xattr to not exist anymore (same behaviour as other filesystems | ||
4127 | * with a journal, ext3/4, xfs, f2fs, etc). | ||
4128 | */ | ||
4129 | static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans, | ||
4130 | struct btrfs_root *root, | ||
4131 | struct inode *inode, | ||
4132 | struct btrfs_path *path, | ||
4133 | struct btrfs_path *dst_path) | ||
4134 | { | ||
4135 | int ret; | ||
4136 | struct btrfs_key key; | ||
4137 | const u64 ino = btrfs_ino(inode); | ||
4138 | int ins_nr = 0; | ||
4139 | int start_slot = 0; | ||
4140 | |||
4141 | key.objectid = ino; | ||
4142 | key.type = BTRFS_XATTR_ITEM_KEY; | ||
4143 | key.offset = 0; | ||
4144 | |||
4145 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); | ||
4146 | if (ret < 0) | ||
4147 | return ret; | ||
4148 | |||
4149 | while (true) { | ||
4150 | int slot = path->slots[0]; | ||
4151 | struct extent_buffer *leaf = path->nodes[0]; | ||
4152 | int nritems = btrfs_header_nritems(leaf); | ||
4153 | |||
4154 | if (slot >= nritems) { | ||
4155 | if (ins_nr > 0) { | ||
4156 | u64 last_extent = 0; | ||
4157 | |||
4158 | ret = copy_items(trans, inode, dst_path, path, | ||
4159 | &last_extent, start_slot, | ||
4160 | ins_nr, 1, 0); | ||
4161 | /* can't be 1, extent items aren't processed */ | ||
4162 | ASSERT(ret <= 0); | ||
4163 | if (ret < 0) | ||
4164 | return ret; | ||
4165 | ins_nr = 0; | ||
4166 | } | ||
4167 | ret = btrfs_next_leaf(root, path); | ||
4168 | if (ret < 0) | ||
4169 | return ret; | ||
4170 | else if (ret > 0) | ||
4171 | break; | ||
4172 | continue; | ||
4173 | } | ||
4174 | |||
4175 | btrfs_item_key_to_cpu(leaf, &key, slot); | ||
4176 | if (key.objectid != ino || key.type != BTRFS_XATTR_ITEM_KEY) | ||
4177 | break; | ||
4178 | |||
4179 | if (ins_nr == 0) | ||
4180 | start_slot = slot; | ||
4181 | ins_nr++; | ||
4182 | path->slots[0]++; | ||
4183 | cond_resched(); | ||
4184 | } | ||
4185 | if (ins_nr > 0) { | ||
4186 | u64 last_extent = 0; | ||
4187 | |||
4188 | ret = copy_items(trans, inode, dst_path, path, | ||
4189 | &last_extent, start_slot, | ||
4190 | ins_nr, 1, 0); | ||
4191 | /* can't be 1, extent items aren't processed */ | ||
4192 | ASSERT(ret <= 0); | ||
4193 | if (ret < 0) | ||
4194 | return ret; | ||
4195 | } | ||
4196 | |||
4197 | return 0; | ||
4198 | } | ||
4199 | |||
4200 | /* | ||
4201 | * If the no holes feature is enabled we need to make sure any hole between the | ||
4202 | * last extent and the i_size of our inode is explicitly marked in the log. This | ||
4203 | * is to make sure that doing something like: | ||
4204 | * | ||
4205 | * 1) create file with 128Kb of data | ||
4206 | * 2) truncate file to 64Kb | ||
4207 | * 3) truncate file to 256Kb | ||
4208 | * 4) fsync file | ||
4209 | * 5) <crash/power failure> | ||
4210 | * 6) mount fs and trigger log replay | ||
4211 | * | ||
4212 | * Will give us a file with a size of 256Kb, the first 64Kb of data match what | ||
4213 | * the file had in its first 64Kb of data at step 1 and the last 192Kb of the | ||
4214 | * file correspond to a hole. The presence of explicit holes in a log tree is | ||
4215 | * what guarantees that log replay will remove/adjust file extent items in the | ||
4216 | * fs/subvol tree. | ||
4217 | * | ||
4218 | * Here we do not need to care about holes between extents, that is already done | ||
4219 | * by copy_items(). We also only need to do this in the full sync path, where we | ||
4220 | * lookup for extents from the fs/subvol tree only. In the fast path case, we | ||
4221 | * lookup the list of modified extent maps and if any represents a hole, we | ||
4222 | * insert a corresponding extent representing a hole in the log tree. | ||
4223 | */ | ||
4224 | static int btrfs_log_trailing_hole(struct btrfs_trans_handle *trans, | ||
4225 | struct btrfs_root *root, | ||
4226 | struct inode *inode, | ||
4227 | struct btrfs_path *path) | ||
4228 | { | ||
4229 | int ret; | ||
4230 | struct btrfs_key key; | ||
4231 | u64 hole_start; | ||
4232 | u64 hole_size; | ||
4233 | struct extent_buffer *leaf; | ||
4234 | struct btrfs_root *log = root->log_root; | ||
4235 | const u64 ino = btrfs_ino(inode); | ||
4236 | const u64 i_size = i_size_read(inode); | ||
4237 | |||
4238 | if (!btrfs_fs_incompat(root->fs_info, NO_HOLES)) | ||
4239 | return 0; | ||
4240 | |||
4241 | key.objectid = ino; | ||
4242 | key.type = BTRFS_EXTENT_DATA_KEY; | ||
4243 | key.offset = (u64)-1; | ||
4244 | |||
4245 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); | ||
4246 | ASSERT(ret != 0); | ||
4247 | if (ret < 0) | ||
4248 | return ret; | ||
4249 | |||
4250 | ASSERT(path->slots[0] > 0); | ||
4251 | path->slots[0]--; | ||
4252 | leaf = path->nodes[0]; | ||
4253 | btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); | ||
4254 | |||
4255 | if (key.objectid != ino || key.type != BTRFS_EXTENT_DATA_KEY) { | ||
4256 | /* inode does not have any extents */ | ||
4257 | hole_start = 0; | ||
4258 | hole_size = i_size; | ||
4259 | } else { | ||
4260 | struct btrfs_file_extent_item *extent; | ||
4261 | u64 len; | ||
4262 | |||
4263 | /* | ||
4264 | * If there's an extent beyond i_size, an explicit hole was | ||
4265 | * already inserted by copy_items(). | ||
4266 | */ | ||
4267 | if (key.offset >= i_size) | ||
4268 | return 0; | ||
4269 | |||
4270 | extent = btrfs_item_ptr(leaf, path->slots[0], | ||
4271 | struct btrfs_file_extent_item); | ||
4272 | |||
4273 | if (btrfs_file_extent_type(leaf, extent) == | ||
4274 | BTRFS_FILE_EXTENT_INLINE) { | ||
4275 | len = btrfs_file_extent_inline_len(leaf, | ||
4276 | path->slots[0], | ||
4277 | extent); | ||
4278 | ASSERT(len == i_size); | ||
4279 | return 0; | ||
4280 | } | ||
4281 | |||
4282 | len = btrfs_file_extent_num_bytes(leaf, extent); | ||
4283 | /* Last extent goes beyond i_size, no need to log a hole. */ | ||
4284 | if (key.offset + len > i_size) | ||
4285 | return 0; | ||
4286 | hole_start = key.offset + len; | ||
4287 | hole_size = i_size - hole_start; | ||
4288 | } | ||
4289 | btrfs_release_path(path); | ||
4290 | |||
4291 | /* Last extent ends at i_size. */ | ||
4292 | if (hole_size == 0) | ||
4293 | return 0; | ||
4294 | |||
4295 | hole_size = ALIGN(hole_size, root->sectorsize); | ||
4296 | ret = btrfs_insert_file_extent(trans, log, ino, hole_start, 0, 0, | ||
4297 | hole_size, 0, hole_size, 0, 0, 0); | ||
4298 | return ret; | ||
4299 | } | ||
4300 | |||
4120 | /* log a single inode in the tree log. | 4301 | /* log a single inode in the tree log. |
4121 | * At least one parent directory for this inode must exist in the tree | 4302 | * At least one parent directory for this inode must exist in the tree |
4122 | * or be logged already. | 4303 | * or be logged already. |
@@ -4155,6 +4336,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, | |||
4155 | u64 ino = btrfs_ino(inode); | 4336 | u64 ino = btrfs_ino(inode); |
4156 | struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; | 4337 | struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; |
4157 | u64 logged_isize = 0; | 4338 | u64 logged_isize = 0; |
4339 | bool need_log_inode_item = true; | ||
4158 | 4340 | ||
4159 | path = btrfs_alloc_path(); | 4341 | path = btrfs_alloc_path(); |
4160 | if (!path) | 4342 | if (!path) |
@@ -4263,11 +4445,6 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, | |||
4263 | } else { | 4445 | } else { |
4264 | if (inode_only == LOG_INODE_ALL) | 4446 | if (inode_only == LOG_INODE_ALL) |
4265 | fast_search = true; | 4447 | fast_search = true; |
4266 | ret = log_inode_item(trans, log, dst_path, inode); | ||
4267 | if (ret) { | ||
4268 | err = ret; | ||
4269 | goto out_unlock; | ||
4270 | } | ||
4271 | goto log_extents; | 4448 | goto log_extents; |
4272 | } | 4449 | } |
4273 | 4450 | ||
@@ -4290,6 +4467,28 @@ again: | |||
4290 | if (min_key.type > max_key.type) | 4467 | if (min_key.type > max_key.type) |
4291 | break; | 4468 | break; |
4292 | 4469 | ||
4470 | if (min_key.type == BTRFS_INODE_ITEM_KEY) | ||
4471 | need_log_inode_item = false; | ||
4472 | |||
4473 | /* Skip xattrs, we log them later with btrfs_log_all_xattrs() */ | ||
4474 | if (min_key.type == BTRFS_XATTR_ITEM_KEY) { | ||
4475 | if (ins_nr == 0) | ||
4476 | goto next_slot; | ||
4477 | ret = copy_items(trans, inode, dst_path, path, | ||
4478 | &last_extent, ins_start_slot, | ||
4479 | ins_nr, inode_only, logged_isize); | ||
4480 | if (ret < 0) { | ||
4481 | err = ret; | ||
4482 | goto out_unlock; | ||
4483 | } | ||
4484 | ins_nr = 0; | ||
4485 | if (ret) { | ||
4486 | btrfs_release_path(path); | ||
4487 | continue; | ||
4488 | } | ||
4489 | goto next_slot; | ||
4490 | } | ||
4491 | |||
4293 | src = path->nodes[0]; | 4492 | src = path->nodes[0]; |
4294 | if (ins_nr && ins_start_slot + ins_nr == path->slots[0]) { | 4493 | if (ins_nr && ins_start_slot + ins_nr == path->slots[0]) { |
4295 | ins_nr++; | 4494 | ins_nr++; |
@@ -4357,9 +4556,26 @@ next_slot: | |||
4357 | ins_nr = 0; | 4556 | ins_nr = 0; |
4358 | } | 4557 | } |
4359 | 4558 | ||
4559 | btrfs_release_path(path); | ||
4560 | btrfs_release_path(dst_path); | ||
4561 | err = btrfs_log_all_xattrs(trans, root, inode, path, dst_path); | ||
4562 | if (err) | ||
4563 | goto out_unlock; | ||
4564 | if (max_key.type >= BTRFS_EXTENT_DATA_KEY && !fast_search) { | ||
4565 | btrfs_release_path(path); | ||
4566 | btrfs_release_path(dst_path); | ||
4567 | err = btrfs_log_trailing_hole(trans, root, inode, path); | ||
4568 | if (err) | ||
4569 | goto out_unlock; | ||
4570 | } | ||
4360 | log_extents: | 4571 | log_extents: |
4361 | btrfs_release_path(path); | 4572 | btrfs_release_path(path); |
4362 | btrfs_release_path(dst_path); | 4573 | btrfs_release_path(dst_path); |
4574 | if (need_log_inode_item) { | ||
4575 | err = log_inode_item(trans, log, dst_path, inode); | ||
4576 | if (err) | ||
4577 | goto out_unlock; | ||
4578 | } | ||
4363 | if (fast_search) { | 4579 | if (fast_search) { |
4364 | /* | 4580 | /* |
4365 | * Some ordered extents started by fsync might have completed | 4581 | * Some ordered extents started by fsync might have completed |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 4b438b4c8c91..fbe7c104531c 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -2766,6 +2766,20 @@ static int btrfs_relocate_chunk(struct btrfs_root *root, | |||
2766 | root = root->fs_info->chunk_root; | 2766 | root = root->fs_info->chunk_root; |
2767 | extent_root = root->fs_info->extent_root; | 2767 | extent_root = root->fs_info->extent_root; |
2768 | 2768 | ||
2769 | /* | ||
2770 | * Prevent races with automatic removal of unused block groups. | ||
2771 | * After we relocate and before we remove the chunk with offset | ||
2772 | * chunk_offset, automatic removal of the block group can kick in, | ||
2773 | * resulting in a failure when calling btrfs_remove_chunk() below. | ||
2774 | * | ||
2775 | * Make sure to acquire this mutex before doing a tree search (dev | ||
2776 | * or chunk trees) to find chunks. Otherwise the cleaner kthread might | ||
2777 | * call btrfs_remove_chunk() (through btrfs_delete_unused_bgs()) after | ||
2778 | * we release the path used to search the chunk/dev tree and before | ||
2779 | * the current task acquires this mutex and calls us. | ||
2780 | */ | ||
2781 | ASSERT(mutex_is_locked(&root->fs_info->delete_unused_bgs_mutex)); | ||
2782 | |||
2769 | ret = btrfs_can_relocate(extent_root, chunk_offset); | 2783 | ret = btrfs_can_relocate(extent_root, chunk_offset); |
2770 | if (ret) | 2784 | if (ret) |
2771 | return -ENOSPC; | 2785 | return -ENOSPC; |
@@ -2814,13 +2828,18 @@ again: | |||
2814 | key.type = BTRFS_CHUNK_ITEM_KEY; | 2828 | key.type = BTRFS_CHUNK_ITEM_KEY; |
2815 | 2829 | ||
2816 | while (1) { | 2830 | while (1) { |
2831 | mutex_lock(&root->fs_info->delete_unused_bgs_mutex); | ||
2817 | ret = btrfs_search_slot(NULL, chunk_root, &key, path, 0, 0); | 2832 | ret = btrfs_search_slot(NULL, chunk_root, &key, path, 0, 0); |
2818 | if (ret < 0) | 2833 | if (ret < 0) { |
2834 | mutex_unlock(&root->fs_info->delete_unused_bgs_mutex); | ||
2819 | goto error; | 2835 | goto error; |
2836 | } | ||
2820 | BUG_ON(ret == 0); /* Corruption */ | 2837 | BUG_ON(ret == 0); /* Corruption */ |
2821 | 2838 | ||
2822 | ret = btrfs_previous_item(chunk_root, path, key.objectid, | 2839 | ret = btrfs_previous_item(chunk_root, path, key.objectid, |
2823 | key.type); | 2840 | key.type); |
2841 | if (ret) | ||
2842 | mutex_unlock(&root->fs_info->delete_unused_bgs_mutex); | ||
2824 | if (ret < 0) | 2843 | if (ret < 0) |
2825 | goto error; | 2844 | goto error; |
2826 | if (ret > 0) | 2845 | if (ret > 0) |
@@ -2843,6 +2862,7 @@ again: | |||
2843 | else | 2862 | else |
2844 | BUG_ON(ret); | 2863 | BUG_ON(ret); |
2845 | } | 2864 | } |
2865 | mutex_unlock(&root->fs_info->delete_unused_bgs_mutex); | ||
2846 | 2866 | ||
2847 | if (found_key.offset == 0) | 2867 | if (found_key.offset == 0) |
2848 | break; | 2868 | break; |
@@ -3299,9 +3319,12 @@ again: | |||
3299 | goto error; | 3319 | goto error; |
3300 | } | 3320 | } |
3301 | 3321 | ||
3322 | mutex_lock(&fs_info->delete_unused_bgs_mutex); | ||
3302 | ret = btrfs_search_slot(NULL, chunk_root, &key, path, 0, 0); | 3323 | ret = btrfs_search_slot(NULL, chunk_root, &key, path, 0, 0); |
3303 | if (ret < 0) | 3324 | if (ret < 0) { |
3325 | mutex_unlock(&fs_info->delete_unused_bgs_mutex); | ||
3304 | goto error; | 3326 | goto error; |
3327 | } | ||
3305 | 3328 | ||
3306 | /* | 3329 | /* |
3307 | * this shouldn't happen, it means the last relocate | 3330 | * this shouldn't happen, it means the last relocate |
@@ -3313,6 +3336,7 @@ again: | |||
3313 | ret = btrfs_previous_item(chunk_root, path, 0, | 3336 | ret = btrfs_previous_item(chunk_root, path, 0, |
3314 | BTRFS_CHUNK_ITEM_KEY); | 3337 | BTRFS_CHUNK_ITEM_KEY); |
3315 | if (ret) { | 3338 | if (ret) { |
3339 | mutex_unlock(&fs_info->delete_unused_bgs_mutex); | ||
3316 | ret = 0; | 3340 | ret = 0; |
3317 | break; | 3341 | break; |
3318 | } | 3342 | } |
@@ -3321,8 +3345,10 @@ again: | |||
3321 | slot = path->slots[0]; | 3345 | slot = path->slots[0]; |
3322 | btrfs_item_key_to_cpu(leaf, &found_key, slot); | 3346 | btrfs_item_key_to_cpu(leaf, &found_key, slot); |
3323 | 3347 | ||
3324 | if (found_key.objectid != key.objectid) | 3348 | if (found_key.objectid != key.objectid) { |
3349 | mutex_unlock(&fs_info->delete_unused_bgs_mutex); | ||
3325 | break; | 3350 | break; |
3351 | } | ||
3326 | 3352 | ||
3327 | chunk = btrfs_item_ptr(leaf, slot, struct btrfs_chunk); | 3353 | chunk = btrfs_item_ptr(leaf, slot, struct btrfs_chunk); |
3328 | 3354 | ||
@@ -3335,10 +3361,13 @@ again: | |||
3335 | ret = should_balance_chunk(chunk_root, leaf, chunk, | 3361 | ret = should_balance_chunk(chunk_root, leaf, chunk, |
3336 | found_key.offset); | 3362 | found_key.offset); |
3337 | btrfs_release_path(path); | 3363 | btrfs_release_path(path); |
3338 | if (!ret) | 3364 | if (!ret) { |
3365 | mutex_unlock(&fs_info->delete_unused_bgs_mutex); | ||
3339 | goto loop; | 3366 | goto loop; |
3367 | } | ||
3340 | 3368 | ||
3341 | if (counting) { | 3369 | if (counting) { |
3370 | mutex_unlock(&fs_info->delete_unused_bgs_mutex); | ||
3342 | spin_lock(&fs_info->balance_lock); | 3371 | spin_lock(&fs_info->balance_lock); |
3343 | bctl->stat.expected++; | 3372 | bctl->stat.expected++; |
3344 | spin_unlock(&fs_info->balance_lock); | 3373 | spin_unlock(&fs_info->balance_lock); |
@@ -3348,6 +3377,7 @@ again: | |||
3348 | ret = btrfs_relocate_chunk(chunk_root, | 3377 | ret = btrfs_relocate_chunk(chunk_root, |
3349 | found_key.objectid, | 3378 | found_key.objectid, |
3350 | found_key.offset); | 3379 | found_key.offset); |
3380 | mutex_unlock(&fs_info->delete_unused_bgs_mutex); | ||
3351 | if (ret && ret != -ENOSPC) | 3381 | if (ret && ret != -ENOSPC) |
3352 | goto error; | 3382 | goto error; |
3353 | if (ret == -ENOSPC) { | 3383 | if (ret == -ENOSPC) { |
@@ -4087,11 +4117,16 @@ again: | |||
4087 | key.type = BTRFS_DEV_EXTENT_KEY; | 4117 | key.type = BTRFS_DEV_EXTENT_KEY; |
4088 | 4118 | ||
4089 | do { | 4119 | do { |
4120 | mutex_lock(&root->fs_info->delete_unused_bgs_mutex); | ||
4090 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); | 4121 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); |
4091 | if (ret < 0) | 4122 | if (ret < 0) { |
4123 | mutex_unlock(&root->fs_info->delete_unused_bgs_mutex); | ||
4092 | goto done; | 4124 | goto done; |
4125 | } | ||
4093 | 4126 | ||
4094 | ret = btrfs_previous_item(root, path, 0, key.type); | 4127 | ret = btrfs_previous_item(root, path, 0, key.type); |
4128 | if (ret) | ||
4129 | mutex_unlock(&root->fs_info->delete_unused_bgs_mutex); | ||
4095 | if (ret < 0) | 4130 | if (ret < 0) |
4096 | goto done; | 4131 | goto done; |
4097 | if (ret) { | 4132 | if (ret) { |
@@ -4105,6 +4140,7 @@ again: | |||
4105 | btrfs_item_key_to_cpu(l, &key, path->slots[0]); | 4140 | btrfs_item_key_to_cpu(l, &key, path->slots[0]); |
4106 | 4141 | ||
4107 | if (key.objectid != device->devid) { | 4142 | if (key.objectid != device->devid) { |
4143 | mutex_unlock(&root->fs_info->delete_unused_bgs_mutex); | ||
4108 | btrfs_release_path(path); | 4144 | btrfs_release_path(path); |
4109 | break; | 4145 | break; |
4110 | } | 4146 | } |
@@ -4113,6 +4149,7 @@ again: | |||
4113 | length = btrfs_dev_extent_length(l, dev_extent); | 4149 | length = btrfs_dev_extent_length(l, dev_extent); |
4114 | 4150 | ||
4115 | if (key.offset + length <= new_size) { | 4151 | if (key.offset + length <= new_size) { |
4152 | mutex_unlock(&root->fs_info->delete_unused_bgs_mutex); | ||
4116 | btrfs_release_path(path); | 4153 | btrfs_release_path(path); |
4117 | break; | 4154 | break; |
4118 | } | 4155 | } |
@@ -4122,6 +4159,7 @@ again: | |||
4122 | btrfs_release_path(path); | 4159 | btrfs_release_path(path); |
4123 | 4160 | ||
4124 | ret = btrfs_relocate_chunk(root, chunk_objectid, chunk_offset); | 4161 | ret = btrfs_relocate_chunk(root, chunk_objectid, chunk_offset); |
4162 | mutex_unlock(&root->fs_info->delete_unused_bgs_mutex); | ||
4125 | if (ret && ret != -ENOSPC) | 4163 | if (ret && ret != -ENOSPC) |
4126 | goto done; | 4164 | goto done; |
4127 | if (ret == -ENOSPC) | 4165 | if (ret == -ENOSPC) |
@@ -5715,7 +5753,6 @@ static inline void btrfs_end_bbio(struct btrfs_bio *bbio, struct bio *bio, int e | |||
5715 | static void btrfs_end_bio(struct bio *bio, int err) | 5753 | static void btrfs_end_bio(struct bio *bio, int err) |
5716 | { | 5754 | { |
5717 | struct btrfs_bio *bbio = bio->bi_private; | 5755 | struct btrfs_bio *bbio = bio->bi_private; |
5718 | struct btrfs_device *dev = bbio->stripes[0].dev; | ||
5719 | int is_orig_bio = 0; | 5756 | int is_orig_bio = 0; |
5720 | 5757 | ||
5721 | if (err) { | 5758 | if (err) { |
@@ -5723,6 +5760,7 @@ static void btrfs_end_bio(struct bio *bio, int err) | |||
5723 | if (err == -EIO || err == -EREMOTEIO) { | 5760 | if (err == -EIO || err == -EREMOTEIO) { |
5724 | unsigned int stripe_index = | 5761 | unsigned int stripe_index = |
5725 | btrfs_io_bio(bio)->stripe_index; | 5762 | btrfs_io_bio(bio)->stripe_index; |
5763 | struct btrfs_device *dev; | ||
5726 | 5764 | ||
5727 | BUG_ON(stripe_index >= bbio->num_stripes); | 5765 | BUG_ON(stripe_index >= bbio->num_stripes); |
5728 | dev = bbio->stripes[stripe_index].dev; | 5766 | dev = bbio->stripes[stripe_index].dev; |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 6b8e2f091f5b..48851f6ea6ec 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -896,6 +896,7 @@ COMPATIBLE_IOCTL(FIGETBSZ) | |||
896 | /* 'X' - originally XFS but some now in the VFS */ | 896 | /* 'X' - originally XFS but some now in the VFS */ |
897 | COMPATIBLE_IOCTL(FIFREEZE) | 897 | COMPATIBLE_IOCTL(FIFREEZE) |
898 | COMPATIBLE_IOCTL(FITHAW) | 898 | COMPATIBLE_IOCTL(FITHAW) |
899 | COMPATIBLE_IOCTL(FITRIM) | ||
899 | COMPATIBLE_IOCTL(KDGETKEYCODE) | 900 | COMPATIBLE_IOCTL(KDGETKEYCODE) |
900 | COMPATIBLE_IOCTL(KDSETKEYCODE) | 901 | COMPATIBLE_IOCTL(KDSETKEYCODE) |
901 | COMPATIBLE_IOCTL(KDGKBTYPE) | 902 | COMPATIBLE_IOCTL(KDGKBTYPE) |
diff --git a/fs/configfs/item.c b/fs/configfs/item.c index 4d6a30e76168..b863a09cd2f1 100644 --- a/fs/configfs/item.c +++ b/fs/configfs/item.c | |||
@@ -115,7 +115,7 @@ void config_item_init_type_name(struct config_item *item, | |||
115 | const char *name, | 115 | const char *name, |
116 | struct config_item_type *type) | 116 | struct config_item_type *type) |
117 | { | 117 | { |
118 | config_item_set_name(item, name); | 118 | config_item_set_name(item, "%s", name); |
119 | item->ci_type = type; | 119 | item->ci_type = type; |
120 | config_item_init(item); | 120 | config_item_init(item); |
121 | } | 121 | } |
@@ -124,7 +124,7 @@ EXPORT_SYMBOL(config_item_init_type_name); | |||
124 | void config_group_init_type_name(struct config_group *group, const char *name, | 124 | void config_group_init_type_name(struct config_group *group, const char *name, |
125 | struct config_item_type *type) | 125 | struct config_item_type *type) |
126 | { | 126 | { |
127 | config_item_set_name(&group->cg_item, name); | 127 | config_item_set_name(&group->cg_item, "%s", name); |
128 | group->cg_item.ci_type = type; | 128 | group->cg_item.ci_type = type; |
129 | config_group_init(group); | 129 | config_group_init(group); |
130 | } | 130 | } |
diff --git a/fs/dcache.c b/fs/dcache.c index 7a3f3e5f9cea..5c8ea15e73a5 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -642,7 +642,7 @@ static inline bool fast_dput(struct dentry *dentry) | |||
642 | 642 | ||
643 | /* | 643 | /* |
644 | * If we have a d_op->d_delete() operation, we sould not | 644 | * If we have a d_op->d_delete() operation, we sould not |
645 | * let the dentry count go to zero, so use "put__or_lock". | 645 | * let the dentry count go to zero, so use "put_or_lock". |
646 | */ | 646 | */ |
647 | if (unlikely(dentry->d_flags & DCACHE_OP_DELETE)) | 647 | if (unlikely(dentry->d_flags & DCACHE_OP_DELETE)) |
648 | return lockref_put_or_lock(&dentry->d_lockref); | 648 | return lockref_put_or_lock(&dentry->d_lockref); |
@@ -697,7 +697,7 @@ static inline bool fast_dput(struct dentry *dentry) | |||
697 | */ | 697 | */ |
698 | smp_rmb(); | 698 | smp_rmb(); |
699 | d_flags = ACCESS_ONCE(dentry->d_flags); | 699 | d_flags = ACCESS_ONCE(dentry->d_flags); |
700 | d_flags &= DCACHE_REFERENCED | DCACHE_LRU_LIST; | 700 | d_flags &= DCACHE_REFERENCED | DCACHE_LRU_LIST | DCACHE_DISCONNECTED; |
701 | 701 | ||
702 | /* Nothing to do? Dropping the reference was all we needed? */ | 702 | /* Nothing to do? Dropping the reference was all we needed? */ |
703 | if (d_flags == (DCACHE_REFERENCED | DCACHE_LRU_LIST) && !d_unhashed(dentry)) | 703 | if (d_flags == (DCACHE_REFERENCED | DCACHE_LRU_LIST) && !d_unhashed(dentry)) |
@@ -776,6 +776,9 @@ repeat: | |||
776 | if (unlikely(d_unhashed(dentry))) | 776 | if (unlikely(d_unhashed(dentry))) |
777 | goto kill_it; | 777 | goto kill_it; |
778 | 778 | ||
779 | if (unlikely(dentry->d_flags & DCACHE_DISCONNECTED)) | ||
780 | goto kill_it; | ||
781 | |||
779 | if (unlikely(dentry->d_flags & DCACHE_OP_DELETE)) { | 782 | if (unlikely(dentry->d_flags & DCACHE_OP_DELETE)) { |
780 | if (dentry->d_op->d_delete(dentry)) | 783 | if (dentry->d_op->d_delete(dentry)) |
781 | goto kill_it; | 784 | goto kill_it; |
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index 72afcc629d7b..feef8a9c4de7 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -325,7 +325,6 @@ ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
325 | return rc; | 325 | return rc; |
326 | 326 | ||
327 | switch (cmd) { | 327 | switch (cmd) { |
328 | case FITRIM: | ||
329 | case FS_IOC32_GETFLAGS: | 328 | case FS_IOC32_GETFLAGS: |
330 | case FS_IOC32_SETFLAGS: | 329 | case FS_IOC32_SETFLAGS: |
331 | case FS_IOC32_GETVERSION: | 330 | case FS_IOC32_GETVERSION: |
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index cb8451246b30..1346cfa355d0 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -755,7 +755,6 @@ long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
755 | return err; | 755 | return err; |
756 | } | 756 | } |
757 | case EXT4_IOC_MOVE_EXT: | 757 | case EXT4_IOC_MOVE_EXT: |
758 | case FITRIM: | ||
759 | case EXT4_IOC_RESIZE_FS: | 758 | case EXT4_IOC_RESIZE_FS: |
760 | case EXT4_IOC_PRECACHE_EXTENTS: | 759 | case EXT4_IOC_PRECACHE_EXTENTS: |
761 | case EXT4_IOC_SET_ENCRYPTION_POLICY: | 760 | case EXT4_IOC_SET_ENCRYPTION_POLICY: |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index f0520bcf2094..518c6294bf6c 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -702,6 +702,7 @@ void wbc_account_io(struct writeback_control *wbc, struct page *page, | |||
702 | else | 702 | else |
703 | wbc->wb_tcand_bytes -= min(bytes, wbc->wb_tcand_bytes); | 703 | wbc->wb_tcand_bytes -= min(bytes, wbc->wb_tcand_bytes); |
704 | } | 704 | } |
705 | EXPORT_SYMBOL_GPL(wbc_account_io); | ||
705 | 706 | ||
706 | /** | 707 | /** |
707 | * inode_congested - test whether an inode is congested | 708 | * inode_congested - test whether an inode is congested |
diff --git a/fs/hpfs/alloc.c b/fs/hpfs/alloc.c index f005046e1591..d6a4b55d2ab0 100644 --- a/fs/hpfs/alloc.c +++ b/fs/hpfs/alloc.c | |||
@@ -484,3 +484,98 @@ struct anode *hpfs_alloc_anode(struct super_block *s, secno near, anode_secno *a | |||
484 | a->btree.first_free = cpu_to_le16(8); | 484 | a->btree.first_free = cpu_to_le16(8); |
485 | return a; | 485 | return a; |
486 | } | 486 | } |
487 | |||
488 | static unsigned find_run(__le32 *bmp, unsigned *idx) | ||
489 | { | ||
490 | unsigned len; | ||
491 | while (tstbits(bmp, *idx, 1)) { | ||
492 | (*idx)++; | ||
493 | if (unlikely(*idx >= 0x4000)) | ||
494 | return 0; | ||
495 | } | ||
496 | len = 1; | ||
497 | while (!tstbits(bmp, *idx + len, 1)) | ||
498 | len++; | ||
499 | return len; | ||
500 | } | ||
501 | |||
502 | static int do_trim(struct super_block *s, secno start, unsigned len, secno limit_start, secno limit_end, unsigned minlen, unsigned *result) | ||
503 | { | ||
504 | int err; | ||
505 | secno end; | ||
506 | if (fatal_signal_pending(current)) | ||
507 | return -EINTR; | ||
508 | end = start + len; | ||
509 | if (start < limit_start) | ||
510 | start = limit_start; | ||
511 | if (end > limit_end) | ||
512 | end = limit_end; | ||
513 | if (start >= end) | ||
514 | return 0; | ||
515 | if (end - start < minlen) | ||
516 | return 0; | ||
517 | err = sb_issue_discard(s, start, end - start, GFP_NOFS, 0); | ||
518 | if (err) | ||
519 | return err; | ||
520 | *result += end - start; | ||
521 | return 0; | ||
522 | } | ||
523 | |||
524 | int hpfs_trim_fs(struct super_block *s, u64 start, u64 end, u64 minlen, unsigned *result) | ||
525 | { | ||
526 | int err = 0; | ||
527 | struct hpfs_sb_info *sbi = hpfs_sb(s); | ||
528 | unsigned idx, len, start_bmp, end_bmp; | ||
529 | __le32 *bmp; | ||
530 | struct quad_buffer_head qbh; | ||
531 | |||
532 | *result = 0; | ||
533 | if (!end || end > sbi->sb_fs_size) | ||
534 | end = sbi->sb_fs_size; | ||
535 | if (start >= sbi->sb_fs_size) | ||
536 | return 0; | ||
537 | if (minlen > 0x4000) | ||
538 | return 0; | ||
539 | if (start < sbi->sb_dirband_start + sbi->sb_dirband_size && end > sbi->sb_dirband_start) { | ||
540 | hpfs_lock(s); | ||
541 | if (s->s_flags & MS_RDONLY) { | ||
542 | err = -EROFS; | ||
543 | goto unlock_1; | ||
544 | } | ||
545 | if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) { | ||
546 | err = -EIO; | ||
547 | goto unlock_1; | ||
548 | } | ||
549 | idx = 0; | ||
550 | while ((len = find_run(bmp, &idx)) && !err) { | ||
551 | err = do_trim(s, sbi->sb_dirband_start + idx * 4, len * 4, start, end, minlen, result); | ||
552 | idx += len; | ||
553 | } | ||
554 | hpfs_brelse4(&qbh); | ||
555 | unlock_1: | ||
556 | hpfs_unlock(s); | ||
557 | } | ||
558 | start_bmp = start >> 14; | ||
559 | end_bmp = (end + 0x3fff) >> 14; | ||
560 | while (start_bmp < end_bmp && !err) { | ||
561 | hpfs_lock(s); | ||
562 | if (s->s_flags & MS_RDONLY) { | ||
563 | err = -EROFS; | ||
564 | goto unlock_2; | ||
565 | } | ||
566 | if (!(bmp = hpfs_map_bitmap(s, start_bmp, &qbh, "trim"))) { | ||
567 | err = -EIO; | ||
568 | goto unlock_2; | ||
569 | } | ||
570 | idx = 0; | ||
571 | while ((len = find_run(bmp, &idx)) && !err) { | ||
572 | err = do_trim(s, (start_bmp << 14) + idx, len, start, end, minlen, result); | ||
573 | idx += len; | ||
574 | } | ||
575 | hpfs_brelse4(&qbh); | ||
576 | unlock_2: | ||
577 | hpfs_unlock(s); | ||
578 | start_bmp++; | ||
579 | } | ||
580 | return err; | ||
581 | } | ||
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index 2a8e07425de0..dc540bfcee1d 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c | |||
@@ -327,4 +327,5 @@ const struct file_operations hpfs_dir_ops = | |||
327 | .iterate = hpfs_readdir, | 327 | .iterate = hpfs_readdir, |
328 | .release = hpfs_dir_release, | 328 | .release = hpfs_dir_release, |
329 | .fsync = hpfs_file_fsync, | 329 | .fsync = hpfs_file_fsync, |
330 | .unlocked_ioctl = hpfs_ioctl, | ||
330 | }; | 331 | }; |
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c index 6d8cfe9b52d6..7ca28d604bf7 100644 --- a/fs/hpfs/file.c +++ b/fs/hpfs/file.c | |||
@@ -203,6 +203,7 @@ const struct file_operations hpfs_file_ops = | |||
203 | .release = hpfs_file_release, | 203 | .release = hpfs_file_release, |
204 | .fsync = hpfs_file_fsync, | 204 | .fsync = hpfs_file_fsync, |
205 | .splice_read = generic_file_splice_read, | 205 | .splice_read = generic_file_splice_read, |
206 | .unlocked_ioctl = hpfs_ioctl, | ||
206 | }; | 207 | }; |
207 | 208 | ||
208 | const struct inode_operations hpfs_file_iops = | 209 | const struct inode_operations hpfs_file_iops = |
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h index bb04b58d1d69..c4867b5116dd 100644 --- a/fs/hpfs/hpfs_fn.h +++ b/fs/hpfs/hpfs_fn.h | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/pagemap.h> | 18 | #include <linux/pagemap.h> |
19 | #include <linux/buffer_head.h> | 19 | #include <linux/buffer_head.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/sched.h> | ||
22 | #include <linux/blkdev.h> | ||
21 | #include <asm/unaligned.h> | 23 | #include <asm/unaligned.h> |
22 | 24 | ||
23 | #include "hpfs.h" | 25 | #include "hpfs.h" |
@@ -200,6 +202,7 @@ void hpfs_free_dnode(struct super_block *, secno); | |||
200 | struct dnode *hpfs_alloc_dnode(struct super_block *, secno, dnode_secno *, struct quad_buffer_head *); | 202 | struct dnode *hpfs_alloc_dnode(struct super_block *, secno, dnode_secno *, struct quad_buffer_head *); |
201 | struct fnode *hpfs_alloc_fnode(struct super_block *, secno, fnode_secno *, struct buffer_head **); | 203 | struct fnode *hpfs_alloc_fnode(struct super_block *, secno, fnode_secno *, struct buffer_head **); |
202 | struct anode *hpfs_alloc_anode(struct super_block *, secno, anode_secno *, struct buffer_head **); | 204 | struct anode *hpfs_alloc_anode(struct super_block *, secno, anode_secno *, struct buffer_head **); |
205 | int hpfs_trim_fs(struct super_block *, u64, u64, u64, unsigned *); | ||
203 | 206 | ||
204 | /* anode.c */ | 207 | /* anode.c */ |
205 | 208 | ||
@@ -318,6 +321,7 @@ __printf(2, 3) | |||
318 | void hpfs_error(struct super_block *, const char *, ...); | 321 | void hpfs_error(struct super_block *, const char *, ...); |
319 | int hpfs_stop_cycles(struct super_block *, int, int *, int *, char *); | 322 | int hpfs_stop_cycles(struct super_block *, int, int *, int *, char *); |
320 | unsigned hpfs_get_free_dnodes(struct super_block *); | 323 | unsigned hpfs_get_free_dnodes(struct super_block *); |
324 | long hpfs_ioctl(struct file *file, unsigned cmd, unsigned long arg); | ||
321 | 325 | ||
322 | /* | 326 | /* |
323 | * local time (HPFS) to GMT (Unix) | 327 | * local time (HPFS) to GMT (Unix) |
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index 7cd00d3a7c9b..68a9bed05628 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -52,17 +52,20 @@ static void unmark_dirty(struct super_block *s) | |||
52 | } | 52 | } |
53 | 53 | ||
54 | /* Filesystem error... */ | 54 | /* Filesystem error... */ |
55 | static char err_buf[1024]; | ||
56 | |||
57 | void hpfs_error(struct super_block *s, const char *fmt, ...) | 55 | void hpfs_error(struct super_block *s, const char *fmt, ...) |
58 | { | 56 | { |
57 | struct va_format vaf; | ||
59 | va_list args; | 58 | va_list args; |
60 | 59 | ||
61 | va_start(args, fmt); | 60 | va_start(args, fmt); |
62 | vsnprintf(err_buf, sizeof(err_buf), fmt, args); | 61 | |
62 | vaf.fmt = fmt; | ||
63 | vaf.va = &args; | ||
64 | |||
65 | pr_err("filesystem error: %pV", &vaf); | ||
66 | |||
63 | va_end(args); | 67 | va_end(args); |
64 | 68 | ||
65 | pr_err("filesystem error: %s", err_buf); | ||
66 | if (!hpfs_sb(s)->sb_was_error) { | 69 | if (!hpfs_sb(s)->sb_was_error) { |
67 | if (hpfs_sb(s)->sb_err == 2) { | 70 | if (hpfs_sb(s)->sb_err == 2) { |
68 | pr_cont("; crashing the system because you wanted it\n"); | 71 | pr_cont("; crashing the system because you wanted it\n"); |
@@ -196,12 +199,39 @@ static int hpfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
196 | return 0; | 199 | return 0; |
197 | } | 200 | } |
198 | 201 | ||
202 | |||
203 | long hpfs_ioctl(struct file *file, unsigned cmd, unsigned long arg) | ||
204 | { | ||
205 | switch (cmd) { | ||
206 | case FITRIM: { | ||
207 | struct fstrim_range range; | ||
208 | secno n_trimmed; | ||
209 | int r; | ||
210 | if (!capable(CAP_SYS_ADMIN)) | ||
211 | return -EPERM; | ||
212 | if (copy_from_user(&range, (struct fstrim_range __user *)arg, sizeof(range))) | ||
213 | return -EFAULT; | ||
214 | r = hpfs_trim_fs(file_inode(file)->i_sb, range.start >> 9, (range.start + range.len) >> 9, (range.minlen + 511) >> 9, &n_trimmed); | ||
215 | if (r) | ||
216 | return r; | ||
217 | range.len = (u64)n_trimmed << 9; | ||
218 | if (copy_to_user((struct fstrim_range __user *)arg, &range, sizeof(range))) | ||
219 | return -EFAULT; | ||
220 | return 0; | ||
221 | } | ||
222 | default: { | ||
223 | return -ENOIOCTLCMD; | ||
224 | } | ||
225 | } | ||
226 | } | ||
227 | |||
228 | |||
199 | static struct kmem_cache * hpfs_inode_cachep; | 229 | static struct kmem_cache * hpfs_inode_cachep; |
200 | 230 | ||
201 | static struct inode *hpfs_alloc_inode(struct super_block *sb) | 231 | static struct inode *hpfs_alloc_inode(struct super_block *sb) |
202 | { | 232 | { |
203 | struct hpfs_inode_info *ei; | 233 | struct hpfs_inode_info *ei; |
204 | ei = (struct hpfs_inode_info *)kmem_cache_alloc(hpfs_inode_cachep, GFP_NOFS); | 234 | ei = kmem_cache_alloc(hpfs_inode_cachep, GFP_NOFS); |
205 | if (!ei) | 235 | if (!ei) |
206 | return NULL; | 236 | return NULL; |
207 | ei->vfs_inode.i_version = 1; | 237 | ei->vfs_inode.i_version = 1; |
@@ -424,11 +454,14 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) | |||
424 | int o; | 454 | int o; |
425 | struct hpfs_sb_info *sbi = hpfs_sb(s); | 455 | struct hpfs_sb_info *sbi = hpfs_sb(s); |
426 | char *new_opts = kstrdup(data, GFP_KERNEL); | 456 | char *new_opts = kstrdup(data, GFP_KERNEL); |
427 | 457 | ||
458 | if (!new_opts) | ||
459 | return -ENOMEM; | ||
460 | |||
428 | sync_filesystem(s); | 461 | sync_filesystem(s); |
429 | 462 | ||
430 | *flags |= MS_NOATIME; | 463 | *flags |= MS_NOATIME; |
431 | 464 | ||
432 | hpfs_lock(s); | 465 | hpfs_lock(s); |
433 | uid = sbi->sb_uid; gid = sbi->sb_gid; | 466 | uid = sbi->sb_uid; gid = sbi->sb_gid; |
434 | umask = 0777 & ~sbi->sb_mode; | 467 | umask = 0777 & ~sbi->sb_mode; |
diff --git a/fs/jfs/file.c b/fs/jfs/file.c index e98d39d75cf4..b9dc23cd04f2 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c | |||
@@ -76,7 +76,7 @@ static int jfs_open(struct inode *inode, struct file *file) | |||
76 | if (ji->active_ag == -1) { | 76 | if (ji->active_ag == -1) { |
77 | struct jfs_sb_info *jfs_sb = JFS_SBI(inode->i_sb); | 77 | struct jfs_sb_info *jfs_sb = JFS_SBI(inode->i_sb); |
78 | ji->active_ag = BLKTOAG(addressPXD(&ji->ixpxd), jfs_sb); | 78 | ji->active_ag = BLKTOAG(addressPXD(&ji->ixpxd), jfs_sb); |
79 | atomic_inc( &jfs_sb->bmap->db_active[ji->active_ag]); | 79 | atomic_inc(&jfs_sb->bmap->db_active[ji->active_ag]); |
80 | } | 80 | } |
81 | spin_unlock_irq(&ji->ag_lock); | 81 | spin_unlock_irq(&ji->ag_lock); |
82 | } | 82 | } |
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index 6f1cb2b5ee28..41aa3ca6a6a4 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c | |||
@@ -134,11 +134,11 @@ int jfs_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
134 | * It has been committed since the last change, but was still | 134 | * It has been committed since the last change, but was still |
135 | * on the dirty inode list. | 135 | * on the dirty inode list. |
136 | */ | 136 | */ |
137 | if (!test_cflag(COMMIT_Dirty, inode)) { | 137 | if (!test_cflag(COMMIT_Dirty, inode)) { |
138 | /* Make sure committed changes hit the disk */ | 138 | /* Make sure committed changes hit the disk */ |
139 | jfs_flush_journal(JFS_SBI(inode->i_sb)->log, wait); | 139 | jfs_flush_journal(JFS_SBI(inode->i_sb)->log, wait); |
140 | return 0; | 140 | return 0; |
141 | } | 141 | } |
142 | 142 | ||
143 | if (jfs_commit_inode(inode, wait)) { | 143 | if (jfs_commit_inode(inode, wait)) { |
144 | jfs_err("jfs_write_inode: jfs_commit_inode failed!"); | 144 | jfs_err("jfs_write_inode: jfs_commit_inode failed!"); |
diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c index 93a1232894f6..8db8b7d61e40 100644 --- a/fs/jfs/ioctl.c +++ b/fs/jfs/ioctl.c | |||
@@ -180,9 +180,6 @@ long jfs_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
180 | case JFS_IOC_SETFLAGS32: | 180 | case JFS_IOC_SETFLAGS32: |
181 | cmd = JFS_IOC_SETFLAGS; | 181 | cmd = JFS_IOC_SETFLAGS; |
182 | break; | 182 | break; |
183 | case FITRIM: | ||
184 | cmd = FITRIM; | ||
185 | break; | ||
186 | } | 183 | } |
187 | return jfs_ioctl(filp, cmd, arg); | 184 | return jfs_ioctl(filp, cmd, arg); |
188 | } | 185 | } |
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index e33be921aa41..a5ac97b9a933 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
@@ -1160,7 +1160,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1160 | rc = dtModify(tid, new_dir, &new_dname, &ino, | 1160 | rc = dtModify(tid, new_dir, &new_dname, &ino, |
1161 | old_ip->i_ino, JFS_RENAME); | 1161 | old_ip->i_ino, JFS_RENAME); |
1162 | if (rc) | 1162 | if (rc) |
1163 | goto out4; | 1163 | goto out_tx; |
1164 | drop_nlink(new_ip); | 1164 | drop_nlink(new_ip); |
1165 | if (S_ISDIR(new_ip->i_mode)) { | 1165 | if (S_ISDIR(new_ip->i_mode)) { |
1166 | drop_nlink(new_ip); | 1166 | drop_nlink(new_ip); |
@@ -1185,7 +1185,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1185 | if ((new_size = commitZeroLink(tid, new_ip)) < 0) { | 1185 | if ((new_size = commitZeroLink(tid, new_ip)) < 0) { |
1186 | txAbort(tid, 1); /* Marks FS Dirty */ | 1186 | txAbort(tid, 1); /* Marks FS Dirty */ |
1187 | rc = new_size; | 1187 | rc = new_size; |
1188 | goto out4; | 1188 | goto out_tx; |
1189 | } | 1189 | } |
1190 | tblk = tid_to_tblock(tid); | 1190 | tblk = tid_to_tblock(tid); |
1191 | tblk->xflag |= COMMIT_DELETE; | 1191 | tblk->xflag |= COMMIT_DELETE; |
@@ -1203,7 +1203,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1203 | if (rc) { | 1203 | if (rc) { |
1204 | jfs_err("jfs_rename didn't expect dtSearch to fail " | 1204 | jfs_err("jfs_rename didn't expect dtSearch to fail " |
1205 | "w/rc = %d", rc); | 1205 | "w/rc = %d", rc); |
1206 | goto out4; | 1206 | goto out_tx; |
1207 | } | 1207 | } |
1208 | 1208 | ||
1209 | ino = old_ip->i_ino; | 1209 | ino = old_ip->i_ino; |
@@ -1211,7 +1211,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1211 | if (rc) { | 1211 | if (rc) { |
1212 | if (rc == -EIO) | 1212 | if (rc == -EIO) |
1213 | jfs_err("jfs_rename: dtInsert returned -EIO"); | 1213 | jfs_err("jfs_rename: dtInsert returned -EIO"); |
1214 | goto out4; | 1214 | goto out_tx; |
1215 | } | 1215 | } |
1216 | if (S_ISDIR(old_ip->i_mode)) | 1216 | if (S_ISDIR(old_ip->i_mode)) |
1217 | inc_nlink(new_dir); | 1217 | inc_nlink(new_dir); |
@@ -1226,7 +1226,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1226 | jfs_err("jfs_rename did not expect dtDelete to return rc = %d", | 1226 | jfs_err("jfs_rename did not expect dtDelete to return rc = %d", |
1227 | rc); | 1227 | rc); |
1228 | txAbort(tid, 1); /* Marks Filesystem dirty */ | 1228 | txAbort(tid, 1); /* Marks Filesystem dirty */ |
1229 | goto out4; | 1229 | goto out_tx; |
1230 | } | 1230 | } |
1231 | if (S_ISDIR(old_ip->i_mode)) { | 1231 | if (S_ISDIR(old_ip->i_mode)) { |
1232 | drop_nlink(old_dir); | 1232 | drop_nlink(old_dir); |
@@ -1285,7 +1285,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1285 | 1285 | ||
1286 | rc = txCommit(tid, ipcount, iplist, commit_flag); | 1286 | rc = txCommit(tid, ipcount, iplist, commit_flag); |
1287 | 1287 | ||
1288 | out4: | 1288 | out_tx: |
1289 | txEnd(tid); | 1289 | txEnd(tid); |
1290 | if (new_ip) | 1290 | if (new_ip) |
1291 | mutex_unlock(&JFS_IP(new_ip)->commit_mutex); | 1291 | mutex_unlock(&JFS_IP(new_ip)->commit_mutex); |
@@ -1308,13 +1308,6 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1308 | } | 1308 | } |
1309 | if (new_ip && (new_ip->i_nlink == 0)) | 1309 | if (new_ip && (new_ip->i_nlink == 0)) |
1310 | set_cflag(COMMIT_Nolink, new_ip); | 1310 | set_cflag(COMMIT_Nolink, new_ip); |
1311 | out3: | ||
1312 | free_UCSname(&new_dname); | ||
1313 | out2: | ||
1314 | free_UCSname(&old_dname); | ||
1315 | out1: | ||
1316 | if (new_ip && !S_ISDIR(new_ip->i_mode)) | ||
1317 | IWRITE_UNLOCK(new_ip); | ||
1318 | /* | 1311 | /* |
1319 | * Truncating the directory index table is not guaranteed. It | 1312 | * Truncating the directory index table is not guaranteed. It |
1320 | * may need to be done iteratively | 1313 | * may need to be done iteratively |
@@ -1325,7 +1318,13 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1325 | 1318 | ||
1326 | clear_cflag(COMMIT_Stale, old_dir); | 1319 | clear_cflag(COMMIT_Stale, old_dir); |
1327 | } | 1320 | } |
1328 | 1321 | if (new_ip && !S_ISDIR(new_ip->i_mode)) | |
1322 | IWRITE_UNLOCK(new_ip); | ||
1323 | out3: | ||
1324 | free_UCSname(&new_dname); | ||
1325 | out2: | ||
1326 | free_UCSname(&old_dname); | ||
1327 | out1: | ||
1329 | jfs_info("jfs_rename: returning %d", rc); | 1328 | jfs_info("jfs_rename: returning %d", rc); |
1330 | return rc; | 1329 | return rc; |
1331 | } | 1330 | } |
diff --git a/fs/locks.c b/fs/locks.c index 653faabb07f4..d3d558ba4da7 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -862,12 +862,11 @@ static int posix_locks_deadlock(struct file_lock *caller_fl, | |||
862 | * whether or not a lock was successfully freed by testing the return | 862 | * whether or not a lock was successfully freed by testing the return |
863 | * value for -ENOENT. | 863 | * value for -ENOENT. |
864 | */ | 864 | */ |
865 | static int flock_lock_file(struct file *filp, struct file_lock *request) | 865 | static int flock_lock_inode(struct inode *inode, struct file_lock *request) |
866 | { | 866 | { |
867 | struct file_lock *new_fl = NULL; | 867 | struct file_lock *new_fl = NULL; |
868 | struct file_lock *fl; | 868 | struct file_lock *fl; |
869 | struct file_lock_context *ctx; | 869 | struct file_lock_context *ctx; |
870 | struct inode *inode = file_inode(filp); | ||
871 | int error = 0; | 870 | int error = 0; |
872 | bool found = false; | 871 | bool found = false; |
873 | LIST_HEAD(dispose); | 872 | LIST_HEAD(dispose); |
@@ -890,7 +889,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request) | |||
890 | goto find_conflict; | 889 | goto find_conflict; |
891 | 890 | ||
892 | list_for_each_entry(fl, &ctx->flc_flock, fl_list) { | 891 | list_for_each_entry(fl, &ctx->flc_flock, fl_list) { |
893 | if (filp != fl->fl_file) | 892 | if (request->fl_file != fl->fl_file) |
894 | continue; | 893 | continue; |
895 | if (request->fl_type == fl->fl_type) | 894 | if (request->fl_type == fl->fl_type) |
896 | goto out; | 895 | goto out; |
@@ -1164,20 +1163,19 @@ int posix_lock_file(struct file *filp, struct file_lock *fl, | |||
1164 | EXPORT_SYMBOL(posix_lock_file); | 1163 | EXPORT_SYMBOL(posix_lock_file); |
1165 | 1164 | ||
1166 | /** | 1165 | /** |
1167 | * posix_lock_file_wait - Apply a POSIX-style lock to a file | 1166 | * posix_lock_inode_wait - Apply a POSIX-style lock to a file |
1168 | * @filp: The file to apply the lock to | 1167 | * @inode: inode of file to which lock request should be applied |
1169 | * @fl: The lock to be applied | 1168 | * @fl: The lock to be applied |
1170 | * | 1169 | * |
1171 | * Add a POSIX style lock to a file. | 1170 | * Variant of posix_lock_file_wait that does not take a filp, and so can be |
1172 | * We merge adjacent & overlapping locks whenever possible. | 1171 | * used after the filp has already been torn down. |
1173 | * POSIX locks are sorted by owner task, then by starting address | ||
1174 | */ | 1172 | */ |
1175 | int posix_lock_file_wait(struct file *filp, struct file_lock *fl) | 1173 | int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl) |
1176 | { | 1174 | { |
1177 | int error; | 1175 | int error; |
1178 | might_sleep (); | 1176 | might_sleep (); |
1179 | for (;;) { | 1177 | for (;;) { |
1180 | error = posix_lock_file(filp, fl, NULL); | 1178 | error = __posix_lock_file(inode, fl, NULL); |
1181 | if (error != FILE_LOCK_DEFERRED) | 1179 | if (error != FILE_LOCK_DEFERRED) |
1182 | break; | 1180 | break; |
1183 | error = wait_event_interruptible(fl->fl_wait, !fl->fl_next); | 1181 | error = wait_event_interruptible(fl->fl_wait, !fl->fl_next); |
@@ -1189,7 +1187,7 @@ int posix_lock_file_wait(struct file *filp, struct file_lock *fl) | |||
1189 | } | 1187 | } |
1190 | return error; | 1188 | return error; |
1191 | } | 1189 | } |
1192 | EXPORT_SYMBOL(posix_lock_file_wait); | 1190 | EXPORT_SYMBOL(posix_lock_inode_wait); |
1193 | 1191 | ||
1194 | /** | 1192 | /** |
1195 | * locks_mandatory_locked - Check for an active lock | 1193 | * locks_mandatory_locked - Check for an active lock |
@@ -1851,18 +1849,18 @@ int fcntl_setlease(unsigned int fd, struct file *filp, long arg) | |||
1851 | } | 1849 | } |
1852 | 1850 | ||
1853 | /** | 1851 | /** |
1854 | * flock_lock_file_wait - Apply a FLOCK-style lock to a file | 1852 | * flock_lock_inode_wait - Apply a FLOCK-style lock to a file |
1855 | * @filp: The file to apply the lock to | 1853 | * @inode: inode of the file to apply to |
1856 | * @fl: The lock to be applied | 1854 | * @fl: The lock to be applied |
1857 | * | 1855 | * |
1858 | * Add a FLOCK style lock to a file. | 1856 | * Apply a FLOCK style lock request to an inode. |
1859 | */ | 1857 | */ |
1860 | int flock_lock_file_wait(struct file *filp, struct file_lock *fl) | 1858 | int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl) |
1861 | { | 1859 | { |
1862 | int error; | 1860 | int error; |
1863 | might_sleep(); | 1861 | might_sleep(); |
1864 | for (;;) { | 1862 | for (;;) { |
1865 | error = flock_lock_file(filp, fl); | 1863 | error = flock_lock_inode(inode, fl); |
1866 | if (error != FILE_LOCK_DEFERRED) | 1864 | if (error != FILE_LOCK_DEFERRED) |
1867 | break; | 1865 | break; |
1868 | error = wait_event_interruptible(fl->fl_wait, !fl->fl_next); | 1866 | error = wait_event_interruptible(fl->fl_wait, !fl->fl_next); |
@@ -1874,8 +1872,7 @@ int flock_lock_file_wait(struct file *filp, struct file_lock *fl) | |||
1874 | } | 1872 | } |
1875 | return error; | 1873 | return error; |
1876 | } | 1874 | } |
1877 | 1875 | EXPORT_SYMBOL(flock_lock_inode_wait); | |
1878 | EXPORT_SYMBOL(flock_lock_file_wait); | ||
1879 | 1876 | ||
1880 | /** | 1877 | /** |
1881 | * sys_flock: - flock() system call. | 1878 | * sys_flock: - flock() system call. |
@@ -2401,7 +2398,8 @@ locks_remove_flock(struct file *filp) | |||
2401 | .fl_type = F_UNLCK, | 2398 | .fl_type = F_UNLCK, |
2402 | .fl_end = OFFSET_MAX, | 2399 | .fl_end = OFFSET_MAX, |
2403 | }; | 2400 | }; |
2404 | struct file_lock_context *flctx = file_inode(filp)->i_flctx; | 2401 | struct inode *inode = file_inode(filp); |
2402 | struct file_lock_context *flctx = inode->i_flctx; | ||
2405 | 2403 | ||
2406 | if (list_empty(&flctx->flc_flock)) | 2404 | if (list_empty(&flctx->flc_flock)) |
2407 | return; | 2405 | return; |
@@ -2409,7 +2407,7 @@ locks_remove_flock(struct file *filp) | |||
2409 | if (filp->f_op->flock) | 2407 | if (filp->f_op->flock) |
2410 | filp->f_op->flock(filp, F_SETLKW, &fl); | 2408 | filp->f_op->flock(filp, F_SETLKW, &fl); |
2411 | else | 2409 | else |
2412 | flock_lock_file(filp, &fl); | 2410 | flock_lock_inode(inode, &fl); |
2413 | 2411 | ||
2414 | if (fl.fl_ops && fl.fl_ops->fl_release_private) | 2412 | if (fl.fl_ops && fl.fl_ops->fl_release_private) |
2415 | fl.fl_ops->fl_release_private(&fl); | 2413 | fl.fl_ops->fl_release_private(&fl); |
diff --git a/fs/namespace.c b/fs/namespace.c index c7cb8a526c05..2b8aa15fd6df 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -1361,6 +1361,36 @@ enum umount_tree_flags { | |||
1361 | UMOUNT_PROPAGATE = 2, | 1361 | UMOUNT_PROPAGATE = 2, |
1362 | UMOUNT_CONNECTED = 4, | 1362 | UMOUNT_CONNECTED = 4, |
1363 | }; | 1363 | }; |
1364 | |||
1365 | static bool disconnect_mount(struct mount *mnt, enum umount_tree_flags how) | ||
1366 | { | ||
1367 | /* Leaving mounts connected is only valid for lazy umounts */ | ||
1368 | if (how & UMOUNT_SYNC) | ||
1369 | return true; | ||
1370 | |||
1371 | /* A mount without a parent has nothing to be connected to */ | ||
1372 | if (!mnt_has_parent(mnt)) | ||
1373 | return true; | ||
1374 | |||
1375 | /* Because the reference counting rules change when mounts are | ||
1376 | * unmounted and connected, umounted mounts may not be | ||
1377 | * connected to mounted mounts. | ||
1378 | */ | ||
1379 | if (!(mnt->mnt_parent->mnt.mnt_flags & MNT_UMOUNT)) | ||
1380 | return true; | ||
1381 | |||
1382 | /* Has it been requested that the mount remain connected? */ | ||
1383 | if (how & UMOUNT_CONNECTED) | ||
1384 | return false; | ||
1385 | |||
1386 | /* Is the mount locked such that it needs to remain connected? */ | ||
1387 | if (IS_MNT_LOCKED(mnt)) | ||
1388 | return false; | ||
1389 | |||
1390 | /* By default disconnect the mount */ | ||
1391 | return true; | ||
1392 | } | ||
1393 | |||
1364 | /* | 1394 | /* |
1365 | * mount_lock must be held | 1395 | * mount_lock must be held |
1366 | * namespace_sem must be held for write | 1396 | * namespace_sem must be held for write |
@@ -1398,10 +1428,7 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how) | |||
1398 | if (how & UMOUNT_SYNC) | 1428 | if (how & UMOUNT_SYNC) |
1399 | p->mnt.mnt_flags |= MNT_SYNC_UMOUNT; | 1429 | p->mnt.mnt_flags |= MNT_SYNC_UMOUNT; |
1400 | 1430 | ||
1401 | disconnect = !(((how & UMOUNT_CONNECTED) && | 1431 | disconnect = disconnect_mount(p, how); |
1402 | mnt_has_parent(p) && | ||
1403 | (p->mnt_parent->mnt.mnt_flags & MNT_UMOUNT)) || | ||
1404 | IS_MNT_LOCKED_AND_LAZY(p)); | ||
1405 | 1432 | ||
1406 | pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt, | 1433 | pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt, |
1407 | disconnect ? &unmounted : NULL); | 1434 | disconnect ? &unmounted : NULL); |
@@ -1538,11 +1565,8 @@ void __detach_mounts(struct dentry *dentry) | |||
1538 | while (!hlist_empty(&mp->m_list)) { | 1565 | while (!hlist_empty(&mp->m_list)) { |
1539 | mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list); | 1566 | mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list); |
1540 | if (mnt->mnt.mnt_flags & MNT_UMOUNT) { | 1567 | if (mnt->mnt.mnt_flags & MNT_UMOUNT) { |
1541 | struct mount *p, *tmp; | 1568 | hlist_add_head(&mnt->mnt_umount.s_list, &unmounted); |
1542 | list_for_each_entry_safe(p, tmp, &mnt->mnt_mounts, mnt_child) { | 1569 | umount_mnt(mnt); |
1543 | hlist_add_head(&p->mnt_umount.s_list, &unmounted); | ||
1544 | umount_mnt(p); | ||
1545 | } | ||
1546 | } | 1570 | } |
1547 | else umount_tree(mnt, UMOUNT_CONNECTED); | 1571 | else umount_tree(mnt, UMOUNT_CONNECTED); |
1548 | } | 1572 | } |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 6f228b5af819..8bee93469617 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -5439,15 +5439,15 @@ static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock * | |||
5439 | return err; | 5439 | return err; |
5440 | } | 5440 | } |
5441 | 5441 | ||
5442 | static int do_vfs_lock(struct file *file, struct file_lock *fl) | 5442 | static int do_vfs_lock(struct inode *inode, struct file_lock *fl) |
5443 | { | 5443 | { |
5444 | int res = 0; | 5444 | int res = 0; |
5445 | switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) { | 5445 | switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) { |
5446 | case FL_POSIX: | 5446 | case FL_POSIX: |
5447 | res = posix_lock_file_wait(file, fl); | 5447 | res = posix_lock_inode_wait(inode, fl); |
5448 | break; | 5448 | break; |
5449 | case FL_FLOCK: | 5449 | case FL_FLOCK: |
5450 | res = flock_lock_file_wait(file, fl); | 5450 | res = flock_lock_inode_wait(inode, fl); |
5451 | break; | 5451 | break; |
5452 | default: | 5452 | default: |
5453 | BUG(); | 5453 | BUG(); |
@@ -5484,7 +5484,6 @@ static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl, | |||
5484 | atomic_inc(&lsp->ls_count); | 5484 | atomic_inc(&lsp->ls_count); |
5485 | /* Ensure we don't close file until we're done freeing locks! */ | 5485 | /* Ensure we don't close file until we're done freeing locks! */ |
5486 | p->ctx = get_nfs_open_context(ctx); | 5486 | p->ctx = get_nfs_open_context(ctx); |
5487 | get_file(fl->fl_file); | ||
5488 | memcpy(&p->fl, fl, sizeof(p->fl)); | 5487 | memcpy(&p->fl, fl, sizeof(p->fl)); |
5489 | p->server = NFS_SERVER(inode); | 5488 | p->server = NFS_SERVER(inode); |
5490 | return p; | 5489 | return p; |
@@ -5496,7 +5495,6 @@ static void nfs4_locku_release_calldata(void *data) | |||
5496 | nfs_free_seqid(calldata->arg.seqid); | 5495 | nfs_free_seqid(calldata->arg.seqid); |
5497 | nfs4_put_lock_state(calldata->lsp); | 5496 | nfs4_put_lock_state(calldata->lsp); |
5498 | put_nfs_open_context(calldata->ctx); | 5497 | put_nfs_open_context(calldata->ctx); |
5499 | fput(calldata->fl.fl_file); | ||
5500 | kfree(calldata); | 5498 | kfree(calldata); |
5501 | } | 5499 | } |
5502 | 5500 | ||
@@ -5509,7 +5507,7 @@ static void nfs4_locku_done(struct rpc_task *task, void *data) | |||
5509 | switch (task->tk_status) { | 5507 | switch (task->tk_status) { |
5510 | case 0: | 5508 | case 0: |
5511 | renew_lease(calldata->server, calldata->timestamp); | 5509 | renew_lease(calldata->server, calldata->timestamp); |
5512 | do_vfs_lock(calldata->fl.fl_file, &calldata->fl); | 5510 | do_vfs_lock(calldata->lsp->ls_state->inode, &calldata->fl); |
5513 | if (nfs4_update_lock_stateid(calldata->lsp, | 5511 | if (nfs4_update_lock_stateid(calldata->lsp, |
5514 | &calldata->res.stateid)) | 5512 | &calldata->res.stateid)) |
5515 | break; | 5513 | break; |
@@ -5617,7 +5615,7 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock * | |||
5617 | mutex_lock(&sp->so_delegreturn_mutex); | 5615 | mutex_lock(&sp->so_delegreturn_mutex); |
5618 | /* Exclude nfs4_reclaim_open_stateid() - note nesting! */ | 5616 | /* Exclude nfs4_reclaim_open_stateid() - note nesting! */ |
5619 | down_read(&nfsi->rwsem); | 5617 | down_read(&nfsi->rwsem); |
5620 | if (do_vfs_lock(request->fl_file, request) == -ENOENT) { | 5618 | if (do_vfs_lock(inode, request) == -ENOENT) { |
5621 | up_read(&nfsi->rwsem); | 5619 | up_read(&nfsi->rwsem); |
5622 | mutex_unlock(&sp->so_delegreturn_mutex); | 5620 | mutex_unlock(&sp->so_delegreturn_mutex); |
5623 | goto out; | 5621 | goto out; |
@@ -5758,7 +5756,7 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata) | |||
5758 | data->timestamp); | 5756 | data->timestamp); |
5759 | if (data->arg.new_lock) { | 5757 | if (data->arg.new_lock) { |
5760 | data->fl.fl_flags &= ~(FL_SLEEP | FL_ACCESS); | 5758 | data->fl.fl_flags &= ~(FL_SLEEP | FL_ACCESS); |
5761 | if (do_vfs_lock(data->fl.fl_file, &data->fl) < 0) { | 5759 | if (do_vfs_lock(lsp->ls_state->inode, &data->fl) < 0) { |
5762 | rpc_restart_call_prepare(task); | 5760 | rpc_restart_call_prepare(task); |
5763 | break; | 5761 | break; |
5764 | } | 5762 | } |
@@ -6000,7 +5998,7 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock | |||
6000 | if (status != 0) | 5998 | if (status != 0) |
6001 | goto out; | 5999 | goto out; |
6002 | request->fl_flags |= FL_ACCESS; | 6000 | request->fl_flags |= FL_ACCESS; |
6003 | status = do_vfs_lock(request->fl_file, request); | 6001 | status = do_vfs_lock(state->inode, request); |
6004 | if (status < 0) | 6002 | if (status < 0) |
6005 | goto out; | 6003 | goto out; |
6006 | down_read(&nfsi->rwsem); | 6004 | down_read(&nfsi->rwsem); |
@@ -6008,7 +6006,7 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock | |||
6008 | /* Yes: cache locks! */ | 6006 | /* Yes: cache locks! */ |
6009 | /* ...but avoid races with delegation recall... */ | 6007 | /* ...but avoid races with delegation recall... */ |
6010 | request->fl_flags = fl_flags & ~FL_SLEEP; | 6008 | request->fl_flags = fl_flags & ~FL_SLEEP; |
6011 | status = do_vfs_lock(request->fl_file, request); | 6009 | status = do_vfs_lock(state->inode, request); |
6012 | up_read(&nfsi->rwsem); | 6010 | up_read(&nfsi->rwsem); |
6013 | goto out; | 6011 | goto out; |
6014 | } | 6012 | } |
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index 9a20e513d7eb..aba43811d6ef 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c | |||
@@ -1369,7 +1369,6 @@ long nilfs_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
1369 | case NILFS_IOCTL_SYNC: | 1369 | case NILFS_IOCTL_SYNC: |
1370 | case NILFS_IOCTL_RESIZE: | 1370 | case NILFS_IOCTL_RESIZE: |
1371 | case NILFS_IOCTL_SET_ALLOC_RANGE: | 1371 | case NILFS_IOCTL_SET_ALLOC_RANGE: |
1372 | case FITRIM: | ||
1373 | break; | 1372 | break; |
1374 | default: | 1373 | default: |
1375 | return -ENOIOCTLCMD; | 1374 | return -ENOIOCTLCMD; |
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index 53e6c40ed4c6..3cb097ccce60 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c | |||
@@ -980,7 +980,6 @@ long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
980 | case OCFS2_IOC_GROUP_EXTEND: | 980 | case OCFS2_IOC_GROUP_EXTEND: |
981 | case OCFS2_IOC_GROUP_ADD: | 981 | case OCFS2_IOC_GROUP_ADD: |
982 | case OCFS2_IOC_GROUP_ADD64: | 982 | case OCFS2_IOC_GROUP_ADD64: |
983 | case FITRIM: | ||
984 | break; | 983 | break; |
985 | case OCFS2_IOC_REFLINK: | 984 | case OCFS2_IOC_REFLINK: |
986 | if (copy_from_user(&args, argp, sizeof(args))) | 985 | if (copy_from_user(&args, argp, sizeof(args))) |
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index f140e3dbfb7b..d9da5a4e9382 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c | |||
@@ -343,6 +343,9 @@ struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags) | |||
343 | struct path realpath; | 343 | struct path realpath; |
344 | enum ovl_path_type type; | 344 | enum ovl_path_type type; |
345 | 345 | ||
346 | if (d_is_dir(dentry)) | ||
347 | return d_backing_inode(dentry); | ||
348 | |||
346 | type = ovl_path_real(dentry, &realpath); | 349 | type = ovl_path_real(dentry, &realpath); |
347 | if (ovl_open_need_copy_up(file_flags, type, realpath.dentry)) { | 350 | if (ovl_open_need_copy_up(file_flags, type, realpath.dentry)) { |
348 | err = ovl_want_write(dentry); | 351 | err = ovl_want_write(dentry); |
diff --git a/fs/pnode.h b/fs/pnode.h index 7114ce6e6b9e..0fcdbe7ca648 100644 --- a/fs/pnode.h +++ b/fs/pnode.h | |||
@@ -20,8 +20,6 @@ | |||
20 | #define SET_MNT_MARK(m) ((m)->mnt.mnt_flags |= MNT_MARKED) | 20 | #define SET_MNT_MARK(m) ((m)->mnt.mnt_flags |= MNT_MARKED) |
21 | #define CLEAR_MNT_MARK(m) ((m)->mnt.mnt_flags &= ~MNT_MARKED) | 21 | #define CLEAR_MNT_MARK(m) ((m)->mnt.mnt_flags &= ~MNT_MARKED) |
22 | #define IS_MNT_LOCKED(m) ((m)->mnt.mnt_flags & MNT_LOCKED) | 22 | #define IS_MNT_LOCKED(m) ((m)->mnt.mnt_flags & MNT_LOCKED) |
23 | #define IS_MNT_LOCKED_AND_LAZY(m) \ | ||
24 | (((m)->mnt.mnt_flags & (MNT_LOCKED|MNT_SYNC_UMOUNT)) == MNT_LOCKED) | ||
25 | 23 | ||
26 | #define CL_EXPIRE 0x01 | 24 | #define CL_EXPIRE 0x01 |
27 | #define CL_SLAVE 0x02 | 25 | #define CL_SLAVE 0x02 |
diff --git a/fs/proc/Kconfig b/fs/proc/Kconfig index d751fcb637bb..1ade1206bb89 100644 --- a/fs/proc/Kconfig +++ b/fs/proc/Kconfig | |||
@@ -75,3 +75,9 @@ config PROC_PAGE_MONITOR | |||
75 | config PROC_CHILDREN | 75 | config PROC_CHILDREN |
76 | bool "Include /proc/<pid>/task/<tid>/children file" | 76 | bool "Include /proc/<pid>/task/<tid>/children file" |
77 | default n | 77 | default n |
78 | help | ||
79 | Provides a fast way to retrieve first level children pids of a task. See | ||
80 | <file:Documentation/filesystems/proc.txt> for more information. | ||
81 | |||
82 | Say Y if you are running any user-space software which takes benefit from | ||
83 | this interface. For example, rkt is such a piece of software. | ||
diff --git a/fs/proc/base.c b/fs/proc/base.c index 87782e874b6a..aa50d1ac28fc 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -243,6 +243,11 @@ static ssize_t proc_pid_cmdline_read(struct file *file, char __user *buf, | |||
243 | len1 = arg_end - arg_start; | 243 | len1 = arg_end - arg_start; |
244 | len2 = env_end - env_start; | 244 | len2 = env_end - env_start; |
245 | 245 | ||
246 | /* Empty ARGV. */ | ||
247 | if (len1 == 0) { | ||
248 | rv = 0; | ||
249 | goto out_free_page; | ||
250 | } | ||
246 | /* | 251 | /* |
247 | * Inherently racy -- command line shares address space | 252 | * Inherently racy -- command line shares address space |
248 | * with code and data. | 253 | * with code and data. |
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index 91a4e6426321..92e6726f6e37 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c | |||
@@ -92,7 +92,7 @@ static size_t get_kcore_size(int *nphdr, size_t *elf_buflen) | |||
92 | roundup(sizeof(CORE_STR), 4)) + | 92 | roundup(sizeof(CORE_STR), 4)) + |
93 | roundup(sizeof(struct elf_prstatus), 4) + | 93 | roundup(sizeof(struct elf_prstatus), 4) + |
94 | roundup(sizeof(struct elf_prpsinfo), 4) + | 94 | roundup(sizeof(struct elf_prpsinfo), 4) + |
95 | roundup(sizeof(struct task_struct), 4); | 95 | roundup(arch_task_struct_size, 4); |
96 | *elf_buflen = PAGE_ALIGN(*elf_buflen); | 96 | *elf_buflen = PAGE_ALIGN(*elf_buflen); |
97 | return size + *elf_buflen; | 97 | return size + *elf_buflen; |
98 | } | 98 | } |
@@ -415,7 +415,7 @@ static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff) | |||
415 | /* set up the task structure */ | 415 | /* set up the task structure */ |
416 | notes[2].name = CORE_STR; | 416 | notes[2].name = CORE_STR; |
417 | notes[2].type = NT_TASKSTRUCT; | 417 | notes[2].type = NT_TASKSTRUCT; |
418 | notes[2].datasz = sizeof(struct task_struct); | 418 | notes[2].datasz = arch_task_struct_size; |
419 | notes[2].data = current; | 419 | notes[2].data = current; |
420 | 420 | ||
421 | nhdr->p_filesz += notesize(¬es[2]); | 421 | nhdr->p_filesz += notesize(¬es[2]); |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 6afac3d561ac..8d0b3ade0ff0 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -1652,17 +1652,9 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1652 | iinfo->i_ext.i_data, inode->i_sb->s_blocksize - | 1652 | iinfo->i_ext.i_data, inode->i_sb->s_blocksize - |
1653 | sizeof(struct unallocSpaceEntry)); | 1653 | sizeof(struct unallocSpaceEntry)); |
1654 | use->descTag.tagIdent = cpu_to_le16(TAG_IDENT_USE); | 1654 | use->descTag.tagIdent = cpu_to_le16(TAG_IDENT_USE); |
1655 | use->descTag.tagLocation = | 1655 | crclen = sizeof(struct unallocSpaceEntry); |
1656 | cpu_to_le32(iinfo->i_location.logicalBlockNum); | ||
1657 | crclen = sizeof(struct unallocSpaceEntry) + | ||
1658 | iinfo->i_lenAlloc - sizeof(struct tag); | ||
1659 | use->descTag.descCRCLength = cpu_to_le16(crclen); | ||
1660 | use->descTag.descCRC = cpu_to_le16(crc_itu_t(0, (char *)use + | ||
1661 | sizeof(struct tag), | ||
1662 | crclen)); | ||
1663 | use->descTag.tagChecksum = udf_tag_checksum(&use->descTag); | ||
1664 | 1656 | ||
1665 | goto out; | 1657 | goto finish; |
1666 | } | 1658 | } |
1667 | 1659 | ||
1668 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET)) | 1660 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET)) |
@@ -1782,6 +1774,8 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1782 | efe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EFE); | 1774 | efe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EFE); |
1783 | crclen = sizeof(struct extendedFileEntry); | 1775 | crclen = sizeof(struct extendedFileEntry); |
1784 | } | 1776 | } |
1777 | |||
1778 | finish: | ||
1785 | if (iinfo->i_strat4096) { | 1779 | if (iinfo->i_strat4096) { |
1786 | fe->icbTag.strategyType = cpu_to_le16(4096); | 1780 | fe->icbTag.strategyType = cpu_to_le16(4096); |
1787 | fe->icbTag.strategyParameter = cpu_to_le16(1); | 1781 | fe->icbTag.strategyParameter = cpu_to_le16(1); |
@@ -1791,7 +1785,9 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1791 | fe->icbTag.numEntries = cpu_to_le16(1); | 1785 | fe->icbTag.numEntries = cpu_to_le16(1); |
1792 | } | 1786 | } |
1793 | 1787 | ||
1794 | if (S_ISDIR(inode->i_mode)) | 1788 | if (iinfo->i_use) |
1789 | fe->icbTag.fileType = ICBTAG_FILE_TYPE_USE; | ||
1790 | else if (S_ISDIR(inode->i_mode)) | ||
1795 | fe->icbTag.fileType = ICBTAG_FILE_TYPE_DIRECTORY; | 1791 | fe->icbTag.fileType = ICBTAG_FILE_TYPE_DIRECTORY; |
1796 | else if (S_ISREG(inode->i_mode)) | 1792 | else if (S_ISREG(inode->i_mode)) |
1797 | fe->icbTag.fileType = ICBTAG_FILE_TYPE_REGULAR; | 1793 | fe->icbTag.fileType = ICBTAG_FILE_TYPE_REGULAR; |
@@ -1828,7 +1824,6 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1828 | crclen)); | 1824 | crclen)); |
1829 | fe->descTag.tagChecksum = udf_tag_checksum(&fe->descTag); | 1825 | fe->descTag.tagChecksum = udf_tag_checksum(&fe->descTag); |
1830 | 1826 | ||
1831 | out: | ||
1832 | set_buffer_uptodate(bh); | 1827 | set_buffer_uptodate(bh); |
1833 | unlock_buffer(bh); | 1828 | unlock_buffer(bh); |
1834 | 1829 | ||
diff --git a/include/asm-generic/mm-arch-hooks.h b/include/asm-generic/mm-arch-hooks.h new file mode 100644 index 000000000000..5ff0e5193f85 --- /dev/null +++ b/include/asm-generic/mm-arch-hooks.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * Architecture specific mm hooks | ||
3 | */ | ||
4 | |||
5 | #ifndef _ASM_GENERIC_MM_ARCH_HOOKS_H | ||
6 | #define _ASM_GENERIC_MM_ARCH_HOOKS_H | ||
7 | |||
8 | /* | ||
9 | * This file should be included through arch/../include/asm/Kbuild for | ||
10 | * the architecture which doesn't need specific mm hooks. | ||
11 | * | ||
12 | * In that case, the generic hooks defined in include/linux/mm-arch-hooks.h | ||
13 | * are used. | ||
14 | */ | ||
15 | |||
16 | #endif /* _ASM_GENERIC_MM_ARCH_HOOKS_H */ | ||
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index c471dfc93b71..d2445fa9999f 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -58,6 +58,19 @@ static inline acpi_handle acpi_device_handle(struct acpi_device *adev) | |||
58 | acpi_fwnode_handle(adev) : NULL) | 58 | acpi_fwnode_handle(adev) : NULL) |
59 | #define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev)) | 59 | #define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev)) |
60 | 60 | ||
61 | /** | ||
62 | * ACPI_DEVICE_CLASS - macro used to describe an ACPI device with | ||
63 | * the PCI-defined class-code information | ||
64 | * | ||
65 | * @_cls : the class, subclass, prog-if triple for this device | ||
66 | * @_msk : the class mask for this device | ||
67 | * | ||
68 | * This macro is used to create a struct acpi_device_id that matches a | ||
69 | * specific PCI class. The .id and .driver_data fields will be left | ||
70 | * initialized with the default value. | ||
71 | */ | ||
72 | #define ACPI_DEVICE_CLASS(_cls, _msk) .cls = (_cls), .cls_msk = (_msk), | ||
73 | |||
61 | static inline bool has_acpi_companion(struct device *dev) | 74 | static inline bool has_acpi_companion(struct device *dev) |
62 | { | 75 | { |
63 | return is_acpi_node(dev->fwnode); | 76 | return is_acpi_node(dev->fwnode); |
@@ -309,9 +322,6 @@ int acpi_check_region(resource_size_t start, resource_size_t n, | |||
309 | 322 | ||
310 | int acpi_resources_are_enforced(void); | 323 | int acpi_resources_are_enforced(void); |
311 | 324 | ||
312 | int acpi_reserve_region(u64 start, unsigned int length, u8 space_id, | ||
313 | unsigned long flags, char *desc); | ||
314 | |||
315 | #ifdef CONFIG_HIBERNATION | 325 | #ifdef CONFIG_HIBERNATION |
316 | void __init acpi_no_s4_hw_signature(void); | 326 | void __init acpi_no_s4_hw_signature(void); |
317 | #endif | 327 | #endif |
@@ -446,6 +456,7 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *); | |||
446 | #define ACPI_COMPANION(dev) (NULL) | 456 | #define ACPI_COMPANION(dev) (NULL) |
447 | #define ACPI_COMPANION_SET(dev, adev) do { } while (0) | 457 | #define ACPI_COMPANION_SET(dev, adev) do { } while (0) |
448 | #define ACPI_HANDLE(dev) (NULL) | 458 | #define ACPI_HANDLE(dev) (NULL) |
459 | #define ACPI_DEVICE_CLASS(_cls, _msk) .cls = (0), .cls_msk = (0), | ||
449 | 460 | ||
450 | struct fwnode_handle; | 461 | struct fwnode_handle; |
451 | 462 | ||
@@ -507,13 +518,6 @@ static inline int acpi_check_region(resource_size_t start, resource_size_t n, | |||
507 | return 0; | 518 | return 0; |
508 | } | 519 | } |
509 | 520 | ||
510 | static inline int acpi_reserve_region(u64 start, unsigned int length, | ||
511 | u8 space_id, unsigned long flags, | ||
512 | char *desc) | ||
513 | { | ||
514 | return -ENXIO; | ||
515 | } | ||
516 | |||
517 | struct acpi_table_header; | 521 | struct acpi_table_header; |
518 | static inline int acpi_table_parse(char *id, | 522 | static inline int acpi_table_parse(char *id, |
519 | int (*handler)(struct acpi_table_header *)) | 523 | int (*handler)(struct acpi_table_header *)) |
diff --git a/include/linux/amba/sp810.h b/include/linux/amba/sp810.h index c7df89f99115..58fe9e8b6fd7 100644 --- a/include/linux/amba/sp810.h +++ b/include/linux/amba/sp810.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * ARM PrimeXsys System Controller SP810 header file | 2 | * ARM PrimeXsys System Controller SP810 header file |
3 | * | 3 | * |
4 | * Copyright (C) 2009 ST Microelectronics | 4 | * Copyright (C) 2009 ST Microelectronics |
5 | * Viresh Kumar <viresh.linux@gmail.com> | 5 | * Viresh Kumar <vireshk@kernel.org> |
6 | * | 6 | * |
7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
diff --git a/include/linux/ata.h b/include/linux/ata.h index fed36418dd1c..6c78956aa470 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -45,6 +45,7 @@ enum { | |||
45 | ATA_SECT_SIZE = 512, | 45 | ATA_SECT_SIZE = 512, |
46 | ATA_MAX_SECTORS_128 = 128, | 46 | ATA_MAX_SECTORS_128 = 128, |
47 | ATA_MAX_SECTORS = 256, | 47 | ATA_MAX_SECTORS = 256, |
48 | ATA_MAX_SECTORS_1024 = 1024, | ||
48 | ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ | 49 | ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ |
49 | ATA_MAX_SECTORS_TAPE = 65535, | 50 | ATA_MAX_SECTORS_TAPE = 65535, |
50 | 51 | ||
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 58cfab80dd70..1b62d768c7df 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h | |||
@@ -47,6 +47,7 @@ struct blkcg { | |||
47 | 47 | ||
48 | struct blkcg_policy_data *pd[BLKCG_MAX_POLS]; | 48 | struct blkcg_policy_data *pd[BLKCG_MAX_POLS]; |
49 | 49 | ||
50 | struct list_head all_blkcgs_node; | ||
50 | #ifdef CONFIG_CGROUP_WRITEBACK | 51 | #ifdef CONFIG_CGROUP_WRITEBACK |
51 | struct list_head cgwb_list; | 52 | struct list_head cgwb_list; |
52 | #endif | 53 | #endif |
@@ -88,18 +89,12 @@ struct blkg_policy_data { | |||
88 | * Policies that need to keep per-blkcg data which is independent | 89 | * Policies that need to keep per-blkcg data which is independent |
89 | * from any request_queue associated to it must specify its size | 90 | * from any request_queue associated to it must specify its size |
90 | * with the cpd_size field of the blkcg_policy structure and | 91 | * with the cpd_size field of the blkcg_policy structure and |
91 | * embed a blkcg_policy_data in it. blkcg core allocates | 92 | * embed a blkcg_policy_data in it. cpd_init() is invoked to let |
92 | * policy-specific per-blkcg structures lazily the first time | 93 | * each policy handle per-blkcg data. |
93 | * they are actually needed, so it handles them together with | ||
94 | * blkgs. cpd_init() is invoked to let each policy handle | ||
95 | * per-blkcg data. | ||
96 | */ | 94 | */ |
97 | struct blkcg_policy_data { | 95 | struct blkcg_policy_data { |
98 | /* the policy id this per-policy data belongs to */ | 96 | /* the policy id this per-policy data belongs to */ |
99 | int plid; | 97 | int plid; |
100 | |||
101 | /* used during policy activation */ | ||
102 | struct list_head alloc_node; | ||
103 | }; | 98 | }; |
104 | 99 | ||
105 | /* association between a blk cgroup and a request queue */ | 100 | /* association between a blk cgroup and a request queue */ |
diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h index b6a52a4b457a..51bb6532785c 100644 --- a/include/linux/can/skb.h +++ b/include/linux/can/skb.h | |||
@@ -27,10 +27,12 @@ | |||
27 | /** | 27 | /** |
28 | * struct can_skb_priv - private additional data inside CAN sk_buffs | 28 | * struct can_skb_priv - private additional data inside CAN sk_buffs |
29 | * @ifindex: ifindex of the first interface the CAN frame appeared on | 29 | * @ifindex: ifindex of the first interface the CAN frame appeared on |
30 | * @skbcnt: atomic counter to have an unique id together with skb pointer | ||
30 | * @cf: align to the following CAN frame at skb->data | 31 | * @cf: align to the following CAN frame at skb->data |
31 | */ | 32 | */ |
32 | struct can_skb_priv { | 33 | struct can_skb_priv { |
33 | int ifindex; | 34 | int ifindex; |
35 | int skbcnt; | ||
34 | struct can_frame cf[0]; | 36 | struct can_frame cf[0]; |
35 | }; | 37 | }; |
36 | 38 | ||
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index e15499422fdc..37753278987a 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/radix-tree.h> | 8 | #include <linux/radix-tree.h> |
9 | #include <linux/uio.h> | 9 | #include <linux/uio.h> |
10 | #include <linux/workqueue.h> | 10 | #include <linux/workqueue.h> |
11 | #include <net/net_namespace.h> | ||
11 | 12 | ||
12 | #include <linux/ceph/types.h> | 13 | #include <linux/ceph/types.h> |
13 | #include <linux/ceph/buffer.h> | 14 | #include <linux/ceph/buffer.h> |
@@ -56,6 +57,7 @@ struct ceph_messenger { | |||
56 | struct ceph_entity_addr my_enc_addr; | 57 | struct ceph_entity_addr my_enc_addr; |
57 | 58 | ||
58 | atomic_t stopping; | 59 | atomic_t stopping; |
60 | possible_net_t net; | ||
59 | bool nocrc; | 61 | bool nocrc; |
60 | bool tcp_nodelay; | 62 | bool tcp_nodelay; |
61 | 63 | ||
@@ -267,6 +269,7 @@ extern void ceph_messenger_init(struct ceph_messenger *msgr, | |||
267 | u64 required_features, | 269 | u64 required_features, |
268 | bool nocrc, | 270 | bool nocrc, |
269 | bool tcp_nodelay); | 271 | bool tcp_nodelay); |
272 | extern void ceph_messenger_fini(struct ceph_messenger *msgr); | ||
270 | 273 | ||
271 | extern void ceph_con_init(struct ceph_connection *con, void *private, | 274 | extern void ceph_con_init(struct ceph_connection *con, void *private, |
272 | const struct ceph_connection_operations *ops, | 275 | const struct ceph_connection_operations *ops, |
diff --git a/include/linux/clkdev.h b/include/linux/clkdev.h index a240b18e86fa..08bffcc466de 100644 --- a/include/linux/clkdev.h +++ b/include/linux/clkdev.h | |||
@@ -33,18 +33,19 @@ struct clk_lookup { | |||
33 | } | 33 | } |
34 | 34 | ||
35 | struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id, | 35 | struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id, |
36 | const char *dev_fmt, ...); | 36 | const char *dev_fmt, ...) __printf(3, 4); |
37 | 37 | ||
38 | void clkdev_add(struct clk_lookup *cl); | 38 | void clkdev_add(struct clk_lookup *cl); |
39 | void clkdev_drop(struct clk_lookup *cl); | 39 | void clkdev_drop(struct clk_lookup *cl); |
40 | 40 | ||
41 | struct clk_lookup *clkdev_create(struct clk *clk, const char *con_id, | 41 | struct clk_lookup *clkdev_create(struct clk *clk, const char *con_id, |
42 | const char *dev_fmt, ...); | 42 | const char *dev_fmt, ...) __printf(3, 4); |
43 | 43 | ||
44 | void clkdev_add_table(struct clk_lookup *, size_t); | 44 | void clkdev_add_table(struct clk_lookup *, size_t); |
45 | int clk_add_alias(const char *, const char *, const char *, struct device *); | 45 | int clk_add_alias(const char *, const char *, const char *, struct device *); |
46 | 46 | ||
47 | int clk_register_clkdev(struct clk *, const char *, const char *, ...); | 47 | int clk_register_clkdev(struct clk *, const char *, const char *, ...) |
48 | __printf(3, 4); | ||
48 | int clk_register_clkdevs(struct clk *, struct clk_lookup *, size_t); | 49 | int clk_register_clkdevs(struct clk *, struct clk_lookup *, size_t); |
49 | 50 | ||
50 | #ifdef CONFIG_COMMON_CLK | 51 | #ifdef CONFIG_COMMON_CLK |
diff --git a/include/linux/compat.h b/include/linux/compat.h index ab25814690bc..a76c9172b2eb 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -424,7 +424,7 @@ asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, | |||
424 | 424 | ||
425 | asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); | 425 | asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); |
426 | 426 | ||
427 | extern int compat_printk(const char *fmt, ...); | 427 | extern __printf(1, 2) int compat_printk(const char *fmt, ...); |
428 | extern void sigset_from_compat(sigset_t *set, const compat_sigset_t *compat); | 428 | extern void sigset_from_compat(sigset_t *set, const compat_sigset_t *compat); |
429 | extern void sigset_to_compat(compat_sigset_t *compat, const sigset_t *set); | 429 | extern void sigset_to_compat(compat_sigset_t *compat, const sigset_t *set); |
430 | 430 | ||
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 7f8ad9593da7..e08a6ae7c0a4 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -17,11 +17,11 @@ | |||
17 | # define __release(x) __context__(x,-1) | 17 | # define __release(x) __context__(x,-1) |
18 | # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) | 18 | # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) |
19 | # define __percpu __attribute__((noderef, address_space(3))) | 19 | # define __percpu __attribute__((noderef, address_space(3))) |
20 | # define __pmem __attribute__((noderef, address_space(5))) | ||
20 | #ifdef CONFIG_SPARSE_RCU_POINTER | 21 | #ifdef CONFIG_SPARSE_RCU_POINTER |
21 | # define __rcu __attribute__((noderef, address_space(4))) | 22 | # define __rcu __attribute__((noderef, address_space(4))) |
22 | #else | 23 | #else |
23 | # define __rcu | 24 | # define __rcu |
24 | # define __pmem __attribute__((noderef, address_space(5))) | ||
25 | #endif | 25 | #endif |
26 | extern void __chk_user_ptr(const volatile void __user *); | 26 | extern void __chk_user_ptr(const volatile void __user *); |
27 | extern void __chk_io_ptr(const volatile void __iomem *); | 27 | extern void __chk_io_ptr(const volatile void __iomem *); |
diff --git a/include/linux/configfs.h b/include/linux/configfs.h index c9e5c57e4edf..63a36e89d0eb 100644 --- a/include/linux/configfs.h +++ b/include/linux/configfs.h | |||
@@ -64,7 +64,8 @@ struct config_item { | |||
64 | struct dentry *ci_dentry; | 64 | struct dentry *ci_dentry; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | extern int config_item_set_name(struct config_item *, const char *, ...); | 67 | extern __printf(2, 3) |
68 | int config_item_set_name(struct config_item *, const char *, ...); | ||
68 | 69 | ||
69 | static inline char *config_item_name(struct config_item * item) | 70 | static inline char *config_item_name(struct config_item * item) |
70 | { | 71 | { |
diff --git a/include/linux/cper.h b/include/linux/cper.h index 76abba4b238e..dcacb1a72e26 100644 --- a/include/linux/cper.h +++ b/include/linux/cper.h | |||
@@ -340,7 +340,27 @@ struct cper_ia_proc_ctx { | |||
340 | __u64 mm_reg_addr; | 340 | __u64 mm_reg_addr; |
341 | }; | 341 | }; |
342 | 342 | ||
343 | /* Memory Error Section */ | 343 | /* Old Memory Error Section UEFI 2.1, 2.2 */ |
344 | struct cper_sec_mem_err_old { | ||
345 | __u64 validation_bits; | ||
346 | __u64 error_status; | ||
347 | __u64 physical_addr; | ||
348 | __u64 physical_addr_mask; | ||
349 | __u16 node; | ||
350 | __u16 card; | ||
351 | __u16 module; | ||
352 | __u16 bank; | ||
353 | __u16 device; | ||
354 | __u16 row; | ||
355 | __u16 column; | ||
356 | __u16 bit_pos; | ||
357 | __u64 requestor_id; | ||
358 | __u64 responder_id; | ||
359 | __u64 target_id; | ||
360 | __u8 error_type; | ||
361 | }; | ||
362 | |||
363 | /* Memory Error Section UEFI >= 2.3 */ | ||
344 | struct cper_sec_mem_err { | 364 | struct cper_sec_mem_err { |
345 | __u64 validation_bits; | 365 | __u64 validation_bits; |
346 | __u64 error_status; | 366 | __u64 error_status; |
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index c0fb6b1b4712..23c30bdcca86 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -40,9 +40,10 @@ extern void cpu_remove_dev_attr(struct device_attribute *attr); | |||
40 | extern int cpu_add_dev_attr_group(struct attribute_group *attrs); | 40 | extern int cpu_add_dev_attr_group(struct attribute_group *attrs); |
41 | extern void cpu_remove_dev_attr_group(struct attribute_group *attrs); | 41 | extern void cpu_remove_dev_attr_group(struct attribute_group *attrs); |
42 | 42 | ||
43 | extern struct device *cpu_device_create(struct device *parent, void *drvdata, | 43 | extern __printf(4, 5) |
44 | const struct attribute_group **groups, | 44 | struct device *cpu_device_create(struct device *parent, void *drvdata, |
45 | const char *fmt, ...); | 45 | const struct attribute_group **groups, |
46 | const char *fmt, ...); | ||
46 | #ifdef CONFIG_HOTPLUG_CPU | 47 | #ifdef CONFIG_HOTPLUG_CPU |
47 | extern void unregister_cpu(struct cpu *cpu); | 48 | extern void unregister_cpu(struct cpu *cpu); |
48 | extern ssize_t arch_cpu_probe(const char *, size_t); | 49 | extern ssize_t arch_cpu_probe(const char *, size_t); |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index d2d50249b7b2..d67ae119cf4e 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -327,7 +327,8 @@ static inline unsigned d_count(const struct dentry *dentry) | |||
327 | /* | 327 | /* |
328 | * helper function for dentry_operations.d_dname() members | 328 | * helper function for dentry_operations.d_dname() members |
329 | */ | 329 | */ |
330 | extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); | 330 | extern __printf(4, 5) |
331 | char *dynamic_dname(struct dentry *, char *, int, const char *, ...); | ||
331 | extern char *simple_dname(struct dentry *, char *, int); | 332 | extern char *simple_dname(struct dentry *, char *, int); |
332 | 333 | ||
333 | extern char *__d_path(const struct path *, const struct path *, char *, int); | 334 | extern char *__d_path(const struct path *, const struct path *, char *, int); |
diff --git a/include/linux/device.h b/include/linux/device.h index 22227e7fe463..3d3139ad5705 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -637,8 +637,9 @@ extern int devres_release_group(struct device *dev, void *id); | |||
637 | 637 | ||
638 | /* managed devm_k.alloc/kfree for device drivers */ | 638 | /* managed devm_k.alloc/kfree for device drivers */ |
639 | extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp); | 639 | extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp); |
640 | extern char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, | 640 | extern __printf(3, 0) |
641 | va_list ap); | 641 | char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, |
642 | va_list ap); | ||
642 | extern __printf(3, 4) | 643 | extern __printf(3, 4) |
643 | char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...); | 644 | char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...); |
644 | static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) | 645 | static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) |
@@ -1015,12 +1016,10 @@ extern int __must_check device_reprobe(struct device *dev); | |||
1015 | /* | 1016 | /* |
1016 | * Easy functions for dynamically creating devices on the fly | 1017 | * Easy functions for dynamically creating devices on the fly |
1017 | */ | 1018 | */ |
1018 | extern struct device *device_create_vargs(struct class *cls, | 1019 | extern __printf(5, 0) |
1019 | struct device *parent, | 1020 | struct device *device_create_vargs(struct class *cls, struct device *parent, |
1020 | dev_t devt, | 1021 | dev_t devt, void *drvdata, |
1021 | void *drvdata, | 1022 | const char *fmt, va_list vargs); |
1022 | const char *fmt, | ||
1023 | va_list vargs); | ||
1024 | extern __printf(5, 6) | 1023 | extern __printf(5, 6) |
1025 | struct device *device_create(struct class *cls, struct device *parent, | 1024 | struct device *device_create(struct class *cls, struct device *parent, |
1026 | dev_t devt, void *drvdata, | 1025 | dev_t devt, void *drvdata, |
diff --git a/include/linux/fs.h b/include/linux/fs.h index a0653e560c26..cc008c338f5a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1046,12 +1046,12 @@ extern void locks_remove_file(struct file *); | |||
1046 | extern void locks_release_private(struct file_lock *); | 1046 | extern void locks_release_private(struct file_lock *); |
1047 | extern void posix_test_lock(struct file *, struct file_lock *); | 1047 | extern void posix_test_lock(struct file *, struct file_lock *); |
1048 | extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); | 1048 | extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); |
1049 | extern int posix_lock_file_wait(struct file *, struct file_lock *); | 1049 | extern int posix_lock_inode_wait(struct inode *, struct file_lock *); |
1050 | extern int posix_unblock_lock(struct file_lock *); | 1050 | extern int posix_unblock_lock(struct file_lock *); |
1051 | extern int vfs_test_lock(struct file *, struct file_lock *); | 1051 | extern int vfs_test_lock(struct file *, struct file_lock *); |
1052 | extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); | 1052 | extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); |
1053 | extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); | 1053 | extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); |
1054 | extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); | 1054 | extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl); |
1055 | extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); | 1055 | extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); |
1056 | extern void lease_get_mtime(struct inode *, struct timespec *time); | 1056 | extern void lease_get_mtime(struct inode *, struct timespec *time); |
1057 | extern int generic_setlease(struct file *, long, struct file_lock **, void **priv); | 1057 | extern int generic_setlease(struct file *, long, struct file_lock **, void **priv); |
@@ -1137,7 +1137,8 @@ static inline int posix_lock_file(struct file *filp, struct file_lock *fl, | |||
1137 | return -ENOLCK; | 1137 | return -ENOLCK; |
1138 | } | 1138 | } |
1139 | 1139 | ||
1140 | static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl) | 1140 | static inline int posix_lock_inode_wait(struct inode *inode, |
1141 | struct file_lock *fl) | ||
1141 | { | 1142 | { |
1142 | return -ENOLCK; | 1143 | return -ENOLCK; |
1143 | } | 1144 | } |
@@ -1163,8 +1164,8 @@ static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl) | |||
1163 | return 0; | 1164 | return 0; |
1164 | } | 1165 | } |
1165 | 1166 | ||
1166 | static inline int flock_lock_file_wait(struct file *filp, | 1167 | static inline int flock_lock_inode_wait(struct inode *inode, |
1167 | struct file_lock *request) | 1168 | struct file_lock *request) |
1168 | { | 1169 | { |
1169 | return -ENOLCK; | 1170 | return -ENOLCK; |
1170 | } | 1171 | } |
@@ -1202,6 +1203,20 @@ static inline void show_fd_locks(struct seq_file *f, | |||
1202 | struct file *filp, struct files_struct *files) {} | 1203 | struct file *filp, struct files_struct *files) {} |
1203 | #endif /* !CONFIG_FILE_LOCKING */ | 1204 | #endif /* !CONFIG_FILE_LOCKING */ |
1204 | 1205 | ||
1206 | static inline struct inode *file_inode(const struct file *f) | ||
1207 | { | ||
1208 | return f->f_inode; | ||
1209 | } | ||
1210 | |||
1211 | static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl) | ||
1212 | { | ||
1213 | return posix_lock_inode_wait(file_inode(filp), fl); | ||
1214 | } | ||
1215 | |||
1216 | static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl) | ||
1217 | { | ||
1218 | return flock_lock_inode_wait(file_inode(filp), fl); | ||
1219 | } | ||
1205 | 1220 | ||
1206 | struct fasync_struct { | 1221 | struct fasync_struct { |
1207 | spinlock_t fa_lock; | 1222 | spinlock_t fa_lock; |
@@ -2011,11 +2026,6 @@ extern void ihold(struct inode * inode); | |||
2011 | extern void iput(struct inode *); | 2026 | extern void iput(struct inode *); |
2012 | extern int generic_update_time(struct inode *, struct timespec *, int); | 2027 | extern int generic_update_time(struct inode *, struct timespec *, int); |
2013 | 2028 | ||
2014 | static inline struct inode *file_inode(const struct file *f) | ||
2015 | { | ||
2016 | return f->f_inode; | ||
2017 | } | ||
2018 | |||
2019 | /* /sys/fs */ | 2029 | /* /sys/fs */ |
2020 | extern struct kobject *fs_kobj; | 2030 | extern struct kobject *fs_kobj; |
2021 | 2031 | ||
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 1da602982cf9..6cd8c0ee4b6f 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -116,6 +116,7 @@ ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops); | |||
116 | * SAVE_REGS. If another ops with this flag set is already registered | 116 | * SAVE_REGS. If another ops with this flag set is already registered |
117 | * for any of the functions that this ops will be registered for, then | 117 | * for any of the functions that this ops will be registered for, then |
118 | * this ops will fail to register or set_filter_ip. | 118 | * this ops will fail to register or set_filter_ip. |
119 | * PID - Is affected by set_ftrace_pid (allows filtering on those pids) | ||
119 | */ | 120 | */ |
120 | enum { | 121 | enum { |
121 | FTRACE_OPS_FL_ENABLED = 1 << 0, | 122 | FTRACE_OPS_FL_ENABLED = 1 << 0, |
@@ -132,6 +133,7 @@ enum { | |||
132 | FTRACE_OPS_FL_MODIFYING = 1 << 11, | 133 | FTRACE_OPS_FL_MODIFYING = 1 << 11, |
133 | FTRACE_OPS_FL_ALLOC_TRAMP = 1 << 12, | 134 | FTRACE_OPS_FL_ALLOC_TRAMP = 1 << 12, |
134 | FTRACE_OPS_FL_IPMODIFY = 1 << 13, | 135 | FTRACE_OPS_FL_IPMODIFY = 1 << 13, |
136 | FTRACE_OPS_FL_PID = 1 << 14, | ||
135 | }; | 137 | }; |
136 | 138 | ||
137 | #ifdef CONFIG_DYNAMIC_FTRACE | 139 | #ifdef CONFIG_DYNAMIC_FTRACE |
@@ -159,6 +161,7 @@ struct ftrace_ops { | |||
159 | struct ftrace_ops *next; | 161 | struct ftrace_ops *next; |
160 | unsigned long flags; | 162 | unsigned long flags; |
161 | void *private; | 163 | void *private; |
164 | ftrace_func_t saved_func; | ||
162 | int __percpu *disabled; | 165 | int __percpu *disabled; |
163 | #ifdef CONFIG_DYNAMIC_FTRACE | 166 | #ifdef CONFIG_DYNAMIC_FTRACE |
164 | int nr_trampolines; | 167 | int nr_trampolines; |
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index cc7ec129b329..c8393cd4d44f 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h | |||
@@ -45,7 +45,7 @@ struct seq_file; | |||
45 | * @base: identifies the first GPIO number handled by this chip; | 45 | * @base: identifies the first GPIO number handled by this chip; |
46 | * or, if negative during registration, requests dynamic ID allocation. | 46 | * or, if negative during registration, requests dynamic ID allocation. |
47 | * DEPRECATION: providing anything non-negative and nailing the base | 47 | * DEPRECATION: providing anything non-negative and nailing the base |
48 | * base offset of GPIO chips is deprecated. Please pass -1 as base to | 48 | * offset of GPIO chips is deprecated. Please pass -1 as base to |
49 | * let gpiolib select the chip base in all possible cases. We want to | 49 | * let gpiolib select the chip base in all possible cases. We want to |
50 | * get rid of the static GPIO number space in the long run. | 50 | * get rid of the static GPIO number space in the long run. |
51 | * @ngpio: the number of GPIOs handled by this controller; the last GPIO | 51 | * @ngpio: the number of GPIOs handled by this controller; the last GPIO |
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h index 0042bf330b99..c02b5ce6c5cd 100644 --- a/include/linux/hid-sensor-hub.h +++ b/include/linux/hid-sensor-hub.h | |||
@@ -230,6 +230,7 @@ struct hid_sensor_common { | |||
230 | struct platform_device *pdev; | 230 | struct platform_device *pdev; |
231 | unsigned usage_id; | 231 | unsigned usage_id; |
232 | atomic_t data_ready; | 232 | atomic_t data_ready; |
233 | atomic_t user_requested_state; | ||
233 | struct iio_trigger *trigger; | 234 | struct iio_trigger *trigger; |
234 | struct hid_sensor_hub_attribute_info poll; | 235 | struct hid_sensor_hub_attribute_info poll; |
235 | struct hid_sensor_hub_attribute_info report_state; | 236 | struct hid_sensor_hub_attribute_info report_state; |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 205026175c42..d891f949466a 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -460,15 +460,14 @@ static inline spinlock_t *huge_pte_lockptr(struct hstate *h, | |||
460 | return &mm->page_table_lock; | 460 | return &mm->page_table_lock; |
461 | } | 461 | } |
462 | 462 | ||
463 | static inline bool hugepages_supported(void) | 463 | #ifndef hugepages_supported |
464 | { | 464 | /* |
465 | /* | 465 | * Some platform decide whether they support huge pages at boot |
466 | * Some platform decide whether they support huge pages at boot | 466 | * time. Some of them, such as powerpc, set HPAGE_SHIFT to 0 |
467 | * time. On these, such as powerpc, HPAGE_SHIFT is set to 0 when | 467 | * when there is no such support |
468 | * there is no such support | 468 | */ |
469 | */ | 469 | #define hugepages_supported() (HPAGE_SHIFT != 0) |
470 | return HPAGE_SHIFT != 0; | 470 | #endif |
471 | } | ||
472 | 471 | ||
473 | #else /* CONFIG_HUGETLB_PAGE */ | 472 | #else /* CONFIG_HUGETLB_PAGE */ |
474 | struct hstate {}; | 473 | struct hstate {}; |
diff --git a/include/linux/init.h b/include/linux/init.h index 7c68c36d3fd8..b449f378f995 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
@@ -282,68 +282,8 @@ void __init parse_early_param(void); | |||
282 | void __init parse_early_options(char *cmdline); | 282 | void __init parse_early_options(char *cmdline); |
283 | #endif /* __ASSEMBLY__ */ | 283 | #endif /* __ASSEMBLY__ */ |
284 | 284 | ||
285 | /** | ||
286 | * module_init() - driver initialization entry point | ||
287 | * @x: function to be run at kernel boot time or module insertion | ||
288 | * | ||
289 | * module_init() will either be called during do_initcalls() (if | ||
290 | * builtin) or at module insertion time (if a module). There can only | ||
291 | * be one per module. | ||
292 | */ | ||
293 | #define module_init(x) __initcall(x); | ||
294 | |||
295 | /** | ||
296 | * module_exit() - driver exit entry point | ||
297 | * @x: function to be run when driver is removed | ||
298 | * | ||
299 | * module_exit() will wrap the driver clean-up code | ||
300 | * with cleanup_module() when used with rmmod when | ||
301 | * the driver is a module. If the driver is statically | ||
302 | * compiled into the kernel, module_exit() has no effect. | ||
303 | * There can only be one per module. | ||
304 | */ | ||
305 | #define module_exit(x) __exitcall(x); | ||
306 | |||
307 | #else /* MODULE */ | 285 | #else /* MODULE */ |
308 | 286 | ||
309 | /* | ||
310 | * In most cases loadable modules do not need custom | ||
311 | * initcall levels. There are still some valid cases where | ||
312 | * a driver may be needed early if built in, and does not | ||
313 | * matter when built as a loadable module. Like bus | ||
314 | * snooping debug drivers. | ||
315 | */ | ||
316 | #define early_initcall(fn) module_init(fn) | ||
317 | #define core_initcall(fn) module_init(fn) | ||
318 | #define core_initcall_sync(fn) module_init(fn) | ||
319 | #define postcore_initcall(fn) module_init(fn) | ||
320 | #define postcore_initcall_sync(fn) module_init(fn) | ||
321 | #define arch_initcall(fn) module_init(fn) | ||
322 | #define subsys_initcall(fn) module_init(fn) | ||
323 | #define subsys_initcall_sync(fn) module_init(fn) | ||
324 | #define fs_initcall(fn) module_init(fn) | ||
325 | #define fs_initcall_sync(fn) module_init(fn) | ||
326 | #define rootfs_initcall(fn) module_init(fn) | ||
327 | #define device_initcall(fn) module_init(fn) | ||
328 | #define device_initcall_sync(fn) module_init(fn) | ||
329 | #define late_initcall(fn) module_init(fn) | ||
330 | #define late_initcall_sync(fn) module_init(fn) | ||
331 | |||
332 | #define console_initcall(fn) module_init(fn) | ||
333 | #define security_initcall(fn) module_init(fn) | ||
334 | |||
335 | /* Each module must use one module_init(). */ | ||
336 | #define module_init(initfn) \ | ||
337 | static inline initcall_t __inittest(void) \ | ||
338 | { return initfn; } \ | ||
339 | int init_module(void) __attribute__((alias(#initfn))); | ||
340 | |||
341 | /* This is only required if you want to be unloadable. */ | ||
342 | #define module_exit(exitfn) \ | ||
343 | static inline exitcall_t __exittest(void) \ | ||
344 | { return exitfn; } \ | ||
345 | void cleanup_module(void) __attribute__((alias(#exitfn))); | ||
346 | |||
347 | #define __setup_param(str, unique_id, fn) /* nothing */ | 287 | #define __setup_param(str, unique_id, fn) /* nothing */ |
348 | #define __setup(str, func) /* nothing */ | 288 | #define __setup(str, func) /* nothing */ |
349 | #endif | 289 | #endif |
@@ -351,24 +291,6 @@ void __init parse_early_options(char *cmdline); | |||
351 | /* Data marked not to be saved by software suspend */ | 291 | /* Data marked not to be saved by software suspend */ |
352 | #define __nosavedata __section(.data..nosave) | 292 | #define __nosavedata __section(.data..nosave) |
353 | 293 | ||
354 | /* This means "can be init if no module support, otherwise module load | ||
355 | may call it." */ | ||
356 | #ifdef CONFIG_MODULES | ||
357 | #define __init_or_module | ||
358 | #define __initdata_or_module | ||
359 | #define __initconst_or_module | ||
360 | #define __INIT_OR_MODULE .text | ||
361 | #define __INITDATA_OR_MODULE .data | ||
362 | #define __INITRODATA_OR_MODULE .section ".rodata","a",%progbits | ||
363 | #else | ||
364 | #define __init_or_module __init | ||
365 | #define __initdata_or_module __initdata | ||
366 | #define __initconst_or_module __initconst | ||
367 | #define __INIT_OR_MODULE __INIT | ||
368 | #define __INITDATA_OR_MODULE __INITDATA | ||
369 | #define __INITRODATA_OR_MODULE __INITRODATA | ||
370 | #endif /*CONFIG_MODULES*/ | ||
371 | |||
372 | #ifdef MODULE | 294 | #ifdef MODULE |
373 | #define __exit_p(x) x | 295 | #define __exit_p(x) x |
374 | #else | 296 | #else |
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index dc767f7c3704..f9c1b6d0f2e4 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
@@ -258,7 +258,7 @@ extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr, | |||
258 | void *data); | 258 | void *data); |
259 | struct device *iommu_device_create(struct device *parent, void *drvdata, | 259 | struct device *iommu_device_create(struct device *parent, void *drvdata, |
260 | const struct attribute_group **groups, | 260 | const struct attribute_group **groups, |
261 | const char *fmt, ...); | 261 | const char *fmt, ...) __printf(4, 5); |
262 | void iommu_device_destroy(struct device *dev); | 262 | void iommu_device_destroy(struct device *dev); |
263 | int iommu_device_link(struct device *dev, struct device *link); | 263 | int iommu_device_link(struct device *dev, struct device *link); |
264 | void iommu_device_unlink(struct device *dev, struct device *link); | 264 | void iommu_device_unlink(struct device *dev, struct device *link); |
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h index 624a668e61f1..fcea4e48e21f 100644 --- a/include/linux/irqdesc.h +++ b/include/linux/irqdesc.h | |||
@@ -87,7 +87,12 @@ struct irq_desc { | |||
87 | const char *name; | 87 | const char *name; |
88 | } ____cacheline_internodealigned_in_smp; | 88 | } ____cacheline_internodealigned_in_smp; |
89 | 89 | ||
90 | #ifndef CONFIG_SPARSE_IRQ | 90 | #ifdef CONFIG_SPARSE_IRQ |
91 | extern void irq_lock_sparse(void); | ||
92 | extern void irq_unlock_sparse(void); | ||
93 | #else | ||
94 | static inline void irq_lock_sparse(void) { } | ||
95 | static inline void irq_unlock_sparse(void) { } | ||
91 | extern struct irq_desc irq_desc[NR_IRQS]; | 96 | extern struct irq_desc irq_desc[NR_IRQS]; |
92 | #endif | 97 | #endif |
93 | 98 | ||
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 5f0be58640ea..5582410727cb 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -411,7 +411,8 @@ extern __printf(3, 0) | |||
411 | int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); | 411 | int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); |
412 | extern __printf(2, 3) | 412 | extern __printf(2, 3) |
413 | char *kasprintf(gfp_t gfp, const char *fmt, ...); | 413 | char *kasprintf(gfp_t gfp, const char *fmt, ...); |
414 | extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); | 414 | extern __printf(2, 0) |
415 | char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); | ||
415 | 416 | ||
416 | extern __scanf(2, 3) | 417 | extern __scanf(2, 3) |
417 | int sscanf(const char *, const char *, ...); | 418 | int sscanf(const char *, const char *, ...); |
@@ -679,10 +680,10 @@ do { \ | |||
679 | __ftrace_vprintk(_THIS_IP_, fmt, vargs); \ | 680 | __ftrace_vprintk(_THIS_IP_, fmt, vargs); \ |
680 | } while (0) | 681 | } while (0) |
681 | 682 | ||
682 | extern int | 683 | extern __printf(2, 0) int |
683 | __ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap); | 684 | __ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap); |
684 | 685 | ||
685 | extern int | 686 | extern __printf(2, 0) int |
686 | __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); | 687 | __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); |
687 | 688 | ||
688 | extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode); | 689 | extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode); |
@@ -702,7 +703,7 @@ int trace_printk(const char *fmt, ...) | |||
702 | { | 703 | { |
703 | return 0; | 704 | return 0; |
704 | } | 705 | } |
705 | static inline int | 706 | static __printf(1, 0) inline int |
706 | ftrace_vprintk(const char *fmt, va_list ap) | 707 | ftrace_vprintk(const char *fmt, va_list ap) |
707 | { | 708 | { |
708 | return 0; | 709 | return 0; |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 2d61b909f414..637f67002c5a 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -80,8 +80,9 @@ struct kobject { | |||
80 | 80 | ||
81 | extern __printf(2, 3) | 81 | extern __printf(2, 3) |
82 | int kobject_set_name(struct kobject *kobj, const char *name, ...); | 82 | int kobject_set_name(struct kobject *kobj, const char *name, ...); |
83 | extern int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, | 83 | extern __printf(2, 0) |
84 | va_list vargs); | 84 | int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, |
85 | va_list vargs); | ||
85 | 86 | ||
86 | static inline const char *kobject_name(const struct kobject *kobj) | 87 | static inline const char *kobject_name(const struct kobject *kobj) |
87 | { | 88 | { |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 9564fd78c547..05e99b8ef465 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -734,6 +734,24 @@ static inline bool kvm_arch_has_noncoherent_dma(struct kvm *kvm) | |||
734 | return false; | 734 | return false; |
735 | } | 735 | } |
736 | #endif | 736 | #endif |
737 | #ifdef __KVM_HAVE_ARCH_ASSIGNED_DEVICE | ||
738 | void kvm_arch_start_assignment(struct kvm *kvm); | ||
739 | void kvm_arch_end_assignment(struct kvm *kvm); | ||
740 | bool kvm_arch_has_assigned_device(struct kvm *kvm); | ||
741 | #else | ||
742 | static inline void kvm_arch_start_assignment(struct kvm *kvm) | ||
743 | { | ||
744 | } | ||
745 | |||
746 | static inline void kvm_arch_end_assignment(struct kvm *kvm) | ||
747 | { | ||
748 | } | ||
749 | |||
750 | static inline bool kvm_arch_has_assigned_device(struct kvm *kvm) | ||
751 | { | ||
752 | return false; | ||
753 | } | ||
754 | #endif | ||
737 | 755 | ||
738 | static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu) | 756 | static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu) |
739 | { | 757 | { |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 36ce37bcc963..c9cfbcdb8d14 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -431,6 +431,8 @@ enum { | |||
431 | ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21), /* some WDs have broken LPM */ | 431 | ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21), /* some WDs have broken LPM */ |
432 | ATA_HORKAGE_ZERO_AFTER_TRIM = (1 << 22),/* guarantees zero after trim */ | 432 | ATA_HORKAGE_ZERO_AFTER_TRIM = (1 << 22),/* guarantees zero after trim */ |
433 | ATA_HORKAGE_NO_NCQ_LOG = (1 << 23), /* don't use NCQ for log read */ | 433 | ATA_HORKAGE_NO_NCQ_LOG = (1 << 23), /* don't use NCQ for log read */ |
434 | ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ | ||
435 | ATA_HORKAGE_MAX_SEC_1024 = (1 << 25), /* Limit max sects to 1024 */ | ||
434 | 436 | ||
435 | /* DMA mask for user DMA control: User visible values; DO NOT | 437 | /* DMA mask for user DMA control: User visible values; DO NOT |
436 | renumber */ | 438 | renumber */ |
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h index c5d52780d6a0..3ba327af055c 100644 --- a/include/linux/mmiotrace.h +++ b/include/linux/mmiotrace.h | |||
@@ -106,6 +106,6 @@ extern void enable_mmiotrace(void); | |||
106 | extern void disable_mmiotrace(void); | 106 | extern void disable_mmiotrace(void); |
107 | extern void mmio_trace_rw(struct mmiotrace_rw *rw); | 107 | extern void mmio_trace_rw(struct mmiotrace_rw *rw); |
108 | extern void mmio_trace_mapping(struct mmiotrace_map *map); | 108 | extern void mmio_trace_mapping(struct mmiotrace_map *map); |
109 | extern int mmio_trace_printk(const char *fmt, va_list args); | 109 | extern __printf(1, 0) int mmio_trace_printk(const char *fmt, va_list args); |
110 | 110 | ||
111 | #endif /* _LINUX_MMIOTRACE_H */ | 111 | #endif /* _LINUX_MMIOTRACE_H */ |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 8183d6640ca7..34f25b7bf642 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -189,6 +189,8 @@ struct css_device_id { | |||
189 | struct acpi_device_id { | 189 | struct acpi_device_id { |
190 | __u8 id[ACPI_ID_LEN]; | 190 | __u8 id[ACPI_ID_LEN]; |
191 | kernel_ulong_t driver_data; | 191 | kernel_ulong_t driver_data; |
192 | __u32 cls; | ||
193 | __u32 cls_msk; | ||
192 | }; | 194 | }; |
193 | 195 | ||
194 | #define PNP_ID_LEN 8 | 196 | #define PNP_ID_LEN 8 |
diff --git a/include/linux/module.h b/include/linux/module.h index d67b1932cc59..3a19c79918e0 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/compiler.h> | 11 | #include <linux/compiler.h> |
12 | #include <linux/cache.h> | 12 | #include <linux/cache.h> |
13 | #include <linux/kmod.h> | 13 | #include <linux/kmod.h> |
14 | #include <linux/init.h> | ||
14 | #include <linux/elf.h> | 15 | #include <linux/elf.h> |
15 | #include <linux/stringify.h> | 16 | #include <linux/stringify.h> |
16 | #include <linux/kobject.h> | 17 | #include <linux/kobject.h> |
@@ -71,6 +72,89 @@ extern struct module_attribute module_uevent; | |||
71 | extern int init_module(void); | 72 | extern int init_module(void); |
72 | extern void cleanup_module(void); | 73 | extern void cleanup_module(void); |
73 | 74 | ||
75 | #ifndef MODULE | ||
76 | /** | ||
77 | * module_init() - driver initialization entry point | ||
78 | * @x: function to be run at kernel boot time or module insertion | ||
79 | * | ||
80 | * module_init() will either be called during do_initcalls() (if | ||
81 | * builtin) or at module insertion time (if a module). There can only | ||
82 | * be one per module. | ||
83 | */ | ||
84 | #define module_init(x) __initcall(x); | ||
85 | |||
86 | /** | ||
87 | * module_exit() - driver exit entry point | ||
88 | * @x: function to be run when driver is removed | ||
89 | * | ||
90 | * module_exit() will wrap the driver clean-up code | ||
91 | * with cleanup_module() when used with rmmod when | ||
92 | * the driver is a module. If the driver is statically | ||
93 | * compiled into the kernel, module_exit() has no effect. | ||
94 | * There can only be one per module. | ||
95 | */ | ||
96 | #define module_exit(x) __exitcall(x); | ||
97 | |||
98 | #else /* MODULE */ | ||
99 | |||
100 | /* | ||
101 | * In most cases loadable modules do not need custom | ||
102 | * initcall levels. There are still some valid cases where | ||
103 | * a driver may be needed early if built in, and does not | ||
104 | * matter when built as a loadable module. Like bus | ||
105 | * snooping debug drivers. | ||
106 | */ | ||
107 | #define early_initcall(fn) module_init(fn) | ||
108 | #define core_initcall(fn) module_init(fn) | ||
109 | #define core_initcall_sync(fn) module_init(fn) | ||
110 | #define postcore_initcall(fn) module_init(fn) | ||
111 | #define postcore_initcall_sync(fn) module_init(fn) | ||
112 | #define arch_initcall(fn) module_init(fn) | ||
113 | #define subsys_initcall(fn) module_init(fn) | ||
114 | #define subsys_initcall_sync(fn) module_init(fn) | ||
115 | #define fs_initcall(fn) module_init(fn) | ||
116 | #define fs_initcall_sync(fn) module_init(fn) | ||
117 | #define rootfs_initcall(fn) module_init(fn) | ||
118 | #define device_initcall(fn) module_init(fn) | ||
119 | #define device_initcall_sync(fn) module_init(fn) | ||
120 | #define late_initcall(fn) module_init(fn) | ||
121 | #define late_initcall_sync(fn) module_init(fn) | ||
122 | |||
123 | #define console_initcall(fn) module_init(fn) | ||
124 | #define security_initcall(fn) module_init(fn) | ||
125 | |||
126 | /* Each module must use one module_init(). */ | ||
127 | #define module_init(initfn) \ | ||
128 | static inline initcall_t __inittest(void) \ | ||
129 | { return initfn; } \ | ||
130 | int init_module(void) __attribute__((alias(#initfn))); | ||
131 | |||
132 | /* This is only required if you want to be unloadable. */ | ||
133 | #define module_exit(exitfn) \ | ||
134 | static inline exitcall_t __exittest(void) \ | ||
135 | { return exitfn; } \ | ||
136 | void cleanup_module(void) __attribute__((alias(#exitfn))); | ||
137 | |||
138 | #endif | ||
139 | |||
140 | /* This means "can be init if no module support, otherwise module load | ||
141 | may call it." */ | ||
142 | #ifdef CONFIG_MODULES | ||
143 | #define __init_or_module | ||
144 | #define __initdata_or_module | ||
145 | #define __initconst_or_module | ||
146 | #define __INIT_OR_MODULE .text | ||
147 | #define __INITDATA_OR_MODULE .data | ||
148 | #define __INITRODATA_OR_MODULE .section ".rodata","a",%progbits | ||
149 | #else | ||
150 | #define __init_or_module __init | ||
151 | #define __initdata_or_module __initdata | ||
152 | #define __initconst_or_module __initconst | ||
153 | #define __INIT_OR_MODULE __INIT | ||
154 | #define __INITDATA_OR_MODULE __INITDATA | ||
155 | #define __INITRODATA_OR_MODULE __INITRODATA | ||
156 | #endif /*CONFIG_MODULES*/ | ||
157 | |||
74 | /* Archs provide a method of finding the correct exception table. */ | 158 | /* Archs provide a method of finding the correct exception table. */ |
75 | struct exception_table_entry; | 159 | struct exception_table_entry; |
76 | 160 | ||
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index f25e2bdd188c..272f42952f34 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -178,17 +178,17 @@ typedef enum { | |||
178 | /* Chip may not exist, so silence any errors in scan */ | 178 | /* Chip may not exist, so silence any errors in scan */ |
179 | #define NAND_SCAN_SILENT_NODEV 0x00040000 | 179 | #define NAND_SCAN_SILENT_NODEV 0x00040000 |
180 | /* | 180 | /* |
181 | * This option could be defined by controller drivers to protect against | ||
182 | * kmap'ed, vmalloc'ed highmem buffers being passed from upper layers | ||
183 | */ | ||
184 | #define NAND_USE_BOUNCE_BUFFER 0x00080000 | ||
185 | /* | ||
186 | * Autodetect nand buswidth with readid/onfi. | 181 | * Autodetect nand buswidth with readid/onfi. |
187 | * This suppose the driver will configure the hardware in 8 bits mode | 182 | * This suppose the driver will configure the hardware in 8 bits mode |
188 | * when calling nand_scan_ident, and update its configuration | 183 | * when calling nand_scan_ident, and update its configuration |
189 | * before calling nand_scan_tail. | 184 | * before calling nand_scan_tail. |
190 | */ | 185 | */ |
191 | #define NAND_BUSWIDTH_AUTO 0x00080000 | 186 | #define NAND_BUSWIDTH_AUTO 0x00080000 |
187 | /* | ||
188 | * This option could be defined by controller drivers to protect against | ||
189 | * kmap'ed, vmalloc'ed highmem buffers being passed from upper layers | ||
190 | */ | ||
191 | #define NAND_USE_BOUNCE_BUFFER 0x00100000 | ||
192 | 192 | ||
193 | /* Options set by nand scan */ | 193 | /* Options set by nand scan */ |
194 | /* Nand scan has allocated controller struct */ | 194 | /* Nand scan has allocated controller struct */ |
diff --git a/include/linux/page_owner.h b/include/linux/page_owner.h index b48c3471c254..cacaabea8a09 100644 --- a/include/linux/page_owner.h +++ b/include/linux/page_owner.h | |||
@@ -8,6 +8,7 @@ extern struct page_ext_operations page_owner_ops; | |||
8 | extern void __reset_page_owner(struct page *page, unsigned int order); | 8 | extern void __reset_page_owner(struct page *page, unsigned int order); |
9 | extern void __set_page_owner(struct page *page, | 9 | extern void __set_page_owner(struct page *page, |
10 | unsigned int order, gfp_t gfp_mask); | 10 | unsigned int order, gfp_t gfp_mask); |
11 | extern gfp_t __get_page_owner_gfp(struct page *page); | ||
11 | 12 | ||
12 | static inline void reset_page_owner(struct page *page, unsigned int order) | 13 | static inline void reset_page_owner(struct page *page, unsigned int order) |
13 | { | 14 | { |
@@ -25,6 +26,14 @@ static inline void set_page_owner(struct page *page, | |||
25 | 26 | ||
26 | __set_page_owner(page, order, gfp_mask); | 27 | __set_page_owner(page, order, gfp_mask); |
27 | } | 28 | } |
29 | |||
30 | static inline gfp_t get_page_owner_gfp(struct page *page) | ||
31 | { | ||
32 | if (likely(!page_owner_inited)) | ||
33 | return 0; | ||
34 | |||
35 | return __get_page_owner_gfp(page); | ||
36 | } | ||
28 | #else | 37 | #else |
29 | static inline void reset_page_owner(struct page *page, unsigned int order) | 38 | static inline void reset_page_owner(struct page *page, unsigned int order) |
30 | { | 39 | { |
@@ -33,6 +42,10 @@ static inline void set_page_owner(struct page *page, | |||
33 | unsigned int order, gfp_t gfp_mask) | 42 | unsigned int order, gfp_t gfp_mask) |
34 | { | 43 | { |
35 | } | 44 | } |
45 | static inline gfp_t get_page_owner_gfp(struct page *page) | ||
46 | { | ||
47 | return 0; | ||
48 | } | ||
36 | 49 | ||
37 | #endif /* CONFIG_PAGE_OWNER */ | 50 | #endif /* CONFIG_PAGE_OWNER */ |
38 | #endif /* __LINUX_PAGE_OWNER_H */ | 51 | #endif /* __LINUX_PAGE_OWNER_H */ |
diff --git a/include/linux/pata_arasan_cf_data.h b/include/linux/pata_arasan_cf_data.h index 3cc21c9cc1e8..9fade5dd2e86 100644 --- a/include/linux/pata_arasan_cf_data.h +++ b/include/linux/pata_arasan_cf_data.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * Arasan Compact Flash host controller platform data header file | 4 | * Arasan Compact Flash host controller platform data header file |
5 | * | 5 | * |
6 | * Copyright (C) 2011 ST Microelectronics | 6 | * Copyright (C) 2011 ST Microelectronics |
7 | * Viresh Kumar <viresh.linux@gmail.com> | 7 | * Viresh Kumar <vireshk@kernel.org> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h index 75f70f6ac137..e1571efa3f2b 100644 --- a/include/linux/platform_data/mmc-esdhc-imx.h +++ b/include/linux/platform_data/mmc-esdhc-imx.h | |||
@@ -43,7 +43,6 @@ struct esdhc_platform_data { | |||
43 | enum wp_types wp_type; | 43 | enum wp_types wp_type; |
44 | enum cd_types cd_type; | 44 | enum cd_types cd_type; |
45 | int max_bus_width; | 45 | int max_bus_width; |
46 | unsigned int f_max; | ||
47 | bool support_vsel; | 46 | bool support_vsel; |
48 | unsigned int delay_line; | 47 | unsigned int delay_line; |
49 | }; | 48 | }; |
diff --git a/include/linux/printk.h b/include/linux/printk.h index 58b1fec40d37..a6298b27ac99 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h | |||
@@ -122,7 +122,7 @@ static inline __printf(1, 2) __cold | |||
122 | void early_printk(const char *s, ...) { } | 122 | void early_printk(const char *s, ...) { } |
123 | #endif | 123 | #endif |
124 | 124 | ||
125 | typedef int(*printk_func_t)(const char *fmt, va_list args); | 125 | typedef __printf(1, 0) int (*printk_func_t)(const char *fmt, va_list args); |
126 | 126 | ||
127 | #ifdef CONFIG_PRINTK | 127 | #ifdef CONFIG_PRINTK |
128 | asmlinkage __printf(5, 0) | 128 | asmlinkage __printf(5, 0) |
@@ -166,7 +166,7 @@ char *log_buf_addr_get(void); | |||
166 | u32 log_buf_len_get(void); | 166 | u32 log_buf_len_get(void); |
167 | void log_buf_kexec_setup(void); | 167 | void log_buf_kexec_setup(void); |
168 | void __init setup_log_buf(int early); | 168 | void __init setup_log_buf(int early); |
169 | void dump_stack_set_arch_desc(const char *fmt, ...); | 169 | __printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...); |
170 | void dump_stack_print_info(const char *log_lvl); | 170 | void dump_stack_print_info(const char *log_lvl); |
171 | void show_regs_print_info(const char *log_lvl); | 171 | void show_regs_print_info(const char *log_lvl); |
172 | #else | 172 | #else |
@@ -217,7 +217,7 @@ static inline void setup_log_buf(int early) | |||
217 | { | 217 | { |
218 | } | 218 | } |
219 | 219 | ||
220 | static inline void dump_stack_set_arch_desc(const char *fmt, ...) | 220 | static inline __printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...) |
221 | { | 221 | { |
222 | } | 222 | } |
223 | 223 | ||
diff --git a/include/linux/rtc/sirfsoc_rtciobrg.h b/include/linux/rtc/sirfsoc_rtciobrg.h index 2c92e1c8e055..aefd997262e4 100644 --- a/include/linux/rtc/sirfsoc_rtciobrg.h +++ b/include/linux/rtc/sirfsoc_rtciobrg.h | |||
@@ -9,10 +9,14 @@ | |||
9 | #ifndef _SIRFSOC_RTC_IOBRG_H_ | 9 | #ifndef _SIRFSOC_RTC_IOBRG_H_ |
10 | #define _SIRFSOC_RTC_IOBRG_H_ | 10 | #define _SIRFSOC_RTC_IOBRG_H_ |
11 | 11 | ||
12 | struct regmap_config; | ||
13 | |||
12 | extern void sirfsoc_rtc_iobrg_besyncing(void); | 14 | extern void sirfsoc_rtc_iobrg_besyncing(void); |
13 | 15 | ||
14 | extern u32 sirfsoc_rtc_iobrg_readl(u32 addr); | 16 | extern u32 sirfsoc_rtc_iobrg_readl(u32 addr); |
15 | 17 | ||
16 | extern void sirfsoc_rtc_iobrg_writel(u32 val, u32 addr); | 18 | extern void sirfsoc_rtc_iobrg_writel(u32 val, u32 addr); |
19 | struct regmap *devm_regmap_init_iobg(struct device *dev, | ||
20 | const struct regmap_config *config); | ||
17 | 21 | ||
18 | #endif | 22 | #endif |
diff --git a/include/linux/sched.h b/include/linux/sched.h index ae21f1591615..04b5ada460b4 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1522,8 +1522,6 @@ struct task_struct { | |||
1522 | /* hung task detection */ | 1522 | /* hung task detection */ |
1523 | unsigned long last_switch_count; | 1523 | unsigned long last_switch_count; |
1524 | #endif | 1524 | #endif |
1525 | /* CPU-specific state of this task */ | ||
1526 | struct thread_struct thread; | ||
1527 | /* filesystem information */ | 1525 | /* filesystem information */ |
1528 | struct fs_struct *fs; | 1526 | struct fs_struct *fs; |
1529 | /* open file information */ | 1527 | /* open file information */ |
@@ -1778,8 +1776,22 @@ struct task_struct { | |||
1778 | unsigned long task_state_change; | 1776 | unsigned long task_state_change; |
1779 | #endif | 1777 | #endif |
1780 | int pagefault_disabled; | 1778 | int pagefault_disabled; |
1779 | /* CPU-specific state of this task */ | ||
1780 | struct thread_struct thread; | ||
1781 | /* | ||
1782 | * WARNING: on x86, 'thread_struct' contains a variable-sized | ||
1783 | * structure. It *MUST* be at the end of 'task_struct'. | ||
1784 | * | ||
1785 | * Do not put anything below here! | ||
1786 | */ | ||
1781 | }; | 1787 | }; |
1782 | 1788 | ||
1789 | #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT | ||
1790 | extern int arch_task_struct_size __read_mostly; | ||
1791 | #else | ||
1792 | # define arch_task_struct_size (sizeof(struct task_struct)) | ||
1793 | #endif | ||
1794 | |||
1783 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ | 1795 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ |
1784 | #define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed) | 1796 | #define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed) |
1785 | 1797 | ||
diff --git a/include/linux/tick.h b/include/linux/tick.h index 3741ba1a652c..edbfc9a5293e 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h | |||
@@ -67,10 +67,13 @@ extern void tick_broadcast_control(enum tick_broadcast_mode mode); | |||
67 | static inline void tick_broadcast_control(enum tick_broadcast_mode mode) { } | 67 | static inline void tick_broadcast_control(enum tick_broadcast_mode mode) { } |
68 | #endif /* BROADCAST */ | 68 | #endif /* BROADCAST */ |
69 | 69 | ||
70 | #if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) | 70 | #ifdef CONFIG_GENERIC_CLOCKEVENTS |
71 | extern int tick_broadcast_oneshot_control(enum tick_broadcast_state state); | 71 | extern int tick_broadcast_oneshot_control(enum tick_broadcast_state state); |
72 | #else | 72 | #else |
73 | static inline int tick_broadcast_oneshot_control(enum tick_broadcast_state state) { return 0; } | 73 | static inline int tick_broadcast_oneshot_control(enum tick_broadcast_state state) |
74 | { | ||
75 | return 0; | ||
76 | } | ||
74 | #endif | 77 | #endif |
75 | 78 | ||
76 | static inline void tick_broadcast_enable(void) | 79 | static inline void tick_broadcast_enable(void) |
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 3aa72e648650..6e191e4e6ab6 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h | |||
@@ -145,7 +145,6 @@ static inline void getboottime(struct timespec *ts) | |||
145 | } | 145 | } |
146 | #endif | 146 | #endif |
147 | 147 | ||
148 | #define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) | ||
149 | #define ktime_get_real_ts64(ts) getnstimeofday64(ts) | 148 | #define ktime_get_real_ts64(ts) getnstimeofday64(ts) |
150 | 149 | ||
151 | /* | 150 | /* |
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h index 7c9b484735c5..1f6526c76ee8 100644 --- a/include/linux/usb/cdc_ncm.h +++ b/include/linux/usb/cdc_ncm.h | |||
@@ -80,6 +80,9 @@ | |||
80 | #define CDC_NCM_TIMER_INTERVAL_MIN 5UL | 80 | #define CDC_NCM_TIMER_INTERVAL_MIN 5UL |
81 | #define CDC_NCM_TIMER_INTERVAL_MAX (U32_MAX / NSEC_PER_USEC) | 81 | #define CDC_NCM_TIMER_INTERVAL_MAX (U32_MAX / NSEC_PER_USEC) |
82 | 82 | ||
83 | /* Driver flags */ | ||
84 | #define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */ | ||
85 | |||
83 | #define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \ | 86 | #define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \ |
84 | (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE) | 87 | (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE) |
85 | #define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB) | 88 | #define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB) |
@@ -103,9 +106,11 @@ struct cdc_ncm_ctx { | |||
103 | 106 | ||
104 | spinlock_t mtx; | 107 | spinlock_t mtx; |
105 | atomic_t stop; | 108 | atomic_t stop; |
109 | int drvflags; | ||
106 | 110 | ||
107 | u32 timer_interval; | 111 | u32 timer_interval; |
108 | u32 max_ndp_size; | 112 | u32 max_ndp_size; |
113 | struct usb_cdc_ncm_ndp16 *delayed_ndp16; | ||
109 | 114 | ||
110 | u32 tx_timer_pending; | 115 | u32 tx_timer_pending; |
111 | u32 tx_curr_frame_num; | 116 | u32 tx_curr_frame_num; |
@@ -133,7 +138,7 @@ struct cdc_ncm_ctx { | |||
133 | }; | 138 | }; |
134 | 139 | ||
135 | u8 cdc_ncm_select_altsetting(struct usb_interface *intf); | 140 | u8 cdc_ncm_select_altsetting(struct usb_interface *intf); |
136 | int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting); | 141 | int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags); |
137 | void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); | 142 | void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); |
138 | struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign); | 143 | struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign); |
139 | int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in); | 144 | int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in); |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index a741678f24a2..883fe1e7c5a1 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -4868,6 +4868,23 @@ bool cfg80211_reg_can_beacon(struct wiphy *wiphy, | |||
4868 | struct cfg80211_chan_def *chandef, | 4868 | struct cfg80211_chan_def *chandef, |
4869 | enum nl80211_iftype iftype); | 4869 | enum nl80211_iftype iftype); |
4870 | 4870 | ||
4871 | /** | ||
4872 | * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation | ||
4873 | * @wiphy: the wiphy | ||
4874 | * @chandef: the channel definition | ||
4875 | * @iftype: interface type | ||
4876 | * | ||
4877 | * Return: %true if there is no secondary channel or the secondary channel(s) | ||
4878 | * can be used for beaconing (i.e. is not a radar channel etc.). This version | ||
4879 | * also checks if IR-relaxation conditions apply, to allow beaconing under | ||
4880 | * more permissive conditions. | ||
4881 | * | ||
4882 | * Requires the RTNL to be held. | ||
4883 | */ | ||
4884 | bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy, | ||
4885 | struct cfg80211_chan_def *chandef, | ||
4886 | enum nl80211_iftype iftype); | ||
4887 | |||
4871 | /* | 4888 | /* |
4872 | * cfg80211_ch_switch_notify - update wdev channel and notify userspace | 4889 | * cfg80211_ch_switch_notify - update wdev channel and notify userspace |
4873 | * @dev: the device which switched channels | 4890 | * @dev: the device which switched channels |
diff --git a/include/net/ip.h b/include/net/ip.h index 0750a186ea63..d5fe9f2ab699 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -161,6 +161,7 @@ static inline __u8 get_rtconn_flags(struct ipcm_cookie* ipc, struct sock* sk) | |||
161 | } | 161 | } |
162 | 162 | ||
163 | /* datagram.c */ | 163 | /* datagram.c */ |
164 | int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len); | ||
164 | int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len); | 165 | int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len); |
165 | 166 | ||
166 | void ip4_datagram_release_cb(struct sock *sk); | 167 | void ip4_datagram_release_cb(struct sock *sk); |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 986fddb08579..b0f898e3b2e7 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -1745,6 +1745,7 @@ struct ib_device { | |||
1745 | char node_desc[64]; | 1745 | char node_desc[64]; |
1746 | __be64 node_guid; | 1746 | __be64 node_guid; |
1747 | u32 local_dma_lkey; | 1747 | u32 local_dma_lkey; |
1748 | u16 is_switch:1; | ||
1748 | u8 node_type; | 1749 | u8 node_type; |
1749 | u8 phys_port_cnt; | 1750 | u8 phys_port_cnt; |
1750 | 1751 | ||
@@ -1824,6 +1825,20 @@ enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, | |||
1824 | u8 port_num); | 1825 | u8 port_num); |
1825 | 1826 | ||
1826 | /** | 1827 | /** |
1828 | * rdma_cap_ib_switch - Check if the device is IB switch | ||
1829 | * @device: Device to check | ||
1830 | * | ||
1831 | * Device driver is responsible for setting is_switch bit on | ||
1832 | * in ib_device structure at init time. | ||
1833 | * | ||
1834 | * Return: true if the device is IB switch. | ||
1835 | */ | ||
1836 | static inline bool rdma_cap_ib_switch(const struct ib_device *device) | ||
1837 | { | ||
1838 | return device->is_switch; | ||
1839 | } | ||
1840 | |||
1841 | /** | ||
1827 | * rdma_start_port - Return the first valid port number for the device | 1842 | * rdma_start_port - Return the first valid port number for the device |
1828 | * specified | 1843 | * specified |
1829 | * | 1844 | * |
@@ -1833,7 +1848,7 @@ enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, | |||
1833 | */ | 1848 | */ |
1834 | static inline u8 rdma_start_port(const struct ib_device *device) | 1849 | static inline u8 rdma_start_port(const struct ib_device *device) |
1835 | { | 1850 | { |
1836 | return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1; | 1851 | return rdma_cap_ib_switch(device) ? 0 : 1; |
1837 | } | 1852 | } |
1838 | 1853 | ||
1839 | /** | 1854 | /** |
@@ -1846,8 +1861,7 @@ static inline u8 rdma_start_port(const struct ib_device *device) | |||
1846 | */ | 1861 | */ |
1847 | static inline u8 rdma_end_port(const struct ib_device *device) | 1862 | static inline u8 rdma_end_port(const struct ib_device *device) |
1848 | { | 1863 | { |
1849 | return (device->node_type == RDMA_NODE_IB_SWITCH) ? | 1864 | return rdma_cap_ib_switch(device) ? 0 : device->phys_port_cnt; |
1850 | 0 : device->phys_port_cnt; | ||
1851 | } | 1865 | } |
1852 | 1866 | ||
1853 | static inline bool rdma_protocol_ib(const struct ib_device *device, u8 port_num) | 1867 | static inline bool rdma_protocol_ib(const struct ib_device *device, u8 port_num) |
diff --git a/include/scsi/scsi_transport_srp.h b/include/scsi/scsi_transport_srp.h index cdb05dd1d440..d40d3ef25707 100644 --- a/include/scsi/scsi_transport_srp.h +++ b/include/scsi/scsi_transport_srp.h | |||
@@ -119,6 +119,7 @@ extern struct srp_rport *srp_rport_add(struct Scsi_Host *, | |||
119 | extern void srp_rport_del(struct srp_rport *); | 119 | extern void srp_rport_del(struct srp_rport *); |
120 | extern int srp_tmo_valid(int reconnect_delay, int fast_io_fail_tmo, | 120 | extern int srp_tmo_valid(int reconnect_delay, int fast_io_fail_tmo, |
121 | int dev_loss_tmo); | 121 | int dev_loss_tmo); |
122 | int srp_parse_tmo(int *tmo, const char *buf); | ||
122 | extern int srp_reconnect_rport(struct srp_rport *rport); | 123 | extern int srp_reconnect_rport(struct srp_rport *rport); |
123 | extern void srp_start_tl_fail_timers(struct srp_rport *rport); | 124 | extern void srp_start_tl_fail_timers(struct srp_rport *rport); |
124 | extern void srp_remove_host(struct Scsi_Host *); | 125 | extern void srp_remove_host(struct Scsi_Host *); |
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index b6fce900a833..d708a53b8fb1 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h | |||
@@ -614,6 +614,8 @@ struct drm_amdgpu_info_device { | |||
614 | uint32_t vram_type; | 614 | uint32_t vram_type; |
615 | /** video memory bit width*/ | 615 | /** video memory bit width*/ |
616 | uint32_t vram_bit_width; | 616 | uint32_t vram_bit_width; |
617 | /* vce harvesting instance */ | ||
618 | uint32_t vce_harvest_config; | ||
617 | }; | 619 | }; |
618 | 620 | ||
619 | struct drm_amdgpu_info_hw_ip { | 621 | struct drm_amdgpu_info_hw_ip { |
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index 6e1a2ed116cb..db809b722985 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h | |||
@@ -1070,6 +1070,14 @@ struct drm_i915_reg_read { | |||
1070 | __u64 offset; | 1070 | __u64 offset; |
1071 | __u64 val; /* Return value */ | 1071 | __u64 val; /* Return value */ |
1072 | }; | 1072 | }; |
1073 | /* Known registers: | ||
1074 | * | ||
1075 | * Render engine timestamp - 0x2358 + 64bit - gen7+ | ||
1076 | * - Note this register returns an invalid value if using the default | ||
1077 | * single instruction 8byte read, in order to workaround that use | ||
1078 | * offset (0x2538 | 1) instead. | ||
1079 | * | ||
1080 | */ | ||
1073 | 1081 | ||
1074 | struct drm_i915_reset_stats { | 1082 | struct drm_i915_reset_stats { |
1075 | __u32 ctx_id; | 1083 | __u32 ctx_id; |
diff --git a/include/uapi/linux/netconf.h b/include/uapi/linux/netconf.h index 669a1f0b1d97..23cbd34e4ac7 100644 --- a/include/uapi/linux/netconf.h +++ b/include/uapi/linux/netconf.h | |||
@@ -15,6 +15,7 @@ enum { | |||
15 | NETCONFA_RP_FILTER, | 15 | NETCONFA_RP_FILTER, |
16 | NETCONFA_MC_FORWARDING, | 16 | NETCONFA_MC_FORWARDING, |
17 | NETCONFA_PROXY_NEIGH, | 17 | NETCONFA_PROXY_NEIGH, |
18 | NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN, | ||
18 | __NETCONFA_MAX | 19 | __NETCONFA_MAX |
19 | }; | 20 | }; |
20 | #define NETCONFA_MAX (__NETCONFA_MAX - 1) | 21 | #define NETCONFA_MAX (__NETCONFA_MAX - 1) |
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h index 7bbee79ca293..ec32293a00db 100644 --- a/include/uapi/linux/virtio_net.h +++ b/include/uapi/linux/virtio_net.h | |||
@@ -34,6 +34,7 @@ | |||
34 | /* The feature bitmap for virtio net */ | 34 | /* The feature bitmap for virtio net */ |
35 | #define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */ | 35 | #define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */ |
36 | #define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */ | 36 | #define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */ |
37 | #define VIRTIO_NET_F_CTRL_GUEST_OFFLOADS 2 /* Dynamic offload configuration. */ | ||
37 | #define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */ | 38 | #define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */ |
38 | #define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */ | 39 | #define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */ |
39 | #define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */ | 40 | #define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */ |
@@ -226,4 +227,19 @@ struct virtio_net_ctrl_mq { | |||
226 | #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1 | 227 | #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1 |
227 | #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000 | 228 | #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000 |
228 | 229 | ||
230 | /* | ||
231 | * Control network offloads | ||
232 | * | ||
233 | * Reconfigures the network offloads that Guest can handle. | ||
234 | * | ||
235 | * Available with the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature bit. | ||
236 | * | ||
237 | * Command data format matches the feature bit mask exactly. | ||
238 | * | ||
239 | * See VIRTIO_NET_F_GUEST_* for the list of offloads | ||
240 | * that can be enabled/disabled. | ||
241 | */ | ||
242 | #define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5 | ||
243 | #define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0 | ||
244 | |||
229 | #endif /* _LINUX_VIRTIO_NET_H */ | 245 | #endif /* _LINUX_VIRTIO_NET_H */ |
diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h index 75301468359f..90007a1abcab 100644 --- a/include/uapi/linux/virtio_pci.h +++ b/include/uapi/linux/virtio_pci.h | |||
@@ -157,6 +157,12 @@ struct virtio_pci_common_cfg { | |||
157 | __le32 queue_used_hi; /* read-write */ | 157 | __le32 queue_used_hi; /* read-write */ |
158 | }; | 158 | }; |
159 | 159 | ||
160 | /* Fields in VIRTIO_PCI_CAP_PCI_CFG: */ | ||
161 | struct virtio_pci_cfg_cap { | ||
162 | struct virtio_pci_cap cap; | ||
163 | __u8 pci_cfg_data[4]; /* Data for BAR access. */ | ||
164 | }; | ||
165 | |||
160 | /* Macro versions of offsets for the Old Timers! */ | 166 | /* Macro versions of offsets for the Old Timers! */ |
161 | #define VIRTIO_PCI_CAP_VNDR 0 | 167 | #define VIRTIO_PCI_CAP_VNDR 0 |
162 | #define VIRTIO_PCI_CAP_NEXT 1 | 168 | #define VIRTIO_PCI_CAP_NEXT 1 |
diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h index 915980ac68df..c07295969b7e 100644 --- a/include/uapi/linux/virtio_ring.h +++ b/include/uapi/linux/virtio_ring.h | |||
@@ -31,6 +31,9 @@ | |||
31 | * SUCH DAMAGE. | 31 | * SUCH DAMAGE. |
32 | * | 32 | * |
33 | * Copyright Rusty Russell IBM Corporation 2007. */ | 33 | * Copyright Rusty Russell IBM Corporation 2007. */ |
34 | #ifndef __KERNEL__ | ||
35 | #include <stdint.h> | ||
36 | #endif | ||
34 | #include <linux/types.h> | 37 | #include <linux/types.h> |
35 | #include <linux/virtio_types.h> | 38 | #include <linux/virtio_types.h> |
36 | 39 | ||
@@ -143,7 +146,7 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p, | |||
143 | vr->num = num; | 146 | vr->num = num; |
144 | vr->desc = p; | 147 | vr->desc = p; |
145 | vr->avail = p + num*sizeof(struct vring_desc); | 148 | vr->avail = p + num*sizeof(struct vring_desc); |
146 | vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + sizeof(__virtio16) | 149 | vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] + sizeof(__virtio16) |
147 | + align-1) & ~(align - 1)); | 150 | + align-1) & ~(align - 1)); |
148 | } | 151 | } |
149 | 152 | ||
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 09c65640cad6..e85bdfd15fed 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -1021,8 +1021,7 @@ static int audit_log_single_execve_arg(struct audit_context *context, | |||
1021 | * for strings that are too long, we should not have created | 1021 | * for strings that are too long, we should not have created |
1022 | * any. | 1022 | * any. |
1023 | */ | 1023 | */ |
1024 | if (unlikely((len == 0) || len > MAX_ARG_STRLEN - 1)) { | 1024 | if (WARN_ON_ONCE(len < 0 || len > MAX_ARG_STRLEN - 1)) { |
1025 | WARN_ON(1); | ||
1026 | send_sig(SIGKILL, current, 0); | 1025 | send_sig(SIGKILL, current, 0); |
1027 | return -1; | 1026 | return -1; |
1028 | } | 1027 | } |
diff --git a/kernel/cpu.c b/kernel/cpu.c index 9c9c9fab16cc..5644ec5582b9 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/suspend.h> | 21 | #include <linux/suspend.h> |
22 | #include <linux/lockdep.h> | 22 | #include <linux/lockdep.h> |
23 | #include <linux/tick.h> | 23 | #include <linux/tick.h> |
24 | #include <linux/irq.h> | ||
24 | #include <trace/events/power.h> | 25 | #include <trace/events/power.h> |
25 | 26 | ||
26 | #include "smpboot.h" | 27 | #include "smpboot.h" |
@@ -392,13 +393,19 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) | |||
392 | smpboot_park_threads(cpu); | 393 | smpboot_park_threads(cpu); |
393 | 394 | ||
394 | /* | 395 | /* |
395 | * So now all preempt/rcu users must observe !cpu_active(). | 396 | * Prevent irq alloc/free while the dying cpu reorganizes the |
397 | * interrupt affinities. | ||
396 | */ | 398 | */ |
399 | irq_lock_sparse(); | ||
397 | 400 | ||
401 | /* | ||
402 | * So now all preempt/rcu users must observe !cpu_active(). | ||
403 | */ | ||
398 | err = __stop_machine(take_cpu_down, &tcd_param, cpumask_of(cpu)); | 404 | err = __stop_machine(take_cpu_down, &tcd_param, cpumask_of(cpu)); |
399 | if (err) { | 405 | if (err) { |
400 | /* CPU didn't die: tell everyone. Can't complain. */ | 406 | /* CPU didn't die: tell everyone. Can't complain. */ |
401 | cpu_notify_nofail(CPU_DOWN_FAILED | mod, hcpu); | 407 | cpu_notify_nofail(CPU_DOWN_FAILED | mod, hcpu); |
408 | irq_unlock_sparse(); | ||
402 | goto out_release; | 409 | goto out_release; |
403 | } | 410 | } |
404 | BUG_ON(cpu_online(cpu)); | 411 | BUG_ON(cpu_online(cpu)); |
@@ -415,6 +422,9 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) | |||
415 | smp_mb(); /* Read from cpu_dead_idle before __cpu_die(). */ | 422 | smp_mb(); /* Read from cpu_dead_idle before __cpu_die(). */ |
416 | per_cpu(cpu_dead_idle, cpu) = false; | 423 | per_cpu(cpu_dead_idle, cpu) = false; |
417 | 424 | ||
425 | /* Interrupts are moved away from the dying cpu, reenable alloc/free */ | ||
426 | irq_unlock_sparse(); | ||
427 | |||
418 | hotplug_cpu__broadcast_tick_pull(cpu); | 428 | hotplug_cpu__broadcast_tick_pull(cpu); |
419 | /* This actually kills the CPU. */ | 429 | /* This actually kills the CPU. */ |
420 | __cpu_die(cpu); | 430 | __cpu_die(cpu); |
@@ -519,6 +529,7 @@ static int _cpu_up(unsigned int cpu, int tasks_frozen) | |||
519 | 529 | ||
520 | /* Arch-specific enabling code. */ | 530 | /* Arch-specific enabling code. */ |
521 | ret = __cpu_up(cpu, idle); | 531 | ret = __cpu_up(cpu, idle); |
532 | |||
522 | if (ret != 0) | 533 | if (ret != 0) |
523 | goto out_notify; | 534 | goto out_notify; |
524 | BUG_ON(!cpu_online(cpu)); | 535 | BUG_ON(!cpu_online(cpu)); |
diff --git a/kernel/fork.c b/kernel/fork.c index 1bfefc6f96a4..dbd9b8d7b7cc 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -287,6 +287,11 @@ static void set_max_threads(unsigned int max_threads_suggested) | |||
287 | max_threads = clamp_t(u64, threads, MIN_THREADS, MAX_THREADS); | 287 | max_threads = clamp_t(u64, threads, MIN_THREADS, MAX_THREADS); |
288 | } | 288 | } |
289 | 289 | ||
290 | #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT | ||
291 | /* Initialized by the architecture: */ | ||
292 | int arch_task_struct_size __read_mostly; | ||
293 | #endif | ||
294 | |||
290 | void __init fork_init(void) | 295 | void __init fork_init(void) |
291 | { | 296 | { |
292 | #ifndef CONFIG_ARCH_TASK_STRUCT_ALLOCATOR | 297 | #ifndef CONFIG_ARCH_TASK_STRUCT_ALLOCATOR |
@@ -295,7 +300,7 @@ void __init fork_init(void) | |||
295 | #endif | 300 | #endif |
296 | /* create a slab on which task_structs can be allocated */ | 301 | /* create a slab on which task_structs can be allocated */ |
297 | task_struct_cachep = | 302 | task_struct_cachep = |
298 | kmem_cache_create("task_struct", sizeof(struct task_struct), | 303 | kmem_cache_create("task_struct", arch_task_struct_size, |
299 | ARCH_MIN_TASKALIGN, SLAB_PANIC | SLAB_NOTRACK, NULL); | 304 | ARCH_MIN_TASKALIGN, SLAB_PANIC | SLAB_NOTRACK, NULL); |
300 | #endif | 305 | #endif |
301 | 306 | ||
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index c8dd8d723ee2..eee4b385cffb 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h | |||
@@ -75,12 +75,8 @@ extern void unmask_threaded_irq(struct irq_desc *desc); | |||
75 | 75 | ||
76 | #ifdef CONFIG_SPARSE_IRQ | 76 | #ifdef CONFIG_SPARSE_IRQ |
77 | static inline void irq_mark_irq(unsigned int irq) { } | 77 | static inline void irq_mark_irq(unsigned int irq) { } |
78 | extern void irq_lock_sparse(void); | ||
79 | extern void irq_unlock_sparse(void); | ||
80 | #else | 78 | #else |
81 | extern void irq_mark_irq(unsigned int irq); | 79 | extern void irq_mark_irq(unsigned int irq); |
82 | static inline void irq_lock_sparse(void) { } | ||
83 | static inline void irq_unlock_sparse(void) { } | ||
84 | #endif | 80 | #endif |
85 | 81 | ||
86 | extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr); | 82 | extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr); |
diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c index 32fc47c2c622..dd95f44f99b2 100644 --- a/kernel/irq/resend.c +++ b/kernel/irq/resend.c | |||
@@ -77,13 +77,21 @@ void check_irq_resend(struct irq_desc *desc) | |||
77 | unsigned int irq = irq_desc_get_irq(desc); | 77 | unsigned int irq = irq_desc_get_irq(desc); |
78 | 78 | ||
79 | /* | 79 | /* |
80 | * If the interrupt has a parent irq and runs | 80 | * If the interrupt is running in the thread |
81 | * in the thread context of the parent irq, | 81 | * context of the parent irq we need to be |
82 | * retrigger the parent. | 82 | * careful, because we cannot trigger it |
83 | * directly. | ||
83 | */ | 84 | */ |
84 | if (desc->parent_irq && | 85 | if (irq_settings_is_nested_thread(desc)) { |
85 | irq_settings_is_nested_thread(desc)) | 86 | /* |
87 | * If the parent_irq is valid, we | ||
88 | * retrigger the parent, otherwise we | ||
89 | * do nothing. | ||
90 | */ | ||
91 | if (!desc->parent_irq) | ||
92 | return; | ||
86 | irq = desc->parent_irq; | 93 | irq = desc->parent_irq; |
94 | } | ||
87 | /* Set it pending and activate the softirq: */ | 95 | /* Set it pending and activate the softirq: */ |
88 | set_bit(irq, irqs_resend); | 96 | set_bit(irq, irqs_resend); |
89 | tasklet_schedule(&resend_tasklet); | 97 | tasklet_schedule(&resend_tasklet); |
diff --git a/kernel/module.c b/kernel/module.c index 3e0e19763d24..4d2b82e610e2 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -3557,6 +3557,7 @@ static int load_module(struct load_info *info, const char __user *uargs, | |||
3557 | mutex_lock(&module_mutex); | 3557 | mutex_lock(&module_mutex); |
3558 | /* Unlink carefully: kallsyms could be walking list. */ | 3558 | /* Unlink carefully: kallsyms could be walking list. */ |
3559 | list_del_rcu(&mod->list); | 3559 | list_del_rcu(&mod->list); |
3560 | mod_tree_remove(mod); | ||
3560 | wake_up_all(&module_wq); | 3561 | wake_up_all(&module_wq); |
3561 | /* Wait for RCU-sched synchronizing before releasing mod->list. */ | 3562 | /* Wait for RCU-sched synchronizing before releasing mod->list. */ |
3562 | synchronize_sched(); | 3563 | synchronize_sched(); |
diff --git a/kernel/resource.c b/kernel/resource.c index 90552aab5f2d..fed052a1bc9f 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
@@ -504,13 +504,13 @@ int region_is_ram(resource_size_t start, unsigned long size) | |||
504 | { | 504 | { |
505 | struct resource *p; | 505 | struct resource *p; |
506 | resource_size_t end = start + size - 1; | 506 | resource_size_t end = start + size - 1; |
507 | int flags = IORESOURCE_MEM | IORESOURCE_BUSY; | 507 | unsigned long flags = IORESOURCE_MEM | IORESOURCE_BUSY; |
508 | const char *name = "System RAM"; | 508 | const char *name = "System RAM"; |
509 | int ret = -1; | 509 | int ret = -1; |
510 | 510 | ||
511 | read_lock(&resource_lock); | 511 | read_lock(&resource_lock); |
512 | for (p = iomem_resource.child; p ; p = p->sibling) { | 512 | for (p = iomem_resource.child; p ; p = p->sibling) { |
513 | if (end < p->start) | 513 | if (p->end < start) |
514 | continue; | 514 | continue; |
515 | 515 | ||
516 | if (p->start <= start && end <= p->end) { | 516 | if (p->start <= start && end <= p->end) { |
@@ -521,7 +521,7 @@ int region_is_ram(resource_size_t start, unsigned long size) | |||
521 | ret = 1; | 521 | ret = 1; |
522 | break; | 522 | break; |
523 | } | 523 | } |
524 | if (p->end < start) | 524 | if (end < p->start) |
525 | break; /* not found */ | 525 | break; /* not found */ |
526 | } | 526 | } |
527 | read_unlock(&resource_lock); | 527 | read_unlock(&resource_lock); |
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 65c8f3ebdc3c..d113c3ba8bc4 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -3683,7 +3683,7 @@ static void throttle_cfs_rq(struct cfs_rq *cfs_rq) | |||
3683 | cfs_rq->throttled = 1; | 3683 | cfs_rq->throttled = 1; |
3684 | cfs_rq->throttled_clock = rq_clock(rq); | 3684 | cfs_rq->throttled_clock = rq_clock(rq); |
3685 | raw_spin_lock(&cfs_b->lock); | 3685 | raw_spin_lock(&cfs_b->lock); |
3686 | empty = list_empty(&cfs_rq->throttled_list); | 3686 | empty = list_empty(&cfs_b->throttled_cfs_rq); |
3687 | 3687 | ||
3688 | /* | 3688 | /* |
3689 | * Add to the _head_ of the list, so that an already-started | 3689 | * Add to the _head_ of the list, so that an already-started |
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 08ccc3da3ca0..50eb107f1198 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c | |||
@@ -120,19 +120,25 @@ static int __clockevents_switch_state(struct clock_event_device *dev, | |||
120 | /* The clockevent device is getting replaced. Shut it down. */ | 120 | /* The clockevent device is getting replaced. Shut it down. */ |
121 | 121 | ||
122 | case CLOCK_EVT_STATE_SHUTDOWN: | 122 | case CLOCK_EVT_STATE_SHUTDOWN: |
123 | return dev->set_state_shutdown(dev); | 123 | if (dev->set_state_shutdown) |
124 | return dev->set_state_shutdown(dev); | ||
125 | return 0; | ||
124 | 126 | ||
125 | case CLOCK_EVT_STATE_PERIODIC: | 127 | case CLOCK_EVT_STATE_PERIODIC: |
126 | /* Core internal bug */ | 128 | /* Core internal bug */ |
127 | if (!(dev->features & CLOCK_EVT_FEAT_PERIODIC)) | 129 | if (!(dev->features & CLOCK_EVT_FEAT_PERIODIC)) |
128 | return -ENOSYS; | 130 | return -ENOSYS; |
129 | return dev->set_state_periodic(dev); | 131 | if (dev->set_state_periodic) |
132 | return dev->set_state_periodic(dev); | ||
133 | return 0; | ||
130 | 134 | ||
131 | case CLOCK_EVT_STATE_ONESHOT: | 135 | case CLOCK_EVT_STATE_ONESHOT: |
132 | /* Core internal bug */ | 136 | /* Core internal bug */ |
133 | if (!(dev->features & CLOCK_EVT_FEAT_ONESHOT)) | 137 | if (!(dev->features & CLOCK_EVT_FEAT_ONESHOT)) |
134 | return -ENOSYS; | 138 | return -ENOSYS; |
135 | return dev->set_state_oneshot(dev); | 139 | if (dev->set_state_oneshot) |
140 | return dev->set_state_oneshot(dev); | ||
141 | return 0; | ||
136 | 142 | ||
137 | case CLOCK_EVT_STATE_ONESHOT_STOPPED: | 143 | case CLOCK_EVT_STATE_ONESHOT_STOPPED: |
138 | /* Core internal bug */ | 144 | /* Core internal bug */ |
@@ -471,18 +477,6 @@ static int clockevents_sanity_check(struct clock_event_device *dev) | |||
471 | if (dev->features & CLOCK_EVT_FEAT_DUMMY) | 477 | if (dev->features & CLOCK_EVT_FEAT_DUMMY) |
472 | return 0; | 478 | return 0; |
473 | 479 | ||
474 | /* New state-specific callbacks */ | ||
475 | if (!dev->set_state_shutdown) | ||
476 | return -EINVAL; | ||
477 | |||
478 | if ((dev->features & CLOCK_EVT_FEAT_PERIODIC) && | ||
479 | !dev->set_state_periodic) | ||
480 | return -EINVAL; | ||
481 | |||
482 | if ((dev->features & CLOCK_EVT_FEAT_ONESHOT) && | ||
483 | !dev->set_state_oneshot) | ||
484 | return -EINVAL; | ||
485 | |||
486 | return 0; | 480 | return 0; |
487 | } | 481 | } |
488 | 482 | ||
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index d39f32cdd1b5..f6aae7977824 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -159,7 +159,7 @@ int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu) | |||
159 | { | 159 | { |
160 | struct clock_event_device *bc = tick_broadcast_device.evtdev; | 160 | struct clock_event_device *bc = tick_broadcast_device.evtdev; |
161 | unsigned long flags; | 161 | unsigned long flags; |
162 | int ret; | 162 | int ret = 0; |
163 | 163 | ||
164 | raw_spin_lock_irqsave(&tick_broadcast_lock, flags); | 164 | raw_spin_lock_irqsave(&tick_broadcast_lock, flags); |
165 | 165 | ||
@@ -221,13 +221,14 @@ int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu) | |||
221 | * If we kept the cpu in the broadcast mask, | 221 | * If we kept the cpu in the broadcast mask, |
222 | * tell the caller to leave the per cpu device | 222 | * tell the caller to leave the per cpu device |
223 | * in shutdown state. The periodic interrupt | 223 | * in shutdown state. The periodic interrupt |
224 | * is delivered by the broadcast device. | 224 | * is delivered by the broadcast device, if |
225 | * the broadcast device exists and is not | ||
226 | * hrtimer based. | ||
225 | */ | 227 | */ |
226 | ret = cpumask_test_cpu(cpu, tick_broadcast_mask); | 228 | if (bc && !(bc->features & CLOCK_EVT_FEAT_HRTIMER)) |
229 | ret = cpumask_test_cpu(cpu, tick_broadcast_mask); | ||
227 | break; | 230 | break; |
228 | default: | 231 | default: |
229 | /* Nothing to do */ | ||
230 | ret = 0; | ||
231 | break; | 232 | break; |
232 | } | 233 | } |
233 | } | 234 | } |
@@ -265,8 +266,22 @@ static bool tick_do_broadcast(struct cpumask *mask) | |||
265 | * Check, if the current cpu is in the mask | 266 | * Check, if the current cpu is in the mask |
266 | */ | 267 | */ |
267 | if (cpumask_test_cpu(cpu, mask)) { | 268 | if (cpumask_test_cpu(cpu, mask)) { |
269 | struct clock_event_device *bc = tick_broadcast_device.evtdev; | ||
270 | |||
268 | cpumask_clear_cpu(cpu, mask); | 271 | cpumask_clear_cpu(cpu, mask); |
269 | local = true; | 272 | /* |
273 | * We only run the local handler, if the broadcast | ||
274 | * device is not hrtimer based. Otherwise we run into | ||
275 | * a hrtimer recursion. | ||
276 | * | ||
277 | * local timer_interrupt() | ||
278 | * local_handler() | ||
279 | * expire_hrtimers() | ||
280 | * bc_handler() | ||
281 | * local_handler() | ||
282 | * expire_hrtimers() | ||
283 | */ | ||
284 | local = !(bc->features & CLOCK_EVT_FEAT_HRTIMER); | ||
270 | } | 285 | } |
271 | 286 | ||
272 | if (!cpumask_empty(mask)) { | 287 | if (!cpumask_empty(mask)) { |
@@ -301,6 +316,13 @@ static void tick_handle_periodic_broadcast(struct clock_event_device *dev) | |||
301 | bool bc_local; | 316 | bool bc_local; |
302 | 317 | ||
303 | raw_spin_lock(&tick_broadcast_lock); | 318 | raw_spin_lock(&tick_broadcast_lock); |
319 | |||
320 | /* Handle spurious interrupts gracefully */ | ||
321 | if (clockevent_state_shutdown(tick_broadcast_device.evtdev)) { | ||
322 | raw_spin_unlock(&tick_broadcast_lock); | ||
323 | return; | ||
324 | } | ||
325 | |||
304 | bc_local = tick_do_periodic_broadcast(); | 326 | bc_local = tick_do_periodic_broadcast(); |
305 | 327 | ||
306 | if (clockevent_state_oneshot(dev)) { | 328 | if (clockevent_state_oneshot(dev)) { |
@@ -359,8 +381,16 @@ void tick_broadcast_control(enum tick_broadcast_mode mode) | |||
359 | case TICK_BROADCAST_ON: | 381 | case TICK_BROADCAST_ON: |
360 | cpumask_set_cpu(cpu, tick_broadcast_on); | 382 | cpumask_set_cpu(cpu, tick_broadcast_on); |
361 | if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_mask)) { | 383 | if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_mask)) { |
362 | if (tick_broadcast_device.mode == | 384 | /* |
363 | TICKDEV_MODE_PERIODIC) | 385 | * Only shutdown the cpu local device, if: |
386 | * | ||
387 | * - the broadcast device exists | ||
388 | * - the broadcast device is not a hrtimer based one | ||
389 | * - the broadcast device is in periodic mode to | ||
390 | * avoid a hickup during switch to oneshot mode | ||
391 | */ | ||
392 | if (bc && !(bc->features & CLOCK_EVT_FEAT_HRTIMER) && | ||
393 | tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) | ||
364 | clockevents_shutdown(dev); | 394 | clockevents_shutdown(dev); |
365 | } | 395 | } |
366 | break; | 396 | break; |
@@ -379,14 +409,16 @@ void tick_broadcast_control(enum tick_broadcast_mode mode) | |||
379 | break; | 409 | break; |
380 | } | 410 | } |
381 | 411 | ||
382 | if (cpumask_empty(tick_broadcast_mask)) { | 412 | if (bc) { |
383 | if (!bc_stopped) | 413 | if (cpumask_empty(tick_broadcast_mask)) { |
384 | clockevents_shutdown(bc); | 414 | if (!bc_stopped) |
385 | } else if (bc_stopped) { | 415 | clockevents_shutdown(bc); |
386 | if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) | 416 | } else if (bc_stopped) { |
387 | tick_broadcast_start_periodic(bc); | 417 | if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) |
388 | else | 418 | tick_broadcast_start_periodic(bc); |
389 | tick_broadcast_setup_oneshot(bc); | 419 | else |
420 | tick_broadcast_setup_oneshot(bc); | ||
421 | } | ||
390 | } | 422 | } |
391 | raw_spin_unlock(&tick_broadcast_lock); | 423 | raw_spin_unlock(&tick_broadcast_lock); |
392 | } | 424 | } |
@@ -662,71 +694,82 @@ static void broadcast_shutdown_local(struct clock_event_device *bc, | |||
662 | clockevents_switch_state(dev, CLOCK_EVT_STATE_SHUTDOWN); | 694 | clockevents_switch_state(dev, CLOCK_EVT_STATE_SHUTDOWN); |
663 | } | 695 | } |
664 | 696 | ||
665 | /** | 697 | int __tick_broadcast_oneshot_control(enum tick_broadcast_state state) |
666 | * tick_broadcast_oneshot_control - Enter/exit broadcast oneshot mode | ||
667 | * @state: The target state (enter/exit) | ||
668 | * | ||
669 | * The system enters/leaves a state, where affected devices might stop | ||
670 | * Returns 0 on success, -EBUSY if the cpu is used to broadcast wakeups. | ||
671 | * | ||
672 | * Called with interrupts disabled, so clockevents_lock is not | ||
673 | * required here because the local clock event device cannot go away | ||
674 | * under us. | ||
675 | */ | ||
676 | int tick_broadcast_oneshot_control(enum tick_broadcast_state state) | ||
677 | { | 698 | { |
678 | struct clock_event_device *bc, *dev; | 699 | struct clock_event_device *bc, *dev; |
679 | struct tick_device *td; | ||
680 | int cpu, ret = 0; | 700 | int cpu, ret = 0; |
681 | ktime_t now; | 701 | ktime_t now; |
682 | 702 | ||
683 | /* | 703 | /* |
684 | * Periodic mode does not care about the enter/exit of power | 704 | * If there is no broadcast device, tell the caller not to go |
685 | * states | 705 | * into deep idle. |
686 | */ | 706 | */ |
687 | if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) | 707 | if (!tick_broadcast_device.evtdev) |
688 | return 0; | 708 | return -EBUSY; |
689 | 709 | ||
690 | /* | 710 | dev = this_cpu_ptr(&tick_cpu_device)->evtdev; |
691 | * We are called with preemtion disabled from the depth of the | ||
692 | * idle code, so we can't be moved away. | ||
693 | */ | ||
694 | td = this_cpu_ptr(&tick_cpu_device); | ||
695 | dev = td->evtdev; | ||
696 | |||
697 | if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) | ||
698 | return 0; | ||
699 | 711 | ||
700 | raw_spin_lock(&tick_broadcast_lock); | 712 | raw_spin_lock(&tick_broadcast_lock); |
701 | bc = tick_broadcast_device.evtdev; | 713 | bc = tick_broadcast_device.evtdev; |
702 | cpu = smp_processor_id(); | 714 | cpu = smp_processor_id(); |
703 | 715 | ||
704 | if (state == TICK_BROADCAST_ENTER) { | 716 | if (state == TICK_BROADCAST_ENTER) { |
717 | /* | ||
718 | * If the current CPU owns the hrtimer broadcast | ||
719 | * mechanism, it cannot go deep idle and we do not add | ||
720 | * the CPU to the broadcast mask. We don't have to go | ||
721 | * through the EXIT path as the local timer is not | ||
722 | * shutdown. | ||
723 | */ | ||
724 | ret = broadcast_needs_cpu(bc, cpu); | ||
725 | if (ret) | ||
726 | goto out; | ||
727 | |||
728 | /* | ||
729 | * If the broadcast device is in periodic mode, we | ||
730 | * return. | ||
731 | */ | ||
732 | if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) { | ||
733 | /* If it is a hrtimer based broadcast, return busy */ | ||
734 | if (bc->features & CLOCK_EVT_FEAT_HRTIMER) | ||
735 | ret = -EBUSY; | ||
736 | goto out; | ||
737 | } | ||
738 | |||
705 | if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_oneshot_mask)) { | 739 | if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_oneshot_mask)) { |
706 | WARN_ON_ONCE(cpumask_test_cpu(cpu, tick_broadcast_pending_mask)); | 740 | WARN_ON_ONCE(cpumask_test_cpu(cpu, tick_broadcast_pending_mask)); |
741 | |||
742 | /* Conditionally shut down the local timer. */ | ||
707 | broadcast_shutdown_local(bc, dev); | 743 | broadcast_shutdown_local(bc, dev); |
744 | |||
708 | /* | 745 | /* |
709 | * We only reprogram the broadcast timer if we | 746 | * We only reprogram the broadcast timer if we |
710 | * did not mark ourself in the force mask and | 747 | * did not mark ourself in the force mask and |
711 | * if the cpu local event is earlier than the | 748 | * if the cpu local event is earlier than the |
712 | * broadcast event. If the current CPU is in | 749 | * broadcast event. If the current CPU is in |
713 | * the force mask, then we are going to be | 750 | * the force mask, then we are going to be |
714 | * woken by the IPI right away. | 751 | * woken by the IPI right away; we return |
752 | * busy, so the CPU does not try to go deep | ||
753 | * idle. | ||
715 | */ | 754 | */ |
716 | if (!cpumask_test_cpu(cpu, tick_broadcast_force_mask) && | 755 | if (cpumask_test_cpu(cpu, tick_broadcast_force_mask)) { |
717 | dev->next_event.tv64 < bc->next_event.tv64) | 756 | ret = -EBUSY; |
757 | } else if (dev->next_event.tv64 < bc->next_event.tv64) { | ||
718 | tick_broadcast_set_event(bc, cpu, dev->next_event); | 758 | tick_broadcast_set_event(bc, cpu, dev->next_event); |
759 | /* | ||
760 | * In case of hrtimer broadcasts the | ||
761 | * programming might have moved the | ||
762 | * timer to this cpu. If yes, remove | ||
763 | * us from the broadcast mask and | ||
764 | * return busy. | ||
765 | */ | ||
766 | ret = broadcast_needs_cpu(bc, cpu); | ||
767 | if (ret) { | ||
768 | cpumask_clear_cpu(cpu, | ||
769 | tick_broadcast_oneshot_mask); | ||
770 | } | ||
771 | } | ||
719 | } | 772 | } |
720 | /* | ||
721 | * If the current CPU owns the hrtimer broadcast | ||
722 | * mechanism, it cannot go deep idle and we remove the | ||
723 | * CPU from the broadcast mask. We don't have to go | ||
724 | * through the EXIT path as the local timer is not | ||
725 | * shutdown. | ||
726 | */ | ||
727 | ret = broadcast_needs_cpu(bc, cpu); | ||
728 | if (ret) | ||
729 | cpumask_clear_cpu(cpu, tick_broadcast_oneshot_mask); | ||
730 | } else { | 773 | } else { |
731 | if (cpumask_test_and_clear_cpu(cpu, tick_broadcast_oneshot_mask)) { | 774 | if (cpumask_test_and_clear_cpu(cpu, tick_broadcast_oneshot_mask)) { |
732 | clockevents_switch_state(dev, CLOCK_EVT_STATE_ONESHOT); | 775 | clockevents_switch_state(dev, CLOCK_EVT_STATE_ONESHOT); |
@@ -796,7 +839,6 @@ out: | |||
796 | raw_spin_unlock(&tick_broadcast_lock); | 839 | raw_spin_unlock(&tick_broadcast_lock); |
797 | return ret; | 840 | return ret; |
798 | } | 841 | } |
799 | EXPORT_SYMBOL_GPL(tick_broadcast_oneshot_control); | ||
800 | 842 | ||
801 | /* | 843 | /* |
802 | * Reset the one shot broadcast for a cpu | 844 | * Reset the one shot broadcast for a cpu |
@@ -938,6 +980,16 @@ bool tick_broadcast_oneshot_available(void) | |||
938 | return bc ? bc->features & CLOCK_EVT_FEAT_ONESHOT : false; | 980 | return bc ? bc->features & CLOCK_EVT_FEAT_ONESHOT : false; |
939 | } | 981 | } |
940 | 982 | ||
983 | #else | ||
984 | int __tick_broadcast_oneshot_control(enum tick_broadcast_state state) | ||
985 | { | ||
986 | struct clock_event_device *bc = tick_broadcast_device.evtdev; | ||
987 | |||
988 | if (!bc || (bc->features & CLOCK_EVT_FEAT_HRTIMER)) | ||
989 | return -EBUSY; | ||
990 | |||
991 | return 0; | ||
992 | } | ||
941 | #endif | 993 | #endif |
942 | 994 | ||
943 | void __init tick_broadcast_init(void) | 995 | void __init tick_broadcast_init(void) |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 76446cb5dfe1..f8bf47571dda 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
@@ -343,6 +343,28 @@ out_bc: | |||
343 | tick_install_broadcast_device(newdev); | 343 | tick_install_broadcast_device(newdev); |
344 | } | 344 | } |
345 | 345 | ||
346 | /** | ||
347 | * tick_broadcast_oneshot_control - Enter/exit broadcast oneshot mode | ||
348 | * @state: The target state (enter/exit) | ||
349 | * | ||
350 | * The system enters/leaves a state, where affected devices might stop | ||
351 | * Returns 0 on success, -EBUSY if the cpu is used to broadcast wakeups. | ||
352 | * | ||
353 | * Called with interrupts disabled, so clockevents_lock is not | ||
354 | * required here because the local clock event device cannot go away | ||
355 | * under us. | ||
356 | */ | ||
357 | int tick_broadcast_oneshot_control(enum tick_broadcast_state state) | ||
358 | { | ||
359 | struct tick_device *td = this_cpu_ptr(&tick_cpu_device); | ||
360 | |||
361 | if (!(td->evtdev->features & CLOCK_EVT_FEAT_C3STOP)) | ||
362 | return 0; | ||
363 | |||
364 | return __tick_broadcast_oneshot_control(state); | ||
365 | } | ||
366 | EXPORT_SYMBOL_GPL(tick_broadcast_oneshot_control); | ||
367 | |||
346 | #ifdef CONFIG_HOTPLUG_CPU | 368 | #ifdef CONFIG_HOTPLUG_CPU |
347 | /* | 369 | /* |
348 | * Transfer the do_timer job away from a dying cpu. | 370 | * Transfer the do_timer job away from a dying cpu. |
diff --git a/kernel/time/tick-sched.h b/kernel/time/tick-sched.h index 42fdf4958bcc..a4a8d4e9baa1 100644 --- a/kernel/time/tick-sched.h +++ b/kernel/time/tick-sched.h | |||
@@ -71,4 +71,14 @@ extern void tick_cancel_sched_timer(int cpu); | |||
71 | static inline void tick_cancel_sched_timer(int cpu) { } | 71 | static inline void tick_cancel_sched_timer(int cpu) { } |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST | ||
75 | extern int __tick_broadcast_oneshot_control(enum tick_broadcast_state state); | ||
76 | #else | ||
77 | static inline int | ||
78 | __tick_broadcast_oneshot_control(enum tick_broadcast_state state) | ||
79 | { | ||
80 | return -EBUSY; | ||
81 | } | ||
82 | #endif | ||
83 | |||
74 | #endif | 84 | #endif |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 02bece4a99ea..eb11011b5292 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -98,6 +98,13 @@ struct ftrace_pid { | |||
98 | struct pid *pid; | 98 | struct pid *pid; |
99 | }; | 99 | }; |
100 | 100 | ||
101 | static bool ftrace_pids_enabled(void) | ||
102 | { | ||
103 | return !list_empty(&ftrace_pids); | ||
104 | } | ||
105 | |||
106 | static void ftrace_update_trampoline(struct ftrace_ops *ops); | ||
107 | |||
101 | /* | 108 | /* |
102 | * ftrace_disabled is set when an anomaly is discovered. | 109 | * ftrace_disabled is set when an anomaly is discovered. |
103 | * ftrace_disabled is much stronger than ftrace_enabled. | 110 | * ftrace_disabled is much stronger than ftrace_enabled. |
@@ -109,7 +116,6 @@ static DEFINE_MUTEX(ftrace_lock); | |||
109 | static struct ftrace_ops *ftrace_control_list __read_mostly = &ftrace_list_end; | 116 | static struct ftrace_ops *ftrace_control_list __read_mostly = &ftrace_list_end; |
110 | static struct ftrace_ops *ftrace_ops_list __read_mostly = &ftrace_list_end; | 117 | static struct ftrace_ops *ftrace_ops_list __read_mostly = &ftrace_list_end; |
111 | ftrace_func_t ftrace_trace_function __read_mostly = ftrace_stub; | 118 | ftrace_func_t ftrace_trace_function __read_mostly = ftrace_stub; |
112 | ftrace_func_t ftrace_pid_function __read_mostly = ftrace_stub; | ||
113 | static struct ftrace_ops global_ops; | 119 | static struct ftrace_ops global_ops; |
114 | static struct ftrace_ops control_ops; | 120 | static struct ftrace_ops control_ops; |
115 | 121 | ||
@@ -183,14 +189,7 @@ static void ftrace_pid_func(unsigned long ip, unsigned long parent_ip, | |||
183 | if (!test_tsk_trace_trace(current)) | 189 | if (!test_tsk_trace_trace(current)) |
184 | return; | 190 | return; |
185 | 191 | ||
186 | ftrace_pid_function(ip, parent_ip, op, regs); | 192 | op->saved_func(ip, parent_ip, op, regs); |
187 | } | ||
188 | |||
189 | static void set_ftrace_pid_function(ftrace_func_t func) | ||
190 | { | ||
191 | /* do not set ftrace_pid_function to itself! */ | ||
192 | if (func != ftrace_pid_func) | ||
193 | ftrace_pid_function = func; | ||
194 | } | 193 | } |
195 | 194 | ||
196 | /** | 195 | /** |
@@ -202,7 +201,6 @@ static void set_ftrace_pid_function(ftrace_func_t func) | |||
202 | void clear_ftrace_function(void) | 201 | void clear_ftrace_function(void) |
203 | { | 202 | { |
204 | ftrace_trace_function = ftrace_stub; | 203 | ftrace_trace_function = ftrace_stub; |
205 | ftrace_pid_function = ftrace_stub; | ||
206 | } | 204 | } |
207 | 205 | ||
208 | static void control_ops_disable_all(struct ftrace_ops *ops) | 206 | static void control_ops_disable_all(struct ftrace_ops *ops) |
@@ -436,6 +434,12 @@ static int __register_ftrace_function(struct ftrace_ops *ops) | |||
436 | } else | 434 | } else |
437 | add_ftrace_ops(&ftrace_ops_list, ops); | 435 | add_ftrace_ops(&ftrace_ops_list, ops); |
438 | 436 | ||
437 | /* Always save the function, and reset at unregistering */ | ||
438 | ops->saved_func = ops->func; | ||
439 | |||
440 | if (ops->flags & FTRACE_OPS_FL_PID && ftrace_pids_enabled()) | ||
441 | ops->func = ftrace_pid_func; | ||
442 | |||
439 | ftrace_update_trampoline(ops); | 443 | ftrace_update_trampoline(ops); |
440 | 444 | ||
441 | if (ftrace_enabled) | 445 | if (ftrace_enabled) |
@@ -463,15 +467,28 @@ static int __unregister_ftrace_function(struct ftrace_ops *ops) | |||
463 | if (ftrace_enabled) | 467 | if (ftrace_enabled) |
464 | update_ftrace_function(); | 468 | update_ftrace_function(); |
465 | 469 | ||
470 | ops->func = ops->saved_func; | ||
471 | |||
466 | return 0; | 472 | return 0; |
467 | } | 473 | } |
468 | 474 | ||
469 | static void ftrace_update_pid_func(void) | 475 | static void ftrace_update_pid_func(void) |
470 | { | 476 | { |
477 | bool enabled = ftrace_pids_enabled(); | ||
478 | struct ftrace_ops *op; | ||
479 | |||
471 | /* Only do something if we are tracing something */ | 480 | /* Only do something if we are tracing something */ |
472 | if (ftrace_trace_function == ftrace_stub) | 481 | if (ftrace_trace_function == ftrace_stub) |
473 | return; | 482 | return; |
474 | 483 | ||
484 | do_for_each_ftrace_op(op, ftrace_ops_list) { | ||
485 | if (op->flags & FTRACE_OPS_FL_PID) { | ||
486 | op->func = enabled ? ftrace_pid_func : | ||
487 | op->saved_func; | ||
488 | ftrace_update_trampoline(op); | ||
489 | } | ||
490 | } while_for_each_ftrace_op(op); | ||
491 | |||
475 | update_ftrace_function(); | 492 | update_ftrace_function(); |
476 | } | 493 | } |
477 | 494 | ||
@@ -1133,7 +1150,8 @@ static struct ftrace_ops global_ops = { | |||
1133 | .local_hash.filter_hash = EMPTY_HASH, | 1150 | .local_hash.filter_hash = EMPTY_HASH, |
1134 | INIT_OPS_HASH(global_ops) | 1151 | INIT_OPS_HASH(global_ops) |
1135 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | | 1152 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | |
1136 | FTRACE_OPS_FL_INITIALIZED, | 1153 | FTRACE_OPS_FL_INITIALIZED | |
1154 | FTRACE_OPS_FL_PID, | ||
1137 | }; | 1155 | }; |
1138 | 1156 | ||
1139 | /* | 1157 | /* |
@@ -5023,7 +5041,9 @@ static void ftrace_update_trampoline(struct ftrace_ops *ops) | |||
5023 | 5041 | ||
5024 | static struct ftrace_ops global_ops = { | 5042 | static struct ftrace_ops global_ops = { |
5025 | .func = ftrace_stub, | 5043 | .func = ftrace_stub, |
5026 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_INITIALIZED, | 5044 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | |
5045 | FTRACE_OPS_FL_INITIALIZED | | ||
5046 | FTRACE_OPS_FL_PID, | ||
5027 | }; | 5047 | }; |
5028 | 5048 | ||
5029 | static int __init ftrace_nodyn_init(void) | 5049 | static int __init ftrace_nodyn_init(void) |
@@ -5080,11 +5100,6 @@ void ftrace_init_array_ops(struct trace_array *tr, ftrace_func_t func) | |||
5080 | if (WARN_ON(tr->ops->func != ftrace_stub)) | 5100 | if (WARN_ON(tr->ops->func != ftrace_stub)) |
5081 | printk("ftrace ops had %pS for function\n", | 5101 | printk("ftrace ops had %pS for function\n", |
5082 | tr->ops->func); | 5102 | tr->ops->func); |
5083 | /* Only the top level instance does pid tracing */ | ||
5084 | if (!list_empty(&ftrace_pids)) { | ||
5085 | set_ftrace_pid_function(func); | ||
5086 | func = ftrace_pid_func; | ||
5087 | } | ||
5088 | } | 5103 | } |
5089 | tr->ops->func = func; | 5104 | tr->ops->func = func; |
5090 | tr->ops->private = tr; | 5105 | tr->ops->private = tr; |
@@ -5371,7 +5386,7 @@ static void *fpid_start(struct seq_file *m, loff_t *pos) | |||
5371 | { | 5386 | { |
5372 | mutex_lock(&ftrace_lock); | 5387 | mutex_lock(&ftrace_lock); |
5373 | 5388 | ||
5374 | if (list_empty(&ftrace_pids) && (!*pos)) | 5389 | if (!ftrace_pids_enabled() && (!*pos)) |
5375 | return (void *) 1; | 5390 | return (void *) 1; |
5376 | 5391 | ||
5377 | return seq_list_start(&ftrace_pids, *pos); | 5392 | return seq_list_start(&ftrace_pids, *pos); |
@@ -5610,6 +5625,7 @@ static struct ftrace_ops graph_ops = { | |||
5610 | .func = ftrace_stub, | 5625 | .func = ftrace_stub, |
5611 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | | 5626 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | |
5612 | FTRACE_OPS_FL_INITIALIZED | | 5627 | FTRACE_OPS_FL_INITIALIZED | |
5628 | FTRACE_OPS_FL_PID | | ||
5613 | FTRACE_OPS_FL_STUB, | 5629 | FTRACE_OPS_FL_STUB, |
5614 | #ifdef FTRACE_GRAPH_TRAMP_ADDR | 5630 | #ifdef FTRACE_GRAPH_TRAMP_ADDR |
5615 | .trampoline = FTRACE_GRAPH_TRAMP_ADDR, | 5631 | .trampoline = FTRACE_GRAPH_TRAMP_ADDR, |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index f060716b02ae..74bde81601a9 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -444,6 +444,7 @@ enum { | |||
444 | 444 | ||
445 | TRACE_CONTROL_BIT, | 445 | TRACE_CONTROL_BIT, |
446 | 446 | ||
447 | TRACE_BRANCH_BIT, | ||
447 | /* | 448 | /* |
448 | * Abuse of the trace_recursion. | 449 | * Abuse of the trace_recursion. |
449 | * As we need a way to maintain state if we are tracing the function | 450 | * As we need a way to maintain state if we are tracing the function |
diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c index a87b43f49eb4..e2e12ad3186f 100644 --- a/kernel/trace/trace_branch.c +++ b/kernel/trace/trace_branch.c | |||
@@ -36,9 +36,12 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect) | |||
36 | struct trace_branch *entry; | 36 | struct trace_branch *entry; |
37 | struct ring_buffer *buffer; | 37 | struct ring_buffer *buffer; |
38 | unsigned long flags; | 38 | unsigned long flags; |
39 | int cpu, pc; | 39 | int pc; |
40 | const char *p; | 40 | const char *p; |
41 | 41 | ||
42 | if (current->trace_recursion & TRACE_BRANCH_BIT) | ||
43 | return; | ||
44 | |||
42 | /* | 45 | /* |
43 | * I would love to save just the ftrace_likely_data pointer, but | 46 | * I would love to save just the ftrace_likely_data pointer, but |
44 | * this code can also be used by modules. Ugly things can happen | 47 | * this code can also be used by modules. Ugly things can happen |
@@ -49,10 +52,10 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect) | |||
49 | if (unlikely(!tr)) | 52 | if (unlikely(!tr)) |
50 | return; | 53 | return; |
51 | 54 | ||
52 | local_irq_save(flags); | 55 | raw_local_irq_save(flags); |
53 | cpu = raw_smp_processor_id(); | 56 | current->trace_recursion |= TRACE_BRANCH_BIT; |
54 | data = per_cpu_ptr(tr->trace_buffer.data, cpu); | 57 | data = this_cpu_ptr(tr->trace_buffer.data); |
55 | if (atomic_inc_return(&data->disabled) != 1) | 58 | if (atomic_read(&data->disabled)) |
56 | goto out; | 59 | goto out; |
57 | 60 | ||
58 | pc = preempt_count(); | 61 | pc = preempt_count(); |
@@ -81,8 +84,8 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect) | |||
81 | __buffer_unlock_commit(buffer, event); | 84 | __buffer_unlock_commit(buffer, event); |
82 | 85 | ||
83 | out: | 86 | out: |
84 | atomic_dec(&data->disabled); | 87 | current->trace_recursion &= ~TRACE_BRANCH_BIT; |
85 | local_irq_restore(flags); | 88 | raw_local_irq_restore(flags); |
86 | } | 89 | } |
87 | 90 | ||
88 | static inline | 91 | static inline |
diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan index 777eda7d1ab4..39f24d6721e5 100644 --- a/lib/Kconfig.kasan +++ b/lib/Kconfig.kasan | |||
@@ -18,10 +18,6 @@ config KASAN | |||
18 | For better error detection enable CONFIG_STACKTRACE, | 18 | For better error detection enable CONFIG_STACKTRACE, |
19 | and add slub_debug=U to boot cmdline. | 19 | and add slub_debug=U to boot cmdline. |
20 | 20 | ||
21 | config KASAN_SHADOW_OFFSET | ||
22 | hex | ||
23 | default 0xdffffc0000000000 if X86_64 | ||
24 | |||
25 | choice | 21 | choice |
26 | prompt "Instrumentation type" | 22 | prompt "Instrumentation type" |
27 | depends on KASAN | 23 | depends on KASAN |
diff --git a/lib/decompress.c b/lib/decompress.c index 528ff932d8e4..62696dff5730 100644 --- a/lib/decompress.c +++ b/lib/decompress.c | |||
@@ -59,8 +59,11 @@ decompress_fn __init decompress_method(const unsigned char *inbuf, long len, | |||
59 | { | 59 | { |
60 | const struct compress_format *cf; | 60 | const struct compress_format *cf; |
61 | 61 | ||
62 | if (len < 2) | 62 | if (len < 2) { |
63 | if (name) | ||
64 | *name = NULL; | ||
63 | return NULL; /* Need at least this much... */ | 65 | return NULL; /* Need at least this much... */ |
66 | } | ||
64 | 67 | ||
65 | pr_debug("Compressed data magic: %#.2x %#.2x\n", inbuf[0], inbuf[1]); | 68 | pr_debug("Compressed data magic: %#.2x %#.2x\n", inbuf[0], inbuf[1]); |
66 | 69 | ||
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index ae4b65e17e64..dace71fe41f7 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -574,6 +574,9 @@ void debug_dma_assert_idle(struct page *page) | |||
574 | unsigned long flags; | 574 | unsigned long flags; |
575 | phys_addr_t cln; | 575 | phys_addr_t cln; |
576 | 576 | ||
577 | if (dma_debug_disabled()) | ||
578 | return; | ||
579 | |||
577 | if (!page) | 580 | if (!page) |
578 | return; | 581 | return; |
579 | 582 | ||
diff --git a/lib/hexdump.c b/lib/hexdump.c index 7ea09699855d..8d74c20d8595 100644 --- a/lib/hexdump.c +++ b/lib/hexdump.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/ctype.h> | 11 | #include <linux/ctype.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/export.h> | 13 | #include <linux/export.h> |
14 | #include <asm/unaligned.h> | ||
14 | 15 | ||
15 | const char hex_asc[] = "0123456789abcdef"; | 16 | const char hex_asc[] = "0123456789abcdef"; |
16 | EXPORT_SYMBOL(hex_asc); | 17 | EXPORT_SYMBOL(hex_asc); |
@@ -139,7 +140,7 @@ int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize, | |||
139 | for (j = 0; j < ngroups; j++) { | 140 | for (j = 0; j < ngroups; j++) { |
140 | ret = snprintf(linebuf + lx, linebuflen - lx, | 141 | ret = snprintf(linebuf + lx, linebuflen - lx, |
141 | "%s%16.16llx", j ? " " : "", | 142 | "%s%16.16llx", j ? " " : "", |
142 | (unsigned long long)*(ptr8 + j)); | 143 | get_unaligned(ptr8 + j)); |
143 | if (ret >= linebuflen - lx) | 144 | if (ret >= linebuflen - lx) |
144 | goto overflow1; | 145 | goto overflow1; |
145 | lx += ret; | 146 | lx += ret; |
@@ -150,7 +151,7 @@ int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize, | |||
150 | for (j = 0; j < ngroups; j++) { | 151 | for (j = 0; j < ngroups; j++) { |
151 | ret = snprintf(linebuf + lx, linebuflen - lx, | 152 | ret = snprintf(linebuf + lx, linebuflen - lx, |
152 | "%s%8.8x", j ? " " : "", | 153 | "%s%8.8x", j ? " " : "", |
153 | *(ptr4 + j)); | 154 | get_unaligned(ptr4 + j)); |
154 | if (ret >= linebuflen - lx) | 155 | if (ret >= linebuflen - lx) |
155 | goto overflow1; | 156 | goto overflow1; |
156 | lx += ret; | 157 | lx += ret; |
@@ -161,7 +162,7 @@ int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize, | |||
161 | for (j = 0; j < ngroups; j++) { | 162 | for (j = 0; j < ngroups; j++) { |
162 | ret = snprintf(linebuf + lx, linebuflen - lx, | 163 | ret = snprintf(linebuf + lx, linebuflen - lx, |
163 | "%s%4.4x", j ? " " : "", | 164 | "%s%4.4x", j ? " " : "", |
164 | *(ptr2 + j)); | 165 | get_unaligned(ptr2 + j)); |
165 | if (ret >= linebuflen - lx) | 166 | if (ret >= linebuflen - lx) |
166 | goto overflow1; | 167 | goto overflow1; |
167 | lx += ret; | 168 | lx += ret; |
diff --git a/lib/kobject.c b/lib/kobject.c index 2e3bd01964a9..3e3a5c3cb330 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -337,8 +337,9 @@ error: | |||
337 | } | 337 | } |
338 | EXPORT_SYMBOL(kobject_init); | 338 | EXPORT_SYMBOL(kobject_init); |
339 | 339 | ||
340 | static int kobject_add_varg(struct kobject *kobj, struct kobject *parent, | 340 | static __printf(3, 0) int kobject_add_varg(struct kobject *kobj, |
341 | const char *fmt, va_list vargs) | 341 | struct kobject *parent, |
342 | const char *fmt, va_list vargs) | ||
342 | { | 343 | { |
343 | int retval; | 344 | int retval; |
344 | 345 | ||
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index a60a6d335a91..cc0c69710dcf 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c | |||
@@ -610,6 +610,8 @@ next: | |||
610 | iter->skip = 0; | 610 | iter->skip = 0; |
611 | } | 611 | } |
612 | 612 | ||
613 | iter->p = NULL; | ||
614 | |||
613 | /* Ensure we see any new tables. */ | 615 | /* Ensure we see any new tables. */ |
614 | smp_rmb(); | 616 | smp_rmb(); |
615 | 617 | ||
@@ -620,8 +622,6 @@ next: | |||
620 | return ERR_PTR(-EAGAIN); | 622 | return ERR_PTR(-EAGAIN); |
621 | } | 623 | } |
622 | 624 | ||
623 | iter->p = NULL; | ||
624 | |||
625 | return NULL; | 625 | return NULL; |
626 | } | 626 | } |
627 | EXPORT_SYMBOL_GPL(rhashtable_walk_next); | 627 | EXPORT_SYMBOL_GPL(rhashtable_walk_next); |
diff --git a/mm/cma_debug.c b/mm/cma_debug.c index 7621ee34daa0..f8e4b60db167 100644 --- a/mm/cma_debug.c +++ b/mm/cma_debug.c | |||
@@ -39,7 +39,7 @@ static int cma_used_get(void *data, u64 *val) | |||
39 | 39 | ||
40 | mutex_lock(&cma->lock); | 40 | mutex_lock(&cma->lock); |
41 | /* pages counter is smaller than sizeof(int) */ | 41 | /* pages counter is smaller than sizeof(int) */ |
42 | used = bitmap_weight(cma->bitmap, (int)cma->count); | 42 | used = bitmap_weight(cma->bitmap, (int)cma_bitmap_maxno(cma)); |
43 | mutex_unlock(&cma->lock); | 43 | mutex_unlock(&cma->lock); |
44 | *val = (u64)used << cma->order_per_bit; | 44 | *val = (u64)used << cma->order_per_bit; |
45 | 45 | ||
@@ -52,13 +52,14 @@ static int cma_maxchunk_get(void *data, u64 *val) | |||
52 | struct cma *cma = data; | 52 | struct cma *cma = data; |
53 | unsigned long maxchunk = 0; | 53 | unsigned long maxchunk = 0; |
54 | unsigned long start, end = 0; | 54 | unsigned long start, end = 0; |
55 | unsigned long bitmap_maxno = cma_bitmap_maxno(cma); | ||
55 | 56 | ||
56 | mutex_lock(&cma->lock); | 57 | mutex_lock(&cma->lock); |
57 | for (;;) { | 58 | for (;;) { |
58 | start = find_next_zero_bit(cma->bitmap, cma->count, end); | 59 | start = find_next_zero_bit(cma->bitmap, bitmap_maxno, end); |
59 | if (start >= cma->count) | 60 | if (start >= cma->count) |
60 | break; | 61 | break; |
61 | end = find_next_bit(cma->bitmap, cma->count, start); | 62 | end = find_next_bit(cma->bitmap, bitmap_maxno, start); |
62 | maxchunk = max(end - start, maxchunk); | 63 | maxchunk = max(end - start, maxchunk); |
63 | } | 64 | } |
64 | mutex_unlock(&cma->lock); | 65 | mutex_unlock(&cma->lock); |
@@ -170,10 +171,10 @@ static void cma_debugfs_add_one(struct cma *cma, int idx) | |||
170 | 171 | ||
171 | tmp = debugfs_create_dir(name, cma_debugfs_root); | 172 | tmp = debugfs_create_dir(name, cma_debugfs_root); |
172 | 173 | ||
173 | debugfs_create_file("alloc", S_IWUSR, cma_debugfs_root, cma, | 174 | debugfs_create_file("alloc", S_IWUSR, tmp, cma, |
174 | &cma_alloc_fops); | 175 | &cma_alloc_fops); |
175 | 176 | ||
176 | debugfs_create_file("free", S_IWUSR, cma_debugfs_root, cma, | 177 | debugfs_create_file("free", S_IWUSR, tmp, cma, |
177 | &cma_free_fops); | 178 | &cma_free_fops); |
178 | 179 | ||
179 | debugfs_create_file("base_pfn", S_IRUGO, tmp, | 180 | debugfs_create_file("base_pfn", S_IRUGO, tmp, |
diff --git a/mm/memory.c b/mm/memory.c index a84fbb772034..388dcf9aa283 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -2670,6 +2670,10 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2670 | 2670 | ||
2671 | pte_unmap(page_table); | 2671 | pte_unmap(page_table); |
2672 | 2672 | ||
2673 | /* File mapping without ->vm_ops ? */ | ||
2674 | if (vma->vm_flags & VM_SHARED) | ||
2675 | return VM_FAULT_SIGBUS; | ||
2676 | |||
2673 | /* Check if we need to add a guard page to the stack */ | 2677 | /* Check if we need to add a guard page to the stack */ |
2674 | if (check_stack_guard_page(vma, address) < 0) | 2678 | if (check_stack_guard_page(vma, address) < 0) |
2675 | return VM_FAULT_SIGSEGV; | 2679 | return VM_FAULT_SIGSEGV; |
@@ -3099,6 +3103,9 @@ static int do_fault(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3099 | - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; | 3103 | - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; |
3100 | 3104 | ||
3101 | pte_unmap(page_table); | 3105 | pte_unmap(page_table); |
3106 | /* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */ | ||
3107 | if (!vma->vm_ops->fault) | ||
3108 | return VM_FAULT_SIGBUS; | ||
3102 | if (!(flags & FAULT_FLAG_WRITE)) | 3109 | if (!(flags & FAULT_FLAG_WRITE)) |
3103 | return do_read_fault(mm, vma, address, pmd, pgoff, flags, | 3110 | return do_read_fault(mm, vma, address, pmd, pgoff, flags, |
3104 | orig_pte); | 3111 | orig_pte); |
@@ -3244,13 +3251,12 @@ static int handle_pte_fault(struct mm_struct *mm, | |||
3244 | barrier(); | 3251 | barrier(); |
3245 | if (!pte_present(entry)) { | 3252 | if (!pte_present(entry)) { |
3246 | if (pte_none(entry)) { | 3253 | if (pte_none(entry)) { |
3247 | if (vma->vm_ops) { | 3254 | if (vma->vm_ops) |
3248 | if (likely(vma->vm_ops->fault)) | 3255 | return do_fault(mm, vma, address, pte, pmd, |
3249 | return do_fault(mm, vma, address, pte, | 3256 | flags, entry); |
3250 | pmd, flags, entry); | 3257 | |
3251 | } | 3258 | return do_anonymous_page(mm, vma, address, pte, pmd, |
3252 | return do_anonymous_page(mm, vma, address, | 3259 | flags); |
3253 | pte, pmd, flags); | ||
3254 | } | 3260 | } |
3255 | return do_swap_page(mm, vma, address, | 3261 | return do_swap_page(mm, vma, address, |
3256 | pte, pmd, flags, entry); | 3262 | pte, pmd, flags, entry); |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 506eac8b38af..ef19f22b2b7d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -246,9 +246,7 @@ static inline void reset_deferred_meminit(pg_data_t *pgdat) | |||
246 | /* Returns true if the struct page for the pfn is uninitialised */ | 246 | /* Returns true if the struct page for the pfn is uninitialised */ |
247 | static inline bool __meminit early_page_uninitialised(unsigned long pfn) | 247 | static inline bool __meminit early_page_uninitialised(unsigned long pfn) |
248 | { | 248 | { |
249 | int nid = early_pfn_to_nid(pfn); | 249 | if (pfn >= NODE_DATA(early_pfn_to_nid(pfn))->first_deferred_pfn) |
250 | |||
251 | if (pfn >= NODE_DATA(nid)->first_deferred_pfn) | ||
252 | return true; | 250 | return true; |
253 | 251 | ||
254 | return false; | 252 | return false; |
@@ -1950,6 +1948,7 @@ void free_hot_cold_page_list(struct list_head *list, bool cold) | |||
1950 | void split_page(struct page *page, unsigned int order) | 1948 | void split_page(struct page *page, unsigned int order) |
1951 | { | 1949 | { |
1952 | int i; | 1950 | int i; |
1951 | gfp_t gfp_mask; | ||
1953 | 1952 | ||
1954 | VM_BUG_ON_PAGE(PageCompound(page), page); | 1953 | VM_BUG_ON_PAGE(PageCompound(page), page); |
1955 | VM_BUG_ON_PAGE(!page_count(page), page); | 1954 | VM_BUG_ON_PAGE(!page_count(page), page); |
@@ -1963,10 +1962,11 @@ void split_page(struct page *page, unsigned int order) | |||
1963 | split_page(virt_to_page(page[0].shadow), order); | 1962 | split_page(virt_to_page(page[0].shadow), order); |
1964 | #endif | 1963 | #endif |
1965 | 1964 | ||
1966 | set_page_owner(page, 0, 0); | 1965 | gfp_mask = get_page_owner_gfp(page); |
1966 | set_page_owner(page, 0, gfp_mask); | ||
1967 | for (i = 1; i < (1 << order); i++) { | 1967 | for (i = 1; i < (1 << order); i++) { |
1968 | set_page_refcounted(page + i); | 1968 | set_page_refcounted(page + i); |
1969 | set_page_owner(page + i, 0, 0); | 1969 | set_page_owner(page + i, 0, gfp_mask); |
1970 | } | 1970 | } |
1971 | } | 1971 | } |
1972 | EXPORT_SYMBOL_GPL(split_page); | 1972 | EXPORT_SYMBOL_GPL(split_page); |
@@ -1996,6 +1996,8 @@ int __isolate_free_page(struct page *page, unsigned int order) | |||
1996 | zone->free_area[order].nr_free--; | 1996 | zone->free_area[order].nr_free--; |
1997 | rmv_page_order(page); | 1997 | rmv_page_order(page); |
1998 | 1998 | ||
1999 | set_page_owner(page, order, __GFP_MOVABLE); | ||
2000 | |||
1999 | /* Set the pageblock if the isolated page is at least a pageblock */ | 2001 | /* Set the pageblock if the isolated page is at least a pageblock */ |
2000 | if (order >= pageblock_order - 1) { | 2002 | if (order >= pageblock_order - 1) { |
2001 | struct page *endpage = page + (1 << order) - 1; | 2003 | struct page *endpage = page + (1 << order) - 1; |
@@ -2007,7 +2009,7 @@ int __isolate_free_page(struct page *page, unsigned int order) | |||
2007 | } | 2009 | } |
2008 | } | 2010 | } |
2009 | 2011 | ||
2010 | set_page_owner(page, order, 0); | 2012 | |
2011 | return 1UL << order; | 2013 | return 1UL << order; |
2012 | } | 2014 | } |
2013 | 2015 | ||
diff --git a/mm/page_owner.c b/mm/page_owner.c index bd5f842b56d2..983c3a10fa07 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c | |||
@@ -76,6 +76,13 @@ void __set_page_owner(struct page *page, unsigned int order, gfp_t gfp_mask) | |||
76 | __set_bit(PAGE_EXT_OWNER, &page_ext->flags); | 76 | __set_bit(PAGE_EXT_OWNER, &page_ext->flags); |
77 | } | 77 | } |
78 | 78 | ||
79 | gfp_t __get_page_owner_gfp(struct page *page) | ||
80 | { | ||
81 | struct page_ext *page_ext = lookup_page_ext(page); | ||
82 | |||
83 | return page_ext->gfp_mask; | ||
84 | } | ||
85 | |||
79 | static ssize_t | 86 | static ssize_t |
80 | print_page_owner(char __user *buf, size_t count, unsigned long pfn, | 87 | print_page_owner(char __user *buf, size_t count, unsigned long pfn, |
81 | struct page *page, struct page_ext *page_ext) | 88 | struct page *page, struct page_ext *page_ext) |
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 9dd49ca67dbc..6e70ddb158b4 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
@@ -704,6 +704,7 @@ static void p9_virtio_remove(struct virtio_device *vdev) | |||
704 | 704 | ||
705 | mutex_unlock(&virtio_9p_lock); | 705 | mutex_unlock(&virtio_9p_lock); |
706 | 706 | ||
707 | vdev->config->reset(vdev); | ||
707 | vdev->config->del_vqs(vdev); | 708 | vdev->config->del_vqs(vdev); |
708 | 709 | ||
709 | sysfs_remove_file(&(vdev->dev.kobj), &dev_attr_mount_tag.attr); | 710 | sysfs_remove_file(&(vdev->dev.kobj), &dev_attr_mount_tag.attr); |
diff --git a/net/ax25/ax25_subr.c b/net/ax25/ax25_subr.c index 1997538a5d23..3b78e8473a01 100644 --- a/net/ax25/ax25_subr.c +++ b/net/ax25/ax25_subr.c | |||
@@ -264,6 +264,7 @@ void ax25_disconnect(ax25_cb *ax25, int reason) | |||
264 | { | 264 | { |
265 | ax25_clear_queues(ax25); | 265 | ax25_clear_queues(ax25); |
266 | 266 | ||
267 | ax25_stop_heartbeat(ax25); | ||
267 | ax25_stop_t1timer(ax25); | 268 | ax25_stop_t1timer(ax25); |
268 | ax25_stop_t2timer(ax25); | 269 | ax25_stop_t2timer(ax25); |
269 | ax25_stop_t3timer(ax25); | 270 | ax25_stop_t3timer(ax25); |
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index e97572b5d2cc..0ff6e1bbca91 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c | |||
@@ -42,6 +42,7 @@ int br_dev_queue_push_xmit(struct sock *sk, struct sk_buff *skb) | |||
42 | } else { | 42 | } else { |
43 | skb_push(skb, ETH_HLEN); | 43 | skb_push(skb, ETH_HLEN); |
44 | br_drop_fake_rtable(skb); | 44 | br_drop_fake_rtable(skb); |
45 | skb_sender_cpu_clear(skb); | ||
45 | dev_queue_xmit(skb); | 46 | dev_queue_xmit(skb); |
46 | } | 47 | } |
47 | 48 | ||
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index e29ad70b3000..1198a3dbad95 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c | |||
@@ -323,6 +323,7 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, | |||
323 | struct net_bridge_port_group *p; | 323 | struct net_bridge_port_group *p; |
324 | struct net_bridge_port_group __rcu **pp; | 324 | struct net_bridge_port_group __rcu **pp; |
325 | struct net_bridge_mdb_htable *mdb; | 325 | struct net_bridge_mdb_htable *mdb; |
326 | unsigned long now = jiffies; | ||
326 | int err; | 327 | int err; |
327 | 328 | ||
328 | mdb = mlock_dereference(br->mdb, br); | 329 | mdb = mlock_dereference(br->mdb, br); |
@@ -347,8 +348,9 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, | |||
347 | if (unlikely(!p)) | 348 | if (unlikely(!p)) |
348 | return -ENOMEM; | 349 | return -ENOMEM; |
349 | rcu_assign_pointer(*pp, p); | 350 | rcu_assign_pointer(*pp, p); |
351 | if (state == MDB_TEMPORARY) | ||
352 | mod_timer(&p->timer, now + br->multicast_membership_interval); | ||
350 | 353 | ||
351 | br_mdb_notify(br->dev, port, group, RTM_NEWMDB); | ||
352 | return 0; | 354 | return 0; |
353 | } | 355 | } |
354 | 356 | ||
@@ -371,6 +373,7 @@ static int __br_mdb_add(struct net *net, struct net_bridge *br, | |||
371 | if (!p || p->br != br || p->state == BR_STATE_DISABLED) | 373 | if (!p || p->br != br || p->state == BR_STATE_DISABLED) |
372 | return -EINVAL; | 374 | return -EINVAL; |
373 | 375 | ||
376 | memset(&ip, 0, sizeof(ip)); | ||
374 | ip.proto = entry->addr.proto; | 377 | ip.proto = entry->addr.proto; |
375 | if (ip.proto == htons(ETH_P_IP)) | 378 | if (ip.proto == htons(ETH_P_IP)) |
376 | ip.u.ip4 = entry->addr.u.ip4; | 379 | ip.u.ip4 = entry->addr.u.ip4; |
@@ -417,20 +420,14 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry) | |||
417 | if (!netif_running(br->dev) || br->multicast_disabled) | 420 | if (!netif_running(br->dev) || br->multicast_disabled) |
418 | return -EINVAL; | 421 | return -EINVAL; |
419 | 422 | ||
423 | memset(&ip, 0, sizeof(ip)); | ||
420 | ip.proto = entry->addr.proto; | 424 | ip.proto = entry->addr.proto; |
421 | if (ip.proto == htons(ETH_P_IP)) { | 425 | if (ip.proto == htons(ETH_P_IP)) |
422 | if (timer_pending(&br->ip4_other_query.timer)) | ||
423 | return -EBUSY; | ||
424 | |||
425 | ip.u.ip4 = entry->addr.u.ip4; | 426 | ip.u.ip4 = entry->addr.u.ip4; |
426 | #if IS_ENABLED(CONFIG_IPV6) | 427 | #if IS_ENABLED(CONFIG_IPV6) |
427 | } else { | 428 | else |
428 | if (timer_pending(&br->ip6_other_query.timer)) | ||
429 | return -EBUSY; | ||
430 | |||
431 | ip.u.ip6 = entry->addr.u.ip6; | 429 | ip.u.ip6 = entry->addr.u.ip6; |
432 | #endif | 430 | #endif |
433 | } | ||
434 | 431 | ||
435 | spin_lock_bh(&br->multicast_lock); | 432 | spin_lock_bh(&br->multicast_lock); |
436 | mdb = mlock_dereference(br->mdb, br); | 433 | mdb = mlock_dereference(br->mdb, br); |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 742a6c27d7a2..79db489cdade 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -39,6 +39,16 @@ static void br_multicast_start_querier(struct net_bridge *br, | |||
39 | struct bridge_mcast_own_query *query); | 39 | struct bridge_mcast_own_query *query); |
40 | static void br_multicast_add_router(struct net_bridge *br, | 40 | static void br_multicast_add_router(struct net_bridge *br, |
41 | struct net_bridge_port *port); | 41 | struct net_bridge_port *port); |
42 | static void br_ip4_multicast_leave_group(struct net_bridge *br, | ||
43 | struct net_bridge_port *port, | ||
44 | __be32 group, | ||
45 | __u16 vid); | ||
46 | #if IS_ENABLED(CONFIG_IPV6) | ||
47 | static void br_ip6_multicast_leave_group(struct net_bridge *br, | ||
48 | struct net_bridge_port *port, | ||
49 | const struct in6_addr *group, | ||
50 | __u16 vid); | ||
51 | #endif | ||
42 | unsigned int br_mdb_rehash_seq; | 52 | unsigned int br_mdb_rehash_seq; |
43 | 53 | ||
44 | static inline int br_ip_equal(const struct br_ip *a, const struct br_ip *b) | 54 | static inline int br_ip_equal(const struct br_ip *a, const struct br_ip *b) |
@@ -1010,9 +1020,15 @@ static int br_ip4_multicast_igmp3_report(struct net_bridge *br, | |||
1010 | continue; | 1020 | continue; |
1011 | } | 1021 | } |
1012 | 1022 | ||
1013 | err = br_ip4_multicast_add_group(br, port, group, vid); | 1023 | if ((type == IGMPV3_CHANGE_TO_INCLUDE || |
1014 | if (err) | 1024 | type == IGMPV3_MODE_IS_INCLUDE) && |
1015 | break; | 1025 | ntohs(grec->grec_nsrcs) == 0) { |
1026 | br_ip4_multicast_leave_group(br, port, group, vid); | ||
1027 | } else { | ||
1028 | err = br_ip4_multicast_add_group(br, port, group, vid); | ||
1029 | if (err) | ||
1030 | break; | ||
1031 | } | ||
1016 | } | 1032 | } |
1017 | 1033 | ||
1018 | return err; | 1034 | return err; |
@@ -1071,10 +1087,17 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, | |||
1071 | continue; | 1087 | continue; |
1072 | } | 1088 | } |
1073 | 1089 | ||
1074 | err = br_ip6_multicast_add_group(br, port, &grec->grec_mca, | 1090 | if ((grec->grec_type == MLD2_CHANGE_TO_INCLUDE || |
1075 | vid); | 1091 | grec->grec_type == MLD2_MODE_IS_INCLUDE) && |
1076 | if (err) | 1092 | ntohs(*nsrcs) == 0) { |
1077 | break; | 1093 | br_ip6_multicast_leave_group(br, port, &grec->grec_mca, |
1094 | vid); | ||
1095 | } else { | ||
1096 | err = br_ip6_multicast_add_group(br, port, | ||
1097 | &grec->grec_mca, vid); | ||
1098 | if (!err) | ||
1099 | break; | ||
1100 | } | ||
1078 | } | 1101 | } |
1079 | 1102 | ||
1080 | return err; | 1103 | return err; |
diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c index d89f4fac0bc5..c8b9bcfe997e 100644 --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c | |||
@@ -111,7 +111,7 @@ static inline __be16 pppoe_proto(const struct sk_buff *skb) | |||
111 | /* largest possible L2 header, see br_nf_dev_queue_xmit() */ | 111 | /* largest possible L2 header, see br_nf_dev_queue_xmit() */ |
112 | #define NF_BRIDGE_MAX_MAC_HEADER_LENGTH (PPPOE_SES_HLEN + ETH_HLEN) | 112 | #define NF_BRIDGE_MAX_MAC_HEADER_LENGTH (PPPOE_SES_HLEN + ETH_HLEN) |
113 | 113 | ||
114 | #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4) | 114 | #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4) || IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) |
115 | struct brnf_frag_data { | 115 | struct brnf_frag_data { |
116 | char mac[NF_BRIDGE_MAX_MAC_HEADER_LENGTH]; | 116 | char mac[NF_BRIDGE_MAX_MAC_HEADER_LENGTH]; |
117 | u8 encap_size; | 117 | u8 encap_size; |
@@ -694,6 +694,7 @@ static int br_nf_push_frag_xmit(struct sock *sk, struct sk_buff *skb) | |||
694 | } | 694 | } |
695 | #endif | 695 | #endif |
696 | 696 | ||
697 | #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4) | ||
697 | static int br_nf_ip_fragment(struct sock *sk, struct sk_buff *skb, | 698 | static int br_nf_ip_fragment(struct sock *sk, struct sk_buff *skb, |
698 | int (*output)(struct sock *, struct sk_buff *)) | 699 | int (*output)(struct sock *, struct sk_buff *)) |
699 | { | 700 | { |
@@ -712,6 +713,7 @@ static int br_nf_ip_fragment(struct sock *sk, struct sk_buff *skb, | |||
712 | 713 | ||
713 | return ip_do_fragment(sk, skb, output); | 714 | return ip_do_fragment(sk, skb, output); |
714 | } | 715 | } |
716 | #endif | ||
715 | 717 | ||
716 | static unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb) | 718 | static unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb) |
717 | { | 719 | { |
@@ -742,7 +744,7 @@ static int br_nf_dev_queue_xmit(struct sock *sk, struct sk_buff *skb) | |||
742 | struct brnf_frag_data *data; | 744 | struct brnf_frag_data *data; |
743 | 745 | ||
744 | if (br_validate_ipv4(skb)) | 746 | if (br_validate_ipv4(skb)) |
745 | return NF_DROP; | 747 | goto drop; |
746 | 748 | ||
747 | IPCB(skb)->frag_max_size = nf_bridge->frag_max_size; | 749 | IPCB(skb)->frag_max_size = nf_bridge->frag_max_size; |
748 | 750 | ||
@@ -767,7 +769,7 @@ static int br_nf_dev_queue_xmit(struct sock *sk, struct sk_buff *skb) | |||
767 | struct brnf_frag_data *data; | 769 | struct brnf_frag_data *data; |
768 | 770 | ||
769 | if (br_validate_ipv6(skb)) | 771 | if (br_validate_ipv6(skb)) |
770 | return NF_DROP; | 772 | goto drop; |
771 | 773 | ||
772 | IP6CB(skb)->frag_max_size = nf_bridge->frag_max_size; | 774 | IP6CB(skb)->frag_max_size = nf_bridge->frag_max_size; |
773 | 775 | ||
@@ -782,12 +784,16 @@ static int br_nf_dev_queue_xmit(struct sock *sk, struct sk_buff *skb) | |||
782 | 784 | ||
783 | if (v6ops) | 785 | if (v6ops) |
784 | return v6ops->fragment(sk, skb, br_nf_push_frag_xmit); | 786 | return v6ops->fragment(sk, skb, br_nf_push_frag_xmit); |
785 | else | 787 | |
786 | return -EMSGSIZE; | 788 | kfree_skb(skb); |
789 | return -EMSGSIZE; | ||
787 | } | 790 | } |
788 | #endif | 791 | #endif |
789 | nf_bridge_info_free(skb); | 792 | nf_bridge_info_free(skb); |
790 | return br_dev_queue_push_xmit(sk, skb); | 793 | return br_dev_queue_push_xmit(sk, skb); |
794 | drop: | ||
795 | kfree_skb(skb); | ||
796 | return 0; | ||
791 | } | 797 | } |
792 | 798 | ||
793 | /* PF_BRIDGE/POST_ROUTING ********************************************/ | 799 | /* PF_BRIDGE/POST_ROUTING ********************************************/ |
diff --git a/net/bridge/br_netfilter_ipv6.c b/net/bridge/br_netfilter_ipv6.c index 6d12d2675c80..13b7d1e3d185 100644 --- a/net/bridge/br_netfilter_ipv6.c +++ b/net/bridge/br_netfilter_ipv6.c | |||
@@ -104,7 +104,7 @@ int br_validate_ipv6(struct sk_buff *skb) | |||
104 | { | 104 | { |
105 | const struct ipv6hdr *hdr; | 105 | const struct ipv6hdr *hdr; |
106 | struct net_device *dev = skb->dev; | 106 | struct net_device *dev = skb->dev; |
107 | struct inet6_dev *idev = in6_dev_get(skb->dev); | 107 | struct inet6_dev *idev = __in6_dev_get(skb->dev); |
108 | u32 pkt_len; | 108 | u32 pkt_len; |
109 | u8 ip6h_len = sizeof(struct ipv6hdr); | 109 | u8 ip6h_len = sizeof(struct ipv6hdr); |
110 | 110 | ||
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index 6b67ed3831de..364bdc98bd9b 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -457,6 +457,8 @@ static int br_afspec(struct net_bridge *br, | |||
457 | if (nla_len(attr) != sizeof(struct bridge_vlan_info)) | 457 | if (nla_len(attr) != sizeof(struct bridge_vlan_info)) |
458 | return -EINVAL; | 458 | return -EINVAL; |
459 | vinfo = nla_data(attr); | 459 | vinfo = nla_data(attr); |
460 | if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK) | ||
461 | return -EINVAL; | ||
460 | if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) { | 462 | if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) { |
461 | if (vinfo_start) | 463 | if (vinfo_start) |
462 | return -EINVAL; | 464 | return -EINVAL; |
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c index 3cc71b9f5517..cc858919108e 100644 --- a/net/caif/caif_socket.c +++ b/net/caif/caif_socket.c | |||
@@ -121,12 +121,13 @@ static void caif_flow_ctrl(struct sock *sk, int mode) | |||
121 | * Copied from sock.c:sock_queue_rcv_skb(), but changed so packets are | 121 | * Copied from sock.c:sock_queue_rcv_skb(), but changed so packets are |
122 | * not dropped, but CAIF is sending flow off instead. | 122 | * not dropped, but CAIF is sending flow off instead. |
123 | */ | 123 | */ |
124 | static int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | 124 | static void caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) |
125 | { | 125 | { |
126 | int err; | 126 | int err; |
127 | unsigned long flags; | 127 | unsigned long flags; |
128 | struct sk_buff_head *list = &sk->sk_receive_queue; | 128 | struct sk_buff_head *list = &sk->sk_receive_queue; |
129 | struct caifsock *cf_sk = container_of(sk, struct caifsock, sk); | 129 | struct caifsock *cf_sk = container_of(sk, struct caifsock, sk); |
130 | bool queued = false; | ||
130 | 131 | ||
131 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= | 132 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= |
132 | (unsigned int)sk->sk_rcvbuf && rx_flow_is_on(cf_sk)) { | 133 | (unsigned int)sk->sk_rcvbuf && rx_flow_is_on(cf_sk)) { |
@@ -139,7 +140,8 @@ static int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
139 | 140 | ||
140 | err = sk_filter(sk, skb); | 141 | err = sk_filter(sk, skb); |
141 | if (err) | 142 | if (err) |
142 | return err; | 143 | goto out; |
144 | |||
143 | if (!sk_rmem_schedule(sk, skb, skb->truesize) && rx_flow_is_on(cf_sk)) { | 145 | if (!sk_rmem_schedule(sk, skb, skb->truesize) && rx_flow_is_on(cf_sk)) { |
144 | set_rx_flow_off(cf_sk); | 146 | set_rx_flow_off(cf_sk); |
145 | net_dbg_ratelimited("sending flow OFF due to rmem_schedule\n"); | 147 | net_dbg_ratelimited("sending flow OFF due to rmem_schedule\n"); |
@@ -147,21 +149,16 @@ static int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
147 | } | 149 | } |
148 | skb->dev = NULL; | 150 | skb->dev = NULL; |
149 | skb_set_owner_r(skb, sk); | 151 | skb_set_owner_r(skb, sk); |
150 | /* Cache the SKB length before we tack it onto the receive | ||
151 | * queue. Once it is added it no longer belongs to us and | ||
152 | * may be freed by other threads of control pulling packets | ||
153 | * from the queue. | ||
154 | */ | ||
155 | spin_lock_irqsave(&list->lock, flags); | 152 | spin_lock_irqsave(&list->lock, flags); |
156 | if (!sock_flag(sk, SOCK_DEAD)) | 153 | queued = !sock_flag(sk, SOCK_DEAD); |
154 | if (queued) | ||
157 | __skb_queue_tail(list, skb); | 155 | __skb_queue_tail(list, skb); |
158 | spin_unlock_irqrestore(&list->lock, flags); | 156 | spin_unlock_irqrestore(&list->lock, flags); |
159 | 157 | out: | |
160 | if (!sock_flag(sk, SOCK_DEAD)) | 158 | if (queued) |
161 | sk->sk_data_ready(sk); | 159 | sk->sk_data_ready(sk); |
162 | else | 160 | else |
163 | kfree_skb(skb); | 161 | kfree_skb(skb); |
164 | return 0; | ||
165 | } | 162 | } |
166 | 163 | ||
167 | /* Packet Receive Callback function called from CAIF Stack */ | 164 | /* Packet Receive Callback function called from CAIF Stack */ |
diff --git a/net/can/af_can.c b/net/can/af_can.c index 7933e62a7318..166d436196c1 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
@@ -89,6 +89,8 @@ struct timer_list can_stattimer; /* timer for statistics update */ | |||
89 | struct s_stats can_stats; /* packet statistics */ | 89 | struct s_stats can_stats; /* packet statistics */ |
90 | struct s_pstats can_pstats; /* receive list statistics */ | 90 | struct s_pstats can_pstats; /* receive list statistics */ |
91 | 91 | ||
92 | static atomic_t skbcounter = ATOMIC_INIT(0); | ||
93 | |||
92 | /* | 94 | /* |
93 | * af_can socket functions | 95 | * af_can socket functions |
94 | */ | 96 | */ |
@@ -310,12 +312,8 @@ int can_send(struct sk_buff *skb, int loop) | |||
310 | return err; | 312 | return err; |
311 | } | 313 | } |
312 | 314 | ||
313 | if (newskb) { | 315 | if (newskb) |
314 | if (!(newskb->tstamp.tv64)) | ||
315 | __net_timestamp(newskb); | ||
316 | |||
317 | netif_rx_ni(newskb); | 316 | netif_rx_ni(newskb); |
318 | } | ||
319 | 317 | ||
320 | /* update statistics */ | 318 | /* update statistics */ |
321 | can_stats.tx_frames++; | 319 | can_stats.tx_frames++; |
@@ -683,6 +681,10 @@ static void can_receive(struct sk_buff *skb, struct net_device *dev) | |||
683 | can_stats.rx_frames++; | 681 | can_stats.rx_frames++; |
684 | can_stats.rx_frames_delta++; | 682 | can_stats.rx_frames_delta++; |
685 | 683 | ||
684 | /* create non-zero unique skb identifier together with *skb */ | ||
685 | while (!(can_skb_prv(skb)->skbcnt)) | ||
686 | can_skb_prv(skb)->skbcnt = atomic_inc_return(&skbcounter); | ||
687 | |||
686 | rcu_read_lock(); | 688 | rcu_read_lock(); |
687 | 689 | ||
688 | /* deliver the packet to sockets listening on all devices */ | 690 | /* deliver the packet to sockets listening on all devices */ |
diff --git a/net/can/bcm.c b/net/can/bcm.c index b523453585be..a1ba6875c2a2 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c | |||
@@ -261,6 +261,7 @@ static void bcm_can_tx(struct bcm_op *op) | |||
261 | 261 | ||
262 | can_skb_reserve(skb); | 262 | can_skb_reserve(skb); |
263 | can_skb_prv(skb)->ifindex = dev->ifindex; | 263 | can_skb_prv(skb)->ifindex = dev->ifindex; |
264 | can_skb_prv(skb)->skbcnt = 0; | ||
264 | 265 | ||
265 | memcpy(skb_put(skb, CFSIZ), cf, CFSIZ); | 266 | memcpy(skb_put(skb, CFSIZ), cf, CFSIZ); |
266 | 267 | ||
@@ -1217,6 +1218,7 @@ static int bcm_tx_send(struct msghdr *msg, int ifindex, struct sock *sk) | |||
1217 | } | 1218 | } |
1218 | 1219 | ||
1219 | can_skb_prv(skb)->ifindex = dev->ifindex; | 1220 | can_skb_prv(skb)->ifindex = dev->ifindex; |
1221 | can_skb_prv(skb)->skbcnt = 0; | ||
1220 | skb->dev = dev; | 1222 | skb->dev = dev; |
1221 | can_skb_set_owner(skb, sk); | 1223 | can_skb_set_owner(skb, sk); |
1222 | err = can_send(skb, 1); /* send with loopback */ | 1224 | err = can_send(skb, 1); /* send with loopback */ |
diff --git a/net/can/raw.c b/net/can/raw.c index 31b9748cbb4e..2e67b1423cd3 100644 --- a/net/can/raw.c +++ b/net/can/raw.c | |||
@@ -75,7 +75,7 @@ MODULE_ALIAS("can-proto-1"); | |||
75 | */ | 75 | */ |
76 | 76 | ||
77 | struct uniqframe { | 77 | struct uniqframe { |
78 | ktime_t tstamp; | 78 | int skbcnt; |
79 | const struct sk_buff *skb; | 79 | const struct sk_buff *skb; |
80 | unsigned int join_rx_count; | 80 | unsigned int join_rx_count; |
81 | }; | 81 | }; |
@@ -133,7 +133,7 @@ static void raw_rcv(struct sk_buff *oskb, void *data) | |||
133 | 133 | ||
134 | /* eliminate multiple filter matches for the same skb */ | 134 | /* eliminate multiple filter matches for the same skb */ |
135 | if (this_cpu_ptr(ro->uniq)->skb == oskb && | 135 | if (this_cpu_ptr(ro->uniq)->skb == oskb && |
136 | ktime_equal(this_cpu_ptr(ro->uniq)->tstamp, oskb->tstamp)) { | 136 | this_cpu_ptr(ro->uniq)->skbcnt == can_skb_prv(oskb)->skbcnt) { |
137 | if (ro->join_filters) { | 137 | if (ro->join_filters) { |
138 | this_cpu_inc(ro->uniq->join_rx_count); | 138 | this_cpu_inc(ro->uniq->join_rx_count); |
139 | /* drop frame until all enabled filters matched */ | 139 | /* drop frame until all enabled filters matched */ |
@@ -144,7 +144,7 @@ static void raw_rcv(struct sk_buff *oskb, void *data) | |||
144 | } | 144 | } |
145 | } else { | 145 | } else { |
146 | this_cpu_ptr(ro->uniq)->skb = oskb; | 146 | this_cpu_ptr(ro->uniq)->skb = oskb; |
147 | this_cpu_ptr(ro->uniq)->tstamp = oskb->tstamp; | 147 | this_cpu_ptr(ro->uniq)->skbcnt = can_skb_prv(oskb)->skbcnt; |
148 | this_cpu_ptr(ro->uniq)->join_rx_count = 1; | 148 | this_cpu_ptr(ro->uniq)->join_rx_count = 1; |
149 | /* drop first frame to check all enabled filters? */ | 149 | /* drop first frame to check all enabled filters? */ |
150 | if (ro->join_filters && ro->count > 1) | 150 | if (ro->join_filters && ro->count > 1) |
@@ -749,6 +749,7 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) | |||
749 | 749 | ||
750 | can_skb_reserve(skb); | 750 | can_skb_reserve(skb); |
751 | can_skb_prv(skb)->ifindex = dev->ifindex; | 751 | can_skb_prv(skb)->ifindex = dev->ifindex; |
752 | can_skb_prv(skb)->skbcnt = 0; | ||
752 | 753 | ||
753 | err = memcpy_from_msg(skb_put(skb, size), msg, size); | 754 | err = memcpy_from_msg(skb_put(skb, size), msg, size); |
754 | if (err < 0) | 755 | if (err < 0) |
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index cb7db320dd27..f30329f72641 100644 --- a/net/ceph/ceph_common.c +++ b/net/ceph/ceph_common.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <keys/ceph-type.h> | 9 | #include <keys/ceph-type.h> |
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/mount.h> | 11 | #include <linux/mount.h> |
12 | #include <linux/nsproxy.h> | ||
12 | #include <linux/parser.h> | 13 | #include <linux/parser.h> |
13 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
14 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
@@ -16,8 +17,6 @@ | |||
16 | #include <linux/statfs.h> | 17 | #include <linux/statfs.h> |
17 | #include <linux/string.h> | 18 | #include <linux/string.h> |
18 | #include <linux/vmalloc.h> | 19 | #include <linux/vmalloc.h> |
19 | #include <linux/nsproxy.h> | ||
20 | #include <net/net_namespace.h> | ||
21 | 20 | ||
22 | 21 | ||
23 | #include <linux/ceph/ceph_features.h> | 22 | #include <linux/ceph/ceph_features.h> |
@@ -131,6 +130,13 @@ int ceph_compare_options(struct ceph_options *new_opt, | |||
131 | int i; | 130 | int i; |
132 | int ret; | 131 | int ret; |
133 | 132 | ||
133 | /* | ||
134 | * Don't bother comparing options if network namespaces don't | ||
135 | * match. | ||
136 | */ | ||
137 | if (!net_eq(current->nsproxy->net_ns, read_pnet(&client->msgr.net))) | ||
138 | return -1; | ||
139 | |||
134 | ret = memcmp(opt1, opt2, ofs); | 140 | ret = memcmp(opt1, opt2, ofs); |
135 | if (ret) | 141 | if (ret) |
136 | return ret; | 142 | return ret; |
@@ -335,9 +341,6 @@ ceph_parse_options(char *options, const char *dev_name, | |||
335 | int err = -ENOMEM; | 341 | int err = -ENOMEM; |
336 | substring_t argstr[MAX_OPT_ARGS]; | 342 | substring_t argstr[MAX_OPT_ARGS]; |
337 | 343 | ||
338 | if (current->nsproxy->net_ns != &init_net) | ||
339 | return ERR_PTR(-EINVAL); | ||
340 | |||
341 | opt = kzalloc(sizeof(*opt), GFP_KERNEL); | 344 | opt = kzalloc(sizeof(*opt), GFP_KERNEL); |
342 | if (!opt) | 345 | if (!opt) |
343 | return ERR_PTR(-ENOMEM); | 346 | return ERR_PTR(-ENOMEM); |
@@ -608,6 +611,7 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private, | |||
608 | fail_monc: | 611 | fail_monc: |
609 | ceph_monc_stop(&client->monc); | 612 | ceph_monc_stop(&client->monc); |
610 | fail: | 613 | fail: |
614 | ceph_messenger_fini(&client->msgr); | ||
611 | kfree(client); | 615 | kfree(client); |
612 | return ERR_PTR(err); | 616 | return ERR_PTR(err); |
613 | } | 617 | } |
@@ -621,8 +625,8 @@ void ceph_destroy_client(struct ceph_client *client) | |||
621 | 625 | ||
622 | /* unmount */ | 626 | /* unmount */ |
623 | ceph_osdc_stop(&client->osdc); | 627 | ceph_osdc_stop(&client->osdc); |
624 | |||
625 | ceph_monc_stop(&client->monc); | 628 | ceph_monc_stop(&client->monc); |
629 | ceph_messenger_fini(&client->msgr); | ||
626 | 630 | ||
627 | ceph_debugfs_client_cleanup(client); | 631 | ceph_debugfs_client_cleanup(client); |
628 | 632 | ||
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 1679f47280e2..e3be1d22a247 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/inet.h> | 6 | #include <linux/inet.h> |
7 | #include <linux/kthread.h> | 7 | #include <linux/kthread.h> |
8 | #include <linux/net.h> | 8 | #include <linux/net.h> |
9 | #include <linux/nsproxy.h> | ||
9 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
10 | #include <linux/socket.h> | 11 | #include <linux/socket.h> |
11 | #include <linux/string.h> | 12 | #include <linux/string.h> |
@@ -479,7 +480,7 @@ static int ceph_tcp_connect(struct ceph_connection *con) | |||
479 | int ret; | 480 | int ret; |
480 | 481 | ||
481 | BUG_ON(con->sock); | 482 | BUG_ON(con->sock); |
482 | ret = sock_create_kern(&init_net, con->peer_addr.in_addr.ss_family, | 483 | ret = sock_create_kern(read_pnet(&con->msgr->net), paddr->ss_family, |
483 | SOCK_STREAM, IPPROTO_TCP, &sock); | 484 | SOCK_STREAM, IPPROTO_TCP, &sock); |
484 | if (ret) | 485 | if (ret) |
485 | return ret; | 486 | return ret; |
@@ -1731,17 +1732,17 @@ static int verify_hello(struct ceph_connection *con) | |||
1731 | 1732 | ||
1732 | static bool addr_is_blank(struct sockaddr_storage *ss) | 1733 | static bool addr_is_blank(struct sockaddr_storage *ss) |
1733 | { | 1734 | { |
1735 | struct in_addr *addr = &((struct sockaddr_in *)ss)->sin_addr; | ||
1736 | struct in6_addr *addr6 = &((struct sockaddr_in6 *)ss)->sin6_addr; | ||
1737 | |||
1734 | switch (ss->ss_family) { | 1738 | switch (ss->ss_family) { |
1735 | case AF_INET: | 1739 | case AF_INET: |
1736 | return ((struct sockaddr_in *)ss)->sin_addr.s_addr == 0; | 1740 | return addr->s_addr == htonl(INADDR_ANY); |
1737 | case AF_INET6: | 1741 | case AF_INET6: |
1738 | return | 1742 | return ipv6_addr_any(addr6); |
1739 | ((struct sockaddr_in6 *)ss)->sin6_addr.s6_addr32[0] == 0 && | 1743 | default: |
1740 | ((struct sockaddr_in6 *)ss)->sin6_addr.s6_addr32[1] == 0 && | 1744 | return true; |
1741 | ((struct sockaddr_in6 *)ss)->sin6_addr.s6_addr32[2] == 0 && | ||
1742 | ((struct sockaddr_in6 *)ss)->sin6_addr.s6_addr32[3] == 0; | ||
1743 | } | 1745 | } |
1744 | return false; | ||
1745 | } | 1746 | } |
1746 | 1747 | ||
1747 | static int addr_port(struct sockaddr_storage *ss) | 1748 | static int addr_port(struct sockaddr_storage *ss) |
@@ -2944,11 +2945,18 @@ void ceph_messenger_init(struct ceph_messenger *msgr, | |||
2944 | msgr->tcp_nodelay = tcp_nodelay; | 2945 | msgr->tcp_nodelay = tcp_nodelay; |
2945 | 2946 | ||
2946 | atomic_set(&msgr->stopping, 0); | 2947 | atomic_set(&msgr->stopping, 0); |
2948 | write_pnet(&msgr->net, get_net(current->nsproxy->net_ns)); | ||
2947 | 2949 | ||
2948 | dout("%s %p\n", __func__, msgr); | 2950 | dout("%s %p\n", __func__, msgr); |
2949 | } | 2951 | } |
2950 | EXPORT_SYMBOL(ceph_messenger_init); | 2952 | EXPORT_SYMBOL(ceph_messenger_init); |
2951 | 2953 | ||
2954 | void ceph_messenger_fini(struct ceph_messenger *msgr) | ||
2955 | { | ||
2956 | put_net(read_pnet(&msgr->net)); | ||
2957 | } | ||
2958 | EXPORT_SYMBOL(ceph_messenger_fini); | ||
2959 | |||
2952 | static void clear_standby(struct ceph_connection *con) | 2960 | static void clear_standby(struct ceph_connection *con) |
2953 | { | 2961 | { |
2954 | /* come back from STANDBY? */ | 2962 | /* come back from STANDBY? */ |
diff --git a/net/core/datagram.c b/net/core/datagram.c index b80fb91bb3f7..4967262b2707 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
@@ -131,6 +131,35 @@ out_noerr: | |||
131 | goto out; | 131 | goto out; |
132 | } | 132 | } |
133 | 133 | ||
134 | static int skb_set_peeked(struct sk_buff *skb) | ||
135 | { | ||
136 | struct sk_buff *nskb; | ||
137 | |||
138 | if (skb->peeked) | ||
139 | return 0; | ||
140 | |||
141 | /* We have to unshare an skb before modifying it. */ | ||
142 | if (!skb_shared(skb)) | ||
143 | goto done; | ||
144 | |||
145 | nskb = skb_clone(skb, GFP_ATOMIC); | ||
146 | if (!nskb) | ||
147 | return -ENOMEM; | ||
148 | |||
149 | skb->prev->next = nskb; | ||
150 | skb->next->prev = nskb; | ||
151 | nskb->prev = skb->prev; | ||
152 | nskb->next = skb->next; | ||
153 | |||
154 | consume_skb(skb); | ||
155 | skb = nskb; | ||
156 | |||
157 | done: | ||
158 | skb->peeked = 1; | ||
159 | |||
160 | return 0; | ||
161 | } | ||
162 | |||
134 | /** | 163 | /** |
135 | * __skb_recv_datagram - Receive a datagram skbuff | 164 | * __skb_recv_datagram - Receive a datagram skbuff |
136 | * @sk: socket | 165 | * @sk: socket |
@@ -165,7 +194,9 @@ out_noerr: | |||
165 | struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags, | 194 | struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags, |
166 | int *peeked, int *off, int *err) | 195 | int *peeked, int *off, int *err) |
167 | { | 196 | { |
197 | struct sk_buff_head *queue = &sk->sk_receive_queue; | ||
168 | struct sk_buff *skb, *last; | 198 | struct sk_buff *skb, *last; |
199 | unsigned long cpu_flags; | ||
169 | long timeo; | 200 | long timeo; |
170 | /* | 201 | /* |
171 | * Caller is allowed not to check sk->sk_err before skb_recv_datagram() | 202 | * Caller is allowed not to check sk->sk_err before skb_recv_datagram() |
@@ -184,8 +215,6 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags, | |||
184 | * Look at current nfs client by the way... | 215 | * Look at current nfs client by the way... |
185 | * However, this function was correct in any case. 8) | 216 | * However, this function was correct in any case. 8) |
186 | */ | 217 | */ |
187 | unsigned long cpu_flags; | ||
188 | struct sk_buff_head *queue = &sk->sk_receive_queue; | ||
189 | int _off = *off; | 218 | int _off = *off; |
190 | 219 | ||
191 | last = (struct sk_buff *)queue; | 220 | last = (struct sk_buff *)queue; |
@@ -199,7 +228,11 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags, | |||
199 | _off -= skb->len; | 228 | _off -= skb->len; |
200 | continue; | 229 | continue; |
201 | } | 230 | } |
202 | skb->peeked = 1; | 231 | |
232 | error = skb_set_peeked(skb); | ||
233 | if (error) | ||
234 | goto unlock_err; | ||
235 | |||
203 | atomic_inc(&skb->users); | 236 | atomic_inc(&skb->users); |
204 | } else | 237 | } else |
205 | __skb_unlink(skb, queue); | 238 | __skb_unlink(skb, queue); |
@@ -223,6 +256,8 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags, | |||
223 | 256 | ||
224 | return NULL; | 257 | return NULL; |
225 | 258 | ||
259 | unlock_err: | ||
260 | spin_unlock_irqrestore(&queue->lock, cpu_flags); | ||
226 | no_packet: | 261 | no_packet: |
227 | *err = error; | 262 | *err = error; |
228 | return NULL; | 263 | return NULL; |
@@ -622,7 +657,8 @@ __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len) | |||
622 | !skb->csum_complete_sw) | 657 | !skb->csum_complete_sw) |
623 | netdev_rx_csum_fault(skb->dev); | 658 | netdev_rx_csum_fault(skb->dev); |
624 | } | 659 | } |
625 | skb->csum_valid = !sum; | 660 | if (!skb_shared(skb)) |
661 | skb->csum_valid = !sum; | ||
626 | return sum; | 662 | return sum; |
627 | } | 663 | } |
628 | EXPORT_SYMBOL(__skb_checksum_complete_head); | 664 | EXPORT_SYMBOL(__skb_checksum_complete_head); |
@@ -642,11 +678,13 @@ __sum16 __skb_checksum_complete(struct sk_buff *skb) | |||
642 | netdev_rx_csum_fault(skb->dev); | 678 | netdev_rx_csum_fault(skb->dev); |
643 | } | 679 | } |
644 | 680 | ||
645 | /* Save full packet checksum */ | 681 | if (!skb_shared(skb)) { |
646 | skb->csum = csum; | 682 | /* Save full packet checksum */ |
647 | skb->ip_summed = CHECKSUM_COMPLETE; | 683 | skb->csum = csum; |
648 | skb->csum_complete_sw = 1; | 684 | skb->ip_summed = CHECKSUM_COMPLETE; |
649 | skb->csum_valid = !sum; | 685 | skb->csum_complete_sw = 1; |
686 | skb->csum_valid = !sum; | ||
687 | } | ||
650 | 688 | ||
651 | return sum; | 689 | return sum; |
652 | } | 690 | } |
diff --git a/net/core/dev.c b/net/core/dev.c index 6778a9999d52..a8e4dd430285 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -677,10 +677,6 @@ int dev_get_iflink(const struct net_device *dev) | |||
677 | if (dev->netdev_ops && dev->netdev_ops->ndo_get_iflink) | 677 | if (dev->netdev_ops && dev->netdev_ops->ndo_get_iflink) |
678 | return dev->netdev_ops->ndo_get_iflink(dev); | 678 | return dev->netdev_ops->ndo_get_iflink(dev); |
679 | 679 | ||
680 | /* If dev->rtnl_link_ops is set, it's a virtual interface. */ | ||
681 | if (dev->rtnl_link_ops) | ||
682 | return 0; | ||
683 | |||
684 | return dev->ifindex; | 680 | return dev->ifindex; |
685 | } | 681 | } |
686 | EXPORT_SYMBOL(dev_get_iflink); | 682 | EXPORT_SYMBOL(dev_get_iflink); |
@@ -3452,6 +3448,8 @@ static int enqueue_to_backlog(struct sk_buff *skb, int cpu, | |||
3452 | local_irq_save(flags); | 3448 | local_irq_save(flags); |
3453 | 3449 | ||
3454 | rps_lock(sd); | 3450 | rps_lock(sd); |
3451 | if (!netif_running(skb->dev)) | ||
3452 | goto drop; | ||
3455 | qlen = skb_queue_len(&sd->input_pkt_queue); | 3453 | qlen = skb_queue_len(&sd->input_pkt_queue); |
3456 | if (qlen <= netdev_max_backlog && !skb_flow_limit(skb, qlen)) { | 3454 | if (qlen <= netdev_max_backlog && !skb_flow_limit(skb, qlen)) { |
3457 | if (qlen) { | 3455 | if (qlen) { |
@@ -3473,6 +3471,7 @@ enqueue: | |||
3473 | goto enqueue; | 3471 | goto enqueue; |
3474 | } | 3472 | } |
3475 | 3473 | ||
3474 | drop: | ||
3476 | sd->dropped++; | 3475 | sd->dropped++; |
3477 | rps_unlock(sd); | 3476 | rps_unlock(sd); |
3478 | 3477 | ||
@@ -3775,8 +3774,6 @@ static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc) | |||
3775 | 3774 | ||
3776 | pt_prev = NULL; | 3775 | pt_prev = NULL; |
3777 | 3776 | ||
3778 | rcu_read_lock(); | ||
3779 | |||
3780 | another_round: | 3777 | another_round: |
3781 | skb->skb_iif = skb->dev->ifindex; | 3778 | skb->skb_iif = skb->dev->ifindex; |
3782 | 3779 | ||
@@ -3786,7 +3783,7 @@ another_round: | |||
3786 | skb->protocol == cpu_to_be16(ETH_P_8021AD)) { | 3783 | skb->protocol == cpu_to_be16(ETH_P_8021AD)) { |
3787 | skb = skb_vlan_untag(skb); | 3784 | skb = skb_vlan_untag(skb); |
3788 | if (unlikely(!skb)) | 3785 | if (unlikely(!skb)) |
3789 | goto unlock; | 3786 | goto out; |
3790 | } | 3787 | } |
3791 | 3788 | ||
3792 | #ifdef CONFIG_NET_CLS_ACT | 3789 | #ifdef CONFIG_NET_CLS_ACT |
@@ -3816,10 +3813,10 @@ skip_taps: | |||
3816 | if (static_key_false(&ingress_needed)) { | 3813 | if (static_key_false(&ingress_needed)) { |
3817 | skb = handle_ing(skb, &pt_prev, &ret, orig_dev); | 3814 | skb = handle_ing(skb, &pt_prev, &ret, orig_dev); |
3818 | if (!skb) | 3815 | if (!skb) |
3819 | goto unlock; | 3816 | goto out; |
3820 | 3817 | ||
3821 | if (nf_ingress(skb, &pt_prev, &ret, orig_dev) < 0) | 3818 | if (nf_ingress(skb, &pt_prev, &ret, orig_dev) < 0) |
3822 | goto unlock; | 3819 | goto out; |
3823 | } | 3820 | } |
3824 | #endif | 3821 | #endif |
3825 | #ifdef CONFIG_NET_CLS_ACT | 3822 | #ifdef CONFIG_NET_CLS_ACT |
@@ -3837,7 +3834,7 @@ ncls: | |||
3837 | if (vlan_do_receive(&skb)) | 3834 | if (vlan_do_receive(&skb)) |
3838 | goto another_round; | 3835 | goto another_round; |
3839 | else if (unlikely(!skb)) | 3836 | else if (unlikely(!skb)) |
3840 | goto unlock; | 3837 | goto out; |
3841 | } | 3838 | } |
3842 | 3839 | ||
3843 | rx_handler = rcu_dereference(skb->dev->rx_handler); | 3840 | rx_handler = rcu_dereference(skb->dev->rx_handler); |
@@ -3849,7 +3846,7 @@ ncls: | |||
3849 | switch (rx_handler(&skb)) { | 3846 | switch (rx_handler(&skb)) { |
3850 | case RX_HANDLER_CONSUMED: | 3847 | case RX_HANDLER_CONSUMED: |
3851 | ret = NET_RX_SUCCESS; | 3848 | ret = NET_RX_SUCCESS; |
3852 | goto unlock; | 3849 | goto out; |
3853 | case RX_HANDLER_ANOTHER: | 3850 | case RX_HANDLER_ANOTHER: |
3854 | goto another_round; | 3851 | goto another_round; |
3855 | case RX_HANDLER_EXACT: | 3852 | case RX_HANDLER_EXACT: |
@@ -3903,8 +3900,7 @@ drop: | |||
3903 | ret = NET_RX_DROP; | 3900 | ret = NET_RX_DROP; |
3904 | } | 3901 | } |
3905 | 3902 | ||
3906 | unlock: | 3903 | out: |
3907 | rcu_read_unlock(); | ||
3908 | return ret; | 3904 | return ret; |
3909 | } | 3905 | } |
3910 | 3906 | ||
@@ -3935,29 +3931,30 @@ static int __netif_receive_skb(struct sk_buff *skb) | |||
3935 | 3931 | ||
3936 | static int netif_receive_skb_internal(struct sk_buff *skb) | 3932 | static int netif_receive_skb_internal(struct sk_buff *skb) |
3937 | { | 3933 | { |
3934 | int ret; | ||
3935 | |||
3938 | net_timestamp_check(netdev_tstamp_prequeue, skb); | 3936 | net_timestamp_check(netdev_tstamp_prequeue, skb); |
3939 | 3937 | ||
3940 | if (skb_defer_rx_timestamp(skb)) | 3938 | if (skb_defer_rx_timestamp(skb)) |
3941 | return NET_RX_SUCCESS; | 3939 | return NET_RX_SUCCESS; |
3942 | 3940 | ||
3941 | rcu_read_lock(); | ||
3942 | |||
3943 | #ifdef CONFIG_RPS | 3943 | #ifdef CONFIG_RPS |
3944 | if (static_key_false(&rps_needed)) { | 3944 | if (static_key_false(&rps_needed)) { |
3945 | struct rps_dev_flow voidflow, *rflow = &voidflow; | 3945 | struct rps_dev_flow voidflow, *rflow = &voidflow; |
3946 | int cpu, ret; | 3946 | int cpu = get_rps_cpu(skb->dev, skb, &rflow); |
3947 | |||
3948 | rcu_read_lock(); | ||
3949 | |||
3950 | cpu = get_rps_cpu(skb->dev, skb, &rflow); | ||
3951 | 3947 | ||
3952 | if (cpu >= 0) { | 3948 | if (cpu >= 0) { |
3953 | ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail); | 3949 | ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail); |
3954 | rcu_read_unlock(); | 3950 | rcu_read_unlock(); |
3955 | return ret; | 3951 | return ret; |
3956 | } | 3952 | } |
3957 | rcu_read_unlock(); | ||
3958 | } | 3953 | } |
3959 | #endif | 3954 | #endif |
3960 | return __netif_receive_skb(skb); | 3955 | ret = __netif_receive_skb(skb); |
3956 | rcu_read_unlock(); | ||
3957 | return ret; | ||
3961 | } | 3958 | } |
3962 | 3959 | ||
3963 | /** | 3960 | /** |
@@ -4502,8 +4499,10 @@ static int process_backlog(struct napi_struct *napi, int quota) | |||
4502 | struct sk_buff *skb; | 4499 | struct sk_buff *skb; |
4503 | 4500 | ||
4504 | while ((skb = __skb_dequeue(&sd->process_queue))) { | 4501 | while ((skb = __skb_dequeue(&sd->process_queue))) { |
4502 | rcu_read_lock(); | ||
4505 | local_irq_enable(); | 4503 | local_irq_enable(); |
4506 | __netif_receive_skb(skb); | 4504 | __netif_receive_skb(skb); |
4505 | rcu_read_unlock(); | ||
4507 | local_irq_disable(); | 4506 | local_irq_disable(); |
4508 | input_queue_head_incr(sd); | 4507 | input_queue_head_incr(sd); |
4509 | if (++work >= quota) { | 4508 | if (++work >= quota) { |
@@ -6139,6 +6138,7 @@ static void rollback_registered_many(struct list_head *head) | |||
6139 | unlist_netdevice(dev); | 6138 | unlist_netdevice(dev); |
6140 | 6139 | ||
6141 | dev->reg_state = NETREG_UNREGISTERING; | 6140 | dev->reg_state = NETREG_UNREGISTERING; |
6141 | on_each_cpu(flush_backlog, dev, 1); | ||
6142 | } | 6142 | } |
6143 | 6143 | ||
6144 | synchronize_net(); | 6144 | synchronize_net(); |
@@ -6409,7 +6409,8 @@ static int netif_alloc_netdev_queues(struct net_device *dev) | |||
6409 | struct netdev_queue *tx; | 6409 | struct netdev_queue *tx; |
6410 | size_t sz = count * sizeof(*tx); | 6410 | size_t sz = count * sizeof(*tx); |
6411 | 6411 | ||
6412 | BUG_ON(count < 1 || count > 0xffff); | 6412 | if (count < 1 || count > 0xffff) |
6413 | return -EINVAL; | ||
6413 | 6414 | ||
6414 | tx = kzalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); | 6415 | tx = kzalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); |
6415 | if (!tx) { | 6416 | if (!tx) { |
@@ -6773,8 +6774,6 @@ void netdev_run_todo(void) | |||
6773 | 6774 | ||
6774 | dev->reg_state = NETREG_UNREGISTERED; | 6775 | dev->reg_state = NETREG_UNREGISTERED; |
6775 | 6776 | ||
6776 | on_each_cpu(flush_backlog, dev, 1); | ||
6777 | |||
6778 | netdev_wait_allrefs(dev); | 6777 | netdev_wait_allrefs(dev); |
6779 | 6778 | ||
6780 | /* paranoia */ | 6779 | /* paranoia */ |
diff --git a/net/core/dst.c b/net/core/dst.c index e956ce6d1378..002144bea935 100644 --- a/net/core/dst.c +++ b/net/core/dst.c | |||
@@ -284,7 +284,9 @@ void dst_release(struct dst_entry *dst) | |||
284 | int newrefcnt; | 284 | int newrefcnt; |
285 | 285 | ||
286 | newrefcnt = atomic_dec_return(&dst->__refcnt); | 286 | newrefcnt = atomic_dec_return(&dst->__refcnt); |
287 | WARN_ON(newrefcnt < 0); | 287 | if (unlikely(newrefcnt < 0)) |
288 | net_warn_ratelimited("%s: dst:%p refcnt:%d\n", | ||
289 | __func__, dst, newrefcnt); | ||
288 | if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) | 290 | if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) |
289 | call_rcu(&dst->rcu_head, dst_destroy_rcu); | 291 | call_rcu(&dst->rcu_head, dst_destroy_rcu); |
290 | } | 292 | } |
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c index 9dfb88a933e7..92d886f4adcb 100644 --- a/net/core/gen_estimator.c +++ b/net/core/gen_estimator.c | |||
@@ -66,7 +66,7 @@ | |||
66 | 66 | ||
67 | NOTES. | 67 | NOTES. |
68 | 68 | ||
69 | * avbps is scaled by 2^5, avpps is scaled by 2^10. | 69 | * avbps and avpps are scaled by 2^5. |
70 | * both values are reported as 32 bit unsigned values. bps can | 70 | * both values are reported as 32 bit unsigned values. bps can |
71 | overflow for fast links : max speed being 34360Mbit/sec | 71 | overflow for fast links : max speed being 34360Mbit/sec |
72 | * Minimal interval is HZ/4=250msec (it is the greatest common divisor | 72 | * Minimal interval is HZ/4=250msec (it is the greatest common divisor |
@@ -85,10 +85,10 @@ struct gen_estimator | |||
85 | struct gnet_stats_rate_est64 *rate_est; | 85 | struct gnet_stats_rate_est64 *rate_est; |
86 | spinlock_t *stats_lock; | 86 | spinlock_t *stats_lock; |
87 | int ewma_log; | 87 | int ewma_log; |
88 | u32 last_packets; | ||
89 | unsigned long avpps; | ||
88 | u64 last_bytes; | 90 | u64 last_bytes; |
89 | u64 avbps; | 91 | u64 avbps; |
90 | u32 last_packets; | ||
91 | u32 avpps; | ||
92 | struct rcu_head e_rcu; | 92 | struct rcu_head e_rcu; |
93 | struct rb_node node; | 93 | struct rb_node node; |
94 | struct gnet_stats_basic_cpu __percpu *cpu_bstats; | 94 | struct gnet_stats_basic_cpu __percpu *cpu_bstats; |
@@ -118,8 +118,8 @@ static void est_timer(unsigned long arg) | |||
118 | rcu_read_lock(); | 118 | rcu_read_lock(); |
119 | list_for_each_entry_rcu(e, &elist[idx].list, list) { | 119 | list_for_each_entry_rcu(e, &elist[idx].list, list) { |
120 | struct gnet_stats_basic_packed b = {0}; | 120 | struct gnet_stats_basic_packed b = {0}; |
121 | unsigned long rate; | ||
121 | u64 brate; | 122 | u64 brate; |
122 | u32 rate; | ||
123 | 123 | ||
124 | spin_lock(e->stats_lock); | 124 | spin_lock(e->stats_lock); |
125 | read_lock(&est_lock); | 125 | read_lock(&est_lock); |
@@ -133,10 +133,11 @@ static void est_timer(unsigned long arg) | |||
133 | e->avbps += (brate >> e->ewma_log) - (e->avbps >> e->ewma_log); | 133 | e->avbps += (brate >> e->ewma_log) - (e->avbps >> e->ewma_log); |
134 | e->rate_est->bps = (e->avbps+0xF)>>5; | 134 | e->rate_est->bps = (e->avbps+0xF)>>5; |
135 | 135 | ||
136 | rate = (b.packets - e->last_packets)<<(12 - idx); | 136 | rate = b.packets - e->last_packets; |
137 | rate <<= (7 - idx); | ||
137 | e->last_packets = b.packets; | 138 | e->last_packets = b.packets; |
138 | e->avpps += (rate >> e->ewma_log) - (e->avpps >> e->ewma_log); | 139 | e->avpps += (rate >> e->ewma_log) - (e->avpps >> e->ewma_log); |
139 | e->rate_est->pps = (e->avpps+0x1FF)>>10; | 140 | e->rate_est->pps = (e->avpps + 0xF) >> 5; |
140 | skip: | 141 | skip: |
141 | read_unlock(&est_lock); | 142 | read_unlock(&est_lock); |
142 | spin_unlock(e->stats_lock); | 143 | spin_unlock(e->stats_lock); |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 05badbb58865..1ebdf1c0d118 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -3571,13 +3571,6 @@ static int pktgen_thread_worker(void *arg) | |||
3571 | pr_debug("%s removing thread\n", t->tsk->comm); | 3571 | pr_debug("%s removing thread\n", t->tsk->comm); |
3572 | pktgen_rem_thread(t); | 3572 | pktgen_rem_thread(t); |
3573 | 3573 | ||
3574 | /* Wait for kthread_stop */ | ||
3575 | while (!kthread_should_stop()) { | ||
3576 | set_current_state(TASK_INTERRUPTIBLE); | ||
3577 | schedule(); | ||
3578 | } | ||
3579 | __set_current_state(TASK_RUNNING); | ||
3580 | |||
3581 | return 0; | 3574 | return 0; |
3582 | } | 3575 | } |
3583 | 3576 | ||
@@ -3769,6 +3762,7 @@ static int __net_init pktgen_create_thread(int cpu, struct pktgen_net *pn) | |||
3769 | } | 3762 | } |
3770 | 3763 | ||
3771 | t->net = pn; | 3764 | t->net = pn; |
3765 | get_task_struct(p); | ||
3772 | wake_up_process(p); | 3766 | wake_up_process(p); |
3773 | wait_for_completion(&t->start_done); | 3767 | wait_for_completion(&t->start_done); |
3774 | 3768 | ||
@@ -3891,6 +3885,7 @@ static void __net_exit pg_net_exit(struct net *net) | |||
3891 | t = list_entry(q, struct pktgen_thread, th_list); | 3885 | t = list_entry(q, struct pktgen_thread, th_list); |
3892 | list_del(&t->th_list); | 3886 | list_del(&t->th_list); |
3893 | kthread_stop(t->tsk); | 3887 | kthread_stop(t->tsk); |
3888 | put_task_struct(t->tsk); | ||
3894 | kfree(t); | 3889 | kfree(t); |
3895 | } | 3890 | } |
3896 | 3891 | ||
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 01ced4a889e0..dc004b1e1f85 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -1328,10 +1328,6 @@ static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { | |||
1328 | [IFLA_INFO_SLAVE_DATA] = { .type = NLA_NESTED }, | 1328 | [IFLA_INFO_SLAVE_DATA] = { .type = NLA_NESTED }, |
1329 | }; | 1329 | }; |
1330 | 1330 | ||
1331 | static const struct nla_policy ifla_vfinfo_policy[IFLA_VF_INFO_MAX+1] = { | ||
1332 | [IFLA_VF_INFO] = { .type = NLA_NESTED }, | ||
1333 | }; | ||
1334 | |||
1335 | static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { | 1331 | static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { |
1336 | [IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) }, | 1332 | [IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) }, |
1337 | [IFLA_VF_VLAN] = { .len = sizeof(struct ifla_vf_vlan) }, | 1333 | [IFLA_VF_VLAN] = { .len = sizeof(struct ifla_vf_vlan) }, |
@@ -1488,96 +1484,98 @@ static int validate_linkmsg(struct net_device *dev, struct nlattr *tb[]) | |||
1488 | return 0; | 1484 | return 0; |
1489 | } | 1485 | } |
1490 | 1486 | ||
1491 | static int do_setvfinfo(struct net_device *dev, struct nlattr *attr) | 1487 | static int do_setvfinfo(struct net_device *dev, struct nlattr **tb) |
1492 | { | 1488 | { |
1493 | int rem, err = -EINVAL; | ||
1494 | struct nlattr *vf; | ||
1495 | const struct net_device_ops *ops = dev->netdev_ops; | 1489 | const struct net_device_ops *ops = dev->netdev_ops; |
1490 | int err = -EINVAL; | ||
1496 | 1491 | ||
1497 | nla_for_each_nested(vf, attr, rem) { | 1492 | if (tb[IFLA_VF_MAC]) { |
1498 | switch (nla_type(vf)) { | 1493 | struct ifla_vf_mac *ivm = nla_data(tb[IFLA_VF_MAC]); |
1499 | case IFLA_VF_MAC: { | ||
1500 | struct ifla_vf_mac *ivm; | ||
1501 | ivm = nla_data(vf); | ||
1502 | err = -EOPNOTSUPP; | ||
1503 | if (ops->ndo_set_vf_mac) | ||
1504 | err = ops->ndo_set_vf_mac(dev, ivm->vf, | ||
1505 | ivm->mac); | ||
1506 | break; | ||
1507 | } | ||
1508 | case IFLA_VF_VLAN: { | ||
1509 | struct ifla_vf_vlan *ivv; | ||
1510 | ivv = nla_data(vf); | ||
1511 | err = -EOPNOTSUPP; | ||
1512 | if (ops->ndo_set_vf_vlan) | ||
1513 | err = ops->ndo_set_vf_vlan(dev, ivv->vf, | ||
1514 | ivv->vlan, | ||
1515 | ivv->qos); | ||
1516 | break; | ||
1517 | } | ||
1518 | case IFLA_VF_TX_RATE: { | ||
1519 | struct ifla_vf_tx_rate *ivt; | ||
1520 | struct ifla_vf_info ivf; | ||
1521 | ivt = nla_data(vf); | ||
1522 | err = -EOPNOTSUPP; | ||
1523 | if (ops->ndo_get_vf_config) | ||
1524 | err = ops->ndo_get_vf_config(dev, ivt->vf, | ||
1525 | &ivf); | ||
1526 | if (err) | ||
1527 | break; | ||
1528 | err = -EOPNOTSUPP; | ||
1529 | if (ops->ndo_set_vf_rate) | ||
1530 | err = ops->ndo_set_vf_rate(dev, ivt->vf, | ||
1531 | ivf.min_tx_rate, | ||
1532 | ivt->rate); | ||
1533 | break; | ||
1534 | } | ||
1535 | case IFLA_VF_RATE: { | ||
1536 | struct ifla_vf_rate *ivt; | ||
1537 | ivt = nla_data(vf); | ||
1538 | err = -EOPNOTSUPP; | ||
1539 | if (ops->ndo_set_vf_rate) | ||
1540 | err = ops->ndo_set_vf_rate(dev, ivt->vf, | ||
1541 | ivt->min_tx_rate, | ||
1542 | ivt->max_tx_rate); | ||
1543 | break; | ||
1544 | } | ||
1545 | case IFLA_VF_SPOOFCHK: { | ||
1546 | struct ifla_vf_spoofchk *ivs; | ||
1547 | ivs = nla_data(vf); | ||
1548 | err = -EOPNOTSUPP; | ||
1549 | if (ops->ndo_set_vf_spoofchk) | ||
1550 | err = ops->ndo_set_vf_spoofchk(dev, ivs->vf, | ||
1551 | ivs->setting); | ||
1552 | break; | ||
1553 | } | ||
1554 | case IFLA_VF_LINK_STATE: { | ||
1555 | struct ifla_vf_link_state *ivl; | ||
1556 | ivl = nla_data(vf); | ||
1557 | err = -EOPNOTSUPP; | ||
1558 | if (ops->ndo_set_vf_link_state) | ||
1559 | err = ops->ndo_set_vf_link_state(dev, ivl->vf, | ||
1560 | ivl->link_state); | ||
1561 | break; | ||
1562 | } | ||
1563 | case IFLA_VF_RSS_QUERY_EN: { | ||
1564 | struct ifla_vf_rss_query_en *ivrssq_en; | ||
1565 | 1494 | ||
1566 | ivrssq_en = nla_data(vf); | 1495 | err = -EOPNOTSUPP; |
1567 | err = -EOPNOTSUPP; | 1496 | if (ops->ndo_set_vf_mac) |
1568 | if (ops->ndo_set_vf_rss_query_en) | 1497 | err = ops->ndo_set_vf_mac(dev, ivm->vf, |
1569 | err = ops->ndo_set_vf_rss_query_en(dev, | 1498 | ivm->mac); |
1570 | ivrssq_en->vf, | 1499 | if (err < 0) |
1571 | ivrssq_en->setting); | 1500 | return err; |
1572 | break; | 1501 | } |
1573 | } | 1502 | |
1574 | default: | 1503 | if (tb[IFLA_VF_VLAN]) { |
1575 | err = -EINVAL; | 1504 | struct ifla_vf_vlan *ivv = nla_data(tb[IFLA_VF_VLAN]); |
1576 | break; | 1505 | |
1577 | } | 1506 | err = -EOPNOTSUPP; |
1578 | if (err) | 1507 | if (ops->ndo_set_vf_vlan) |
1579 | break; | 1508 | err = ops->ndo_set_vf_vlan(dev, ivv->vf, ivv->vlan, |
1509 | ivv->qos); | ||
1510 | if (err < 0) | ||
1511 | return err; | ||
1512 | } | ||
1513 | |||
1514 | if (tb[IFLA_VF_TX_RATE]) { | ||
1515 | struct ifla_vf_tx_rate *ivt = nla_data(tb[IFLA_VF_TX_RATE]); | ||
1516 | struct ifla_vf_info ivf; | ||
1517 | |||
1518 | err = -EOPNOTSUPP; | ||
1519 | if (ops->ndo_get_vf_config) | ||
1520 | err = ops->ndo_get_vf_config(dev, ivt->vf, &ivf); | ||
1521 | if (err < 0) | ||
1522 | return err; | ||
1523 | |||
1524 | err = -EOPNOTSUPP; | ||
1525 | if (ops->ndo_set_vf_rate) | ||
1526 | err = ops->ndo_set_vf_rate(dev, ivt->vf, | ||
1527 | ivf.min_tx_rate, | ||
1528 | ivt->rate); | ||
1529 | if (err < 0) | ||
1530 | return err; | ||
1531 | } | ||
1532 | |||
1533 | if (tb[IFLA_VF_RATE]) { | ||
1534 | struct ifla_vf_rate *ivt = nla_data(tb[IFLA_VF_RATE]); | ||
1535 | |||
1536 | err = -EOPNOTSUPP; | ||
1537 | if (ops->ndo_set_vf_rate) | ||
1538 | err = ops->ndo_set_vf_rate(dev, ivt->vf, | ||
1539 | ivt->min_tx_rate, | ||
1540 | ivt->max_tx_rate); | ||
1541 | if (err < 0) | ||
1542 | return err; | ||
1543 | } | ||
1544 | |||
1545 | if (tb[IFLA_VF_SPOOFCHK]) { | ||
1546 | struct ifla_vf_spoofchk *ivs = nla_data(tb[IFLA_VF_SPOOFCHK]); | ||
1547 | |||
1548 | err = -EOPNOTSUPP; | ||
1549 | if (ops->ndo_set_vf_spoofchk) | ||
1550 | err = ops->ndo_set_vf_spoofchk(dev, ivs->vf, | ||
1551 | ivs->setting); | ||
1552 | if (err < 0) | ||
1553 | return err; | ||
1580 | } | 1554 | } |
1555 | |||
1556 | if (tb[IFLA_VF_LINK_STATE]) { | ||
1557 | struct ifla_vf_link_state *ivl = nla_data(tb[IFLA_VF_LINK_STATE]); | ||
1558 | |||
1559 | err = -EOPNOTSUPP; | ||
1560 | if (ops->ndo_set_vf_link_state) | ||
1561 | err = ops->ndo_set_vf_link_state(dev, ivl->vf, | ||
1562 | ivl->link_state); | ||
1563 | if (err < 0) | ||
1564 | return err; | ||
1565 | } | ||
1566 | |||
1567 | if (tb[IFLA_VF_RSS_QUERY_EN]) { | ||
1568 | struct ifla_vf_rss_query_en *ivrssq_en; | ||
1569 | |||
1570 | err = -EOPNOTSUPP; | ||
1571 | ivrssq_en = nla_data(tb[IFLA_VF_RSS_QUERY_EN]); | ||
1572 | if (ops->ndo_set_vf_rss_query_en) | ||
1573 | err = ops->ndo_set_vf_rss_query_en(dev, ivrssq_en->vf, | ||
1574 | ivrssq_en->setting); | ||
1575 | if (err < 0) | ||
1576 | return err; | ||
1577 | } | ||
1578 | |||
1581 | return err; | 1579 | return err; |
1582 | } | 1580 | } |
1583 | 1581 | ||
@@ -1773,14 +1771,21 @@ static int do_setlink(const struct sk_buff *skb, | |||
1773 | } | 1771 | } |
1774 | 1772 | ||
1775 | if (tb[IFLA_VFINFO_LIST]) { | 1773 | if (tb[IFLA_VFINFO_LIST]) { |
1774 | struct nlattr *vfinfo[IFLA_VF_MAX + 1]; | ||
1776 | struct nlattr *attr; | 1775 | struct nlattr *attr; |
1777 | int rem; | 1776 | int rem; |
1777 | |||
1778 | nla_for_each_nested(attr, tb[IFLA_VFINFO_LIST], rem) { | 1778 | nla_for_each_nested(attr, tb[IFLA_VFINFO_LIST], rem) { |
1779 | if (nla_type(attr) != IFLA_VF_INFO) { | 1779 | if (nla_type(attr) != IFLA_VF_INFO || |
1780 | nla_len(attr) < NLA_HDRLEN) { | ||
1780 | err = -EINVAL; | 1781 | err = -EINVAL; |
1781 | goto errout; | 1782 | goto errout; |
1782 | } | 1783 | } |
1783 | err = do_setvfinfo(dev, attr); | 1784 | err = nla_parse_nested(vfinfo, IFLA_VF_MAX, attr, |
1785 | ifla_vf_policy); | ||
1786 | if (err < 0) | ||
1787 | goto errout; | ||
1788 | err = do_setvfinfo(dev, vfinfo); | ||
1784 | if (err < 0) | 1789 | if (err < 0) |
1785 | goto errout; | 1790 | goto errout; |
1786 | status |= DO_SETLINK_NOTIFY; | 1791 | status |= DO_SETLINK_NOTIFY; |
@@ -1799,10 +1804,13 @@ static int do_setlink(const struct sk_buff *skb, | |||
1799 | goto errout; | 1804 | goto errout; |
1800 | 1805 | ||
1801 | nla_for_each_nested(attr, tb[IFLA_VF_PORTS], rem) { | 1806 | nla_for_each_nested(attr, tb[IFLA_VF_PORTS], rem) { |
1802 | if (nla_type(attr) != IFLA_VF_PORT) | 1807 | if (nla_type(attr) != IFLA_VF_PORT || |
1803 | continue; | 1808 | nla_len(attr) < NLA_HDRLEN) { |
1804 | err = nla_parse_nested(port, IFLA_PORT_MAX, | 1809 | err = -EINVAL; |
1805 | attr, ifla_port_policy); | 1810 | goto errout; |
1811 | } | ||
1812 | err = nla_parse_nested(port, IFLA_PORT_MAX, attr, | ||
1813 | ifla_port_policy); | ||
1806 | if (err < 0) | 1814 | if (err < 0) |
1807 | goto errout; | 1815 | goto errout; |
1808 | if (!port[IFLA_PORT_VF]) { | 1816 | if (!port[IFLA_PORT_VF]) { |
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 392e29a0227d..b445d492c115 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -630,7 +630,7 @@ static int dsa_of_probe(struct device *dev) | |||
630 | continue; | 630 | continue; |
631 | 631 | ||
632 | cd->sw_addr = be32_to_cpup(sw_addr); | 632 | cd->sw_addr = be32_to_cpup(sw_addr); |
633 | if (cd->sw_addr > PHY_MAX_ADDR) | 633 | if (cd->sw_addr >= PHY_MAX_ADDR) |
634 | continue; | 634 | continue; |
635 | 635 | ||
636 | if (!of_property_read_u32(child, "eeprom-length", &eeprom_len)) | 636 | if (!of_property_read_u32(child, "eeprom-length", &eeprom_len)) |
@@ -642,6 +642,8 @@ static int dsa_of_probe(struct device *dev) | |||
642 | continue; | 642 | continue; |
643 | 643 | ||
644 | port_index = be32_to_cpup(port_reg); | 644 | port_index = be32_to_cpup(port_reg); |
645 | if (port_index >= DSA_MAX_PORTS) | ||
646 | break; | ||
645 | 647 | ||
646 | port_name = of_get_property(port, "label", NULL); | 648 | port_name = of_get_property(port, "label", NULL); |
647 | if (!port_name) | 649 | if (!port_name) |
@@ -666,8 +668,6 @@ static int dsa_of_probe(struct device *dev) | |||
666 | goto out_free_chip; | 668 | goto out_free_chip; |
667 | } | 669 | } |
668 | 670 | ||
669 | if (port_index == DSA_MAX_PORTS) | ||
670 | break; | ||
671 | } | 671 | } |
672 | } | 672 | } |
673 | 673 | ||
diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c index 90c0e8386116..574fad9cca05 100644 --- a/net/ipv4/datagram.c +++ b/net/ipv4/datagram.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <net/route.h> | 20 | #include <net/route.h> |
21 | #include <net/tcp_states.h> | 21 | #include <net/tcp_states.h> |
22 | 22 | ||
23 | int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | 23 | int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) |
24 | { | 24 | { |
25 | struct inet_sock *inet = inet_sk(sk); | 25 | struct inet_sock *inet = inet_sk(sk); |
26 | struct sockaddr_in *usin = (struct sockaddr_in *) uaddr; | 26 | struct sockaddr_in *usin = (struct sockaddr_in *) uaddr; |
@@ -39,8 +39,6 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
39 | 39 | ||
40 | sk_dst_reset(sk); | 40 | sk_dst_reset(sk); |
41 | 41 | ||
42 | lock_sock(sk); | ||
43 | |||
44 | oif = sk->sk_bound_dev_if; | 42 | oif = sk->sk_bound_dev_if; |
45 | saddr = inet->inet_saddr; | 43 | saddr = inet->inet_saddr; |
46 | if (ipv4_is_multicast(usin->sin_addr.s_addr)) { | 44 | if (ipv4_is_multicast(usin->sin_addr.s_addr)) { |
@@ -82,9 +80,19 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
82 | sk_dst_set(sk, &rt->dst); | 80 | sk_dst_set(sk, &rt->dst); |
83 | err = 0; | 81 | err = 0; |
84 | out: | 82 | out: |
85 | release_sock(sk); | ||
86 | return err; | 83 | return err; |
87 | } | 84 | } |
85 | EXPORT_SYMBOL(__ip4_datagram_connect); | ||
86 | |||
87 | int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | ||
88 | { | ||
89 | int res; | ||
90 | |||
91 | lock_sock(sk); | ||
92 | res = __ip4_datagram_connect(sk, uaddr, addr_len); | ||
93 | release_sock(sk); | ||
94 | return res; | ||
95 | } | ||
88 | EXPORT_SYMBOL(ip4_datagram_connect); | 96 | EXPORT_SYMBOL(ip4_datagram_connect); |
89 | 97 | ||
90 | /* Because UDP xmit path can manipulate sk_dst_cache without holding | 98 | /* Because UDP xmit path can manipulate sk_dst_cache without holding |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 7498716e8f54..e813196c91c7 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1740,6 +1740,8 @@ static int inet_netconf_msgsize_devconf(int type) | |||
1740 | size += nla_total_size(4); | 1740 | size += nla_total_size(4); |
1741 | if (type == -1 || type == NETCONFA_PROXY_NEIGH) | 1741 | if (type == -1 || type == NETCONFA_PROXY_NEIGH) |
1742 | size += nla_total_size(4); | 1742 | size += nla_total_size(4); |
1743 | if (type == -1 || type == NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN) | ||
1744 | size += nla_total_size(4); | ||
1743 | 1745 | ||
1744 | return size; | 1746 | return size; |
1745 | } | 1747 | } |
@@ -1780,6 +1782,10 @@ static int inet_netconf_fill_devconf(struct sk_buff *skb, int ifindex, | |||
1780 | nla_put_s32(skb, NETCONFA_PROXY_NEIGH, | 1782 | nla_put_s32(skb, NETCONFA_PROXY_NEIGH, |
1781 | IPV4_DEVCONF(*devconf, PROXY_ARP)) < 0) | 1783 | IPV4_DEVCONF(*devconf, PROXY_ARP)) < 0) |
1782 | goto nla_put_failure; | 1784 | goto nla_put_failure; |
1785 | if ((type == -1 || type == NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN) && | ||
1786 | nla_put_s32(skb, NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN, | ||
1787 | IPV4_DEVCONF(*devconf, IGNORE_ROUTES_WITH_LINKDOWN)) < 0) | ||
1788 | goto nla_put_failure; | ||
1783 | 1789 | ||
1784 | nlmsg_end(skb, nlh); | 1790 | nlmsg_end(skb, nlh); |
1785 | return 0; | 1791 | return 0; |
@@ -1819,6 +1825,7 @@ static const struct nla_policy devconf_ipv4_policy[NETCONFA_MAX+1] = { | |||
1819 | [NETCONFA_FORWARDING] = { .len = sizeof(int) }, | 1825 | [NETCONFA_FORWARDING] = { .len = sizeof(int) }, |
1820 | [NETCONFA_RP_FILTER] = { .len = sizeof(int) }, | 1826 | [NETCONFA_RP_FILTER] = { .len = sizeof(int) }, |
1821 | [NETCONFA_PROXY_NEIGH] = { .len = sizeof(int) }, | 1827 | [NETCONFA_PROXY_NEIGH] = { .len = sizeof(int) }, |
1828 | [NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN] = { .len = sizeof(int) }, | ||
1822 | }; | 1829 | }; |
1823 | 1830 | ||
1824 | static int inet_netconf_get_devconf(struct sk_buff *in_skb, | 1831 | static int inet_netconf_get_devconf(struct sk_buff *in_skb, |
@@ -2048,6 +2055,12 @@ static int devinet_conf_proc(struct ctl_table *ctl, int write, | |||
2048 | inet_netconf_notify_devconf(net, NETCONFA_PROXY_NEIGH, | 2055 | inet_netconf_notify_devconf(net, NETCONFA_PROXY_NEIGH, |
2049 | ifindex, cnf); | 2056 | ifindex, cnf); |
2050 | } | 2057 | } |
2058 | if (i == IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN - 1 && | ||
2059 | new_value != old_value) { | ||
2060 | ifindex = devinet_conf_ifindex(net, cnf); | ||
2061 | inet_netconf_notify_devconf(net, NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN, | ||
2062 | ifindex, cnf); | ||
2063 | } | ||
2051 | } | 2064 | } |
2052 | 2065 | ||
2053 | return ret; | 2066 | return ret; |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 9bc26677058e..c3b1f3a0f4cf 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -152,8 +152,8 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, | |||
152 | inet6_sk(sk)->tclass) < 0) | 152 | inet6_sk(sk)->tclass) < 0) |
153 | goto errout; | 153 | goto errout; |
154 | 154 | ||
155 | if (ipv6_only_sock(sk) && | 155 | if (((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) && |
156 | nla_put_u8(skb, INET_DIAG_SKV6ONLY, 1)) | 156 | nla_put_u8(skb, INET_DIAG_SKV6ONLY, ipv6_only_sock(sk))) |
157 | goto errout; | 157 | goto errout; |
158 | } | 158 | } |
159 | #endif | 159 | #endif |
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 5f9b063bbe8a..0cb9165421d4 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c | |||
@@ -624,22 +624,21 @@ EXPORT_SYMBOL_GPL(inet_hashinfo_init); | |||
624 | 624 | ||
625 | int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo) | 625 | int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo) |
626 | { | 626 | { |
627 | unsigned int locksz = sizeof(spinlock_t); | ||
627 | unsigned int i, nblocks = 1; | 628 | unsigned int i, nblocks = 1; |
628 | 629 | ||
629 | if (sizeof(spinlock_t) != 0) { | 630 | if (locksz != 0) { |
630 | /* allocate 2 cache lines or at least one spinlock per cpu */ | 631 | /* allocate 2 cache lines or at least one spinlock per cpu */ |
631 | nblocks = max_t(unsigned int, | 632 | nblocks = max(2U * L1_CACHE_BYTES / locksz, 1U); |
632 | 2 * L1_CACHE_BYTES / sizeof(spinlock_t), | ||
633 | 1); | ||
634 | nblocks = roundup_pow_of_two(nblocks * num_possible_cpus()); | 633 | nblocks = roundup_pow_of_two(nblocks * num_possible_cpus()); |
635 | 634 | ||
636 | /* no more locks than number of hash buckets */ | 635 | /* no more locks than number of hash buckets */ |
637 | nblocks = min(nblocks, hashinfo->ehash_mask + 1); | 636 | nblocks = min(nblocks, hashinfo->ehash_mask + 1); |
638 | 637 | ||
639 | hashinfo->ehash_locks = kmalloc_array(nblocks, sizeof(spinlock_t), | 638 | hashinfo->ehash_locks = kmalloc_array(nblocks, locksz, |
640 | GFP_KERNEL | __GFP_NOWARN); | 639 | GFP_KERNEL | __GFP_NOWARN); |
641 | if (!hashinfo->ehash_locks) | 640 | if (!hashinfo->ehash_locks) |
642 | hashinfo->ehash_locks = vmalloc(nblocks * sizeof(spinlock_t)); | 641 | hashinfo->ehash_locks = vmalloc(nblocks * locksz); |
643 | 642 | ||
644 | if (!hashinfo->ehash_locks) | 643 | if (!hashinfo->ehash_locks) |
645 | return -ENOMEM; | 644 | return -ENOMEM; |
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index a50dc6d408d1..31f71b15cfba 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -351,7 +351,7 @@ static int ip_frag_queue(struct ipq *qp, struct sk_buff *skb) | |||
351 | ihl = ip_hdrlen(skb); | 351 | ihl = ip_hdrlen(skb); |
352 | 352 | ||
353 | /* Determine the position of this fragment. */ | 353 | /* Determine the position of this fragment. */ |
354 | end = offset + skb->len - ihl; | 354 | end = offset + skb->len - skb_network_offset(skb) - ihl; |
355 | err = -EINVAL; | 355 | err = -EINVAL; |
356 | 356 | ||
357 | /* Is this the final fragment? */ | 357 | /* Is this the final fragment? */ |
@@ -381,7 +381,7 @@ static int ip_frag_queue(struct ipq *qp, struct sk_buff *skb) | |||
381 | goto err; | 381 | goto err; |
382 | 382 | ||
383 | err = -ENOMEM; | 383 | err = -ENOMEM; |
384 | if (!pskb_pull(skb, ihl)) | 384 | if (!pskb_pull(skb, skb_network_offset(skb) + ihl)) |
385 | goto err; | 385 | goto err; |
386 | 386 | ||
387 | err = pskb_trim_rcsum(skb, end - offset); | 387 | err = pskb_trim_rcsum(skb, end - offset); |
@@ -641,6 +641,8 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev, | |||
641 | iph->frag_off = 0; | 641 | iph->frag_off = 0; |
642 | } | 642 | } |
643 | 643 | ||
644 | ip_send_check(iph); | ||
645 | |||
644 | IP_INC_STATS_BH(net, IPSTATS_MIB_REASMOKS); | 646 | IP_INC_STATS_BH(net, IPSTATS_MIB_REASMOKS); |
645 | qp->q.fragments = NULL; | 647 | qp->q.fragments = NULL; |
646 | qp->q.fragments_tail = NULL; | 648 | qp->q.fragments_tail = NULL; |
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index 4c2c3ba4ba65..626d9e56a6bd 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
@@ -586,7 +586,8 @@ int ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t, | |||
586 | EXPORT_SYMBOL(ip_tunnel_encap); | 586 | EXPORT_SYMBOL(ip_tunnel_encap); |
587 | 587 | ||
588 | static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb, | 588 | static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb, |
589 | struct rtable *rt, __be16 df) | 589 | struct rtable *rt, __be16 df, |
590 | const struct iphdr *inner_iph) | ||
590 | { | 591 | { |
591 | struct ip_tunnel *tunnel = netdev_priv(dev); | 592 | struct ip_tunnel *tunnel = netdev_priv(dev); |
592 | int pkt_size = skb->len - tunnel->hlen - dev->hard_header_len; | 593 | int pkt_size = skb->len - tunnel->hlen - dev->hard_header_len; |
@@ -603,7 +604,8 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb, | |||
603 | 604 | ||
604 | if (skb->protocol == htons(ETH_P_IP)) { | 605 | if (skb->protocol == htons(ETH_P_IP)) { |
605 | if (!skb_is_gso(skb) && | 606 | if (!skb_is_gso(skb) && |
606 | (df & htons(IP_DF)) && mtu < pkt_size) { | 607 | (inner_iph->frag_off & htons(IP_DF)) && |
608 | mtu < pkt_size) { | ||
607 | memset(IPCB(skb), 0, sizeof(*IPCB(skb))); | 609 | memset(IPCB(skb), 0, sizeof(*IPCB(skb))); |
608 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); | 610 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); |
609 | return -E2BIG; | 611 | return -E2BIG; |
@@ -737,7 +739,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, | |||
737 | goto tx_error; | 739 | goto tx_error; |
738 | } | 740 | } |
739 | 741 | ||
740 | if (tnl_update_pmtu(dev, skb, rt, tnl_params->frag_off)) { | 742 | if (tnl_update_pmtu(dev, skb, rt, tnl_params->frag_off, inner_iph)) { |
741 | ip_rt_put(rt); | 743 | ip_rt_put(rt); |
742 | goto tx_error; | 744 | goto tx_error; |
743 | } | 745 | } |
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 95c9b6eece25..92305a1a021a 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -254,9 +254,10 @@ unsigned int arpt_do_table(struct sk_buff *skb, | |||
254 | static const char nulldevname[IFNAMSIZ] __attribute__((aligned(sizeof(long)))); | 254 | static const char nulldevname[IFNAMSIZ] __attribute__((aligned(sizeof(long)))); |
255 | unsigned int verdict = NF_DROP; | 255 | unsigned int verdict = NF_DROP; |
256 | const struct arphdr *arp; | 256 | const struct arphdr *arp; |
257 | struct arpt_entry *e, *back; | 257 | struct arpt_entry *e, **jumpstack; |
258 | const char *indev, *outdev; | 258 | const char *indev, *outdev; |
259 | const void *table_base; | 259 | const void *table_base; |
260 | unsigned int cpu, stackidx = 0; | ||
260 | const struct xt_table_info *private; | 261 | const struct xt_table_info *private; |
261 | struct xt_action_param acpar; | 262 | struct xt_action_param acpar; |
262 | unsigned int addend; | 263 | unsigned int addend; |
@@ -270,15 +271,16 @@ unsigned int arpt_do_table(struct sk_buff *skb, | |||
270 | local_bh_disable(); | 271 | local_bh_disable(); |
271 | addend = xt_write_recseq_begin(); | 272 | addend = xt_write_recseq_begin(); |
272 | private = table->private; | 273 | private = table->private; |
274 | cpu = smp_processor_id(); | ||
273 | /* | 275 | /* |
274 | * Ensure we load private-> members after we've fetched the base | 276 | * Ensure we load private-> members after we've fetched the base |
275 | * pointer. | 277 | * pointer. |
276 | */ | 278 | */ |
277 | smp_read_barrier_depends(); | 279 | smp_read_barrier_depends(); |
278 | table_base = private->entries; | 280 | table_base = private->entries; |
281 | jumpstack = (struct arpt_entry **)private->jumpstack[cpu]; | ||
279 | 282 | ||
280 | e = get_entry(table_base, private->hook_entry[hook]); | 283 | e = get_entry(table_base, private->hook_entry[hook]); |
281 | back = get_entry(table_base, private->underflow[hook]); | ||
282 | 284 | ||
283 | acpar.in = state->in; | 285 | acpar.in = state->in; |
284 | acpar.out = state->out; | 286 | acpar.out = state->out; |
@@ -312,18 +314,23 @@ unsigned int arpt_do_table(struct sk_buff *skb, | |||
312 | verdict = (unsigned int)(-v) - 1; | 314 | verdict = (unsigned int)(-v) - 1; |
313 | break; | 315 | break; |
314 | } | 316 | } |
315 | e = back; | 317 | if (stackidx == 0) { |
316 | back = get_entry(table_base, back->comefrom); | 318 | e = get_entry(table_base, |
319 | private->underflow[hook]); | ||
320 | } else { | ||
321 | e = jumpstack[--stackidx]; | ||
322 | e = arpt_next_entry(e); | ||
323 | } | ||
317 | continue; | 324 | continue; |
318 | } | 325 | } |
319 | if (table_base + v | 326 | if (table_base + v |
320 | != arpt_next_entry(e)) { | 327 | != arpt_next_entry(e)) { |
321 | /* Save old back ptr in next entry */ | ||
322 | struct arpt_entry *next = arpt_next_entry(e); | ||
323 | next->comefrom = (void *)back - table_base; | ||
324 | 328 | ||
325 | /* set back pointer to next entry */ | 329 | if (stackidx >= private->stacksize) { |
326 | back = next; | 330 | verdict = NF_DROP; |
331 | break; | ||
332 | } | ||
333 | jumpstack[stackidx++] = e; | ||
327 | } | 334 | } |
328 | 335 | ||
329 | e = get_entry(table_base, v); | 336 | e = get_entry(table_base, v); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 684f095d196e..728f5b3d3c64 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1917,14 +1917,13 @@ void tcp_enter_loss(struct sock *sk) | |||
1917 | const struct inet_connection_sock *icsk = inet_csk(sk); | 1917 | const struct inet_connection_sock *icsk = inet_csk(sk); |
1918 | struct tcp_sock *tp = tcp_sk(sk); | 1918 | struct tcp_sock *tp = tcp_sk(sk); |
1919 | struct sk_buff *skb; | 1919 | struct sk_buff *skb; |
1920 | bool new_recovery = false; | 1920 | bool new_recovery = icsk->icsk_ca_state < TCP_CA_Recovery; |
1921 | bool is_reneg; /* is receiver reneging on SACKs? */ | 1921 | bool is_reneg; /* is receiver reneging on SACKs? */ |
1922 | 1922 | ||
1923 | /* Reduce ssthresh if it has not yet been made inside this window. */ | 1923 | /* Reduce ssthresh if it has not yet been made inside this window. */ |
1924 | if (icsk->icsk_ca_state <= TCP_CA_Disorder || | 1924 | if (icsk->icsk_ca_state <= TCP_CA_Disorder || |
1925 | !after(tp->high_seq, tp->snd_una) || | 1925 | !after(tp->high_seq, tp->snd_una) || |
1926 | (icsk->icsk_ca_state == TCP_CA_Loss && !icsk->icsk_retransmits)) { | 1926 | (icsk->icsk_ca_state == TCP_CA_Loss && !icsk->icsk_retransmits)) { |
1927 | new_recovery = true; | ||
1928 | tp->prior_ssthresh = tcp_current_ssthresh(sk); | 1927 | tp->prior_ssthresh = tcp_current_ssthresh(sk); |
1929 | tp->snd_ssthresh = icsk->icsk_ca_ops->ssthresh(sk); | 1928 | tp->snd_ssthresh = icsk->icsk_ca_ops->ssthresh(sk); |
1930 | tcp_ca_event(sk, CA_EVENT_LOSS); | 1929 | tcp_ca_event(sk, CA_EVENT_LOSS); |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index 62d908e64eeb..b10a88986a98 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -40,7 +40,7 @@ static bool ipv6_mapped_addr_any(const struct in6_addr *a) | |||
40 | return ipv6_addr_v4mapped(a) && (a->s6_addr32[3] == 0); | 40 | return ipv6_addr_v4mapped(a) && (a->s6_addr32[3] == 0); |
41 | } | 41 | } |
42 | 42 | ||
43 | int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | 43 | static int __ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) |
44 | { | 44 | { |
45 | struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr; | 45 | struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr; |
46 | struct inet_sock *inet = inet_sk(sk); | 46 | struct inet_sock *inet = inet_sk(sk); |
@@ -56,7 +56,7 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
56 | if (usin->sin6_family == AF_INET) { | 56 | if (usin->sin6_family == AF_INET) { |
57 | if (__ipv6_only_sock(sk)) | 57 | if (__ipv6_only_sock(sk)) |
58 | return -EAFNOSUPPORT; | 58 | return -EAFNOSUPPORT; |
59 | err = ip4_datagram_connect(sk, uaddr, addr_len); | 59 | err = __ip4_datagram_connect(sk, uaddr, addr_len); |
60 | goto ipv4_connected; | 60 | goto ipv4_connected; |
61 | } | 61 | } |
62 | 62 | ||
@@ -98,9 +98,9 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
98 | sin.sin_addr.s_addr = daddr->s6_addr32[3]; | 98 | sin.sin_addr.s_addr = daddr->s6_addr32[3]; |
99 | sin.sin_port = usin->sin6_port; | 99 | sin.sin_port = usin->sin6_port; |
100 | 100 | ||
101 | err = ip4_datagram_connect(sk, | 101 | err = __ip4_datagram_connect(sk, |
102 | (struct sockaddr *) &sin, | 102 | (struct sockaddr *) &sin, |
103 | sizeof(sin)); | 103 | sizeof(sin)); |
104 | 104 | ||
105 | ipv4_connected: | 105 | ipv4_connected: |
106 | if (err) | 106 | if (err) |
@@ -204,6 +204,16 @@ out: | |||
204 | fl6_sock_release(flowlabel); | 204 | fl6_sock_release(flowlabel); |
205 | return err; | 205 | return err; |
206 | } | 206 | } |
207 | |||
208 | int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | ||
209 | { | ||
210 | int res; | ||
211 | |||
212 | lock_sock(sk); | ||
213 | res = __ip6_datagram_connect(sk, uaddr, addr_len); | ||
214 | release_sock(sk); | ||
215 | return res; | ||
216 | } | ||
207 | EXPORT_SYMBOL_GPL(ip6_datagram_connect); | 217 | EXPORT_SYMBOL_GPL(ip6_datagram_connect); |
208 | 218 | ||
209 | int ip6_datagram_connect_v6_only(struct sock *sk, struct sockaddr *uaddr, | 219 | int ip6_datagram_connect_v6_only(struct sock *sk, struct sockaddr *uaddr, |
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index f2e464eba5ef..57990c929cd8 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
@@ -331,10 +331,10 @@ int ip6_mc_input(struct sk_buff *skb) | |||
331 | if (offset < 0) | 331 | if (offset < 0) |
332 | goto out; | 332 | goto out; |
333 | 333 | ||
334 | if (!ipv6_is_mld(skb, nexthdr, offset)) | 334 | if (ipv6_is_mld(skb, nexthdr, offset)) |
335 | goto out; | 335 | deliver = true; |
336 | 336 | ||
337 | deliver = true; | 337 | goto out; |
338 | } | 338 | } |
339 | /* unknown RA - process it normally */ | 339 | /* unknown RA - process it normally */ |
340 | } | 340 | } |
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index e893cd18612f..08b62047c67f 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c | |||
@@ -292,8 +292,6 @@ static struct packet_offload ipv6_packet_offload __read_mostly = { | |||
292 | static const struct net_offload sit_offload = { | 292 | static const struct net_offload sit_offload = { |
293 | .callbacks = { | 293 | .callbacks = { |
294 | .gso_segment = ipv6_gso_segment, | 294 | .gso_segment = ipv6_gso_segment, |
295 | .gro_receive = ipv6_gro_receive, | ||
296 | .gro_complete = ipv6_gro_complete, | ||
297 | }, | 295 | }, |
298 | }; | 296 | }; |
299 | 297 | ||
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 1a1122a6bbf5..6090969937f8 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -369,10 +369,7 @@ static void ip6_dst_destroy(struct dst_entry *dst) | |||
369 | struct inet6_dev *idev; | 369 | struct inet6_dev *idev; |
370 | 370 | ||
371 | dst_destroy_metrics_generic(dst); | 371 | dst_destroy_metrics_generic(dst); |
372 | 372 | free_percpu(rt->rt6i_pcpu); | |
373 | if (rt->rt6i_pcpu) | ||
374 | free_percpu(rt->rt6i_pcpu); | ||
375 | |||
376 | rt6_uncached_list_del(rt); | 373 | rt6_uncached_list_del(rt); |
377 | 374 | ||
378 | idev = rt->rt6i_idev; | 375 | idev = rt->rt6i_idev; |
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 29236e832e44..c09c0131bfa2 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -723,6 +723,7 @@ void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata) | |||
723 | 723 | ||
724 | debugfs_remove_recursive(sdata->vif.debugfs_dir); | 724 | debugfs_remove_recursive(sdata->vif.debugfs_dir); |
725 | sdata->vif.debugfs_dir = NULL; | 725 | sdata->vif.debugfs_dir = NULL; |
726 | sdata->debugfs.subdir_stations = NULL; | ||
726 | } | 727 | } |
727 | 728 | ||
728 | void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata) | 729 | void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata) |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index ed1edac14372..553ac6dd4867 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -1863,10 +1863,6 @@ void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata) | |||
1863 | ieee80211_teardown_sdata(sdata); | 1863 | ieee80211_teardown_sdata(sdata); |
1864 | } | 1864 | } |
1865 | 1865 | ||
1866 | /* | ||
1867 | * Remove all interfaces, may only be called at hardware unregistration | ||
1868 | * time because it doesn't do RCU-safe list removals. | ||
1869 | */ | ||
1870 | void ieee80211_remove_interfaces(struct ieee80211_local *local) | 1866 | void ieee80211_remove_interfaces(struct ieee80211_local *local) |
1871 | { | 1867 | { |
1872 | struct ieee80211_sub_if_data *sdata, *tmp; | 1868 | struct ieee80211_sub_if_data *sdata, *tmp; |
@@ -1875,14 +1871,21 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local) | |||
1875 | 1871 | ||
1876 | ASSERT_RTNL(); | 1872 | ASSERT_RTNL(); |
1877 | 1873 | ||
1878 | /* | 1874 | /* Before destroying the interfaces, make sure they're all stopped so |
1879 | * Close all AP_VLAN interfaces first, as otherwise they | 1875 | * that the hardware is stopped. Otherwise, the driver might still be |
1880 | * might be closed while the AP interface they belong to | 1876 | * iterating the interfaces during the shutdown, e.g. from a worker |
1881 | * is closed, causing unregister_netdevice_many() to crash. | 1877 | * or from RX processing or similar, and if it does so (using atomic |
1878 | * iteration) while we're manipulating the list, the iteration will | ||
1879 | * crash. | ||
1880 | * | ||
1881 | * After this, the hardware should be stopped and the driver should | ||
1882 | * have stopped all of its activities, so that we can do RCU-unaware | ||
1883 | * manipulations of the interface list below. | ||
1882 | */ | 1884 | */ |
1883 | list_for_each_entry(sdata, &local->interfaces, list) | 1885 | cfg80211_shutdown_all_interfaces(local->hw.wiphy); |
1884 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 1886 | |
1885 | dev_close(sdata->dev); | 1887 | WARN(local->open_count, "%s: open count remains %d\n", |
1888 | wiphy_name(local->hw.wiphy), local->open_count); | ||
1886 | 1889 | ||
1887 | mutex_lock(&local->iflist_mtx); | 1890 | mutex_lock(&local->iflist_mtx); |
1888 | list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { | 1891 | list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { |
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 5438d13e2f00..3b59099413fb 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
@@ -306,7 +306,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, | |||
306 | if (action == WLAN_SP_MESH_PEERING_CONFIRM) { | 306 | if (action == WLAN_SP_MESH_PEERING_CONFIRM) { |
307 | /* AID */ | 307 | /* AID */ |
308 | pos = skb_put(skb, 2); | 308 | pos = skb_put(skb, 2); |
309 | put_unaligned_le16(plid, pos + 2); | 309 | put_unaligned_le16(plid, pos); |
310 | } | 310 | } |
311 | if (ieee80211_add_srates_ie(sdata, skb, true, band) || | 311 | if (ieee80211_add_srates_ie(sdata, skb, true, band) || |
312 | ieee80211_add_ext_srates_ie(sdata, skb, true, band) || | 312 | ieee80211_add_ext_srates_ie(sdata, skb, true, band) || |
@@ -1122,6 +1122,9 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, | |||
1122 | WLAN_SP_MESH_PEERING_CONFIRM) { | 1122 | WLAN_SP_MESH_PEERING_CONFIRM) { |
1123 | baseaddr += 4; | 1123 | baseaddr += 4; |
1124 | baselen += 4; | 1124 | baselen += 4; |
1125 | |||
1126 | if (baselen > len) | ||
1127 | return; | ||
1125 | } | 1128 | } |
1126 | ieee802_11_parse_elems(baseaddr, len - baselen, true, &elems); | 1129 | ieee802_11_parse_elems(baseaddr, len - baselen, true, &elems); |
1127 | mesh_process_plink_frame(sdata, mgmt, &elems); | 1130 | mesh_process_plink_frame(sdata, mgmt, &elems); |
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c index 06b60980c62c..b676b9fa707b 100644 --- a/net/mac80211/pm.c +++ b/net/mac80211/pm.c | |||
@@ -76,6 +76,22 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) | |||
76 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | 76 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
77 | continue; | 77 | continue; |
78 | ieee80211_mgd_quiesce(sdata); | 78 | ieee80211_mgd_quiesce(sdata); |
79 | /* If suspended during TX in progress, and wowlan | ||
80 | * is enabled (connection will be active) there | ||
81 | * can be a race where the driver is put out | ||
82 | * of power-save due to TX and during suspend | ||
83 | * dynamic_ps_timer is cancelled and TX packet | ||
84 | * is flushed, leaving the driver in ACTIVE even | ||
85 | * after resuming until dynamic_ps_timer puts | ||
86 | * driver back in DOZE. | ||
87 | */ | ||
88 | if (sdata->u.mgd.associated && | ||
89 | sdata->u.mgd.powersave && | ||
90 | !(local->hw.conf.flags & IEEE80211_CONF_PS)) { | ||
91 | local->hw.conf.flags |= IEEE80211_CONF_PS; | ||
92 | ieee80211_hw_config(local, | ||
93 | IEEE80211_CONF_CHANGE_PS); | ||
94 | } | ||
79 | } | 95 | } |
80 | 96 | ||
81 | err = drv_suspend(local, wowlan); | 97 | err = drv_suspend(local, wowlan); |
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c index ad31b2dab4f5..8db6e2994bbc 100644 --- a/net/mac80211/tdls.c +++ b/net/mac80211/tdls.c | |||
@@ -60,6 +60,7 @@ ieee80211_tdls_add_subband(struct ieee80211_sub_if_data *sdata, | |||
60 | struct ieee80211_channel *ch; | 60 | struct ieee80211_channel *ch; |
61 | struct cfg80211_chan_def chandef; | 61 | struct cfg80211_chan_def chandef; |
62 | int i, subband_start; | 62 | int i, subband_start; |
63 | struct wiphy *wiphy = sdata->local->hw.wiphy; | ||
63 | 64 | ||
64 | for (i = start; i <= end; i += spacing) { | 65 | for (i = start; i <= end; i += spacing) { |
65 | if (!ch_cnt) | 66 | if (!ch_cnt) |
@@ -70,9 +71,8 @@ ieee80211_tdls_add_subband(struct ieee80211_sub_if_data *sdata, | |||
70 | /* we will be active on the channel */ | 71 | /* we will be active on the channel */ |
71 | cfg80211_chandef_create(&chandef, ch, | 72 | cfg80211_chandef_create(&chandef, ch, |
72 | NL80211_CHAN_NO_HT); | 73 | NL80211_CHAN_NO_HT); |
73 | if (cfg80211_reg_can_beacon(sdata->local->hw.wiphy, | 74 | if (cfg80211_reg_can_beacon_relax(wiphy, &chandef, |
74 | &chandef, | 75 | sdata->wdev.iftype)) { |
75 | sdata->wdev.iftype)) { | ||
76 | ch_cnt++; | 76 | ch_cnt++; |
77 | /* | 77 | /* |
78 | * check if the next channel is also part of | 78 | * check if the next channel is also part of |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 8410bb3bf5e8..b8233505bf9f 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1117,7 +1117,9 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx, | |||
1117 | queued = true; | 1117 | queued = true; |
1118 | info->control.vif = &tx->sdata->vif; | 1118 | info->control.vif = &tx->sdata->vif; |
1119 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; | 1119 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; |
1120 | info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS; | 1120 | info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS | |
1121 | IEEE80211_TX_CTL_NO_PS_BUFFER | | ||
1122 | IEEE80211_TX_STATUS_EOSP; | ||
1121 | __skb_queue_tail(&tid_tx->pending, skb); | 1123 | __skb_queue_tail(&tid_tx->pending, skb); |
1122 | if (skb_queue_len(&tid_tx->pending) > STA_MAX_TX_BUFFER) | 1124 | if (skb_queue_len(&tid_tx->pending) > STA_MAX_TX_BUFFER) |
1123 | purge_skb = __skb_dequeue(&tid_tx->pending); | 1125 | purge_skb = __skb_dequeue(&tid_tx->pending); |
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c index cd60d397fe05..8a8b2abc35ff 100644 --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c | |||
@@ -213,7 +213,7 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict) | |||
213 | 213 | ||
214 | if (verdict == NF_ACCEPT) { | 214 | if (verdict == NF_ACCEPT) { |
215 | next_hook: | 215 | next_hook: |
216 | verdict = nf_iterate(&nf_hooks[entry->state.pf][entry->state.hook], | 216 | verdict = nf_iterate(entry->state.hook_list, |
217 | skb, &entry->state, &elem); | 217 | skb, &entry->state, &elem); |
218 | } | 218 | } |
219 | 219 | ||
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 8b117c90ecd7..0c0e8ecf02ab 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -269,6 +269,12 @@ static void nfnl_err_deliver(struct list_head *err_list, struct sk_buff *skb) | |||
269 | } | 269 | } |
270 | } | 270 | } |
271 | 271 | ||
272 | enum { | ||
273 | NFNL_BATCH_FAILURE = (1 << 0), | ||
274 | NFNL_BATCH_DONE = (1 << 1), | ||
275 | NFNL_BATCH_REPLAY = (1 << 2), | ||
276 | }; | ||
277 | |||
272 | static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, | 278 | static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, |
273 | u_int16_t subsys_id) | 279 | u_int16_t subsys_id) |
274 | { | 280 | { |
@@ -276,13 +282,15 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
276 | struct net *net = sock_net(skb->sk); | 282 | struct net *net = sock_net(skb->sk); |
277 | const struct nfnetlink_subsystem *ss; | 283 | const struct nfnetlink_subsystem *ss; |
278 | const struct nfnl_callback *nc; | 284 | const struct nfnl_callback *nc; |
279 | bool success = true, done = false; | ||
280 | static LIST_HEAD(err_list); | 285 | static LIST_HEAD(err_list); |
286 | u32 status; | ||
281 | int err; | 287 | int err; |
282 | 288 | ||
283 | if (subsys_id >= NFNL_SUBSYS_COUNT) | 289 | if (subsys_id >= NFNL_SUBSYS_COUNT) |
284 | return netlink_ack(skb, nlh, -EINVAL); | 290 | return netlink_ack(skb, nlh, -EINVAL); |
285 | replay: | 291 | replay: |
292 | status = 0; | ||
293 | |||
286 | skb = netlink_skb_clone(oskb, GFP_KERNEL); | 294 | skb = netlink_skb_clone(oskb, GFP_KERNEL); |
287 | if (!skb) | 295 | if (!skb) |
288 | return netlink_ack(oskb, nlh, -ENOMEM); | 296 | return netlink_ack(oskb, nlh, -ENOMEM); |
@@ -336,10 +344,10 @@ replay: | |||
336 | if (type == NFNL_MSG_BATCH_BEGIN) { | 344 | if (type == NFNL_MSG_BATCH_BEGIN) { |
337 | /* Malformed: Batch begin twice */ | 345 | /* Malformed: Batch begin twice */ |
338 | nfnl_err_reset(&err_list); | 346 | nfnl_err_reset(&err_list); |
339 | success = false; | 347 | status |= NFNL_BATCH_FAILURE; |
340 | goto done; | 348 | goto done; |
341 | } else if (type == NFNL_MSG_BATCH_END) { | 349 | } else if (type == NFNL_MSG_BATCH_END) { |
342 | done = true; | 350 | status |= NFNL_BATCH_DONE; |
343 | goto done; | 351 | goto done; |
344 | } else if (type < NLMSG_MIN_TYPE) { | 352 | } else if (type < NLMSG_MIN_TYPE) { |
345 | err = -EINVAL; | 353 | err = -EINVAL; |
@@ -382,11 +390,8 @@ replay: | |||
382 | * original skb. | 390 | * original skb. |
383 | */ | 391 | */ |
384 | if (err == -EAGAIN) { | 392 | if (err == -EAGAIN) { |
385 | nfnl_err_reset(&err_list); | 393 | status |= NFNL_BATCH_REPLAY; |
386 | ss->abort(oskb); | 394 | goto next; |
387 | nfnl_unlock(subsys_id); | ||
388 | kfree_skb(skb); | ||
389 | goto replay; | ||
390 | } | 395 | } |
391 | } | 396 | } |
392 | ack: | 397 | ack: |
@@ -402,7 +407,7 @@ ack: | |||
402 | */ | 407 | */ |
403 | nfnl_err_reset(&err_list); | 408 | nfnl_err_reset(&err_list); |
404 | netlink_ack(skb, nlmsg_hdr(oskb), -ENOMEM); | 409 | netlink_ack(skb, nlmsg_hdr(oskb), -ENOMEM); |
405 | success = false; | 410 | status |= NFNL_BATCH_FAILURE; |
406 | goto done; | 411 | goto done; |
407 | } | 412 | } |
408 | /* We don't stop processing the batch on errors, thus, | 413 | /* We don't stop processing the batch on errors, thus, |
@@ -410,19 +415,26 @@ ack: | |||
410 | * triggers. | 415 | * triggers. |
411 | */ | 416 | */ |
412 | if (err) | 417 | if (err) |
413 | success = false; | 418 | status |= NFNL_BATCH_FAILURE; |
414 | } | 419 | } |
415 | 420 | next: | |
416 | msglen = NLMSG_ALIGN(nlh->nlmsg_len); | 421 | msglen = NLMSG_ALIGN(nlh->nlmsg_len); |
417 | if (msglen > skb->len) | 422 | if (msglen > skb->len) |
418 | msglen = skb->len; | 423 | msglen = skb->len; |
419 | skb_pull(skb, msglen); | 424 | skb_pull(skb, msglen); |
420 | } | 425 | } |
421 | done: | 426 | done: |
422 | if (success && done) | 427 | if (status & NFNL_BATCH_REPLAY) { |
428 | ss->abort(oskb); | ||
429 | nfnl_err_reset(&err_list); | ||
430 | nfnl_unlock(subsys_id); | ||
431 | kfree_skb(skb); | ||
432 | goto replay; | ||
433 | } else if (status == NFNL_BATCH_DONE) { | ||
423 | ss->commit(oskb); | 434 | ss->commit(oskb); |
424 | else | 435 | } else { |
425 | ss->abort(oskb); | 436 | ss->abort(oskb); |
437 | } | ||
426 | 438 | ||
427 | nfnl_err_deliver(&err_list, oskb); | 439 | nfnl_err_deliver(&err_list, oskb); |
428 | nfnl_unlock(subsys_id); | 440 | nfnl_unlock(subsys_id); |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index dea925388a5b..d8e2e3918ce2 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -158,7 +158,7 @@ static int __netlink_remove_tap(struct netlink_tap *nt) | |||
158 | out: | 158 | out: |
159 | spin_unlock(&netlink_tap_lock); | 159 | spin_unlock(&netlink_tap_lock); |
160 | 160 | ||
161 | if (found && nt->module) | 161 | if (found) |
162 | module_put(nt->module); | 162 | module_put(nt->module); |
163 | 163 | ||
164 | return found ? 0 : -ENODEV; | 164 | return found ? 0 : -ENODEV; |
@@ -357,25 +357,52 @@ err1: | |||
357 | return NULL; | 357 | return NULL; |
358 | } | 358 | } |
359 | 359 | ||
360 | |||
361 | static void | ||
362 | __netlink_set_ring(struct sock *sk, struct nl_mmap_req *req, bool tx_ring, void **pg_vec, | ||
363 | unsigned int order) | ||
364 | { | ||
365 | struct netlink_sock *nlk = nlk_sk(sk); | ||
366 | struct sk_buff_head *queue; | ||
367 | struct netlink_ring *ring; | ||
368 | |||
369 | queue = tx_ring ? &sk->sk_write_queue : &sk->sk_receive_queue; | ||
370 | ring = tx_ring ? &nlk->tx_ring : &nlk->rx_ring; | ||
371 | |||
372 | spin_lock_bh(&queue->lock); | ||
373 | |||
374 | ring->frame_max = req->nm_frame_nr - 1; | ||
375 | ring->head = 0; | ||
376 | ring->frame_size = req->nm_frame_size; | ||
377 | ring->pg_vec_pages = req->nm_block_size / PAGE_SIZE; | ||
378 | |||
379 | swap(ring->pg_vec_len, req->nm_block_nr); | ||
380 | swap(ring->pg_vec_order, order); | ||
381 | swap(ring->pg_vec, pg_vec); | ||
382 | |||
383 | __skb_queue_purge(queue); | ||
384 | spin_unlock_bh(&queue->lock); | ||
385 | |||
386 | WARN_ON(atomic_read(&nlk->mapped)); | ||
387 | |||
388 | if (pg_vec) | ||
389 | free_pg_vec(pg_vec, order, req->nm_block_nr); | ||
390 | } | ||
391 | |||
360 | static int netlink_set_ring(struct sock *sk, struct nl_mmap_req *req, | 392 | static int netlink_set_ring(struct sock *sk, struct nl_mmap_req *req, |
361 | bool closing, bool tx_ring) | 393 | bool tx_ring) |
362 | { | 394 | { |
363 | struct netlink_sock *nlk = nlk_sk(sk); | 395 | struct netlink_sock *nlk = nlk_sk(sk); |
364 | struct netlink_ring *ring; | 396 | struct netlink_ring *ring; |
365 | struct sk_buff_head *queue; | ||
366 | void **pg_vec = NULL; | 397 | void **pg_vec = NULL; |
367 | unsigned int order = 0; | 398 | unsigned int order = 0; |
368 | int err; | ||
369 | 399 | ||
370 | ring = tx_ring ? &nlk->tx_ring : &nlk->rx_ring; | 400 | ring = tx_ring ? &nlk->tx_ring : &nlk->rx_ring; |
371 | queue = tx_ring ? &sk->sk_write_queue : &sk->sk_receive_queue; | ||
372 | 401 | ||
373 | if (!closing) { | 402 | if (atomic_read(&nlk->mapped)) |
374 | if (atomic_read(&nlk->mapped)) | 403 | return -EBUSY; |
375 | return -EBUSY; | 404 | if (atomic_read(&ring->pending)) |
376 | if (atomic_read(&ring->pending)) | 405 | return -EBUSY; |
377 | return -EBUSY; | ||
378 | } | ||
379 | 406 | ||
380 | if (req->nm_block_nr) { | 407 | if (req->nm_block_nr) { |
381 | if (ring->pg_vec != NULL) | 408 | if (ring->pg_vec != NULL) |
@@ -407,31 +434,19 @@ static int netlink_set_ring(struct sock *sk, struct nl_mmap_req *req, | |||
407 | return -EINVAL; | 434 | return -EINVAL; |
408 | } | 435 | } |
409 | 436 | ||
410 | err = -EBUSY; | ||
411 | mutex_lock(&nlk->pg_vec_lock); | 437 | mutex_lock(&nlk->pg_vec_lock); |
412 | if (closing || atomic_read(&nlk->mapped) == 0) { | 438 | if (atomic_read(&nlk->mapped) == 0) { |
413 | err = 0; | 439 | __netlink_set_ring(sk, req, tx_ring, pg_vec, order); |
414 | spin_lock_bh(&queue->lock); | 440 | mutex_unlock(&nlk->pg_vec_lock); |
415 | 441 | return 0; | |
416 | ring->frame_max = req->nm_frame_nr - 1; | ||
417 | ring->head = 0; | ||
418 | ring->frame_size = req->nm_frame_size; | ||
419 | ring->pg_vec_pages = req->nm_block_size / PAGE_SIZE; | ||
420 | |||
421 | swap(ring->pg_vec_len, req->nm_block_nr); | ||
422 | swap(ring->pg_vec_order, order); | ||
423 | swap(ring->pg_vec, pg_vec); | ||
424 | |||
425 | __skb_queue_purge(queue); | ||
426 | spin_unlock_bh(&queue->lock); | ||
427 | |||
428 | WARN_ON(atomic_read(&nlk->mapped)); | ||
429 | } | 442 | } |
443 | |||
430 | mutex_unlock(&nlk->pg_vec_lock); | 444 | mutex_unlock(&nlk->pg_vec_lock); |
431 | 445 | ||
432 | if (pg_vec) | 446 | if (pg_vec) |
433 | free_pg_vec(pg_vec, order, req->nm_block_nr); | 447 | free_pg_vec(pg_vec, order, req->nm_block_nr); |
434 | return err; | 448 | |
449 | return -EBUSY; | ||
435 | } | 450 | } |
436 | 451 | ||
437 | static void netlink_mm_open(struct vm_area_struct *vma) | 452 | static void netlink_mm_open(struct vm_area_struct *vma) |
@@ -900,10 +915,10 @@ static void netlink_sock_destruct(struct sock *sk) | |||
900 | 915 | ||
901 | memset(&req, 0, sizeof(req)); | 916 | memset(&req, 0, sizeof(req)); |
902 | if (nlk->rx_ring.pg_vec) | 917 | if (nlk->rx_ring.pg_vec) |
903 | netlink_set_ring(sk, &req, true, false); | 918 | __netlink_set_ring(sk, &req, false, NULL, 0); |
904 | memset(&req, 0, sizeof(req)); | 919 | memset(&req, 0, sizeof(req)); |
905 | if (nlk->tx_ring.pg_vec) | 920 | if (nlk->tx_ring.pg_vec) |
906 | netlink_set_ring(sk, &req, true, true); | 921 | __netlink_set_ring(sk, &req, true, NULL, 0); |
907 | } | 922 | } |
908 | #endif /* CONFIG_NETLINK_MMAP */ | 923 | #endif /* CONFIG_NETLINK_MMAP */ |
909 | 924 | ||
@@ -2223,7 +2238,7 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname, | |||
2223 | return -EINVAL; | 2238 | return -EINVAL; |
2224 | if (copy_from_user(&req, optval, sizeof(req))) | 2239 | if (copy_from_user(&req, optval, sizeof(req))) |
2225 | return -EFAULT; | 2240 | return -EFAULT; |
2226 | err = netlink_set_ring(sk, &req, false, | 2241 | err = netlink_set_ring(sk, &req, |
2227 | optname == NETLINK_TX_RING); | 2242 | optname == NETLINK_TX_RING); |
2228 | break; | 2243 | break; |
2229 | } | 2244 | } |
diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c index 4613df8c8290..65523948fb95 100644 --- a/net/openvswitch/flow_table.c +++ b/net/openvswitch/flow_table.c | |||
@@ -752,7 +752,7 @@ int ovs_flow_init(void) | |||
752 | BUILD_BUG_ON(sizeof(struct sw_flow_key) % sizeof(long)); | 752 | BUILD_BUG_ON(sizeof(struct sw_flow_key) % sizeof(long)); |
753 | 753 | ||
754 | flow_cache = kmem_cache_create("sw_flow", sizeof(struct sw_flow) | 754 | flow_cache = kmem_cache_create("sw_flow", sizeof(struct sw_flow) |
755 | + (num_possible_nodes() | 755 | + (nr_node_ids |
756 | * sizeof(struct flow_stats *)), | 756 | * sizeof(struct flow_stats *)), |
757 | 0, 0, NULL); | 757 | 0, 0, NULL); |
758 | if (flow_cache == NULL) | 758 | if (flow_cache == NULL) |
diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c index 273b8bff6ba4..657ba9f5d308 100644 --- a/net/rds/ib_rdma.c +++ b/net/rds/ib_rdma.c | |||
@@ -759,8 +759,10 @@ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents, | |||
759 | } | 759 | } |
760 | 760 | ||
761 | ibmr = rds_ib_alloc_fmr(rds_ibdev); | 761 | ibmr = rds_ib_alloc_fmr(rds_ibdev); |
762 | if (IS_ERR(ibmr)) | 762 | if (IS_ERR(ibmr)) { |
763 | rds_ib_dev_put(rds_ibdev); | ||
763 | return ibmr; | 764 | return ibmr; |
765 | } | ||
764 | 766 | ||
765 | ret = rds_ib_map_fmr(rds_ibdev, ibmr, sg, nents); | 767 | ret = rds_ib_map_fmr(rds_ibdev, ibmr, sg, nents); |
766 | if (ret == 0) | 768 | if (ret == 0) |
diff --git a/net/rds/transport.c b/net/rds/transport.c index 8b4a6cd2c3a7..83498e1c75b8 100644 --- a/net/rds/transport.c +++ b/net/rds/transport.c | |||
@@ -73,7 +73,7 @@ EXPORT_SYMBOL_GPL(rds_trans_unregister); | |||
73 | 73 | ||
74 | void rds_trans_put(struct rds_transport *trans) | 74 | void rds_trans_put(struct rds_transport *trans) |
75 | { | 75 | { |
76 | if (trans && trans->t_owner) | 76 | if (trans) |
77 | module_put(trans->t_owner); | 77 | module_put(trans->t_owner); |
78 | } | 78 | } |
79 | 79 | ||
diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c index 1d56903fd4c7..1df78289e248 100644 --- a/net/sched/act_bpf.c +++ b/net/sched/act_bpf.c | |||
@@ -339,6 +339,9 @@ static void tcf_bpf_cleanup(struct tc_action *act, int bind) | |||
339 | bpf_prog_put(prog->filter); | 339 | bpf_prog_put(prog->filter); |
340 | else | 340 | else |
341 | bpf_prog_destroy(prog->filter); | 341 | bpf_prog_destroy(prog->filter); |
342 | |||
343 | kfree(prog->bpf_ops); | ||
344 | kfree(prog->bpf_name); | ||
342 | } | 345 | } |
343 | 346 | ||
344 | static struct tc_action_ops act_bpf_ops __read_mostly = { | 347 | static struct tc_action_ops act_bpf_ops __read_mostly = { |
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index c79ecfd36e0f..e5168f8b9640 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c | |||
@@ -378,7 +378,7 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb, | |||
378 | goto errout; | 378 | goto errout; |
379 | 379 | ||
380 | if (oldprog) { | 380 | if (oldprog) { |
381 | list_replace_rcu(&prog->link, &oldprog->link); | 381 | list_replace_rcu(&oldprog->link, &prog->link); |
382 | tcf_unbind_filter(tp, &oldprog->res); | 382 | tcf_unbind_filter(tp, &oldprog->res); |
383 | call_rcu(&oldprog->rcu, __cls_bpf_delete_prog); | 383 | call_rcu(&oldprog->rcu, __cls_bpf_delete_prog); |
384 | } else { | 384 | } else { |
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c index 76bc3a20ffdb..bb2a0f529c1f 100644 --- a/net/sched/cls_flow.c +++ b/net/sched/cls_flow.c | |||
@@ -425,6 +425,8 @@ static int flow_change(struct net *net, struct sk_buff *in_skb, | |||
425 | if (!fnew) | 425 | if (!fnew) |
426 | goto err2; | 426 | goto err2; |
427 | 427 | ||
428 | tcf_exts_init(&fnew->exts, TCA_FLOW_ACT, TCA_FLOW_POLICE); | ||
429 | |||
428 | fold = (struct flow_filter *)*arg; | 430 | fold = (struct flow_filter *)*arg; |
429 | if (fold) { | 431 | if (fold) { |
430 | err = -EINVAL; | 432 | err = -EINVAL; |
@@ -486,7 +488,6 @@ static int flow_change(struct net *net, struct sk_buff *in_skb, | |||
486 | fnew->mask = ~0U; | 488 | fnew->mask = ~0U; |
487 | fnew->tp = tp; | 489 | fnew->tp = tp; |
488 | get_random_bytes(&fnew->hashrnd, 4); | 490 | get_random_bytes(&fnew->hashrnd, 4); |
489 | tcf_exts_init(&fnew->exts, TCA_FLOW_ACT, TCA_FLOW_POLICE); | ||
490 | } | 491 | } |
491 | 492 | ||
492 | fnew->perturb_timer.function = flow_perturbation; | 493 | fnew->perturb_timer.function = flow_perturbation; |
@@ -526,7 +527,7 @@ static int flow_change(struct net *net, struct sk_buff *in_skb, | |||
526 | if (*arg == 0) | 527 | if (*arg == 0) |
527 | list_add_tail_rcu(&fnew->list, &head->filters); | 528 | list_add_tail_rcu(&fnew->list, &head->filters); |
528 | else | 529 | else |
529 | list_replace_rcu(&fnew->list, &fold->list); | 530 | list_replace_rcu(&fold->list, &fnew->list); |
530 | 531 | ||
531 | *arg = (unsigned long)fnew; | 532 | *arg = (unsigned long)fnew; |
532 | 533 | ||
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 9d37ccd95062..2f3d03f99487 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c | |||
@@ -499,7 +499,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, | |||
499 | *arg = (unsigned long) fnew; | 499 | *arg = (unsigned long) fnew; |
500 | 500 | ||
501 | if (fold) { | 501 | if (fold) { |
502 | list_replace_rcu(&fnew->list, &fold->list); | 502 | list_replace_rcu(&fold->list, &fnew->list); |
503 | tcf_unbind_filter(tp, &fold->res); | 503 | tcf_unbind_filter(tp, &fold->res); |
504 | call_rcu(&fold->rcu, fl_destroy_filter); | 504 | call_rcu(&fold->rcu, fl_destroy_filter); |
505 | } else { | 505 | } else { |
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c index d75993f89fac..21ca33c9f036 100644 --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c | |||
@@ -155,14 +155,23 @@ static unsigned int fq_codel_drop(struct Qdisc *sch) | |||
155 | skb = dequeue_head(flow); | 155 | skb = dequeue_head(flow); |
156 | len = qdisc_pkt_len(skb); | 156 | len = qdisc_pkt_len(skb); |
157 | q->backlogs[idx] -= len; | 157 | q->backlogs[idx] -= len; |
158 | kfree_skb(skb); | ||
159 | sch->q.qlen--; | 158 | sch->q.qlen--; |
160 | qdisc_qstats_drop(sch); | 159 | qdisc_qstats_drop(sch); |
161 | qdisc_qstats_backlog_dec(sch, skb); | 160 | qdisc_qstats_backlog_dec(sch, skb); |
161 | kfree_skb(skb); | ||
162 | flow->dropped++; | 162 | flow->dropped++; |
163 | return idx; | 163 | return idx; |
164 | } | 164 | } |
165 | 165 | ||
166 | static unsigned int fq_codel_qdisc_drop(struct Qdisc *sch) | ||
167 | { | ||
168 | unsigned int prev_backlog; | ||
169 | |||
170 | prev_backlog = sch->qstats.backlog; | ||
171 | fq_codel_drop(sch); | ||
172 | return prev_backlog - sch->qstats.backlog; | ||
173 | } | ||
174 | |||
166 | static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch) | 175 | static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
167 | { | 176 | { |
168 | struct fq_codel_sched_data *q = qdisc_priv(sch); | 177 | struct fq_codel_sched_data *q = qdisc_priv(sch); |
@@ -604,7 +613,7 @@ static struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = { | |||
604 | .enqueue = fq_codel_enqueue, | 613 | .enqueue = fq_codel_enqueue, |
605 | .dequeue = fq_codel_dequeue, | 614 | .dequeue = fq_codel_dequeue, |
606 | .peek = qdisc_peek_dequeued, | 615 | .peek = qdisc_peek_dequeued, |
607 | .drop = fq_codel_drop, | 616 | .drop = fq_codel_qdisc_drop, |
608 | .init = fq_codel_init, | 617 | .init = fq_codel_init, |
609 | .reset = fq_codel_reset, | 618 | .reset = fq_codel_reset, |
610 | .destroy = fq_codel_destroy, | 619 | .destroy = fq_codel_destroy, |
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index 7d1492663360..52f75a5473e1 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c | |||
@@ -306,10 +306,10 @@ drop: | |||
306 | len = qdisc_pkt_len(skb); | 306 | len = qdisc_pkt_len(skb); |
307 | slot->backlog -= len; | 307 | slot->backlog -= len; |
308 | sfq_dec(q, x); | 308 | sfq_dec(q, x); |
309 | kfree_skb(skb); | ||
310 | sch->q.qlen--; | 309 | sch->q.qlen--; |
311 | qdisc_qstats_drop(sch); | 310 | qdisc_qstats_drop(sch); |
312 | qdisc_qstats_backlog_dec(sch, skb); | 311 | qdisc_qstats_backlog_dec(sch, skb); |
312 | kfree_skb(skb); | ||
313 | return len; | 313 | return len; |
314 | } | 314 | } |
315 | 315 | ||
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index 84f77a054025..9f2add3cba26 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c | |||
@@ -171,8 +171,10 @@ int switchdev_port_attr_set(struct net_device *dev, struct switchdev_attr *attr) | |||
171 | * released. | 171 | * released. |
172 | */ | 172 | */ |
173 | 173 | ||
174 | attr->trans = SWITCHDEV_TRANS_ABORT; | 174 | if (err != -EOPNOTSUPP) { |
175 | __switchdev_port_attr_set(dev, attr); | 175 | attr->trans = SWITCHDEV_TRANS_ABORT; |
176 | __switchdev_port_attr_set(dev, attr); | ||
177 | } | ||
176 | 178 | ||
177 | return err; | 179 | return err; |
178 | } | 180 | } |
@@ -249,8 +251,10 @@ int switchdev_port_obj_add(struct net_device *dev, struct switchdev_obj *obj) | |||
249 | * released. | 251 | * released. |
250 | */ | 252 | */ |
251 | 253 | ||
252 | obj->trans = SWITCHDEV_TRANS_ABORT; | 254 | if (err != -EOPNOTSUPP) { |
253 | __switchdev_port_obj_add(dev, obj); | 255 | obj->trans = SWITCHDEV_TRANS_ABORT; |
256 | __switchdev_port_obj_add(dev, obj); | ||
257 | } | ||
254 | 258 | ||
255 | return err; | 259 | return err; |
256 | } | 260 | } |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 46b6ed534ef2..3a7567f690f3 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -2007,6 +2007,7 @@ static int tipc_accept(struct socket *sock, struct socket *new_sock, int flags) | |||
2007 | res = tipc_sk_create(sock_net(sock->sk), new_sock, 0, 1); | 2007 | res = tipc_sk_create(sock_net(sock->sk), new_sock, 0, 1); |
2008 | if (res) | 2008 | if (res) |
2009 | goto exit; | 2009 | goto exit; |
2010 | security_sk_clone(sock->sk, new_sock->sk); | ||
2010 | 2011 | ||
2011 | new_sk = new_sock->sk; | 2012 | new_sk = new_sock->sk; |
2012 | new_tsock = tipc_sk(new_sk); | 2013 | new_tsock = tipc_sk(new_sk); |
diff --git a/net/wireless/chan.c b/net/wireless/chan.c index 915b328b9ac5..59cabc9bce69 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c | |||
@@ -797,23 +797,18 @@ static bool cfg80211_ir_permissive_chan(struct wiphy *wiphy, | |||
797 | return false; | 797 | return false; |
798 | } | 798 | } |
799 | 799 | ||
800 | bool cfg80211_reg_can_beacon(struct wiphy *wiphy, | 800 | static bool _cfg80211_reg_can_beacon(struct wiphy *wiphy, |
801 | struct cfg80211_chan_def *chandef, | 801 | struct cfg80211_chan_def *chandef, |
802 | enum nl80211_iftype iftype) | 802 | enum nl80211_iftype iftype, |
803 | bool check_no_ir) | ||
803 | { | 804 | { |
804 | bool res; | 805 | bool res; |
805 | u32 prohibited_flags = IEEE80211_CHAN_DISABLED | | 806 | u32 prohibited_flags = IEEE80211_CHAN_DISABLED | |
806 | IEEE80211_CHAN_RADAR; | 807 | IEEE80211_CHAN_RADAR; |
807 | 808 | ||
808 | trace_cfg80211_reg_can_beacon(wiphy, chandef, iftype); | 809 | trace_cfg80211_reg_can_beacon(wiphy, chandef, iftype, check_no_ir); |
809 | 810 | ||
810 | /* | 811 | if (check_no_ir) |
811 | * Under certain conditions suggested by some regulatory bodies a | ||
812 | * GO/STA can IR on channels marked with IEEE80211_NO_IR. Set this flag | ||
813 | * only if such relaxations are not enabled and the conditions are not | ||
814 | * met. | ||
815 | */ | ||
816 | if (!cfg80211_ir_permissive_chan(wiphy, iftype, chandef->chan)) | ||
817 | prohibited_flags |= IEEE80211_CHAN_NO_IR; | 812 | prohibited_flags |= IEEE80211_CHAN_NO_IR; |
818 | 813 | ||
819 | if (cfg80211_chandef_dfs_required(wiphy, chandef, iftype) > 0 && | 814 | if (cfg80211_chandef_dfs_required(wiphy, chandef, iftype) > 0 && |
@@ -827,8 +822,36 @@ bool cfg80211_reg_can_beacon(struct wiphy *wiphy, | |||
827 | trace_cfg80211_return_bool(res); | 822 | trace_cfg80211_return_bool(res); |
828 | return res; | 823 | return res; |
829 | } | 824 | } |
825 | |||
826 | bool cfg80211_reg_can_beacon(struct wiphy *wiphy, | ||
827 | struct cfg80211_chan_def *chandef, | ||
828 | enum nl80211_iftype iftype) | ||
829 | { | ||
830 | return _cfg80211_reg_can_beacon(wiphy, chandef, iftype, true); | ||
831 | } | ||
830 | EXPORT_SYMBOL(cfg80211_reg_can_beacon); | 832 | EXPORT_SYMBOL(cfg80211_reg_can_beacon); |
831 | 833 | ||
834 | bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy, | ||
835 | struct cfg80211_chan_def *chandef, | ||
836 | enum nl80211_iftype iftype) | ||
837 | { | ||
838 | bool check_no_ir; | ||
839 | |||
840 | ASSERT_RTNL(); | ||
841 | |||
842 | /* | ||
843 | * Under certain conditions suggested by some regulatory bodies a | ||
844 | * GO/STA can IR on channels marked with IEEE80211_NO_IR. Set this flag | ||
845 | * only if such relaxations are not enabled and the conditions are not | ||
846 | * met. | ||
847 | */ | ||
848 | check_no_ir = !cfg80211_ir_permissive_chan(wiphy, iftype, | ||
849 | chandef->chan); | ||
850 | |||
851 | return _cfg80211_reg_can_beacon(wiphy, chandef, iftype, check_no_ir); | ||
852 | } | ||
853 | EXPORT_SYMBOL(cfg80211_reg_can_beacon_relax); | ||
854 | |||
832 | int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev, | 855 | int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev, |
833 | struct cfg80211_chan_def *chandef) | 856 | struct cfg80211_chan_def *chandef) |
834 | { | 857 | { |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index c264effd00a6..76b41578a838 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2003,7 +2003,8 @@ static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, | |||
2003 | switch (iftype) { | 2003 | switch (iftype) { |
2004 | case NL80211_IFTYPE_AP: | 2004 | case NL80211_IFTYPE_AP: |
2005 | case NL80211_IFTYPE_P2P_GO: | 2005 | case NL80211_IFTYPE_P2P_GO: |
2006 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, &chandef, iftype)) { | 2006 | if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, &chandef, |
2007 | iftype)) { | ||
2007 | result = -EINVAL; | 2008 | result = -EINVAL; |
2008 | break; | 2009 | break; |
2009 | } | 2010 | } |
@@ -3403,8 +3404,8 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) | |||
3403 | } else if (!nl80211_get_ap_channel(rdev, ¶ms)) | 3404 | } else if (!nl80211_get_ap_channel(rdev, ¶ms)) |
3404 | return -EINVAL; | 3405 | return -EINVAL; |
3405 | 3406 | ||
3406 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, ¶ms.chandef, | 3407 | if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, ¶ms.chandef, |
3407 | wdev->iftype)) | 3408 | wdev->iftype)) |
3408 | return -EINVAL; | 3409 | return -EINVAL; |
3409 | 3410 | ||
3410 | if (info->attrs[NL80211_ATTR_ACL_POLICY]) { | 3411 | if (info->attrs[NL80211_ATTR_ACL_POLICY]) { |
@@ -6492,8 +6493,8 @@ skip_beacons: | |||
6492 | if (err) | 6493 | if (err) |
6493 | return err; | 6494 | return err; |
6494 | 6495 | ||
6495 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, ¶ms.chandef, | 6496 | if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, ¶ms.chandef, |
6496 | wdev->iftype)) | 6497 | wdev->iftype)) |
6497 | return -EINVAL; | 6498 | return -EINVAL; |
6498 | 6499 | ||
6499 | err = cfg80211_chandef_dfs_required(wdev->wiphy, | 6500 | err = cfg80211_chandef_dfs_required(wdev->wiphy, |
@@ -10170,7 +10171,8 @@ static int nl80211_tdls_channel_switch(struct sk_buff *skb, | |||
10170 | return -EINVAL; | 10171 | return -EINVAL; |
10171 | 10172 | ||
10172 | /* we will be active on the TDLS link */ | 10173 | /* we will be active on the TDLS link */ |
10173 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, &chandef, wdev->iftype)) | 10174 | if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, &chandef, |
10175 | wdev->iftype)) | ||
10174 | return -EINVAL; | 10176 | return -EINVAL; |
10175 | 10177 | ||
10176 | /* don't allow switching to DFS channels */ | 10178 | /* don't allow switching to DFS channels */ |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index d359e0610198..aa2d75482017 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -544,15 +544,15 @@ static int call_crda(const char *alpha2) | |||
544 | reg_regdb_query(alpha2); | 544 | reg_regdb_query(alpha2); |
545 | 545 | ||
546 | if (reg_crda_timeouts > REG_MAX_CRDA_TIMEOUTS) { | 546 | if (reg_crda_timeouts > REG_MAX_CRDA_TIMEOUTS) { |
547 | pr_info("Exceeded CRDA call max attempts. Not calling CRDA\n"); | 547 | pr_debug("Exceeded CRDA call max attempts. Not calling CRDA\n"); |
548 | return -EINVAL; | 548 | return -EINVAL; |
549 | } | 549 | } |
550 | 550 | ||
551 | if (!is_world_regdom((char *) alpha2)) | 551 | if (!is_world_regdom((char *) alpha2)) |
552 | pr_info("Calling CRDA for country: %c%c\n", | 552 | pr_debug("Calling CRDA for country: %c%c\n", |
553 | alpha2[0], alpha2[1]); | 553 | alpha2[0], alpha2[1]); |
554 | else | 554 | else |
555 | pr_info("Calling CRDA to update world regulatory domain\n"); | 555 | pr_debug("Calling CRDA to update world regulatory domain\n"); |
556 | 556 | ||
557 | return kobject_uevent_env(®_pdev->dev.kobj, KOBJ_CHANGE, env); | 557 | return kobject_uevent_env(®_pdev->dev.kobj, KOBJ_CHANGE, env); |
558 | } | 558 | } |
@@ -1589,7 +1589,7 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) | |||
1589 | case NL80211_IFTYPE_AP: | 1589 | case NL80211_IFTYPE_AP: |
1590 | case NL80211_IFTYPE_P2P_GO: | 1590 | case NL80211_IFTYPE_P2P_GO: |
1591 | case NL80211_IFTYPE_ADHOC: | 1591 | case NL80211_IFTYPE_ADHOC: |
1592 | return cfg80211_reg_can_beacon(wiphy, &chandef, iftype); | 1592 | return cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype); |
1593 | case NL80211_IFTYPE_STATION: | 1593 | case NL80211_IFTYPE_STATION: |
1594 | case NL80211_IFTYPE_P2P_CLIENT: | 1594 | case NL80211_IFTYPE_P2P_CLIENT: |
1595 | return cfg80211_chandef_usable(wiphy, &chandef, | 1595 | return cfg80211_chandef_usable(wiphy, &chandef, |
diff --git a/net/wireless/trace.h b/net/wireless/trace.h index af3617c9879e..a808279a432a 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h | |||
@@ -2358,20 +2358,23 @@ TRACE_EVENT(cfg80211_cqm_rssi_notify, | |||
2358 | 2358 | ||
2359 | TRACE_EVENT(cfg80211_reg_can_beacon, | 2359 | TRACE_EVENT(cfg80211_reg_can_beacon, |
2360 | TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef, | 2360 | TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef, |
2361 | enum nl80211_iftype iftype), | 2361 | enum nl80211_iftype iftype, bool check_no_ir), |
2362 | TP_ARGS(wiphy, chandef, iftype), | 2362 | TP_ARGS(wiphy, chandef, iftype, check_no_ir), |
2363 | TP_STRUCT__entry( | 2363 | TP_STRUCT__entry( |
2364 | WIPHY_ENTRY | 2364 | WIPHY_ENTRY |
2365 | CHAN_DEF_ENTRY | 2365 | CHAN_DEF_ENTRY |
2366 | __field(enum nl80211_iftype, iftype) | 2366 | __field(enum nl80211_iftype, iftype) |
2367 | __field(bool, check_no_ir) | ||
2367 | ), | 2368 | ), |
2368 | TP_fast_assign( | 2369 | TP_fast_assign( |
2369 | WIPHY_ASSIGN; | 2370 | WIPHY_ASSIGN; |
2370 | CHAN_DEF_ASSIGN(chandef); | 2371 | CHAN_DEF_ASSIGN(chandef); |
2371 | __entry->iftype = iftype; | 2372 | __entry->iftype = iftype; |
2373 | __entry->check_no_ir = check_no_ir; | ||
2372 | ), | 2374 | ), |
2373 | TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT ", iftype=%d", | 2375 | TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT ", iftype=%d check_no_ir=%s", |
2374 | WIPHY_PR_ARG, CHAN_DEF_PR_ARG, __entry->iftype) | 2376 | WIPHY_PR_ARG, CHAN_DEF_PR_ARG, __entry->iftype, |
2377 | BOOL_TO_STR(__entry->check_no_ir)) | ||
2375 | ); | 2378 | ); |
2376 | 2379 | ||
2377 | TRACE_EVENT(cfg80211_chandef_dfs_required, | 2380 | TRACE_EVENT(cfg80211_chandef_dfs_required, |
diff --git a/samples/trace_events/trace-events-sample.h b/samples/trace_events/trace-events-sample.h index 8965d1bb8811..125d6402f64f 100644 --- a/samples/trace_events/trace-events-sample.h +++ b/samples/trace_events/trace-events-sample.h | |||
@@ -168,7 +168,10 @@ | |||
168 | * | 168 | * |
169 | * For __dynamic_array(int, foo, bar) use __get_dynamic_array(foo) | 169 | * For __dynamic_array(int, foo, bar) use __get_dynamic_array(foo) |
170 | * Use __get_dynamic_array_len(foo) to get the length of the array | 170 | * Use __get_dynamic_array_len(foo) to get the length of the array |
171 | * saved. | 171 | * saved. Note, __get_dynamic_array_len() returns the total allocated |
172 | * length of the dynamic array; __print_array() expects the second | ||
173 | * parameter to be the number of elements. To get that, the array length | ||
174 | * needs to be divided by the element size. | ||
172 | * | 175 | * |
173 | * For __string(foo, bar) use __get_str(foo) | 176 | * For __string(foo, bar) use __get_str(foo) |
174 | * | 177 | * |
@@ -288,7 +291,7 @@ TRACE_EVENT(foo_bar, | |||
288 | * This prints out the array that is defined by __array in a nice format. | 291 | * This prints out the array that is defined by __array in a nice format. |
289 | */ | 292 | */ |
290 | __print_array(__get_dynamic_array(list), | 293 | __print_array(__get_dynamic_array(list), |
291 | __get_dynamic_array_len(list), | 294 | __get_dynamic_array_len(list) / sizeof(int), |
292 | sizeof(int)), | 295 | sizeof(int)), |
293 | __get_str(str), __get_bitmask(cpus)) | 296 | __get_str(str), __get_bitmask(cpus)) |
294 | ); | 297 | ); |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 90e1edc8dd42..d5c8e9a3a73c 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -2599,7 +2599,7 @@ sub process { | |||
2599 | # if LONG_LINE is ignored, the other 2 types are also ignored | 2599 | # if LONG_LINE is ignored, the other 2 types are also ignored |
2600 | # | 2600 | # |
2601 | 2601 | ||
2602 | if ($length > $max_line_length) { | 2602 | if ($line =~ /^\+/ && $length > $max_line_length) { |
2603 | my $msg_type = "LONG_LINE"; | 2603 | my $msg_type = "LONG_LINE"; |
2604 | 2604 | ||
2605 | # Check the allowed long line types first | 2605 | # Check the allowed long line types first |
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index eff7de1fc82e..e70fcd12eeeb 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c | |||
@@ -63,6 +63,8 @@ int main(void) | |||
63 | 63 | ||
64 | DEVID(acpi_device_id); | 64 | DEVID(acpi_device_id); |
65 | DEVID_FIELD(acpi_device_id, id); | 65 | DEVID_FIELD(acpi_device_id, id); |
66 | DEVID_FIELD(acpi_device_id, cls); | ||
67 | DEVID_FIELD(acpi_device_id, cls_msk); | ||
66 | 68 | ||
67 | DEVID(pnp_device_id); | 69 | DEVID(pnp_device_id); |
68 | DEVID_FIELD(pnp_device_id, id); | 70 | DEVID_FIELD(pnp_device_id, id); |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 84c86f3cd6cd..5f2088209132 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -523,12 +523,40 @@ static int do_serio_entry(const char *filename, | |||
523 | } | 523 | } |
524 | ADD_TO_DEVTABLE("serio", serio_device_id, do_serio_entry); | 524 | ADD_TO_DEVTABLE("serio", serio_device_id, do_serio_entry); |
525 | 525 | ||
526 | /* looks like: "acpi:ACPI0003 or acpi:PNP0C0B" or "acpi:LNXVIDEO" */ | 526 | /* looks like: "acpi:ACPI0003" or "acpi:PNP0C0B" or "acpi:LNXVIDEO" or |
527 | * "acpi:bbsspp" (bb=base-class, ss=sub-class, pp=prog-if) | ||
528 | * | ||
529 | * NOTE: Each driver should use one of the following : _HID, _CIDs | ||
530 | * or _CLS. Also, bb, ss, and pp can be substituted with ?? | ||
531 | * as don't care byte. | ||
532 | */ | ||
527 | static int do_acpi_entry(const char *filename, | 533 | static int do_acpi_entry(const char *filename, |
528 | void *symval, char *alias) | 534 | void *symval, char *alias) |
529 | { | 535 | { |
530 | DEF_FIELD_ADDR(symval, acpi_device_id, id); | 536 | DEF_FIELD_ADDR(symval, acpi_device_id, id); |
531 | sprintf(alias, "acpi*:%s:*", *id); | 537 | DEF_FIELD_ADDR(symval, acpi_device_id, cls); |
538 | DEF_FIELD_ADDR(symval, acpi_device_id, cls_msk); | ||
539 | |||
540 | if (id && strlen((const char *)*id)) | ||
541 | sprintf(alias, "acpi*:%s:*", *id); | ||
542 | else if (cls) { | ||
543 | int i, byte_shift, cnt = 0; | ||
544 | unsigned int msk; | ||
545 | |||
546 | sprintf(&alias[cnt], "acpi*:"); | ||
547 | cnt = 6; | ||
548 | for (i = 1; i <= 3; i++) { | ||
549 | byte_shift = 8 * (3-i); | ||
550 | msk = (*cls_msk >> byte_shift) & 0xFF; | ||
551 | if (msk) | ||
552 | sprintf(&alias[cnt], "%02x", | ||
553 | (*cls >> byte_shift) & 0xFF); | ||
554 | else | ||
555 | sprintf(&alias[cnt], "??"); | ||
556 | cnt += 2; | ||
557 | } | ||
558 | sprintf(&alias[cnt], ":*"); | ||
559 | } | ||
532 | return 1; | 560 | return 1; |
533 | } | 561 | } |
534 | ADD_TO_DEVTABLE("acpi", acpi_device_id, do_acpi_entry); | 562 | ADD_TO_DEVTABLE("acpi", acpi_device_id, do_acpi_entry); |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 91ee1b2e0f9a..12d3db3bd46b 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -886,7 +886,8 @@ static void check_section(const char *modname, struct elf_info *elf, | |||
886 | #define TEXT_SECTIONS ".text", ".text.unlikely", ".sched.text", \ | 886 | #define TEXT_SECTIONS ".text", ".text.unlikely", ".sched.text", \ |
887 | ".kprobes.text" | 887 | ".kprobes.text" |
888 | #define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \ | 888 | #define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \ |
889 | ".fixup", ".entry.text", ".exception.text", ".text.*" | 889 | ".fixup", ".entry.text", ".exception.text", ".text.*", \ |
890 | ".coldtext" | ||
890 | 891 | ||
891 | #define INIT_SECTIONS ".init.*" | 892 | #define INIT_SECTIONS ".init.*" |
892 | #define MEM_INIT_SECTIONS ".meminit.*" | 893 | #define MEM_INIT_SECTIONS ".meminit.*" |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 623108199641..564079c5c49d 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -3283,7 +3283,8 @@ static int file_map_prot_check(struct file *file, unsigned long prot, int shared | |||
3283 | int rc = 0; | 3283 | int rc = 0; |
3284 | 3284 | ||
3285 | if (default_noexec && | 3285 | if (default_noexec && |
3286 | (prot & PROT_EXEC) && (!file || (!shared && (prot & PROT_WRITE)))) { | 3286 | (prot & PROT_EXEC) && (!file || IS_PRIVATE(file_inode(file)) || |
3287 | (!shared && (prot & PROT_WRITE)))) { | ||
3287 | /* | 3288 | /* |
3288 | * We are making executable an anonymous mapping or a | 3289 | * We are making executable an anonymous mapping or a |
3289 | * private file mapping that will also be writable. | 3290 | * private file mapping that will also be writable. |
diff --git a/security/selinux/ss/ebitmap.c b/security/selinux/ss/ebitmap.c index afe6a269ec17..57644b1dc42e 100644 --- a/security/selinux/ss/ebitmap.c +++ b/security/selinux/ss/ebitmap.c | |||
@@ -153,6 +153,12 @@ int ebitmap_netlbl_import(struct ebitmap *ebmap, | |||
153 | if (offset == (u32)-1) | 153 | if (offset == (u32)-1) |
154 | return 0; | 154 | return 0; |
155 | 155 | ||
156 | /* don't waste ebitmap space if the netlabel bitmap is empty */ | ||
157 | if (bitmap == 0) { | ||
158 | offset += EBITMAP_UNIT_SIZE; | ||
159 | continue; | ||
160 | } | ||
161 | |||
156 | if (e_iter == NULL || | 162 | if (e_iter == NULL || |
157 | offset >= e_iter->startbit + EBITMAP_SIZE) { | 163 | offset >= e_iter->startbit + EBITMAP_SIZE) { |
158 | e_prev = e_iter; | 164 | e_prev = e_iter; |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index d126c03361ae..75888dd38a7f 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -85,7 +85,7 @@ static DECLARE_RWSEM(snd_pcm_link_rwsem); | |||
85 | void snd_pcm_stream_lock(struct snd_pcm_substream *substream) | 85 | void snd_pcm_stream_lock(struct snd_pcm_substream *substream) |
86 | { | 86 | { |
87 | if (substream->pcm->nonatomic) { | 87 | if (substream->pcm->nonatomic) { |
88 | down_read(&snd_pcm_link_rwsem); | 88 | down_read_nested(&snd_pcm_link_rwsem, SINGLE_DEPTH_NESTING); |
89 | mutex_lock(&substream->self_group.mutex); | 89 | mutex_lock(&substream->self_group.mutex); |
90 | } else { | 90 | } else { |
91 | read_lock(&snd_pcm_link_rwlock); | 91 | read_lock(&snd_pcm_link_rwlock); |
diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c index 442500e06b7c..5676b849379d 100644 --- a/sound/hda/hdac_i915.c +++ b/sound/hda/hdac_i915.c | |||
@@ -56,8 +56,11 @@ int snd_hdac_display_power(struct hdac_bus *bus, bool enable) | |||
56 | enable ? "enable" : "disable"); | 56 | enable ? "enable" : "disable"); |
57 | 57 | ||
58 | if (enable) { | 58 | if (enable) { |
59 | if (!bus->i915_power_refcount++) | 59 | if (!bus->i915_power_refcount++) { |
60 | acomp->ops->get_power(acomp->dev); | 60 | acomp->ops->get_power(acomp->dev); |
61 | snd_hdac_set_codec_wakeup(bus, true); | ||
62 | snd_hdac_set_codec_wakeup(bus, false); | ||
63 | } | ||
61 | } else { | 64 | } else { |
62 | WARN_ON(!bus->i915_power_refcount); | 65 | WARN_ON(!bus->i915_power_refcount); |
63 | if (!--bus->i915_power_refcount) | 66 | if (!--bus->i915_power_refcount) |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index ac0db1679f09..b077bb644434 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -5175,7 +5175,7 @@ static int alt_playback_pcm_open(struct hda_pcm_stream *hinfo, | |||
5175 | int err = 0; | 5175 | int err = 0; |
5176 | 5176 | ||
5177 | mutex_lock(&spec->pcm_mutex); | 5177 | mutex_lock(&spec->pcm_mutex); |
5178 | if (!spec->indep_hp_enabled) | 5178 | if (spec->indep_hp && !spec->indep_hp_enabled) |
5179 | err = -EBUSY; | 5179 | err = -EBUSY; |
5180 | else | 5180 | else |
5181 | spec->active_streams |= 1 << STREAM_INDEP_HP; | 5181 | spec->active_streams |= 1 << STREAM_INDEP_HP; |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 745535d1840a..735bdcb04ce8 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -979,14 +979,16 @@ static int azx_runtime_resume(struct device *dev) | |||
979 | if (!azx_has_pm_runtime(chip)) | 979 | if (!azx_has_pm_runtime(chip)) |
980 | return 0; | 980 | return 0; |
981 | 981 | ||
982 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL | 982 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
983 | && hda->need_i915_power) { | 983 | bus = azx_bus(chip); |
984 | bus = azx_bus(chip); | 984 | if (hda->need_i915_power) { |
985 | snd_hdac_display_power(bus, true); | 985 | snd_hdac_display_power(bus, true); |
986 | haswell_set_bclk(hda); | 986 | haswell_set_bclk(hda); |
987 | /* toggle codec wakeup bit for STATESTS read */ | 987 | } else { |
988 | snd_hdac_set_codec_wakeup(bus, true); | 988 | /* toggle codec wakeup bit for STATESTS read */ |
989 | snd_hdac_set_codec_wakeup(bus, false); | 989 | snd_hdac_set_codec_wakeup(bus, true); |
990 | snd_hdac_set_codec_wakeup(bus, false); | ||
991 | } | ||
990 | } | 992 | } |
991 | 993 | ||
992 | /* Read STATESTS before controller reset */ | 994 | /* Read STATESTS before controller reset */ |
@@ -2182,6 +2184,8 @@ static const struct pci_device_id azx_ids[] = { | |||
2182 | /* ATI HDMI */ | 2184 | /* ATI HDMI */ |
2183 | { PCI_DEVICE(0x1002, 0x1308), | 2185 | { PCI_DEVICE(0x1002, 0x1308), |
2184 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, | 2186 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
2187 | { PCI_DEVICE(0x1002, 0x157a), | ||
2188 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, | ||
2185 | { PCI_DEVICE(0x1002, 0x793b), | 2189 | { PCI_DEVICE(0x1002, 0x793b), |
2186 | .driver_data = AZX_DRIVER_ATIHDMI | AZX_DCAPS_PRESET_ATI_HDMI }, | 2190 | .driver_data = AZX_DRIVER_ATIHDMI | AZX_DCAPS_PRESET_ATI_HDMI }, |
2187 | { PCI_DEVICE(0x1002, 0x7919), | 2191 | { PCI_DEVICE(0x1002, 0x7919), |
@@ -2236,8 +2240,14 @@ static const struct pci_device_id azx_ids[] = { | |||
2236 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, | 2240 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
2237 | { PCI_DEVICE(0x1002, 0xaab0), | 2241 | { PCI_DEVICE(0x1002, 0xaab0), |
2238 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, | 2242 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
2243 | { PCI_DEVICE(0x1002, 0xaac0), | ||
2244 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, | ||
2239 | { PCI_DEVICE(0x1002, 0xaac8), | 2245 | { PCI_DEVICE(0x1002, 0xaac8), |
2240 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, | 2246 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
2247 | { PCI_DEVICE(0x1002, 0xaad8), | ||
2248 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, | ||
2249 | { PCI_DEVICE(0x1002, 0xaae8), | ||
2250 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, | ||
2241 | /* VIA VT8251/VT8237A */ | 2251 | /* VIA VT8251/VT8237A */ |
2242 | { PCI_DEVICE(0x1106, 0x3288), | 2252 | { PCI_DEVICE(0x1106, 0x3288), |
2243 | .driver_data = AZX_DRIVER_VIA | AZX_DCAPS_POSFIX_VIA }, | 2253 | .driver_data = AZX_DRIVER_VIA | AZX_DCAPS_POSFIX_VIA }, |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 2f2433845d04..a97db5fc8a15 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -3512,6 +3512,7 @@ static const struct hda_codec_preset snd_hda_preset_hdmi[] = { | |||
3512 | { .id = 0x10de0070, .name = "GPU 70 HDMI/DP", .patch = patch_nvhdmi }, | 3512 | { .id = 0x10de0070, .name = "GPU 70 HDMI/DP", .patch = patch_nvhdmi }, |
3513 | { .id = 0x10de0071, .name = "GPU 71 HDMI/DP", .patch = patch_nvhdmi }, | 3513 | { .id = 0x10de0071, .name = "GPU 71 HDMI/DP", .patch = patch_nvhdmi }, |
3514 | { .id = 0x10de0072, .name = "GPU 72 HDMI/DP", .patch = patch_nvhdmi }, | 3514 | { .id = 0x10de0072, .name = "GPU 72 HDMI/DP", .patch = patch_nvhdmi }, |
3515 | { .id = 0x10de007d, .name = "GPU 7d HDMI/DP", .patch = patch_nvhdmi }, | ||
3515 | { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, | 3516 | { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, |
3516 | { .id = 0x11069f80, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, | 3517 | { .id = 0x11069f80, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, |
3517 | { .id = 0x11069f81, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, | 3518 | { .id = 0x11069f81, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, |
@@ -3527,6 +3528,7 @@ static const struct hda_codec_preset snd_hda_preset_hdmi[] = { | |||
3527 | { .id = 0x80862807, .name = "Haswell HDMI", .patch = patch_generic_hdmi }, | 3528 | { .id = 0x80862807, .name = "Haswell HDMI", .patch = patch_generic_hdmi }, |
3528 | { .id = 0x80862808, .name = "Broadwell HDMI", .patch = patch_generic_hdmi }, | 3529 | { .id = 0x80862808, .name = "Broadwell HDMI", .patch = patch_generic_hdmi }, |
3529 | { .id = 0x80862809, .name = "Skylake HDMI", .patch = patch_generic_hdmi }, | 3530 | { .id = 0x80862809, .name = "Skylake HDMI", .patch = patch_generic_hdmi }, |
3531 | { .id = 0x8086280a, .name = "Broxton HDMI", .patch = patch_generic_hdmi }, | ||
3530 | { .id = 0x80862880, .name = "CedarTrail HDMI", .patch = patch_generic_hdmi }, | 3532 | { .id = 0x80862880, .name = "CedarTrail HDMI", .patch = patch_generic_hdmi }, |
3531 | { .id = 0x80862882, .name = "Valleyview2 HDMI", .patch = patch_generic_hdmi }, | 3533 | { .id = 0x80862882, .name = "Valleyview2 HDMI", .patch = patch_generic_hdmi }, |
3532 | { .id = 0x80862883, .name = "Braswell HDMI", .patch = patch_generic_hdmi }, | 3534 | { .id = 0x80862883, .name = "Braswell HDMI", .patch = patch_generic_hdmi }, |
@@ -3575,6 +3577,7 @@ MODULE_ALIAS("snd-hda-codec-id:10de0067"); | |||
3575 | MODULE_ALIAS("snd-hda-codec-id:10de0070"); | 3577 | MODULE_ALIAS("snd-hda-codec-id:10de0070"); |
3576 | MODULE_ALIAS("snd-hda-codec-id:10de0071"); | 3578 | MODULE_ALIAS("snd-hda-codec-id:10de0071"); |
3577 | MODULE_ALIAS("snd-hda-codec-id:10de0072"); | 3579 | MODULE_ALIAS("snd-hda-codec-id:10de0072"); |
3580 | MODULE_ALIAS("snd-hda-codec-id:10de007d"); | ||
3578 | MODULE_ALIAS("snd-hda-codec-id:10de8001"); | 3581 | MODULE_ALIAS("snd-hda-codec-id:10de8001"); |
3579 | MODULE_ALIAS("snd-hda-codec-id:11069f80"); | 3582 | MODULE_ALIAS("snd-hda-codec-id:11069f80"); |
3580 | MODULE_ALIAS("snd-hda-codec-id:11069f81"); | 3583 | MODULE_ALIAS("snd-hda-codec-id:11069f81"); |
@@ -3591,6 +3594,7 @@ MODULE_ALIAS("snd-hda-codec-id:80862806"); | |||
3591 | MODULE_ALIAS("snd-hda-codec-id:80862807"); | 3594 | MODULE_ALIAS("snd-hda-codec-id:80862807"); |
3592 | MODULE_ALIAS("snd-hda-codec-id:80862808"); | 3595 | MODULE_ALIAS("snd-hda-codec-id:80862808"); |
3593 | MODULE_ALIAS("snd-hda-codec-id:80862809"); | 3596 | MODULE_ALIAS("snd-hda-codec-id:80862809"); |
3597 | MODULE_ALIAS("snd-hda-codec-id:8086280a"); | ||
3594 | MODULE_ALIAS("snd-hda-codec-id:80862880"); | 3598 | MODULE_ALIAS("snd-hda-codec-id:80862880"); |
3595 | MODULE_ALIAS("snd-hda-codec-id:80862882"); | 3599 | MODULE_ALIAS("snd-hda-codec-id:80862882"); |
3596 | MODULE_ALIAS("snd-hda-codec-id:80862883"); | 3600 | MODULE_ALIAS("snd-hda-codec-id:80862883"); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index b3b44681d3cf..742fc626f9e1 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4441,6 +4441,55 @@ static void alc290_fixup_mono_speakers(struct hda_codec *codec, | |||
4441 | } | 4441 | } |
4442 | } | 4442 | } |
4443 | 4443 | ||
4444 | /* Hook to update amp GPIO4 for automute */ | ||
4445 | static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, | ||
4446 | struct hda_jack_callback *jack) | ||
4447 | { | ||
4448 | struct alc_spec *spec = codec->spec; | ||
4449 | |||
4450 | snd_hda_gen_hp_automute(codec, jack); | ||
4451 | /* mute_led_polarity is set to 0, so we pass inverted value here */ | ||
4452 | alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present); | ||
4453 | } | ||
4454 | |||
4455 | /* Manage GPIOs for HP EliteBook Folio 9480m. | ||
4456 | * | ||
4457 | * GPIO4 is the headphone amplifier power control | ||
4458 | * GPIO3 is the audio output mute indicator LED | ||
4459 | */ | ||
4460 | |||
4461 | static void alc280_fixup_hp_9480m(struct hda_codec *codec, | ||
4462 | const struct hda_fixup *fix, | ||
4463 | int action) | ||
4464 | { | ||
4465 | struct alc_spec *spec = codec->spec; | ||
4466 | static const struct hda_verb gpio_init[] = { | ||
4467 | { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 }, | ||
4468 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 }, | ||
4469 | {} | ||
4470 | }; | ||
4471 | |||
4472 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
4473 | /* Set the hooks to turn the headphone amp on/off | ||
4474 | * as needed | ||
4475 | */ | ||
4476 | spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; | ||
4477 | spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook; | ||
4478 | |||
4479 | /* The GPIOs are currently off */ | ||
4480 | spec->gpio_led = 0; | ||
4481 | |||
4482 | /* GPIO3 is connected to the output mute LED, | ||
4483 | * high is on, low is off | ||
4484 | */ | ||
4485 | spec->mute_led_polarity = 0; | ||
4486 | spec->gpio_mute_led_mask = 0x08; | ||
4487 | |||
4488 | /* Initialize GPIO configuration */ | ||
4489 | snd_hda_add_verbs(codec, gpio_init); | ||
4490 | } | ||
4491 | } | ||
4492 | |||
4444 | /* for hda_fixup_thinkpad_acpi() */ | 4493 | /* for hda_fixup_thinkpad_acpi() */ |
4445 | #include "thinkpad_helper.c" | 4494 | #include "thinkpad_helper.c" |
4446 | 4495 | ||
@@ -4521,6 +4570,7 @@ enum { | |||
4521 | ALC286_FIXUP_HP_GPIO_LED, | 4570 | ALC286_FIXUP_HP_GPIO_LED, |
4522 | ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, | 4571 | ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, |
4523 | ALC280_FIXUP_HP_DOCK_PINS, | 4572 | ALC280_FIXUP_HP_DOCK_PINS, |
4573 | ALC280_FIXUP_HP_9480M, | ||
4524 | ALC288_FIXUP_DELL_HEADSET_MODE, | 4574 | ALC288_FIXUP_DELL_HEADSET_MODE, |
4525 | ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, | 4575 | ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, |
4526 | ALC288_FIXUP_DELL_XPS_13_GPIO6, | 4576 | ALC288_FIXUP_DELL_XPS_13_GPIO6, |
@@ -5011,7 +5061,7 @@ static const struct hda_fixup alc269_fixups[] = { | |||
5011 | { 0x14, 0x90170110 }, | 5061 | { 0x14, 0x90170110 }, |
5012 | { 0x17, 0x40000008 }, | 5062 | { 0x17, 0x40000008 }, |
5013 | { 0x18, 0x411111f0 }, | 5063 | { 0x18, 0x411111f0 }, |
5014 | { 0x19, 0x411111f0 }, | 5064 | { 0x19, 0x01a1913c }, |
5015 | { 0x1a, 0x411111f0 }, | 5065 | { 0x1a, 0x411111f0 }, |
5016 | { 0x1b, 0x411111f0 }, | 5066 | { 0x1b, 0x411111f0 }, |
5017 | { 0x1d, 0x40f89b2d }, | 5067 | { 0x1d, 0x40f89b2d }, |
@@ -5043,6 +5093,10 @@ static const struct hda_fixup alc269_fixups[] = { | |||
5043 | .chained = true, | 5093 | .chained = true, |
5044 | .chain_id = ALC280_FIXUP_HP_GPIO4 | 5094 | .chain_id = ALC280_FIXUP_HP_GPIO4 |
5045 | }, | 5095 | }, |
5096 | [ALC280_FIXUP_HP_9480M] = { | ||
5097 | .type = HDA_FIXUP_FUNC, | ||
5098 | .v.func = alc280_fixup_hp_9480m, | ||
5099 | }, | ||
5046 | [ALC288_FIXUP_DELL_HEADSET_MODE] = { | 5100 | [ALC288_FIXUP_DELL_HEADSET_MODE] = { |
5047 | .type = HDA_FIXUP_FUNC, | 5101 | .type = HDA_FIXUP_FUNC, |
5048 | .v.func = alc_fixup_headset_mode_dell_alc288, | 5102 | .v.func = alc_fixup_headset_mode_dell_alc288, |
@@ -5161,6 +5215,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
5161 | SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 5215 | SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
5162 | SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 5216 | SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
5163 | SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 5217 | SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
5218 | SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M), | ||
5164 | SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 5219 | SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
5165 | SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 5220 | SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
5166 | /* ALC290 */ | 5221 | /* ALC290 */ |
@@ -5375,8 +5430,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { | |||
5375 | {0x15, 0x0221401f}, \ | 5430 | {0x15, 0x0221401f}, \ |
5376 | {0x1a, 0x411111f0}, \ | 5431 | {0x1a, 0x411111f0}, \ |
5377 | {0x1b, 0x411111f0}, \ | 5432 | {0x1b, 0x411111f0}, \ |
5378 | {0x1d, 0x40700001}, \ | 5433 | {0x1d, 0x40700001} |
5379 | {0x1e, 0x411111f0} | ||
5380 | 5434 | ||
5381 | #define ALC298_STANDARD_PINS \ | 5435 | #define ALC298_STANDARD_PINS \ |
5382 | {0x18, 0x411111f0}, \ | 5436 | {0x18, 0x411111f0}, \ |
@@ -5408,6 +5462,17 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | |||
5408 | {0x1d, 0x40700001}, | 5462 | {0x1d, 0x40700001}, |
5409 | {0x21, 0x02211030}), | 5463 | {0x21, 0x02211030}), |
5410 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5464 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
5465 | {0x12, 0x40000000}, | ||
5466 | {0x14, 0x90170130}, | ||
5467 | {0x17, 0x411111f0}, | ||
5468 | {0x18, 0x411111f0}, | ||
5469 | {0x19, 0x411111f0}, | ||
5470 | {0x1a, 0x411111f0}, | ||
5471 | {0x1b, 0x01014020}, | ||
5472 | {0x1d, 0x4054c029}, | ||
5473 | {0x1e, 0x411111f0}, | ||
5474 | {0x21, 0x0221103f}), | ||
5475 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
5411 | {0x12, 0x90a60160}, | 5476 | {0x12, 0x90a60160}, |
5412 | {0x14, 0x90170120}, | 5477 | {0x14, 0x90170120}, |
5413 | {0x17, 0x90170140}, | 5478 | {0x17, 0x90170140}, |
@@ -5635,35 +5700,48 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | |||
5635 | {0x13, 0x411111f0}, | 5700 | {0x13, 0x411111f0}, |
5636 | {0x16, 0x01014020}, | 5701 | {0x16, 0x01014020}, |
5637 | {0x18, 0x411111f0}, | 5702 | {0x18, 0x411111f0}, |
5638 | {0x19, 0x01a19030}), | 5703 | {0x19, 0x01a19030}, |
5704 | {0x1e, 0x411111f0}), | ||
5639 | SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, | 5705 | SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, |
5640 | ALC292_STANDARD_PINS, | 5706 | ALC292_STANDARD_PINS, |
5641 | {0x12, 0x90a60140}, | 5707 | {0x12, 0x90a60140}, |
5642 | {0x13, 0x411111f0}, | 5708 | {0x13, 0x411111f0}, |
5643 | {0x16, 0x01014020}, | 5709 | {0x16, 0x01014020}, |
5644 | {0x18, 0x02a19031}, | 5710 | {0x18, 0x02a19031}, |
5645 | {0x19, 0x01a1903e}), | 5711 | {0x19, 0x01a1903e}, |
5712 | {0x1e, 0x411111f0}), | ||
5646 | SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, | 5713 | SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, |
5647 | ALC292_STANDARD_PINS, | 5714 | ALC292_STANDARD_PINS, |
5648 | {0x12, 0x90a60140}, | 5715 | {0x12, 0x90a60140}, |
5649 | {0x13, 0x411111f0}, | 5716 | {0x13, 0x411111f0}, |
5650 | {0x16, 0x411111f0}, | 5717 | {0x16, 0x411111f0}, |
5651 | {0x18, 0x411111f0}, | 5718 | {0x18, 0x411111f0}, |
5652 | {0x19, 0x411111f0}), | 5719 | {0x19, 0x411111f0}, |
5720 | {0x1e, 0x411111f0}), | ||
5653 | SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, | 5721 | SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, |
5654 | ALC292_STANDARD_PINS, | 5722 | ALC292_STANDARD_PINS, |
5655 | {0x12, 0x40000000}, | 5723 | {0x12, 0x40000000}, |
5656 | {0x13, 0x90a60140}, | 5724 | {0x13, 0x90a60140}, |
5657 | {0x16, 0x21014020}, | 5725 | {0x16, 0x21014020}, |
5658 | {0x18, 0x411111f0}, | 5726 | {0x18, 0x411111f0}, |
5659 | {0x19, 0x21a19030}), | 5727 | {0x19, 0x21a19030}, |
5728 | {0x1e, 0x411111f0}), | ||
5660 | SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, | 5729 | SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, |
5661 | ALC292_STANDARD_PINS, | 5730 | ALC292_STANDARD_PINS, |
5662 | {0x12, 0x40000000}, | 5731 | {0x12, 0x40000000}, |
5663 | {0x13, 0x90a60140}, | 5732 | {0x13, 0x90a60140}, |
5664 | {0x16, 0x411111f0}, | 5733 | {0x16, 0x411111f0}, |
5665 | {0x18, 0x411111f0}, | 5734 | {0x18, 0x411111f0}, |
5666 | {0x19, 0x411111f0}), | 5735 | {0x19, 0x411111f0}, |
5736 | {0x1e, 0x411111f0}), | ||
5737 | SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
5738 | ALC292_STANDARD_PINS, | ||
5739 | {0x12, 0x40000000}, | ||
5740 | {0x13, 0x90a60140}, | ||
5741 | {0x16, 0x21014020}, | ||
5742 | {0x18, 0x411111f0}, | ||
5743 | {0x19, 0x21a19030}, | ||
5744 | {0x1e, 0x411111ff}), | ||
5667 | SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, | 5745 | SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, |
5668 | ALC298_STANDARD_PINS, | 5746 | ALC298_STANDARD_PINS, |
5669 | {0x12, 0x90a60130}, | 5747 | {0x12, 0x90a60130}, |
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c index 1b1a89e80d13..784ceb85b2d9 100644 --- a/sound/sparc/amd7930.c +++ b/sound/sparc/amd7930.c | |||
@@ -956,6 +956,7 @@ static int snd_amd7930_create(struct snd_card *card, | |||
956 | if (!amd->regs) { | 956 | if (!amd->regs) { |
957 | snd_printk(KERN_ERR | 957 | snd_printk(KERN_ERR |
958 | "amd7930-%d: Unable to map chip registers.\n", dev); | 958 | "amd7930-%d: Unable to map chip registers.\n", dev); |
959 | kfree(amd); | ||
959 | return -EIO; | 960 | return -EIO; |
960 | } | 961 | } |
961 | 962 | ||
diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c index 8461d6bf992f..204cc074adb9 100644 --- a/sound/usb/line6/pcm.c +++ b/sound/usb/line6/pcm.c | |||
@@ -186,12 +186,8 @@ static int line6_stream_start(struct snd_line6_pcm *line6pcm, int direction, | |||
186 | int ret = 0; | 186 | int ret = 0; |
187 | 187 | ||
188 | spin_lock_irqsave(&pstr->lock, flags); | 188 | spin_lock_irqsave(&pstr->lock, flags); |
189 | if (!test_and_set_bit(type, &pstr->running)) { | 189 | if (!test_and_set_bit(type, &pstr->running) && |
190 | if (pstr->active_urbs || pstr->unlink_urbs) { | 190 | !(pstr->active_urbs || pstr->unlink_urbs)) { |
191 | ret = -EBUSY; | ||
192 | goto error; | ||
193 | } | ||
194 | |||
195 | pstr->count = 0; | 191 | pstr->count = 0; |
196 | /* Submit all currently available URBs */ | 192 | /* Submit all currently available URBs */ |
197 | if (direction == SNDRV_PCM_STREAM_PLAYBACK) | 193 | if (direction == SNDRV_PCM_STREAM_PLAYBACK) |
@@ -199,7 +195,6 @@ static int line6_stream_start(struct snd_line6_pcm *line6pcm, int direction, | |||
199 | else | 195 | else |
200 | ret = line6_submit_audio_in_all_urbs(line6pcm); | 196 | ret = line6_submit_audio_in_all_urbs(line6pcm); |
201 | } | 197 | } |
202 | error: | ||
203 | if (ret < 0) | 198 | if (ret < 0) |
204 | clear_bit(type, &pstr->running); | 199 | clear_bit(type, &pstr->running); |
205 | spin_unlock_irqrestore(&pstr->lock, flags); | 200 | spin_unlock_irqrestore(&pstr->lock, flags); |
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index 2f6d3e9a1bcd..e4756651a52c 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h | |||
@@ -2512,6 +2512,74 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
2512 | } | 2512 | } |
2513 | }, | 2513 | }, |
2514 | 2514 | ||
2515 | /* Steinberg devices */ | ||
2516 | { | ||
2517 | /* Steinberg MI2 */ | ||
2518 | USB_DEVICE_VENDOR_SPEC(0x0a4e, 0x2040), | ||
2519 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | ||
2520 | .ifnum = QUIRK_ANY_INTERFACE, | ||
2521 | .type = QUIRK_COMPOSITE, | ||
2522 | .data = & (const struct snd_usb_audio_quirk[]) { | ||
2523 | { | ||
2524 | .ifnum = 0, | ||
2525 | .type = QUIRK_AUDIO_STANDARD_INTERFACE | ||
2526 | }, | ||
2527 | { | ||
2528 | .ifnum = 1, | ||
2529 | .type = QUIRK_AUDIO_STANDARD_INTERFACE | ||
2530 | }, | ||
2531 | { | ||
2532 | .ifnum = 2, | ||
2533 | .type = QUIRK_AUDIO_STANDARD_INTERFACE | ||
2534 | }, | ||
2535 | { | ||
2536 | .ifnum = 3, | ||
2537 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | ||
2538 | .data = &(const struct snd_usb_midi_endpoint_info) { | ||
2539 | .out_cables = 0x0001, | ||
2540 | .in_cables = 0x0001 | ||
2541 | } | ||
2542 | }, | ||
2543 | { | ||
2544 | .ifnum = -1 | ||
2545 | } | ||
2546 | } | ||
2547 | } | ||
2548 | }, | ||
2549 | { | ||
2550 | /* Steinberg MI4 */ | ||
2551 | USB_DEVICE_VENDOR_SPEC(0x0a4e, 0x4040), | ||
2552 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | ||
2553 | .ifnum = QUIRK_ANY_INTERFACE, | ||
2554 | .type = QUIRK_COMPOSITE, | ||
2555 | .data = & (const struct snd_usb_audio_quirk[]) { | ||
2556 | { | ||
2557 | .ifnum = 0, | ||
2558 | .type = QUIRK_AUDIO_STANDARD_INTERFACE | ||
2559 | }, | ||
2560 | { | ||
2561 | .ifnum = 1, | ||
2562 | .type = QUIRK_AUDIO_STANDARD_INTERFACE | ||
2563 | }, | ||
2564 | { | ||
2565 | .ifnum = 2, | ||
2566 | .type = QUIRK_AUDIO_STANDARD_INTERFACE | ||
2567 | }, | ||
2568 | { | ||
2569 | .ifnum = 3, | ||
2570 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | ||
2571 | .data = &(const struct snd_usb_midi_endpoint_info) { | ||
2572 | .out_cables = 0x0001, | ||
2573 | .in_cables = 0x0001 | ||
2574 | } | ||
2575 | }, | ||
2576 | { | ||
2577 | .ifnum = -1 | ||
2578 | } | ||
2579 | } | ||
2580 | } | ||
2581 | }, | ||
2582 | |||
2515 | /* TerraTec devices */ | 2583 | /* TerraTec devices */ |
2516 | { | 2584 | { |
2517 | USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0012), | 2585 | USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0012), |
diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile index 8bd960658463..fe1b02c2c95b 100644 --- a/tools/lib/api/Makefile +++ b/tools/lib/api/Makefile | |||
@@ -36,7 +36,7 @@ $(LIBFILE): $(API_IN) | |||
36 | 36 | ||
37 | clean: | 37 | clean: |
38 | $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \ | 38 | $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \ |
39 | find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM) | 39 | find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) |
40 | 40 | ||
41 | FORCE: | 41 | FORCE: |
42 | 42 | ||
diff --git a/tools/lib/hweight.c b/tools/lib/hweight.c new file mode 100644 index 000000000000..0b859b884339 --- /dev/null +++ b/tools/lib/hweight.c | |||
@@ -0,0 +1,62 @@ | |||
1 | #include <linux/bitops.h> | ||
2 | #include <asm/types.h> | ||
3 | |||
4 | /** | ||
5 | * hweightN - returns the hamming weight of a N-bit word | ||
6 | * @x: the word to weigh | ||
7 | * | ||
8 | * The Hamming Weight of a number is the total number of bits set in it. | ||
9 | */ | ||
10 | |||
11 | unsigned int __sw_hweight32(unsigned int w) | ||
12 | { | ||
13 | #ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER | ||
14 | w -= (w >> 1) & 0x55555555; | ||
15 | w = (w & 0x33333333) + ((w >> 2) & 0x33333333); | ||
16 | w = (w + (w >> 4)) & 0x0f0f0f0f; | ||
17 | return (w * 0x01010101) >> 24; | ||
18 | #else | ||
19 | unsigned int res = w - ((w >> 1) & 0x55555555); | ||
20 | res = (res & 0x33333333) + ((res >> 2) & 0x33333333); | ||
21 | res = (res + (res >> 4)) & 0x0F0F0F0F; | ||
22 | res = res + (res >> 8); | ||
23 | return (res + (res >> 16)) & 0x000000FF; | ||
24 | #endif | ||
25 | } | ||
26 | |||
27 | unsigned int __sw_hweight16(unsigned int w) | ||
28 | { | ||
29 | unsigned int res = w - ((w >> 1) & 0x5555); | ||
30 | res = (res & 0x3333) + ((res >> 2) & 0x3333); | ||
31 | res = (res + (res >> 4)) & 0x0F0F; | ||
32 | return (res + (res >> 8)) & 0x00FF; | ||
33 | } | ||
34 | |||
35 | unsigned int __sw_hweight8(unsigned int w) | ||
36 | { | ||
37 | unsigned int res = w - ((w >> 1) & 0x55); | ||
38 | res = (res & 0x33) + ((res >> 2) & 0x33); | ||
39 | return (res + (res >> 4)) & 0x0F; | ||
40 | } | ||
41 | |||
42 | unsigned long __sw_hweight64(__u64 w) | ||
43 | { | ||
44 | #if BITS_PER_LONG == 32 | ||
45 | return __sw_hweight32((unsigned int)(w >> 32)) + | ||
46 | __sw_hweight32((unsigned int)w); | ||
47 | #elif BITS_PER_LONG == 64 | ||
48 | #ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER | ||
49 | w -= (w >> 1) & 0x5555555555555555ul; | ||
50 | w = (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul); | ||
51 | w = (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful; | ||
52 | return (w * 0x0101010101010101ul) >> 56; | ||
53 | #else | ||
54 | __u64 res = w - ((w >> 1) & 0x5555555555555555ul); | ||
55 | res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul); | ||
56 | res = (res + (res >> 4)) & 0x0F0F0F0F0F0F0F0Ful; | ||
57 | res = res + (res >> 8); | ||
58 | res = res + (res >> 16); | ||
59 | return (res + (res >> 32)) & 0x00000000000000FFul; | ||
60 | #endif | ||
61 | #endif | ||
62 | } | ||
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile index 6daaff652aff..7851df1490e0 100644 --- a/tools/lib/traceevent/Makefile +++ b/tools/lib/traceevent/Makefile | |||
@@ -268,7 +268,7 @@ install: install_lib | |||
268 | 268 | ||
269 | clean: | 269 | clean: |
270 | $(call QUIET_CLEAN, libtraceevent) \ | 270 | $(call QUIET_CLEAN, libtraceevent) \ |
271 | $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d \ | 271 | $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd \ |
272 | $(RM) TRACEEVENT-CFLAGS tags TAGS | 272 | $(RM) TRACEEVENT-CFLAGS tags TAGS |
273 | 273 | ||
274 | PHONY += force plugins | 274 | PHONY += force plugins |
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST index 09dc0aabb515..d01a0aad5a01 100644 --- a/tools/perf/MANIFEST +++ b/tools/perf/MANIFEST | |||
@@ -18,6 +18,7 @@ tools/arch/x86/include/asm/atomic.h | |||
18 | tools/arch/x86/include/asm/rmwcc.h | 18 | tools/arch/x86/include/asm/rmwcc.h |
19 | tools/lib/traceevent | 19 | tools/lib/traceevent |
20 | tools/lib/api | 20 | tools/lib/api |
21 | tools/lib/hweight.c | ||
21 | tools/lib/rbtree.c | 22 | tools/lib/rbtree.c |
22 | tools/lib/symbol/kallsyms.c | 23 | tools/lib/symbol/kallsyms.c |
23 | tools/lib/symbol/kallsyms.h | 24 | tools/lib/symbol/kallsyms.h |
@@ -57,7 +58,6 @@ include/linux/perf_event.h | |||
57 | include/linux/list.h | 58 | include/linux/list.h |
58 | include/linux/hash.h | 59 | include/linux/hash.h |
59 | include/linux/stringify.h | 60 | include/linux/stringify.h |
60 | lib/hweight.c | ||
61 | include/linux/swab.h | 61 | include/linux/swab.h |
62 | arch/*/include/asm/unistd*.h | 62 | arch/*/include/asm/unistd*.h |
63 | arch/*/include/uapi/asm/unistd*.h | 63 | arch/*/include/uapi/asm/unistd*.h |
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 7a4b549214e3..bba34636b733 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
@@ -109,9 +109,22 @@ $(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD | |||
109 | $(Q)$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) | 109 | $(Q)$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) |
110 | $(Q)touch $(OUTPUT)PERF-VERSION-FILE | 110 | $(Q)touch $(OUTPUT)PERF-VERSION-FILE |
111 | 111 | ||
112 | CC = $(CROSS_COMPILE)gcc | 112 | # Makefiles suck: This macro sets a default value of $(2) for the |
113 | LD ?= $(CROSS_COMPILE)ld | 113 | # variable named by $(1), unless the variable has been set by |
114 | AR = $(CROSS_COMPILE)ar | 114 | # environment or command line. This is necessary for CC and AR |
115 | # because make sets default values, so the simpler ?= approach | ||
116 | # won't work as expected. | ||
117 | define allow-override | ||
118 | $(if $(or $(findstring environment,$(origin $(1))),\ | ||
119 | $(findstring command line,$(origin $(1)))),,\ | ||
120 | $(eval $(1) = $(2))) | ||
121 | endef | ||
122 | |||
123 | # Allow setting CC and AR and LD, or setting CROSS_COMPILE as a prefix. | ||
124 | $(call allow-override,CC,$(CROSS_COMPILE)gcc) | ||
125 | $(call allow-override,AR,$(CROSS_COMPILE)ar) | ||
126 | $(call allow-override,LD,$(CROSS_COMPILE)ld) | ||
127 | |||
115 | PKG_CONFIG = $(CROSS_COMPILE)pkg-config | 128 | PKG_CONFIG = $(CROSS_COMPILE)pkg-config |
116 | 129 | ||
117 | RM = rm -f | 130 | RM = rm -f |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 37e301a32f43..d99d850e1444 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -343,7 +343,7 @@ static int read_counter(struct perf_evsel *counter) | |||
343 | return 0; | 343 | return 0; |
344 | } | 344 | } |
345 | 345 | ||
346 | static void read_counters(bool close) | 346 | static void read_counters(bool close_counters) |
347 | { | 347 | { |
348 | struct perf_evsel *counter; | 348 | struct perf_evsel *counter; |
349 | 349 | ||
@@ -354,7 +354,7 @@ static void read_counters(bool close) | |||
354 | if (process_counter(counter)) | 354 | if (process_counter(counter)) |
355 | pr_warning("failed to process counter %s\n", counter->name); | 355 | pr_warning("failed to process counter %s\n", counter->name); |
356 | 356 | ||
357 | if (close) { | 357 | if (close_counters) { |
358 | perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter), | 358 | perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter), |
359 | thread_map__nr(evsel_list->threads)); | 359 | thread_map__nr(evsel_list->threads)); |
360 | } | 360 | } |
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 7629bef2fd79..fa67613976a8 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -48,7 +48,7 @@ static struct rb_node *hists__filter_entries(struct rb_node *nd, | |||
48 | 48 | ||
49 | static bool hist_browser__has_filter(struct hist_browser *hb) | 49 | static bool hist_browser__has_filter(struct hist_browser *hb) |
50 | { | 50 | { |
51 | return hists__has_filter(hb->hists) || hb->min_pcnt; | 51 | return hists__has_filter(hb->hists) || hb->min_pcnt || symbol_conf.has_filter; |
52 | } | 52 | } |
53 | 53 | ||
54 | static int hist_browser__get_folding(struct hist_browser *browser) | 54 | static int hist_browser__get_folding(struct hist_browser *browser) |
diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 601d11440596..d2d318c59b37 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build | |||
@@ -143,6 +143,6 @@ $(OUTPUT)util/rbtree.o: ../lib/rbtree.c FORCE | |||
143 | $(call rule_mkdir) | 143 | $(call rule_mkdir) |
144 | $(call if_changed_dep,cc_o_c) | 144 | $(call if_changed_dep,cc_o_c) |
145 | 145 | ||
146 | $(OUTPUT)util/hweight.o: ../../lib/hweight.c FORCE | 146 | $(OUTPUT)util/hweight.o: ../lib/hweight.c FORCE |
147 | $(call rule_mkdir) | 147 | $(call rule_mkdir) |
148 | $(call if_changed_dep,cc_o_c) | 148 | $(call if_changed_dep,cc_o_c) |
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c index 7e7405c9b936..83d9dd96fe08 100644 --- a/tools/perf/util/auxtrace.c +++ b/tools/perf/util/auxtrace.c | |||
@@ -53,11 +53,6 @@ int auxtrace_mmap__mmap(struct auxtrace_mmap *mm, | |||
53 | { | 53 | { |
54 | struct perf_event_mmap_page *pc = userpg; | 54 | struct perf_event_mmap_page *pc = userpg; |
55 | 55 | ||
56 | #if BITS_PER_LONG != 64 && !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT) | ||
57 | pr_err("Cannot use AUX area tracing mmaps\n"); | ||
58 | return -1; | ||
59 | #endif | ||
60 | |||
61 | WARN_ONCE(mm->base, "Uninitialized auxtrace_mmap\n"); | 56 | WARN_ONCE(mm->base, "Uninitialized auxtrace_mmap\n"); |
62 | 57 | ||
63 | mm->userpg = userpg; | 58 | mm->userpg = userpg; |
@@ -73,6 +68,11 @@ int auxtrace_mmap__mmap(struct auxtrace_mmap *mm, | |||
73 | return 0; | 68 | return 0; |
74 | } | 69 | } |
75 | 70 | ||
71 | #if BITS_PER_LONG != 64 && !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT) | ||
72 | pr_err("Cannot use AUX area tracing mmaps\n"); | ||
73 | return -1; | ||
74 | #endif | ||
75 | |||
76 | pc->aux_offset = mp->offset; | 76 | pc->aux_offset = mp->offset; |
77 | pc->aux_size = mp->len; | 77 | pc->aux_size = mp->len; |
78 | 78 | ||
diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources index e23ded40c79e..0766d98c5da5 100644 --- a/tools/perf/util/python-ext-sources +++ b/tools/perf/util/python-ext-sources | |||
@@ -10,7 +10,7 @@ util/ctype.c | |||
10 | util/evlist.c | 10 | util/evlist.c |
11 | util/evsel.c | 11 | util/evsel.c |
12 | util/cpumap.c | 12 | util/cpumap.c |
13 | ../../lib/hweight.c | 13 | ../lib/hweight.c |
14 | util/thread_map.c | 14 | util/thread_map.c |
15 | util/util.c | 15 | util/util.c |
16 | util/xyarray.c | 16 | util/xyarray.c |
@@ -19,5 +19,5 @@ util/rblist.c | |||
19 | util/stat.c | 19 | util/stat.c |
20 | util/strlist.c | 20 | util/strlist.c |
21 | util/trace-event.c | 21 | util/trace-event.c |
22 | ../../lib/rbtree.c | 22 | ../lib/rbtree.c |
23 | util/string.c | 23 | util/string.c |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 48b588c6951a..60f11414bb5c 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1911,6 +1911,8 @@ int setup_list(struct strlist **list, const char *list_str, | |||
1911 | pr_err("problems parsing %s list\n", list_name); | 1911 | pr_err("problems parsing %s list\n", list_name); |
1912 | return -1; | 1912 | return -1; |
1913 | } | 1913 | } |
1914 | |||
1915 | symbol_conf.has_filter = true; | ||
1914 | return 0; | 1916 | return 0; |
1915 | } | 1917 | } |
1916 | 1918 | ||
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index bef47ead1d9b..b98ce51af142 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -105,7 +105,8 @@ struct symbol_conf { | |||
105 | demangle_kernel, | 105 | demangle_kernel, |
106 | filter_relative, | 106 | filter_relative, |
107 | show_hist_headers, | 107 | show_hist_headers, |
108 | branch_callstack; | 108 | branch_callstack, |
109 | has_filter; | ||
109 | const char *vmlinux_name, | 110 | const char *vmlinux_name, |
110 | *kallsyms_name, | 111 | *kallsyms_name, |
111 | *source_prefix, | 112 | *source_prefix, |
diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c index da7646d767fe..292ae2c90e06 100644 --- a/tools/perf/util/thread_map.c +++ b/tools/perf/util/thread_map.c | |||
@@ -136,8 +136,7 @@ struct thread_map *thread_map__new_by_uid(uid_t uid) | |||
136 | if (grow) { | 136 | if (grow) { |
137 | struct thread_map *tmp; | 137 | struct thread_map *tmp; |
138 | 138 | ||
139 | tmp = realloc(threads, (sizeof(*threads) + | 139 | tmp = thread_map__realloc(threads, max_threads); |
140 | max_threads * sizeof(pid_t))); | ||
141 | if (tmp == NULL) | 140 | if (tmp == NULL) |
142 | goto out_free_namelist; | 141 | goto out_free_namelist; |
143 | 142 | ||
diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c index 4b89118f158d..44d440da15dc 100644 --- a/tools/perf/util/vdso.c +++ b/tools/perf/util/vdso.c | |||
@@ -236,18 +236,16 @@ static struct dso *__machine__findnew_compat(struct machine *machine, | |||
236 | const char *file_name; | 236 | const char *file_name; |
237 | struct dso *dso; | 237 | struct dso *dso; |
238 | 238 | ||
239 | pthread_rwlock_wrlock(&machine->dsos.lock); | ||
240 | dso = __dsos__find(&machine->dsos, vdso_file->dso_name, true); | 239 | dso = __dsos__find(&machine->dsos, vdso_file->dso_name, true); |
241 | if (dso) | 240 | if (dso) |
242 | goto out_unlock; | 241 | goto out; |
243 | 242 | ||
244 | file_name = vdso__get_compat_file(vdso_file); | 243 | file_name = vdso__get_compat_file(vdso_file); |
245 | if (!file_name) | 244 | if (!file_name) |
246 | goto out_unlock; | 245 | goto out; |
247 | 246 | ||
248 | dso = __machine__addnew_vdso(machine, vdso_file->dso_name, file_name); | 247 | dso = __machine__addnew_vdso(machine, vdso_file->dso_name, file_name); |
249 | out_unlock: | 248 | out: |
250 | pthread_rwlock_unlock(&machine->dsos.lock); | ||
251 | return dso; | 249 | return dso; |
252 | } | 250 | } |
253 | 251 | ||
diff --git a/tools/testing/nvdimm/Kbuild b/tools/testing/nvdimm/Kbuild index 8e9b64520ec1..f56914c7929b 100644 --- a/tools/testing/nvdimm/Kbuild +++ b/tools/testing/nvdimm/Kbuild | |||
@@ -1,3 +1,6 @@ | |||
1 | ldflags-y += --wrap=ioremap_wt | ||
2 | ldflags-y += --wrap=ioremap_wc | ||
3 | ldflags-y += --wrap=devm_ioremap_nocache | ||
1 | ldflags-y += --wrap=ioremap_cache | 4 | ldflags-y += --wrap=ioremap_cache |
2 | ldflags-y += --wrap=ioremap_nocache | 5 | ldflags-y += --wrap=ioremap_nocache |
3 | ldflags-y += --wrap=iounmap | 6 | ldflags-y += --wrap=iounmap |
diff --git a/tools/testing/nvdimm/test/iomap.c b/tools/testing/nvdimm/test/iomap.c index c85a6f6ba559..64bfaa50831c 100644 --- a/tools/testing/nvdimm/test/iomap.c +++ b/tools/testing/nvdimm/test/iomap.c | |||
@@ -65,6 +65,21 @@ void __iomem *__nfit_test_ioremap(resource_size_t offset, unsigned long size, | |||
65 | return fallback_fn(offset, size); | 65 | return fallback_fn(offset, size); |
66 | } | 66 | } |
67 | 67 | ||
68 | void __iomem *__wrap_devm_ioremap_nocache(struct device *dev, | ||
69 | resource_size_t offset, unsigned long size) | ||
70 | { | ||
71 | struct nfit_test_resource *nfit_res; | ||
72 | |||
73 | rcu_read_lock(); | ||
74 | nfit_res = get_nfit_res(offset); | ||
75 | rcu_read_unlock(); | ||
76 | if (nfit_res) | ||
77 | return (void __iomem *) nfit_res->buf + offset | ||
78 | - nfit_res->res->start; | ||
79 | return devm_ioremap_nocache(dev, offset, size); | ||
80 | } | ||
81 | EXPORT_SYMBOL(__wrap_devm_ioremap_nocache); | ||
82 | |||
68 | void __iomem *__wrap_ioremap_cache(resource_size_t offset, unsigned long size) | 83 | void __iomem *__wrap_ioremap_cache(resource_size_t offset, unsigned long size) |
69 | { | 84 | { |
70 | return __nfit_test_ioremap(offset, size, ioremap_cache); | 85 | return __nfit_test_ioremap(offset, size, ioremap_cache); |
@@ -77,6 +92,18 @@ void __iomem *__wrap_ioremap_nocache(resource_size_t offset, unsigned long size) | |||
77 | } | 92 | } |
78 | EXPORT_SYMBOL(__wrap_ioremap_nocache); | 93 | EXPORT_SYMBOL(__wrap_ioremap_nocache); |
79 | 94 | ||
95 | void __iomem *__wrap_ioremap_wt(resource_size_t offset, unsigned long size) | ||
96 | { | ||
97 | return __nfit_test_ioremap(offset, size, ioremap_wt); | ||
98 | } | ||
99 | EXPORT_SYMBOL(__wrap_ioremap_wt); | ||
100 | |||
101 | void __iomem *__wrap_ioremap_wc(resource_size_t offset, unsigned long size) | ||
102 | { | ||
103 | return __nfit_test_ioremap(offset, size, ioremap_wc); | ||
104 | } | ||
105 | EXPORT_SYMBOL(__wrap_ioremap_wc); | ||
106 | |||
80 | void __wrap_iounmap(volatile void __iomem *addr) | 107 | void __wrap_iounmap(volatile void __iomem *addr) |
81 | { | 108 | { |
82 | struct nfit_test_resource *nfit_res; | 109 | struct nfit_test_resource *nfit_res; |
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c index 4b69b8368de0..d0bdae40ccc9 100644 --- a/tools/testing/nvdimm/test/nfit.c +++ b/tools/testing/nvdimm/test/nfit.c | |||
@@ -128,6 +128,8 @@ struct nfit_test { | |||
128 | int num_pm; | 128 | int num_pm; |
129 | void **dimm; | 129 | void **dimm; |
130 | dma_addr_t *dimm_dma; | 130 | dma_addr_t *dimm_dma; |
131 | void **flush; | ||
132 | dma_addr_t *flush_dma; | ||
131 | void **label; | 133 | void **label; |
132 | dma_addr_t *label_dma; | 134 | dma_addr_t *label_dma; |
133 | void **spa_set; | 135 | void **spa_set; |
@@ -155,7 +157,7 @@ static int nfit_test_ctl(struct nvdimm_bus_descriptor *nd_desc, | |||
155 | int i, rc; | 157 | int i, rc; |
156 | 158 | ||
157 | if (!nfit_mem || !test_bit(cmd, &nfit_mem->dsm_mask)) | 159 | if (!nfit_mem || !test_bit(cmd, &nfit_mem->dsm_mask)) |
158 | return -ENXIO; | 160 | return -ENOTTY; |
159 | 161 | ||
160 | /* lookup label space for the given dimm */ | 162 | /* lookup label space for the given dimm */ |
161 | for (i = 0; i < ARRAY_SIZE(handle); i++) | 163 | for (i = 0; i < ARRAY_SIZE(handle); i++) |
@@ -331,7 +333,8 @@ static int nfit_test0_alloc(struct nfit_test *t) | |||
331 | + sizeof(struct acpi_nfit_system_address) * NUM_SPA | 333 | + sizeof(struct acpi_nfit_system_address) * NUM_SPA |
332 | + sizeof(struct acpi_nfit_memory_map) * NUM_MEM | 334 | + sizeof(struct acpi_nfit_memory_map) * NUM_MEM |
333 | + sizeof(struct acpi_nfit_control_region) * NUM_DCR | 335 | + sizeof(struct acpi_nfit_control_region) * NUM_DCR |
334 | + sizeof(struct acpi_nfit_data_region) * NUM_BDW; | 336 | + sizeof(struct acpi_nfit_data_region) * NUM_BDW |
337 | + sizeof(struct acpi_nfit_flush_address) * NUM_DCR; | ||
335 | int i; | 338 | int i; |
336 | 339 | ||
337 | t->nfit_buf = test_alloc(t, nfit_size, &t->nfit_dma); | 340 | t->nfit_buf = test_alloc(t, nfit_size, &t->nfit_dma); |
@@ -356,6 +359,10 @@ static int nfit_test0_alloc(struct nfit_test *t) | |||
356 | if (!t->label[i]) | 359 | if (!t->label[i]) |
357 | return -ENOMEM; | 360 | return -ENOMEM; |
358 | sprintf(t->label[i], "label%d", i); | 361 | sprintf(t->label[i], "label%d", i); |
362 | |||
363 | t->flush[i] = test_alloc(t, 8, &t->flush_dma[i]); | ||
364 | if (!t->flush[i]) | ||
365 | return -ENOMEM; | ||
359 | } | 366 | } |
360 | 367 | ||
361 | for (i = 0; i < NUM_DCR; i++) { | 368 | for (i = 0; i < NUM_DCR; i++) { |
@@ -408,6 +415,7 @@ static void nfit_test0_setup(struct nfit_test *t) | |||
408 | struct acpi_nfit_system_address *spa; | 415 | struct acpi_nfit_system_address *spa; |
409 | struct acpi_nfit_control_region *dcr; | 416 | struct acpi_nfit_control_region *dcr; |
410 | struct acpi_nfit_data_region *bdw; | 417 | struct acpi_nfit_data_region *bdw; |
418 | struct acpi_nfit_flush_address *flush; | ||
411 | unsigned int offset; | 419 | unsigned int offset; |
412 | 420 | ||
413 | nfit_test_init_header(nfit_buf, size); | 421 | nfit_test_init_header(nfit_buf, size); |
@@ -831,6 +839,39 @@ static void nfit_test0_setup(struct nfit_test *t) | |||
831 | bdw->capacity = DIMM_SIZE; | 839 | bdw->capacity = DIMM_SIZE; |
832 | bdw->start_address = 0; | 840 | bdw->start_address = 0; |
833 | 841 | ||
842 | offset = offset + sizeof(struct acpi_nfit_data_region) * 4; | ||
843 | /* flush0 (dimm0) */ | ||
844 | flush = nfit_buf + offset; | ||
845 | flush->header.type = ACPI_NFIT_TYPE_FLUSH_ADDRESS; | ||
846 | flush->header.length = sizeof(struct acpi_nfit_flush_address); | ||
847 | flush->device_handle = handle[0]; | ||
848 | flush->hint_count = 1; | ||
849 | flush->hint_address[0] = t->flush_dma[0]; | ||
850 | |||
851 | /* flush1 (dimm1) */ | ||
852 | flush = nfit_buf + offset + sizeof(struct acpi_nfit_flush_address) * 1; | ||
853 | flush->header.type = ACPI_NFIT_TYPE_FLUSH_ADDRESS; | ||
854 | flush->header.length = sizeof(struct acpi_nfit_flush_address); | ||
855 | flush->device_handle = handle[1]; | ||
856 | flush->hint_count = 1; | ||
857 | flush->hint_address[0] = t->flush_dma[1]; | ||
858 | |||
859 | /* flush2 (dimm2) */ | ||
860 | flush = nfit_buf + offset + sizeof(struct acpi_nfit_flush_address) * 2; | ||
861 | flush->header.type = ACPI_NFIT_TYPE_FLUSH_ADDRESS; | ||
862 | flush->header.length = sizeof(struct acpi_nfit_flush_address); | ||
863 | flush->device_handle = handle[2]; | ||
864 | flush->hint_count = 1; | ||
865 | flush->hint_address[0] = t->flush_dma[2]; | ||
866 | |||
867 | /* flush3 (dimm3) */ | ||
868 | flush = nfit_buf + offset + sizeof(struct acpi_nfit_flush_address) * 3; | ||
869 | flush->header.type = ACPI_NFIT_TYPE_FLUSH_ADDRESS; | ||
870 | flush->header.length = sizeof(struct acpi_nfit_flush_address); | ||
871 | flush->device_handle = handle[3]; | ||
872 | flush->hint_count = 1; | ||
873 | flush->hint_address[0] = t->flush_dma[3]; | ||
874 | |||
834 | acpi_desc = &t->acpi_desc; | 875 | acpi_desc = &t->acpi_desc; |
835 | set_bit(ND_CMD_GET_CONFIG_SIZE, &acpi_desc->dimm_dsm_force_en); | 876 | set_bit(ND_CMD_GET_CONFIG_SIZE, &acpi_desc->dimm_dsm_force_en); |
836 | set_bit(ND_CMD_GET_CONFIG_DATA, &acpi_desc->dimm_dsm_force_en); | 877 | set_bit(ND_CMD_GET_CONFIG_DATA, &acpi_desc->dimm_dsm_force_en); |
@@ -933,6 +974,10 @@ static int nfit_test_probe(struct platform_device *pdev) | |||
933 | GFP_KERNEL); | 974 | GFP_KERNEL); |
934 | nfit_test->dimm_dma = devm_kcalloc(dev, num, sizeof(dma_addr_t), | 975 | nfit_test->dimm_dma = devm_kcalloc(dev, num, sizeof(dma_addr_t), |
935 | GFP_KERNEL); | 976 | GFP_KERNEL); |
977 | nfit_test->flush = devm_kcalloc(dev, num, sizeof(void *), | ||
978 | GFP_KERNEL); | ||
979 | nfit_test->flush_dma = devm_kcalloc(dev, num, sizeof(dma_addr_t), | ||
980 | GFP_KERNEL); | ||
936 | nfit_test->label = devm_kcalloc(dev, num, sizeof(void *), | 981 | nfit_test->label = devm_kcalloc(dev, num, sizeof(void *), |
937 | GFP_KERNEL); | 982 | GFP_KERNEL); |
938 | nfit_test->label_dma = devm_kcalloc(dev, num, | 983 | nfit_test->label_dma = devm_kcalloc(dev, num, |
@@ -943,7 +988,8 @@ static int nfit_test_probe(struct platform_device *pdev) | |||
943 | sizeof(dma_addr_t), GFP_KERNEL); | 988 | sizeof(dma_addr_t), GFP_KERNEL); |
944 | if (nfit_test->dimm && nfit_test->dimm_dma && nfit_test->label | 989 | if (nfit_test->dimm && nfit_test->dimm_dma && nfit_test->label |
945 | && nfit_test->label_dma && nfit_test->dcr | 990 | && nfit_test->label_dma && nfit_test->dcr |
946 | && nfit_test->dcr_dma) | 991 | && nfit_test->dcr_dma && nfit_test->flush |
992 | && nfit_test->flush_dma) | ||
947 | /* pass */; | 993 | /* pass */; |
948 | else | 994 | else |
949 | return -ENOMEM; | 995 | return -ENOMEM; |
diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c index 620e37f741b8..1dd087da6f31 100644 --- a/virt/kvm/vfio.c +++ b/virt/kvm/vfio.c | |||
@@ -155,6 +155,8 @@ static int kvm_vfio_set_group(struct kvm_device *dev, long attr, u64 arg) | |||
155 | list_add_tail(&kvg->node, &kv->group_list); | 155 | list_add_tail(&kvg->node, &kv->group_list); |
156 | kvg->vfio_group = vfio_group; | 156 | kvg->vfio_group = vfio_group; |
157 | 157 | ||
158 | kvm_arch_start_assignment(dev->kvm); | ||
159 | |||
158 | mutex_unlock(&kv->lock); | 160 | mutex_unlock(&kv->lock); |
159 | 161 | ||
160 | kvm_vfio_update_coherency(dev); | 162 | kvm_vfio_update_coherency(dev); |
@@ -190,6 +192,8 @@ static int kvm_vfio_set_group(struct kvm_device *dev, long attr, u64 arg) | |||
190 | break; | 192 | break; |
191 | } | 193 | } |
192 | 194 | ||
195 | kvm_arch_end_assignment(dev->kvm); | ||
196 | |||
193 | mutex_unlock(&kv->lock); | 197 | mutex_unlock(&kv->lock); |
194 | 198 | ||
195 | kvm_vfio_group_put_external_user(vfio_group); | 199 | kvm_vfio_group_put_external_user(vfio_group); |
@@ -239,6 +243,7 @@ static void kvm_vfio_destroy(struct kvm_device *dev) | |||
239 | kvm_vfio_group_put_external_user(kvg->vfio_group); | 243 | kvm_vfio_group_put_external_user(kvg->vfio_group); |
240 | list_del(&kvg->node); | 244 | list_del(&kvg->node); |
241 | kfree(kvg); | 245 | kfree(kvg); |
246 | kvm_arch_end_assignment(dev->kvm); | ||
242 | } | 247 | } |
243 | 248 | ||
244 | kvm_vfio_update_coherency(dev); | 249 | kvm_vfio_update_coherency(dev); |