diff options
196 files changed, 1999 insertions, 1209 deletions
| @@ -89,6 +89,7 @@ Leonid I Ananiev <leonid.i.ananiev@intel.com> | |||
| 89 | Linas Vepstas <linas@austin.ibm.com> | 89 | Linas Vepstas <linas@austin.ibm.com> |
| 90 | Mark Brown <broonie@sirena.org.uk> | 90 | Mark Brown <broonie@sirena.org.uk> |
| 91 | Matthieu CASTET <castet.matthieu@free.fr> | 91 | Matthieu CASTET <castet.matthieu@free.fr> |
| 92 | Mauro Carvalho Chehab <mchehab@kernel.org> <maurochehab@gmail.com> <mchehab@infradead.org> <mchehab@redhat.com> <m.chehab@samsung.com> <mchehab@osg.samsung.com> <mchehab@s-opensource.com> | ||
| 92 | Mayuresh Janorkar <mayur@ti.com> | 93 | Mayuresh Janorkar <mayur@ti.com> |
| 93 | Michael Buesch <m@bues.ch> | 94 | Michael Buesch <m@bues.ch> |
| 94 | Michel Dänzer <michel@tungstengraphics.com> | 95 | Michel Dänzer <michel@tungstengraphics.com> |
| @@ -122,6 +123,7 @@ Santosh Shilimkar <santosh.shilimkar@oracle.org> | |||
| 122 | Sascha Hauer <s.hauer@pengutronix.de> | 123 | Sascha Hauer <s.hauer@pengutronix.de> |
| 123 | S.Çağlar Onur <caglar@pardus.org.tr> | 124 | S.Çağlar Onur <caglar@pardus.org.tr> |
| 124 | Shiraz Hashim <shiraz.linux.kernel@gmail.com> <shiraz.hashim@st.com> | 125 | Shiraz Hashim <shiraz.linux.kernel@gmail.com> <shiraz.hashim@st.com> |
| 126 | Shuah Khan <shuah@kernel.org> <shuahkhan@gmail.com> <shuah.khan@hp.com> <shuahkh@osg.samsung.com> <shuah.kh@samsung.com> | ||
| 125 | Simon Kelley <simon@thekelleys.org.uk> | 127 | Simon Kelley <simon@thekelleys.org.uk> |
| 126 | Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr> | 128 | Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr> |
| 127 | Stephen Hemminger <shemminger@osdl.org> | 129 | Stephen Hemminger <shemminger@osdl.org> |
| @@ -649,6 +649,7 @@ D: Configure, Menuconfig, xconfig | |||
| 649 | 649 | ||
| 650 | N: Mauro Carvalho Chehab | 650 | N: Mauro Carvalho Chehab |
| 651 | E: m.chehab@samsung.org | 651 | E: m.chehab@samsung.org |
| 652 | E: mchehab@osg.samsung.com | ||
| 652 | E: mchehab@infradead.org | 653 | E: mchehab@infradead.org |
| 653 | D: Media subsystem (V4L/DVB) drivers and core | 654 | D: Media subsystem (V4L/DVB) drivers and core |
| 654 | D: EDAC drivers and EDAC 3.0 core rework | 655 | D: EDAC drivers and EDAC 3.0 core rework |
diff --git a/Documentation/ABI/testing/configfs-usb-gadget-uvc b/Documentation/ABI/testing/configfs-usb-gadget-uvc index 2f4a0051b32d..1ba0d0fda9c0 100644 --- a/Documentation/ABI/testing/configfs-usb-gadget-uvc +++ b/Documentation/ABI/testing/configfs-usb-gadget-uvc | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | What: /config/usb-gadget/gadget/functions/uvc.name | 1 | What: /config/usb-gadget/gadget/functions/uvc.name |
| 2 | Date: Dec 2014 | 2 | Date: Dec 2014 |
| 3 | KernelVersion: 3.20 | 3 | KernelVersion: 4.0 |
| 4 | Description: UVC function directory | 4 | Description: UVC function directory |
| 5 | 5 | ||
| 6 | streaming_maxburst - 0..15 (ss only) | 6 | streaming_maxburst - 0..15 (ss only) |
| @@ -9,37 +9,37 @@ Description: UVC function directory | |||
| 9 | 9 | ||
| 10 | What: /config/usb-gadget/gadget/functions/uvc.name/control | 10 | What: /config/usb-gadget/gadget/functions/uvc.name/control |
| 11 | Date: Dec 2014 | 11 | Date: Dec 2014 |
| 12 | KernelVersion: 3.20 | 12 | KernelVersion: 4.0 |
| 13 | Description: Control descriptors | 13 | Description: Control descriptors |
| 14 | 14 | ||
| 15 | What: /config/usb-gadget/gadget/functions/uvc.name/control/class | 15 | What: /config/usb-gadget/gadget/functions/uvc.name/control/class |
| 16 | Date: Dec 2014 | 16 | Date: Dec 2014 |
| 17 | KernelVersion: 3.20 | 17 | KernelVersion: 4.0 |
| 18 | Description: Class descriptors | 18 | Description: Class descriptors |
| 19 | 19 | ||
| 20 | What: /config/usb-gadget/gadget/functions/uvc.name/control/class/ss | 20 | What: /config/usb-gadget/gadget/functions/uvc.name/control/class/ss |
| 21 | Date: Dec 2014 | 21 | Date: Dec 2014 |
| 22 | KernelVersion: 3.20 | 22 | KernelVersion: 4.0 |
| 23 | Description: Super speed control class descriptors | 23 | Description: Super speed control class descriptors |
| 24 | 24 | ||
| 25 | What: /config/usb-gadget/gadget/functions/uvc.name/control/class/fs | 25 | What: /config/usb-gadget/gadget/functions/uvc.name/control/class/fs |
| 26 | Date: Dec 2014 | 26 | Date: Dec 2014 |
| 27 | KernelVersion: 3.20 | 27 | KernelVersion: 4.0 |
| 28 | Description: Full speed control class descriptors | 28 | Description: Full speed control class descriptors |
| 29 | 29 | ||
| 30 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal | 30 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal |
| 31 | Date: Dec 2014 | 31 | Date: Dec 2014 |
| 32 | KernelVersion: 3.20 | 32 | KernelVersion: 4.0 |
| 33 | Description: Terminal descriptors | 33 | Description: Terminal descriptors |
| 34 | 34 | ||
| 35 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output | 35 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output |
| 36 | Date: Dec 2014 | 36 | Date: Dec 2014 |
| 37 | KernelVersion: 3.20 | 37 | KernelVersion: 4.0 |
| 38 | Description: Output terminal descriptors | 38 | Description: Output terminal descriptors |
| 39 | 39 | ||
| 40 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output/default | 40 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output/default |
| 41 | Date: Dec 2014 | 41 | Date: Dec 2014 |
| 42 | KernelVersion: 3.20 | 42 | KernelVersion: 4.0 |
| 43 | Description: Default output terminal descriptors | 43 | Description: Default output terminal descriptors |
| 44 | 44 | ||
| 45 | All attributes read only: | 45 | All attributes read only: |
| @@ -53,12 +53,12 @@ Description: Default output terminal descriptors | |||
| 53 | 53 | ||
| 54 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera | 54 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera |
| 55 | Date: Dec 2014 | 55 | Date: Dec 2014 |
| 56 | KernelVersion: 3.20 | 56 | KernelVersion: 4.0 |
| 57 | Description: Camera terminal descriptors | 57 | Description: Camera terminal descriptors |
| 58 | 58 | ||
| 59 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera/default | 59 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera/default |
| 60 | Date: Dec 2014 | 60 | Date: Dec 2014 |
| 61 | KernelVersion: 3.20 | 61 | KernelVersion: 4.0 |
| 62 | Description: Default camera terminal descriptors | 62 | Description: Default camera terminal descriptors |
| 63 | 63 | ||
| 64 | All attributes read only: | 64 | All attributes read only: |
| @@ -75,12 +75,12 @@ Description: Default camera terminal descriptors | |||
| 75 | 75 | ||
| 76 | What: /config/usb-gadget/gadget/functions/uvc.name/control/processing | 76 | What: /config/usb-gadget/gadget/functions/uvc.name/control/processing |
| 77 | Date: Dec 2014 | 77 | Date: Dec 2014 |
| 78 | KernelVersion: 3.20 | 78 | KernelVersion: 4.0 |
| 79 | Description: Processing unit descriptors | 79 | Description: Processing unit descriptors |
| 80 | 80 | ||
| 81 | What: /config/usb-gadget/gadget/functions/uvc.name/control/processing/default | 81 | What: /config/usb-gadget/gadget/functions/uvc.name/control/processing/default |
| 82 | Date: Dec 2014 | 82 | Date: Dec 2014 |
| 83 | KernelVersion: 3.20 | 83 | KernelVersion: 4.0 |
| 84 | Description: Default processing unit descriptors | 84 | Description: Default processing unit descriptors |
| 85 | 85 | ||
| 86 | All attributes read only: | 86 | All attributes read only: |
| @@ -94,49 +94,49 @@ Description: Default processing unit descriptors | |||
| 94 | 94 | ||
| 95 | What: /config/usb-gadget/gadget/functions/uvc.name/control/header | 95 | What: /config/usb-gadget/gadget/functions/uvc.name/control/header |
| 96 | Date: Dec 2014 | 96 | Date: Dec 2014 |
| 97 | KernelVersion: 3.20 | 97 | KernelVersion: 4.0 |
| 98 | Description: Control header descriptors | 98 | Description: Control header descriptors |
| 99 | 99 | ||
| 100 | What: /config/usb-gadget/gadget/functions/uvc.name/control/header/name | 100 | What: /config/usb-gadget/gadget/functions/uvc.name/control/header/name |
| 101 | Date: Dec 2014 | 101 | Date: Dec 2014 |
| 102 | KernelVersion: 3.20 | 102 | KernelVersion: 4.0 |
| 103 | Description: Specific control header descriptors | 103 | Description: Specific control header descriptors |
| 104 | 104 | ||
| 105 | dwClockFrequency | 105 | dwClockFrequency |
| 106 | bcdUVC | 106 | bcdUVC |
| 107 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming | 107 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming |
| 108 | Date: Dec 2014 | 108 | Date: Dec 2014 |
| 109 | KernelVersion: 3.20 | 109 | KernelVersion: 4.0 |
| 110 | Description: Streaming descriptors | 110 | Description: Streaming descriptors |
| 111 | 111 | ||
| 112 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class | 112 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class |
| 113 | Date: Dec 2014 | 113 | Date: Dec 2014 |
| 114 | KernelVersion: 3.20 | 114 | KernelVersion: 4.0 |
| 115 | Description: Streaming class descriptors | 115 | Description: Streaming class descriptors |
| 116 | 116 | ||
| 117 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/ss | 117 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/ss |
| 118 | Date: Dec 2014 | 118 | Date: Dec 2014 |
| 119 | KernelVersion: 3.20 | 119 | KernelVersion: 4.0 |
| 120 | Description: Super speed streaming class descriptors | 120 | Description: Super speed streaming class descriptors |
| 121 | 121 | ||
| 122 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/hs | 122 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/hs |
| 123 | Date: Dec 2014 | 123 | Date: Dec 2014 |
| 124 | KernelVersion: 3.20 | 124 | KernelVersion: 4.0 |
| 125 | Description: High speed streaming class descriptors | 125 | Description: High speed streaming class descriptors |
| 126 | 126 | ||
| 127 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/fs | 127 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/fs |
| 128 | Date: Dec 2014 | 128 | Date: Dec 2014 |
| 129 | KernelVersion: 3.20 | 129 | KernelVersion: 4.0 |
| 130 | Description: Full speed streaming class descriptors | 130 | Description: Full speed streaming class descriptors |
| 131 | 131 | ||
| 132 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching | 132 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching |
| 133 | Date: Dec 2014 | 133 | Date: Dec 2014 |
| 134 | KernelVersion: 3.20 | 134 | KernelVersion: 4.0 |
| 135 | Description: Color matching descriptors | 135 | Description: Color matching descriptors |
| 136 | 136 | ||
| 137 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching/default | 137 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching/default |
| 138 | Date: Dec 2014 | 138 | Date: Dec 2014 |
| 139 | KernelVersion: 3.20 | 139 | KernelVersion: 4.0 |
| 140 | Description: Default color matching descriptors | 140 | Description: Default color matching descriptors |
| 141 | 141 | ||
| 142 | All attributes read only: | 142 | All attributes read only: |
| @@ -150,12 +150,12 @@ Description: Default color matching descriptors | |||
| 150 | 150 | ||
| 151 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg | 151 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg |
| 152 | Date: Dec 2014 | 152 | Date: Dec 2014 |
| 153 | KernelVersion: 3.20 | 153 | KernelVersion: 4.0 |
| 154 | Description: MJPEG format descriptors | 154 | Description: MJPEG format descriptors |
| 155 | 155 | ||
| 156 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name | 156 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name |
| 157 | Date: Dec 2014 | 157 | Date: Dec 2014 |
| 158 | KernelVersion: 3.20 | 158 | KernelVersion: 4.0 |
| 159 | Description: Specific MJPEG format descriptors | 159 | Description: Specific MJPEG format descriptors |
| 160 | 160 | ||
| 161 | All attributes read only, | 161 | All attributes read only, |
| @@ -174,7 +174,7 @@ Description: Specific MJPEG format descriptors | |||
| 174 | 174 | ||
| 175 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name/name | 175 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name/name |
| 176 | Date: Dec 2014 | 176 | Date: Dec 2014 |
| 177 | KernelVersion: 3.20 | 177 | KernelVersion: 4.0 |
| 178 | Description: Specific MJPEG frame descriptors | 178 | Description: Specific MJPEG frame descriptors |
| 179 | 179 | ||
| 180 | dwFrameInterval - indicates how frame interval can be | 180 | dwFrameInterval - indicates how frame interval can be |
| @@ -196,12 +196,12 @@ Description: Specific MJPEG frame descriptors | |||
| 196 | 196 | ||
| 197 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed | 197 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed |
| 198 | Date: Dec 2014 | 198 | Date: Dec 2014 |
| 199 | KernelVersion: 3.20 | 199 | KernelVersion: 4.0 |
| 200 | Description: Uncompressed format descriptors | 200 | Description: Uncompressed format descriptors |
| 201 | 201 | ||
| 202 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name | 202 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name |
| 203 | Date: Dec 2014 | 203 | Date: Dec 2014 |
| 204 | KernelVersion: 3.20 | 204 | KernelVersion: 4.0 |
| 205 | Description: Specific uncompressed format descriptors | 205 | Description: Specific uncompressed format descriptors |
| 206 | 206 | ||
| 207 | bmaControls - this format's data for bmaControls in | 207 | bmaControls - this format's data for bmaControls in |
| @@ -221,7 +221,7 @@ Description: Specific uncompressed format descriptors | |||
| 221 | 221 | ||
| 222 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name/name | 222 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name/name |
| 223 | Date: Dec 2014 | 223 | Date: Dec 2014 |
| 224 | KernelVersion: 3.20 | 224 | KernelVersion: 4.0 |
| 225 | Description: Specific uncompressed frame descriptors | 225 | Description: Specific uncompressed frame descriptors |
| 226 | 226 | ||
| 227 | dwFrameInterval - indicates how frame interval can be | 227 | dwFrameInterval - indicates how frame interval can be |
| @@ -243,12 +243,12 @@ Description: Specific uncompressed frame descriptors | |||
| 243 | 243 | ||
| 244 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header | 244 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header |
| 245 | Date: Dec 2014 | 245 | Date: Dec 2014 |
| 246 | KernelVersion: 3.20 | 246 | KernelVersion: 4.0 |
| 247 | Description: Streaming header descriptors | 247 | Description: Streaming header descriptors |
| 248 | 248 | ||
| 249 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header/name | 249 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header/name |
| 250 | Date: Dec 2014 | 250 | Date: Dec 2014 |
| 251 | KernelVersion: 3.20 | 251 | KernelVersion: 4.0 |
| 252 | Description: Specific streaming header descriptors | 252 | Description: Specific streaming header descriptors |
| 253 | 253 | ||
| 254 | All attributes read only: | 254 | All attributes read only: |
diff --git a/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 b/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 index 6708c5e264aa..33e96f740639 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 +++ b/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | What /sys/bus/iio/devices/iio:deviceX/in_proximity_raw | 1 | What /sys/bus/iio/devices/iio:deviceX/in_proximity_input |
| 2 | Date: March 2014 | 2 | Date: March 2014 |
| 3 | KernelVersion: 3.15 | 3 | KernelVersion: 3.15 |
| 4 | Contact: Matt Ranostay <mranostay@gmail.com> | 4 | Contact: Matt Ranostay <mranostay@gmail.com> |
diff --git a/Documentation/leds/leds-class.txt b/Documentation/leds/leds-class.txt index d406d98339b2..44f5e6bccd97 100644 --- a/Documentation/leds/leds-class.txt +++ b/Documentation/leds/leds-class.txt | |||
| @@ -74,8 +74,8 @@ blink_set() function (see <linux/leds.h>). To set an LED to blinking, | |||
| 74 | however, it is better to use the API function led_blink_set(), as it | 74 | however, it is better to use the API function led_blink_set(), as it |
| 75 | will check and implement software fallback if necessary. | 75 | will check and implement software fallback if necessary. |
| 76 | 76 | ||
| 77 | To turn off blinking again, use the API function led_brightness_set() | 77 | To turn off blinking, use the API function led_brightness_set() |
| 78 | as that will not just set the LED brightness but also stop any software | 78 | with brightness value LED_OFF, which should stop any software |
| 79 | timers that may have been required for blinking. | 79 | timers that may have been required for blinking. |
| 80 | 80 | ||
| 81 | The blink_set() function should choose a user friendly blinking value | 81 | The blink_set() function should choose a user friendly blinking value |
diff --git a/MAINTAINERS b/MAINTAINERS index dff697ca7155..98f8a5c92314 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -2243,7 +2243,8 @@ F: include/net/ax25.h | |||
| 2243 | F: net/ax25/ | 2243 | F: net/ax25/ |
| 2244 | 2244 | ||
| 2245 | AZ6007 DVB DRIVER | 2245 | AZ6007 DVB DRIVER |
| 2246 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2246 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 2247 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 2247 | L: linux-media@vger.kernel.org | 2248 | L: linux-media@vger.kernel.org |
| 2248 | W: https://linuxtv.org | 2249 | W: https://linuxtv.org |
| 2249 | T: git git://linuxtv.org/media_tree.git | 2250 | T: git git://linuxtv.org/media_tree.git |
| @@ -2710,7 +2711,8 @@ F: Documentation/filesystems/btrfs.txt | |||
| 2710 | F: fs/btrfs/ | 2711 | F: fs/btrfs/ |
| 2711 | 2712 | ||
| 2712 | BTTV VIDEO4LINUX DRIVER | 2713 | BTTV VIDEO4LINUX DRIVER |
| 2713 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2714 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 2715 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 2714 | L: linux-media@vger.kernel.org | 2716 | L: linux-media@vger.kernel.org |
| 2715 | W: https://linuxtv.org | 2717 | W: https://linuxtv.org |
| 2716 | T: git git://linuxtv.org/media_tree.git | 2718 | T: git git://linuxtv.org/media_tree.git |
| @@ -3345,7 +3347,8 @@ S: Maintained | |||
| 3345 | F: drivers/media/dvb-frontends/cx24120* | 3347 | F: drivers/media/dvb-frontends/cx24120* |
| 3346 | 3348 | ||
| 3347 | CX88 VIDEO4LINUX DRIVER | 3349 | CX88 VIDEO4LINUX DRIVER |
| 3348 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 3350 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 3351 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 3349 | L: linux-media@vger.kernel.org | 3352 | L: linux-media@vger.kernel.org |
| 3350 | W: https://linuxtv.org | 3353 | W: https://linuxtv.org |
| 3351 | T: git git://linuxtv.org/media_tree.git | 3354 | T: git git://linuxtv.org/media_tree.git |
| @@ -4292,7 +4295,8 @@ F: fs/ecryptfs/ | |||
| 4292 | EDAC-CORE | 4295 | EDAC-CORE |
| 4293 | M: Doug Thompson <dougthompson@xmission.com> | 4296 | M: Doug Thompson <dougthompson@xmission.com> |
| 4294 | M: Borislav Petkov <bp@alien8.de> | 4297 | M: Borislav Petkov <bp@alien8.de> |
| 4295 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 4298 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 4299 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 4296 | L: linux-edac@vger.kernel.org | 4300 | L: linux-edac@vger.kernel.org |
| 4297 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git for-next | 4301 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git for-next |
| 4298 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-edac.git linux_next | 4302 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-edac.git linux_next |
| @@ -4337,7 +4341,8 @@ S: Maintained | |||
| 4337 | F: drivers/edac/e7xxx_edac.c | 4341 | F: drivers/edac/e7xxx_edac.c |
| 4338 | 4342 | ||
| 4339 | EDAC-GHES | 4343 | EDAC-GHES |
| 4340 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 4344 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 4345 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 4341 | L: linux-edac@vger.kernel.org | 4346 | L: linux-edac@vger.kernel.org |
| 4342 | S: Maintained | 4347 | S: Maintained |
| 4343 | F: drivers/edac/ghes_edac.c | 4348 | F: drivers/edac/ghes_edac.c |
| @@ -4361,19 +4366,22 @@ S: Maintained | |||
| 4361 | F: drivers/edac/i5000_edac.c | 4366 | F: drivers/edac/i5000_edac.c |
| 4362 | 4367 | ||
| 4363 | EDAC-I5400 | 4368 | EDAC-I5400 |
| 4364 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 4369 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 4370 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 4365 | L: linux-edac@vger.kernel.org | 4371 | L: linux-edac@vger.kernel.org |
| 4366 | S: Maintained | 4372 | S: Maintained |
| 4367 | F: drivers/edac/i5400_edac.c | 4373 | F: drivers/edac/i5400_edac.c |
| 4368 | 4374 | ||
| 4369 | EDAC-I7300 | 4375 | EDAC-I7300 |
| 4370 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 4376 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 4377 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 4371 | L: linux-edac@vger.kernel.org | 4378 | L: linux-edac@vger.kernel.org |
| 4372 | S: Maintained | 4379 | S: Maintained |
| 4373 | F: drivers/edac/i7300_edac.c | 4380 | F: drivers/edac/i7300_edac.c |
| 4374 | 4381 | ||
| 4375 | EDAC-I7CORE | 4382 | EDAC-I7CORE |
| 4376 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 4383 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 4384 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 4377 | L: linux-edac@vger.kernel.org | 4385 | L: linux-edac@vger.kernel.org |
| 4378 | S: Maintained | 4386 | S: Maintained |
| 4379 | F: drivers/edac/i7core_edac.c | 4387 | F: drivers/edac/i7core_edac.c |
| @@ -4410,7 +4418,8 @@ S: Maintained | |||
| 4410 | F: drivers/edac/r82600_edac.c | 4418 | F: drivers/edac/r82600_edac.c |
| 4411 | 4419 | ||
| 4412 | EDAC-SBRIDGE | 4420 | EDAC-SBRIDGE |
| 4413 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 4421 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 4422 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 4414 | L: linux-edac@vger.kernel.org | 4423 | L: linux-edac@vger.kernel.org |
| 4415 | S: Maintained | 4424 | S: Maintained |
| 4416 | F: drivers/edac/sb_edac.c | 4425 | F: drivers/edac/sb_edac.c |
| @@ -4469,7 +4478,8 @@ S: Maintained | |||
| 4469 | F: drivers/net/ethernet/ibm/ehea/ | 4478 | F: drivers/net/ethernet/ibm/ehea/ |
| 4470 | 4479 | ||
| 4471 | EM28XX VIDEO4LINUX DRIVER | 4480 | EM28XX VIDEO4LINUX DRIVER |
| 4472 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 4481 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 4482 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 4473 | L: linux-media@vger.kernel.org | 4483 | L: linux-media@vger.kernel.org |
| 4474 | W: https://linuxtv.org | 4484 | W: https://linuxtv.org |
| 4475 | T: git git://linuxtv.org/media_tree.git | 4485 | T: git git://linuxtv.org/media_tree.git |
| @@ -6488,6 +6498,7 @@ F: include/uapi/linux/sunrpc/ | |||
| 6488 | 6498 | ||
| 6489 | KERNEL SELFTEST FRAMEWORK | 6499 | KERNEL SELFTEST FRAMEWORK |
| 6490 | M: Shuah Khan <shuahkh@osg.samsung.com> | 6500 | M: Shuah Khan <shuahkh@osg.samsung.com> |
| 6501 | M: Shuah Khan <shuah@kernel.org> | ||
| 6491 | L: linux-kselftest@vger.kernel.org | 6502 | L: linux-kselftest@vger.kernel.org |
| 6492 | T: git git://git.kernel.org/pub/scm/shuah/linux-kselftest | 6503 | T: git git://git.kernel.org/pub/scm/shuah/linux-kselftest |
| 6493 | S: Maintained | 6504 | S: Maintained |
| @@ -7359,7 +7370,8 @@ S: Supported | |||
| 7359 | F: drivers/media/pci/netup_unidvb/* | 7370 | F: drivers/media/pci/netup_unidvb/* |
| 7360 | 7371 | ||
| 7361 | MEDIA INPUT INFRASTRUCTURE (V4L/DVB) | 7372 | MEDIA INPUT INFRASTRUCTURE (V4L/DVB) |
| 7362 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 7373 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 7374 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 7363 | P: LinuxTV.org Project | 7375 | P: LinuxTV.org Project |
| 7364 | L: linux-media@vger.kernel.org | 7376 | L: linux-media@vger.kernel.org |
| 7365 | W: https://linuxtv.org | 7377 | W: https://linuxtv.org |
| @@ -9853,7 +9865,8 @@ S: Odd Fixes | |||
| 9853 | F: drivers/media/i2c/saa6588* | 9865 | F: drivers/media/i2c/saa6588* |
| 9854 | 9866 | ||
| 9855 | SAA7134 VIDEO4LINUX DRIVER | 9867 | SAA7134 VIDEO4LINUX DRIVER |
| 9856 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 9868 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 9869 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 9857 | L: linux-media@vger.kernel.org | 9870 | L: linux-media@vger.kernel.org |
| 9858 | W: https://linuxtv.org | 9871 | W: https://linuxtv.org |
| 9859 | T: git git://linuxtv.org/media_tree.git | 9872 | T: git git://linuxtv.org/media_tree.git |
| @@ -10372,7 +10385,8 @@ S: Maintained | |||
| 10372 | F: drivers/media/radio/si4713/radio-usb-si4713.c | 10385 | F: drivers/media/radio/si4713/radio-usb-si4713.c |
| 10373 | 10386 | ||
| 10374 | SIANO DVB DRIVER | 10387 | SIANO DVB DRIVER |
| 10375 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 10388 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 10389 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 10376 | L: linux-media@vger.kernel.org | 10390 | L: linux-media@vger.kernel.org |
| 10377 | W: https://linuxtv.org | 10391 | W: https://linuxtv.org |
| 10378 | T: git git://linuxtv.org/media_tree.git | 10392 | T: git git://linuxtv.org/media_tree.git |
| @@ -11138,7 +11152,8 @@ S: Maintained | |||
| 11138 | F: drivers/media/i2c/tda9840* | 11152 | F: drivers/media/i2c/tda9840* |
| 11139 | 11153 | ||
| 11140 | TEA5761 TUNER DRIVER | 11154 | TEA5761 TUNER DRIVER |
| 11141 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 11155 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 11156 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 11142 | L: linux-media@vger.kernel.org | 11157 | L: linux-media@vger.kernel.org |
| 11143 | W: https://linuxtv.org | 11158 | W: https://linuxtv.org |
| 11144 | T: git git://linuxtv.org/media_tree.git | 11159 | T: git git://linuxtv.org/media_tree.git |
| @@ -11146,7 +11161,8 @@ S: Odd fixes | |||
| 11146 | F: drivers/media/tuners/tea5761.* | 11161 | F: drivers/media/tuners/tea5761.* |
| 11147 | 11162 | ||
| 11148 | TEA5767 TUNER DRIVER | 11163 | TEA5767 TUNER DRIVER |
| 11149 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 11164 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 11165 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 11150 | L: linux-media@vger.kernel.org | 11166 | L: linux-media@vger.kernel.org |
| 11151 | W: https://linuxtv.org | 11167 | W: https://linuxtv.org |
| 11152 | T: git git://linuxtv.org/media_tree.git | 11168 | T: git git://linuxtv.org/media_tree.git |
| @@ -11533,7 +11549,8 @@ F: include/linux/shmem_fs.h | |||
| 11533 | F: mm/shmem.c | 11549 | F: mm/shmem.c |
| 11534 | 11550 | ||
| 11535 | TM6000 VIDEO4LINUX DRIVER | 11551 | TM6000 VIDEO4LINUX DRIVER |
| 11536 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 11552 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 11553 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 11537 | L: linux-media@vger.kernel.org | 11554 | L: linux-media@vger.kernel.org |
| 11538 | W: https://linuxtv.org | 11555 | W: https://linuxtv.org |
| 11539 | T: git git://linuxtv.org/media_tree.git | 11556 | T: git git://linuxtv.org/media_tree.git |
| @@ -11887,7 +11904,8 @@ F: drivers/usb/common/usb-otg-fsm.c | |||
| 11887 | 11904 | ||
| 11888 | USB OVER IP DRIVER | 11905 | USB OVER IP DRIVER |
| 11889 | M: Valentina Manea <valentina.manea.m@gmail.com> | 11906 | M: Valentina Manea <valentina.manea.m@gmail.com> |
| 11890 | M: Shuah Khan <shuah.kh@samsung.com> | 11907 | M: Shuah Khan <shuahkh@osg.samsung.com> |
| 11908 | M: Shuah Khan <shuah@kernel.org> | ||
| 11891 | L: linux-usb@vger.kernel.org | 11909 | L: linux-usb@vger.kernel.org |
| 11892 | S: Maintained | 11910 | S: Maintained |
| 11893 | F: Documentation/usb/usbip_protocol.txt | 11911 | F: Documentation/usb/usbip_protocol.txt |
| @@ -11958,6 +11976,7 @@ L: linux-usb@vger.kernel.org | |||
| 11958 | W: http://www.linux-usb.org | 11976 | W: http://www.linux-usb.org |
| 11959 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git | 11977 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git |
| 11960 | S: Supported | 11978 | S: Supported |
| 11979 | F: Documentation/devicetree/bindings/usb/ | ||
| 11961 | F: Documentation/usb/ | 11980 | F: Documentation/usb/ |
| 11962 | F: drivers/usb/ | 11981 | F: drivers/usb/ |
| 11963 | F: include/linux/usb.h | 11982 | F: include/linux/usb.h |
| @@ -12131,6 +12150,7 @@ VIRTIO CORE, NET AND BLOCK DRIVERS | |||
| 12131 | M: "Michael S. Tsirkin" <mst@redhat.com> | 12150 | M: "Michael S. Tsirkin" <mst@redhat.com> |
| 12132 | L: virtualization@lists.linux-foundation.org | 12151 | L: virtualization@lists.linux-foundation.org |
| 12133 | S: Maintained | 12152 | S: Maintained |
| 12153 | F: Documentation/devicetree/bindings/virtio/ | ||
| 12134 | F: drivers/virtio/ | 12154 | F: drivers/virtio/ |
| 12135 | F: tools/virtio/ | 12155 | F: tools/virtio/ |
| 12136 | F: drivers/net/virtio_net.c | 12156 | F: drivers/net/virtio_net.c |
| @@ -12519,7 +12539,8 @@ S: Maintained | |||
| 12519 | F: arch/x86/entry/vdso/ | 12539 | F: arch/x86/entry/vdso/ |
| 12520 | 12540 | ||
| 12521 | XC2028/3028 TUNER DRIVER | 12541 | XC2028/3028 TUNER DRIVER |
| 12522 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 12542 | M: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| 12543 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | ||
| 12523 | L: linux-media@vger.kernel.org | 12544 | L: linux-media@vger.kernel.org |
| 12524 | W: https://linuxtv.org | 12545 | W: https://linuxtv.org |
| 12525 | T: git git://linuxtv.org/media_tree.git | 12546 | T: git git://linuxtv.org/media_tree.git |
diff --git a/arch/Kconfig b/arch/Kconfig index d794384a0404..e9734796531f 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
| @@ -606,6 +606,9 @@ config HAVE_ARCH_HASH | |||
| 606 | file which provides platform-specific implementations of some | 606 | file which provides platform-specific implementations of some |
| 607 | functions in <linux/hash.h> or fs/namei.c. | 607 | functions in <linux/hash.h> or fs/namei.c. |
| 608 | 608 | ||
| 609 | config ISA_BUS_API | ||
| 610 | def_bool ISA | ||
| 611 | |||
| 609 | # | 612 | # |
| 610 | # ABI hall of shame | 613 | # ABI hall of shame |
| 611 | # | 614 | # |
diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h index aeddd28b3595..92fd2c8a9af0 100644 --- a/arch/arm/include/asm/pgtable-2level.h +++ b/arch/arm/include/asm/pgtable-2level.h | |||
| @@ -193,6 +193,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr) | |||
| 193 | 193 | ||
| 194 | #define pmd_large(pmd) (pmd_val(pmd) & 2) | 194 | #define pmd_large(pmd) (pmd_val(pmd) & 2) |
| 195 | #define pmd_bad(pmd) (pmd_val(pmd) & 2) | 195 | #define pmd_bad(pmd) (pmd_val(pmd) & 2) |
| 196 | #define pmd_present(pmd) (pmd_val(pmd)) | ||
| 196 | 197 | ||
| 197 | #define copy_pmd(pmdpd,pmdps) \ | 198 | #define copy_pmd(pmdpd,pmdps) \ |
| 198 | do { \ | 199 | do { \ |
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h index fa70db7c714b..2a029bceaf2f 100644 --- a/arch/arm/include/asm/pgtable-3level.h +++ b/arch/arm/include/asm/pgtable-3level.h | |||
| @@ -211,6 +211,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr) | |||
| 211 | : !!(pmd_val(pmd) & (val))) | 211 | : !!(pmd_val(pmd) & (val))) |
| 212 | #define pmd_isclear(pmd, val) (!(pmd_val(pmd) & (val))) | 212 | #define pmd_isclear(pmd, val) (!(pmd_val(pmd) & (val))) |
| 213 | 213 | ||
| 214 | #define pmd_present(pmd) (pmd_isset((pmd), L_PMD_SECT_VALID)) | ||
| 214 | #define pmd_young(pmd) (pmd_isset((pmd), PMD_SECT_AF)) | 215 | #define pmd_young(pmd) (pmd_isset((pmd), PMD_SECT_AF)) |
| 215 | #define pte_special(pte) (pte_isset((pte), L_PTE_SPECIAL)) | 216 | #define pte_special(pte) (pte_isset((pte), L_PTE_SPECIAL)) |
| 216 | static inline pte_t pte_mkspecial(pte_t pte) | 217 | static inline pte_t pte_mkspecial(pte_t pte) |
| @@ -249,10 +250,10 @@ PMD_BIT_FUNC(mkyoung, |= PMD_SECT_AF); | |||
| 249 | #define pfn_pmd(pfn,prot) (__pmd(((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))) | 250 | #define pfn_pmd(pfn,prot) (__pmd(((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))) |
| 250 | #define mk_pmd(page,prot) pfn_pmd(page_to_pfn(page),prot) | 251 | #define mk_pmd(page,prot) pfn_pmd(page_to_pfn(page),prot) |
| 251 | 252 | ||
| 252 | /* represent a notpresent pmd by zero, this is used by pmdp_invalidate */ | 253 | /* represent a notpresent pmd by faulting entry, this is used by pmdp_invalidate */ |
| 253 | static inline pmd_t pmd_mknotpresent(pmd_t pmd) | 254 | static inline pmd_t pmd_mknotpresent(pmd_t pmd) |
| 254 | { | 255 | { |
| 255 | return __pmd(0); | 256 | return __pmd(pmd_val(pmd) & ~L_PMD_SECT_VALID); |
| 256 | } | 257 | } |
| 257 | 258 | ||
| 258 | static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot) | 259 | static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot) |
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index 348caabb7625..d62204060cbe 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h | |||
| @@ -182,7 +182,6 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | |||
| 182 | #define pgd_offset_k(addr) pgd_offset(&init_mm, addr) | 182 | #define pgd_offset_k(addr) pgd_offset(&init_mm, addr) |
| 183 | 183 | ||
| 184 | #define pmd_none(pmd) (!pmd_val(pmd)) | 184 | #define pmd_none(pmd) (!pmd_val(pmd)) |
| 185 | #define pmd_present(pmd) (pmd_val(pmd)) | ||
| 186 | 185 | ||
| 187 | static inline pte_t *pmd_page_vaddr(pmd_t pmd) | 186 | static inline pte_t *pmd_page_vaddr(pmd_t pmd) |
| 188 | { | 187 | { |
diff --git a/arch/arm64/include/asm/kgdb.h b/arch/arm64/include/asm/kgdb.h index f69f69c8120c..da84645525b9 100644 --- a/arch/arm64/include/asm/kgdb.h +++ b/arch/arm64/include/asm/kgdb.h | |||
| @@ -38,25 +38,54 @@ extern int kgdb_fault_expected; | |||
| 38 | #endif /* !__ASSEMBLY__ */ | 38 | #endif /* !__ASSEMBLY__ */ |
| 39 | 39 | ||
| 40 | /* | 40 | /* |
| 41 | * gdb is expecting the following registers layout. | 41 | * gdb remote procotol (well most versions of it) expects the following |
| 42 | * register layout. | ||
| 42 | * | 43 | * |
| 43 | * General purpose regs: | 44 | * General purpose regs: |
| 44 | * r0-r30: 64 bit | 45 | * r0-r30: 64 bit |
| 45 | * sp,pc : 64 bit | 46 | * sp,pc : 64 bit |
| 46 | * pstate : 64 bit | 47 | * pstate : 32 bit |
| 47 | * Total: 34 | 48 | * Total: 33 + 1 |
| 48 | * FPU regs: | 49 | * FPU regs: |
| 49 | * f0-f31: 128 bit | 50 | * f0-f31: 128 bit |
| 50 | * Total: 32 | ||
| 51 | * Extra regs | ||
| 52 | * fpsr & fpcr: 32 bit | 51 | * fpsr & fpcr: 32 bit |
| 53 | * Total: 2 | 52 | * Total: 32 + 2 |
| 54 | * | 53 | * |
| 54 | * To expand a little on the "most versions of it"... when the gdb remote | ||
| 55 | * protocol for AArch64 was developed it depended on a statement in the | ||
| 56 | * Architecture Reference Manual that claimed "SPSR_ELx is a 32-bit register". | ||
| 57 | * and, as a result, allocated only 32-bits for the PSTATE in the remote | ||
| 58 | * protocol. In fact this statement is still present in ARM DDI 0487A.i. | ||
| 59 | * | ||
| 60 | * Unfortunately "is a 32-bit register" has a very special meaning for | ||
| 61 | * system registers. It means that "the upper bits, bits[63:32], are | ||
| 62 | * RES0.". RES0 is heavily used in the ARM architecture documents as a | ||
| 63 | * way to leave space for future architecture changes. So to translate a | ||
| 64 | * little for people who don't spend their spare time reading ARM architecture | ||
| 65 | * manuals, what "is a 32-bit register" actually means in this context is | ||
| 66 | * "is a 64-bit register but one with no meaning allocated to any of the | ||
| 67 | * upper 32-bits... *yet*". | ||
| 68 | * | ||
| 69 | * Perhaps then we should not be surprised that this has led to some | ||
| 70 | * confusion. Specifically a patch, influenced by the above translation, | ||
| 71 | * that extended PSTATE to 64-bit was accepted into gdb-7.7 but the patch | ||
| 72 | * was reverted in gdb-7.8.1 and all later releases, when this was | ||
| 73 | * discovered to be an undocumented protocol change. | ||
| 74 | * | ||
| 75 | * So... it is *not* wrong for us to only allocate 32-bits to PSTATE | ||
| 76 | * here even though the kernel itself allocates 64-bits for the same | ||
| 77 | * state. That is because this bit of code tells the kernel how the gdb | ||
| 78 | * remote protocol (well most versions of it) describes the register state. | ||
| 79 | * | ||
| 80 | * Note that if you are using one of the versions of gdb that supports | ||
| 81 | * the gdb-7.7 version of the protocol you cannot use kgdb directly | ||
| 82 | * without providing a custom register description (gdb can load new | ||
| 83 | * protocol descriptions at runtime). | ||
| 55 | */ | 84 | */ |
| 56 | 85 | ||
| 57 | #define _GP_REGS 34 | 86 | #define _GP_REGS 33 |
| 58 | #define _FP_REGS 32 | 87 | #define _FP_REGS 32 |
| 59 | #define _EXTRA_REGS 2 | 88 | #define _EXTRA_REGS 3 |
| 60 | /* | 89 | /* |
| 61 | * general purpose registers size in bytes. | 90 | * general purpose registers size in bytes. |
| 62 | * pstate is only 4 bytes. subtract 4 bytes | 91 | * pstate is only 4 bytes. subtract 4 bytes |
diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h index fc9682bfe002..e875a5a551d7 100644 --- a/arch/arm64/include/asm/spinlock.h +++ b/arch/arm64/include/asm/spinlock.h | |||
| @@ -30,22 +30,53 @@ static inline void arch_spin_unlock_wait(arch_spinlock_t *lock) | |||
| 30 | { | 30 | { |
| 31 | unsigned int tmp; | 31 | unsigned int tmp; |
| 32 | arch_spinlock_t lockval; | 32 | arch_spinlock_t lockval; |
| 33 | u32 owner; | ||
| 34 | |||
| 35 | /* | ||
| 36 | * Ensure prior spin_lock operations to other locks have completed | ||
| 37 | * on this CPU before we test whether "lock" is locked. | ||
| 38 | */ | ||
| 39 | smp_mb(); | ||
| 40 | owner = READ_ONCE(lock->owner) << 16; | ||
| 33 | 41 | ||
| 34 | asm volatile( | 42 | asm volatile( |
| 35 | " sevl\n" | 43 | " sevl\n" |
| 36 | "1: wfe\n" | 44 | "1: wfe\n" |
| 37 | "2: ldaxr %w0, %2\n" | 45 | "2: ldaxr %w0, %2\n" |
| 46 | /* Is the lock free? */ | ||
| 38 | " eor %w1, %w0, %w0, ror #16\n" | 47 | " eor %w1, %w0, %w0, ror #16\n" |
| 39 | " cbnz %w1, 1b\n" | 48 | " cbz %w1, 3f\n" |
| 49 | /* Lock taken -- has there been a subsequent unlock->lock transition? */ | ||
| 50 | " eor %w1, %w3, %w0, lsl #16\n" | ||
| 51 | " cbz %w1, 1b\n" | ||
| 52 | /* | ||
| 53 | * The owner has been updated, so there was an unlock->lock | ||
| 54 | * transition that we missed. That means we can rely on the | ||
| 55 | * store-release of the unlock operation paired with the | ||
| 56 | * load-acquire of the lock operation to publish any of our | ||
| 57 | * previous stores to the new lock owner and therefore don't | ||
| 58 | * need to bother with the writeback below. | ||
| 59 | */ | ||
| 60 | " b 4f\n" | ||
| 61 | "3:\n" | ||
| 62 | /* | ||
| 63 | * Serialise against any concurrent lockers by writing back the | ||
| 64 | * unlocked lock value | ||
| 65 | */ | ||
| 40 | ARM64_LSE_ATOMIC_INSN( | 66 | ARM64_LSE_ATOMIC_INSN( |
| 41 | /* LL/SC */ | 67 | /* LL/SC */ |
| 42 | " stxr %w1, %w0, %2\n" | 68 | " stxr %w1, %w0, %2\n" |
| 43 | " cbnz %w1, 2b\n", /* Serialise against any concurrent lockers */ | ||
| 44 | /* LSE atomics */ | ||
| 45 | " nop\n" | 69 | " nop\n" |
| 46 | " nop\n") | 70 | " nop\n", |
| 71 | /* LSE atomics */ | ||
| 72 | " mov %w1, %w0\n" | ||
| 73 | " cas %w0, %w0, %2\n" | ||
| 74 | " eor %w1, %w1, %w0\n") | ||
| 75 | /* Somebody else wrote to the lock, GOTO 10 and reload the value */ | ||
| 76 | " cbnz %w1, 2b\n" | ||
| 77 | "4:" | ||
| 47 | : "=&r" (lockval), "=&r" (tmp), "+Q" (*lock) | 78 | : "=&r" (lockval), "=&r" (tmp), "+Q" (*lock) |
| 48 | : | 79 | : "r" (owner) |
| 49 | : "memory"); | 80 | : "memory"); |
| 50 | } | 81 | } |
| 51 | 82 | ||
| @@ -148,6 +179,7 @@ static inline int arch_spin_value_unlocked(arch_spinlock_t lock) | |||
| 148 | 179 | ||
| 149 | static inline int arch_spin_is_locked(arch_spinlock_t *lock) | 180 | static inline int arch_spin_is_locked(arch_spinlock_t *lock) |
| 150 | { | 181 | { |
| 182 | smp_mb(); /* See arch_spin_unlock_wait */ | ||
| 151 | return !arch_spin_value_unlocked(READ_ONCE(*lock)); | 183 | return !arch_spin_value_unlocked(READ_ONCE(*lock)); |
| 152 | } | 184 | } |
| 153 | 185 | ||
diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c index b67531a13136..b5f063e5eff7 100644 --- a/arch/arm64/kernel/kgdb.c +++ b/arch/arm64/kernel/kgdb.c | |||
| @@ -58,7 +58,17 @@ struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = { | |||
| 58 | { "x30", 8, offsetof(struct pt_regs, regs[30])}, | 58 | { "x30", 8, offsetof(struct pt_regs, regs[30])}, |
| 59 | { "sp", 8, offsetof(struct pt_regs, sp)}, | 59 | { "sp", 8, offsetof(struct pt_regs, sp)}, |
| 60 | { "pc", 8, offsetof(struct pt_regs, pc)}, | 60 | { "pc", 8, offsetof(struct pt_regs, pc)}, |
| 61 | { "pstate", 8, offsetof(struct pt_regs, pstate)}, | 61 | /* |
| 62 | * struct pt_regs thinks PSTATE is 64-bits wide but gdb remote | ||
| 63 | * protocol disagrees. Therefore we must extract only the lower | ||
| 64 | * 32-bits. Look for the big comment in asm/kgdb.h for more | ||
| 65 | * detail. | ||
| 66 | */ | ||
| 67 | { "pstate", 4, offsetof(struct pt_regs, pstate) | ||
| 68 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
| 69 | + 4 | ||
| 70 | #endif | ||
| 71 | }, | ||
| 62 | { "v0", 16, -1 }, | 72 | { "v0", 16, -1 }, |
| 63 | { "v1", 16, -1 }, | 73 | { "v1", 16, -1 }, |
| 64 | { "v2", 16, -1 }, | 74 | { "v2", 16, -1 }, |
| @@ -128,6 +138,8 @@ sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *task) | |||
| 128 | memset((char *)gdb_regs, 0, NUMREGBYTES); | 138 | memset((char *)gdb_regs, 0, NUMREGBYTES); |
| 129 | thread_regs = task_pt_regs(task); | 139 | thread_regs = task_pt_regs(task); |
| 130 | memcpy((void *)gdb_regs, (void *)thread_regs->regs, GP_REG_BYTES); | 140 | memcpy((void *)gdb_regs, (void *)thread_regs->regs, GP_REG_BYTES); |
| 141 | /* Special case for PSTATE (check comments in asm/kgdb.h for details) */ | ||
| 142 | dbg_get_reg(33, gdb_regs + GP_REG_BYTES, thread_regs); | ||
| 131 | } | 143 | } |
| 132 | 144 | ||
| 133 | void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc) | 145 | void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc) |
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index f7cf463107df..2a43012616b7 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c | |||
| @@ -64,8 +64,7 @@ static void dump_mem(const char *lvl, const char *str, unsigned long bottom, | |||
| 64 | 64 | ||
| 65 | /* | 65 | /* |
| 66 | * We need to switch to kernel mode so that we can use __get_user | 66 | * We need to switch to kernel mode so that we can use __get_user |
| 67 | * to safely read from kernel space. Note that we now dump the | 67 | * to safely read from kernel space. |
| 68 | * code first, just in case the backtrace kills us. | ||
| 69 | */ | 68 | */ |
| 70 | fs = get_fs(); | 69 | fs = get_fs(); |
| 71 | set_fs(KERNEL_DS); | 70 | set_fs(KERNEL_DS); |
| @@ -111,21 +110,12 @@ static void dump_backtrace_entry(unsigned long where) | |||
| 111 | print_ip_sym(where); | 110 | print_ip_sym(where); |
| 112 | } | 111 | } |
| 113 | 112 | ||
| 114 | static void dump_instr(const char *lvl, struct pt_regs *regs) | 113 | static void __dump_instr(const char *lvl, struct pt_regs *regs) |
| 115 | { | 114 | { |
| 116 | unsigned long addr = instruction_pointer(regs); | 115 | unsigned long addr = instruction_pointer(regs); |
| 117 | mm_segment_t fs; | ||
| 118 | char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str; | 116 | char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str; |
| 119 | int i; | 117 | int i; |
| 120 | 118 | ||
| 121 | /* | ||
| 122 | * We need to switch to kernel mode so that we can use __get_user | ||
| 123 | * to safely read from kernel space. Note that we now dump the | ||
| 124 | * code first, just in case the backtrace kills us. | ||
| 125 | */ | ||
| 126 | fs = get_fs(); | ||
| 127 | set_fs(KERNEL_DS); | ||
| 128 | |||
| 129 | for (i = -4; i < 1; i++) { | 119 | for (i = -4; i < 1; i++) { |
| 130 | unsigned int val, bad; | 120 | unsigned int val, bad; |
| 131 | 121 | ||
| @@ -139,8 +129,18 @@ static void dump_instr(const char *lvl, struct pt_regs *regs) | |||
| 139 | } | 129 | } |
| 140 | } | 130 | } |
| 141 | printk("%sCode: %s\n", lvl, str); | 131 | printk("%sCode: %s\n", lvl, str); |
| 132 | } | ||
| 142 | 133 | ||
| 143 | set_fs(fs); | 134 | static void dump_instr(const char *lvl, struct pt_regs *regs) |
| 135 | { | ||
| 136 | if (!user_mode(regs)) { | ||
| 137 | mm_segment_t fs = get_fs(); | ||
| 138 | set_fs(KERNEL_DS); | ||
| 139 | __dump_instr(lvl, regs); | ||
| 140 | set_fs(fs); | ||
| 141 | } else { | ||
| 142 | __dump_instr(lvl, regs); | ||
| 143 | } | ||
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) | 146 | static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) |
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index ba3fc12bd272..013e2cbe7924 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c | |||
| @@ -441,7 +441,7 @@ static int do_bad(unsigned long addr, unsigned int esr, struct pt_regs *regs) | |||
| 441 | return 1; | 441 | return 1; |
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | static struct fault_info { | 444 | static const struct fault_info { |
| 445 | int (*fn)(unsigned long addr, unsigned int esr, struct pt_regs *regs); | 445 | int (*fn)(unsigned long addr, unsigned int esr, struct pt_regs *regs); |
| 446 | int sig; | 446 | int sig; |
| 447 | int code; | 447 | int code; |
diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h index 6733ac575da4..36a391d289aa 100644 --- a/arch/mips/include/asm/kvm_host.h +++ b/arch/mips/include/asm/kvm_host.h | |||
| @@ -74,7 +74,7 @@ | |||
| 74 | #define KVM_GUEST_KUSEG 0x00000000UL | 74 | #define KVM_GUEST_KUSEG 0x00000000UL |
| 75 | #define KVM_GUEST_KSEG0 0x40000000UL | 75 | #define KVM_GUEST_KSEG0 0x40000000UL |
| 76 | #define KVM_GUEST_KSEG23 0x60000000UL | 76 | #define KVM_GUEST_KSEG23 0x60000000UL |
| 77 | #define KVM_GUEST_KSEGX(a) ((_ACAST32_(a)) & 0x60000000) | 77 | #define KVM_GUEST_KSEGX(a) ((_ACAST32_(a)) & 0xe0000000) |
| 78 | #define KVM_GUEST_CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff) | 78 | #define KVM_GUEST_CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff) |
| 79 | 79 | ||
| 80 | #define KVM_GUEST_CKSEG0ADDR(a) (KVM_GUEST_CPHYSADDR(a) | KVM_GUEST_KSEG0) | 80 | #define KVM_GUEST_CKSEG0ADDR(a) (KVM_GUEST_CPHYSADDR(a) | KVM_GUEST_KSEG0) |
| @@ -338,6 +338,7 @@ struct kvm_mips_tlb { | |||
| 338 | #define KVM_MIPS_GUEST_TLB_SIZE 64 | 338 | #define KVM_MIPS_GUEST_TLB_SIZE 64 |
| 339 | struct kvm_vcpu_arch { | 339 | struct kvm_vcpu_arch { |
| 340 | void *host_ebase, *guest_ebase; | 340 | void *host_ebase, *guest_ebase; |
| 341 | int (*vcpu_run)(struct kvm_run *run, struct kvm_vcpu *vcpu); | ||
| 341 | unsigned long host_stack; | 342 | unsigned long host_stack; |
| 342 | unsigned long host_gp; | 343 | unsigned long host_gp; |
| 343 | 344 | ||
diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c index 396df6eb0a12..645c8a1982a7 100644 --- a/arch/mips/kvm/emulate.c +++ b/arch/mips/kvm/emulate.c | |||
| @@ -1636,6 +1636,7 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, | |||
| 1636 | if (index < 0) { | 1636 | if (index < 0) { |
| 1637 | vcpu->arch.host_cp0_entryhi = (va & VPN2_MASK); | 1637 | vcpu->arch.host_cp0_entryhi = (va & VPN2_MASK); |
| 1638 | vcpu->arch.host_cp0_badvaddr = va; | 1638 | vcpu->arch.host_cp0_badvaddr = va; |
| 1639 | vcpu->arch.pc = curr_pc; | ||
| 1639 | er = kvm_mips_emulate_tlbmiss_ld(cause, NULL, run, | 1640 | er = kvm_mips_emulate_tlbmiss_ld(cause, NULL, run, |
| 1640 | vcpu); | 1641 | vcpu); |
| 1641 | preempt_enable(); | 1642 | preempt_enable(); |
| @@ -1647,6 +1648,8 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, | |||
| 1647 | * invalid exception to the guest | 1648 | * invalid exception to the guest |
| 1648 | */ | 1649 | */ |
| 1649 | if (!TLB_IS_VALID(*tlb, va)) { | 1650 | if (!TLB_IS_VALID(*tlb, va)) { |
| 1651 | vcpu->arch.host_cp0_badvaddr = va; | ||
| 1652 | vcpu->arch.pc = curr_pc; | ||
| 1650 | er = kvm_mips_emulate_tlbinv_ld(cause, NULL, | 1653 | er = kvm_mips_emulate_tlbinv_ld(cause, NULL, |
| 1651 | run, vcpu); | 1654 | run, vcpu); |
| 1652 | preempt_enable(); | 1655 | preempt_enable(); |
| @@ -1666,7 +1669,7 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, | |||
| 1666 | cache, op, base, arch->gprs[base], offset); | 1669 | cache, op, base, arch->gprs[base], offset); |
| 1667 | er = EMULATE_FAIL; | 1670 | er = EMULATE_FAIL; |
| 1668 | preempt_enable(); | 1671 | preempt_enable(); |
| 1669 | goto dont_update_pc; | 1672 | goto done; |
| 1670 | 1673 | ||
| 1671 | } | 1674 | } |
| 1672 | 1675 | ||
| @@ -1694,16 +1697,20 @@ skip_fault: | |||
| 1694 | kvm_err("NO-OP CACHE (cache: %#x, op: %#x, base[%d]: %#lx, offset: %#x\n", | 1697 | kvm_err("NO-OP CACHE (cache: %#x, op: %#x, base[%d]: %#lx, offset: %#x\n", |
| 1695 | cache, op, base, arch->gprs[base], offset); | 1698 | cache, op, base, arch->gprs[base], offset); |
| 1696 | er = EMULATE_FAIL; | 1699 | er = EMULATE_FAIL; |
| 1697 | preempt_enable(); | ||
| 1698 | goto dont_update_pc; | ||
| 1699 | } | 1700 | } |
| 1700 | 1701 | ||
| 1701 | preempt_enable(); | 1702 | preempt_enable(); |
| 1703 | done: | ||
| 1704 | /* Rollback PC only if emulation was unsuccessful */ | ||
| 1705 | if (er == EMULATE_FAIL) | ||
| 1706 | vcpu->arch.pc = curr_pc; | ||
| 1702 | 1707 | ||
| 1703 | dont_update_pc: | 1708 | dont_update_pc: |
| 1704 | /* Rollback PC */ | 1709 | /* |
| 1705 | vcpu->arch.pc = curr_pc; | 1710 | * This is for exceptions whose emulation updates the PC, so do not |
| 1706 | done: | 1711 | * overwrite the PC under any circumstances |
| 1712 | */ | ||
| 1713 | |||
| 1707 | return er; | 1714 | return er; |
| 1708 | } | 1715 | } |
| 1709 | 1716 | ||
diff --git a/arch/mips/kvm/interrupt.h b/arch/mips/kvm/interrupt.h index 4ab4bdfad703..2143884709e4 100644 --- a/arch/mips/kvm/interrupt.h +++ b/arch/mips/kvm/interrupt.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #define MIPS_EXC_MAX 12 | 28 | #define MIPS_EXC_MAX 12 |
| 29 | /* XXXSL More to follow */ | 29 | /* XXXSL More to follow */ |
| 30 | 30 | ||
| 31 | extern char __kvm_mips_vcpu_run_end[]; | ||
| 31 | extern char mips32_exception[], mips32_exceptionEnd[]; | 32 | extern char mips32_exception[], mips32_exceptionEnd[]; |
| 32 | extern char mips32_GuestException[], mips32_GuestExceptionEnd[]; | 33 | extern char mips32_GuestException[], mips32_GuestExceptionEnd[]; |
| 33 | 34 | ||
diff --git a/arch/mips/kvm/locore.S b/arch/mips/kvm/locore.S index 3ef03009de5f..828fcfc1cd7f 100644 --- a/arch/mips/kvm/locore.S +++ b/arch/mips/kvm/locore.S | |||
| @@ -202,6 +202,7 @@ FEXPORT(__kvm_mips_load_k0k1) | |||
| 202 | 202 | ||
| 203 | /* Jump to guest */ | 203 | /* Jump to guest */ |
| 204 | eret | 204 | eret |
| 205 | EXPORT(__kvm_mips_vcpu_run_end) | ||
| 205 | 206 | ||
| 206 | VECTOR(MIPSX(exception), unknown) | 207 | VECTOR(MIPSX(exception), unknown) |
| 207 | /* Find out what mode we came from and jump to the proper handler. */ | 208 | /* Find out what mode we came from and jump to the proper handler. */ |
diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c index dc052fb5c7a2..44da5259f390 100644 --- a/arch/mips/kvm/mips.c +++ b/arch/mips/kvm/mips.c | |||
| @@ -315,6 +315,15 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) | |||
| 315 | memcpy(gebase + offset, mips32_GuestException, | 315 | memcpy(gebase + offset, mips32_GuestException, |
| 316 | mips32_GuestExceptionEnd - mips32_GuestException); | 316 | mips32_GuestExceptionEnd - mips32_GuestException); |
| 317 | 317 | ||
| 318 | #ifdef MODULE | ||
| 319 | offset += mips32_GuestExceptionEnd - mips32_GuestException; | ||
| 320 | memcpy(gebase + offset, (char *)__kvm_mips_vcpu_run, | ||
| 321 | __kvm_mips_vcpu_run_end - (char *)__kvm_mips_vcpu_run); | ||
| 322 | vcpu->arch.vcpu_run = gebase + offset; | ||
| 323 | #else | ||
| 324 | vcpu->arch.vcpu_run = __kvm_mips_vcpu_run; | ||
| 325 | #endif | ||
| 326 | |||
| 318 | /* Invalidate the icache for these ranges */ | 327 | /* Invalidate the icache for these ranges */ |
| 319 | local_flush_icache_range((unsigned long)gebase, | 328 | local_flush_icache_range((unsigned long)gebase, |
| 320 | (unsigned long)gebase + ALIGN(size, PAGE_SIZE)); | 329 | (unsigned long)gebase + ALIGN(size, PAGE_SIZE)); |
| @@ -404,7 +413,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
| 404 | /* Disable hardware page table walking while in guest */ | 413 | /* Disable hardware page table walking while in guest */ |
| 405 | htw_stop(); | 414 | htw_stop(); |
| 406 | 415 | ||
| 407 | r = __kvm_mips_vcpu_run(run, vcpu); | 416 | r = vcpu->arch.vcpu_run(run, vcpu); |
| 408 | 417 | ||
| 409 | /* Re-enable HTW before enabling interrupts */ | 418 | /* Re-enable HTW before enabling interrupts */ |
| 410 | htw_start(); | 419 | htw_start(); |
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h index 37b9017c6a96..ac82e8eb936d 100644 --- a/arch/s390/include/asm/kvm_host.h +++ b/arch/s390/include/asm/kvm_host.h | |||
| @@ -245,6 +245,7 @@ struct kvm_vcpu_stat { | |||
| 245 | u32 exit_stop_request; | 245 | u32 exit_stop_request; |
| 246 | u32 exit_validity; | 246 | u32 exit_validity; |
| 247 | u32 exit_instruction; | 247 | u32 exit_instruction; |
| 248 | u32 exit_pei; | ||
| 248 | u32 halt_successful_poll; | 249 | u32 halt_successful_poll; |
| 249 | u32 halt_attempted_poll; | 250 | u32 halt_attempted_poll; |
| 250 | u32 halt_poll_invalid; | 251 | u32 halt_poll_invalid; |
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c index 2e6b54e4d3f9..252157181302 100644 --- a/arch/s390/kvm/intercept.c +++ b/arch/s390/kvm/intercept.c | |||
| @@ -341,6 +341,8 @@ static int handle_mvpg_pei(struct kvm_vcpu *vcpu) | |||
| 341 | 341 | ||
| 342 | static int handle_partial_execution(struct kvm_vcpu *vcpu) | 342 | static int handle_partial_execution(struct kvm_vcpu *vcpu) |
| 343 | { | 343 | { |
| 344 | vcpu->stat.exit_pei++; | ||
| 345 | |||
| 344 | if (vcpu->arch.sie_block->ipa == 0xb254) /* MVPG */ | 346 | if (vcpu->arch.sie_block->ipa == 0xb254) /* MVPG */ |
| 345 | return handle_mvpg_pei(vcpu); | 347 | return handle_mvpg_pei(vcpu); |
| 346 | if (vcpu->arch.sie_block->ipa >> 8 == 0xae) /* SIGP */ | 348 | if (vcpu->arch.sie_block->ipa >> 8 == 0xae) /* SIGP */ |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 6d8ec3ac9dd8..43f2a2b80490 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
| @@ -61,6 +61,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { | |||
| 61 | { "exit_external_request", VCPU_STAT(exit_external_request) }, | 61 | { "exit_external_request", VCPU_STAT(exit_external_request) }, |
| 62 | { "exit_external_interrupt", VCPU_STAT(exit_external_interrupt) }, | 62 | { "exit_external_interrupt", VCPU_STAT(exit_external_interrupt) }, |
| 63 | { "exit_instruction", VCPU_STAT(exit_instruction) }, | 63 | { "exit_instruction", VCPU_STAT(exit_instruction) }, |
| 64 | { "exit_pei", VCPU_STAT(exit_pei) }, | ||
| 64 | { "exit_program_interruption", VCPU_STAT(exit_program_interruption) }, | 65 | { "exit_program_interruption", VCPU_STAT(exit_program_interruption) }, |
| 65 | { "exit_instr_and_program_int", VCPU_STAT(exit_instr_and_program) }, | 66 | { "exit_instr_and_program_int", VCPU_STAT(exit_instr_and_program) }, |
| 66 | { "halt_successful_poll", VCPU_STAT(halt_successful_poll) }, | 67 | { "halt_successful_poll", VCPU_STAT(halt_successful_poll) }, |
| @@ -657,7 +658,7 @@ static int kvm_s390_set_processor(struct kvm *kvm, struct kvm_device_attr *attr) | |||
| 657 | kvm->arch.model.cpuid = proc->cpuid; | 658 | kvm->arch.model.cpuid = proc->cpuid; |
| 658 | lowest_ibc = sclp.ibc >> 16 & 0xfff; | 659 | lowest_ibc = sclp.ibc >> 16 & 0xfff; |
| 659 | unblocked_ibc = sclp.ibc & 0xfff; | 660 | unblocked_ibc = sclp.ibc & 0xfff; |
| 660 | if (lowest_ibc) { | 661 | if (lowest_ibc && proc->ibc) { |
| 661 | if (proc->ibc > unblocked_ibc) | 662 | if (proc->ibc > unblocked_ibc) |
| 662 | kvm->arch.model.ibc = unblocked_ibc; | 663 | kvm->arch.model.ibc = unblocked_ibc; |
| 663 | else if (proc->ibc < lowest_ibc) | 664 | else if (proc->ibc < lowest_ibc) |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 0a7b885964ba..d9a94da0c29f 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -2439,6 +2439,15 @@ config PCI_CNB20LE_QUIRK | |||
| 2439 | 2439 | ||
| 2440 | source "drivers/pci/Kconfig" | 2440 | source "drivers/pci/Kconfig" |
| 2441 | 2441 | ||
| 2442 | config ISA_BUS | ||
| 2443 | bool "ISA-style bus support on modern systems" if EXPERT | ||
| 2444 | select ISA_BUS_API | ||
| 2445 | help | ||
| 2446 | Enables ISA-style drivers on modern systems. This is necessary to | ||
| 2447 | support PC/104 devices on X86_64 platforms. | ||
| 2448 | |||
| 2449 | If unsure, say N. | ||
| 2450 | |||
| 2442 | # x86_64 have no ISA slots, but can have ISA-style DMA. | 2451 | # x86_64 have no ISA slots, but can have ISA-style DMA. |
| 2443 | config ISA_DMA_API | 2452 | config ISA_DMA_API |
| 2444 | bool "ISA-style DMA support" if (X86_64 && EXPERT) | 2453 | bool "ISA-style DMA support" if (X86_64 && EXPERT) |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index e0fbe7e70dc1..69e62862b622 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <linux/irqbypass.h> | 27 | #include <linux/irqbypass.h> |
| 28 | #include <linux/hyperv.h> | 28 | #include <linux/hyperv.h> |
| 29 | 29 | ||
| 30 | #include <asm/apic.h> | ||
| 30 | #include <asm/pvclock-abi.h> | 31 | #include <asm/pvclock-abi.h> |
| 31 | #include <asm/desc.h> | 32 | #include <asm/desc.h> |
| 32 | #include <asm/mtrr.h> | 33 | #include <asm/mtrr.h> |
| @@ -1368,4 +1369,14 @@ static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) | |||
| 1368 | 1369 | ||
| 1369 | static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {} | 1370 | static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {} |
| 1370 | 1371 | ||
| 1372 | static inline int kvm_cpu_get_apicid(int mps_cpu) | ||
| 1373 | { | ||
| 1374 | #ifdef CONFIG_X86_LOCAL_APIC | ||
| 1375 | return __default_cpu_present_to_apicid(mps_cpu); | ||
| 1376 | #else | ||
| 1377 | WARN_ON_ONCE(1); | ||
| 1378 | return BAD_APICID; | ||
| 1379 | #endif | ||
| 1380 | } | ||
| 1381 | |||
| 1371 | #endif /* _ASM_X86_KVM_HOST_H */ | 1382 | #endif /* _ASM_X86_KVM_HOST_H */ |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 1163e8173e5a..16ef31b87452 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
| @@ -238,7 +238,9 @@ module_param(nested, int, S_IRUGO); | |||
| 238 | 238 | ||
| 239 | /* enable / disable AVIC */ | 239 | /* enable / disable AVIC */ |
| 240 | static int avic; | 240 | static int avic; |
| 241 | #ifdef CONFIG_X86_LOCAL_APIC | ||
| 241 | module_param(avic, int, S_IRUGO); | 242 | module_param(avic, int, S_IRUGO); |
| 243 | #endif | ||
| 242 | 244 | ||
| 243 | static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0); | 245 | static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0); |
| 244 | static void svm_flush_tlb(struct kvm_vcpu *vcpu); | 246 | static void svm_flush_tlb(struct kvm_vcpu *vcpu); |
| @@ -981,11 +983,14 @@ static __init int svm_hardware_setup(void) | |||
| 981 | } else | 983 | } else |
| 982 | kvm_disable_tdp(); | 984 | kvm_disable_tdp(); |
| 983 | 985 | ||
| 984 | if (avic && (!npt_enabled || !boot_cpu_has(X86_FEATURE_AVIC))) | 986 | if (avic) { |
| 985 | avic = false; | 987 | if (!npt_enabled || |
| 986 | 988 | !boot_cpu_has(X86_FEATURE_AVIC) || | |
| 987 | if (avic) | 989 | !IS_ENABLED(CONFIG_X86_LOCAL_APIC)) |
| 988 | pr_info("AVIC enabled\n"); | 990 | avic = false; |
| 991 | else | ||
| 992 | pr_info("AVIC enabled\n"); | ||
| 993 | } | ||
| 989 | 994 | ||
| 990 | return 0; | 995 | return 0; |
| 991 | 996 | ||
| @@ -1324,7 +1329,7 @@ free_avic: | |||
| 1324 | static void avic_set_running(struct kvm_vcpu *vcpu, bool is_run) | 1329 | static void avic_set_running(struct kvm_vcpu *vcpu, bool is_run) |
| 1325 | { | 1330 | { |
| 1326 | u64 entry; | 1331 | u64 entry; |
| 1327 | int h_physical_id = __default_cpu_present_to_apicid(vcpu->cpu); | 1332 | int h_physical_id = kvm_cpu_get_apicid(vcpu->cpu); |
| 1328 | struct vcpu_svm *svm = to_svm(vcpu); | 1333 | struct vcpu_svm *svm = to_svm(vcpu); |
| 1329 | 1334 | ||
| 1330 | if (!kvm_vcpu_apicv_active(vcpu)) | 1335 | if (!kvm_vcpu_apicv_active(vcpu)) |
| @@ -1349,7 +1354,7 @@ static void avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | |||
| 1349 | { | 1354 | { |
| 1350 | u64 entry; | 1355 | u64 entry; |
| 1351 | /* ID = 0xff (broadcast), ID > 0xff (reserved) */ | 1356 | /* ID = 0xff (broadcast), ID > 0xff (reserved) */ |
| 1352 | int h_physical_id = __default_cpu_present_to_apicid(cpu); | 1357 | int h_physical_id = kvm_cpu_get_apicid(cpu); |
| 1353 | struct vcpu_svm *svm = to_svm(vcpu); | 1358 | struct vcpu_svm *svm = to_svm(vcpu); |
| 1354 | 1359 | ||
| 1355 | if (!kvm_vcpu_apicv_active(vcpu)) | 1360 | if (!kvm_vcpu_apicv_active(vcpu)) |
| @@ -4236,7 +4241,7 @@ static void svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec) | |||
| 4236 | 4241 | ||
| 4237 | if (avic_vcpu_is_running(vcpu)) | 4242 | if (avic_vcpu_is_running(vcpu)) |
| 4238 | wrmsrl(SVM_AVIC_DOORBELL, | 4243 | wrmsrl(SVM_AVIC_DOORBELL, |
| 4239 | __default_cpu_present_to_apicid(vcpu->cpu)); | 4244 | kvm_cpu_get_apicid(vcpu->cpu)); |
| 4240 | else | 4245 | else |
| 4241 | kvm_vcpu_wake_up(vcpu); | 4246 | kvm_vcpu_wake_up(vcpu); |
| 4242 | } | 4247 | } |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index fb93010beaa4..003618e324ce 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
| @@ -2072,7 +2072,8 @@ static void vmx_vcpu_pi_load(struct kvm_vcpu *vcpu, int cpu) | |||
| 2072 | unsigned int dest; | 2072 | unsigned int dest; |
| 2073 | 2073 | ||
| 2074 | if (!kvm_arch_has_assigned_device(vcpu->kvm) || | 2074 | if (!kvm_arch_has_assigned_device(vcpu->kvm) || |
| 2075 | !irq_remapping_cap(IRQ_POSTING_CAP)) | 2075 | !irq_remapping_cap(IRQ_POSTING_CAP) || |
| 2076 | !kvm_vcpu_apicv_active(vcpu)) | ||
| 2076 | return; | 2077 | return; |
| 2077 | 2078 | ||
| 2078 | do { | 2079 | do { |
| @@ -2180,7 +2181,8 @@ static void vmx_vcpu_pi_put(struct kvm_vcpu *vcpu) | |||
| 2180 | struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu); | 2181 | struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu); |
| 2181 | 2182 | ||
| 2182 | if (!kvm_arch_has_assigned_device(vcpu->kvm) || | 2183 | if (!kvm_arch_has_assigned_device(vcpu->kvm) || |
| 2183 | !irq_remapping_cap(IRQ_POSTING_CAP)) | 2184 | !irq_remapping_cap(IRQ_POSTING_CAP) || |
| 2185 | !kvm_vcpu_apicv_active(vcpu)) | ||
| 2184 | return; | 2186 | return; |
| 2185 | 2187 | ||
| 2186 | /* Set SN when the vCPU is preempted */ | 2188 | /* Set SN when the vCPU is preempted */ |
| @@ -10714,7 +10716,8 @@ static int vmx_pre_block(struct kvm_vcpu *vcpu) | |||
| 10714 | struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu); | 10716 | struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu); |
| 10715 | 10717 | ||
| 10716 | if (!kvm_arch_has_assigned_device(vcpu->kvm) || | 10718 | if (!kvm_arch_has_assigned_device(vcpu->kvm) || |
| 10717 | !irq_remapping_cap(IRQ_POSTING_CAP)) | 10719 | !irq_remapping_cap(IRQ_POSTING_CAP) || |
| 10720 | !kvm_vcpu_apicv_active(vcpu)) | ||
| 10718 | return 0; | 10721 | return 0; |
| 10719 | 10722 | ||
| 10720 | vcpu->pre_pcpu = vcpu->cpu; | 10723 | vcpu->pre_pcpu = vcpu->cpu; |
| @@ -10780,7 +10783,8 @@ static void vmx_post_block(struct kvm_vcpu *vcpu) | |||
| 10780 | unsigned long flags; | 10783 | unsigned long flags; |
| 10781 | 10784 | ||
| 10782 | if (!kvm_arch_has_assigned_device(vcpu->kvm) || | 10785 | if (!kvm_arch_has_assigned_device(vcpu->kvm) || |
| 10783 | !irq_remapping_cap(IRQ_POSTING_CAP)) | 10786 | !irq_remapping_cap(IRQ_POSTING_CAP) || |
| 10787 | !kvm_vcpu_apicv_active(vcpu)) | ||
| 10784 | return; | 10788 | return; |
| 10785 | 10789 | ||
| 10786 | do { | 10790 | do { |
| @@ -10833,7 +10837,8 @@ static int vmx_update_pi_irte(struct kvm *kvm, unsigned int host_irq, | |||
| 10833 | int idx, ret = -EINVAL; | 10837 | int idx, ret = -EINVAL; |
| 10834 | 10838 | ||
| 10835 | if (!kvm_arch_has_assigned_device(kvm) || | 10839 | if (!kvm_arch_has_assigned_device(kvm) || |
| 10836 | !irq_remapping_cap(IRQ_POSTING_CAP)) | 10840 | !irq_remapping_cap(IRQ_POSTING_CAP) || |
| 10841 | !kvm_vcpu_apicv_active(kvm->vcpus[0])) | ||
| 10837 | return 0; | 10842 | return 0; |
| 10838 | 10843 | ||
| 10839 | idx = srcu_read_lock(&kvm->irq_srcu); | 10844 | idx = srcu_read_lock(&kvm->irq_srcu); |
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c index daceb80022b0..3b7fb99362b6 100644 --- a/drivers/acpi/acpica/hwregs.c +++ b/drivers/acpi/acpica/hwregs.c | |||
| @@ -306,12 +306,6 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg) | |||
| 306 | acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg) | 306 | acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg) |
| 307 | { | 307 | { |
| 308 | u64 address; | 308 | u64 address; |
| 309 | u8 access_width; | ||
| 310 | u32 bit_width; | ||
| 311 | u8 bit_offset; | ||
| 312 | u64 value64; | ||
| 313 | u32 new_value32, old_value32; | ||
| 314 | u8 index; | ||
| 315 | acpi_status status; | 309 | acpi_status status; |
| 316 | 310 | ||
| 317 | ACPI_FUNCTION_NAME(hw_write); | 311 | ACPI_FUNCTION_NAME(hw_write); |
| @@ -323,145 +317,23 @@ acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg) | |||
| 323 | return (status); | 317 | return (status); |
| 324 | } | 318 | } |
| 325 | 319 | ||
| 326 | /* Convert access_width into number of bits based */ | ||
| 327 | |||
| 328 | access_width = acpi_hw_get_access_bit_width(reg, 32); | ||
| 329 | bit_width = reg->bit_offset + reg->bit_width; | ||
| 330 | bit_offset = reg->bit_offset; | ||
| 331 | |||
| 332 | /* | 320 | /* |
| 333 | * Two address spaces supported: Memory or IO. PCI_Config is | 321 | * Two address spaces supported: Memory or IO. PCI_Config is |
| 334 | * not supported here because the GAS structure is insufficient | 322 | * not supported here because the GAS structure is insufficient |
| 335 | */ | 323 | */ |
| 336 | index = 0; | 324 | if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { |
| 337 | while (bit_width) { | 325 | status = acpi_os_write_memory((acpi_physical_address) |
| 338 | /* | 326 | address, (u64)value, |
| 339 | * Use offset style bit reads because "Index * AccessWidth" is | 327 | reg->bit_width); |
| 340 | * ensured to be less than 32-bits by acpi_hw_validate_register(). | 328 | } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ |
| 341 | */ | 329 | |
| 342 | new_value32 = ACPI_GET_BITS(&value, index * access_width, | 330 | status = acpi_hw_write_port((acpi_io_address) |
| 343 | ACPI_MASK_BITS_ABOVE_32 | 331 | address, value, reg->bit_width); |
| 344 | (access_width)); | ||
| 345 | |||
| 346 | if (bit_offset >= access_width) { | ||
| 347 | bit_offset -= access_width; | ||
| 348 | } else { | ||
| 349 | /* | ||
| 350 | * Use offset style bit masks because access_width is ensured | ||
| 351 | * to be less than 32-bits by acpi_hw_validate_register() and | ||
| 352 | * bit_offset/bit_width is less than access_width here. | ||
| 353 | */ | ||
| 354 | if (bit_offset) { | ||
| 355 | new_value32 &= ACPI_MASK_BITS_BELOW(bit_offset); | ||
| 356 | } | ||
| 357 | if (bit_width < access_width) { | ||
| 358 | new_value32 &= ACPI_MASK_BITS_ABOVE(bit_width); | ||
| 359 | } | ||
| 360 | |||
| 361 | if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { | ||
| 362 | if (bit_offset || bit_width < access_width) { | ||
| 363 | /* | ||
| 364 | * Read old values in order not to modify the bits that | ||
| 365 | * are beyond the register bit_width/bit_offset setting. | ||
| 366 | */ | ||
| 367 | status = | ||
| 368 | acpi_os_read_memory((acpi_physical_address) | ||
| 369 | address + | ||
| 370 | index * | ||
| 371 | ACPI_DIV_8 | ||
| 372 | (access_width), | ||
| 373 | &value64, | ||
| 374 | access_width); | ||
| 375 | old_value32 = (u32)value64; | ||
| 376 | |||
| 377 | /* | ||
| 378 | * Use offset style bit masks because access_width is | ||
| 379 | * ensured to be less than 32-bits by | ||
| 380 | * acpi_hw_validate_register() and bit_offset/bit_width is | ||
| 381 | * less than access_width here. | ||
| 382 | */ | ||
| 383 | if (bit_offset) { | ||
| 384 | old_value32 &= | ||
| 385 | ACPI_MASK_BITS_ABOVE | ||
| 386 | (bit_offset); | ||
| 387 | bit_offset = 0; | ||
| 388 | } | ||
| 389 | if (bit_width < access_width) { | ||
| 390 | old_value32 &= | ||
| 391 | ACPI_MASK_BITS_BELOW | ||
| 392 | (bit_width); | ||
| 393 | } | ||
| 394 | |||
| 395 | new_value32 |= old_value32; | ||
| 396 | } | ||
| 397 | |||
| 398 | value64 = (u64)new_value32; | ||
| 399 | status = | ||
| 400 | acpi_os_write_memory((acpi_physical_address) | ||
| 401 | address + | ||
| 402 | index * | ||
| 403 | ACPI_DIV_8 | ||
| 404 | (access_width), | ||
| 405 | value64, access_width); | ||
| 406 | } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ | ||
| 407 | |||
| 408 | if (bit_offset || bit_width < access_width) { | ||
| 409 | /* | ||
| 410 | * Read old values in order not to modify the bits that | ||
| 411 | * are beyond the register bit_width/bit_offset setting. | ||
| 412 | */ | ||
| 413 | status = | ||
| 414 | acpi_hw_read_port((acpi_io_address) | ||
| 415 | address + | ||
| 416 | index * | ||
| 417 | ACPI_DIV_8 | ||
| 418 | (access_width), | ||
| 419 | &old_value32, | ||
| 420 | access_width); | ||
| 421 | |||
| 422 | /* | ||
| 423 | * Use offset style bit masks because access_width is | ||
| 424 | * ensured to be less than 32-bits by | ||
| 425 | * acpi_hw_validate_register() and bit_offset/bit_width is | ||
| 426 | * less than access_width here. | ||
| 427 | */ | ||
| 428 | if (bit_offset) { | ||
| 429 | old_value32 &= | ||
| 430 | ACPI_MASK_BITS_ABOVE | ||
| 431 | (bit_offset); | ||
| 432 | bit_offset = 0; | ||
| 433 | } | ||
| 434 | if (bit_width < access_width) { | ||
| 435 | old_value32 &= | ||
| 436 | ACPI_MASK_BITS_BELOW | ||
| 437 | (bit_width); | ||
| 438 | } | ||
| 439 | |||
| 440 | new_value32 |= old_value32; | ||
| 441 | } | ||
| 442 | |||
| 443 | status = acpi_hw_write_port((acpi_io_address) | ||
| 444 | address + | ||
| 445 | index * | ||
| 446 | ACPI_DIV_8 | ||
| 447 | (access_width), | ||
| 448 | new_value32, | ||
| 449 | access_width); | ||
| 450 | } | ||
| 451 | } | ||
| 452 | |||
| 453 | /* | ||
| 454 | * Index * access_width is ensured to be less than 32-bits by | ||
| 455 | * acpi_hw_validate_register(). | ||
| 456 | */ | ||
| 457 | bit_width -= | ||
| 458 | bit_width > access_width ? access_width : bit_width; | ||
| 459 | index++; | ||
| 460 | } | 332 | } |
| 461 | 333 | ||
| 462 | ACPI_DEBUG_PRINT((ACPI_DB_IO, | 334 | ACPI_DEBUG_PRINT((ACPI_DB_IO, |
| 463 | "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", | 335 | "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", |
| 464 | value, access_width, ACPI_FORMAT_UINT64(address), | 336 | value, reg->bit_width, ACPI_FORMAT_UINT64(address), |
| 465 | acpi_ut_get_region_name(reg->space_id))); | 337 | acpi_ut_get_region_name(reg->space_id))); |
| 466 | 338 | ||
| 467 | return (status); | 339 | return (status); |
diff --git a/drivers/base/Makefile b/drivers/base/Makefile index 6b2a84e7f2be..2609ba20b396 100644 --- a/drivers/base/Makefile +++ b/drivers/base/Makefile | |||
| @@ -10,7 +10,7 @@ obj-$(CONFIG_DMA_CMA) += dma-contiguous.o | |||
| 10 | obj-y += power/ | 10 | obj-y += power/ |
| 11 | obj-$(CONFIG_HAS_DMA) += dma-mapping.o | 11 | obj-$(CONFIG_HAS_DMA) += dma-mapping.o |
| 12 | obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o | 12 | obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o |
| 13 | obj-$(CONFIG_ISA) += isa.o | 13 | obj-$(CONFIG_ISA_BUS_API) += isa.o |
| 14 | obj-$(CONFIG_FW_LOADER) += firmware_class.o | 14 | obj-$(CONFIG_FW_LOADER) += firmware_class.o |
| 15 | obj-$(CONFIG_NUMA) += node.o | 15 | obj-$(CONFIG_NUMA) += node.o |
| 16 | obj-$(CONFIG_MEMORY_HOTPLUG_SPARSE) += memory.o | 16 | obj-$(CONFIG_MEMORY_HOTPLUG_SPARSE) += memory.o |
diff --git a/drivers/base/isa.c b/drivers/base/isa.c index 91dba65d7264..cd6ccdcf9df0 100644 --- a/drivers/base/isa.c +++ b/drivers/base/isa.c | |||
| @@ -180,4 +180,4 @@ static int __init isa_bus_init(void) | |||
| 180 | return error; | 180 | return error; |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | device_initcall(isa_bus_init); | 183 | postcore_initcall(isa_bus_init); |
diff --git a/drivers/base/module.c b/drivers/base/module.c index db930d3ee312..2a215780eda2 100644 --- a/drivers/base/module.c +++ b/drivers/base/module.c | |||
| @@ -24,10 +24,12 @@ static char *make_driver_name(struct device_driver *drv) | |||
| 24 | 24 | ||
| 25 | static void module_create_drivers_dir(struct module_kobject *mk) | 25 | static void module_create_drivers_dir(struct module_kobject *mk) |
| 26 | { | 26 | { |
| 27 | if (!mk || mk->drivers_dir) | 27 | static DEFINE_MUTEX(drivers_dir_mutex); |
| 28 | return; | ||
| 29 | 28 | ||
| 30 | mk->drivers_dir = kobject_create_and_add("drivers", &mk->kobj); | 29 | mutex_lock(&drivers_dir_mutex); |
| 30 | if (mk && !mk->drivers_dir) | ||
| 31 | mk->drivers_dir = kobject_create_and_add("drivers", &mk->kobj); | ||
| 32 | mutex_unlock(&drivers_dir_mutex); | ||
| 31 | } | 33 | } |
| 32 | 34 | ||
| 33 | void module_add_driver(struct module *mod, struct device_driver *drv) | 35 | void module_add_driver(struct module *mod, struct device_driver *drv) |
diff --git a/drivers/base/power/opp/cpu.c b/drivers/base/power/opp/cpu.c index 83d6e7ba1a34..8c3434bdb26d 100644 --- a/drivers/base/power/opp/cpu.c +++ b/drivers/base/power/opp/cpu.c | |||
| @@ -211,7 +211,7 @@ int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, | |||
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | /* Mark opp-table as multiple CPUs are sharing it now */ | 213 | /* Mark opp-table as multiple CPUs are sharing it now */ |
| 214 | opp_table->shared_opp = true; | 214 | opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED; |
| 215 | } | 215 | } |
| 216 | unlock: | 216 | unlock: |
| 217 | mutex_unlock(&opp_table_lock); | 217 | mutex_unlock(&opp_table_lock); |
| @@ -227,7 +227,8 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_set_sharing_cpus); | |||
| 227 | * | 227 | * |
| 228 | * This updates the @cpumask with CPUs that are sharing OPPs with @cpu_dev. | 228 | * This updates the @cpumask with CPUs that are sharing OPPs with @cpu_dev. |
| 229 | * | 229 | * |
| 230 | * Returns -ENODEV if OPP table isn't already present. | 230 | * Returns -ENODEV if OPP table isn't already present and -EINVAL if the OPP |
| 231 | * table's status is access-unknown. | ||
| 231 | * | 232 | * |
| 232 | * Locking: The internal opp_table and opp structures are RCU protected. | 233 | * Locking: The internal opp_table and opp structures are RCU protected. |
| 233 | * Hence this function internally uses RCU updater strategy with mutex locks | 234 | * Hence this function internally uses RCU updater strategy with mutex locks |
| @@ -249,9 +250,14 @@ int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask) | |||
| 249 | goto unlock; | 250 | goto unlock; |
| 250 | } | 251 | } |
| 251 | 252 | ||
| 253 | if (opp_table->shared_opp == OPP_TABLE_ACCESS_UNKNOWN) { | ||
| 254 | ret = -EINVAL; | ||
| 255 | goto unlock; | ||
| 256 | } | ||
| 257 | |||
| 252 | cpumask_clear(cpumask); | 258 | cpumask_clear(cpumask); |
| 253 | 259 | ||
| 254 | if (opp_table->shared_opp) { | 260 | if (opp_table->shared_opp == OPP_TABLE_ACCESS_SHARED) { |
| 255 | list_for_each_entry(opp_dev, &opp_table->dev_list, node) | 261 | list_for_each_entry(opp_dev, &opp_table->dev_list, node) |
| 256 | cpumask_set_cpu(opp_dev->dev->id, cpumask); | 262 | cpumask_set_cpu(opp_dev->dev->id, cpumask); |
| 257 | } else { | 263 | } else { |
diff --git a/drivers/base/power/opp/of.c b/drivers/base/power/opp/of.c index 94d2010558e3..1dfd3dd92624 100644 --- a/drivers/base/power/opp/of.c +++ b/drivers/base/power/opp/of.c | |||
| @@ -34,7 +34,10 @@ static struct opp_table *_managed_opp(const struct device_node *np) | |||
| 34 | * But the OPPs will be considered as shared only if the | 34 | * But the OPPs will be considered as shared only if the |
| 35 | * OPP table contains a "opp-shared" property. | 35 | * OPP table contains a "opp-shared" property. |
| 36 | */ | 36 | */ |
| 37 | return opp_table->shared_opp ? opp_table : NULL; | 37 | if (opp_table->shared_opp == OPP_TABLE_ACCESS_SHARED) |
| 38 | return opp_table; | ||
| 39 | |||
| 40 | return NULL; | ||
| 38 | } | 41 | } |
| 39 | } | 42 | } |
| 40 | 43 | ||
| @@ -353,7 +356,10 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np) | |||
| 353 | } | 356 | } |
| 354 | 357 | ||
| 355 | opp_table->np = opp_np; | 358 | opp_table->np = opp_np; |
| 356 | opp_table->shared_opp = of_property_read_bool(opp_np, "opp-shared"); | 359 | if (of_property_read_bool(opp_np, "opp-shared")) |
| 360 | opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED; | ||
| 361 | else | ||
| 362 | opp_table->shared_opp = OPP_TABLE_ACCESS_EXCLUSIVE; | ||
| 357 | 363 | ||
| 358 | mutex_unlock(&opp_table_lock); | 364 | mutex_unlock(&opp_table_lock); |
| 359 | 365 | ||
diff --git a/drivers/base/power/opp/opp.h b/drivers/base/power/opp/opp.h index 20f3be22e060..fabd5ca1a083 100644 --- a/drivers/base/power/opp/opp.h +++ b/drivers/base/power/opp/opp.h | |||
| @@ -119,6 +119,12 @@ struct opp_device { | |||
| 119 | #endif | 119 | #endif |
| 120 | }; | 120 | }; |
| 121 | 121 | ||
| 122 | enum opp_table_access { | ||
| 123 | OPP_TABLE_ACCESS_UNKNOWN = 0, | ||
| 124 | OPP_TABLE_ACCESS_EXCLUSIVE = 1, | ||
| 125 | OPP_TABLE_ACCESS_SHARED = 2, | ||
| 126 | }; | ||
| 127 | |||
| 122 | /** | 128 | /** |
| 123 | * struct opp_table - Device opp structure | 129 | * struct opp_table - Device opp structure |
| 124 | * @node: table node - contains the devices with OPPs that | 130 | * @node: table node - contains the devices with OPPs that |
| @@ -166,7 +172,7 @@ struct opp_table { | |||
| 166 | /* For backward compatibility with v1 bindings */ | 172 | /* For backward compatibility with v1 bindings */ |
| 167 | unsigned int voltage_tolerance_v1; | 173 | unsigned int voltage_tolerance_v1; |
| 168 | 174 | ||
| 169 | bool shared_opp; | 175 | enum opp_table_access shared_opp; |
| 170 | struct dev_pm_opp *suspend_opp; | 176 | struct dev_pm_opp *suspend_opp; |
| 171 | 177 | ||
| 172 | unsigned int *supported_hw; | 178 | unsigned int *supported_hw; |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 94fb407d8561..44b1bd6baa38 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
| @@ -3820,6 +3820,7 @@ static void handle_new_recv_msgs(ipmi_smi_t intf) | |||
| 3820 | while (!list_empty(&intf->waiting_rcv_msgs)) { | 3820 | while (!list_empty(&intf->waiting_rcv_msgs)) { |
| 3821 | smi_msg = list_entry(intf->waiting_rcv_msgs.next, | 3821 | smi_msg = list_entry(intf->waiting_rcv_msgs.next, |
| 3822 | struct ipmi_smi_msg, link); | 3822 | struct ipmi_smi_msg, link); |
| 3823 | list_del(&smi_msg->link); | ||
| 3823 | if (!run_to_completion) | 3824 | if (!run_to_completion) |
| 3824 | spin_unlock_irqrestore(&intf->waiting_rcv_msgs_lock, | 3825 | spin_unlock_irqrestore(&intf->waiting_rcv_msgs_lock, |
| 3825 | flags); | 3826 | flags); |
| @@ -3829,11 +3830,14 @@ static void handle_new_recv_msgs(ipmi_smi_t intf) | |||
| 3829 | if (rv > 0) { | 3830 | if (rv > 0) { |
| 3830 | /* | 3831 | /* |
| 3831 | * To preserve message order, quit if we | 3832 | * To preserve message order, quit if we |
| 3832 | * can't handle a message. | 3833 | * can't handle a message. Add the message |
| 3834 | * back at the head, this is safe because this | ||
| 3835 | * tasklet is the only thing that pulls the | ||
| 3836 | * messages. | ||
| 3833 | */ | 3837 | */ |
| 3838 | list_add(&smi_msg->link, &intf->waiting_rcv_msgs); | ||
| 3834 | break; | 3839 | break; |
| 3835 | } else { | 3840 | } else { |
| 3836 | list_del(&smi_msg->link); | ||
| 3837 | if (rv == 0) | 3841 | if (rv == 0) |
| 3838 | /* Message handled */ | 3842 | /* Message handled */ |
| 3839 | ipmi_free_smi_msg(smi_msg); | 3843 | ipmi_free_smi_msg(smi_msg); |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index ee367e9b7d2e..fe9dc17ea873 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
| @@ -372,26 +372,9 @@ static bool intel_pstate_get_ppc_enable_status(void) | |||
| 372 | return acpi_ppc; | 372 | return acpi_ppc; |
| 373 | } | 373 | } |
| 374 | 374 | ||
| 375 | /* | ||
| 376 | * The max target pstate ratio is a 8 bit value in both PLATFORM_INFO MSR and | ||
| 377 | * in TURBO_RATIO_LIMIT MSR, which pstate driver stores in max_pstate and | ||
| 378 | * max_turbo_pstate fields. The PERF_CTL MSR contains 16 bit value for P state | ||
| 379 | * ratio, out of it only high 8 bits are used. For example 0x1700 is setting | ||
| 380 | * target ratio 0x17. The _PSS control value stores in a format which can be | ||
| 381 | * directly written to PERF_CTL MSR. But in intel_pstate driver this shift | ||
| 382 | * occurs during write to PERF_CTL (E.g. for cores core_set_pstate()). | ||
| 383 | * This function converts the _PSS control value to intel pstate driver format | ||
| 384 | * for comparison and assignment. | ||
| 385 | */ | ||
| 386 | static int convert_to_native_pstate_format(struct cpudata *cpu, int index) | ||
| 387 | { | ||
| 388 | return cpu->acpi_perf_data.states[index].control >> 8; | ||
| 389 | } | ||
| 390 | |||
| 391 | static void intel_pstate_init_acpi_perf_limits(struct cpufreq_policy *policy) | 375 | static void intel_pstate_init_acpi_perf_limits(struct cpufreq_policy *policy) |
| 392 | { | 376 | { |
| 393 | struct cpudata *cpu; | 377 | struct cpudata *cpu; |
| 394 | int turbo_pss_ctl; | ||
| 395 | int ret; | 378 | int ret; |
| 396 | int i; | 379 | int i; |
| 397 | 380 | ||
| @@ -441,11 +424,10 @@ static void intel_pstate_init_acpi_perf_limits(struct cpufreq_policy *policy) | |||
| 441 | * max frequency, which will cause a reduced performance as | 424 | * max frequency, which will cause a reduced performance as |
| 442 | * this driver uses real max turbo frequency as the max | 425 | * this driver uses real max turbo frequency as the max |
| 443 | * frequency. So correct this frequency in _PSS table to | 426 | * frequency. So correct this frequency in _PSS table to |
| 444 | * correct max turbo frequency based on the turbo ratio. | 427 | * correct max turbo frequency based on the turbo state. |
| 445 | * Also need to convert to MHz as _PSS freq is in MHz. | 428 | * Also need to convert to MHz as _PSS freq is in MHz. |
| 446 | */ | 429 | */ |
| 447 | turbo_pss_ctl = convert_to_native_pstate_format(cpu, 0); | 430 | if (!limits->turbo_disabled) |
| 448 | if (turbo_pss_ctl > cpu->pstate.max_pstate) | ||
| 449 | cpu->acpi_perf_data.states[0].core_frequency = | 431 | cpu->acpi_perf_data.states[0].core_frequency = |
| 450 | policy->cpuinfo.max_freq / 1000; | 432 | policy->cpuinfo.max_freq / 1000; |
| 451 | cpu->valid_pss_table = true; | 433 | cpu->valid_pss_table = true; |
diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c index 8b3226dca1d9..caff46c0e214 100644 --- a/drivers/extcon/extcon-palmas.c +++ b/drivers/extcon/extcon-palmas.c | |||
| @@ -360,6 +360,8 @@ static int palmas_usb_probe(struct platform_device *pdev) | |||
| 360 | 360 | ||
| 361 | palmas_enable_irq(palmas_usb); | 361 | palmas_enable_irq(palmas_usb); |
| 362 | /* perform initial detection */ | 362 | /* perform initial detection */ |
| 363 | if (palmas_usb->enable_gpio_vbus_detection) | ||
| 364 | palmas_vbus_irq_handler(palmas_usb->gpio_vbus_irq, palmas_usb); | ||
| 363 | palmas_gpio_id_detect(&palmas_usb->wq_detectid.work); | 365 | palmas_gpio_id_detect(&palmas_usb->wq_detectid.work); |
| 364 | device_set_wakeup_capable(&pdev->dev, true); | 366 | device_set_wakeup_capable(&pdev->dev, true); |
| 365 | return 0; | 367 | return 0; |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index a116609b1914..cebcb405812e 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
| @@ -531,7 +531,7 @@ menu "Port-mapped I/O GPIO drivers" | |||
| 531 | 531 | ||
| 532 | config GPIO_104_DIO_48E | 532 | config GPIO_104_DIO_48E |
| 533 | tristate "ACCES 104-DIO-48E GPIO support" | 533 | tristate "ACCES 104-DIO-48E GPIO support" |
| 534 | depends on ISA | 534 | depends on ISA_BUS_API |
| 535 | select GPIOLIB_IRQCHIP | 535 | select GPIOLIB_IRQCHIP |
| 536 | help | 536 | help |
| 537 | Enables GPIO support for the ACCES 104-DIO-48E series (104-DIO-48E, | 537 | Enables GPIO support for the ACCES 104-DIO-48E series (104-DIO-48E, |
| @@ -541,7 +541,7 @@ config GPIO_104_DIO_48E | |||
| 541 | 541 | ||
| 542 | config GPIO_104_IDIO_16 | 542 | config GPIO_104_IDIO_16 |
| 543 | tristate "ACCES 104-IDIO-16 GPIO support" | 543 | tristate "ACCES 104-IDIO-16 GPIO support" |
| 544 | depends on ISA | 544 | depends on ISA_BUS_API |
| 545 | select GPIOLIB_IRQCHIP | 545 | select GPIOLIB_IRQCHIP |
| 546 | help | 546 | help |
| 547 | Enables GPIO support for the ACCES 104-IDIO-16 family (104-IDIO-16, | 547 | Enables GPIO support for the ACCES 104-IDIO-16 family (104-IDIO-16, |
| @@ -552,7 +552,7 @@ config GPIO_104_IDIO_16 | |||
| 552 | 552 | ||
| 553 | config GPIO_104_IDI_48 | 553 | config GPIO_104_IDI_48 |
| 554 | tristate "ACCES 104-IDI-48 GPIO support" | 554 | tristate "ACCES 104-IDI-48 GPIO support" |
| 555 | depends on ISA | 555 | depends on ISA_BUS_API |
| 556 | select GPIOLIB_IRQCHIP | 556 | select GPIOLIB_IRQCHIP |
| 557 | help | 557 | help |
| 558 | Enables GPIO support for the ACCES 104-IDI-48 family (104-IDI-48A, | 558 | Enables GPIO support for the ACCES 104-IDI-48 family (104-IDI-48A, |
| @@ -628,7 +628,7 @@ config GPIO_TS5500 | |||
| 628 | 628 | ||
| 629 | config GPIO_WS16C48 | 629 | config GPIO_WS16C48 |
| 630 | tristate "WinSystems WS16C48 GPIO support" | 630 | tristate "WinSystems WS16C48 GPIO support" |
| 631 | depends on ISA | 631 | depends on ISA_BUS_API |
| 632 | select GPIOLIB_IRQCHIP | 632 | select GPIOLIB_IRQCHIP |
| 633 | help | 633 | help |
| 634 | Enables GPIO support for the WinSystems WS16C48. The base port | 634 | Enables GPIO support for the WinSystems WS16C48. The base port |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 01c36b8d6222..e055d5be1c3c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
| @@ -799,7 +799,6 @@ struct amdgpu_ring { | |||
| 799 | unsigned cond_exe_offs; | 799 | unsigned cond_exe_offs; |
| 800 | u64 cond_exe_gpu_addr; | 800 | u64 cond_exe_gpu_addr; |
| 801 | volatile u32 *cond_exe_cpu_addr; | 801 | volatile u32 *cond_exe_cpu_addr; |
| 802 | int vmid; | ||
| 803 | }; | 802 | }; |
| 804 | 803 | ||
| 805 | /* | 804 | /* |
| @@ -937,8 +936,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, | |||
| 937 | unsigned vm_id, uint64_t pd_addr, | 936 | unsigned vm_id, uint64_t pd_addr, |
| 938 | uint32_t gds_base, uint32_t gds_size, | 937 | uint32_t gds_base, uint32_t gds_size, |
| 939 | uint32_t gws_base, uint32_t gws_size, | 938 | uint32_t gws_base, uint32_t gws_size, |
| 940 | uint32_t oa_base, uint32_t oa_size, | 939 | uint32_t oa_base, uint32_t oa_size); |
| 941 | bool vmid_switch); | ||
| 942 | void amdgpu_vm_reset_id(struct amdgpu_device *adev, unsigned vm_id); | 940 | void amdgpu_vm_reset_id(struct amdgpu_device *adev, unsigned vm_id); |
| 943 | uint64_t amdgpu_vm_map_gart(const dma_addr_t *pages_addr, uint64_t addr); | 941 | uint64_t amdgpu_vm_map_gart(const dma_addr_t *pages_addr, uint64_t addr); |
| 944 | int amdgpu_vm_update_page_directory(struct amdgpu_device *adev, | 942 | int amdgpu_vm_update_page_directory(struct amdgpu_device *adev, |
| @@ -1822,6 +1820,8 @@ struct amdgpu_asic_funcs { | |||
| 1822 | /* MM block clocks */ | 1820 | /* MM block clocks */ |
| 1823 | int (*set_uvd_clocks)(struct amdgpu_device *adev, u32 vclk, u32 dclk); | 1821 | int (*set_uvd_clocks)(struct amdgpu_device *adev, u32 vclk, u32 dclk); |
| 1824 | int (*set_vce_clocks)(struct amdgpu_device *adev, u32 evclk, u32 ecclk); | 1822 | int (*set_vce_clocks)(struct amdgpu_device *adev, u32 evclk, u32 ecclk); |
| 1823 | /* query virtual capabilities */ | ||
| 1824 | u32 (*get_virtual_caps)(struct amdgpu_device *adev); | ||
| 1825 | }; | 1825 | }; |
| 1826 | 1826 | ||
| 1827 | /* | 1827 | /* |
| @@ -1916,8 +1916,12 @@ void amdgpu_cgs_destroy_device(struct cgs_device *cgs_device); | |||
| 1916 | 1916 | ||
| 1917 | 1917 | ||
| 1918 | /* GPU virtualization */ | 1918 | /* GPU virtualization */ |
| 1919 | #define AMDGPU_VIRT_CAPS_SRIOV_EN (1 << 0) | ||
| 1920 | #define AMDGPU_VIRT_CAPS_IS_VF (1 << 1) | ||
| 1919 | struct amdgpu_virtualization { | 1921 | struct amdgpu_virtualization { |
| 1920 | bool supports_sr_iov; | 1922 | bool supports_sr_iov; |
| 1923 | bool is_virtual; | ||
| 1924 | u32 caps; | ||
| 1921 | }; | 1925 | }; |
| 1922 | 1926 | ||
| 1923 | /* | 1927 | /* |
| @@ -2206,6 +2210,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring) | |||
| 2206 | #define amdgpu_asic_get_xclk(adev) (adev)->asic_funcs->get_xclk((adev)) | 2210 | #define amdgpu_asic_get_xclk(adev) (adev)->asic_funcs->get_xclk((adev)) |
| 2207 | #define amdgpu_asic_set_uvd_clocks(adev, v, d) (adev)->asic_funcs->set_uvd_clocks((adev), (v), (d)) | 2211 | #define amdgpu_asic_set_uvd_clocks(adev, v, d) (adev)->asic_funcs->set_uvd_clocks((adev), (v), (d)) |
| 2208 | #define amdgpu_asic_set_vce_clocks(adev, ev, ec) (adev)->asic_funcs->set_vce_clocks((adev), (ev), (ec)) | 2212 | #define amdgpu_asic_set_vce_clocks(adev, ev, ec) (adev)->asic_funcs->set_vce_clocks((adev), (ev), (ec)) |
| 2213 | #define amdgpu_asic_get_virtual_caps(adev) ((adev)->asic_funcs->get_virtual_caps((adev))) | ||
| 2209 | #define amdgpu_asic_get_gpu_clock_counter(adev) (adev)->asic_funcs->get_gpu_clock_counter((adev)) | 2214 | #define amdgpu_asic_get_gpu_clock_counter(adev) (adev)->asic_funcs->get_gpu_clock_counter((adev)) |
| 2210 | #define amdgpu_asic_read_disabled_bios(adev) (adev)->asic_funcs->read_disabled_bios((adev)) | 2215 | #define amdgpu_asic_read_disabled_bios(adev) (adev)->asic_funcs->read_disabled_bios((adev)) |
| 2211 | #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l)) | 2216 | #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l)) |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 964f31404f17..66482b429458 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
| @@ -1385,6 +1385,15 @@ static int amdgpu_resume(struct amdgpu_device *adev) | |||
| 1385 | return 0; | 1385 | return 0; |
| 1386 | } | 1386 | } |
| 1387 | 1387 | ||
| 1388 | static bool amdgpu_device_is_virtual(void) | ||
| 1389 | { | ||
| 1390 | #ifdef CONFIG_X86 | ||
| 1391 | return boot_cpu_has(X86_FEATURE_HYPERVISOR); | ||
| 1392 | #else | ||
| 1393 | return false; | ||
| 1394 | #endif | ||
| 1395 | } | ||
| 1396 | |||
| 1388 | /** | 1397 | /** |
| 1389 | * amdgpu_device_init - initialize the driver | 1398 | * amdgpu_device_init - initialize the driver |
| 1390 | * | 1399 | * |
| @@ -1519,8 +1528,14 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
| 1519 | adev->virtualization.supports_sr_iov = | 1528 | adev->virtualization.supports_sr_iov = |
| 1520 | amdgpu_atombios_has_gpu_virtualization_table(adev); | 1529 | amdgpu_atombios_has_gpu_virtualization_table(adev); |
| 1521 | 1530 | ||
| 1531 | /* Check if we are executing in a virtualized environment */ | ||
| 1532 | adev->virtualization.is_virtual = amdgpu_device_is_virtual(); | ||
| 1533 | adev->virtualization.caps = amdgpu_asic_get_virtual_caps(adev); | ||
| 1534 | |||
| 1522 | /* Post card if necessary */ | 1535 | /* Post card if necessary */ |
| 1523 | if (!amdgpu_card_posted(adev)) { | 1536 | if (!amdgpu_card_posted(adev) || |
| 1537 | (adev->virtualization.is_virtual && | ||
| 1538 | !adev->virtualization.caps & AMDGPU_VIRT_CAPS_SRIOV_EN)) { | ||
| 1524 | if (!adev->bios) { | 1539 | if (!adev->bios) { |
| 1525 | dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n"); | 1540 | dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n"); |
| 1526 | return -EINVAL; | 1541 | return -EINVAL; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c index 7a0b1e50f293..34e35423b78e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | |||
| @@ -122,7 +122,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
| 122 | bool skip_preamble, need_ctx_switch; | 122 | bool skip_preamble, need_ctx_switch; |
| 123 | unsigned patch_offset = ~0; | 123 | unsigned patch_offset = ~0; |
| 124 | struct amdgpu_vm *vm; | 124 | struct amdgpu_vm *vm; |
| 125 | int vmid = 0, old_vmid = ring->vmid; | ||
| 126 | struct fence *hwf; | 125 | struct fence *hwf; |
| 127 | uint64_t ctx; | 126 | uint64_t ctx; |
| 128 | 127 | ||
| @@ -136,11 +135,9 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
| 136 | if (job) { | 135 | if (job) { |
| 137 | vm = job->vm; | 136 | vm = job->vm; |
| 138 | ctx = job->ctx; | 137 | ctx = job->ctx; |
| 139 | vmid = job->vm_id; | ||
| 140 | } else { | 138 | } else { |
| 141 | vm = NULL; | 139 | vm = NULL; |
| 142 | ctx = 0; | 140 | ctx = 0; |
| 143 | vmid = 0; | ||
| 144 | } | 141 | } |
| 145 | 142 | ||
| 146 | if (!ring->ready) { | 143 | if (!ring->ready) { |
| @@ -166,8 +163,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
| 166 | r = amdgpu_vm_flush(ring, job->vm_id, job->vm_pd_addr, | 163 | r = amdgpu_vm_flush(ring, job->vm_id, job->vm_pd_addr, |
| 167 | job->gds_base, job->gds_size, | 164 | job->gds_base, job->gds_size, |
| 168 | job->gws_base, job->gws_size, | 165 | job->gws_base, job->gws_size, |
| 169 | job->oa_base, job->oa_size, | 166 | job->oa_base, job->oa_size); |
| 170 | (ring->current_ctx == ctx) && (old_vmid != vmid)); | ||
| 171 | if (r) { | 167 | if (r) { |
| 172 | amdgpu_ring_undo(ring); | 168 | amdgpu_ring_undo(ring); |
| 173 | return r; | 169 | return r; |
| @@ -184,6 +180,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
| 184 | need_ctx_switch = ring->current_ctx != ctx; | 180 | need_ctx_switch = ring->current_ctx != ctx; |
| 185 | for (i = 0; i < num_ibs; ++i) { | 181 | for (i = 0; i < num_ibs; ++i) { |
| 186 | ib = &ibs[i]; | 182 | ib = &ibs[i]; |
| 183 | |||
| 187 | /* drop preamble IBs if we don't have a context switch */ | 184 | /* drop preamble IBs if we don't have a context switch */ |
| 188 | if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) && skip_preamble) | 185 | if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) && skip_preamble) |
| 189 | continue; | 186 | continue; |
| @@ -191,7 +188,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
| 191 | amdgpu_ring_emit_ib(ring, ib, job ? job->vm_id : 0, | 188 | amdgpu_ring_emit_ib(ring, ib, job ? job->vm_id : 0, |
| 192 | need_ctx_switch); | 189 | need_ctx_switch); |
| 193 | need_ctx_switch = false; | 190 | need_ctx_switch = false; |
| 194 | ring->vmid = vmid; | ||
| 195 | } | 191 | } |
| 196 | 192 | ||
| 197 | if (ring->funcs->emit_hdp_invalidate) | 193 | if (ring->funcs->emit_hdp_invalidate) |
| @@ -202,7 +198,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
| 202 | dev_err(adev->dev, "failed to emit fence (%d)\n", r); | 198 | dev_err(adev->dev, "failed to emit fence (%d)\n", r); |
| 203 | if (job && job->vm_id) | 199 | if (job && job->vm_id) |
| 204 | amdgpu_vm_reset_id(adev, job->vm_id); | 200 | amdgpu_vm_reset_id(adev, job->vm_id); |
| 205 | ring->vmid = old_vmid; | ||
| 206 | amdgpu_ring_undo(ring); | 201 | amdgpu_ring_undo(ring); |
| 207 | return r; | 202 | return r; |
| 208 | } | 203 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 62a4c127620f..9f36ed30ba11 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
| @@ -298,8 +298,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, | |||
| 298 | unsigned vm_id, uint64_t pd_addr, | 298 | unsigned vm_id, uint64_t pd_addr, |
| 299 | uint32_t gds_base, uint32_t gds_size, | 299 | uint32_t gds_base, uint32_t gds_size, |
| 300 | uint32_t gws_base, uint32_t gws_size, | 300 | uint32_t gws_base, uint32_t gws_size, |
| 301 | uint32_t oa_base, uint32_t oa_size, | 301 | uint32_t oa_base, uint32_t oa_size) |
| 302 | bool vmid_switch) | ||
| 303 | { | 302 | { |
| 304 | struct amdgpu_device *adev = ring->adev; | 303 | struct amdgpu_device *adev = ring->adev; |
| 305 | struct amdgpu_vm_id *id = &adev->vm_manager.ids[vm_id]; | 304 | struct amdgpu_vm_id *id = &adev->vm_manager.ids[vm_id]; |
| @@ -313,7 +312,8 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, | |||
| 313 | int r; | 312 | int r; |
| 314 | 313 | ||
| 315 | if (ring->funcs->emit_pipeline_sync && ( | 314 | if (ring->funcs->emit_pipeline_sync && ( |
| 316 | pd_addr != AMDGPU_VM_NO_FLUSH || gds_switch_needed || vmid_switch)) | 315 | pd_addr != AMDGPU_VM_NO_FLUSH || gds_switch_needed || |
| 316 | ring->type == AMDGPU_RING_TYPE_COMPUTE)) | ||
| 317 | amdgpu_ring_emit_pipeline_sync(ring); | 317 | amdgpu_ring_emit_pipeline_sync(ring); |
| 318 | 318 | ||
| 319 | if (ring->funcs->emit_vm_flush && | 319 | if (ring->funcs->emit_vm_flush && |
diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c index 07bc795a4ca9..910431808542 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik.c +++ b/drivers/gpu/drm/amd/amdgpu/cik.c | |||
| @@ -962,6 +962,12 @@ static bool cik_read_bios_from_rom(struct amdgpu_device *adev, | |||
| 962 | return true; | 962 | return true; |
| 963 | } | 963 | } |
| 964 | 964 | ||
| 965 | static u32 cik_get_virtual_caps(struct amdgpu_device *adev) | ||
| 966 | { | ||
| 967 | /* CIK does not support SR-IOV */ | ||
| 968 | return 0; | ||
| 969 | } | ||
| 970 | |||
| 965 | static const struct amdgpu_allowed_register_entry cik_allowed_read_registers[] = { | 971 | static const struct amdgpu_allowed_register_entry cik_allowed_read_registers[] = { |
| 966 | {mmGRBM_STATUS, false}, | 972 | {mmGRBM_STATUS, false}, |
| 967 | {mmGB_ADDR_CONFIG, false}, | 973 | {mmGB_ADDR_CONFIG, false}, |
| @@ -2007,6 +2013,7 @@ static const struct amdgpu_asic_funcs cik_asic_funcs = | |||
| 2007 | .get_xclk = &cik_get_xclk, | 2013 | .get_xclk = &cik_get_xclk, |
| 2008 | .set_uvd_clocks = &cik_set_uvd_clocks, | 2014 | .set_uvd_clocks = &cik_set_uvd_clocks, |
| 2009 | .set_vce_clocks = &cik_set_vce_clocks, | 2015 | .set_vce_clocks = &cik_set_vce_clocks, |
| 2016 | .get_virtual_caps = &cik_get_virtual_caps, | ||
| 2010 | /* these should be moved to their own ip modules */ | 2017 | /* these should be moved to their own ip modules */ |
| 2011 | .get_gpu_clock_counter = &gfx_v7_0_get_gpu_clock_counter, | 2018 | .get_gpu_clock_counter = &gfx_v7_0_get_gpu_clock_counter, |
| 2012 | .wait_for_mc_idle = &gmc_v7_0_mc_wait_for_idle, | 2019 | .wait_for_mc_idle = &gmc_v7_0_mc_wait_for_idle, |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c index 8c6ad1e72f02..fc8ff4d3ccf8 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | |||
| @@ -4833,7 +4833,7 @@ static int gfx_v7_0_eop_irq(struct amdgpu_device *adev, | |||
| 4833 | case 2: | 4833 | case 2: |
| 4834 | for (i = 0; i < adev->gfx.num_compute_rings; i++) { | 4834 | for (i = 0; i < adev->gfx.num_compute_rings; i++) { |
| 4835 | ring = &adev->gfx.compute_ring[i]; | 4835 | ring = &adev->gfx.compute_ring[i]; |
| 4836 | if ((ring->me == me_id) & (ring->pipe == pipe_id)) | 4836 | if ((ring->me == me_id) && (ring->pipe == pipe_id)) |
| 4837 | amdgpu_fence_process(ring); | 4837 | amdgpu_fence_process(ring); |
| 4838 | } | 4838 | } |
| 4839 | break; | 4839 | break; |
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c index 2c88d0b66cf3..a65c96029476 100644 --- a/drivers/gpu/drm/amd/amdgpu/vi.c +++ b/drivers/gpu/drm/amd/amdgpu/vi.c | |||
| @@ -421,6 +421,20 @@ static bool vi_read_bios_from_rom(struct amdgpu_device *adev, | |||
| 421 | return true; | 421 | return true; |
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | static u32 vi_get_virtual_caps(struct amdgpu_device *adev) | ||
| 425 | { | ||
| 426 | u32 caps = 0; | ||
| 427 | u32 reg = RREG32(mmBIF_IOV_FUNC_IDENTIFIER); | ||
| 428 | |||
| 429 | if (REG_GET_FIELD(reg, BIF_IOV_FUNC_IDENTIFIER, IOV_ENABLE)) | ||
| 430 | caps |= AMDGPU_VIRT_CAPS_SRIOV_EN; | ||
| 431 | |||
| 432 | if (REG_GET_FIELD(reg, BIF_IOV_FUNC_IDENTIFIER, FUNC_IDENTIFIER)) | ||
| 433 | caps |= AMDGPU_VIRT_CAPS_IS_VF; | ||
| 434 | |||
| 435 | return caps; | ||
| 436 | } | ||
| 437 | |||
| 424 | static const struct amdgpu_allowed_register_entry tonga_allowed_read_registers[] = { | 438 | static const struct amdgpu_allowed_register_entry tonga_allowed_read_registers[] = { |
| 425 | {mmGB_MACROTILE_MODE7, true}, | 439 | {mmGB_MACROTILE_MODE7, true}, |
| 426 | }; | 440 | }; |
| @@ -1118,6 +1132,7 @@ static const struct amdgpu_asic_funcs vi_asic_funcs = | |||
| 1118 | .get_xclk = &vi_get_xclk, | 1132 | .get_xclk = &vi_get_xclk, |
| 1119 | .set_uvd_clocks = &vi_set_uvd_clocks, | 1133 | .set_uvd_clocks = &vi_set_uvd_clocks, |
| 1120 | .set_vce_clocks = &vi_set_vce_clocks, | 1134 | .set_vce_clocks = &vi_set_vce_clocks, |
| 1135 | .get_virtual_caps = &vi_get_virtual_caps, | ||
| 1121 | /* these should be moved to their own ip modules */ | 1136 | /* these should be moved to their own ip modules */ |
| 1122 | .get_gpu_clock_counter = &gfx_v8_0_get_gpu_clock_counter, | 1137 | .get_gpu_clock_counter = &gfx_v8_0_get_gpu_clock_counter, |
| 1123 | .wait_for_mc_idle = &gmc_v8_0_mc_wait_for_idle, | 1138 | .wait_for_mc_idle = &gmc_v8_0_mc_wait_for_idle, |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c index ac005796b71c..7708d90b9da9 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c | |||
| @@ -242,13 +242,19 @@ static void kfd_process_notifier_release(struct mmu_notifier *mn, | |||
| 242 | pqm_uninit(&p->pqm); | 242 | pqm_uninit(&p->pqm); |
| 243 | 243 | ||
| 244 | /* Iterate over all process device data structure and check | 244 | /* Iterate over all process device data structure and check |
| 245 | * if we should reset all wavefronts */ | 245 | * if we should delete debug managers and reset all wavefronts |
| 246 | list_for_each_entry(pdd, &p->per_device_data, per_device_list) | 246 | */ |
| 247 | list_for_each_entry(pdd, &p->per_device_data, per_device_list) { | ||
| 248 | if ((pdd->dev->dbgmgr) && | ||
| 249 | (pdd->dev->dbgmgr->pasid == p->pasid)) | ||
| 250 | kfd_dbgmgr_destroy(pdd->dev->dbgmgr); | ||
| 251 | |||
| 247 | if (pdd->reset_wavefronts) { | 252 | if (pdd->reset_wavefronts) { |
| 248 | pr_warn("amdkfd: Resetting all wave fronts\n"); | 253 | pr_warn("amdkfd: Resetting all wave fronts\n"); |
| 249 | dbgdev_wave_reset_wavefronts(pdd->dev, p); | 254 | dbgdev_wave_reset_wavefronts(pdd->dev, p); |
| 250 | pdd->reset_wavefronts = false; | 255 | pdd->reset_wavefronts = false; |
| 251 | } | 256 | } |
| 257 | } | ||
| 252 | 258 | ||
| 253 | mutex_unlock(&p->mutex); | 259 | mutex_unlock(&p->mutex); |
| 254 | 260 | ||
| @@ -404,42 +410,52 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid) | |||
| 404 | 410 | ||
| 405 | idx = srcu_read_lock(&kfd_processes_srcu); | 411 | idx = srcu_read_lock(&kfd_processes_srcu); |
| 406 | 412 | ||
| 413 | /* | ||
| 414 | * Look for the process that matches the pasid. If there is no such | ||
| 415 | * process, we either released it in amdkfd's own notifier, or there | ||
| 416 | * is a bug. Unfortunately, there is no way to tell... | ||
| 417 | */ | ||
| 407 | hash_for_each_rcu(kfd_processes_table, i, p, kfd_processes) | 418 | hash_for_each_rcu(kfd_processes_table, i, p, kfd_processes) |
| 408 | if (p->pasid == pasid) | 419 | if (p->pasid == pasid) { |
| 409 | break; | ||
| 410 | 420 | ||
| 411 | srcu_read_unlock(&kfd_processes_srcu, idx); | 421 | srcu_read_unlock(&kfd_processes_srcu, idx); |
| 412 | 422 | ||
| 413 | BUG_ON(p->pasid != pasid); | 423 | pr_debug("Unbinding process %d from IOMMU\n", pasid); |
| 414 | 424 | ||
| 415 | mutex_lock(&p->mutex); | 425 | mutex_lock(&p->mutex); |
| 416 | 426 | ||
| 417 | if ((dev->dbgmgr) && (dev->dbgmgr->pasid == p->pasid)) | 427 | if ((dev->dbgmgr) && (dev->dbgmgr->pasid == p->pasid)) |
| 418 | kfd_dbgmgr_destroy(dev->dbgmgr); | 428 | kfd_dbgmgr_destroy(dev->dbgmgr); |
| 419 | 429 | ||
| 420 | pqm_uninit(&p->pqm); | 430 | pqm_uninit(&p->pqm); |
| 421 | 431 | ||
| 422 | pdd = kfd_get_process_device_data(dev, p); | 432 | pdd = kfd_get_process_device_data(dev, p); |
| 423 | 433 | ||
| 424 | if (!pdd) { | 434 | if (!pdd) { |
| 425 | mutex_unlock(&p->mutex); | 435 | mutex_unlock(&p->mutex); |
| 426 | return; | 436 | return; |
| 427 | } | 437 | } |
| 428 | 438 | ||
| 429 | if (pdd->reset_wavefronts) { | 439 | if (pdd->reset_wavefronts) { |
| 430 | dbgdev_wave_reset_wavefronts(pdd->dev, p); | 440 | dbgdev_wave_reset_wavefronts(pdd->dev, p); |
| 431 | pdd->reset_wavefronts = false; | 441 | pdd->reset_wavefronts = false; |
| 432 | } | 442 | } |
| 433 | 443 | ||
| 434 | /* | 444 | /* |
| 435 | * Just mark pdd as unbound, because we still need it to call | 445 | * Just mark pdd as unbound, because we still need it |
| 436 | * amd_iommu_unbind_pasid() in when the process exits. | 446 | * to call amd_iommu_unbind_pasid() in when the |
| 437 | * We don't call amd_iommu_unbind_pasid() here | 447 | * process exits. |
| 438 | * because the IOMMU called us. | 448 | * We don't call amd_iommu_unbind_pasid() here |
| 439 | */ | 449 | * because the IOMMU called us. |
| 440 | pdd->bound = false; | 450 | */ |
| 451 | pdd->bound = false; | ||
| 441 | 452 | ||
| 442 | mutex_unlock(&p->mutex); | 453 | mutex_unlock(&p->mutex); |
| 454 | |||
| 455 | return; | ||
| 456 | } | ||
| 457 | |||
| 458 | srcu_read_unlock(&kfd_processes_srcu, idx); | ||
| 443 | } | 459 | } |
| 444 | 460 | ||
| 445 | struct kfd_process_device *kfd_get_first_process_device_data(struct kfd_process *p) | 461 | struct kfd_process_device *kfd_get_first_process_device_data(struct kfd_process *p) |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c index 74909e72a009..884c96f50c3d 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c | |||
| @@ -666,7 +666,7 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, | |||
| 666 | dev->node_props.simd_count); | 666 | dev->node_props.simd_count); |
| 667 | 667 | ||
| 668 | if (dev->mem_bank_count < dev->node_props.mem_banks_count) { | 668 | if (dev->mem_bank_count < dev->node_props.mem_banks_count) { |
| 669 | pr_warn("kfd: mem_banks_count truncated from %d to %d\n", | 669 | pr_info_once("kfd: mem_banks_count truncated from %d to %d\n", |
| 670 | dev->node_props.mem_banks_count, | 670 | dev->node_props.mem_banks_count, |
| 671 | dev->mem_bank_count); | 671 | dev->mem_bank_count); |
| 672 | sysfs_show_32bit_prop(buffer, "mem_banks_count", | 672 | sysfs_show_32bit_prop(buffer, "mem_banks_count", |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h index 347fef127ce9..2930a3355948 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h | |||
| @@ -39,6 +39,7 @@ struct phm_ppt_v1_clock_voltage_dependency_record { | |||
| 39 | uint8_t phases; | 39 | uint8_t phases; |
| 40 | uint8_t cks_enable; | 40 | uint8_t cks_enable; |
| 41 | uint8_t cks_voffset; | 41 | uint8_t cks_voffset; |
| 42 | uint32_t sclk_offset; | ||
| 42 | }; | 43 | }; |
| 43 | 44 | ||
| 44 | typedef struct phm_ppt_v1_clock_voltage_dependency_record phm_ppt_v1_clock_voltage_dependency_record; | 45 | typedef struct phm_ppt_v1_clock_voltage_dependency_record phm_ppt_v1_clock_voltage_dependency_record; |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c index aa6be033f21b..1400bc420881 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | |||
| @@ -999,7 +999,7 @@ static int polaris10_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr, | |||
| 999 | vddci = phm_find_closest_vddci(&(data->vddci_voltage_table), | 999 | vddci = phm_find_closest_vddci(&(data->vddci_voltage_table), |
| 1000 | (dep_table->entries[i].vddc - | 1000 | (dep_table->entries[i].vddc - |
| 1001 | (uint16_t)data->vddc_vddci_delta)); | 1001 | (uint16_t)data->vddc_vddci_delta)); |
| 1002 | *voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT; | 1002 | *voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT; |
| 1003 | } | 1003 | } |
| 1004 | 1004 | ||
| 1005 | if (POLARIS10_VOLTAGE_CONTROL_NONE == data->mvdd_control) | 1005 | if (POLARIS10_VOLTAGE_CONTROL_NONE == data->mvdd_control) |
| @@ -3520,10 +3520,11 @@ static int polaris10_get_pp_table_entry_callback_func(struct pp_hwmgr *hwmgr, | |||
| 3520 | ATOM_Tonga_State *state_entry = (ATOM_Tonga_State *)state; | 3520 | ATOM_Tonga_State *state_entry = (ATOM_Tonga_State *)state; |
| 3521 | ATOM_Tonga_POWERPLAYTABLE *powerplay_table = | 3521 | ATOM_Tonga_POWERPLAYTABLE *powerplay_table = |
| 3522 | (ATOM_Tonga_POWERPLAYTABLE *)pp_table; | 3522 | (ATOM_Tonga_POWERPLAYTABLE *)pp_table; |
| 3523 | ATOM_Tonga_SCLK_Dependency_Table *sclk_dep_table = | 3523 | PPTable_Generic_SubTable_Header *sclk_dep_table = |
| 3524 | (ATOM_Tonga_SCLK_Dependency_Table *) | 3524 | (PPTable_Generic_SubTable_Header *) |
| 3525 | (((unsigned long)powerplay_table) + | 3525 | (((unsigned long)powerplay_table) + |
| 3526 | le16_to_cpu(powerplay_table->usSclkDependencyTableOffset)); | 3526 | le16_to_cpu(powerplay_table->usSclkDependencyTableOffset)); |
| 3527 | |||
| 3527 | ATOM_Tonga_MCLK_Dependency_Table *mclk_dep_table = | 3528 | ATOM_Tonga_MCLK_Dependency_Table *mclk_dep_table = |
| 3528 | (ATOM_Tonga_MCLK_Dependency_Table *) | 3529 | (ATOM_Tonga_MCLK_Dependency_Table *) |
| 3529 | (((unsigned long)powerplay_table) + | 3530 | (((unsigned long)powerplay_table) + |
| @@ -3575,7 +3576,11 @@ static int polaris10_get_pp_table_entry_callback_func(struct pp_hwmgr *hwmgr, | |||
| 3575 | /* Performance levels are arranged from low to high. */ | 3576 | /* Performance levels are arranged from low to high. */ |
| 3576 | performance_level->memory_clock = mclk_dep_table->entries | 3577 | performance_level->memory_clock = mclk_dep_table->entries |
| 3577 | [state_entry->ucMemoryClockIndexLow].ulMclk; | 3578 | [state_entry->ucMemoryClockIndexLow].ulMclk; |
| 3578 | performance_level->engine_clock = sclk_dep_table->entries | 3579 | if (sclk_dep_table->ucRevId == 0) |
| 3580 | performance_level->engine_clock = ((ATOM_Tonga_SCLK_Dependency_Table *)sclk_dep_table)->entries | ||
| 3581 | [state_entry->ucEngineClockIndexLow].ulSclk; | ||
| 3582 | else if (sclk_dep_table->ucRevId == 1) | ||
| 3583 | performance_level->engine_clock = ((ATOM_Polaris_SCLK_Dependency_Table *)sclk_dep_table)->entries | ||
| 3579 | [state_entry->ucEngineClockIndexLow].ulSclk; | 3584 | [state_entry->ucEngineClockIndexLow].ulSclk; |
| 3580 | performance_level->pcie_gen = get_pcie_gen_support(data->pcie_gen_cap, | 3585 | performance_level->pcie_gen = get_pcie_gen_support(data->pcie_gen_cap, |
| 3581 | state_entry->ucPCIEGenLow); | 3586 | state_entry->ucPCIEGenLow); |
| @@ -3586,8 +3591,14 @@ static int polaris10_get_pp_table_entry_callback_func(struct pp_hwmgr *hwmgr, | |||
| 3586 | [polaris10_power_state->performance_level_count++]); | 3591 | [polaris10_power_state->performance_level_count++]); |
| 3587 | performance_level->memory_clock = mclk_dep_table->entries | 3592 | performance_level->memory_clock = mclk_dep_table->entries |
| 3588 | [state_entry->ucMemoryClockIndexHigh].ulMclk; | 3593 | [state_entry->ucMemoryClockIndexHigh].ulMclk; |
| 3589 | performance_level->engine_clock = sclk_dep_table->entries | 3594 | |
| 3595 | if (sclk_dep_table->ucRevId == 0) | ||
| 3596 | performance_level->engine_clock = ((ATOM_Tonga_SCLK_Dependency_Table *)sclk_dep_table)->entries | ||
| 3590 | [state_entry->ucEngineClockIndexHigh].ulSclk; | 3597 | [state_entry->ucEngineClockIndexHigh].ulSclk; |
| 3598 | else if (sclk_dep_table->ucRevId == 1) | ||
| 3599 | performance_level->engine_clock = ((ATOM_Polaris_SCLK_Dependency_Table *)sclk_dep_table)->entries | ||
| 3600 | [state_entry->ucEngineClockIndexHigh].ulSclk; | ||
| 3601 | |||
| 3591 | performance_level->pcie_gen = get_pcie_gen_support(data->pcie_gen_cap, | 3602 | performance_level->pcie_gen = get_pcie_gen_support(data->pcie_gen_cap, |
| 3592 | state_entry->ucPCIEGenHigh); | 3603 | state_entry->ucPCIEGenHigh); |
| 3593 | performance_level->pcie_lane = get_pcie_lane_support(data->pcie_lane_cap, | 3604 | performance_level->pcie_lane = get_pcie_lane_support(data->pcie_lane_cap, |
| @@ -3645,7 +3656,6 @@ static int polaris10_get_pp_table_entry(struct pp_hwmgr *hwmgr, | |||
| 3645 | switch (state->classification.ui_label) { | 3656 | switch (state->classification.ui_label) { |
| 3646 | case PP_StateUILabel_Performance: | 3657 | case PP_StateUILabel_Performance: |
| 3647 | data->use_pcie_performance_levels = true; | 3658 | data->use_pcie_performance_levels = true; |
| 3648 | |||
| 3649 | for (i = 0; i < ps->performance_level_count; i++) { | 3659 | for (i = 0; i < ps->performance_level_count; i++) { |
| 3650 | if (data->pcie_gen_performance.max < | 3660 | if (data->pcie_gen_performance.max < |
| 3651 | ps->performance_levels[i].pcie_gen) | 3661 | ps->performance_levels[i].pcie_gen) |
| @@ -3661,7 +3671,6 @@ static int polaris10_get_pp_table_entry(struct pp_hwmgr *hwmgr, | |||
| 3661 | ps->performance_levels[i].pcie_lane) | 3671 | ps->performance_levels[i].pcie_lane) |
| 3662 | data->pcie_lane_performance.max = | 3672 | data->pcie_lane_performance.max = |
| 3663 | ps->performance_levels[i].pcie_lane; | 3673 | ps->performance_levels[i].pcie_lane; |
| 3664 | |||
| 3665 | if (data->pcie_lane_performance.min > | 3674 | if (data->pcie_lane_performance.min > |
| 3666 | ps->performance_levels[i].pcie_lane) | 3675 | ps->performance_levels[i].pcie_lane) |
| 3667 | data->pcie_lane_performance.min = | 3676 | data->pcie_lane_performance.min = |
| @@ -4187,12 +4196,9 @@ int polaris10_update_samu_dpm(struct pp_hwmgr *hwmgr, bool bgate) | |||
| 4187 | { | 4196 | { |
| 4188 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); | 4197 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); |
| 4189 | uint32_t mm_boot_level_offset, mm_boot_level_value; | 4198 | uint32_t mm_boot_level_offset, mm_boot_level_value; |
| 4190 | struct phm_ppt_v1_information *table_info = | ||
| 4191 | (struct phm_ppt_v1_information *)(hwmgr->pptable); | ||
| 4192 | 4199 | ||
| 4193 | if (!bgate) { | 4200 | if (!bgate) { |
| 4194 | data->smc_state_table.SamuBootLevel = | 4201 | data->smc_state_table.SamuBootLevel = 0; |
| 4195 | (uint8_t) (table_info->mm_dep_table->count - 1); | ||
| 4196 | mm_boot_level_offset = data->dpm_table_start + | 4202 | mm_boot_level_offset = data->dpm_table_start + |
| 4197 | offsetof(SMU74_Discrete_DpmTable, SamuBootLevel); | 4203 | offsetof(SMU74_Discrete_DpmTable, SamuBootLevel); |
| 4198 | mm_boot_level_offset /= 4; | 4204 | mm_boot_level_offset /= 4; |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h index 1b44f4e9b8f5..f127198aafc4 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h | |||
| @@ -197,6 +197,22 @@ typedef struct _ATOM_Tonga_SCLK_Dependency_Table { | |||
| 197 | ATOM_Tonga_SCLK_Dependency_Record entries[1]; /* Dynamically allocate entries. */ | 197 | ATOM_Tonga_SCLK_Dependency_Record entries[1]; /* Dynamically allocate entries. */ |
| 198 | } ATOM_Tonga_SCLK_Dependency_Table; | 198 | } ATOM_Tonga_SCLK_Dependency_Table; |
| 199 | 199 | ||
| 200 | typedef struct _ATOM_Polaris_SCLK_Dependency_Record { | ||
| 201 | UCHAR ucVddInd; /* Base voltage */ | ||
| 202 | USHORT usVddcOffset; /* Offset relative to base voltage */ | ||
| 203 | ULONG ulSclk; | ||
| 204 | USHORT usEdcCurrent; | ||
| 205 | UCHAR ucReliabilityTemperature; | ||
| 206 | UCHAR ucCKSVOffsetandDisable; /* Bits 0~6: Voltage offset for CKS, Bit 7: Disable/enable for the SCLK level. */ | ||
| 207 | ULONG ulSclkOffset; | ||
| 208 | } ATOM_Polaris_SCLK_Dependency_Record; | ||
| 209 | |||
| 210 | typedef struct _ATOM_Polaris_SCLK_Dependency_Table { | ||
| 211 | UCHAR ucRevId; | ||
| 212 | UCHAR ucNumEntries; /* Number of entries. */ | ||
| 213 | ATOM_Polaris_SCLK_Dependency_Record entries[1]; /* Dynamically allocate entries. */ | ||
| 214 | } ATOM_Polaris_SCLK_Dependency_Table; | ||
| 215 | |||
| 200 | typedef struct _ATOM_Tonga_PCIE_Record { | 216 | typedef struct _ATOM_Tonga_PCIE_Record { |
| 201 | UCHAR ucPCIEGenSpeed; | 217 | UCHAR ucPCIEGenSpeed; |
| 202 | UCHAR usPCIELaneWidth; | 218 | UCHAR usPCIELaneWidth; |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c index 296ec7ef6d45..671fdb4d615a 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c | |||
| @@ -408,41 +408,78 @@ static int get_mclk_voltage_dependency_table( | |||
| 408 | static int get_sclk_voltage_dependency_table( | 408 | static int get_sclk_voltage_dependency_table( |
| 409 | struct pp_hwmgr *hwmgr, | 409 | struct pp_hwmgr *hwmgr, |
| 410 | phm_ppt_v1_clock_voltage_dependency_table **pp_tonga_sclk_dep_table, | 410 | phm_ppt_v1_clock_voltage_dependency_table **pp_tonga_sclk_dep_table, |
| 411 | const ATOM_Tonga_SCLK_Dependency_Table * sclk_dep_table | 411 | const PPTable_Generic_SubTable_Header *sclk_dep_table |
| 412 | ) | 412 | ) |
| 413 | { | 413 | { |
| 414 | uint32_t table_size, i; | 414 | uint32_t table_size, i; |
| 415 | phm_ppt_v1_clock_voltage_dependency_table *sclk_table; | 415 | phm_ppt_v1_clock_voltage_dependency_table *sclk_table; |
| 416 | 416 | ||
| 417 | PP_ASSERT_WITH_CODE((0 != sclk_dep_table->ucNumEntries), | 417 | if (sclk_dep_table->ucRevId < 1) { |
| 418 | "Invalid PowerPlay Table!", return -1); | 418 | const ATOM_Tonga_SCLK_Dependency_Table *tonga_table = |
| 419 | (ATOM_Tonga_SCLK_Dependency_Table *)sclk_dep_table; | ||
| 419 | 420 | ||
| 420 | table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record) | 421 | PP_ASSERT_WITH_CODE((0 != tonga_table->ucNumEntries), |
| 421 | * sclk_dep_table->ucNumEntries; | 422 | "Invalid PowerPlay Table!", return -1); |
| 422 | 423 | ||
| 423 | sclk_table = (phm_ppt_v1_clock_voltage_dependency_table *) | 424 | table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record) |
| 424 | kzalloc(table_size, GFP_KERNEL); | 425 | * tonga_table->ucNumEntries; |
| 425 | 426 | ||
| 426 | if (NULL == sclk_table) | 427 | sclk_table = (phm_ppt_v1_clock_voltage_dependency_table *) |
| 427 | return -ENOMEM; | 428 | kzalloc(table_size, GFP_KERNEL); |
| 428 | 429 | ||
| 429 | memset(sclk_table, 0x00, table_size); | 430 | if (NULL == sclk_table) |
| 430 | 431 | return -ENOMEM; | |
| 431 | sclk_table->count = (uint32_t)sclk_dep_table->ucNumEntries; | 432 | |
| 432 | 433 | memset(sclk_table, 0x00, table_size); | |
| 433 | for (i = 0; i < sclk_dep_table->ucNumEntries; i++) { | 434 | |
| 434 | sclk_table->entries[i].vddInd = | 435 | sclk_table->count = (uint32_t)tonga_table->ucNumEntries; |
| 435 | sclk_dep_table->entries[i].ucVddInd; | 436 | |
| 436 | sclk_table->entries[i].vdd_offset = | 437 | for (i = 0; i < tonga_table->ucNumEntries; i++) { |
| 437 | sclk_dep_table->entries[i].usVddcOffset; | 438 | sclk_table->entries[i].vddInd = |
| 438 | sclk_table->entries[i].clk = | 439 | tonga_table->entries[i].ucVddInd; |
| 439 | sclk_dep_table->entries[i].ulSclk; | 440 | sclk_table->entries[i].vdd_offset = |
| 440 | sclk_table->entries[i].cks_enable = | 441 | tonga_table->entries[i].usVddcOffset; |
| 441 | (((sclk_dep_table->entries[i].ucCKSVOffsetandDisable & 0x80) >> 7) == 0) ? 1 : 0; | 442 | sclk_table->entries[i].clk = |
| 442 | sclk_table->entries[i].cks_voffset = | 443 | tonga_table->entries[i].ulSclk; |
| 443 | (sclk_dep_table->entries[i].ucCKSVOffsetandDisable & 0x7F); | 444 | sclk_table->entries[i].cks_enable = |
| 444 | } | 445 | (((tonga_table->entries[i].ucCKSVOffsetandDisable & 0x80) >> 7) == 0) ? 1 : 0; |
| 446 | sclk_table->entries[i].cks_voffset = | ||
| 447 | (tonga_table->entries[i].ucCKSVOffsetandDisable & 0x7F); | ||
| 448 | } | ||
| 449 | } else { | ||
| 450 | const ATOM_Polaris_SCLK_Dependency_Table *polaris_table = | ||
| 451 | (ATOM_Polaris_SCLK_Dependency_Table *)sclk_dep_table; | ||
| 445 | 452 | ||
| 453 | PP_ASSERT_WITH_CODE((0 != polaris_table->ucNumEntries), | ||
| 454 | "Invalid PowerPlay Table!", return -1); | ||
| 455 | |||
| 456 | table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record) | ||
| 457 | * polaris_table->ucNumEntries; | ||
| 458 | |||
| 459 | sclk_table = (phm_ppt_v1_clock_voltage_dependency_table *) | ||
| 460 | kzalloc(table_size, GFP_KERNEL); | ||
| 461 | |||
| 462 | if (NULL == sclk_table) | ||
| 463 | return -ENOMEM; | ||
| 464 | |||
| 465 | memset(sclk_table, 0x00, table_size); | ||
| 466 | |||
| 467 | sclk_table->count = (uint32_t)polaris_table->ucNumEntries; | ||
| 468 | |||
| 469 | for (i = 0; i < polaris_table->ucNumEntries; i++) { | ||
| 470 | sclk_table->entries[i].vddInd = | ||
| 471 | polaris_table->entries[i].ucVddInd; | ||
| 472 | sclk_table->entries[i].vdd_offset = | ||
| 473 | polaris_table->entries[i].usVddcOffset; | ||
| 474 | sclk_table->entries[i].clk = | ||
| 475 | polaris_table->entries[i].ulSclk; | ||
| 476 | sclk_table->entries[i].cks_enable = | ||
| 477 | (((polaris_table->entries[i].ucCKSVOffsetandDisable & 0x80) >> 7) == 0) ? 1 : 0; | ||
| 478 | sclk_table->entries[i].cks_voffset = | ||
| 479 | (polaris_table->entries[i].ucCKSVOffsetandDisable & 0x7F); | ||
| 480 | sclk_table->entries[i].sclk_offset = polaris_table->entries[i].ulSclkOffset; | ||
| 481 | } | ||
| 482 | } | ||
| 446 | *pp_tonga_sclk_dep_table = sclk_table; | 483 | *pp_tonga_sclk_dep_table = sclk_table; |
| 447 | 484 | ||
| 448 | return 0; | 485 | return 0; |
| @@ -708,8 +745,8 @@ static int init_clock_voltage_dependency( | |||
| 708 | const ATOM_Tonga_MCLK_Dependency_Table *mclk_dep_table = | 745 | const ATOM_Tonga_MCLK_Dependency_Table *mclk_dep_table = |
| 709 | (const ATOM_Tonga_MCLK_Dependency_Table *)(((unsigned long) powerplay_table) + | 746 | (const ATOM_Tonga_MCLK_Dependency_Table *)(((unsigned long) powerplay_table) + |
| 710 | le16_to_cpu(powerplay_table->usMclkDependencyTableOffset)); | 747 | le16_to_cpu(powerplay_table->usMclkDependencyTableOffset)); |
| 711 | const ATOM_Tonga_SCLK_Dependency_Table *sclk_dep_table = | 748 | const PPTable_Generic_SubTable_Header *sclk_dep_table = |
| 712 | (const ATOM_Tonga_SCLK_Dependency_Table *)(((unsigned long) powerplay_table) + | 749 | (const PPTable_Generic_SubTable_Header *)(((unsigned long) powerplay_table) + |
| 713 | le16_to_cpu(powerplay_table->usSclkDependencyTableOffset)); | 750 | le16_to_cpu(powerplay_table->usSclkDependencyTableOffset)); |
| 714 | const ATOM_Tonga_Hard_Limit_Table *pHardLimits = | 751 | const ATOM_Tonga_Hard_Limit_Table *pHardLimits = |
| 715 | (const ATOM_Tonga_Hard_Limit_Table *)(((unsigned long) powerplay_table) + | 752 | (const ATOM_Tonga_Hard_Limit_Table *)(((unsigned long) powerplay_table) + |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index a6e42433ef0e..26feb2f8453f 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
| @@ -528,11 +528,11 @@ drm_crtc_helper_disable(struct drm_crtc *crtc) | |||
| 528 | int drm_crtc_helper_set_config(struct drm_mode_set *set) | 528 | int drm_crtc_helper_set_config(struct drm_mode_set *set) |
| 529 | { | 529 | { |
| 530 | struct drm_device *dev; | 530 | struct drm_device *dev; |
| 531 | struct drm_crtc *new_crtc; | 531 | struct drm_crtc **save_encoder_crtcs, *new_crtc; |
| 532 | struct drm_encoder *save_encoders, *new_encoder, *encoder; | 532 | struct drm_encoder **save_connector_encoders, *new_encoder, *encoder; |
| 533 | bool mode_changed = false; /* if true do a full mode set */ | 533 | bool mode_changed = false; /* if true do a full mode set */ |
| 534 | bool fb_changed = false; /* if true and !mode_changed just do a flip */ | 534 | bool fb_changed = false; /* if true and !mode_changed just do a flip */ |
| 535 | struct drm_connector *save_connectors, *connector; | 535 | struct drm_connector *connector; |
| 536 | int count = 0, ro, fail = 0; | 536 | int count = 0, ro, fail = 0; |
| 537 | const struct drm_crtc_helper_funcs *crtc_funcs; | 537 | const struct drm_crtc_helper_funcs *crtc_funcs; |
| 538 | struct drm_mode_set save_set; | 538 | struct drm_mode_set save_set; |
| @@ -574,15 +574,15 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
| 574 | * Allocate space for the backup of all (non-pointer) encoder and | 574 | * Allocate space for the backup of all (non-pointer) encoder and |
| 575 | * connector data. | 575 | * connector data. |
| 576 | */ | 576 | */ |
| 577 | save_encoders = kzalloc(dev->mode_config.num_encoder * | 577 | save_encoder_crtcs = kzalloc(dev->mode_config.num_encoder * |
| 578 | sizeof(struct drm_encoder), GFP_KERNEL); | 578 | sizeof(struct drm_crtc *), GFP_KERNEL); |
| 579 | if (!save_encoders) | 579 | if (!save_encoder_crtcs) |
| 580 | return -ENOMEM; | 580 | return -ENOMEM; |
| 581 | 581 | ||
| 582 | save_connectors = kzalloc(dev->mode_config.num_connector * | 582 | save_connector_encoders = kzalloc(dev->mode_config.num_connector * |
| 583 | sizeof(struct drm_connector), GFP_KERNEL); | 583 | sizeof(struct drm_encoder *), GFP_KERNEL); |
| 584 | if (!save_connectors) { | 584 | if (!save_connector_encoders) { |
| 585 | kfree(save_encoders); | 585 | kfree(save_encoder_crtcs); |
| 586 | return -ENOMEM; | 586 | return -ENOMEM; |
| 587 | } | 587 | } |
| 588 | 588 | ||
| @@ -593,12 +593,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
| 593 | */ | 593 | */ |
| 594 | count = 0; | 594 | count = 0; |
| 595 | drm_for_each_encoder(encoder, dev) { | 595 | drm_for_each_encoder(encoder, dev) { |
| 596 | save_encoders[count++] = *encoder; | 596 | save_encoder_crtcs[count++] = encoder->crtc; |
| 597 | } | 597 | } |
| 598 | 598 | ||
| 599 | count = 0; | 599 | count = 0; |
| 600 | drm_for_each_connector(connector, dev) { | 600 | drm_for_each_connector(connector, dev) { |
| 601 | save_connectors[count++] = *connector; | 601 | save_connector_encoders[count++] = connector->encoder; |
| 602 | } | 602 | } |
| 603 | 603 | ||
| 604 | save_set.crtc = set->crtc; | 604 | save_set.crtc = set->crtc; |
| @@ -631,8 +631,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
| 631 | mode_changed = true; | 631 | mode_changed = true; |
| 632 | } | 632 | } |
| 633 | 633 | ||
| 634 | /* take a reference on all connectors in set */ | 634 | /* take a reference on all unbound connectors in set, reuse the |
| 635 | * already taken reference for bound connectors | ||
| 636 | */ | ||
| 635 | for (ro = 0; ro < set->num_connectors; ro++) { | 637 | for (ro = 0; ro < set->num_connectors; ro++) { |
| 638 | if (set->connectors[ro]->encoder) | ||
| 639 | continue; | ||
| 636 | drm_connector_reference(set->connectors[ro]); | 640 | drm_connector_reference(set->connectors[ro]); |
| 637 | } | 641 | } |
| 638 | 642 | ||
| @@ -754,30 +758,28 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
| 754 | } | 758 | } |
| 755 | } | 759 | } |
| 756 | 760 | ||
| 757 | /* after fail drop reference on all connectors in save set */ | 761 | kfree(save_connector_encoders); |
| 758 | count = 0; | 762 | kfree(save_encoder_crtcs); |
| 759 | drm_for_each_connector(connector, dev) { | ||
| 760 | drm_connector_unreference(&save_connectors[count++]); | ||
| 761 | } | ||
| 762 | |||
| 763 | kfree(save_connectors); | ||
| 764 | kfree(save_encoders); | ||
| 765 | return 0; | 763 | return 0; |
| 766 | 764 | ||
| 767 | fail: | 765 | fail: |
| 768 | /* Restore all previous data. */ | 766 | /* Restore all previous data. */ |
| 769 | count = 0; | 767 | count = 0; |
| 770 | drm_for_each_encoder(encoder, dev) { | 768 | drm_for_each_encoder(encoder, dev) { |
| 771 | *encoder = save_encoders[count++]; | 769 | encoder->crtc = save_encoder_crtcs[count++]; |
| 772 | } | 770 | } |
| 773 | 771 | ||
| 774 | count = 0; | 772 | count = 0; |
| 775 | drm_for_each_connector(connector, dev) { | 773 | drm_for_each_connector(connector, dev) { |
| 776 | *connector = save_connectors[count++]; | 774 | connector->encoder = save_connector_encoders[count++]; |
| 777 | } | 775 | } |
| 778 | 776 | ||
| 779 | /* after fail drop reference on all connectors in set */ | 777 | /* after fail drop reference on all unbound connectors in set, let |
| 778 | * bound connectors keep their reference | ||
| 779 | */ | ||
| 780 | for (ro = 0; ro < set->num_connectors; ro++) { | 780 | for (ro = 0; ro < set->num_connectors; ro++) { |
| 781 | if (set->connectors[ro]->encoder) | ||
| 782 | continue; | ||
| 781 | drm_connector_unreference(set->connectors[ro]); | 783 | drm_connector_unreference(set->connectors[ro]); |
| 782 | } | 784 | } |
| 783 | 785 | ||
| @@ -787,8 +789,8 @@ fail: | |||
| 787 | save_set.y, save_set.fb)) | 789 | save_set.y, save_set.fb)) |
| 788 | DRM_ERROR("failed to restore config after modeset failure\n"); | 790 | DRM_ERROR("failed to restore config after modeset failure\n"); |
| 789 | 791 | ||
| 790 | kfree(save_connectors); | 792 | kfree(save_connector_encoders); |
| 791 | kfree(save_encoders); | 793 | kfree(save_encoder_crtcs); |
| 792 | return ret; | 794 | return ret; |
| 793 | } | 795 | } |
| 794 | EXPORT_SYMBOL(drm_crtc_helper_set_config); | 796 | EXPORT_SYMBOL(drm_crtc_helper_set_config); |
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index a13edf5de2d6..6537908050d7 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c | |||
| @@ -2927,11 +2927,9 @@ static void drm_dp_destroy_connector_work(struct work_struct *work) | |||
| 2927 | drm_dp_port_teardown_pdt(port, port->pdt); | 2927 | drm_dp_port_teardown_pdt(port, port->pdt); |
| 2928 | 2928 | ||
| 2929 | if (!port->input && port->vcpi.vcpi > 0) { | 2929 | if (!port->input && port->vcpi.vcpi > 0) { |
| 2930 | if (mgr->mst_state) { | 2930 | drm_dp_mst_reset_vcpi_slots(mgr, port); |
| 2931 | drm_dp_mst_reset_vcpi_slots(mgr, port); | 2931 | drm_dp_update_payload_part1(mgr); |
| 2932 | drm_dp_update_payload_part1(mgr); | 2932 | drm_dp_mst_put_payload_id(mgr, port->vcpi.vcpi); |
| 2933 | drm_dp_mst_put_payload_id(mgr, port->vcpi.vcpi); | ||
| 2934 | } | ||
| 2935 | } | 2933 | } |
| 2936 | 2934 | ||
| 2937 | kref_put(&port->kref, drm_dp_free_mst_port); | 2935 | kref_put(&port->kref, drm_dp_free_mst_port); |
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c index 522cfd447892..16353ee81651 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c | |||
| @@ -225,6 +225,7 @@ struct iommu_domain *etnaviv_iommu_domain_alloc(struct etnaviv_gpu *gpu) | |||
| 225 | 225 | ||
| 226 | etnaviv_domain->domain.type = __IOMMU_DOMAIN_PAGING; | 226 | etnaviv_domain->domain.type = __IOMMU_DOMAIN_PAGING; |
| 227 | etnaviv_domain->domain.ops = &etnaviv_iommu_ops.ops; | 227 | etnaviv_domain->domain.ops = &etnaviv_iommu_ops.ops; |
| 228 | etnaviv_domain->domain.pgsize_bitmap = SZ_4K; | ||
| 228 | etnaviv_domain->domain.geometry.aperture_start = GPU_MEM_START; | 229 | etnaviv_domain->domain.geometry.aperture_start = GPU_MEM_START; |
| 229 | etnaviv_domain->domain.geometry.aperture_end = GPU_MEM_START + PT_ENTRIES * SZ_4K - 1; | 230 | etnaviv_domain->domain.geometry.aperture_end = GPU_MEM_START + PT_ENTRIES * SZ_4K - 1; |
| 230 | 231 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 5faacc6e548d..7c334e902266 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
| @@ -3481,6 +3481,7 @@ int intel_bios_init(struct drm_i915_private *dev_priv); | |||
| 3481 | bool intel_bios_is_valid_vbt(const void *buf, size_t size); | 3481 | bool intel_bios_is_valid_vbt(const void *buf, size_t size); |
| 3482 | bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv); | 3482 | bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv); |
| 3483 | bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin); | 3483 | bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin); |
| 3484 | bool intel_bios_is_port_present(struct drm_i915_private *dev_priv, enum port port); | ||
| 3484 | bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port); | 3485 | bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port); |
| 3485 | bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum port port); | 3486 | bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum port port); |
| 3486 | bool intel_bios_is_dsi_present(struct drm_i915_private *dev_priv, enum port *port); | 3487 | bool intel_bios_is_dsi_present(struct drm_i915_private *dev_priv, enum port *port); |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index b235b6e88ead..b9022fa053d6 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
| @@ -139,6 +139,11 @@ fill_detail_timing_data(struct drm_display_mode *panel_fixed_mode, | |||
| 139 | else | 139 | else |
| 140 | panel_fixed_mode->flags |= DRM_MODE_FLAG_NVSYNC; | 140 | panel_fixed_mode->flags |= DRM_MODE_FLAG_NVSYNC; |
| 141 | 141 | ||
| 142 | panel_fixed_mode->width_mm = (dvo_timing->himage_hi << 8) | | ||
| 143 | dvo_timing->himage_lo; | ||
| 144 | panel_fixed_mode->height_mm = (dvo_timing->vimage_hi << 8) | | ||
| 145 | dvo_timing->vimage_lo; | ||
| 146 | |||
| 142 | /* Some VBTs have bogus h/vtotal values */ | 147 | /* Some VBTs have bogus h/vtotal values */ |
| 143 | if (panel_fixed_mode->hsync_end > panel_fixed_mode->htotal) | 148 | if (panel_fixed_mode->hsync_end > panel_fixed_mode->htotal) |
| 144 | panel_fixed_mode->htotal = panel_fixed_mode->hsync_end + 1; | 149 | panel_fixed_mode->htotal = panel_fixed_mode->hsync_end + 1; |
| @@ -1187,7 +1192,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv, | |||
| 1187 | } | 1192 | } |
| 1188 | if (bdb->version < 106) { | 1193 | if (bdb->version < 106) { |
| 1189 | expected_size = 22; | 1194 | expected_size = 22; |
| 1190 | } else if (bdb->version < 109) { | 1195 | } else if (bdb->version < 111) { |
| 1191 | expected_size = 27; | 1196 | expected_size = 27; |
| 1192 | } else if (bdb->version < 195) { | 1197 | } else if (bdb->version < 195) { |
| 1193 | BUILD_BUG_ON(sizeof(struct old_child_dev_config) != 33); | 1198 | BUILD_BUG_ON(sizeof(struct old_child_dev_config) != 33); |
| @@ -1546,6 +1551,45 @@ bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin) | |||
| 1546 | } | 1551 | } |
| 1547 | 1552 | ||
| 1548 | /** | 1553 | /** |
| 1554 | * intel_bios_is_port_present - is the specified digital port present | ||
| 1555 | * @dev_priv: i915 device instance | ||
| 1556 | * @port: port to check | ||
| 1557 | * | ||
| 1558 | * Return true if the device in %port is present. | ||
| 1559 | */ | ||
| 1560 | bool intel_bios_is_port_present(struct drm_i915_private *dev_priv, enum port port) | ||
| 1561 | { | ||
| 1562 | static const struct { | ||
| 1563 | u16 dp, hdmi; | ||
| 1564 | } port_mapping[] = { | ||
| 1565 | [PORT_B] = { DVO_PORT_DPB, DVO_PORT_HDMIB, }, | ||
| 1566 | [PORT_C] = { DVO_PORT_DPC, DVO_PORT_HDMIC, }, | ||
| 1567 | [PORT_D] = { DVO_PORT_DPD, DVO_PORT_HDMID, }, | ||
| 1568 | [PORT_E] = { DVO_PORT_DPE, DVO_PORT_HDMIE, }, | ||
| 1569 | }; | ||
| 1570 | int i; | ||
| 1571 | |||
| 1572 | /* FIXME maybe deal with port A as well? */ | ||
| 1573 | if (WARN_ON(port == PORT_A) || port >= ARRAY_SIZE(port_mapping)) | ||
| 1574 | return false; | ||
| 1575 | |||
| 1576 | if (!dev_priv->vbt.child_dev_num) | ||
| 1577 | return false; | ||
| 1578 | |||
| 1579 | for (i = 0; i < dev_priv->vbt.child_dev_num; i++) { | ||
| 1580 | const union child_device_config *p_child = | ||
| 1581 | &dev_priv->vbt.child_dev[i]; | ||
| 1582 | if ((p_child->common.dvo_port == port_mapping[port].dp || | ||
| 1583 | p_child->common.dvo_port == port_mapping[port].hdmi) && | ||
| 1584 | (p_child->common.device_type & (DEVICE_TYPE_TMDS_DVI_SIGNALING | | ||
| 1585 | DEVICE_TYPE_DISPLAYPORT_OUTPUT))) | ||
| 1586 | return true; | ||
| 1587 | } | ||
| 1588 | |||
| 1589 | return false; | ||
| 1590 | } | ||
| 1591 | |||
| 1592 | /** | ||
| 1549 | * intel_bios_is_port_edp - is the device in given port eDP | 1593 | * intel_bios_is_port_edp - is the device in given port eDP |
| 1550 | * @dev_priv: i915 device instance | 1594 | * @dev_priv: i915 device instance |
| 1551 | * @port: port to check | 1595 | * @port: port to check |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 2113f401f0ba..56a1637c864f 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -8275,12 +8275,14 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) | |||
| 8275 | { | 8275 | { |
| 8276 | struct drm_i915_private *dev_priv = dev->dev_private; | 8276 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 8277 | struct intel_encoder *encoder; | 8277 | struct intel_encoder *encoder; |
| 8278 | int i; | ||
| 8278 | u32 val, final; | 8279 | u32 val, final; |
| 8279 | bool has_lvds = false; | 8280 | bool has_lvds = false; |
| 8280 | bool has_cpu_edp = false; | 8281 | bool has_cpu_edp = false; |
| 8281 | bool has_panel = false; | 8282 | bool has_panel = false; |
| 8282 | bool has_ck505 = false; | 8283 | bool has_ck505 = false; |
| 8283 | bool can_ssc = false; | 8284 | bool can_ssc = false; |
| 8285 | bool using_ssc_source = false; | ||
| 8284 | 8286 | ||
| 8285 | /* We need to take the global config into account */ | 8287 | /* We need to take the global config into account */ |
| 8286 | for_each_intel_encoder(dev, encoder) { | 8288 | for_each_intel_encoder(dev, encoder) { |
| @@ -8307,8 +8309,22 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) | |||
| 8307 | can_ssc = true; | 8309 | can_ssc = true; |
| 8308 | } | 8310 | } |
| 8309 | 8311 | ||
| 8310 | DRM_DEBUG_KMS("has_panel %d has_lvds %d has_ck505 %d\n", | 8312 | /* Check if any DPLLs are using the SSC source */ |
| 8311 | has_panel, has_lvds, has_ck505); | 8313 | for (i = 0; i < dev_priv->num_shared_dpll; i++) { |
| 8314 | u32 temp = I915_READ(PCH_DPLL(i)); | ||
| 8315 | |||
| 8316 | if (!(temp & DPLL_VCO_ENABLE)) | ||
| 8317 | continue; | ||
| 8318 | |||
| 8319 | if ((temp & PLL_REF_INPUT_MASK) == | ||
| 8320 | PLLB_REF_INPUT_SPREADSPECTRUMIN) { | ||
| 8321 | using_ssc_source = true; | ||
| 8322 | break; | ||
| 8323 | } | ||
| 8324 | } | ||
| 8325 | |||
| 8326 | DRM_DEBUG_KMS("has_panel %d has_lvds %d has_ck505 %d using_ssc_source %d\n", | ||
| 8327 | has_panel, has_lvds, has_ck505, using_ssc_source); | ||
| 8312 | 8328 | ||
| 8313 | /* Ironlake: try to setup display ref clock before DPLL | 8329 | /* Ironlake: try to setup display ref clock before DPLL |
| 8314 | * enabling. This is only under driver's control after | 8330 | * enabling. This is only under driver's control after |
| @@ -8345,9 +8361,9 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) | |||
| 8345 | final |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD; | 8361 | final |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD; |
| 8346 | } else | 8362 | } else |
| 8347 | final |= DREF_CPU_SOURCE_OUTPUT_DISABLE; | 8363 | final |= DREF_CPU_SOURCE_OUTPUT_DISABLE; |
| 8348 | } else { | 8364 | } else if (using_ssc_source) { |
| 8349 | final |= DREF_SSC_SOURCE_DISABLE; | 8365 | final |= DREF_SSC_SOURCE_ENABLE; |
| 8350 | final |= DREF_CPU_SOURCE_OUTPUT_DISABLE; | 8366 | final |= DREF_SSC1_ENABLE; |
| 8351 | } | 8367 | } |
| 8352 | 8368 | ||
| 8353 | if (final == val) | 8369 | if (final == val) |
| @@ -8393,7 +8409,7 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) | |||
| 8393 | POSTING_READ(PCH_DREF_CONTROL); | 8409 | POSTING_READ(PCH_DREF_CONTROL); |
| 8394 | udelay(200); | 8410 | udelay(200); |
| 8395 | } else { | 8411 | } else { |
| 8396 | DRM_DEBUG_KMS("Disabling SSC entirely\n"); | 8412 | DRM_DEBUG_KMS("Disabling CPU source output\n"); |
| 8397 | 8413 | ||
| 8398 | val &= ~DREF_CPU_SOURCE_OUTPUT_MASK; | 8414 | val &= ~DREF_CPU_SOURCE_OUTPUT_MASK; |
| 8399 | 8415 | ||
| @@ -8404,16 +8420,20 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) | |||
| 8404 | POSTING_READ(PCH_DREF_CONTROL); | 8420 | POSTING_READ(PCH_DREF_CONTROL); |
| 8405 | udelay(200); | 8421 | udelay(200); |
| 8406 | 8422 | ||
| 8407 | /* Turn off the SSC source */ | 8423 | if (!using_ssc_source) { |
| 8408 | val &= ~DREF_SSC_SOURCE_MASK; | 8424 | DRM_DEBUG_KMS("Disabling SSC source\n"); |
| 8409 | val |= DREF_SSC_SOURCE_DISABLE; | ||
| 8410 | 8425 | ||
| 8411 | /* Turn off SSC1 */ | 8426 | /* Turn off the SSC source */ |
| 8412 | val &= ~DREF_SSC1_ENABLE; | 8427 | val &= ~DREF_SSC_SOURCE_MASK; |
| 8428 | val |= DREF_SSC_SOURCE_DISABLE; | ||
| 8413 | 8429 | ||
| 8414 | I915_WRITE(PCH_DREF_CONTROL, val); | 8430 | /* Turn off SSC1 */ |
| 8415 | POSTING_READ(PCH_DREF_CONTROL); | 8431 | val &= ~DREF_SSC1_ENABLE; |
| 8416 | udelay(200); | 8432 | |
| 8433 | I915_WRITE(PCH_DREF_CONTROL, val); | ||
| 8434 | POSTING_READ(PCH_DREF_CONTROL); | ||
| 8435 | udelay(200); | ||
| 8436 | } | ||
| 8417 | } | 8437 | } |
| 8418 | 8438 | ||
| 8419 | BUG_ON(val != final); | 8439 | BUG_ON(val != final); |
| @@ -14554,6 +14574,8 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
| 14554 | if (I915_READ(PCH_DP_D) & DP_DETECTED) | 14574 | if (I915_READ(PCH_DP_D) & DP_DETECTED) |
| 14555 | intel_dp_init(dev, PCH_DP_D, PORT_D); | 14575 | intel_dp_init(dev, PCH_DP_D, PORT_D); |
| 14556 | } else if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { | 14576 | } else if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { |
| 14577 | bool has_edp, has_port; | ||
| 14578 | |||
| 14557 | /* | 14579 | /* |
| 14558 | * The DP_DETECTED bit is the latched state of the DDC | 14580 | * The DP_DETECTED bit is the latched state of the DDC |
| 14559 | * SDA pin at boot. However since eDP doesn't require DDC | 14581 | * SDA pin at boot. However since eDP doesn't require DDC |
| @@ -14562,27 +14584,37 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
| 14562 | * Thus we can't rely on the DP_DETECTED bit alone to detect | 14584 | * Thus we can't rely on the DP_DETECTED bit alone to detect |
| 14563 | * eDP ports. Consult the VBT as well as DP_DETECTED to | 14585 | * eDP ports. Consult the VBT as well as DP_DETECTED to |
| 14564 | * detect eDP ports. | 14586 | * detect eDP ports. |
| 14587 | * | ||
| 14588 | * Sadly the straps seem to be missing sometimes even for HDMI | ||
| 14589 | * ports (eg. on Voyo V3 - CHT x7-Z8700), so check both strap | ||
| 14590 | * and VBT for the presence of the port. Additionally we can't | ||
| 14591 | * trust the port type the VBT declares as we've seen at least | ||
| 14592 | * HDMI ports that the VBT claim are DP or eDP. | ||
| 14565 | */ | 14593 | */ |
| 14566 | if (I915_READ(VLV_HDMIB) & SDVO_DETECTED && | 14594 | has_edp = intel_dp_is_edp(dev, PORT_B); |
| 14567 | !intel_dp_is_edp(dev, PORT_B)) | 14595 | has_port = intel_bios_is_port_present(dev_priv, PORT_B); |
| 14596 | if (I915_READ(VLV_DP_B) & DP_DETECTED || has_port) | ||
| 14597 | has_edp &= intel_dp_init(dev, VLV_DP_B, PORT_B); | ||
| 14598 | if ((I915_READ(VLV_HDMIB) & SDVO_DETECTED || has_port) && !has_edp) | ||
| 14568 | intel_hdmi_init(dev, VLV_HDMIB, PORT_B); | 14599 | intel_hdmi_init(dev, VLV_HDMIB, PORT_B); |
| 14569 | if (I915_READ(VLV_DP_B) & DP_DETECTED || | ||
| 14570 | intel_dp_is_edp(dev, PORT_B)) | ||
| 14571 | intel_dp_init(dev, VLV_DP_B, PORT_B); | ||
| 14572 | 14600 | ||
| 14573 | if (I915_READ(VLV_HDMIC) & SDVO_DETECTED && | 14601 | has_edp = intel_dp_is_edp(dev, PORT_C); |
| 14574 | !intel_dp_is_edp(dev, PORT_C)) | 14602 | has_port = intel_bios_is_port_present(dev_priv, PORT_C); |
| 14603 | if (I915_READ(VLV_DP_C) & DP_DETECTED || has_port) | ||
| 14604 | has_edp &= intel_dp_init(dev, VLV_DP_C, PORT_C); | ||
| 14605 | if ((I915_READ(VLV_HDMIC) & SDVO_DETECTED || has_port) && !has_edp) | ||
| 14575 | intel_hdmi_init(dev, VLV_HDMIC, PORT_C); | 14606 | intel_hdmi_init(dev, VLV_HDMIC, PORT_C); |
| 14576 | if (I915_READ(VLV_DP_C) & DP_DETECTED || | ||
| 14577 | intel_dp_is_edp(dev, PORT_C)) | ||
| 14578 | intel_dp_init(dev, VLV_DP_C, PORT_C); | ||
| 14579 | 14607 | ||
| 14580 | if (IS_CHERRYVIEW(dev)) { | 14608 | if (IS_CHERRYVIEW(dev)) { |
| 14581 | /* eDP not supported on port D, so don't check VBT */ | 14609 | /* |
| 14582 | if (I915_READ(CHV_HDMID) & SDVO_DETECTED) | 14610 | * eDP not supported on port D, |
| 14583 | intel_hdmi_init(dev, CHV_HDMID, PORT_D); | 14611 | * so no need to worry about it |
| 14584 | if (I915_READ(CHV_DP_D) & DP_DETECTED) | 14612 | */ |
| 14613 | has_port = intel_bios_is_port_present(dev_priv, PORT_D); | ||
| 14614 | if (I915_READ(CHV_DP_D) & DP_DETECTED || has_port) | ||
| 14585 | intel_dp_init(dev, CHV_DP_D, PORT_D); | 14615 | intel_dp_init(dev, CHV_DP_D, PORT_D); |
| 14616 | if (I915_READ(CHV_HDMID) & SDVO_DETECTED || has_port) | ||
| 14617 | intel_hdmi_init(dev, CHV_HDMID, PORT_D); | ||
| 14586 | } | 14618 | } |
| 14587 | 14619 | ||
| 14588 | intel_dsi_init(dev); | 14620 | intel_dsi_init(dev); |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index f192f58708c2..ffe5f8430957 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
| @@ -5725,8 +5725,11 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, | |||
| 5725 | if (!fixed_mode && dev_priv->vbt.lfp_lvds_vbt_mode) { | 5725 | if (!fixed_mode && dev_priv->vbt.lfp_lvds_vbt_mode) { |
| 5726 | fixed_mode = drm_mode_duplicate(dev, | 5726 | fixed_mode = drm_mode_duplicate(dev, |
| 5727 | dev_priv->vbt.lfp_lvds_vbt_mode); | 5727 | dev_priv->vbt.lfp_lvds_vbt_mode); |
| 5728 | if (fixed_mode) | 5728 | if (fixed_mode) { |
| 5729 | fixed_mode->type |= DRM_MODE_TYPE_PREFERRED; | 5729 | fixed_mode->type |= DRM_MODE_TYPE_PREFERRED; |
| 5730 | connector->display_info.width_mm = fixed_mode->width_mm; | ||
| 5731 | connector->display_info.height_mm = fixed_mode->height_mm; | ||
| 5732 | } | ||
| 5730 | } | 5733 | } |
| 5731 | mutex_unlock(&dev->mode_config.mutex); | 5734 | mutex_unlock(&dev->mode_config.mutex); |
| 5732 | 5735 | ||
| @@ -5923,9 +5926,9 @@ fail: | |||
| 5923 | return false; | 5926 | return false; |
| 5924 | } | 5927 | } |
| 5925 | 5928 | ||
| 5926 | void | 5929 | bool intel_dp_init(struct drm_device *dev, |
| 5927 | intel_dp_init(struct drm_device *dev, | 5930 | i915_reg_t output_reg, |
| 5928 | i915_reg_t output_reg, enum port port) | 5931 | enum port port) |
| 5929 | { | 5932 | { |
| 5930 | struct drm_i915_private *dev_priv = dev->dev_private; | 5933 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 5931 | struct intel_digital_port *intel_dig_port; | 5934 | struct intel_digital_port *intel_dig_port; |
| @@ -5935,7 +5938,7 @@ intel_dp_init(struct drm_device *dev, | |||
| 5935 | 5938 | ||
| 5936 | intel_dig_port = kzalloc(sizeof(*intel_dig_port), GFP_KERNEL); | 5939 | intel_dig_port = kzalloc(sizeof(*intel_dig_port), GFP_KERNEL); |
| 5937 | if (!intel_dig_port) | 5940 | if (!intel_dig_port) |
| 5938 | return; | 5941 | return false; |
| 5939 | 5942 | ||
| 5940 | intel_connector = intel_connector_alloc(); | 5943 | intel_connector = intel_connector_alloc(); |
| 5941 | if (!intel_connector) | 5944 | if (!intel_connector) |
| @@ -5992,7 +5995,7 @@ intel_dp_init(struct drm_device *dev, | |||
| 5992 | if (!intel_dp_init_connector(intel_dig_port, intel_connector)) | 5995 | if (!intel_dp_init_connector(intel_dig_port, intel_connector)) |
| 5993 | goto err_init_connector; | 5996 | goto err_init_connector; |
| 5994 | 5997 | ||
| 5995 | return; | 5998 | return true; |
| 5996 | 5999 | ||
| 5997 | err_init_connector: | 6000 | err_init_connector: |
| 5998 | drm_encoder_cleanup(encoder); | 6001 | drm_encoder_cleanup(encoder); |
| @@ -6000,8 +6003,7 @@ err_encoder_init: | |||
| 6000 | kfree(intel_connector); | 6003 | kfree(intel_connector); |
| 6001 | err_connector_alloc: | 6004 | err_connector_alloc: |
| 6002 | kfree(intel_dig_port); | 6005 | kfree(intel_dig_port); |
| 6003 | 6006 | return false; | |
| 6004 | return; | ||
| 6005 | } | 6007 | } |
| 6006 | 6008 | ||
| 6007 | void intel_dp_mst_suspend(struct drm_device *dev) | 6009 | void intel_dp_mst_suspend(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/i915/intel_dpll_mgr.c b/drivers/gpu/drm/i915/intel_dpll_mgr.c index 3ac705936b04..baf6f5584cbd 100644 --- a/drivers/gpu/drm/i915/intel_dpll_mgr.c +++ b/drivers/gpu/drm/i915/intel_dpll_mgr.c | |||
| @@ -366,6 +366,9 @@ ibx_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state, | |||
| 366 | DPLL_ID_PCH_PLL_B); | 366 | DPLL_ID_PCH_PLL_B); |
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | if (!pll) | ||
| 370 | return NULL; | ||
| 371 | |||
| 369 | /* reference the pll */ | 372 | /* reference the pll */ |
| 370 | intel_reference_shared_dpll(pll, crtc_state); | 373 | intel_reference_shared_dpll(pll, crtc_state); |
| 371 | 374 | ||
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index a28b4aac1e02..4a24b0067a3a 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
| @@ -1284,7 +1284,7 @@ void intel_csr_ucode_suspend(struct drm_i915_private *); | |||
| 1284 | void intel_csr_ucode_resume(struct drm_i915_private *); | 1284 | void intel_csr_ucode_resume(struct drm_i915_private *); |
| 1285 | 1285 | ||
| 1286 | /* intel_dp.c */ | 1286 | /* intel_dp.c */ |
| 1287 | void intel_dp_init(struct drm_device *dev, i915_reg_t output_reg, enum port port); | 1287 | bool intel_dp_init(struct drm_device *dev, i915_reg_t output_reg, enum port port); |
| 1288 | bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port, | 1288 | bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port, |
| 1289 | struct intel_connector *intel_connector); | 1289 | struct intel_connector *intel_connector); |
| 1290 | void intel_dp_set_link_params(struct intel_dp *intel_dp, | 1290 | void intel_dp_set_link_params(struct intel_dp *intel_dp, |
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c index 366ad6c67ce4..4756ef639648 100644 --- a/drivers/gpu/drm/i915/intel_dsi.c +++ b/drivers/gpu/drm/i915/intel_dsi.c | |||
| @@ -1545,6 +1545,9 @@ void intel_dsi_init(struct drm_device *dev) | |||
| 1545 | goto err; | 1545 | goto err; |
| 1546 | } | 1546 | } |
| 1547 | 1547 | ||
| 1548 | connector->display_info.width_mm = fixed_mode->width_mm; | ||
| 1549 | connector->display_info.height_mm = fixed_mode->height_mm; | ||
| 1550 | |||
| 1548 | intel_panel_init(&intel_connector->panel, fixed_mode, NULL); | 1551 | intel_panel_init(&intel_connector->panel, fixed_mode, NULL); |
| 1549 | 1552 | ||
| 1550 | intel_dsi_add_properties(intel_connector); | 1553 | intel_dsi_add_properties(intel_connector); |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 2c3bd9c2573e..a8844702d11b 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
| @@ -2142,6 +2142,9 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, | |||
| 2142 | enum port port = intel_dig_port->port; | 2142 | enum port port = intel_dig_port->port; |
| 2143 | uint8_t alternate_ddc_pin; | 2143 | uint8_t alternate_ddc_pin; |
| 2144 | 2144 | ||
| 2145 | DRM_DEBUG_KMS("Adding HDMI connector on port %c\n", | ||
| 2146 | port_name(port)); | ||
| 2147 | |||
| 2145 | if (WARN(intel_dig_port->max_lanes < 4, | 2148 | if (WARN(intel_dig_port->max_lanes < 4, |
| 2146 | "Not enough lanes (%d) for HDMI on port %c\n", | 2149 | "Not enough lanes (%d) for HDMI on port %c\n", |
| 2147 | intel_dig_port->max_lanes, port_name(port))) | 2150 | intel_dig_port->max_lanes, port_name(port))) |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index bc53c0dd34d0..96281e628d2a 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
| @@ -1082,6 +1082,8 @@ void intel_lvds_init(struct drm_device *dev) | |||
| 1082 | fixed_mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode); | 1082 | fixed_mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode); |
| 1083 | if (fixed_mode) { | 1083 | if (fixed_mode) { |
| 1084 | fixed_mode->type |= DRM_MODE_TYPE_PREFERRED; | 1084 | fixed_mode->type |= DRM_MODE_TYPE_PREFERRED; |
| 1085 | connector->display_info.width_mm = fixed_mode->width_mm; | ||
| 1086 | connector->display_info.height_mm = fixed_mode->height_mm; | ||
| 1085 | goto out; | 1087 | goto out; |
| 1086 | } | 1088 | } |
| 1087 | } | 1089 | } |
diff --git a/drivers/gpu/drm/i915/intel_vbt_defs.h b/drivers/gpu/drm/i915/intel_vbt_defs.h index c15051de8023..44fb0b35eed3 100644 --- a/drivers/gpu/drm/i915/intel_vbt_defs.h +++ b/drivers/gpu/drm/i915/intel_vbt_defs.h | |||
| @@ -403,9 +403,10 @@ struct lvds_dvo_timing { | |||
| 403 | u8 vsync_off:4; | 403 | u8 vsync_off:4; |
| 404 | u8 rsvd0:6; | 404 | u8 rsvd0:6; |
| 405 | u8 hsync_off_hi:2; | 405 | u8 hsync_off_hi:2; |
| 406 | u8 h_image; | 406 | u8 himage_lo; |
| 407 | u8 v_image; | 407 | u8 vimage_lo; |
| 408 | u8 max_hv; | 408 | u8 vimage_hi:4; |
| 409 | u8 himage_hi:4; | ||
| 409 | u8 h_border; | 410 | u8 h_border; |
| 410 | u8 v_border; | 411 | u8 v_border; |
| 411 | u8 rsvd1:3; | 412 | u8 rsvd1:3; |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c index 18fab3973ce5..62ad0300cfa5 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c | |||
| @@ -1614,7 +1614,7 @@ nvkm_device_pci_func = { | |||
| 1614 | .fini = nvkm_device_pci_fini, | 1614 | .fini = nvkm_device_pci_fini, |
| 1615 | .resource_addr = nvkm_device_pci_resource_addr, | 1615 | .resource_addr = nvkm_device_pci_resource_addr, |
| 1616 | .resource_size = nvkm_device_pci_resource_size, | 1616 | .resource_size = nvkm_device_pci_resource_size, |
| 1617 | .cpu_coherent = !IS_ENABLED(CONFIG_ARM) && !IS_ENABLED(CONFIG_ARM64), | 1617 | .cpu_coherent = !IS_ENABLED(CONFIG_ARM), |
| 1618 | }; | 1618 | }; |
| 1619 | 1619 | ||
| 1620 | int | 1620 | int |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c index 323c79abe468..41bd5d0f7692 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c | |||
| @@ -276,6 +276,8 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev) | |||
| 276 | struct pwr_rail_t *r = &stbl.rail[i]; | 276 | struct pwr_rail_t *r = &stbl.rail[i]; |
| 277 | struct nvkm_iccsense_rail *rail; | 277 | struct nvkm_iccsense_rail *rail; |
| 278 | struct nvkm_iccsense_sensor *sensor; | 278 | struct nvkm_iccsense_sensor *sensor; |
| 279 | int (*read)(struct nvkm_iccsense *, | ||
| 280 | struct nvkm_iccsense_rail *); | ||
| 279 | 281 | ||
| 280 | if (!r->mode || r->resistor_mohm == 0) | 282 | if (!r->mode || r->resistor_mohm == 0) |
| 281 | continue; | 283 | continue; |
| @@ -284,31 +286,31 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev) | |||
| 284 | if (!sensor) | 286 | if (!sensor) |
| 285 | continue; | 287 | continue; |
| 286 | 288 | ||
| 287 | rail = kmalloc(sizeof(*rail), GFP_KERNEL); | ||
| 288 | if (!rail) | ||
| 289 | return -ENOMEM; | ||
| 290 | |||
| 291 | switch (sensor->type) { | 289 | switch (sensor->type) { |
| 292 | case NVBIOS_EXTDEV_INA209: | 290 | case NVBIOS_EXTDEV_INA209: |
| 293 | if (r->rail != 0) | 291 | if (r->rail != 0) |
| 294 | continue; | 292 | continue; |
| 295 | rail->read = nvkm_iccsense_ina209_read; | 293 | read = nvkm_iccsense_ina209_read; |
| 296 | break; | 294 | break; |
| 297 | case NVBIOS_EXTDEV_INA219: | 295 | case NVBIOS_EXTDEV_INA219: |
| 298 | if (r->rail != 0) | 296 | if (r->rail != 0) |
| 299 | continue; | 297 | continue; |
| 300 | rail->read = nvkm_iccsense_ina219_read; | 298 | read = nvkm_iccsense_ina219_read; |
| 301 | break; | 299 | break; |
| 302 | case NVBIOS_EXTDEV_INA3221: | 300 | case NVBIOS_EXTDEV_INA3221: |
| 303 | if (r->rail >= 3) | 301 | if (r->rail >= 3) |
| 304 | continue; | 302 | continue; |
| 305 | rail->read = nvkm_iccsense_ina3221_read; | 303 | read = nvkm_iccsense_ina3221_read; |
| 306 | break; | 304 | break; |
| 307 | default: | 305 | default: |
| 308 | continue; | 306 | continue; |
| 309 | } | 307 | } |
| 310 | 308 | ||
| 309 | rail = kmalloc(sizeof(*rail), GFP_KERNEL); | ||
| 310 | if (!rail) | ||
| 311 | return -ENOMEM; | ||
| 311 | sensor->rail_mask |= 1 << r->rail; | 312 | sensor->rail_mask |= 1 << r->rail; |
| 313 | rail->read = read; | ||
| 312 | rail->sensor = sensor; | 314 | rail->sensor = sensor; |
| 313 | rail->idx = r->rail; | 315 | rail->idx = r->rail; |
| 314 | rail->mohm = r->resistor_mohm; | 316 | rail->mohm = r->resistor_mohm; |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 2e216e2ea78c..259cd6e6d71c 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
| @@ -589,7 +589,8 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
| 589 | if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE61(rdev) || ASIC_IS_DCE8(rdev)) | 589 | if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE61(rdev) || ASIC_IS_DCE8(rdev)) |
| 590 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; | 590 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; |
| 591 | /* use frac fb div on RS780/RS880 */ | 591 | /* use frac fb div on RS780/RS880 */ |
| 592 | if ((rdev->family == CHIP_RS780) || (rdev->family == CHIP_RS880)) | 592 | if (((rdev->family == CHIP_RS780) || (rdev->family == CHIP_RS880)) |
| 593 | && !radeon_crtc->ss_enabled) | ||
| 593 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; | 594 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; |
| 594 | if (ASIC_IS_DCE32(rdev) && mode->clock > 165000) | 595 | if (ASIC_IS_DCE32(rdev) && mode->clock > 165000) |
| 595 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; | 596 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; |
| @@ -626,7 +627,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
| 626 | if (radeon_crtc->ss.refdiv) { | 627 | if (radeon_crtc->ss.refdiv) { |
| 627 | radeon_crtc->pll_flags |= RADEON_PLL_USE_REF_DIV; | 628 | radeon_crtc->pll_flags |= RADEON_PLL_USE_REF_DIV; |
| 628 | radeon_crtc->pll_reference_div = radeon_crtc->ss.refdiv; | 629 | radeon_crtc->pll_reference_div = radeon_crtc->ss.refdiv; |
| 629 | if (ASIC_IS_AVIVO(rdev)) | 630 | if (rdev->family >= CHIP_RV770) |
| 630 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; | 631 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; |
| 631 | } | 632 | } |
| 632 | } | 633 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index e721e6b2766e..21c44b2293bc 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
| @@ -630,6 +630,23 @@ void radeon_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | |||
| 630 | /* | 630 | /* |
| 631 | * GPU helpers function. | 631 | * GPU helpers function. |
| 632 | */ | 632 | */ |
| 633 | |||
| 634 | /** | ||
| 635 | * radeon_device_is_virtual - check if we are running is a virtual environment | ||
| 636 | * | ||
| 637 | * Check if the asic has been passed through to a VM (all asics). | ||
| 638 | * Used at driver startup. | ||
| 639 | * Returns true if virtual or false if not. | ||
| 640 | */ | ||
| 641 | static bool radeon_device_is_virtual(void) | ||
| 642 | { | ||
| 643 | #ifdef CONFIG_X86 | ||
| 644 | return boot_cpu_has(X86_FEATURE_HYPERVISOR); | ||
| 645 | #else | ||
| 646 | return false; | ||
| 647 | #endif | ||
| 648 | } | ||
| 649 | |||
| 633 | /** | 650 | /** |
| 634 | * radeon_card_posted - check if the hw has already been initialized | 651 | * radeon_card_posted - check if the hw has already been initialized |
| 635 | * | 652 | * |
| @@ -643,6 +660,10 @@ bool radeon_card_posted(struct radeon_device *rdev) | |||
| 643 | { | 660 | { |
| 644 | uint32_t reg; | 661 | uint32_t reg; |
| 645 | 662 | ||
| 663 | /* for pass through, always force asic_init */ | ||
| 664 | if (radeon_device_is_virtual()) | ||
| 665 | return false; | ||
| 666 | |||
| 646 | /* required for EFI mode on macbook2,1 which uses an r5xx asic */ | 667 | /* required for EFI mode on macbook2,1 which uses an r5xx asic */ |
| 647 | if (efi_enabled(EFI_BOOT) && | 668 | if (efi_enabled(EFI_BOOT) && |
| 648 | (rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) && | 669 | (rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) && |
| @@ -1631,7 +1652,7 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, | |||
| 1631 | radeon_agp_suspend(rdev); | 1652 | radeon_agp_suspend(rdev); |
| 1632 | 1653 | ||
| 1633 | pci_save_state(dev->pdev); | 1654 | pci_save_state(dev->pdev); |
| 1634 | if (freeze && rdev->family >= CHIP_R600) { | 1655 | if (freeze && rdev->family >= CHIP_CEDAR) { |
| 1635 | rdev->asic->asic_reset(rdev, true); | 1656 | rdev->asic->asic_reset(rdev, true); |
| 1636 | pci_restore_state(dev->pdev); | 1657 | pci_restore_state(dev->pdev); |
| 1637 | } else if (suspend) { | 1658 | } else if (suspend) { |
diff --git a/drivers/hid/hid-elo.c b/drivers/hid/hid-elo.c index aad8c162a825..0cd4f7216239 100644 --- a/drivers/hid/hid-elo.c +++ b/drivers/hid/hid-elo.c | |||
| @@ -261,7 +261,7 @@ static void elo_remove(struct hid_device *hdev) | |||
| 261 | struct elo_priv *priv = hid_get_drvdata(hdev); | 261 | struct elo_priv *priv = hid_get_drvdata(hdev); |
| 262 | 262 | ||
| 263 | hid_hw_stop(hdev); | 263 | hid_hw_stop(hdev); |
| 264 | flush_workqueue(wq); | 264 | cancel_delayed_work_sync(&priv->work); |
| 265 | kfree(priv); | 265 | kfree(priv); |
| 266 | } | 266 | } |
| 267 | 267 | ||
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index c741f5e50a66..95b7d61d9910 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
| @@ -1401,6 +1401,11 @@ static const struct hid_device_id mt_devices[] = { | |||
| 1401 | MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK, | 1401 | MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK, |
| 1402 | USB_DEVICE_ID_NOVATEK_PCT) }, | 1402 | USB_DEVICE_ID_NOVATEK_PCT) }, |
| 1403 | 1403 | ||
| 1404 | /* Ntrig Panel */ | ||
| 1405 | { .driver_data = MT_CLS_NSMU, | ||
| 1406 | HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, | ||
| 1407 | USB_VENDOR_ID_NTRIG, 0x1b05) }, | ||
| 1408 | |||
| 1404 | /* PixArt optical touch screen */ | 1409 | /* PixArt optical touch screen */ |
| 1405 | { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER, | 1410 | { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER, |
| 1406 | MT_USB_DEVICE(USB_VENDOR_ID_PIXART, | 1411 | MT_USB_DEVICE(USB_VENDOR_ID_PIXART, |
diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 847d1b5f2c13..688be9e060fc 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c | |||
| @@ -300,13 +300,10 @@ int tmc_read_unprepare_etr(struct tmc_drvdata *drvdata) | |||
| 300 | if (local_read(&drvdata->mode) == CS_MODE_SYSFS) { | 300 | if (local_read(&drvdata->mode) == CS_MODE_SYSFS) { |
| 301 | /* | 301 | /* |
| 302 | * The trace run will continue with the same allocated trace | 302 | * The trace run will continue with the same allocated trace |
| 303 | * buffer. As such zero-out the buffer so that we don't end | 303 | * buffer. The trace buffer is cleared in tmc_etr_enable_hw(), |
| 304 | * up with stale data. | 304 | * so we don't have to explicitly clear it. Also, since the |
| 305 | * | 305 | * tracer is still enabled drvdata::buf can't be NULL. |
| 306 | * Since the tracer is still enabled drvdata::buf | ||
| 307 | * can't be NULL. | ||
| 308 | */ | 306 | */ |
| 309 | memset(drvdata->buf, 0, drvdata->size); | ||
| 310 | tmc_etr_enable_hw(drvdata); | 307 | tmc_etr_enable_hw(drvdata); |
| 311 | } else { | 308 | } else { |
| 312 | /* | 309 | /* |
| @@ -315,7 +312,7 @@ int tmc_read_unprepare_etr(struct tmc_drvdata *drvdata) | |||
| 315 | */ | 312 | */ |
| 316 | vaddr = drvdata->vaddr; | 313 | vaddr = drvdata->vaddr; |
| 317 | paddr = drvdata->paddr; | 314 | paddr = drvdata->paddr; |
| 318 | drvdata->buf = NULL; | 315 | drvdata->buf = drvdata->vaddr = NULL; |
| 319 | } | 316 | } |
| 320 | 317 | ||
| 321 | drvdata->reading = false; | 318 | drvdata->reading = false; |
diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 5443d03a1eec..d08d1ab9bba5 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c | |||
| @@ -385,7 +385,6 @@ static int _coresight_build_path(struct coresight_device *csdev, | |||
| 385 | int i; | 385 | int i; |
| 386 | bool found = false; | 386 | bool found = false; |
| 387 | struct coresight_node *node; | 387 | struct coresight_node *node; |
| 388 | struct coresight_connection *conn; | ||
| 389 | 388 | ||
| 390 | /* An activated sink has been found. Enqueue the element */ | 389 | /* An activated sink has been found. Enqueue the element */ |
| 391 | if ((csdev->type == CORESIGHT_DEV_TYPE_SINK || | 390 | if ((csdev->type == CORESIGHT_DEV_TYPE_SINK || |
| @@ -394,8 +393,9 @@ static int _coresight_build_path(struct coresight_device *csdev, | |||
| 394 | 393 | ||
| 395 | /* Not a sink - recursively explore each port found on this element */ | 394 | /* Not a sink - recursively explore each port found on this element */ |
| 396 | for (i = 0; i < csdev->nr_outport; i++) { | 395 | for (i = 0; i < csdev->nr_outport; i++) { |
| 397 | conn = &csdev->conns[i]; | 396 | struct coresight_device *child_dev = csdev->conns[i].child_dev; |
| 398 | if (_coresight_build_path(conn->child_dev, path) == 0) { | 397 | |
| 398 | if (child_dev && _coresight_build_path(child_dev, path) == 0) { | ||
| 399 | found = true; | 399 | found = true; |
| 400 | break; | 400 | break; |
| 401 | } | 401 | } |
| @@ -425,6 +425,7 @@ out: | |||
| 425 | struct list_head *coresight_build_path(struct coresight_device *csdev) | 425 | struct list_head *coresight_build_path(struct coresight_device *csdev) |
| 426 | { | 426 | { |
| 427 | struct list_head *path; | 427 | struct list_head *path; |
| 428 | int rc; | ||
| 428 | 429 | ||
| 429 | path = kzalloc(sizeof(struct list_head), GFP_KERNEL); | 430 | path = kzalloc(sizeof(struct list_head), GFP_KERNEL); |
| 430 | if (!path) | 431 | if (!path) |
| @@ -432,9 +433,10 @@ struct list_head *coresight_build_path(struct coresight_device *csdev) | |||
| 432 | 433 | ||
| 433 | INIT_LIST_HEAD(path); | 434 | INIT_LIST_HEAD(path); |
| 434 | 435 | ||
| 435 | if (_coresight_build_path(csdev, path)) { | 436 | rc = _coresight_build_path(csdev, path); |
| 437 | if (rc) { | ||
| 436 | kfree(path); | 438 | kfree(path); |
| 437 | path = NULL; | 439 | return ERR_PTR(rc); |
| 438 | } | 440 | } |
| 439 | 441 | ||
| 440 | return path; | 442 | return path; |
| @@ -507,8 +509,9 @@ int coresight_enable(struct coresight_device *csdev) | |||
| 507 | goto out; | 509 | goto out; |
| 508 | 510 | ||
| 509 | path = coresight_build_path(csdev); | 511 | path = coresight_build_path(csdev); |
| 510 | if (!path) { | 512 | if (IS_ERR(path)) { |
| 511 | pr_err("building path(s) failed\n"); | 513 | pr_err("building path(s) failed\n"); |
| 514 | ret = PTR_ERR(path); | ||
| 512 | goto out; | 515 | goto out; |
| 513 | } | 516 | } |
| 514 | 517 | ||
diff --git a/drivers/iio/accel/st_accel_buffer.c b/drivers/iio/accel/st_accel_buffer.c index a1e642ee13d6..7fddc137e91e 100644 --- a/drivers/iio/accel/st_accel_buffer.c +++ b/drivers/iio/accel/st_accel_buffer.c | |||
| @@ -91,7 +91,7 @@ static const struct iio_buffer_setup_ops st_accel_buffer_setup_ops = { | |||
| 91 | 91 | ||
| 92 | int st_accel_allocate_ring(struct iio_dev *indio_dev) | 92 | int st_accel_allocate_ring(struct iio_dev *indio_dev) |
| 93 | { | 93 | { |
| 94 | return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, | 94 | return iio_triggered_buffer_setup(indio_dev, NULL, |
| 95 | &st_sensors_trigger_handler, &st_accel_buffer_setup_ops); | 95 | &st_sensors_trigger_handler, &st_accel_buffer_setup_ops); |
| 96 | } | 96 | } |
| 97 | 97 | ||
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c index dc73f2d85e6d..4d95bfc4786c 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c | |||
| @@ -741,6 +741,7 @@ static const struct iio_info accel_info = { | |||
| 741 | static const struct iio_trigger_ops st_accel_trigger_ops = { | 741 | static const struct iio_trigger_ops st_accel_trigger_ops = { |
| 742 | .owner = THIS_MODULE, | 742 | .owner = THIS_MODULE, |
| 743 | .set_trigger_state = ST_ACCEL_TRIGGER_SET_STATE, | 743 | .set_trigger_state = ST_ACCEL_TRIGGER_SET_STATE, |
| 744 | .validate_device = st_sensors_validate_device, | ||
| 744 | }; | 745 | }; |
| 745 | #define ST_ACCEL_TRIGGER_OPS (&st_accel_trigger_ops) | 746 | #define ST_ACCEL_TRIGGER_OPS (&st_accel_trigger_ops) |
| 746 | #else | 747 | #else |
diff --git a/drivers/iio/common/st_sensors/st_sensors_buffer.c b/drivers/iio/common/st_sensors/st_sensors_buffer.c index c55898543a47..f1693dbebb8a 100644 --- a/drivers/iio/common/st_sensors/st_sensors_buffer.c +++ b/drivers/iio/common/st_sensors/st_sensors_buffer.c | |||
| @@ -57,31 +57,20 @@ irqreturn_t st_sensors_trigger_handler(int irq, void *p) | |||
| 57 | struct iio_poll_func *pf = p; | 57 | struct iio_poll_func *pf = p; |
| 58 | struct iio_dev *indio_dev = pf->indio_dev; | 58 | struct iio_dev *indio_dev = pf->indio_dev; |
| 59 | struct st_sensor_data *sdata = iio_priv(indio_dev); | 59 | struct st_sensor_data *sdata = iio_priv(indio_dev); |
| 60 | s64 timestamp; | ||
| 60 | 61 | ||
| 61 | /* If we have a status register, check if this IRQ came from us */ | 62 | /* If we do timetamping here, do it before reading the values */ |
| 62 | if (sdata->sensor_settings->drdy_irq.addr_stat_drdy) { | 63 | if (sdata->hw_irq_trigger) |
| 63 | u8 status; | 64 | timestamp = sdata->hw_timestamp; |
| 64 | 65 | else | |
| 65 | len = sdata->tf->read_byte(&sdata->tb, sdata->dev, | 66 | timestamp = iio_get_time_ns(); |
| 66 | sdata->sensor_settings->drdy_irq.addr_stat_drdy, | ||
| 67 | &status); | ||
| 68 | if (len < 0) | ||
| 69 | dev_err(sdata->dev, "could not read channel status\n"); | ||
| 70 | |||
| 71 | /* | ||
| 72 | * If this was not caused by any channels on this sensor, | ||
| 73 | * return IRQ_NONE | ||
| 74 | */ | ||
| 75 | if (!(status & (u8)indio_dev->active_scan_mask[0])) | ||
| 76 | return IRQ_NONE; | ||
| 77 | } | ||
| 78 | 67 | ||
| 79 | len = st_sensors_get_buffer_element(indio_dev, sdata->buffer_data); | 68 | len = st_sensors_get_buffer_element(indio_dev, sdata->buffer_data); |
| 80 | if (len < 0) | 69 | if (len < 0) |
| 81 | goto st_sensors_get_buffer_element_error; | 70 | goto st_sensors_get_buffer_element_error; |
| 82 | 71 | ||
| 83 | iio_push_to_buffers_with_timestamp(indio_dev, sdata->buffer_data, | 72 | iio_push_to_buffers_with_timestamp(indio_dev, sdata->buffer_data, |
| 84 | pf->timestamp); | 73 | timestamp); |
| 85 | 74 | ||
| 86 | st_sensors_get_buffer_element_error: | 75 | st_sensors_get_buffer_element_error: |
| 87 | iio_trigger_notify_done(indio_dev->trig); | 76 | iio_trigger_notify_done(indio_dev->trig); |
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index dffe00692169..9e59c90f6a8d 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c | |||
| @@ -363,6 +363,11 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, | |||
| 363 | if (err < 0) | 363 | if (err < 0) |
| 364 | return err; | 364 | return err; |
| 365 | 365 | ||
| 366 | /* Disable DRDY, this might be still be enabled after reboot. */ | ||
| 367 | err = st_sensors_set_dataready_irq(indio_dev, false); | ||
| 368 | if (err < 0) | ||
| 369 | return err; | ||
| 370 | |||
| 366 | if (sdata->current_fullscale) { | 371 | if (sdata->current_fullscale) { |
| 367 | err = st_sensors_set_fullscale(indio_dev, | 372 | err = st_sensors_set_fullscale(indio_dev, |
| 368 | sdata->current_fullscale->num); | 373 | sdata->current_fullscale->num); |
| @@ -424,6 +429,9 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable) | |||
| 424 | else | 429 | else |
| 425 | drdy_mask = sdata->sensor_settings->drdy_irq.mask_int2; | 430 | drdy_mask = sdata->sensor_settings->drdy_irq.mask_int2; |
| 426 | 431 | ||
| 432 | /* Flag to the poll function that the hardware trigger is in use */ | ||
| 433 | sdata->hw_irq_trigger = enable; | ||
| 434 | |||
| 427 | /* Enable/Disable the interrupt generator for data ready. */ | 435 | /* Enable/Disable the interrupt generator for data ready. */ |
| 428 | err = st_sensors_write_data_with_mask(indio_dev, | 436 | err = st_sensors_write_data_with_mask(indio_dev, |
| 429 | sdata->sensor_settings->drdy_irq.addr, | 437 | sdata->sensor_settings->drdy_irq.addr, |
diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c index da72279fcf99..296e4ff19ae8 100644 --- a/drivers/iio/common/st_sensors/st_sensors_trigger.c +++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c | |||
| @@ -17,6 +17,73 @@ | |||
| 17 | #include <linux/iio/common/st_sensors.h> | 17 | #include <linux/iio/common/st_sensors.h> |
| 18 | #include "st_sensors_core.h" | 18 | #include "st_sensors_core.h" |
| 19 | 19 | ||
| 20 | /** | ||
| 21 | * st_sensors_irq_handler() - top half of the IRQ-based triggers | ||
| 22 | * @irq: irq number | ||
| 23 | * @p: private handler data | ||
| 24 | */ | ||
| 25 | irqreturn_t st_sensors_irq_handler(int irq, void *p) | ||
| 26 | { | ||
| 27 | struct iio_trigger *trig = p; | ||
| 28 | struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); | ||
| 29 | struct st_sensor_data *sdata = iio_priv(indio_dev); | ||
| 30 | |||
| 31 | /* Get the time stamp as close in time as possible */ | ||
| 32 | sdata->hw_timestamp = iio_get_time_ns(); | ||
| 33 | return IRQ_WAKE_THREAD; | ||
| 34 | } | ||
| 35 | |||
| 36 | /** | ||
| 37 | * st_sensors_irq_thread() - bottom half of the IRQ-based triggers | ||
| 38 | * @irq: irq number | ||
| 39 | * @p: private handler data | ||
| 40 | */ | ||
| 41 | irqreturn_t st_sensors_irq_thread(int irq, void *p) | ||
| 42 | { | ||
| 43 | struct iio_trigger *trig = p; | ||
| 44 | struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); | ||
| 45 | struct st_sensor_data *sdata = iio_priv(indio_dev); | ||
| 46 | int ret; | ||
| 47 | |||
| 48 | /* | ||
| 49 | * If this trigger is backed by a hardware interrupt and we have a | ||
| 50 | * status register, check if this IRQ came from us | ||
| 51 | */ | ||
| 52 | if (sdata->sensor_settings->drdy_irq.addr_stat_drdy) { | ||
| 53 | u8 status; | ||
| 54 | |||
| 55 | ret = sdata->tf->read_byte(&sdata->tb, sdata->dev, | ||
| 56 | sdata->sensor_settings->drdy_irq.addr_stat_drdy, | ||
| 57 | &status); | ||
| 58 | if (ret < 0) { | ||
| 59 | dev_err(sdata->dev, "could not read channel status\n"); | ||
| 60 | goto out_poll; | ||
| 61 | } | ||
| 62 | /* | ||
| 63 | * the lower bits of .active_scan_mask[0] is directly mapped | ||
| 64 | * to the channels on the sensor: either bit 0 for | ||
| 65 | * one-dimensional sensors, or e.g. x,y,z for accelerometers, | ||
| 66 | * gyroscopes or magnetometers. No sensor use more than 3 | ||
| 67 | * channels, so cut the other status bits here. | ||
| 68 | */ | ||
| 69 | status &= 0x07; | ||
| 70 | |||
| 71 | /* | ||
| 72 | * If this was not caused by any channels on this sensor, | ||
| 73 | * return IRQ_NONE | ||
| 74 | */ | ||
| 75 | if (!indio_dev->active_scan_mask) | ||
| 76 | return IRQ_NONE; | ||
| 77 | if (!(status & (u8)indio_dev->active_scan_mask[0])) | ||
| 78 | return IRQ_NONE; | ||
| 79 | } | ||
| 80 | |||
| 81 | out_poll: | ||
| 82 | /* It's our IRQ: proceed to handle the register polling */ | ||
| 83 | iio_trigger_poll_chained(p); | ||
| 84 | return IRQ_HANDLED; | ||
| 85 | } | ||
| 86 | |||
| 20 | int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | 87 | int st_sensors_allocate_trigger(struct iio_dev *indio_dev, |
| 21 | const struct iio_trigger_ops *trigger_ops) | 88 | const struct iio_trigger_ops *trigger_ops) |
| 22 | { | 89 | { |
| @@ -30,6 +97,10 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | |||
| 30 | return -ENOMEM; | 97 | return -ENOMEM; |
| 31 | } | 98 | } |
| 32 | 99 | ||
| 100 | iio_trigger_set_drvdata(sdata->trig, indio_dev); | ||
| 101 | sdata->trig->ops = trigger_ops; | ||
| 102 | sdata->trig->dev.parent = sdata->dev; | ||
| 103 | |||
| 33 | irq = sdata->get_irq_data_ready(indio_dev); | 104 | irq = sdata->get_irq_data_ready(indio_dev); |
| 34 | irq_trig = irqd_get_trigger_type(irq_get_irq_data(irq)); | 105 | irq_trig = irqd_get_trigger_type(irq_get_irq_data(irq)); |
| 35 | /* | 106 | /* |
| @@ -77,9 +148,12 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | |||
| 77 | sdata->sensor_settings->drdy_irq.addr_stat_drdy) | 148 | sdata->sensor_settings->drdy_irq.addr_stat_drdy) |
| 78 | irq_trig |= IRQF_SHARED; | 149 | irq_trig |= IRQF_SHARED; |
| 79 | 150 | ||
| 80 | err = request_threaded_irq(irq, | 151 | /* Let's create an interrupt thread masking the hard IRQ here */ |
| 81 | iio_trigger_generic_data_rdy_poll, | 152 | irq_trig |= IRQF_ONESHOT; |
| 82 | NULL, | 153 | |
| 154 | err = request_threaded_irq(sdata->get_irq_data_ready(indio_dev), | ||
| 155 | st_sensors_irq_handler, | ||
| 156 | st_sensors_irq_thread, | ||
| 83 | irq_trig, | 157 | irq_trig, |
| 84 | sdata->trig->name, | 158 | sdata->trig->name, |
| 85 | sdata->trig); | 159 | sdata->trig); |
| @@ -88,10 +162,6 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | |||
| 88 | goto iio_trigger_free; | 162 | goto iio_trigger_free; |
| 89 | } | 163 | } |
| 90 | 164 | ||
| 91 | iio_trigger_set_drvdata(sdata->trig, indio_dev); | ||
| 92 | sdata->trig->ops = trigger_ops; | ||
| 93 | sdata->trig->dev.parent = sdata->dev; | ||
| 94 | |||
| 95 | err = iio_trigger_register(sdata->trig); | 165 | err = iio_trigger_register(sdata->trig); |
| 96 | if (err < 0) { | 166 | if (err < 0) { |
| 97 | dev_err(&indio_dev->dev, "failed to register iio trigger.\n"); | 167 | dev_err(&indio_dev->dev, "failed to register iio trigger.\n"); |
| @@ -119,6 +189,18 @@ void st_sensors_deallocate_trigger(struct iio_dev *indio_dev) | |||
| 119 | } | 189 | } |
| 120 | EXPORT_SYMBOL(st_sensors_deallocate_trigger); | 190 | EXPORT_SYMBOL(st_sensors_deallocate_trigger); |
| 121 | 191 | ||
| 192 | int st_sensors_validate_device(struct iio_trigger *trig, | ||
| 193 | struct iio_dev *indio_dev) | ||
| 194 | { | ||
| 195 | struct iio_dev *indio = iio_trigger_get_drvdata(trig); | ||
| 196 | |||
| 197 | if (indio != indio_dev) | ||
| 198 | return -EINVAL; | ||
| 199 | |||
| 200 | return 0; | ||
| 201 | } | ||
| 202 | EXPORT_SYMBOL(st_sensors_validate_device); | ||
| 203 | |||
| 122 | MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>"); | 204 | MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>"); |
| 123 | MODULE_DESCRIPTION("STMicroelectronics ST-sensors trigger"); | 205 | MODULE_DESCRIPTION("STMicroelectronics ST-sensors trigger"); |
| 124 | MODULE_LICENSE("GPL v2"); | 206 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig index e63b957c985f..f7c71da42f15 100644 --- a/drivers/iio/dac/Kconfig +++ b/drivers/iio/dac/Kconfig | |||
| @@ -247,7 +247,7 @@ config MCP4922 | |||
| 247 | 247 | ||
| 248 | config STX104 | 248 | config STX104 |
| 249 | tristate "Apex Embedded Systems STX104 DAC driver" | 249 | tristate "Apex Embedded Systems STX104 DAC driver" |
| 250 | depends on X86 && ISA | 250 | depends on X86 && ISA_BUS_API |
| 251 | help | 251 | help |
| 252 | Say yes here to build support for the 2-channel DAC on the Apex | 252 | Say yes here to build support for the 2-channel DAC on the Apex |
| 253 | Embedded Systems STX104 integrated analog PC/104 card. The base port | 253 | Embedded Systems STX104 integrated analog PC/104 card. The base port |
diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c index 948f600e7059..69bde5909854 100644 --- a/drivers/iio/dac/ad5592r-base.c +++ b/drivers/iio/dac/ad5592r-base.c | |||
| @@ -525,7 +525,7 @@ static int ad5592r_alloc_channels(struct ad5592r_state *st) | |||
| 525 | 525 | ||
| 526 | device_for_each_child_node(st->dev, child) { | 526 | device_for_each_child_node(st->dev, child) { |
| 527 | ret = fwnode_property_read_u32(child, "reg", ®); | 527 | ret = fwnode_property_read_u32(child, "reg", ®); |
| 528 | if (ret || reg > ARRAY_SIZE(st->channel_modes)) | 528 | if (ret || reg >= ARRAY_SIZE(st->channel_modes)) |
| 529 | continue; | 529 | continue; |
| 530 | 530 | ||
| 531 | ret = fwnode_property_read_u32(child, "adi,mode", &tmp); | 531 | ret = fwnode_property_read_u32(child, "adi,mode", &tmp); |
diff --git a/drivers/iio/gyro/st_gyro_buffer.c b/drivers/iio/gyro/st_gyro_buffer.c index d67b17b6a7aa..a5377044e42f 100644 --- a/drivers/iio/gyro/st_gyro_buffer.c +++ b/drivers/iio/gyro/st_gyro_buffer.c | |||
| @@ -91,7 +91,7 @@ static const struct iio_buffer_setup_ops st_gyro_buffer_setup_ops = { | |||
| 91 | 91 | ||
| 92 | int st_gyro_allocate_ring(struct iio_dev *indio_dev) | 92 | int st_gyro_allocate_ring(struct iio_dev *indio_dev) |
| 93 | { | 93 | { |
| 94 | return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, | 94 | return iio_triggered_buffer_setup(indio_dev, NULL, |
| 95 | &st_sensors_trigger_handler, &st_gyro_buffer_setup_ops); | 95 | &st_sensors_trigger_handler, &st_gyro_buffer_setup_ops); |
| 96 | } | 96 | } |
| 97 | 97 | ||
diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c index 52a3c87c375c..a8012955a1f6 100644 --- a/drivers/iio/gyro/st_gyro_core.c +++ b/drivers/iio/gyro/st_gyro_core.c | |||
| @@ -409,6 +409,7 @@ static const struct iio_info gyro_info = { | |||
| 409 | static const struct iio_trigger_ops st_gyro_trigger_ops = { | 409 | static const struct iio_trigger_ops st_gyro_trigger_ops = { |
| 410 | .owner = THIS_MODULE, | 410 | .owner = THIS_MODULE, |
| 411 | .set_trigger_state = ST_GYRO_TRIGGER_SET_STATE, | 411 | .set_trigger_state = ST_GYRO_TRIGGER_SET_STATE, |
| 412 | .validate_device = st_sensors_validate_device, | ||
| 412 | }; | 413 | }; |
| 413 | #define ST_GYRO_TRIGGER_OPS (&st_gyro_trigger_ops) | 414 | #define ST_GYRO_TRIGGER_OPS (&st_gyro_trigger_ops) |
| 414 | #else | 415 | #else |
diff --git a/drivers/iio/humidity/am2315.c b/drivers/iio/humidity/am2315.c index 3be6d209a159..11535911a5c6 100644 --- a/drivers/iio/humidity/am2315.c +++ b/drivers/iio/humidity/am2315.c | |||
| @@ -165,10 +165,8 @@ static irqreturn_t am2315_trigger_handler(int irq, void *p) | |||
| 165 | struct am2315_sensor_data sensor_data; | 165 | struct am2315_sensor_data sensor_data; |
| 166 | 166 | ||
| 167 | ret = am2315_read_data(data, &sensor_data); | 167 | ret = am2315_read_data(data, &sensor_data); |
| 168 | if (ret < 0) { | 168 | if (ret < 0) |
| 169 | mutex_unlock(&data->lock); | ||
| 170 | goto err; | 169 | goto err; |
| 171 | } | ||
| 172 | 170 | ||
| 173 | mutex_lock(&data->lock); | 171 | mutex_lock(&data->lock); |
| 174 | if (*(indio_dev->active_scan_mask) == AM2315_ALL_CHANNEL_MASK) { | 172 | if (*(indio_dev->active_scan_mask) == AM2315_ALL_CHANNEL_MASK) { |
diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c index fa4767613173..a03832a5fc95 100644 --- a/drivers/iio/humidity/hdc100x.c +++ b/drivers/iio/humidity/hdc100x.c | |||
| @@ -55,7 +55,7 @@ static const struct { | |||
| 55 | }, | 55 | }, |
| 56 | { /* IIO_HUMIDITYRELATIVE channel */ | 56 | { /* IIO_HUMIDITYRELATIVE channel */ |
| 57 | .shift = 8, | 57 | .shift = 8, |
| 58 | .mask = 2, | 58 | .mask = 3, |
| 59 | }, | 59 | }, |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| @@ -164,14 +164,14 @@ static int hdc100x_get_measurement(struct hdc100x_data *data, | |||
| 164 | dev_err(&client->dev, "cannot read high byte measurement"); | 164 | dev_err(&client->dev, "cannot read high byte measurement"); |
| 165 | return ret; | 165 | return ret; |
| 166 | } | 166 | } |
| 167 | val = ret << 6; | 167 | val = ret << 8; |
| 168 | 168 | ||
| 169 | ret = i2c_smbus_read_byte(client); | 169 | ret = i2c_smbus_read_byte(client); |
| 170 | if (ret < 0) { | 170 | if (ret < 0) { |
| 171 | dev_err(&client->dev, "cannot read low byte measurement"); | 171 | dev_err(&client->dev, "cannot read low byte measurement"); |
| 172 | return ret; | 172 | return ret; |
| 173 | } | 173 | } |
| 174 | val |= ret >> 2; | 174 | val |= ret; |
| 175 | 175 | ||
| 176 | return val; | 176 | return val; |
| 177 | } | 177 | } |
| @@ -211,18 +211,18 @@ static int hdc100x_read_raw(struct iio_dev *indio_dev, | |||
| 211 | return IIO_VAL_INT_PLUS_MICRO; | 211 | return IIO_VAL_INT_PLUS_MICRO; |
| 212 | case IIO_CHAN_INFO_SCALE: | 212 | case IIO_CHAN_INFO_SCALE: |
| 213 | if (chan->type == IIO_TEMP) { | 213 | if (chan->type == IIO_TEMP) { |
| 214 | *val = 165; | 214 | *val = 165000; |
| 215 | *val2 = 65536 >> 2; | 215 | *val2 = 65536; |
| 216 | return IIO_VAL_FRACTIONAL; | 216 | return IIO_VAL_FRACTIONAL; |
| 217 | } else { | 217 | } else { |
| 218 | *val = 0; | 218 | *val = 100; |
| 219 | *val2 = 10000; | 219 | *val2 = 65536; |
| 220 | return IIO_VAL_INT_PLUS_MICRO; | 220 | return IIO_VAL_FRACTIONAL; |
| 221 | } | 221 | } |
| 222 | break; | 222 | break; |
| 223 | case IIO_CHAN_INFO_OFFSET: | 223 | case IIO_CHAN_INFO_OFFSET: |
| 224 | *val = -3971; | 224 | *val = -15887; |
| 225 | *val2 = 879096; | 225 | *val2 = 515151; |
| 226 | return IIO_VAL_INT_PLUS_MICRO; | 226 | return IIO_VAL_INT_PLUS_MICRO; |
| 227 | default: | 227 | default: |
| 228 | return -EINVAL; | 228 | return -EINVAL; |
diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c index 0bf92b06d7d8..b8a290ec984e 100644 --- a/drivers/iio/imu/bmi160/bmi160_core.c +++ b/drivers/iio/imu/bmi160/bmi160_core.c | |||
| @@ -209,11 +209,11 @@ static const struct bmi160_scale_item bmi160_scale_table[] = { | |||
| 209 | }; | 209 | }; |
| 210 | 210 | ||
| 211 | static const struct bmi160_odr bmi160_accel_odr[] = { | 211 | static const struct bmi160_odr bmi160_accel_odr[] = { |
| 212 | {0x01, 0, 78125}, | 212 | {0x01, 0, 781250}, |
| 213 | {0x02, 1, 5625}, | 213 | {0x02, 1, 562500}, |
| 214 | {0x03, 3, 125}, | 214 | {0x03, 3, 125000}, |
| 215 | {0x04, 6, 25}, | 215 | {0x04, 6, 250000}, |
| 216 | {0x05, 12, 5}, | 216 | {0x05, 12, 500000}, |
| 217 | {0x06, 25, 0}, | 217 | {0x06, 25, 0}, |
| 218 | {0x07, 50, 0}, | 218 | {0x07, 50, 0}, |
| 219 | {0x08, 100, 0}, | 219 | {0x08, 100, 0}, |
| @@ -229,7 +229,7 @@ static const struct bmi160_odr bmi160_gyro_odr[] = { | |||
| 229 | {0x08, 100, 0}, | 229 | {0x08, 100, 0}, |
| 230 | {0x09, 200, 0}, | 230 | {0x09, 200, 0}, |
| 231 | {0x0A, 400, 0}, | 231 | {0x0A, 400, 0}, |
| 232 | {0x0B, 8000, 0}, | 232 | {0x0B, 800, 0}, |
| 233 | {0x0C, 1600, 0}, | 233 | {0x0C, 1600, 0}, |
| 234 | {0x0D, 3200, 0}, | 234 | {0x0D, 3200, 0}, |
| 235 | }; | 235 | }; |
| @@ -364,8 +364,8 @@ int bmi160_set_odr(struct bmi160_data *data, enum bmi160_sensor_type t, | |||
| 364 | 364 | ||
| 365 | return regmap_update_bits(data->regmap, | 365 | return regmap_update_bits(data->regmap, |
| 366 | bmi160_regs[t].config, | 366 | bmi160_regs[t].config, |
| 367 | bmi160_odr_table[t].tbl[i].bits, | 367 | bmi160_regs[t].config_odr_mask, |
| 368 | bmi160_regs[t].config_odr_mask); | 368 | bmi160_odr_table[t].tbl[i].bits); |
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | static int bmi160_get_odr(struct bmi160_data *data, enum bmi160_sensor_type t, | 371 | static int bmi160_get_odr(struct bmi160_data *data, enum bmi160_sensor_type t, |
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index ae2806aafb72..0c52dfe64977 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c | |||
| @@ -210,22 +210,35 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig, | |||
| 210 | 210 | ||
| 211 | /* Prevent the module from being removed whilst attached to a trigger */ | 211 | /* Prevent the module from being removed whilst attached to a trigger */ |
| 212 | __module_get(pf->indio_dev->info->driver_module); | 212 | __module_get(pf->indio_dev->info->driver_module); |
| 213 | |||
| 214 | /* Get irq number */ | ||
| 213 | pf->irq = iio_trigger_get_irq(trig); | 215 | pf->irq = iio_trigger_get_irq(trig); |
| 216 | if (pf->irq < 0) | ||
| 217 | goto out_put_module; | ||
| 218 | |||
| 219 | /* Request irq */ | ||
| 214 | ret = request_threaded_irq(pf->irq, pf->h, pf->thread, | 220 | ret = request_threaded_irq(pf->irq, pf->h, pf->thread, |
| 215 | pf->type, pf->name, | 221 | pf->type, pf->name, |
| 216 | pf); | 222 | pf); |
| 217 | if (ret < 0) { | 223 | if (ret < 0) |
| 218 | module_put(pf->indio_dev->info->driver_module); | 224 | goto out_put_irq; |
| 219 | return ret; | ||
| 220 | } | ||
| 221 | 225 | ||
| 226 | /* Enable trigger in driver */ | ||
| 222 | if (trig->ops && trig->ops->set_trigger_state && notinuse) { | 227 | if (trig->ops && trig->ops->set_trigger_state && notinuse) { |
| 223 | ret = trig->ops->set_trigger_state(trig, true); | 228 | ret = trig->ops->set_trigger_state(trig, true); |
| 224 | if (ret < 0) | 229 | if (ret < 0) |
| 225 | module_put(pf->indio_dev->info->driver_module); | 230 | goto out_free_irq; |
| 226 | } | 231 | } |
| 227 | 232 | ||
| 228 | return ret; | 233 | return ret; |
| 234 | |||
| 235 | out_free_irq: | ||
| 236 | free_irq(pf->irq, pf); | ||
| 237 | out_put_irq: | ||
| 238 | iio_trigger_put_irq(trig, pf->irq); | ||
| 239 | out_put_module: | ||
| 240 | module_put(pf->indio_dev->info->driver_module); | ||
| 241 | return ret; | ||
| 229 | } | 242 | } |
| 230 | 243 | ||
| 231 | static int iio_trigger_detach_poll_func(struct iio_trigger *trig, | 244 | static int iio_trigger_detach_poll_func(struct iio_trigger *trig, |
diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c index b4dbb3912977..651d57b8abbf 100644 --- a/drivers/iio/light/apds9960.c +++ b/drivers/iio/light/apds9960.c | |||
| @@ -1011,6 +1011,7 @@ static int apds9960_probe(struct i2c_client *client, | |||
| 1011 | 1011 | ||
| 1012 | iio_device_attach_buffer(indio_dev, buffer); | 1012 | iio_device_attach_buffer(indio_dev, buffer); |
| 1013 | 1013 | ||
| 1014 | indio_dev->dev.parent = &client->dev; | ||
| 1014 | indio_dev->info = &apds9960_info; | 1015 | indio_dev->info = &apds9960_info; |
| 1015 | indio_dev->name = APDS9960_DRV_NAME; | 1016 | indio_dev->name = APDS9960_DRV_NAME; |
| 1016 | indio_dev->channels = apds9960_channels; | 1017 | indio_dev->channels = apds9960_channels; |
diff --git a/drivers/iio/light/bh1780.c b/drivers/iio/light/bh1780.c index 72b364e4aa72..b54dcba05a82 100644 --- a/drivers/iio/light/bh1780.c +++ b/drivers/iio/light/bh1780.c | |||
| @@ -84,7 +84,7 @@ static int bh1780_debugfs_reg_access(struct iio_dev *indio_dev, | |||
| 84 | int ret; | 84 | int ret; |
| 85 | 85 | ||
| 86 | if (!readval) | 86 | if (!readval) |
| 87 | bh1780_write(bh1780, (u8)reg, (u8)writeval); | 87 | return bh1780_write(bh1780, (u8)reg, (u8)writeval); |
| 88 | 88 | ||
| 89 | ret = bh1780_read(bh1780, (u8)reg); | 89 | ret = bh1780_read(bh1780, (u8)reg); |
| 90 | if (ret < 0) | 90 | if (ret < 0) |
| @@ -187,7 +187,7 @@ static int bh1780_probe(struct i2c_client *client, | |||
| 187 | 187 | ||
| 188 | indio_dev->dev.parent = &client->dev; | 188 | indio_dev->dev.parent = &client->dev; |
| 189 | indio_dev->info = &bh1780_info; | 189 | indio_dev->info = &bh1780_info; |
| 190 | indio_dev->name = id->name; | 190 | indio_dev->name = "bh1780"; |
| 191 | indio_dev->channels = bh1780_channels; | 191 | indio_dev->channels = bh1780_channels; |
| 192 | indio_dev->num_channels = ARRAY_SIZE(bh1780_channels); | 192 | indio_dev->num_channels = ARRAY_SIZE(bh1780_channels); |
| 193 | indio_dev->modes = INDIO_DIRECT_MODE; | 193 | indio_dev->modes = INDIO_DIRECT_MODE; |
| @@ -226,7 +226,8 @@ static int bh1780_remove(struct i2c_client *client) | |||
| 226 | static int bh1780_runtime_suspend(struct device *dev) | 226 | static int bh1780_runtime_suspend(struct device *dev) |
| 227 | { | 227 | { |
| 228 | struct i2c_client *client = to_i2c_client(dev); | 228 | struct i2c_client *client = to_i2c_client(dev); |
| 229 | struct bh1780_data *bh1780 = i2c_get_clientdata(client); | 229 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
| 230 | struct bh1780_data *bh1780 = iio_priv(indio_dev); | ||
| 230 | int ret; | 231 | int ret; |
| 231 | 232 | ||
| 232 | ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_POFF); | 233 | ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_POFF); |
| @@ -241,7 +242,8 @@ static int bh1780_runtime_suspend(struct device *dev) | |||
| 241 | static int bh1780_runtime_resume(struct device *dev) | 242 | static int bh1780_runtime_resume(struct device *dev) |
| 242 | { | 243 | { |
| 243 | struct i2c_client *client = to_i2c_client(dev); | 244 | struct i2c_client *client = to_i2c_client(dev); |
| 244 | struct bh1780_data *bh1780 = i2c_get_clientdata(client); | 245 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
| 246 | struct bh1780_data *bh1780 = iio_priv(indio_dev); | ||
| 245 | int ret; | 247 | int ret; |
| 246 | 248 | ||
| 247 | ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_PON); | 249 | ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_PON); |
diff --git a/drivers/iio/light/max44000.c b/drivers/iio/light/max44000.c index e01e58a9bd14..f17cb2ea18f5 100644 --- a/drivers/iio/light/max44000.c +++ b/drivers/iio/light/max44000.c | |||
| @@ -147,7 +147,6 @@ static const struct iio_chan_spec max44000_channels[] = { | |||
| 147 | { | 147 | { |
| 148 | .type = IIO_PROXIMITY, | 148 | .type = IIO_PROXIMITY, |
| 149 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | 149 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
| 150 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
| 151 | .scan_index = MAX44000_SCAN_INDEX_PRX, | 150 | .scan_index = MAX44000_SCAN_INDEX_PRX, |
| 152 | .scan_type = { | 151 | .scan_type = { |
| 153 | .sign = 'u', | 152 | .sign = 'u', |
diff --git a/drivers/iio/magnetometer/st_magn_buffer.c b/drivers/iio/magnetometer/st_magn_buffer.c index ecd3bd0a9769..0a9e8fadfa9d 100644 --- a/drivers/iio/magnetometer/st_magn_buffer.c +++ b/drivers/iio/magnetometer/st_magn_buffer.c | |||
| @@ -82,7 +82,7 @@ static const struct iio_buffer_setup_ops st_magn_buffer_setup_ops = { | |||
| 82 | 82 | ||
| 83 | int st_magn_allocate_ring(struct iio_dev *indio_dev) | 83 | int st_magn_allocate_ring(struct iio_dev *indio_dev) |
| 84 | { | 84 | { |
| 85 | return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, | 85 | return iio_triggered_buffer_setup(indio_dev, NULL, |
| 86 | &st_sensors_trigger_handler, &st_magn_buffer_setup_ops); | 86 | &st_sensors_trigger_handler, &st_magn_buffer_setup_ops); |
| 87 | } | 87 | } |
| 88 | 88 | ||
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c index 62036d2a9956..8250fc322c56 100644 --- a/drivers/iio/magnetometer/st_magn_core.c +++ b/drivers/iio/magnetometer/st_magn_core.c | |||
| @@ -572,6 +572,7 @@ static const struct iio_info magn_info = { | |||
| 572 | static const struct iio_trigger_ops st_magn_trigger_ops = { | 572 | static const struct iio_trigger_ops st_magn_trigger_ops = { |
| 573 | .owner = THIS_MODULE, | 573 | .owner = THIS_MODULE, |
| 574 | .set_trigger_state = ST_MAGN_TRIGGER_SET_STATE, | 574 | .set_trigger_state = ST_MAGN_TRIGGER_SET_STATE, |
| 575 | .validate_device = st_sensors_validate_device, | ||
| 575 | }; | 576 | }; |
| 576 | #define ST_MAGN_TRIGGER_OPS (&st_magn_trigger_ops) | 577 | #define ST_MAGN_TRIGGER_OPS (&st_magn_trigger_ops) |
| 577 | #else | 578 | #else |
diff --git a/drivers/iio/pressure/bmp280.c b/drivers/iio/pressure/bmp280.c index 2f1498e12bb2..724452d61846 100644 --- a/drivers/iio/pressure/bmp280.c +++ b/drivers/iio/pressure/bmp280.c | |||
| @@ -879,8 +879,8 @@ static int bmp280_probe(struct i2c_client *client, | |||
| 879 | if (ret < 0) | 879 | if (ret < 0) |
| 880 | return ret; | 880 | return ret; |
| 881 | if (chip_id != id->driver_data) { | 881 | if (chip_id != id->driver_data) { |
| 882 | dev_err(&client->dev, "bad chip id. expected %x got %x\n", | 882 | dev_err(&client->dev, "bad chip id. expected %lx got %x\n", |
| 883 | BMP280_CHIP_ID, chip_id); | 883 | id->driver_data, chip_id); |
| 884 | return -EINVAL; | 884 | return -EINVAL; |
| 885 | } | 885 | } |
| 886 | 886 | ||
diff --git a/drivers/iio/pressure/st_pressure_buffer.c b/drivers/iio/pressure/st_pressure_buffer.c index 2ff53f222352..99468d0a64e7 100644 --- a/drivers/iio/pressure/st_pressure_buffer.c +++ b/drivers/iio/pressure/st_pressure_buffer.c | |||
| @@ -82,7 +82,7 @@ static const struct iio_buffer_setup_ops st_press_buffer_setup_ops = { | |||
| 82 | 82 | ||
| 83 | int st_press_allocate_ring(struct iio_dev *indio_dev) | 83 | int st_press_allocate_ring(struct iio_dev *indio_dev) |
| 84 | { | 84 | { |
| 85 | return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, | 85 | return iio_triggered_buffer_setup(indio_dev, NULL, |
| 86 | &st_sensors_trigger_handler, &st_press_buffer_setup_ops); | 86 | &st_sensors_trigger_handler, &st_press_buffer_setup_ops); |
| 87 | } | 87 | } |
| 88 | 88 | ||
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c index 9e9b72a8f18f..92a118c3c4ac 100644 --- a/drivers/iio/pressure/st_pressure_core.c +++ b/drivers/iio/pressure/st_pressure_core.c | |||
| @@ -28,15 +28,21 @@ | |||
| 28 | #include <linux/iio/common/st_sensors.h> | 28 | #include <linux/iio/common/st_sensors.h> |
| 29 | #include "st_pressure.h" | 29 | #include "st_pressure.h" |
| 30 | 30 | ||
| 31 | #define MCELSIUS_PER_CELSIUS 1000 | ||
| 32 | |||
| 33 | /* Default pressure sensitivity */ | ||
| 31 | #define ST_PRESS_LSB_PER_MBAR 4096UL | 34 | #define ST_PRESS_LSB_PER_MBAR 4096UL |
| 32 | #define ST_PRESS_KPASCAL_NANO_SCALE (100000000UL / \ | 35 | #define ST_PRESS_KPASCAL_NANO_SCALE (100000000UL / \ |
| 33 | ST_PRESS_LSB_PER_MBAR) | 36 | ST_PRESS_LSB_PER_MBAR) |
| 37 | |||
| 38 | /* Default temperature sensitivity */ | ||
| 34 | #define ST_PRESS_LSB_PER_CELSIUS 480UL | 39 | #define ST_PRESS_LSB_PER_CELSIUS 480UL |
| 35 | #define ST_PRESS_CELSIUS_NANO_SCALE (1000000000UL / \ | 40 | #define ST_PRESS_MILLI_CELSIUS_OFFSET 42500UL |
| 36 | ST_PRESS_LSB_PER_CELSIUS) | 41 | |
| 37 | #define ST_PRESS_NUMBER_DATA_CHANNELS 1 | 42 | #define ST_PRESS_NUMBER_DATA_CHANNELS 1 |
| 38 | 43 | ||
| 39 | /* FULLSCALE */ | 44 | /* FULLSCALE */ |
| 45 | #define ST_PRESS_FS_AVL_1100MB 1100 | ||
| 40 | #define ST_PRESS_FS_AVL_1260MB 1260 | 46 | #define ST_PRESS_FS_AVL_1260MB 1260 |
| 41 | 47 | ||
| 42 | #define ST_PRESS_1_OUT_XL_ADDR 0x28 | 48 | #define ST_PRESS_1_OUT_XL_ADDR 0x28 |
| @@ -54,9 +60,6 @@ | |||
| 54 | #define ST_PRESS_LPS331AP_PW_MASK 0x80 | 60 | #define ST_PRESS_LPS331AP_PW_MASK 0x80 |
| 55 | #define ST_PRESS_LPS331AP_FS_ADDR 0x23 | 61 | #define ST_PRESS_LPS331AP_FS_ADDR 0x23 |
| 56 | #define ST_PRESS_LPS331AP_FS_MASK 0x30 | 62 | #define ST_PRESS_LPS331AP_FS_MASK 0x30 |
| 57 | #define ST_PRESS_LPS331AP_FS_AVL_1260_VAL 0x00 | ||
| 58 | #define ST_PRESS_LPS331AP_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE | ||
| 59 | #define ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN ST_PRESS_CELSIUS_NANO_SCALE | ||
| 60 | #define ST_PRESS_LPS331AP_BDU_ADDR 0x20 | 63 | #define ST_PRESS_LPS331AP_BDU_ADDR 0x20 |
| 61 | #define ST_PRESS_LPS331AP_BDU_MASK 0x04 | 64 | #define ST_PRESS_LPS331AP_BDU_MASK 0x04 |
| 62 | #define ST_PRESS_LPS331AP_DRDY_IRQ_ADDR 0x22 | 65 | #define ST_PRESS_LPS331AP_DRDY_IRQ_ADDR 0x22 |
| @@ -67,9 +70,14 @@ | |||
| 67 | #define ST_PRESS_LPS331AP_OD_IRQ_ADDR 0x22 | 70 | #define ST_PRESS_LPS331AP_OD_IRQ_ADDR 0x22 |
| 68 | #define ST_PRESS_LPS331AP_OD_IRQ_MASK 0x40 | 71 | #define ST_PRESS_LPS331AP_OD_IRQ_MASK 0x40 |
| 69 | #define ST_PRESS_LPS331AP_MULTIREAD_BIT true | 72 | #define ST_PRESS_LPS331AP_MULTIREAD_BIT true |
| 70 | #define ST_PRESS_LPS331AP_TEMP_OFFSET 42500 | ||
| 71 | 73 | ||
| 72 | /* CUSTOM VALUES FOR LPS001WP SENSOR */ | 74 | /* CUSTOM VALUES FOR LPS001WP SENSOR */ |
| 75 | |||
| 76 | /* LPS001WP pressure resolution */ | ||
| 77 | #define ST_PRESS_LPS001WP_LSB_PER_MBAR 16UL | ||
| 78 | /* LPS001WP temperature resolution */ | ||
| 79 | #define ST_PRESS_LPS001WP_LSB_PER_CELSIUS 64UL | ||
| 80 | |||
| 73 | #define ST_PRESS_LPS001WP_WAI_EXP 0xba | 81 | #define ST_PRESS_LPS001WP_WAI_EXP 0xba |
| 74 | #define ST_PRESS_LPS001WP_ODR_ADDR 0x20 | 82 | #define ST_PRESS_LPS001WP_ODR_ADDR 0x20 |
| 75 | #define ST_PRESS_LPS001WP_ODR_MASK 0x30 | 83 | #define ST_PRESS_LPS001WP_ODR_MASK 0x30 |
| @@ -78,6 +86,8 @@ | |||
| 78 | #define ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL 0x03 | 86 | #define ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL 0x03 |
| 79 | #define ST_PRESS_LPS001WP_PW_ADDR 0x20 | 87 | #define ST_PRESS_LPS001WP_PW_ADDR 0x20 |
| 80 | #define ST_PRESS_LPS001WP_PW_MASK 0x40 | 88 | #define ST_PRESS_LPS001WP_PW_MASK 0x40 |
| 89 | #define ST_PRESS_LPS001WP_FS_AVL_PRESS_GAIN \ | ||
| 90 | (100000000UL / ST_PRESS_LPS001WP_LSB_PER_MBAR) | ||
| 81 | #define ST_PRESS_LPS001WP_BDU_ADDR 0x20 | 91 | #define ST_PRESS_LPS001WP_BDU_ADDR 0x20 |
| 82 | #define ST_PRESS_LPS001WP_BDU_MASK 0x04 | 92 | #define ST_PRESS_LPS001WP_BDU_MASK 0x04 |
| 83 | #define ST_PRESS_LPS001WP_MULTIREAD_BIT true | 93 | #define ST_PRESS_LPS001WP_MULTIREAD_BIT true |
| @@ -94,11 +104,6 @@ | |||
| 94 | #define ST_PRESS_LPS25H_ODR_AVL_25HZ_VAL 0x04 | 104 | #define ST_PRESS_LPS25H_ODR_AVL_25HZ_VAL 0x04 |
| 95 | #define ST_PRESS_LPS25H_PW_ADDR 0x20 | 105 | #define ST_PRESS_LPS25H_PW_ADDR 0x20 |
| 96 | #define ST_PRESS_LPS25H_PW_MASK 0x80 | 106 | #define ST_PRESS_LPS25H_PW_MASK 0x80 |
| 97 | #define ST_PRESS_LPS25H_FS_ADDR 0x00 | ||
| 98 | #define ST_PRESS_LPS25H_FS_MASK 0x00 | ||
| 99 | #define ST_PRESS_LPS25H_FS_AVL_1260_VAL 0x00 | ||
| 100 | #define ST_PRESS_LPS25H_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE | ||
| 101 | #define ST_PRESS_LPS25H_FS_AVL_TEMP_GAIN ST_PRESS_CELSIUS_NANO_SCALE | ||
| 102 | #define ST_PRESS_LPS25H_BDU_ADDR 0x20 | 107 | #define ST_PRESS_LPS25H_BDU_ADDR 0x20 |
| 103 | #define ST_PRESS_LPS25H_BDU_MASK 0x04 | 108 | #define ST_PRESS_LPS25H_BDU_MASK 0x04 |
| 104 | #define ST_PRESS_LPS25H_DRDY_IRQ_ADDR 0x23 | 109 | #define ST_PRESS_LPS25H_DRDY_IRQ_ADDR 0x23 |
| @@ -109,7 +114,6 @@ | |||
| 109 | #define ST_PRESS_LPS25H_OD_IRQ_ADDR 0x22 | 114 | #define ST_PRESS_LPS25H_OD_IRQ_ADDR 0x22 |
| 110 | #define ST_PRESS_LPS25H_OD_IRQ_MASK 0x40 | 115 | #define ST_PRESS_LPS25H_OD_IRQ_MASK 0x40 |
| 111 | #define ST_PRESS_LPS25H_MULTIREAD_BIT true | 116 | #define ST_PRESS_LPS25H_MULTIREAD_BIT true |
| 112 | #define ST_PRESS_LPS25H_TEMP_OFFSET 42500 | ||
| 113 | #define ST_PRESS_LPS25H_OUT_XL_ADDR 0x28 | 117 | #define ST_PRESS_LPS25H_OUT_XL_ADDR 0x28 |
| 114 | #define ST_TEMP_LPS25H_OUT_L_ADDR 0x2b | 118 | #define ST_TEMP_LPS25H_OUT_L_ADDR 0x2b |
| 115 | 119 | ||
| @@ -161,7 +165,9 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { | |||
| 161 | .storagebits = 16, | 165 | .storagebits = 16, |
| 162 | .endianness = IIO_LE, | 166 | .endianness = IIO_LE, |
| 163 | }, | 167 | }, |
| 164 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | 168 | .info_mask_separate = |
| 169 | BIT(IIO_CHAN_INFO_RAW) | | ||
| 170 | BIT(IIO_CHAN_INFO_SCALE), | ||
| 165 | .modified = 0, | 171 | .modified = 0, |
| 166 | }, | 172 | }, |
| 167 | { | 173 | { |
| @@ -177,7 +183,7 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { | |||
| 177 | }, | 183 | }, |
| 178 | .info_mask_separate = | 184 | .info_mask_separate = |
| 179 | BIT(IIO_CHAN_INFO_RAW) | | 185 | BIT(IIO_CHAN_INFO_RAW) | |
| 180 | BIT(IIO_CHAN_INFO_OFFSET), | 186 | BIT(IIO_CHAN_INFO_SCALE), |
| 181 | .modified = 0, | 187 | .modified = 0, |
| 182 | }, | 188 | }, |
| 183 | IIO_CHAN_SOFT_TIMESTAMP(1) | 189 | IIO_CHAN_SOFT_TIMESTAMP(1) |
| @@ -212,11 +218,14 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { | |||
| 212 | .addr = ST_PRESS_LPS331AP_FS_ADDR, | 218 | .addr = ST_PRESS_LPS331AP_FS_ADDR, |
| 213 | .mask = ST_PRESS_LPS331AP_FS_MASK, | 219 | .mask = ST_PRESS_LPS331AP_FS_MASK, |
| 214 | .fs_avl = { | 220 | .fs_avl = { |
| 221 | /* | ||
| 222 | * Pressure and temperature sensitivity values | ||
| 223 | * as defined in table 3 of LPS331AP datasheet. | ||
| 224 | */ | ||
| 215 | [0] = { | 225 | [0] = { |
| 216 | .num = ST_PRESS_FS_AVL_1260MB, | 226 | .num = ST_PRESS_FS_AVL_1260MB, |
| 217 | .value = ST_PRESS_LPS331AP_FS_AVL_1260_VAL, | 227 | .gain = ST_PRESS_KPASCAL_NANO_SCALE, |
| 218 | .gain = ST_PRESS_LPS331AP_FS_AVL_1260_GAIN, | 228 | .gain2 = ST_PRESS_LSB_PER_CELSIUS, |
| 219 | .gain2 = ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN, | ||
| 220 | }, | 229 | }, |
| 221 | }, | 230 | }, |
| 222 | }, | 231 | }, |
| @@ -261,7 +270,17 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { | |||
| 261 | .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, | 270 | .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, |
| 262 | }, | 271 | }, |
| 263 | .fs = { | 272 | .fs = { |
| 264 | .addr = 0, | 273 | .fs_avl = { |
| 274 | /* | ||
| 275 | * Pressure and temperature resolution values | ||
| 276 | * as defined in table 3 of LPS001WP datasheet. | ||
| 277 | */ | ||
| 278 | [0] = { | ||
| 279 | .num = ST_PRESS_FS_AVL_1100MB, | ||
| 280 | .gain = ST_PRESS_LPS001WP_FS_AVL_PRESS_GAIN, | ||
| 281 | .gain2 = ST_PRESS_LPS001WP_LSB_PER_CELSIUS, | ||
| 282 | }, | ||
| 283 | }, | ||
| 265 | }, | 284 | }, |
| 266 | .bdu = { | 285 | .bdu = { |
| 267 | .addr = ST_PRESS_LPS001WP_BDU_ADDR, | 286 | .addr = ST_PRESS_LPS001WP_BDU_ADDR, |
| @@ -298,14 +317,15 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { | |||
| 298 | .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, | 317 | .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, |
| 299 | }, | 318 | }, |
| 300 | .fs = { | 319 | .fs = { |
| 301 | .addr = ST_PRESS_LPS25H_FS_ADDR, | ||
| 302 | .mask = ST_PRESS_LPS25H_FS_MASK, | ||
| 303 | .fs_avl = { | 320 | .fs_avl = { |
| 321 | /* | ||
| 322 | * Pressure and temperature sensitivity values | ||
| 323 | * as defined in table 3 of LPS25H datasheet. | ||
| 324 | */ | ||
| 304 | [0] = { | 325 | [0] = { |
| 305 | .num = ST_PRESS_FS_AVL_1260MB, | 326 | .num = ST_PRESS_FS_AVL_1260MB, |
| 306 | .value = ST_PRESS_LPS25H_FS_AVL_1260_VAL, | 327 | .gain = ST_PRESS_KPASCAL_NANO_SCALE, |
| 307 | .gain = ST_PRESS_LPS25H_FS_AVL_1260_GAIN, | 328 | .gain2 = ST_PRESS_LSB_PER_CELSIUS, |
| 308 | .gain2 = ST_PRESS_LPS25H_FS_AVL_TEMP_GAIN, | ||
| 309 | }, | 329 | }, |
| 310 | }, | 330 | }, |
| 311 | }, | 331 | }, |
| @@ -364,26 +384,26 @@ static int st_press_read_raw(struct iio_dev *indio_dev, | |||
| 364 | 384 | ||
| 365 | return IIO_VAL_INT; | 385 | return IIO_VAL_INT; |
| 366 | case IIO_CHAN_INFO_SCALE: | 386 | case IIO_CHAN_INFO_SCALE: |
| 367 | *val = 0; | ||
| 368 | |||
| 369 | switch (ch->type) { | 387 | switch (ch->type) { |
| 370 | case IIO_PRESSURE: | 388 | case IIO_PRESSURE: |
| 389 | *val = 0; | ||
| 371 | *val2 = press_data->current_fullscale->gain; | 390 | *val2 = press_data->current_fullscale->gain; |
| 372 | break; | 391 | return IIO_VAL_INT_PLUS_NANO; |
| 373 | case IIO_TEMP: | 392 | case IIO_TEMP: |
| 393 | *val = MCELSIUS_PER_CELSIUS; | ||
| 374 | *val2 = press_data->current_fullscale->gain2; | 394 | *val2 = press_data->current_fullscale->gain2; |
| 375 | break; | 395 | return IIO_VAL_FRACTIONAL; |
| 376 | default: | 396 | default: |
| 377 | err = -EINVAL; | 397 | err = -EINVAL; |
| 378 | goto read_error; | 398 | goto read_error; |
| 379 | } | 399 | } |
| 380 | 400 | ||
| 381 | return IIO_VAL_INT_PLUS_NANO; | ||
| 382 | case IIO_CHAN_INFO_OFFSET: | 401 | case IIO_CHAN_INFO_OFFSET: |
| 383 | switch (ch->type) { | 402 | switch (ch->type) { |
| 384 | case IIO_TEMP: | 403 | case IIO_TEMP: |
| 385 | *val = 425; | 404 | *val = ST_PRESS_MILLI_CELSIUS_OFFSET * |
| 386 | *val2 = 10; | 405 | press_data->current_fullscale->gain2; |
| 406 | *val2 = MCELSIUS_PER_CELSIUS; | ||
| 387 | break; | 407 | break; |
| 388 | default: | 408 | default: |
| 389 | err = -EINVAL; | 409 | err = -EINVAL; |
| @@ -425,6 +445,7 @@ static const struct iio_info press_info = { | |||
| 425 | static const struct iio_trigger_ops st_press_trigger_ops = { | 445 | static const struct iio_trigger_ops st_press_trigger_ops = { |
| 426 | .owner = THIS_MODULE, | 446 | .owner = THIS_MODULE, |
| 427 | .set_trigger_state = ST_PRESS_TRIGGER_SET_STATE, | 447 | .set_trigger_state = ST_PRESS_TRIGGER_SET_STATE, |
| 448 | .validate_device = st_sensors_validate_device, | ||
| 428 | }; | 449 | }; |
| 429 | #define ST_PRESS_TRIGGER_OPS (&st_press_trigger_ops) | 450 | #define ST_PRESS_TRIGGER_OPS (&st_press_trigger_ops) |
| 430 | #else | 451 | #else |
diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c index f4d29d5dbd5f..e2f926cdcad2 100644 --- a/drivers/iio/proximity/as3935.c +++ b/drivers/iio/proximity/as3935.c | |||
| @@ -64,6 +64,7 @@ struct as3935_state { | |||
| 64 | struct delayed_work work; | 64 | struct delayed_work work; |
| 65 | 65 | ||
| 66 | u32 tune_cap; | 66 | u32 tune_cap; |
| 67 | u8 buffer[16]; /* 8-bit data + 56-bit padding + 64-bit timestamp */ | ||
| 67 | u8 buf[2] ____cacheline_aligned; | 68 | u8 buf[2] ____cacheline_aligned; |
| 68 | }; | 69 | }; |
| 69 | 70 | ||
| @@ -72,7 +73,8 @@ static const struct iio_chan_spec as3935_channels[] = { | |||
| 72 | .type = IIO_PROXIMITY, | 73 | .type = IIO_PROXIMITY, |
| 73 | .info_mask_separate = | 74 | .info_mask_separate = |
| 74 | BIT(IIO_CHAN_INFO_RAW) | | 75 | BIT(IIO_CHAN_INFO_RAW) | |
| 75 | BIT(IIO_CHAN_INFO_PROCESSED), | 76 | BIT(IIO_CHAN_INFO_PROCESSED) | |
| 77 | BIT(IIO_CHAN_INFO_SCALE), | ||
| 76 | .scan_index = 0, | 78 | .scan_index = 0, |
| 77 | .scan_type = { | 79 | .scan_type = { |
| 78 | .sign = 'u', | 80 | .sign = 'u', |
| @@ -181,7 +183,12 @@ static int as3935_read_raw(struct iio_dev *indio_dev, | |||
| 181 | /* storm out of range */ | 183 | /* storm out of range */ |
| 182 | if (*val == AS3935_DATA_MASK) | 184 | if (*val == AS3935_DATA_MASK) |
| 183 | return -EINVAL; | 185 | return -EINVAL; |
| 184 | *val *= 1000; | 186 | |
| 187 | if (m == IIO_CHAN_INFO_PROCESSED) | ||
| 188 | *val *= 1000; | ||
| 189 | break; | ||
| 190 | case IIO_CHAN_INFO_SCALE: | ||
| 191 | *val = 1000; | ||
| 185 | break; | 192 | break; |
| 186 | default: | 193 | default: |
| 187 | return -EINVAL; | 194 | return -EINVAL; |
| @@ -206,10 +213,10 @@ static irqreturn_t as3935_trigger_handler(int irq, void *private) | |||
| 206 | ret = as3935_read(st, AS3935_DATA, &val); | 213 | ret = as3935_read(st, AS3935_DATA, &val); |
| 207 | if (ret) | 214 | if (ret) |
| 208 | goto err_read; | 215 | goto err_read; |
| 209 | val &= AS3935_DATA_MASK; | ||
| 210 | val *= 1000; | ||
| 211 | 216 | ||
| 212 | iio_push_to_buffers_with_timestamp(indio_dev, &val, pf->timestamp); | 217 | st->buffer[0] = val & AS3935_DATA_MASK; |
| 218 | iio_push_to_buffers_with_timestamp(indio_dev, &st->buffer, | ||
| 219 | pf->timestamp); | ||
| 213 | err_read: | 220 | err_read: |
| 214 | iio_trigger_notify_done(indio_dev->trig); | 221 | iio_trigger_notify_done(indio_dev->trig); |
| 215 | 222 | ||
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 94b68213c50d..5f6b3bcab078 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c | |||
| @@ -1941,6 +1941,7 @@ static struct iommu_ops arm_smmu_ops = { | |||
| 1941 | .attach_dev = arm_smmu_attach_dev, | 1941 | .attach_dev = arm_smmu_attach_dev, |
| 1942 | .map = arm_smmu_map, | 1942 | .map = arm_smmu_map, |
| 1943 | .unmap = arm_smmu_unmap, | 1943 | .unmap = arm_smmu_unmap, |
| 1944 | .map_sg = default_iommu_map_sg, | ||
| 1944 | .iova_to_phys = arm_smmu_iova_to_phys, | 1945 | .iova_to_phys = arm_smmu_iova_to_phys, |
| 1945 | .add_device = arm_smmu_add_device, | 1946 | .add_device = arm_smmu_add_device, |
| 1946 | .remove_device = arm_smmu_remove_device, | 1947 | .remove_device = arm_smmu_remove_device, |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index a644d0cec2d8..10700945994e 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
| @@ -3222,11 +3222,6 @@ static int __init init_dmars(void) | |||
| 3222 | } | 3222 | } |
| 3223 | } | 3223 | } |
| 3224 | 3224 | ||
| 3225 | iommu_flush_write_buffer(iommu); | ||
| 3226 | iommu_set_root_entry(iommu); | ||
| 3227 | iommu->flush.flush_context(iommu, 0, 0, 0, DMA_CCMD_GLOBAL_INVL); | ||
| 3228 | iommu->flush.flush_iotlb(iommu, 0, 0, 0, DMA_TLB_GLOBAL_FLUSH); | ||
| 3229 | |||
| 3230 | if (!ecap_pass_through(iommu->ecap)) | 3225 | if (!ecap_pass_through(iommu->ecap)) |
| 3231 | hw_pass_through = 0; | 3226 | hw_pass_through = 0; |
| 3232 | #ifdef CONFIG_INTEL_IOMMU_SVM | 3227 | #ifdef CONFIG_INTEL_IOMMU_SVM |
| @@ -3235,6 +3230,18 @@ static int __init init_dmars(void) | |||
| 3235 | #endif | 3230 | #endif |
| 3236 | } | 3231 | } |
| 3237 | 3232 | ||
| 3233 | /* | ||
| 3234 | * Now that qi is enabled on all iommus, set the root entry and flush | ||
| 3235 | * caches. This is required on some Intel X58 chipsets, otherwise the | ||
| 3236 | * flush_context function will loop forever and the boot hangs. | ||
| 3237 | */ | ||
| 3238 | for_each_active_iommu(iommu, drhd) { | ||
| 3239 | iommu_flush_write_buffer(iommu); | ||
| 3240 | iommu_set_root_entry(iommu); | ||
| 3241 | iommu->flush.flush_context(iommu, 0, 0, 0, DMA_CCMD_GLOBAL_INVL); | ||
| 3242 | iommu->flush.flush_iotlb(iommu, 0, 0, 0, DMA_TLB_GLOBAL_FLUSH); | ||
| 3243 | } | ||
| 3244 | |||
| 3238 | if (iommu_pass_through) | 3245 | if (iommu_pass_through) |
| 3239 | iommu_identity_mapping |= IDENTMAP_ALL; | 3246 | iommu_identity_mapping |= IDENTMAP_ALL; |
| 3240 | 3247 | ||
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index c7d6156ff536..25b4627cb57f 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c | |||
| @@ -815,7 +815,7 @@ static int rk_iommu_attach_device(struct iommu_domain *domain, | |||
| 815 | dte_addr = virt_to_phys(rk_domain->dt); | 815 | dte_addr = virt_to_phys(rk_domain->dt); |
| 816 | for (i = 0; i < iommu->num_mmu; i++) { | 816 | for (i = 0; i < iommu->num_mmu; i++) { |
| 817 | rk_iommu_write(iommu->bases[i], RK_MMU_DTE_ADDR, dte_addr); | 817 | rk_iommu_write(iommu->bases[i], RK_MMU_DTE_ADDR, dte_addr); |
| 818 | rk_iommu_command(iommu->bases[i], RK_MMU_CMD_ZAP_CACHE); | 818 | rk_iommu_base_command(iommu->bases[i], RK_MMU_CMD_ZAP_CACHE); |
| 819 | rk_iommu_write(iommu->bases[i], RK_MMU_INT_MASK, RK_MMU_IRQ_MASK); | 819 | rk_iommu_write(iommu->bases[i], RK_MMU_INT_MASK, RK_MMU_IRQ_MASK); |
| 820 | } | 820 | } |
| 821 | 821 | ||
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c index 3495d5d6547f..3bce44893021 100644 --- a/drivers/leds/led-core.c +++ b/drivers/leds/led-core.c | |||
| @@ -53,11 +53,12 @@ static void led_timer_function(unsigned long data) | |||
| 53 | 53 | ||
| 54 | if (!led_cdev->blink_delay_on || !led_cdev->blink_delay_off) { | 54 | if (!led_cdev->blink_delay_on || !led_cdev->blink_delay_off) { |
| 55 | led_set_brightness_nosleep(led_cdev, LED_OFF); | 55 | led_set_brightness_nosleep(led_cdev, LED_OFF); |
| 56 | led_cdev->flags &= ~LED_BLINK_SW; | ||
| 56 | return; | 57 | return; |
| 57 | } | 58 | } |
| 58 | 59 | ||
| 59 | if (led_cdev->flags & LED_BLINK_ONESHOT_STOP) { | 60 | if (led_cdev->flags & LED_BLINK_ONESHOT_STOP) { |
| 60 | led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP; | 61 | led_cdev->flags &= ~(LED_BLINK_ONESHOT_STOP | LED_BLINK_SW); |
| 61 | return; | 62 | return; |
| 62 | } | 63 | } |
| 63 | 64 | ||
| @@ -151,6 +152,7 @@ static void led_set_software_blink(struct led_classdev *led_cdev, | |||
| 151 | return; | 152 | return; |
| 152 | } | 153 | } |
| 153 | 154 | ||
| 155 | led_cdev->flags |= LED_BLINK_SW; | ||
| 154 | mod_timer(&led_cdev->blink_timer, jiffies + 1); | 156 | mod_timer(&led_cdev->blink_timer, jiffies + 1); |
| 155 | } | 157 | } |
| 156 | 158 | ||
| @@ -219,6 +221,7 @@ void led_stop_software_blink(struct led_classdev *led_cdev) | |||
| 219 | del_timer_sync(&led_cdev->blink_timer); | 221 | del_timer_sync(&led_cdev->blink_timer); |
| 220 | led_cdev->blink_delay_on = 0; | 222 | led_cdev->blink_delay_on = 0; |
| 221 | led_cdev->blink_delay_off = 0; | 223 | led_cdev->blink_delay_off = 0; |
| 224 | led_cdev->flags &= ~LED_BLINK_SW; | ||
| 222 | } | 225 | } |
| 223 | EXPORT_SYMBOL_GPL(led_stop_software_blink); | 226 | EXPORT_SYMBOL_GPL(led_stop_software_blink); |
| 224 | 227 | ||
| @@ -226,10 +229,10 @@ void led_set_brightness(struct led_classdev *led_cdev, | |||
| 226 | enum led_brightness brightness) | 229 | enum led_brightness brightness) |
| 227 | { | 230 | { |
| 228 | /* | 231 | /* |
| 229 | * In case blinking is on delay brightness setting | 232 | * If software blink is active, delay brightness setting |
| 230 | * until the next timer tick. | 233 | * until the next timer tick. |
| 231 | */ | 234 | */ |
| 232 | if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) { | 235 | if (led_cdev->flags & LED_BLINK_SW) { |
| 233 | /* | 236 | /* |
| 234 | * If we need to disable soft blinking delegate this to the | 237 | * If we need to disable soft blinking delegate this to the |
| 235 | * work queue task to avoid problems in case we are called | 238 | * work queue task to avoid problems in case we are called |
diff --git a/drivers/leds/trigger/ledtrig-heartbeat.c b/drivers/leds/trigger/ledtrig-heartbeat.c index 410c39c62dc7..c9f386213e9e 100644 --- a/drivers/leds/trigger/ledtrig-heartbeat.c +++ b/drivers/leds/trigger/ledtrig-heartbeat.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
| 20 | #include <linux/leds.h> | 20 | #include <linux/leds.h> |
| 21 | #include <linux/reboot.h> | 21 | #include <linux/reboot.h> |
| 22 | #include <linux/suspend.h> | ||
| 22 | #include "../leds.h" | 23 | #include "../leds.h" |
| 23 | 24 | ||
| 24 | static int panic_heartbeats; | 25 | static int panic_heartbeats; |
| @@ -154,6 +155,30 @@ static struct led_trigger heartbeat_led_trigger = { | |||
| 154 | .deactivate = heartbeat_trig_deactivate, | 155 | .deactivate = heartbeat_trig_deactivate, |
| 155 | }; | 156 | }; |
| 156 | 157 | ||
| 158 | static int heartbeat_pm_notifier(struct notifier_block *nb, | ||
| 159 | unsigned long pm_event, void *unused) | ||
| 160 | { | ||
| 161 | int rc; | ||
| 162 | |||
| 163 | switch (pm_event) { | ||
| 164 | case PM_SUSPEND_PREPARE: | ||
| 165 | case PM_HIBERNATION_PREPARE: | ||
| 166 | case PM_RESTORE_PREPARE: | ||
| 167 | led_trigger_unregister(&heartbeat_led_trigger); | ||
| 168 | break; | ||
| 169 | case PM_POST_SUSPEND: | ||
| 170 | case PM_POST_HIBERNATION: | ||
| 171 | case PM_POST_RESTORE: | ||
| 172 | rc = led_trigger_register(&heartbeat_led_trigger); | ||
| 173 | if (rc) | ||
| 174 | pr_err("could not re-register heartbeat trigger\n"); | ||
| 175 | break; | ||
| 176 | default: | ||
| 177 | break; | ||
| 178 | } | ||
| 179 | return NOTIFY_DONE; | ||
| 180 | } | ||
| 181 | |||
| 157 | static int heartbeat_reboot_notifier(struct notifier_block *nb, | 182 | static int heartbeat_reboot_notifier(struct notifier_block *nb, |
| 158 | unsigned long code, void *unused) | 183 | unsigned long code, void *unused) |
| 159 | { | 184 | { |
| @@ -168,6 +193,10 @@ static int heartbeat_panic_notifier(struct notifier_block *nb, | |||
| 168 | return NOTIFY_DONE; | 193 | return NOTIFY_DONE; |
| 169 | } | 194 | } |
| 170 | 195 | ||
| 196 | static struct notifier_block heartbeat_pm_nb = { | ||
| 197 | .notifier_call = heartbeat_pm_notifier, | ||
| 198 | }; | ||
| 199 | |||
| 171 | static struct notifier_block heartbeat_reboot_nb = { | 200 | static struct notifier_block heartbeat_reboot_nb = { |
| 172 | .notifier_call = heartbeat_reboot_notifier, | 201 | .notifier_call = heartbeat_reboot_notifier, |
| 173 | }; | 202 | }; |
| @@ -184,12 +213,14 @@ static int __init heartbeat_trig_init(void) | |||
| 184 | atomic_notifier_chain_register(&panic_notifier_list, | 213 | atomic_notifier_chain_register(&panic_notifier_list, |
| 185 | &heartbeat_panic_nb); | 214 | &heartbeat_panic_nb); |
| 186 | register_reboot_notifier(&heartbeat_reboot_nb); | 215 | register_reboot_notifier(&heartbeat_reboot_nb); |
| 216 | register_pm_notifier(&heartbeat_pm_nb); | ||
| 187 | } | 217 | } |
| 188 | return rc; | 218 | return rc; |
| 189 | } | 219 | } |
| 190 | 220 | ||
| 191 | static void __exit heartbeat_trig_exit(void) | 221 | static void __exit heartbeat_trig_exit(void) |
| 192 | { | 222 | { |
| 223 | unregister_pm_notifier(&heartbeat_pm_nb); | ||
| 193 | unregister_reboot_notifier(&heartbeat_reboot_nb); | 224 | unregister_reboot_notifier(&heartbeat_reboot_nb); |
| 194 | atomic_notifier_chain_unregister(&panic_notifier_list, | 225 | atomic_notifier_chain_unregister(&panic_notifier_list, |
| 195 | &heartbeat_panic_nb); | 226 | &heartbeat_panic_nb); |
diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c index b73c6e7d28e4..6f2c8522e14a 100644 --- a/drivers/mcb/mcb-core.c +++ b/drivers/mcb/mcb-core.c | |||
| @@ -61,21 +61,36 @@ static int mcb_probe(struct device *dev) | |||
| 61 | struct mcb_driver *mdrv = to_mcb_driver(dev->driver); | 61 | struct mcb_driver *mdrv = to_mcb_driver(dev->driver); |
| 62 | struct mcb_device *mdev = to_mcb_device(dev); | 62 | struct mcb_device *mdev = to_mcb_device(dev); |
| 63 | const struct mcb_device_id *found_id; | 63 | const struct mcb_device_id *found_id; |
| 64 | struct module *carrier_mod; | ||
| 65 | int ret; | ||
| 64 | 66 | ||
| 65 | found_id = mcb_match_id(mdrv->id_table, mdev); | 67 | found_id = mcb_match_id(mdrv->id_table, mdev); |
| 66 | if (!found_id) | 68 | if (!found_id) |
| 67 | return -ENODEV; | 69 | return -ENODEV; |
| 68 | 70 | ||
| 69 | return mdrv->probe(mdev, found_id); | 71 | carrier_mod = mdev->dev.parent->driver->owner; |
| 72 | if (!try_module_get(carrier_mod)) | ||
| 73 | return -EINVAL; | ||
| 74 | |||
| 75 | get_device(dev); | ||
| 76 | ret = mdrv->probe(mdev, found_id); | ||
| 77 | if (ret) | ||
| 78 | module_put(carrier_mod); | ||
| 79 | |||
| 80 | return ret; | ||
| 70 | } | 81 | } |
| 71 | 82 | ||
| 72 | static int mcb_remove(struct device *dev) | 83 | static int mcb_remove(struct device *dev) |
| 73 | { | 84 | { |
| 74 | struct mcb_driver *mdrv = to_mcb_driver(dev->driver); | 85 | struct mcb_driver *mdrv = to_mcb_driver(dev->driver); |
| 75 | struct mcb_device *mdev = to_mcb_device(dev); | 86 | struct mcb_device *mdev = to_mcb_device(dev); |
| 87 | struct module *carrier_mod; | ||
| 76 | 88 | ||
| 77 | mdrv->remove(mdev); | 89 | mdrv->remove(mdev); |
| 78 | 90 | ||
| 91 | carrier_mod = mdev->dev.parent->driver->owner; | ||
| 92 | module_put(carrier_mod); | ||
| 93 | |||
| 79 | put_device(&mdev->dev); | 94 | put_device(&mdev->dev); |
| 80 | 95 | ||
| 81 | return 0; | 96 | return 0; |
diff --git a/drivers/media/v4l2-core/v4l2-mc.c b/drivers/media/v4l2-core/v4l2-mc.c index ca94bded3386..8bef4331bd51 100644 --- a/drivers/media/v4l2-core/v4l2-mc.c +++ b/drivers/media/v4l2-core/v4l2-mc.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Media Controller ancillary functions | 2 | * Media Controller ancillary functions |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2016 Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 4 | * Copyright (c) 2016 Mauro Carvalho Chehab <mchehab@kernel.org> |
| 5 | * Copyright (C) 2016 Shuah Khan <shuahkh@osg.samsung.com> | 5 | * Copyright (C) 2016 Shuah Khan <shuahkh@osg.samsung.com> |
| 6 | * Copyright (C) 2006-2010 Nokia Corporation | 6 | * Copyright (C) 2006-2010 Nokia Corporation |
| 7 | * Copyright (c) 2016 Intel Corporation. | 7 | * Copyright (c) 2016 Intel Corporation. |
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index eed254da63a8..641c1a566687 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c | |||
| @@ -730,7 +730,7 @@ static void mei_cl_wake_all(struct mei_cl *cl) | |||
| 730 | /* synchronized under device mutex */ | 730 | /* synchronized under device mutex */ |
| 731 | if (waitqueue_active(&cl->wait)) { | 731 | if (waitqueue_active(&cl->wait)) { |
| 732 | cl_dbg(dev, cl, "Waking up ctrl write clients!\n"); | 732 | cl_dbg(dev, cl, "Waking up ctrl write clients!\n"); |
| 733 | wake_up_interruptible(&cl->wait); | 733 | wake_up(&cl->wait); |
| 734 | } | 734 | } |
| 735 | } | 735 | } |
| 736 | 736 | ||
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 16baeb51b2bd..ef3618299494 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
| @@ -1147,11 +1147,17 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway) | |||
| 1147 | */ | 1147 | */ |
| 1148 | static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev) | 1148 | static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev) |
| 1149 | { | 1149 | { |
| 1150 | struct kstat stat; | ||
| 1151 | int err, minor; | 1150 | int err, minor; |
| 1151 | struct path path; | ||
| 1152 | struct kstat stat; | ||
| 1152 | 1153 | ||
| 1153 | /* Probably this is an MTD character device node path */ | 1154 | /* Probably this is an MTD character device node path */ |
| 1154 | err = vfs_stat(mtd_dev, &stat); | 1155 | err = kern_path(mtd_dev, LOOKUP_FOLLOW, &path); |
| 1156 | if (err) | ||
| 1157 | return ERR_PTR(err); | ||
| 1158 | |||
| 1159 | err = vfs_getattr(&path, &stat); | ||
| 1160 | path_put(&path); | ||
| 1155 | if (err) | 1161 | if (err) |
| 1156 | return ERR_PTR(err); | 1162 | return ERR_PTR(err); |
| 1157 | 1163 | ||
| @@ -1160,6 +1166,7 @@ static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev) | |||
| 1160 | return ERR_PTR(-EINVAL); | 1166 | return ERR_PTR(-EINVAL); |
| 1161 | 1167 | ||
| 1162 | minor = MINOR(stat.rdev); | 1168 | minor = MINOR(stat.rdev); |
| 1169 | |||
| 1163 | if (minor & 1) | 1170 | if (minor & 1) |
| 1164 | /* | 1171 | /* |
| 1165 | * Just do not think the "/dev/mtdrX" devices support is need, | 1172 | * Just do not think the "/dev/mtdrX" devices support is need, |
diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c index 348dbbcbedc8..a9e2cef7c95c 100644 --- a/drivers/mtd/ubi/kapi.c +++ b/drivers/mtd/ubi/kapi.c | |||
| @@ -302,6 +302,7 @@ EXPORT_SYMBOL_GPL(ubi_open_volume_nm); | |||
| 302 | struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode) | 302 | struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode) |
| 303 | { | 303 | { |
| 304 | int error, ubi_num, vol_id; | 304 | int error, ubi_num, vol_id; |
| 305 | struct path path; | ||
| 305 | struct kstat stat; | 306 | struct kstat stat; |
| 306 | 307 | ||
| 307 | dbg_gen("open volume %s, mode %d", pathname, mode); | 308 | dbg_gen("open volume %s, mode %d", pathname, mode); |
| @@ -309,7 +310,12 @@ struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode) | |||
| 309 | if (!pathname || !*pathname) | 310 | if (!pathname || !*pathname) |
| 310 | return ERR_PTR(-EINVAL); | 311 | return ERR_PTR(-EINVAL); |
| 311 | 312 | ||
| 312 | error = vfs_stat(pathname, &stat); | 313 | error = kern_path(pathname, LOOKUP_FOLLOW, &path); |
| 314 | if (error) | ||
| 315 | return ERR_PTR(error); | ||
| 316 | |||
| 317 | error = vfs_getattr(&path, &stat); | ||
| 318 | path_put(&path); | ||
| 313 | if (error) | 319 | if (error) |
| 314 | return ERR_PTR(error); | 320 | return ERR_PTR(error); |
| 315 | 321 | ||
diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index 1b8304e1efaa..140436a046c0 100644 --- a/drivers/perf/arm_pmu.c +++ b/drivers/perf/arm_pmu.c | |||
| @@ -1010,8 +1010,8 @@ int arm_pmu_device_probe(struct platform_device *pdev, | |||
| 1010 | if (!ret) | 1010 | if (!ret) |
| 1011 | ret = init_fn(pmu); | 1011 | ret = init_fn(pmu); |
| 1012 | } else { | 1012 | } else { |
| 1013 | ret = probe_current_pmu(pmu, probe_table); | ||
| 1014 | cpumask_setall(&pmu->supported_cpus); | 1013 | cpumask_setall(&pmu->supported_cpus); |
| 1014 | ret = probe_current_pmu(pmu, probe_table); | ||
| 1015 | } | 1015 | } |
| 1016 | 1016 | ||
| 1017 | if (ret) { | 1017 | if (ret) { |
diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c index cc093ebfda94..8b851f718123 100644 --- a/drivers/phy/phy-exynos-mipi-video.c +++ b/drivers/phy/phy-exynos-mipi-video.c | |||
| @@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data, | |||
| 233 | struct exynos_mipi_video_phy *state) | 233 | struct exynos_mipi_video_phy *state) |
| 234 | { | 234 | { |
| 235 | u32 val; | 235 | u32 val; |
| 236 | int ret; | ||
| 237 | |||
| 238 | ret = regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val); | ||
| 239 | if (ret) | ||
| 240 | return 0; | ||
| 236 | 241 | ||
| 237 | regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val); | ||
| 238 | return val & data->resetn_val; | 242 | return val & data->resetn_val; |
| 239 | } | 243 | } |
| 240 | 244 | ||
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index 0a477d24cf76..bf46844dc387 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c | |||
| @@ -293,11 +293,18 @@ static int ti_pipe3_init(struct phy *x) | |||
| 293 | ret = ti_pipe3_dpll_wait_lock(phy); | 293 | ret = ti_pipe3_dpll_wait_lock(phy); |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | /* Program the DPLL only if not locked */ | 296 | /* SATA has issues if re-programmed when locked */ |
| 297 | val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS); | 297 | val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS); |
| 298 | if (!(val & PLL_LOCK)) | 298 | if ((val & PLL_LOCK) && of_device_is_compatible(phy->dev->of_node, |
| 299 | if (ti_pipe3_dpll_program(phy)) | 299 | "ti,phy-pipe3-sata")) |
| 300 | return -EINVAL; | 300 | return ret; |
| 301 | |||
| 302 | /* Program the DPLL */ | ||
| 303 | ret = ti_pipe3_dpll_program(phy); | ||
| 304 | if (ret) { | ||
| 305 | ti_pipe3_disable_clocks(phy); | ||
| 306 | return -EINVAL; | ||
| 307 | } | ||
| 301 | 308 | ||
| 302 | return ret; | 309 | return ret; |
| 303 | } | 310 | } |
diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c index 6b6af6cba454..d9b10a39a2cf 100644 --- a/drivers/phy/phy-twl4030-usb.c +++ b/drivers/phy/phy-twl4030-usb.c | |||
| @@ -463,7 +463,8 @@ static int twl4030_phy_power_on(struct phy *phy) | |||
| 463 | twl4030_usb_set_mode(twl, twl->usb_mode); | 463 | twl4030_usb_set_mode(twl, twl->usb_mode); |
| 464 | if (twl->usb_mode == T2_USB_MODE_ULPI) | 464 | if (twl->usb_mode == T2_USB_MODE_ULPI) |
| 465 | twl4030_i2c_access(twl, 0); | 465 | twl4030_i2c_access(twl, 0); |
| 466 | schedule_delayed_work(&twl->id_workaround_work, 0); | 466 | twl->linkstat = MUSB_UNKNOWN; |
| 467 | schedule_delayed_work(&twl->id_workaround_work, HZ); | ||
| 467 | 468 | ||
| 468 | return 0; | 469 | return 0; |
| 469 | } | 470 | } |
| @@ -537,6 +538,7 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) | |||
| 537 | struct twl4030_usb *twl = _twl; | 538 | struct twl4030_usb *twl = _twl; |
| 538 | enum musb_vbus_id_status status; | 539 | enum musb_vbus_id_status status; |
| 539 | bool status_changed = false; | 540 | bool status_changed = false; |
| 541 | int err; | ||
| 540 | 542 | ||
| 541 | status = twl4030_usb_linkstat(twl); | 543 | status = twl4030_usb_linkstat(twl); |
| 542 | 544 | ||
| @@ -567,7 +569,9 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) | |||
| 567 | pm_runtime_mark_last_busy(twl->dev); | 569 | pm_runtime_mark_last_busy(twl->dev); |
| 568 | pm_runtime_put_autosuspend(twl->dev); | 570 | pm_runtime_put_autosuspend(twl->dev); |
| 569 | } | 571 | } |
| 570 | musb_mailbox(status); | 572 | err = musb_mailbox(status); |
| 573 | if (err) | ||
| 574 | twl->linkstat = MUSB_UNKNOWN; | ||
| 571 | } | 575 | } |
| 572 | 576 | ||
| 573 | /* don't schedule during sleep - irq works right then */ | 577 | /* don't schedule during sleep - irq works right then */ |
| @@ -595,7 +599,8 @@ static int twl4030_phy_init(struct phy *phy) | |||
| 595 | struct twl4030_usb *twl = phy_get_drvdata(phy); | 599 | struct twl4030_usb *twl = phy_get_drvdata(phy); |
| 596 | 600 | ||
| 597 | pm_runtime_get_sync(twl->dev); | 601 | pm_runtime_get_sync(twl->dev); |
| 598 | schedule_delayed_work(&twl->id_workaround_work, 0); | 602 | twl->linkstat = MUSB_UNKNOWN; |
| 603 | schedule_delayed_work(&twl->id_workaround_work, HZ); | ||
| 599 | pm_runtime_mark_last_busy(twl->dev); | 604 | pm_runtime_mark_last_busy(twl->dev); |
| 600 | pm_runtime_put_autosuspend(twl->dev); | 605 | pm_runtime_put_autosuspend(twl->dev); |
| 601 | 606 | ||
| @@ -763,7 +768,8 @@ static int twl4030_usb_remove(struct platform_device *pdev) | |||
| 763 | if (cable_present(twl->linkstat)) | 768 | if (cable_present(twl->linkstat)) |
| 764 | pm_runtime_put_noidle(twl->dev); | 769 | pm_runtime_put_noidle(twl->dev); |
| 765 | pm_runtime_mark_last_busy(twl->dev); | 770 | pm_runtime_mark_last_busy(twl->dev); |
| 766 | pm_runtime_put_sync_suspend(twl->dev); | 771 | pm_runtime_dont_use_autosuspend(&pdev->dev); |
| 772 | pm_runtime_put_sync(twl->dev); | ||
| 767 | pm_runtime_disable(twl->dev); | 773 | pm_runtime_disable(twl->dev); |
| 768 | 774 | ||
| 769 | /* autogate 60MHz ULPI clock, | 775 | /* autogate 60MHz ULPI clock, |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index c06bb85c2839..3ec0025d19e7 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
| @@ -103,7 +103,6 @@ config DELL_SMBIOS | |||
| 103 | 103 | ||
| 104 | config DELL_LAPTOP | 104 | config DELL_LAPTOP |
| 105 | tristate "Dell Laptop Extras" | 105 | tristate "Dell Laptop Extras" |
| 106 | depends on X86 | ||
| 107 | depends on DELL_SMBIOS | 106 | depends on DELL_SMBIOS |
| 108 | depends on DMI | 107 | depends on DMI |
| 109 | depends on BACKLIGHT_CLASS_DEVICE | 108 | depends on BACKLIGHT_CLASS_DEVICE |
| @@ -505,7 +504,7 @@ config THINKPAD_ACPI_HOTKEY_POLL | |||
| 505 | 504 | ||
| 506 | config SENSORS_HDAPS | 505 | config SENSORS_HDAPS |
| 507 | tristate "Thinkpad Hard Drive Active Protection System (hdaps)" | 506 | tristate "Thinkpad Hard Drive Active Protection System (hdaps)" |
| 508 | depends on INPUT && X86 | 507 | depends on INPUT |
| 509 | select INPUT_POLLDEV | 508 | select INPUT_POLLDEV |
| 510 | default n | 509 | default n |
| 511 | help | 510 | help |
| @@ -749,7 +748,7 @@ config TOSHIBA_WMI | |||
| 749 | 748 | ||
| 750 | config ACPI_CMPC | 749 | config ACPI_CMPC |
| 751 | tristate "CMPC Laptop Extras" | 750 | tristate "CMPC Laptop Extras" |
| 752 | depends on X86 && ACPI | 751 | depends on ACPI |
| 753 | depends on RFKILL || RFKILL=n | 752 | depends on RFKILL || RFKILL=n |
| 754 | select INPUT | 753 | select INPUT |
| 755 | select BACKLIGHT_CLASS_DEVICE | 754 | select BACKLIGHT_CLASS_DEVICE |
| @@ -848,7 +847,7 @@ config INTEL_IMR | |||
| 848 | 847 | ||
| 849 | config INTEL_PMC_CORE | 848 | config INTEL_PMC_CORE |
| 850 | bool "Intel PMC Core driver" | 849 | bool "Intel PMC Core driver" |
| 851 | depends on X86 && PCI | 850 | depends on PCI |
| 852 | ---help--- | 851 | ---help--- |
| 853 | The Intel Platform Controller Hub for Intel Core SoCs provides access | 852 | The Intel Platform Controller Hub for Intel Core SoCs provides access |
| 854 | to Power Management Controller registers via a PCI interface. This | 853 | to Power Management Controller registers via a PCI interface. This |
| @@ -860,7 +859,7 @@ config INTEL_PMC_CORE | |||
| 860 | 859 | ||
| 861 | config IBM_RTL | 860 | config IBM_RTL |
| 862 | tristate "Device driver to enable PRTL support" | 861 | tristate "Device driver to enable PRTL support" |
| 863 | depends on X86 && PCI | 862 | depends on PCI |
| 864 | ---help--- | 863 | ---help--- |
| 865 | Enable support for IBM Premium Real Time Mode (PRTM). | 864 | Enable support for IBM Premium Real Time Mode (PRTM). |
| 866 | This module will allow you the enter and exit PRTM in the BIOS via | 865 | This module will allow you the enter and exit PRTM in the BIOS via |
| @@ -894,7 +893,6 @@ config XO15_EBOOK | |||
| 894 | 893 | ||
| 895 | config SAMSUNG_LAPTOP | 894 | config SAMSUNG_LAPTOP |
| 896 | tristate "Samsung Laptop driver" | 895 | tristate "Samsung Laptop driver" |
| 897 | depends on X86 | ||
| 898 | depends on RFKILL || RFKILL = n | 896 | depends on RFKILL || RFKILL = n |
| 899 | depends on ACPI_VIDEO || ACPI_VIDEO = n | 897 | depends on ACPI_VIDEO || ACPI_VIDEO = n |
| 900 | depends on BACKLIGHT_CLASS_DEVICE | 898 | depends on BACKLIGHT_CLASS_DEVICE |
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 4a23fbc66b71..d1a091b93192 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c | |||
| @@ -567,6 +567,7 @@ static void ideapad_sysfs_exit(struct ideapad_private *priv) | |||
| 567 | static const struct key_entry ideapad_keymap[] = { | 567 | static const struct key_entry ideapad_keymap[] = { |
| 568 | { KE_KEY, 6, { KEY_SWITCHVIDEOMODE } }, | 568 | { KE_KEY, 6, { KEY_SWITCHVIDEOMODE } }, |
| 569 | { KE_KEY, 7, { KEY_CAMERA } }, | 569 | { KE_KEY, 7, { KEY_CAMERA } }, |
| 570 | { KE_KEY, 8, { KEY_MICMUTE } }, | ||
| 570 | { KE_KEY, 11, { KEY_F16 } }, | 571 | { KE_KEY, 11, { KEY_F16 } }, |
| 571 | { KE_KEY, 13, { KEY_WLAN } }, | 572 | { KE_KEY, 13, { KEY_WLAN } }, |
| 572 | { KE_KEY, 16, { KEY_PROG1 } }, | 573 | { KE_KEY, 16, { KEY_PROG1 } }, |
| @@ -809,6 +810,7 @@ static void ideapad_acpi_notify(acpi_handle handle, u32 event, void *data) | |||
| 809 | break; | 810 | break; |
| 810 | case 13: | 811 | case 13: |
| 811 | case 11: | 812 | case 11: |
| 813 | case 8: | ||
| 812 | case 7: | 814 | case 7: |
| 813 | case 6: | 815 | case 6: |
| 814 | ideapad_input_report(priv, vpc_bit); | 816 | ideapad_input_report(priv, vpc_bit); |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index c3bfa1fe95bf..b65ce7519411 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
| @@ -2043,6 +2043,7 @@ static int hotkey_autosleep_ack; | |||
| 2043 | 2043 | ||
| 2044 | static u32 hotkey_orig_mask; /* events the BIOS had enabled */ | 2044 | static u32 hotkey_orig_mask; /* events the BIOS had enabled */ |
| 2045 | static u32 hotkey_all_mask; /* all events supported in fw */ | 2045 | static u32 hotkey_all_mask; /* all events supported in fw */ |
| 2046 | static u32 hotkey_adaptive_all_mask; /* all adaptive events supported in fw */ | ||
| 2046 | static u32 hotkey_reserved_mask; /* events better left disabled */ | 2047 | static u32 hotkey_reserved_mask; /* events better left disabled */ |
| 2047 | static u32 hotkey_driver_mask; /* events needed by the driver */ | 2048 | static u32 hotkey_driver_mask; /* events needed by the driver */ |
| 2048 | static u32 hotkey_user_mask; /* events visible to userspace */ | 2049 | static u32 hotkey_user_mask; /* events visible to userspace */ |
| @@ -2742,6 +2743,17 @@ static ssize_t hotkey_all_mask_show(struct device *dev, | |||
| 2742 | 2743 | ||
| 2743 | static DEVICE_ATTR_RO(hotkey_all_mask); | 2744 | static DEVICE_ATTR_RO(hotkey_all_mask); |
| 2744 | 2745 | ||
| 2746 | /* sysfs hotkey all_mask ----------------------------------------------- */ | ||
| 2747 | static ssize_t hotkey_adaptive_all_mask_show(struct device *dev, | ||
| 2748 | struct device_attribute *attr, | ||
| 2749 | char *buf) | ||
| 2750 | { | ||
| 2751 | return snprintf(buf, PAGE_SIZE, "0x%08x\n", | ||
| 2752 | hotkey_adaptive_all_mask | hotkey_source_mask); | ||
| 2753 | } | ||
| 2754 | |||
| 2755 | static DEVICE_ATTR_RO(hotkey_adaptive_all_mask); | ||
| 2756 | |||
| 2745 | /* sysfs hotkey recommended_mask --------------------------------------- */ | 2757 | /* sysfs hotkey recommended_mask --------------------------------------- */ |
| 2746 | static ssize_t hotkey_recommended_mask_show(struct device *dev, | 2758 | static ssize_t hotkey_recommended_mask_show(struct device *dev, |
| 2747 | struct device_attribute *attr, | 2759 | struct device_attribute *attr, |
| @@ -2985,6 +2997,7 @@ static struct attribute *hotkey_attributes[] __initdata = { | |||
| 2985 | &dev_attr_wakeup_hotunplug_complete.attr, | 2997 | &dev_attr_wakeup_hotunplug_complete.attr, |
| 2986 | &dev_attr_hotkey_mask.attr, | 2998 | &dev_attr_hotkey_mask.attr, |
| 2987 | &dev_attr_hotkey_all_mask.attr, | 2999 | &dev_attr_hotkey_all_mask.attr, |
| 3000 | &dev_attr_hotkey_adaptive_all_mask.attr, | ||
| 2988 | &dev_attr_hotkey_recommended_mask.attr, | 3001 | &dev_attr_hotkey_recommended_mask.attr, |
| 2989 | #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL | 3002 | #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL |
| 2990 | &dev_attr_hotkey_source_mask.attr, | 3003 | &dev_attr_hotkey_source_mask.attr, |
| @@ -3321,20 +3334,6 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
| 3321 | if (!tp_features.hotkey) | 3334 | if (!tp_features.hotkey) |
| 3322 | return 1; | 3335 | return 1; |
| 3323 | 3336 | ||
| 3324 | /* | ||
| 3325 | * Check if we have an adaptive keyboard, like on the | ||
| 3326 | * Lenovo Carbon X1 2014 (2nd Gen). | ||
| 3327 | */ | ||
| 3328 | if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) { | ||
| 3329 | if ((hkeyv >> 8) == 2) { | ||
| 3330 | tp_features.has_adaptive_kbd = true; | ||
| 3331 | res = sysfs_create_group(&tpacpi_pdev->dev.kobj, | ||
| 3332 | &adaptive_kbd_attr_group); | ||
| 3333 | if (res) | ||
| 3334 | goto err_exit; | ||
| 3335 | } | ||
| 3336 | } | ||
| 3337 | |||
| 3338 | quirks = tpacpi_check_quirks(tpacpi_hotkey_qtable, | 3337 | quirks = tpacpi_check_quirks(tpacpi_hotkey_qtable, |
| 3339 | ARRAY_SIZE(tpacpi_hotkey_qtable)); | 3338 | ARRAY_SIZE(tpacpi_hotkey_qtable)); |
| 3340 | 3339 | ||
| @@ -3357,30 +3356,70 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
| 3357 | A30, R30, R31, T20-22, X20-21, X22-24. Detected by checking | 3356 | A30, R30, R31, T20-22, X20-21, X22-24. Detected by checking |
| 3358 | for HKEY interface version 0x100 */ | 3357 | for HKEY interface version 0x100 */ |
| 3359 | if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) { | 3358 | if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) { |
| 3360 | if ((hkeyv >> 8) != 1) { | 3359 | vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, |
| 3361 | pr_err("unknown version of the HKEY interface: 0x%x\n", | 3360 | "firmware HKEY interface version: 0x%x\n", |
| 3362 | hkeyv); | 3361 | hkeyv); |
| 3363 | pr_err("please report this to %s\n", TPACPI_MAIL); | 3362 | |
| 3364 | } else { | 3363 | switch (hkeyv >> 8) { |
| 3364 | case 1: | ||
| 3365 | /* | 3365 | /* |
| 3366 | * MHKV 0x100 in A31, R40, R40e, | 3366 | * MHKV 0x100 in A31, R40, R40e, |
| 3367 | * T4x, X31, and later | 3367 | * T4x, X31, and later |
| 3368 | */ | 3368 | */ |
| 3369 | vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, | ||
| 3370 | "firmware HKEY interface version: 0x%x\n", | ||
| 3371 | hkeyv); | ||
| 3372 | 3369 | ||
| 3373 | /* Paranoia check AND init hotkey_all_mask */ | 3370 | /* Paranoia check AND init hotkey_all_mask */ |
| 3374 | if (!acpi_evalf(hkey_handle, &hotkey_all_mask, | 3371 | if (!acpi_evalf(hkey_handle, &hotkey_all_mask, |
| 3375 | "MHKA", "qd")) { | 3372 | "MHKA", "qd")) { |
| 3376 | pr_err("missing MHKA handler, " | 3373 | pr_err("missing MHKA handler, please report this to %s\n", |
| 3377 | "please report this to %s\n", | ||
| 3378 | TPACPI_MAIL); | 3374 | TPACPI_MAIL); |
| 3379 | /* Fallback: pre-init for FN+F3,F4,F12 */ | 3375 | /* Fallback: pre-init for FN+F3,F4,F12 */ |
| 3380 | hotkey_all_mask = 0x080cU; | 3376 | hotkey_all_mask = 0x080cU; |
| 3381 | } else { | 3377 | } else { |
| 3382 | tp_features.hotkey_mask = 1; | 3378 | tp_features.hotkey_mask = 1; |
| 3383 | } | 3379 | } |
| 3380 | break; | ||
| 3381 | |||
| 3382 | case 2: | ||
| 3383 | /* | ||
| 3384 | * MHKV 0x200 in X1, T460s, X260, T560, X1 Tablet (2016) | ||
| 3385 | */ | ||
| 3386 | |||
| 3387 | /* Paranoia check AND init hotkey_all_mask */ | ||
| 3388 | if (!acpi_evalf(hkey_handle, &hotkey_all_mask, | ||
| 3389 | "MHKA", "dd", 1)) { | ||
| 3390 | pr_err("missing MHKA handler, please report this to %s\n", | ||
| 3391 | TPACPI_MAIL); | ||
| 3392 | /* Fallback: pre-init for FN+F3,F4,F12 */ | ||
| 3393 | hotkey_all_mask = 0x080cU; | ||
| 3394 | } else { | ||
| 3395 | tp_features.hotkey_mask = 1; | ||
| 3396 | } | ||
| 3397 | |||
| 3398 | /* | ||
| 3399 | * Check if we have an adaptive keyboard, like on the | ||
| 3400 | * Lenovo Carbon X1 2014 (2nd Gen). | ||
| 3401 | */ | ||
| 3402 | if (acpi_evalf(hkey_handle, &hotkey_adaptive_all_mask, | ||
| 3403 | "MHKA", "dd", 2)) { | ||
| 3404 | if (hotkey_adaptive_all_mask != 0) { | ||
| 3405 | tp_features.has_adaptive_kbd = true; | ||
| 3406 | res = sysfs_create_group( | ||
| 3407 | &tpacpi_pdev->dev.kobj, | ||
| 3408 | &adaptive_kbd_attr_group); | ||
| 3409 | if (res) | ||
| 3410 | goto err_exit; | ||
| 3411 | } | ||
| 3412 | } else { | ||
| 3413 | tp_features.has_adaptive_kbd = false; | ||
| 3414 | hotkey_adaptive_all_mask = 0x0U; | ||
| 3415 | } | ||
| 3416 | break; | ||
| 3417 | |||
| 3418 | default: | ||
| 3419 | pr_err("unknown version of the HKEY interface: 0x%x\n", | ||
| 3420 | hkeyv); | ||
| 3421 | pr_err("please report this to %s\n", TPACPI_MAIL); | ||
| 3422 | break; | ||
| 3384 | } | 3423 | } |
| 3385 | } | 3424 | } |
| 3386 | 3425 | ||
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index dba3843c53b8..ed337a8c34ab 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c | |||
| @@ -457,7 +457,8 @@ int pwm_apply_state(struct pwm_device *pwm, struct pwm_state *state) | |||
| 457 | { | 457 | { |
| 458 | int err; | 458 | int err; |
| 459 | 459 | ||
| 460 | if (!pwm) | 460 | if (!pwm || !state || !state->period || |
| 461 | state->duty_cycle > state->period) | ||
| 461 | return -EINVAL; | 462 | return -EINVAL; |
| 462 | 463 | ||
| 463 | if (!memcmp(state, &pwm->state, sizeof(*state))) | 464 | if (!memcmp(state, &pwm->state, sizeof(*state))) |
diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c index f994c7eaf41c..14fc011faa32 100644 --- a/drivers/pwm/pwm-atmel-hlcdc.c +++ b/drivers/pwm/pwm-atmel-hlcdc.c | |||
| @@ -272,7 +272,7 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev) | |||
| 272 | chip->chip.of_pwm_n_cells = 3; | 272 | chip->chip.of_pwm_n_cells = 3; |
| 273 | chip->chip.can_sleep = 1; | 273 | chip->chip.can_sleep = 1; |
| 274 | 274 | ||
| 275 | ret = pwmchip_add(&chip->chip); | 275 | ret = pwmchip_add_with_polarity(&chip->chip, PWM_POLARITY_INVERSED); |
| 276 | if (ret) { | 276 | if (ret) { |
| 277 | clk_disable_unprepare(hlcdc->periph_clk); | 277 | clk_disable_unprepare(hlcdc->periph_clk); |
| 278 | return ret; | 278 | return ret; |
diff --git a/drivers/pwm/sysfs.c b/drivers/pwm/sysfs.c index d98599249a05..01695d48dd54 100644 --- a/drivers/pwm/sysfs.c +++ b/drivers/pwm/sysfs.c | |||
| @@ -152,7 +152,7 @@ static ssize_t enable_store(struct device *child, | |||
| 152 | goto unlock; | 152 | goto unlock; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | pwm_apply_state(pwm, &state); | 155 | ret = pwm_apply_state(pwm, &state); |
| 156 | 156 | ||
| 157 | unlock: | 157 | unlock: |
| 158 | mutex_unlock(&export->lock); | 158 | mutex_unlock(&export->lock); |
diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c index 56a17ec5b5ef..526bf23dcb49 100644 --- a/drivers/regulator/qcom_smd-regulator.c +++ b/drivers/regulator/qcom_smd-regulator.c | |||
| @@ -140,6 +140,19 @@ static const struct regulator_ops rpm_smps_ldo_ops = { | |||
| 140 | .enable = rpm_reg_enable, | 140 | .enable = rpm_reg_enable, |
| 141 | .disable = rpm_reg_disable, | 141 | .disable = rpm_reg_disable, |
| 142 | .is_enabled = rpm_reg_is_enabled, | 142 | .is_enabled = rpm_reg_is_enabled, |
| 143 | .list_voltage = regulator_list_voltage_linear_range, | ||
| 144 | |||
| 145 | .get_voltage = rpm_reg_get_voltage, | ||
| 146 | .set_voltage = rpm_reg_set_voltage, | ||
| 147 | |||
| 148 | .set_load = rpm_reg_set_load, | ||
| 149 | }; | ||
| 150 | |||
| 151 | static const struct regulator_ops rpm_smps_ldo_ops_fixed = { | ||
| 152 | .enable = rpm_reg_enable, | ||
| 153 | .disable = rpm_reg_disable, | ||
| 154 | .is_enabled = rpm_reg_is_enabled, | ||
| 155 | .list_voltage = regulator_list_voltage_linear_range, | ||
| 143 | 156 | ||
| 144 | .get_voltage = rpm_reg_get_voltage, | 157 | .get_voltage = rpm_reg_get_voltage, |
| 145 | .set_voltage = rpm_reg_set_voltage, | 158 | .set_voltage = rpm_reg_set_voltage, |
| @@ -247,7 +260,7 @@ static const struct regulator_desc pm8941_nldo = { | |||
| 247 | static const struct regulator_desc pm8941_lnldo = { | 260 | static const struct regulator_desc pm8941_lnldo = { |
| 248 | .fixed_uV = 1740000, | 261 | .fixed_uV = 1740000, |
| 249 | .n_voltages = 1, | 262 | .n_voltages = 1, |
| 250 | .ops = &rpm_smps_ldo_ops, | 263 | .ops = &rpm_smps_ldo_ops_fixed, |
| 251 | }; | 264 | }; |
| 252 | 265 | ||
| 253 | static const struct regulator_desc pm8941_switch = { | 266 | static const struct regulator_desc pm8941_switch = { |
diff --git a/drivers/regulator/tps51632-regulator.c b/drivers/regulator/tps51632-regulator.c index 572816e30095..c139890c1514 100644 --- a/drivers/regulator/tps51632-regulator.c +++ b/drivers/regulator/tps51632-regulator.c | |||
| @@ -94,11 +94,14 @@ static int tps51632_dcdc_set_ramp_delay(struct regulator_dev *rdev, | |||
| 94 | int ramp_delay) | 94 | int ramp_delay) |
| 95 | { | 95 | { |
| 96 | struct tps51632_chip *tps = rdev_get_drvdata(rdev); | 96 | struct tps51632_chip *tps = rdev_get_drvdata(rdev); |
| 97 | int bit = ramp_delay/6000; | 97 | int bit; |
| 98 | int ret; | 98 | int ret; |
| 99 | 99 | ||
| 100 | if (bit) | 100 | if (ramp_delay == 0) |
| 101 | bit--; | 101 | bit = 0; |
| 102 | else | ||
| 103 | bit = DIV_ROUND_UP(ramp_delay, 6000) - 1; | ||
| 104 | |||
| 102 | ret = regmap_write(tps->regmap, TPS51632_SLEW_REGS, BIT(bit)); | 105 | ret = regmap_write(tps->regmap, TPS51632_SLEW_REGS, BIT(bit)); |
| 103 | if (ret < 0) | 106 | if (ret < 0) |
| 104 | dev_err(tps->dev, "SLEW reg write failed, err %d\n", ret); | 107 | dev_err(tps->dev, "SLEW reg write failed, err %d\n", ret); |
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index bbfee53cfcf5..845e49a52430 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | |||
| @@ -2521,12 +2521,13 @@ kiblnd_passive_connect(struct rdma_cm_id *cmid, void *priv, int priv_nob) | |||
| 2521 | return 0; | 2521 | return 0; |
| 2522 | 2522 | ||
| 2523 | failed: | 2523 | failed: |
| 2524 | if (ni) | 2524 | if (ni) { |
| 2525 | lnet_ni_decref(ni); | 2525 | lnet_ni_decref(ni); |
| 2526 | rej.ibr_cp.ibcp_queue_depth = kiblnd_msg_queue_size(version, ni); | ||
| 2527 | rej.ibr_cp.ibcp_max_frags = kiblnd_rdma_frags(version, ni); | ||
| 2528 | } | ||
| 2526 | 2529 | ||
| 2527 | rej.ibr_version = version; | 2530 | rej.ibr_version = version; |
| 2528 | rej.ibr_cp.ibcp_queue_depth = kiblnd_msg_queue_size(version, ni); | ||
| 2529 | rej.ibr_cp.ibcp_max_frags = kiblnd_rdma_frags(version, ni); | ||
| 2530 | kiblnd_reject(cmid, &rej); | 2531 | kiblnd_reject(cmid, &rej); |
| 2531 | 2532 | ||
| 2532 | return -ECONNREFUSED; | 2533 | return -ECONNREFUSED; |
diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c index c17870cddb5b..fbce1f7e68ca 100644 --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c | |||
| @@ -102,7 +102,7 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf) | |||
| 102 | if (!efuseTbl) | 102 | if (!efuseTbl) |
| 103 | return; | 103 | return; |
| 104 | 104 | ||
| 105 | eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(*eFuseWord)); | 105 | eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); |
| 106 | if (!eFuseWord) { | 106 | if (!eFuseWord) { |
| 107 | DBG_88E("%s: alloc eFuseWord fail!\n", __func__); | 107 | DBG_88E("%s: alloc eFuseWord fail!\n", __func__); |
| 108 | goto eFuseWord_failed; | 108 | goto eFuseWord_failed; |
diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c index 87ea3b844951..363f3a34ddce 100644 --- a/drivers/staging/rtl8188eu/hal/usb_halinit.c +++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c | |||
| @@ -2072,7 +2072,8 @@ void rtl8188eu_set_hal_ops(struct adapter *adapt) | |||
| 2072 | { | 2072 | { |
| 2073 | struct hal_ops *halfunc = &adapt->HalFunc; | 2073 | struct hal_ops *halfunc = &adapt->HalFunc; |
| 2074 | 2074 | ||
| 2075 | adapt->HalData = kzalloc(sizeof(*adapt->HalData), GFP_KERNEL); | 2075 | |
| 2076 | adapt->HalData = kzalloc(sizeof(struct hal_data_8188e), GFP_KERNEL); | ||
| 2076 | if (!adapt->HalData) | 2077 | if (!adapt->HalData) |
| 2077 | DBG_88E("cant not alloc memory for HAL DATA\n"); | 2078 | DBG_88E("cant not alloc memory for HAL DATA\n"); |
| 2078 | 2079 | ||
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 6dc810bce295..944a6dca0fcb 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
| @@ -44,6 +44,9 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
| 44 | /* Creative SB Audigy 2 NX */ | 44 | /* Creative SB Audigy 2 NX */ |
| 45 | { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, | 45 | { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 46 | 46 | ||
| 47 | /* USB3503 */ | ||
| 48 | { USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
| 49 | |||
| 47 | /* Microsoft Wireless Laser Mouse 6000 Receiver */ | 50 | /* Microsoft Wireless Laser Mouse 6000 Receiver */ |
| 48 | { USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME }, | 51 | { USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 49 | 52 | ||
| @@ -173,6 +176,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
| 173 | /* MAYA44USB sound device */ | 176 | /* MAYA44USB sound device */ |
| 174 | { USB_DEVICE(0x0a92, 0x0091), .driver_info = USB_QUIRK_RESET_RESUME }, | 177 | { USB_DEVICE(0x0a92, 0x0091), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 175 | 178 | ||
| 179 | /* ASUS Base Station(T100) */ | ||
| 180 | { USB_DEVICE(0x0b05, 0x17e0), .driver_info = | ||
| 181 | USB_QUIRK_IGNORE_REMOTE_WAKEUP }, | ||
| 182 | |||
| 176 | /* Action Semiconductor flash disk */ | 183 | /* Action Semiconductor flash disk */ |
| 177 | { USB_DEVICE(0x10d6, 0x2200), .driver_info = | 184 | { USB_DEVICE(0x10d6, 0x2200), .driver_info = |
| 178 | USB_QUIRK_STRING_FETCH_255 }, | 185 | USB_QUIRK_STRING_FETCH_255 }, |
| @@ -188,26 +195,22 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
| 188 | { USB_DEVICE(0x1908, 0x1315), .driver_info = | 195 | { USB_DEVICE(0x1908, 0x1315), .driver_info = |
| 189 | USB_QUIRK_HONOR_BNUMINTERFACES }, | 196 | USB_QUIRK_HONOR_BNUMINTERFACES }, |
| 190 | 197 | ||
| 191 | /* INTEL VALUE SSD */ | ||
| 192 | { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
| 193 | |||
| 194 | /* USB3503 */ | ||
| 195 | { USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
| 196 | |||
| 197 | /* ASUS Base Station(T100) */ | ||
| 198 | { USB_DEVICE(0x0b05, 0x17e0), .driver_info = | ||
| 199 | USB_QUIRK_IGNORE_REMOTE_WAKEUP }, | ||
| 200 | |||
| 201 | /* Protocol and OTG Electrical Test Device */ | 198 | /* Protocol and OTG Electrical Test Device */ |
| 202 | { USB_DEVICE(0x1a0a, 0x0200), .driver_info = | 199 | { USB_DEVICE(0x1a0a, 0x0200), .driver_info = |
| 203 | USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, | 200 | USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, |
| 204 | 201 | ||
| 202 | /* Acer C120 LED Projector */ | ||
| 203 | { USB_DEVICE(0x1de1, 0xc102), .driver_info = USB_QUIRK_NO_LPM }, | ||
| 204 | |||
| 205 | /* Blackmagic Design Intensity Shuttle */ | 205 | /* Blackmagic Design Intensity Shuttle */ |
| 206 | { USB_DEVICE(0x1edb, 0xbd3b), .driver_info = USB_QUIRK_NO_LPM }, | 206 | { USB_DEVICE(0x1edb, 0xbd3b), .driver_info = USB_QUIRK_NO_LPM }, |
| 207 | 207 | ||
| 208 | /* Blackmagic Design UltraStudio SDI */ | 208 | /* Blackmagic Design UltraStudio SDI */ |
| 209 | { USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM }, | 209 | { USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM }, |
| 210 | 210 | ||
| 211 | /* INTEL VALUE SSD */ | ||
| 212 | { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
| 213 | |||
| 211 | { } /* terminating entry must be last */ | 214 | { } /* terminating entry must be last */ |
| 212 | }; | 215 | }; |
| 213 | 216 | ||
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 3c58d633ce80..dec0b21fc626 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h | |||
| @@ -64,6 +64,17 @@ | |||
| 64 | DWC2_TRACE_SCHEDULER_VB(pr_fmt("%s: SCH: " fmt), \ | 64 | DWC2_TRACE_SCHEDULER_VB(pr_fmt("%s: SCH: " fmt), \ |
| 65 | dev_name(hsotg->dev), ##__VA_ARGS__) | 65 | dev_name(hsotg->dev), ##__VA_ARGS__) |
| 66 | 66 | ||
| 67 | #ifdef CONFIG_MIPS | ||
| 68 | /* | ||
| 69 | * There are some MIPS machines that can run in either big-endian | ||
| 70 | * or little-endian mode and that use the dwc2 register without | ||
| 71 | * a byteswap in both ways. | ||
| 72 | * Unlike other architectures, MIPS apparently does not require a | ||
| 73 | * barrier before the __raw_writel() to synchronize with DMA but does | ||
| 74 | * require the barrier after the __raw_writel() to serialize a set of | ||
| 75 | * writes. This set of operations was added specifically for MIPS and | ||
| 76 | * should only be used there. | ||
| 77 | */ | ||
| 67 | static inline u32 dwc2_readl(const void __iomem *addr) | 78 | static inline u32 dwc2_readl(const void __iomem *addr) |
| 68 | { | 79 | { |
| 69 | u32 value = __raw_readl(addr); | 80 | u32 value = __raw_readl(addr); |
| @@ -90,6 +101,22 @@ static inline void dwc2_writel(u32 value, void __iomem *addr) | |||
| 90 | pr_info("INFO:: wrote %08x to %p\n", value, addr); | 101 | pr_info("INFO:: wrote %08x to %p\n", value, addr); |
| 91 | #endif | 102 | #endif |
| 92 | } | 103 | } |
| 104 | #else | ||
| 105 | /* Normal architectures just use readl/write */ | ||
| 106 | static inline u32 dwc2_readl(const void __iomem *addr) | ||
| 107 | { | ||
| 108 | return readl(addr); | ||
| 109 | } | ||
| 110 | |||
| 111 | static inline void dwc2_writel(u32 value, void __iomem *addr) | ||
| 112 | { | ||
| 113 | writel(value, addr); | ||
| 114 | |||
| 115 | #ifdef DWC2_LOG_WRITES | ||
| 116 | pr_info("info:: wrote %08x to %p\n", value, addr); | ||
| 117 | #endif | ||
| 118 | } | ||
| 119 | #endif | ||
| 93 | 120 | ||
| 94 | /* Maximum number of Endpoints/HostChannels */ | 121 | /* Maximum number of Endpoints/HostChannels */ |
| 95 | #define MAX_EPS_CHANNELS 16 | 122 | #define MAX_EPS_CHANNELS 16 |
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 4c5e3005e1dc..26cf09d0fe3c 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
| @@ -1018,7 +1018,7 @@ static int dwc2_hsotg_process_req_status(struct dwc2_hsotg *hsotg, | |||
| 1018 | return 1; | 1018 | return 1; |
| 1019 | } | 1019 | } |
| 1020 | 1020 | ||
| 1021 | static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value); | 1021 | static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now); |
| 1022 | 1022 | ||
| 1023 | /** | 1023 | /** |
| 1024 | * get_ep_head - return the first request on the endpoint | 1024 | * get_ep_head - return the first request on the endpoint |
| @@ -1094,7 +1094,7 @@ static int dwc2_hsotg_process_req_feature(struct dwc2_hsotg *hsotg, | |||
| 1094 | case USB_ENDPOINT_HALT: | 1094 | case USB_ENDPOINT_HALT: |
| 1095 | halted = ep->halted; | 1095 | halted = ep->halted; |
| 1096 | 1096 | ||
| 1097 | dwc2_hsotg_ep_sethalt(&ep->ep, set); | 1097 | dwc2_hsotg_ep_sethalt(&ep->ep, set, true); |
| 1098 | 1098 | ||
| 1099 | ret = dwc2_hsotg_send_reply(hsotg, ep0, NULL, 0); | 1099 | ret = dwc2_hsotg_send_reply(hsotg, ep0, NULL, 0); |
| 1100 | if (ret) { | 1100 | if (ret) { |
| @@ -2948,8 +2948,13 @@ static int dwc2_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
| 2948 | * dwc2_hsotg_ep_sethalt - set halt on a given endpoint | 2948 | * dwc2_hsotg_ep_sethalt - set halt on a given endpoint |
| 2949 | * @ep: The endpoint to set halt. | 2949 | * @ep: The endpoint to set halt. |
| 2950 | * @value: Set or unset the halt. | 2950 | * @value: Set or unset the halt. |
| 2951 | * @now: If true, stall the endpoint now. Otherwise return -EAGAIN if | ||
| 2952 | * the endpoint is busy processing requests. | ||
| 2953 | * | ||
| 2954 | * We need to stall the endpoint immediately if request comes from set_feature | ||
| 2955 | * protocol command handler. | ||
| 2951 | */ | 2956 | */ |
| 2952 | static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value) | 2957 | static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now) |
| 2953 | { | 2958 | { |
| 2954 | struct dwc2_hsotg_ep *hs_ep = our_ep(ep); | 2959 | struct dwc2_hsotg_ep *hs_ep = our_ep(ep); |
| 2955 | struct dwc2_hsotg *hs = hs_ep->parent; | 2960 | struct dwc2_hsotg *hs = hs_ep->parent; |
| @@ -2969,6 +2974,17 @@ static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value) | |||
| 2969 | return 0; | 2974 | return 0; |
| 2970 | } | 2975 | } |
| 2971 | 2976 | ||
| 2977 | if (hs_ep->isochronous) { | ||
| 2978 | dev_err(hs->dev, "%s is Isochronous Endpoint\n", ep->name); | ||
| 2979 | return -EINVAL; | ||
| 2980 | } | ||
| 2981 | |||
| 2982 | if (!now && value && !list_empty(&hs_ep->queue)) { | ||
| 2983 | dev_dbg(hs->dev, "%s request is pending, cannot halt\n", | ||
| 2984 | ep->name); | ||
| 2985 | return -EAGAIN; | ||
| 2986 | } | ||
| 2987 | |||
| 2972 | if (hs_ep->dir_in) { | 2988 | if (hs_ep->dir_in) { |
| 2973 | epreg = DIEPCTL(index); | 2989 | epreg = DIEPCTL(index); |
| 2974 | epctl = dwc2_readl(hs->regs + epreg); | 2990 | epctl = dwc2_readl(hs->regs + epreg); |
| @@ -3020,7 +3036,7 @@ static int dwc2_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value) | |||
| 3020 | int ret = 0; | 3036 | int ret = 0; |
| 3021 | 3037 | ||
| 3022 | spin_lock_irqsave(&hs->lock, flags); | 3038 | spin_lock_irqsave(&hs->lock, flags); |
| 3023 | ret = dwc2_hsotg_ep_sethalt(ep, value); | 3039 | ret = dwc2_hsotg_ep_sethalt(ep, value, false); |
| 3024 | spin_unlock_irqrestore(&hs->lock, flags); | 3040 | spin_unlock_irqrestore(&hs->lock, flags); |
| 3025 | 3041 | ||
| 3026 | return ret; | 3042 | return ret; |
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 7ddf9449a063..654050684f4f 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h | |||
| @@ -402,6 +402,7 @@ | |||
| 402 | #define DWC3_DEPCMD_GET_RSC_IDX(x) (((x) >> DWC3_DEPCMD_PARAM_SHIFT) & 0x7f) | 402 | #define DWC3_DEPCMD_GET_RSC_IDX(x) (((x) >> DWC3_DEPCMD_PARAM_SHIFT) & 0x7f) |
| 403 | #define DWC3_DEPCMD_STATUS(x) (((x) >> 12) & 0x0F) | 403 | #define DWC3_DEPCMD_STATUS(x) (((x) >> 12) & 0x0F) |
| 404 | #define DWC3_DEPCMD_HIPRI_FORCERM (1 << 11) | 404 | #define DWC3_DEPCMD_HIPRI_FORCERM (1 << 11) |
| 405 | #define DWC3_DEPCMD_CLEARPENDIN (1 << 11) | ||
| 405 | #define DWC3_DEPCMD_CMDACT (1 << 10) | 406 | #define DWC3_DEPCMD_CMDACT (1 << 10) |
| 406 | #define DWC3_DEPCMD_CMDIOC (1 << 8) | 407 | #define DWC3_DEPCMD_CMDIOC (1 << 8) |
| 407 | 408 | ||
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index dd5cb5577dca..2f1fb7e7aa54 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c | |||
| @@ -128,12 +128,6 @@ static int dwc3_exynos_probe(struct platform_device *pdev) | |||
| 128 | 128 | ||
| 129 | platform_set_drvdata(pdev, exynos); | 129 | platform_set_drvdata(pdev, exynos); |
| 130 | 130 | ||
| 131 | ret = dwc3_exynos_register_phys(exynos); | ||
| 132 | if (ret) { | ||
| 133 | dev_err(dev, "couldn't register PHYs\n"); | ||
| 134 | return ret; | ||
| 135 | } | ||
| 136 | |||
| 137 | exynos->dev = dev; | 131 | exynos->dev = dev; |
| 138 | 132 | ||
| 139 | exynos->clk = devm_clk_get(dev, "usbdrd30"); | 133 | exynos->clk = devm_clk_get(dev, "usbdrd30"); |
| @@ -183,20 +177,29 @@ static int dwc3_exynos_probe(struct platform_device *pdev) | |||
| 183 | goto err3; | 177 | goto err3; |
| 184 | } | 178 | } |
| 185 | 179 | ||
| 180 | ret = dwc3_exynos_register_phys(exynos); | ||
| 181 | if (ret) { | ||
| 182 | dev_err(dev, "couldn't register PHYs\n"); | ||
| 183 | goto err4; | ||
| 184 | } | ||
| 185 | |||
| 186 | if (node) { | 186 | if (node) { |
| 187 | ret = of_platform_populate(node, NULL, NULL, dev); | 187 | ret = of_platform_populate(node, NULL, NULL, dev); |
| 188 | if (ret) { | 188 | if (ret) { |
| 189 | dev_err(dev, "failed to add dwc3 core\n"); | 189 | dev_err(dev, "failed to add dwc3 core\n"); |
| 190 | goto err4; | 190 | goto err5; |
| 191 | } | 191 | } |
| 192 | } else { | 192 | } else { |
| 193 | dev_err(dev, "no device node, failed to add dwc3 core\n"); | 193 | dev_err(dev, "no device node, failed to add dwc3 core\n"); |
| 194 | ret = -ENODEV; | 194 | ret = -ENODEV; |
| 195 | goto err4; | 195 | goto err5; |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | return 0; | 198 | return 0; |
| 199 | 199 | ||
| 200 | err5: | ||
| 201 | platform_device_unregister(exynos->usb2_phy); | ||
| 202 | platform_device_unregister(exynos->usb3_phy); | ||
| 200 | err4: | 203 | err4: |
| 201 | regulator_disable(exynos->vdd10); | 204 | regulator_disable(exynos->vdd10); |
| 202 | err3: | 205 | err3: |
diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c index 5c0adb9c6fb2..50d6ae6f88bc 100644 --- a/drivers/usb/dwc3/dwc3-st.c +++ b/drivers/usb/dwc3/dwc3-st.c | |||
| @@ -129,12 +129,18 @@ static int st_dwc3_drd_init(struct st_dwc3 *dwc3_data) | |||
| 129 | switch (dwc3_data->dr_mode) { | 129 | switch (dwc3_data->dr_mode) { |
| 130 | case USB_DR_MODE_PERIPHERAL: | 130 | case USB_DR_MODE_PERIPHERAL: |
| 131 | 131 | ||
| 132 | val &= ~(USB3_FORCE_VBUSVALID | USB3_DELAY_VBUSVALID | 132 | val &= ~(USB3_DELAY_VBUSVALID |
| 133 | | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3) | 133 | | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3) |
| 134 | | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2 | 134 | | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2 |
| 135 | | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2); | 135 | | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2); |
| 136 | 136 | ||
| 137 | val |= USB3_DEVICE_NOT_HOST; | 137 | /* |
| 138 | * USB3_PORT2_FORCE_VBUSVALID When '1' and when | ||
| 139 | * USB3_PORT2_DEVICE_NOT_HOST = 1, forces VBUSVLDEXT2 input | ||
| 140 | * of the pico PHY to 1. | ||
| 141 | */ | ||
| 142 | |||
| 143 | val |= USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID; | ||
| 138 | break; | 144 | break; |
| 139 | 145 | ||
| 140 | case USB_DR_MODE_HOST: | 146 | case USB_DR_MODE_HOST: |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 9a7d0bd15dc3..07248ff1be5c 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
| @@ -347,6 +347,28 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep, | |||
| 347 | return ret; | 347 | return ret; |
| 348 | } | 348 | } |
| 349 | 349 | ||
| 350 | static int dwc3_send_clear_stall_ep_cmd(struct dwc3_ep *dep) | ||
| 351 | { | ||
| 352 | struct dwc3 *dwc = dep->dwc; | ||
| 353 | struct dwc3_gadget_ep_cmd_params params; | ||
| 354 | u32 cmd = DWC3_DEPCMD_CLEARSTALL; | ||
| 355 | |||
| 356 | /* | ||
| 357 | * As of core revision 2.60a the recommended programming model | ||
| 358 | * is to set the ClearPendIN bit when issuing a Clear Stall EP | ||
| 359 | * command for IN endpoints. This is to prevent an issue where | ||
| 360 | * some (non-compliant) hosts may not send ACK TPs for pending | ||
| 361 | * IN transfers due to a mishandled error condition. Synopsys | ||
| 362 | * STAR 9000614252. | ||
| 363 | */ | ||
| 364 | if (dep->direction && (dwc->revision >= DWC3_REVISION_260A)) | ||
| 365 | cmd |= DWC3_DEPCMD_CLEARPENDIN; | ||
| 366 | |||
| 367 | memset(¶ms, 0, sizeof(params)); | ||
| 368 | |||
| 369 | return dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, ¶ms); | ||
| 370 | } | ||
| 371 | |||
| 350 | static dma_addr_t dwc3_trb_dma_offset(struct dwc3_ep *dep, | 372 | static dma_addr_t dwc3_trb_dma_offset(struct dwc3_ep *dep, |
| 351 | struct dwc3_trb *trb) | 373 | struct dwc3_trb *trb) |
| 352 | { | 374 | { |
| @@ -1314,8 +1336,7 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol) | |||
| 1314 | else | 1336 | else |
| 1315 | dep->flags |= DWC3_EP_STALL; | 1337 | dep->flags |= DWC3_EP_STALL; |
| 1316 | } else { | 1338 | } else { |
| 1317 | ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, | 1339 | ret = dwc3_send_clear_stall_ep_cmd(dep); |
| 1318 | DWC3_DEPCMD_CLEARSTALL, ¶ms); | ||
| 1319 | if (ret) | 1340 | if (ret) |
| 1320 | dev_err(dwc->dev, "failed to clear STALL on %s\n", | 1341 | dev_err(dwc->dev, "failed to clear STALL on %s\n", |
| 1321 | dep->name); | 1342 | dep->name); |
| @@ -2247,7 +2268,6 @@ static void dwc3_clear_stall_all_ep(struct dwc3 *dwc) | |||
| 2247 | 2268 | ||
| 2248 | for (epnum = 1; epnum < DWC3_ENDPOINTS_NUM; epnum++) { | 2269 | for (epnum = 1; epnum < DWC3_ENDPOINTS_NUM; epnum++) { |
| 2249 | struct dwc3_ep *dep; | 2270 | struct dwc3_ep *dep; |
| 2250 | struct dwc3_gadget_ep_cmd_params params; | ||
| 2251 | int ret; | 2271 | int ret; |
| 2252 | 2272 | ||
| 2253 | dep = dwc->eps[epnum]; | 2273 | dep = dwc->eps[epnum]; |
| @@ -2259,9 +2279,7 @@ static void dwc3_clear_stall_all_ep(struct dwc3 *dwc) | |||
| 2259 | 2279 | ||
| 2260 | dep->flags &= ~DWC3_EP_STALL; | 2280 | dep->flags &= ~DWC3_EP_STALL; |
| 2261 | 2281 | ||
| 2262 | memset(¶ms, 0, sizeof(params)); | 2282 | ret = dwc3_send_clear_stall_ep_cmd(dep); |
| 2263 | ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, | ||
| 2264 | DWC3_DEPCMD_CLEARSTALL, ¶ms); | ||
| 2265 | WARN_ON_ONCE(ret); | 2283 | WARN_ON_ONCE(ret); |
| 2266 | } | 2284 | } |
| 2267 | } | 2285 | } |
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index d67de0d22a2b..eb648485a58c 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
| @@ -1868,14 +1868,19 @@ unknown: | |||
| 1868 | } | 1868 | } |
| 1869 | break; | 1869 | break; |
| 1870 | } | 1870 | } |
| 1871 | req->length = value; | 1871 | |
| 1872 | req->context = cdev; | 1872 | if (value >= 0) { |
| 1873 | req->zero = value < w_length; | 1873 | req->length = value; |
| 1874 | value = composite_ep0_queue(cdev, req, GFP_ATOMIC); | 1874 | req->context = cdev; |
| 1875 | if (value < 0) { | 1875 | req->zero = value < w_length; |
| 1876 | DBG(cdev, "ep_queue --> %d\n", value); | 1876 | value = composite_ep0_queue(cdev, req, |
| 1877 | req->status = 0; | 1877 | GFP_ATOMIC); |
| 1878 | composite_setup_complete(gadget->ep0, req); | 1878 | if (value < 0) { |
| 1879 | DBG(cdev, "ep_queue --> %d\n", value); | ||
| 1880 | req->status = 0; | ||
| 1881 | composite_setup_complete(gadget->ep0, | ||
| 1882 | req); | ||
| 1883 | } | ||
| 1879 | } | 1884 | } |
| 1880 | return value; | 1885 | return value; |
| 1881 | } | 1886 | } |
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index b6f60ca8a035..70cf3477f951 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c | |||
| @@ -1401,6 +1401,7 @@ static const struct usb_gadget_driver configfs_driver_template = { | |||
| 1401 | .owner = THIS_MODULE, | 1401 | .owner = THIS_MODULE, |
| 1402 | .name = "configfs-gadget", | 1402 | .name = "configfs-gadget", |
| 1403 | }, | 1403 | }, |
| 1404 | .match_existing_only = 1, | ||
| 1404 | }; | 1405 | }; |
| 1405 | 1406 | ||
| 1406 | static struct config_group *gadgets_make( | 1407 | static struct config_group *gadgets_make( |
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 73515d54e1cc..cc33d2667408 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
| @@ -2051,7 +2051,7 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, | |||
| 2051 | 2051 | ||
| 2052 | if (len < sizeof(*d) || | 2052 | if (len < sizeof(*d) || |
| 2053 | d->bFirstInterfaceNumber >= ffs->interfaces_count || | 2053 | d->bFirstInterfaceNumber >= ffs->interfaces_count || |
| 2054 | d->Reserved1) | 2054 | !d->Reserved1) |
| 2055 | return -EINVAL; | 2055 | return -EINVAL; |
| 2056 | for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i) | 2056 | for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i) |
| 2057 | if (d->Reserved2[i]) | 2057 | if (d->Reserved2[i]) |
| @@ -2729,6 +2729,7 @@ static int _ffs_func_bind(struct usb_configuration *c, | |||
| 2729 | func->ffs->ss_descs_count; | 2729 | func->ffs->ss_descs_count; |
| 2730 | 2730 | ||
| 2731 | int fs_len, hs_len, ss_len, ret, i; | 2731 | int fs_len, hs_len, ss_len, ret, i; |
| 2732 | struct ffs_ep *eps_ptr; | ||
| 2732 | 2733 | ||
| 2733 | /* Make it a single chunk, less management later on */ | 2734 | /* Make it a single chunk, less management later on */ |
| 2734 | vla_group(d); | 2735 | vla_group(d); |
| @@ -2777,12 +2778,9 @@ static int _ffs_func_bind(struct usb_configuration *c, | |||
| 2777 | ffs->raw_descs_length); | 2778 | ffs->raw_descs_length); |
| 2778 | 2779 | ||
| 2779 | memset(vla_ptr(vlabuf, d, inums), 0xff, d_inums__sz); | 2780 | memset(vla_ptr(vlabuf, d, inums), 0xff, d_inums__sz); |
| 2780 | for (ret = ffs->eps_count; ret; --ret) { | 2781 | eps_ptr = vla_ptr(vlabuf, d, eps); |
| 2781 | struct ffs_ep *ptr; | 2782 | for (i = 0; i < ffs->eps_count; i++) |
| 2782 | 2783 | eps_ptr[i].num = -1; | |
| 2783 | ptr = vla_ptr(vlabuf, d, eps); | ||
| 2784 | ptr[ret].num = -1; | ||
| 2785 | } | ||
| 2786 | 2784 | ||
| 2787 | /* Save pointers | 2785 | /* Save pointers |
| 2788 | * d_eps == vlabuf, func->eps used to kfree vlabuf later | 2786 | * d_eps == vlabuf, func->eps used to kfree vlabuf later |
| @@ -2851,7 +2849,7 @@ static int _ffs_func_bind(struct usb_configuration *c, | |||
| 2851 | goto error; | 2849 | goto error; |
| 2852 | 2850 | ||
| 2853 | func->function.os_desc_table = vla_ptr(vlabuf, d, os_desc_table); | 2851 | func->function.os_desc_table = vla_ptr(vlabuf, d, os_desc_table); |
| 2854 | if (c->cdev->use_os_string) | 2852 | if (c->cdev->use_os_string) { |
| 2855 | for (i = 0; i < ffs->interfaces_count; ++i) { | 2853 | for (i = 0; i < ffs->interfaces_count; ++i) { |
| 2856 | struct usb_os_desc *desc; | 2854 | struct usb_os_desc *desc; |
| 2857 | 2855 | ||
| @@ -2862,13 +2860,15 @@ static int _ffs_func_bind(struct usb_configuration *c, | |||
| 2862 | vla_ptr(vlabuf, d, ext_compat) + i * 16; | 2860 | vla_ptr(vlabuf, d, ext_compat) + i * 16; |
| 2863 | INIT_LIST_HEAD(&desc->ext_prop); | 2861 | INIT_LIST_HEAD(&desc->ext_prop); |
| 2864 | } | 2862 | } |
| 2865 | ret = ffs_do_os_descs(ffs->ms_os_descs_count, | 2863 | ret = ffs_do_os_descs(ffs->ms_os_descs_count, |
| 2866 | vla_ptr(vlabuf, d, raw_descs) + | 2864 | vla_ptr(vlabuf, d, raw_descs) + |
| 2867 | fs_len + hs_len + ss_len, | 2865 | fs_len + hs_len + ss_len, |
| 2868 | d_raw_descs__sz - fs_len - hs_len - ss_len, | 2866 | d_raw_descs__sz - fs_len - hs_len - |
| 2869 | __ffs_func_bind_do_os_desc, func); | 2867 | ss_len, |
| 2870 | if (unlikely(ret < 0)) | 2868 | __ffs_func_bind_do_os_desc, func); |
| 2871 | goto error; | 2869 | if (unlikely(ret < 0)) |
| 2870 | goto error; | ||
| 2871 | } | ||
| 2872 | func->function.os_desc_n = | 2872 | func->function.os_desc_n = |
| 2873 | c->cdev->use_os_string ? ffs->interfaces_count : 0; | 2873 | c->cdev->use_os_string ? ffs->interfaces_count : 0; |
| 2874 | 2874 | ||
diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c index c45104e3a64b..64706a789580 100644 --- a/drivers/usb/gadget/function/f_printer.c +++ b/drivers/usb/gadget/function/f_printer.c | |||
| @@ -161,14 +161,6 @@ static struct usb_endpoint_descriptor hs_ep_out_desc = { | |||
| 161 | .wMaxPacketSize = cpu_to_le16(512) | 161 | .wMaxPacketSize = cpu_to_le16(512) |
| 162 | }; | 162 | }; |
| 163 | 163 | ||
| 164 | static struct usb_qualifier_descriptor dev_qualifier = { | ||
| 165 | .bLength = sizeof(dev_qualifier), | ||
| 166 | .bDescriptorType = USB_DT_DEVICE_QUALIFIER, | ||
| 167 | .bcdUSB = cpu_to_le16(0x0200), | ||
| 168 | .bDeviceClass = USB_CLASS_PRINTER, | ||
| 169 | .bNumConfigurations = 1 | ||
| 170 | }; | ||
| 171 | |||
| 172 | static struct usb_descriptor_header *hs_printer_function[] = { | 164 | static struct usb_descriptor_header *hs_printer_function[] = { |
| 173 | (struct usb_descriptor_header *) &intf_desc, | 165 | (struct usb_descriptor_header *) &intf_desc, |
| 174 | (struct usb_descriptor_header *) &hs_ep_in_desc, | 166 | (struct usb_descriptor_header *) &hs_ep_in_desc, |
diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 35fe3c80cfc0..197f73386fac 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c | |||
| @@ -1445,16 +1445,18 @@ static void usbg_drop_tpg(struct se_portal_group *se_tpg) | |||
| 1445 | for (i = 0; i < TPG_INSTANCES; ++i) | 1445 | for (i = 0; i < TPG_INSTANCES; ++i) |
| 1446 | if (tpg_instances[i].tpg == tpg) | 1446 | if (tpg_instances[i].tpg == tpg) |
| 1447 | break; | 1447 | break; |
| 1448 | if (i < TPG_INSTANCES) | 1448 | if (i < TPG_INSTANCES) { |
| 1449 | tpg_instances[i].tpg = NULL; | 1449 | tpg_instances[i].tpg = NULL; |
| 1450 | opts = container_of(tpg_instances[i].func_inst, | 1450 | opts = container_of(tpg_instances[i].func_inst, |
| 1451 | struct f_tcm_opts, func_inst); | 1451 | struct f_tcm_opts, func_inst); |
| 1452 | mutex_lock(&opts->dep_lock); | 1452 | mutex_lock(&opts->dep_lock); |
| 1453 | if (opts->has_dep) | 1453 | if (opts->has_dep) |
| 1454 | module_put(opts->dependent); | 1454 | module_put(opts->dependent); |
| 1455 | else | 1455 | else |
| 1456 | configfs_undepend_item_unlocked(&opts->func_inst.group.cg_item); | 1456 | configfs_undepend_item_unlocked( |
| 1457 | mutex_unlock(&opts->dep_lock); | 1457 | &opts->func_inst.group.cg_item); |
| 1458 | mutex_unlock(&opts->dep_lock); | ||
| 1459 | } | ||
| 1458 | mutex_unlock(&tpg_instances_lock); | 1460 | mutex_unlock(&tpg_instances_lock); |
| 1459 | 1461 | ||
| 1460 | kfree(tpg); | 1462 | kfree(tpg); |
diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index 186d4b162524..cd214ec8a601 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c | |||
| @@ -598,18 +598,6 @@ static struct usb_gadget_strings *fn_strings[] = { | |||
| 598 | NULL, | 598 | NULL, |
| 599 | }; | 599 | }; |
| 600 | 600 | ||
| 601 | static struct usb_qualifier_descriptor devqual_desc = { | ||
| 602 | .bLength = sizeof devqual_desc, | ||
| 603 | .bDescriptorType = USB_DT_DEVICE_QUALIFIER, | ||
| 604 | |||
| 605 | .bcdUSB = cpu_to_le16(0x200), | ||
| 606 | .bDeviceClass = USB_CLASS_MISC, | ||
| 607 | .bDeviceSubClass = 0x02, | ||
| 608 | .bDeviceProtocol = 0x01, | ||
| 609 | .bNumConfigurations = 1, | ||
| 610 | .bRESERVED = 0, | ||
| 611 | }; | ||
| 612 | |||
| 613 | static struct usb_interface_assoc_descriptor iad_desc = { | 601 | static struct usb_interface_assoc_descriptor iad_desc = { |
| 614 | .bLength = sizeof iad_desc, | 602 | .bLength = sizeof iad_desc, |
| 615 | .bDescriptorType = USB_DT_INTERFACE_ASSOCIATION, | 603 | .bDescriptorType = USB_DT_INTERFACE_ASSOCIATION, |
| @@ -1292,6 +1280,7 @@ in_rq_cur(struct usb_function *fn, const struct usb_ctrlrequest *cr) | |||
| 1292 | 1280 | ||
| 1293 | if (control_selector == UAC2_CS_CONTROL_SAM_FREQ) { | 1281 | if (control_selector == UAC2_CS_CONTROL_SAM_FREQ) { |
| 1294 | struct cntrl_cur_lay3 c; | 1282 | struct cntrl_cur_lay3 c; |
| 1283 | memset(&c, 0, sizeof(struct cntrl_cur_lay3)); | ||
| 1295 | 1284 | ||
| 1296 | if (entity_id == USB_IN_CLK_ID) | 1285 | if (entity_id == USB_IN_CLK_ID) |
| 1297 | c.dCUR = p_srate; | 1286 | c.dCUR = p_srate; |
diff --git a/drivers/usb/gadget/function/storage_common.c b/drivers/usb/gadget/function/storage_common.c index d62683017cf3..990df221c629 100644 --- a/drivers/usb/gadget/function/storage_common.c +++ b/drivers/usb/gadget/function/storage_common.c | |||
| @@ -83,9 +83,7 @@ EXPORT_SYMBOL_GPL(fsg_fs_function); | |||
| 83 | * USB 2.0 devices need to expose both high speed and full speed | 83 | * USB 2.0 devices need to expose both high speed and full speed |
| 84 | * descriptors, unless they only run at full speed. | 84 | * descriptors, unless they only run at full speed. |
| 85 | * | 85 | * |
| 86 | * That means alternate endpoint descriptors (bigger packets) | 86 | * That means alternate endpoint descriptors (bigger packets). |
| 87 | * and a "device qualifier" ... plus more construction options | ||
| 88 | * for the configuration descriptor. | ||
| 89 | */ | 87 | */ |
| 90 | struct usb_endpoint_descriptor fsg_hs_bulk_in_desc = { | 88 | struct usb_endpoint_descriptor fsg_hs_bulk_in_desc = { |
| 91 | .bLength = USB_DT_ENDPOINT_SIZE, | 89 | .bLength = USB_DT_ENDPOINT_SIZE, |
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index e64479f882a5..aa3707bdebb4 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c | |||
| @@ -938,8 +938,11 @@ ep0_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
| 938 | struct usb_ep *ep = dev->gadget->ep0; | 938 | struct usb_ep *ep = dev->gadget->ep0; |
| 939 | struct usb_request *req = dev->req; | 939 | struct usb_request *req = dev->req; |
| 940 | 940 | ||
| 941 | if ((retval = setup_req (ep, req, 0)) == 0) | 941 | if ((retval = setup_req (ep, req, 0)) == 0) { |
| 942 | retval = usb_ep_queue (ep, req, GFP_ATOMIC); | 942 | spin_unlock_irq (&dev->lock); |
| 943 | retval = usb_ep_queue (ep, req, GFP_KERNEL); | ||
| 944 | spin_lock_irq (&dev->lock); | ||
| 945 | } | ||
| 943 | dev->state = STATE_DEV_CONNECTED; | 946 | dev->state = STATE_DEV_CONNECTED; |
| 944 | 947 | ||
| 945 | /* assume that was SET_CONFIGURATION */ | 948 | /* assume that was SET_CONFIGURATION */ |
| @@ -1457,8 +1460,11 @@ delegate: | |||
| 1457 | w_length); | 1460 | w_length); |
| 1458 | if (value < 0) | 1461 | if (value < 0) |
| 1459 | break; | 1462 | break; |
| 1463 | |||
| 1464 | spin_unlock (&dev->lock); | ||
| 1460 | value = usb_ep_queue (gadget->ep0, dev->req, | 1465 | value = usb_ep_queue (gadget->ep0, dev->req, |
| 1461 | GFP_ATOMIC); | 1466 | GFP_KERNEL); |
| 1467 | spin_lock (&dev->lock); | ||
| 1462 | if (value < 0) { | 1468 | if (value < 0) { |
| 1463 | clean_req (gadget->ep0, dev->req); | 1469 | clean_req (gadget->ep0, dev->req); |
| 1464 | break; | 1470 | break; |
| @@ -1481,11 +1487,14 @@ delegate: | |||
| 1481 | if (value >= 0 && dev->state != STATE_DEV_SETUP) { | 1487 | if (value >= 0 && dev->state != STATE_DEV_SETUP) { |
| 1482 | req->length = value; | 1488 | req->length = value; |
| 1483 | req->zero = value < w_length; | 1489 | req->zero = value < w_length; |
| 1484 | value = usb_ep_queue (gadget->ep0, req, GFP_ATOMIC); | 1490 | |
| 1491 | spin_unlock (&dev->lock); | ||
| 1492 | value = usb_ep_queue (gadget->ep0, req, GFP_KERNEL); | ||
| 1485 | if (value < 0) { | 1493 | if (value < 0) { |
| 1486 | DBG (dev, "ep_queue --> %d\n", value); | 1494 | DBG (dev, "ep_queue --> %d\n", value); |
| 1487 | req->status = 0; | 1495 | req->status = 0; |
| 1488 | } | 1496 | } |
| 1497 | return value; | ||
| 1489 | } | 1498 | } |
| 1490 | 1499 | ||
| 1491 | /* device stalls when value < 0 */ | 1500 | /* device stalls when value < 0 */ |
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index 6e8300d6a737..e1b2dcebdc2e 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c | |||
| @@ -603,11 +603,15 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver) | |||
| 603 | } | 603 | } |
| 604 | } | 604 | } |
| 605 | 605 | ||
| 606 | list_add_tail(&driver->pending, &gadget_driver_pending_list); | 606 | if (!driver->match_existing_only) { |
| 607 | pr_info("udc-core: couldn't find an available UDC - added [%s] to list of pending drivers\n", | 607 | list_add_tail(&driver->pending, &gadget_driver_pending_list); |
| 608 | driver->function); | 608 | pr_info("udc-core: couldn't find an available UDC - added [%s] to list of pending drivers\n", |
| 609 | driver->function); | ||
| 610 | ret = 0; | ||
| 611 | } | ||
| 612 | |||
| 609 | mutex_unlock(&udc_lock); | 613 | mutex_unlock(&udc_lock); |
| 610 | return 0; | 614 | return ret; |
| 611 | found: | 615 | found: |
| 612 | ret = udc_bind_to_driver(udc, driver); | 616 | ret = udc_bind_to_driver(udc, driver); |
| 613 | mutex_unlock(&udc_lock); | 617 | mutex_unlock(&udc_lock); |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index ae1b6e69eb96..a962b89b65a6 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
| @@ -368,6 +368,15 @@ static void ehci_shutdown(struct usb_hcd *hcd) | |||
| 368 | { | 368 | { |
| 369 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | 369 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
| 370 | 370 | ||
| 371 | /** | ||
| 372 | * Protect the system from crashing at system shutdown in cases where | ||
| 373 | * usb host is not added yet from OTG controller driver. | ||
| 374 | * As ehci_setup() not done yet, so stop accessing registers or | ||
| 375 | * variables initialized in ehci_setup() | ||
| 376 | */ | ||
| 377 | if (!ehci->sbrn) | ||
| 378 | return; | ||
| 379 | |||
| 371 | spin_lock_irq(&ehci->lock); | 380 | spin_lock_irq(&ehci->lock); |
| 372 | ehci->shutdown = true; | 381 | ehci->shutdown = true; |
| 373 | ehci->rh_state = EHCI_RH_STOPPING; | 382 | ehci->rh_state = EHCI_RH_STOPPING; |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index ffc90295a95f..74f62d68f013 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
| @@ -872,15 +872,23 @@ int ehci_hub_control( | |||
| 872 | ) { | 872 | ) { |
| 873 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 873 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
| 874 | int ports = HCS_N_PORTS (ehci->hcs_params); | 874 | int ports = HCS_N_PORTS (ehci->hcs_params); |
| 875 | u32 __iomem *status_reg = &ehci->regs->port_status[ | 875 | u32 __iomem *status_reg, *hostpc_reg; |
| 876 | (wIndex & 0xff) - 1]; | ||
| 877 | u32 __iomem *hostpc_reg = &ehci->regs->hostpc[(wIndex & 0xff) - 1]; | ||
| 878 | u32 temp, temp1, status; | 876 | u32 temp, temp1, status; |
| 879 | unsigned long flags; | 877 | unsigned long flags; |
| 880 | int retval = 0; | 878 | int retval = 0; |
| 881 | unsigned selector; | 879 | unsigned selector; |
| 882 | 880 | ||
| 883 | /* | 881 | /* |
| 882 | * Avoid underflow while calculating (wIndex & 0xff) - 1. | ||
| 883 | * The compiler might deduce that wIndex can never be 0 and then | ||
| 884 | * optimize away the tests for !wIndex below. | ||
| 885 | */ | ||
| 886 | temp = wIndex & 0xff; | ||
| 887 | temp -= (temp > 0); | ||
| 888 | status_reg = &ehci->regs->port_status[temp]; | ||
| 889 | hostpc_reg = &ehci->regs->hostpc[temp]; | ||
| 890 | |||
| 891 | /* | ||
| 884 | * FIXME: support SetPortFeatures USB_PORT_FEAT_INDICATOR. | 892 | * FIXME: support SetPortFeatures USB_PORT_FEAT_INDICATOR. |
| 885 | * HCS_INDICATOR may say we can change LEDs to off/amber/green. | 893 | * HCS_INDICATOR may say we can change LEDs to off/amber/green. |
| 886 | * (track current state ourselves) ... blink for diagnostics, | 894 | * (track current state ourselves) ... blink for diagnostics, |
diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c index d3afc89d00f5..2f8d3af811ce 100644 --- a/drivers/usb/host/ehci-msm.c +++ b/drivers/usb/host/ehci-msm.c | |||
| @@ -179,22 +179,32 @@ static int ehci_msm_remove(struct platform_device *pdev) | |||
| 179 | static int ehci_msm_pm_suspend(struct device *dev) | 179 | static int ehci_msm_pm_suspend(struct device *dev) |
| 180 | { | 180 | { |
| 181 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 181 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
| 182 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
| 182 | bool do_wakeup = device_may_wakeup(dev); | 183 | bool do_wakeup = device_may_wakeup(dev); |
| 183 | 184 | ||
| 184 | dev_dbg(dev, "ehci-msm PM suspend\n"); | 185 | dev_dbg(dev, "ehci-msm PM suspend\n"); |
| 185 | 186 | ||
| 186 | return ehci_suspend(hcd, do_wakeup); | 187 | /* Only call ehci_suspend if ehci_setup has been done */ |
| 188 | if (ehci->sbrn) | ||
| 189 | return ehci_suspend(hcd, do_wakeup); | ||
| 190 | |||
| 191 | return 0; | ||
| 187 | } | 192 | } |
| 188 | 193 | ||
| 189 | static int ehci_msm_pm_resume(struct device *dev) | 194 | static int ehci_msm_pm_resume(struct device *dev) |
| 190 | { | 195 | { |
| 191 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 196 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
| 197 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
| 192 | 198 | ||
| 193 | dev_dbg(dev, "ehci-msm PM resume\n"); | 199 | dev_dbg(dev, "ehci-msm PM resume\n"); |
| 194 | ehci_resume(hcd, false); | 200 | |
| 201 | /* Only call ehci_resume if ehci_setup has been done */ | ||
| 202 | if (ehci->sbrn) | ||
| 203 | ehci_resume(hcd, false); | ||
| 195 | 204 | ||
| 196 | return 0; | 205 | return 0; |
| 197 | } | 206 | } |
| 207 | |||
| 198 | #else | 208 | #else |
| 199 | #define ehci_msm_pm_suspend NULL | 209 | #define ehci_msm_pm_suspend NULL |
| 200 | #define ehci_msm_pm_resume NULL | 210 | #define ehci_msm_pm_resume NULL |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 4031b372008e..9a3d7db5be57 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
| @@ -81,15 +81,23 @@ static int tegra_reset_usb_controller(struct platform_device *pdev) | |||
| 81 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 81 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
| 82 | struct tegra_ehci_hcd *tegra = | 82 | struct tegra_ehci_hcd *tegra = |
| 83 | (struct tegra_ehci_hcd *)hcd_to_ehci(hcd)->priv; | 83 | (struct tegra_ehci_hcd *)hcd_to_ehci(hcd)->priv; |
| 84 | bool has_utmi_pad_registers = false; | ||
| 84 | 85 | ||
| 85 | phy_np = of_parse_phandle(pdev->dev.of_node, "nvidia,phy", 0); | 86 | phy_np = of_parse_phandle(pdev->dev.of_node, "nvidia,phy", 0); |
| 86 | if (!phy_np) | 87 | if (!phy_np) |
| 87 | return -ENOENT; | 88 | return -ENOENT; |
| 88 | 89 | ||
| 90 | if (of_property_read_bool(phy_np, "nvidia,has-utmi-pad-registers")) | ||
| 91 | has_utmi_pad_registers = true; | ||
| 92 | |||
| 89 | if (!usb1_reset_attempted) { | 93 | if (!usb1_reset_attempted) { |
| 90 | struct reset_control *usb1_reset; | 94 | struct reset_control *usb1_reset; |
| 91 | 95 | ||
| 92 | usb1_reset = of_reset_control_get(phy_np, "usb"); | 96 | if (!has_utmi_pad_registers) |
| 97 | usb1_reset = of_reset_control_get(phy_np, "utmi-pads"); | ||
| 98 | else | ||
| 99 | usb1_reset = tegra->rst; | ||
| 100 | |||
| 93 | if (IS_ERR(usb1_reset)) { | 101 | if (IS_ERR(usb1_reset)) { |
| 94 | dev_warn(&pdev->dev, | 102 | dev_warn(&pdev->dev, |
| 95 | "can't get utmi-pads reset from the PHY\n"); | 103 | "can't get utmi-pads reset from the PHY\n"); |
| @@ -99,13 +107,15 @@ static int tegra_reset_usb_controller(struct platform_device *pdev) | |||
| 99 | reset_control_assert(usb1_reset); | 107 | reset_control_assert(usb1_reset); |
| 100 | udelay(1); | 108 | udelay(1); |
| 101 | reset_control_deassert(usb1_reset); | 109 | reset_control_deassert(usb1_reset); |
| 110 | |||
| 111 | if (!has_utmi_pad_registers) | ||
| 112 | reset_control_put(usb1_reset); | ||
| 102 | } | 113 | } |
| 103 | 114 | ||
| 104 | reset_control_put(usb1_reset); | ||
| 105 | usb1_reset_attempted = true; | 115 | usb1_reset_attempted = true; |
| 106 | } | 116 | } |
| 107 | 117 | ||
| 108 | if (!of_property_read_bool(phy_np, "nvidia,has-utmi-pad-registers")) { | 118 | if (!has_utmi_pad_registers) { |
| 109 | reset_control_assert(tegra->rst); | 119 | reset_control_assert(tegra->rst); |
| 110 | udelay(1); | 120 | udelay(1); |
| 111 | reset_control_deassert(tegra->rst); | 121 | reset_control_deassert(tegra->rst); |
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c index d029bbe9eb36..641fed609911 100644 --- a/drivers/usb/host/ohci-q.c +++ b/drivers/usb/host/ohci-q.c | |||
| @@ -183,7 +183,6 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) | |||
| 183 | { | 183 | { |
| 184 | int branch; | 184 | int branch; |
| 185 | 185 | ||
| 186 | ed->state = ED_OPER; | ||
| 187 | ed->ed_prev = NULL; | 186 | ed->ed_prev = NULL; |
| 188 | ed->ed_next = NULL; | 187 | ed->ed_next = NULL; |
| 189 | ed->hwNextED = 0; | 188 | ed->hwNextED = 0; |
| @@ -259,6 +258,8 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) | |||
| 259 | /* the HC may not see the schedule updates yet, but if it does | 258 | /* the HC may not see the schedule updates yet, but if it does |
| 260 | * then they'll be properly ordered. | 259 | * then they'll be properly ordered. |
| 261 | */ | 260 | */ |
| 261 | |||
| 262 | ed->state = ED_OPER; | ||
| 262 | return 0; | 263 | return 0; |
| 263 | } | 264 | } |
| 264 | 265 | ||
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 48672fac7ff3..c10972fcc8e4 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | /* Device for a quirk */ | 37 | /* Device for a quirk */ |
| 38 | #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 | 38 | #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 |
| 39 | #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 | 39 | #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 |
| 40 | #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1009 0x1009 | ||
| 40 | #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1400 0x1400 | 41 | #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1400 0x1400 |
| 41 | 42 | ||
| 42 | #define PCI_VENDOR_ID_ETRON 0x1b6f | 43 | #define PCI_VENDOR_ID_ETRON 0x1b6f |
| @@ -114,6 +115,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
| 114 | xhci->quirks |= XHCI_TRUST_TX_LENGTH; | 115 | xhci->quirks |= XHCI_TRUST_TX_LENGTH; |
| 115 | } | 116 | } |
| 116 | 117 | ||
| 118 | if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && | ||
| 119 | pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1009) | ||
| 120 | xhci->quirks |= XHCI_BROKEN_STREAMS; | ||
| 121 | |||
| 117 | if (pdev->vendor == PCI_VENDOR_ID_NEC) | 122 | if (pdev->vendor == PCI_VENDOR_ID_NEC) |
| 118 | xhci->quirks |= XHCI_NEC_HOST; | 123 | xhci->quirks |= XHCI_NEC_HOST; |
| 119 | 124 | ||
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 676ea458148b..1f3f981fe7f8 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c | |||
| @@ -196,6 +196,9 @@ static int xhci_plat_probe(struct platform_device *pdev) | |||
| 196 | ret = clk_prepare_enable(clk); | 196 | ret = clk_prepare_enable(clk); |
| 197 | if (ret) | 197 | if (ret) |
| 198 | goto put_hcd; | 198 | goto put_hcd; |
| 199 | } else if (PTR_ERR(clk) == -EPROBE_DEFER) { | ||
| 200 | ret = -EPROBE_DEFER; | ||
| 201 | goto put_hcd; | ||
| 199 | } | 202 | } |
| 200 | 203 | ||
| 201 | xhci = hcd_to_xhci(hcd); | 204 | xhci = hcd_to_xhci(hcd); |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 52deae4b7eac..d7d502578d79 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -290,6 +290,14 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) | |||
| 290 | 290 | ||
| 291 | temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | 291 | temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); |
| 292 | xhci->cmd_ring_state = CMD_RING_STATE_ABORTED; | 292 | xhci->cmd_ring_state = CMD_RING_STATE_ABORTED; |
| 293 | |||
| 294 | /* | ||
| 295 | * Writing the CMD_RING_ABORT bit should cause a cmd completion event, | ||
| 296 | * however on some host hw the CMD_RING_RUNNING bit is correctly cleared | ||
| 297 | * but the completion event in never sent. Use the cmd timeout timer to | ||
| 298 | * handle those cases. Use twice the time to cover the bit polling retry | ||
| 299 | */ | ||
| 300 | mod_timer(&xhci->cmd_timer, jiffies + (2 * XHCI_CMD_DEFAULT_TIMEOUT)); | ||
| 293 | xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, | 301 | xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, |
| 294 | &xhci->op_regs->cmd_ring); | 302 | &xhci->op_regs->cmd_ring); |
| 295 | 303 | ||
| @@ -314,6 +322,7 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) | |||
| 314 | 322 | ||
| 315 | xhci_err(xhci, "Stopped the command ring failed, " | 323 | xhci_err(xhci, "Stopped the command ring failed, " |
| 316 | "maybe the host is dead\n"); | 324 | "maybe the host is dead\n"); |
| 325 | del_timer(&xhci->cmd_timer); | ||
| 317 | xhci->xhc_state |= XHCI_STATE_DYING; | 326 | xhci->xhc_state |= XHCI_STATE_DYING; |
| 318 | xhci_quiesce(xhci); | 327 | xhci_quiesce(xhci); |
| 319 | xhci_halt(xhci); | 328 | xhci_halt(xhci); |
| @@ -1246,22 +1255,21 @@ void xhci_handle_command_timeout(unsigned long data) | |||
| 1246 | int ret; | 1255 | int ret; |
| 1247 | unsigned long flags; | 1256 | unsigned long flags; |
| 1248 | u64 hw_ring_state; | 1257 | u64 hw_ring_state; |
| 1249 | struct xhci_command *cur_cmd = NULL; | 1258 | bool second_timeout = false; |
| 1250 | xhci = (struct xhci_hcd *) data; | 1259 | xhci = (struct xhci_hcd *) data; |
| 1251 | 1260 | ||
| 1252 | /* mark this command to be cancelled */ | 1261 | /* mark this command to be cancelled */ |
| 1253 | spin_lock_irqsave(&xhci->lock, flags); | 1262 | spin_lock_irqsave(&xhci->lock, flags); |
| 1254 | if (xhci->current_cmd) { | 1263 | if (xhci->current_cmd) { |
| 1255 | cur_cmd = xhci->current_cmd; | 1264 | if (xhci->current_cmd->status == COMP_CMD_ABORT) |
| 1256 | cur_cmd->status = COMP_CMD_ABORT; | 1265 | second_timeout = true; |
| 1266 | xhci->current_cmd->status = COMP_CMD_ABORT; | ||
| 1257 | } | 1267 | } |
| 1258 | 1268 | ||
| 1259 | |||
| 1260 | /* Make sure command ring is running before aborting it */ | 1269 | /* Make sure command ring is running before aborting it */ |
| 1261 | hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | 1270 | hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); |
| 1262 | if ((xhci->cmd_ring_state & CMD_RING_STATE_RUNNING) && | 1271 | if ((xhci->cmd_ring_state & CMD_RING_STATE_RUNNING) && |
| 1263 | (hw_ring_state & CMD_RING_RUNNING)) { | 1272 | (hw_ring_state & CMD_RING_RUNNING)) { |
| 1264 | |||
| 1265 | spin_unlock_irqrestore(&xhci->lock, flags); | 1273 | spin_unlock_irqrestore(&xhci->lock, flags); |
| 1266 | xhci_dbg(xhci, "Command timeout\n"); | 1274 | xhci_dbg(xhci, "Command timeout\n"); |
| 1267 | ret = xhci_abort_cmd_ring(xhci); | 1275 | ret = xhci_abort_cmd_ring(xhci); |
| @@ -1273,6 +1281,15 @@ void xhci_handle_command_timeout(unsigned long data) | |||
| 1273 | } | 1281 | } |
| 1274 | return; | 1282 | return; |
| 1275 | } | 1283 | } |
| 1284 | |||
| 1285 | /* command ring failed to restart, or host removed. Bail out */ | ||
| 1286 | if (second_timeout || xhci->xhc_state & XHCI_STATE_REMOVING) { | ||
| 1287 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
| 1288 | xhci_dbg(xhci, "command timed out twice, ring start fail?\n"); | ||
| 1289 | xhci_cleanup_command_queue(xhci); | ||
| 1290 | return; | ||
| 1291 | } | ||
| 1292 | |||
| 1276 | /* command timeout on stopped ring, ring can't be aborted */ | 1293 | /* command timeout on stopped ring, ring can't be aborted */ |
| 1277 | xhci_dbg(xhci, "Command timeout on stopped ring\n"); | 1294 | xhci_dbg(xhci, "Command timeout on stopped ring\n"); |
| 1278 | xhci_handle_stopped_cmd_ring(xhci, xhci->current_cmd); | 1295 | xhci_handle_stopped_cmd_ring(xhci, xhci->current_cmd); |
| @@ -2721,7 +2738,8 @@ hw_died: | |||
| 2721 | writel(irq_pending, &xhci->ir_set->irq_pending); | 2738 | writel(irq_pending, &xhci->ir_set->irq_pending); |
| 2722 | } | 2739 | } |
| 2723 | 2740 | ||
| 2724 | if (xhci->xhc_state & XHCI_STATE_DYING) { | 2741 | if (xhci->xhc_state & XHCI_STATE_DYING || |
| 2742 | xhci->xhc_state & XHCI_STATE_HALTED) { | ||
| 2725 | xhci_dbg(xhci, "xHCI dying, ignoring interrupt. " | 2743 | xhci_dbg(xhci, "xHCI dying, ignoring interrupt. " |
| 2726 | "Shouldn't IRQs be disabled?\n"); | 2744 | "Shouldn't IRQs be disabled?\n"); |
| 2727 | /* Clear the event handler busy flag (RW1C); | 2745 | /* Clear the event handler busy flag (RW1C); |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index fa7e1ef36cd9..f2f9518c53ab 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
| @@ -685,20 +685,23 @@ void xhci_stop(struct usb_hcd *hcd) | |||
| 685 | u32 temp; | 685 | u32 temp; |
| 686 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 686 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
| 687 | 687 | ||
| 688 | if (xhci->xhc_state & XHCI_STATE_HALTED) | ||
| 689 | return; | ||
| 690 | |||
| 691 | mutex_lock(&xhci->mutex); | 688 | mutex_lock(&xhci->mutex); |
| 692 | spin_lock_irq(&xhci->lock); | ||
| 693 | xhci->xhc_state |= XHCI_STATE_HALTED; | ||
| 694 | xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; | ||
| 695 | 689 | ||
| 696 | /* Make sure the xHC is halted for a USB3 roothub | 690 | if (!(xhci->xhc_state & XHCI_STATE_HALTED)) { |
| 697 | * (xhci_stop() could be called as part of failed init). | 691 | spin_lock_irq(&xhci->lock); |
| 698 | */ | 692 | |
| 699 | xhci_halt(xhci); | 693 | xhci->xhc_state |= XHCI_STATE_HALTED; |
| 700 | xhci_reset(xhci); | 694 | xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; |
| 701 | spin_unlock_irq(&xhci->lock); | 695 | xhci_halt(xhci); |
| 696 | xhci_reset(xhci); | ||
| 697 | |||
| 698 | spin_unlock_irq(&xhci->lock); | ||
| 699 | } | ||
| 700 | |||
| 701 | if (!usb_hcd_is_primary_hcd(hcd)) { | ||
| 702 | mutex_unlock(&xhci->mutex); | ||
| 703 | return; | ||
| 704 | } | ||
| 702 | 705 | ||
| 703 | xhci_cleanup_msix(xhci); | 706 | xhci_cleanup_msix(xhci); |
| 704 | 707 | ||
| @@ -4886,7 +4889,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) | |||
| 4886 | xhci->hcc_params2 = readl(&xhci->cap_regs->hcc_params2); | 4889 | xhci->hcc_params2 = readl(&xhci->cap_regs->hcc_params2); |
| 4887 | xhci_print_registers(xhci); | 4890 | xhci_print_registers(xhci); |
| 4888 | 4891 | ||
| 4889 | xhci->quirks = quirks; | 4892 | xhci->quirks |= quirks; |
| 4890 | 4893 | ||
| 4891 | get_quirks(dev, xhci); | 4894 | get_quirks(dev, xhci); |
| 4892 | 4895 | ||
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 39fd95833eb8..f824336def5c 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
| @@ -1090,29 +1090,6 @@ void musb_stop(struct musb *musb) | |||
| 1090 | musb_platform_try_idle(musb, 0); | 1090 | musb_platform_try_idle(musb, 0); |
| 1091 | } | 1091 | } |
| 1092 | 1092 | ||
| 1093 | static void musb_shutdown(struct platform_device *pdev) | ||
| 1094 | { | ||
| 1095 | struct musb *musb = dev_to_musb(&pdev->dev); | ||
| 1096 | unsigned long flags; | ||
| 1097 | |||
| 1098 | pm_runtime_get_sync(musb->controller); | ||
| 1099 | |||
| 1100 | musb_host_cleanup(musb); | ||
| 1101 | musb_gadget_cleanup(musb); | ||
| 1102 | |||
| 1103 | spin_lock_irqsave(&musb->lock, flags); | ||
| 1104 | musb_platform_disable(musb); | ||
| 1105 | musb_generic_disable(musb); | ||
| 1106 | spin_unlock_irqrestore(&musb->lock, flags); | ||
| 1107 | |||
| 1108 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
| 1109 | musb_platform_exit(musb); | ||
| 1110 | |||
| 1111 | pm_runtime_put(musb->controller); | ||
| 1112 | /* FIXME power down */ | ||
| 1113 | } | ||
| 1114 | |||
| 1115 | |||
| 1116 | /*-------------------------------------------------------------------------*/ | 1093 | /*-------------------------------------------------------------------------*/ |
| 1117 | 1094 | ||
| 1118 | /* | 1095 | /* |
| @@ -1702,7 +1679,7 @@ EXPORT_SYMBOL_GPL(musb_dma_completion); | |||
| 1702 | #define use_dma 0 | 1679 | #define use_dma 0 |
| 1703 | #endif | 1680 | #endif |
| 1704 | 1681 | ||
| 1705 | static void (*musb_phy_callback)(enum musb_vbus_id_status status); | 1682 | static int (*musb_phy_callback)(enum musb_vbus_id_status status); |
| 1706 | 1683 | ||
| 1707 | /* | 1684 | /* |
| 1708 | * musb_mailbox - optional phy notifier function | 1685 | * musb_mailbox - optional phy notifier function |
| @@ -1711,11 +1688,12 @@ static void (*musb_phy_callback)(enum musb_vbus_id_status status); | |||
| 1711 | * Optionally gets called from the USB PHY. Note that the USB PHY must be | 1688 | * Optionally gets called from the USB PHY. Note that the USB PHY must be |
| 1712 | * disabled at the point the phy_callback is registered or unregistered. | 1689 | * disabled at the point the phy_callback is registered or unregistered. |
| 1713 | */ | 1690 | */ |
| 1714 | void musb_mailbox(enum musb_vbus_id_status status) | 1691 | int musb_mailbox(enum musb_vbus_id_status status) |
| 1715 | { | 1692 | { |
| 1716 | if (musb_phy_callback) | 1693 | if (musb_phy_callback) |
| 1717 | musb_phy_callback(status); | 1694 | return musb_phy_callback(status); |
| 1718 | 1695 | ||
| 1696 | return -ENODEV; | ||
| 1719 | }; | 1697 | }; |
| 1720 | EXPORT_SYMBOL_GPL(musb_mailbox); | 1698 | EXPORT_SYMBOL_GPL(musb_mailbox); |
| 1721 | 1699 | ||
| @@ -2028,11 +2006,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
| 2028 | musb_readl = musb_default_readl; | 2006 | musb_readl = musb_default_readl; |
| 2029 | musb_writel = musb_default_writel; | 2007 | musb_writel = musb_default_writel; |
| 2030 | 2008 | ||
| 2031 | /* We need musb_read/write functions initialized for PM */ | ||
| 2032 | pm_runtime_use_autosuspend(musb->controller); | ||
| 2033 | pm_runtime_set_autosuspend_delay(musb->controller, 200); | ||
| 2034 | pm_runtime_enable(musb->controller); | ||
| 2035 | |||
| 2036 | /* The musb_platform_init() call: | 2009 | /* The musb_platform_init() call: |
| 2037 | * - adjusts musb->mregs | 2010 | * - adjusts musb->mregs |
| 2038 | * - sets the musb->isr | 2011 | * - sets the musb->isr |
| @@ -2134,6 +2107,16 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
| 2134 | if (musb->ops->phy_callback) | 2107 | if (musb->ops->phy_callback) |
| 2135 | musb_phy_callback = musb->ops->phy_callback; | 2108 | musb_phy_callback = musb->ops->phy_callback; |
| 2136 | 2109 | ||
| 2110 | /* | ||
| 2111 | * We need musb_read/write functions initialized for PM. | ||
| 2112 | * Note that at least 2430 glue needs autosuspend delay | ||
| 2113 | * somewhere above 300 ms for the hardware to idle properly | ||
| 2114 | * after disconnecting the cable in host mode. Let's use | ||
| 2115 | * 500 ms for some margin. | ||
| 2116 | */ | ||
| 2117 | pm_runtime_use_autosuspend(musb->controller); | ||
| 2118 | pm_runtime_set_autosuspend_delay(musb->controller, 500); | ||
| 2119 | pm_runtime_enable(musb->controller); | ||
| 2137 | pm_runtime_get_sync(musb->controller); | 2120 | pm_runtime_get_sync(musb->controller); |
| 2138 | 2121 | ||
| 2139 | status = usb_phy_init(musb->xceiv); | 2122 | status = usb_phy_init(musb->xceiv); |
| @@ -2237,13 +2220,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
| 2237 | if (status) | 2220 | if (status) |
| 2238 | goto fail5; | 2221 | goto fail5; |
| 2239 | 2222 | ||
| 2240 | pm_runtime_put(musb->controller); | 2223 | pm_runtime_mark_last_busy(musb->controller); |
| 2241 | 2224 | pm_runtime_put_autosuspend(musb->controller); | |
| 2242 | /* | ||
| 2243 | * For why this is currently needed, see commit 3e43a0725637 | ||
| 2244 | * ("usb: musb: core: add pm_runtime_irq_safe()") | ||
| 2245 | */ | ||
| 2246 | pm_runtime_irq_safe(musb->controller); | ||
| 2247 | 2225 | ||
| 2248 | return 0; | 2226 | return 0; |
| 2249 | 2227 | ||
| @@ -2265,7 +2243,9 @@ fail2_5: | |||
| 2265 | usb_phy_shutdown(musb->xceiv); | 2243 | usb_phy_shutdown(musb->xceiv); |
| 2266 | 2244 | ||
| 2267 | err_usb_phy_init: | 2245 | err_usb_phy_init: |
| 2246 | pm_runtime_dont_use_autosuspend(musb->controller); | ||
| 2268 | pm_runtime_put_sync(musb->controller); | 2247 | pm_runtime_put_sync(musb->controller); |
| 2248 | pm_runtime_disable(musb->controller); | ||
| 2269 | 2249 | ||
| 2270 | fail2: | 2250 | fail2: |
| 2271 | if (musb->irq_wake) | 2251 | if (musb->irq_wake) |
| @@ -2273,7 +2253,6 @@ fail2: | |||
| 2273 | musb_platform_exit(musb); | 2253 | musb_platform_exit(musb); |
| 2274 | 2254 | ||
| 2275 | fail1: | 2255 | fail1: |
| 2276 | pm_runtime_disable(musb->controller); | ||
| 2277 | dev_err(musb->controller, | 2256 | dev_err(musb->controller, |
| 2278 | "musb_init_controller failed with status %d\n", status); | 2257 | "musb_init_controller failed with status %d\n", status); |
| 2279 | 2258 | ||
| @@ -2312,6 +2291,7 @@ static int musb_remove(struct platform_device *pdev) | |||
| 2312 | { | 2291 | { |
| 2313 | struct device *dev = &pdev->dev; | 2292 | struct device *dev = &pdev->dev; |
| 2314 | struct musb *musb = dev_to_musb(dev); | 2293 | struct musb *musb = dev_to_musb(dev); |
| 2294 | unsigned long flags; | ||
| 2315 | 2295 | ||
| 2316 | /* this gets called on rmmod. | 2296 | /* this gets called on rmmod. |
| 2317 | * - Host mode: host may still be active | 2297 | * - Host mode: host may still be active |
| @@ -2319,17 +2299,26 @@ static int musb_remove(struct platform_device *pdev) | |||
| 2319 | * - OTG mode: both roles are deactivated (or never-activated) | 2299 | * - OTG mode: both roles are deactivated (or never-activated) |
| 2320 | */ | 2300 | */ |
| 2321 | musb_exit_debugfs(musb); | 2301 | musb_exit_debugfs(musb); |
| 2322 | musb_shutdown(pdev); | ||
| 2323 | musb_phy_callback = NULL; | ||
| 2324 | |||
| 2325 | if (musb->dma_controller) | ||
| 2326 | musb_dma_controller_destroy(musb->dma_controller); | ||
| 2327 | |||
| 2328 | usb_phy_shutdown(musb->xceiv); | ||
| 2329 | 2302 | ||
| 2330 | cancel_work_sync(&musb->irq_work); | 2303 | cancel_work_sync(&musb->irq_work); |
| 2331 | cancel_delayed_work_sync(&musb->finish_resume_work); | 2304 | cancel_delayed_work_sync(&musb->finish_resume_work); |
| 2332 | cancel_delayed_work_sync(&musb->deassert_reset_work); | 2305 | cancel_delayed_work_sync(&musb->deassert_reset_work); |
| 2306 | pm_runtime_get_sync(musb->controller); | ||
| 2307 | musb_host_cleanup(musb); | ||
| 2308 | musb_gadget_cleanup(musb); | ||
| 2309 | spin_lock_irqsave(&musb->lock, flags); | ||
| 2310 | musb_platform_disable(musb); | ||
| 2311 | musb_generic_disable(musb); | ||
| 2312 | spin_unlock_irqrestore(&musb->lock, flags); | ||
| 2313 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
| 2314 | pm_runtime_dont_use_autosuspend(musb->controller); | ||
| 2315 | pm_runtime_put_sync(musb->controller); | ||
| 2316 | pm_runtime_disable(musb->controller); | ||
| 2317 | musb_platform_exit(musb); | ||
| 2318 | musb_phy_callback = NULL; | ||
| 2319 | if (musb->dma_controller) | ||
| 2320 | musb_dma_controller_destroy(musb->dma_controller); | ||
| 2321 | usb_phy_shutdown(musb->xceiv); | ||
| 2333 | musb_free(musb); | 2322 | musb_free(musb); |
| 2334 | device_init_wakeup(dev, 0); | 2323 | device_init_wakeup(dev, 0); |
| 2335 | return 0; | 2324 | return 0; |
| @@ -2429,7 +2418,8 @@ static void musb_restore_context(struct musb *musb) | |||
| 2429 | musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe); | 2418 | musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe); |
| 2430 | musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe); | 2419 | musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe); |
| 2431 | musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe); | 2420 | musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe); |
| 2432 | musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); | 2421 | if (musb->context.devctl & MUSB_DEVCTL_SESSION) |
| 2422 | musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); | ||
| 2433 | 2423 | ||
| 2434 | for (i = 0; i < musb->config->num_eps; ++i) { | 2424 | for (i = 0; i < musb->config->num_eps; ++i) { |
| 2435 | struct musb_hw_ep *hw_ep; | 2425 | struct musb_hw_ep *hw_ep; |
| @@ -2612,7 +2602,6 @@ static struct platform_driver musb_driver = { | |||
| 2612 | }, | 2602 | }, |
| 2613 | .probe = musb_probe, | 2603 | .probe = musb_probe, |
| 2614 | .remove = musb_remove, | 2604 | .remove = musb_remove, |
| 2615 | .shutdown = musb_shutdown, | ||
| 2616 | }; | 2605 | }; |
| 2617 | 2606 | ||
| 2618 | module_platform_driver(musb_driver); | 2607 | module_platform_driver(musb_driver); |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index b6afe9e43305..b55a776b03eb 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
| @@ -215,7 +215,7 @@ struct musb_platform_ops { | |||
| 215 | dma_addr_t *dma_addr, u32 *len); | 215 | dma_addr_t *dma_addr, u32 *len); |
| 216 | void (*pre_root_reset_end)(struct musb *musb); | 216 | void (*pre_root_reset_end)(struct musb *musb); |
| 217 | void (*post_root_reset_end)(struct musb *musb); | 217 | void (*post_root_reset_end)(struct musb *musb); |
| 218 | void (*phy_callback)(enum musb_vbus_id_status status); | 218 | int (*phy_callback)(enum musb_vbus_id_status status); |
| 219 | }; | 219 | }; |
| 220 | 220 | ||
| 221 | /* | 221 | /* |
| @@ -312,6 +312,7 @@ struct musb { | |||
| 312 | struct work_struct irq_work; | 312 | struct work_struct irq_work; |
| 313 | struct delayed_work deassert_reset_work; | 313 | struct delayed_work deassert_reset_work; |
| 314 | struct delayed_work finish_resume_work; | 314 | struct delayed_work finish_resume_work; |
| 315 | struct delayed_work gadget_work; | ||
| 315 | u16 hwvers; | 316 | u16 hwvers; |
| 316 | 317 | ||
| 317 | u16 intrrxe; | 318 | u16 intrrxe; |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 152865b36522..af2a3a7addf9 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
| @@ -1656,6 +1656,20 @@ static int musb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) | |||
| 1656 | return usb_phy_set_power(musb->xceiv, mA); | 1656 | return usb_phy_set_power(musb->xceiv, mA); |
| 1657 | } | 1657 | } |
| 1658 | 1658 | ||
| 1659 | static void musb_gadget_work(struct work_struct *work) | ||
| 1660 | { | ||
| 1661 | struct musb *musb; | ||
| 1662 | unsigned long flags; | ||
| 1663 | |||
| 1664 | musb = container_of(work, struct musb, gadget_work.work); | ||
| 1665 | pm_runtime_get_sync(musb->controller); | ||
| 1666 | spin_lock_irqsave(&musb->lock, flags); | ||
| 1667 | musb_pullup(musb, musb->softconnect); | ||
| 1668 | spin_unlock_irqrestore(&musb->lock, flags); | ||
| 1669 | pm_runtime_mark_last_busy(musb->controller); | ||
| 1670 | pm_runtime_put_autosuspend(musb->controller); | ||
| 1671 | } | ||
| 1672 | |||
| 1659 | static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on) | 1673 | static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on) |
| 1660 | { | 1674 | { |
| 1661 | struct musb *musb = gadget_to_musb(gadget); | 1675 | struct musb *musb = gadget_to_musb(gadget); |
| @@ -1663,20 +1677,16 @@ static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on) | |||
| 1663 | 1677 | ||
| 1664 | is_on = !!is_on; | 1678 | is_on = !!is_on; |
| 1665 | 1679 | ||
| 1666 | pm_runtime_get_sync(musb->controller); | ||
| 1667 | |||
| 1668 | /* NOTE: this assumes we are sensing vbus; we'd rather | 1680 | /* NOTE: this assumes we are sensing vbus; we'd rather |
| 1669 | * not pullup unless the B-session is active. | 1681 | * not pullup unless the B-session is active. |
| 1670 | */ | 1682 | */ |
| 1671 | spin_lock_irqsave(&musb->lock, flags); | 1683 | spin_lock_irqsave(&musb->lock, flags); |
| 1672 | if (is_on != musb->softconnect) { | 1684 | if (is_on != musb->softconnect) { |
| 1673 | musb->softconnect = is_on; | 1685 | musb->softconnect = is_on; |
| 1674 | musb_pullup(musb, is_on); | 1686 | schedule_delayed_work(&musb->gadget_work, 0); |
| 1675 | } | 1687 | } |
| 1676 | spin_unlock_irqrestore(&musb->lock, flags); | 1688 | spin_unlock_irqrestore(&musb->lock, flags); |
| 1677 | 1689 | ||
| 1678 | pm_runtime_put(musb->controller); | ||
| 1679 | |||
| 1680 | return 0; | 1690 | return 0; |
| 1681 | } | 1691 | } |
| 1682 | 1692 | ||
| @@ -1845,7 +1855,7 @@ int musb_gadget_setup(struct musb *musb) | |||
| 1845 | #elif IS_ENABLED(CONFIG_USB_MUSB_GADGET) | 1855 | #elif IS_ENABLED(CONFIG_USB_MUSB_GADGET) |
| 1846 | musb->g.is_otg = 0; | 1856 | musb->g.is_otg = 0; |
| 1847 | #endif | 1857 | #endif |
| 1848 | 1858 | INIT_DELAYED_WORK(&musb->gadget_work, musb_gadget_work); | |
| 1849 | musb_g_init_endpoints(musb); | 1859 | musb_g_init_endpoints(musb); |
| 1850 | 1860 | ||
| 1851 | musb->is_active = 0; | 1861 | musb->is_active = 0; |
| @@ -1866,6 +1876,8 @@ void musb_gadget_cleanup(struct musb *musb) | |||
| 1866 | { | 1876 | { |
| 1867 | if (musb->port_mode == MUSB_PORT_MODE_HOST) | 1877 | if (musb->port_mode == MUSB_PORT_MODE_HOST) |
| 1868 | return; | 1878 | return; |
| 1879 | |||
| 1880 | cancel_delayed_work_sync(&musb->gadget_work); | ||
| 1869 | usb_del_gadget_udc(&musb->g); | 1881 | usb_del_gadget_udc(&musb->g); |
| 1870 | } | 1882 | } |
| 1871 | 1883 | ||
| @@ -1914,8 +1926,8 @@ static int musb_gadget_start(struct usb_gadget *g, | |||
| 1914 | if (musb->xceiv->last_event == USB_EVENT_ID) | 1926 | if (musb->xceiv->last_event == USB_EVENT_ID) |
| 1915 | musb_platform_set_vbus(musb, 1); | 1927 | musb_platform_set_vbus(musb, 1); |
| 1916 | 1928 | ||
| 1917 | if (musb->xceiv->last_event == USB_EVENT_NONE) | 1929 | pm_runtime_mark_last_busy(musb->controller); |
| 1918 | pm_runtime_put(musb->controller); | 1930 | pm_runtime_put_autosuspend(musb->controller); |
| 1919 | 1931 | ||
| 1920 | return 0; | 1932 | return 0; |
| 1921 | 1933 | ||
| @@ -1934,8 +1946,7 @@ static int musb_gadget_stop(struct usb_gadget *g) | |||
| 1934 | struct musb *musb = gadget_to_musb(g); | 1946 | struct musb *musb = gadget_to_musb(g); |
| 1935 | unsigned long flags; | 1947 | unsigned long flags; |
| 1936 | 1948 | ||
| 1937 | if (musb->xceiv->last_event == USB_EVENT_NONE) | 1949 | pm_runtime_get_sync(musb->controller); |
| 1938 | pm_runtime_get_sync(musb->controller); | ||
| 1939 | 1950 | ||
| 1940 | /* | 1951 | /* |
| 1941 | * REVISIT always use otg_set_peripheral() here too; | 1952 | * REVISIT always use otg_set_peripheral() here too; |
| @@ -1963,7 +1974,8 @@ static int musb_gadget_stop(struct usb_gadget *g) | |||
| 1963 | * that currently misbehaves. | 1974 | * that currently misbehaves. |
| 1964 | */ | 1975 | */ |
| 1965 | 1976 | ||
| 1966 | pm_runtime_put(musb->controller); | 1977 | pm_runtime_mark_last_busy(musb->controller); |
| 1978 | pm_runtime_put_autosuspend(musb->controller); | ||
| 1967 | 1979 | ||
| 1968 | return 0; | 1980 | return 0; |
| 1969 | } | 1981 | } |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 2f8ad7f1f482..d227a71d85e1 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
| @@ -434,7 +434,13 @@ static void musb_advance_schedule(struct musb *musb, struct urb *urb, | |||
| 434 | } | 434 | } |
| 435 | } | 435 | } |
| 436 | 436 | ||
| 437 | if (qh != NULL && qh->is_ready) { | 437 | /* |
| 438 | * The pipe must be broken if current urb->status is set, so don't | ||
| 439 | * start next urb. | ||
| 440 | * TODO: to minimize the risk of regression, only check urb->status | ||
| 441 | * for RX, until we have a test case to understand the behavior of TX. | ||
| 442 | */ | ||
| 443 | if ((!status || !is_in) && qh && qh->is_ready) { | ||
| 438 | dev_dbg(musb->controller, "... next ep%d %cX urb %p\n", | 444 | dev_dbg(musb->controller, "... next ep%d %cX urb %p\n", |
| 439 | hw_ep->epnum, is_in ? 'R' : 'T', next_urb(qh)); | 445 | hw_ep->epnum, is_in ? 'R' : 'T', next_urb(qh)); |
| 440 | musb_start_urb(musb, is_in, qh); | 446 | musb_start_urb(musb, is_in, qh); |
| @@ -594,14 +600,13 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, u8 epnum) | |||
| 594 | musb_writew(ep->regs, MUSB_TXCSR, 0); | 600 | musb_writew(ep->regs, MUSB_TXCSR, 0); |
| 595 | 601 | ||
| 596 | /* scrub all previous state, clearing toggle */ | 602 | /* scrub all previous state, clearing toggle */ |
| 597 | } else { | ||
| 598 | csr = musb_readw(ep->regs, MUSB_RXCSR); | ||
| 599 | if (csr & MUSB_RXCSR_RXPKTRDY) | ||
| 600 | WARNING("rx%d, packet/%d ready?\n", ep->epnum, | ||
| 601 | musb_readw(ep->regs, MUSB_RXCOUNT)); | ||
| 602 | |||
| 603 | musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG); | ||
| 604 | } | 603 | } |
| 604 | csr = musb_readw(ep->regs, MUSB_RXCSR); | ||
| 605 | if (csr & MUSB_RXCSR_RXPKTRDY) | ||
| 606 | WARNING("rx%d, packet/%d ready?\n", ep->epnum, | ||
| 607 | musb_readw(ep->regs, MUSB_RXCOUNT)); | ||
| 608 | |||
| 609 | musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG); | ||
| 605 | 610 | ||
| 606 | /* target addr and (for multipoint) hub addr/port */ | 611 | /* target addr and (for multipoint) hub addr/port */ |
| 607 | if (musb->is_multipoint) { | 612 | if (musb->is_multipoint) { |
| @@ -627,7 +632,7 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, u8 epnum) | |||
| 627 | ep->rx_reinit = 0; | 632 | ep->rx_reinit = 0; |
| 628 | } | 633 | } |
| 629 | 634 | ||
| 630 | static int musb_tx_dma_set_mode_mentor(struct dma_controller *dma, | 635 | static void musb_tx_dma_set_mode_mentor(struct dma_controller *dma, |
| 631 | struct musb_hw_ep *hw_ep, struct musb_qh *qh, | 636 | struct musb_hw_ep *hw_ep, struct musb_qh *qh, |
| 632 | struct urb *urb, u32 offset, | 637 | struct urb *urb, u32 offset, |
| 633 | u32 *length, u8 *mode) | 638 | u32 *length, u8 *mode) |
| @@ -664,23 +669,18 @@ static int musb_tx_dma_set_mode_mentor(struct dma_controller *dma, | |||
| 664 | } | 669 | } |
| 665 | channel->desired_mode = *mode; | 670 | channel->desired_mode = *mode; |
| 666 | musb_writew(epio, MUSB_TXCSR, csr); | 671 | musb_writew(epio, MUSB_TXCSR, csr); |
| 667 | |||
| 668 | return 0; | ||
| 669 | } | 672 | } |
| 670 | 673 | ||
| 671 | static int musb_tx_dma_set_mode_cppi_tusb(struct dma_controller *dma, | 674 | static void musb_tx_dma_set_mode_cppi_tusb(struct dma_controller *dma, |
| 672 | struct musb_hw_ep *hw_ep, | 675 | struct musb_hw_ep *hw_ep, |
| 673 | struct musb_qh *qh, | 676 | struct musb_qh *qh, |
| 674 | struct urb *urb, | 677 | struct urb *urb, |
| 675 | u32 offset, | 678 | u32 offset, |
| 676 | u32 *length, | 679 | u32 *length, |
| 677 | u8 *mode) | 680 | u8 *mode) |
| 678 | { | 681 | { |
| 679 | struct dma_channel *channel = hw_ep->tx_channel; | 682 | struct dma_channel *channel = hw_ep->tx_channel; |
| 680 | 683 | ||
| 681 | if (!is_cppi_enabled(hw_ep->musb) && !tusb_dma_omap(hw_ep->musb)) | ||
| 682 | return -ENODEV; | ||
| 683 | |||
| 684 | channel->actual_len = 0; | 684 | channel->actual_len = 0; |
| 685 | 685 | ||
| 686 | /* | 686 | /* |
| @@ -688,8 +688,6 @@ static int musb_tx_dma_set_mode_cppi_tusb(struct dma_controller *dma, | |||
| 688 | * to identify the zero-length-final-packet case. | 688 | * to identify the zero-length-final-packet case. |
| 689 | */ | 689 | */ |
| 690 | *mode = (urb->transfer_flags & URB_ZERO_PACKET) ? 1 : 0; | 690 | *mode = (urb->transfer_flags & URB_ZERO_PACKET) ? 1 : 0; |
| 691 | |||
| 692 | return 0; | ||
| 693 | } | 691 | } |
| 694 | 692 | ||
| 695 | static bool musb_tx_dma_program(struct dma_controller *dma, | 693 | static bool musb_tx_dma_program(struct dma_controller *dma, |
| @@ -699,15 +697,14 @@ static bool musb_tx_dma_program(struct dma_controller *dma, | |||
| 699 | struct dma_channel *channel = hw_ep->tx_channel; | 697 | struct dma_channel *channel = hw_ep->tx_channel; |
| 700 | u16 pkt_size = qh->maxpacket; | 698 | u16 pkt_size = qh->maxpacket; |
| 701 | u8 mode; | 699 | u8 mode; |
| 702 | int res; | ||
| 703 | 700 | ||
| 704 | if (musb_dma_inventra(hw_ep->musb) || musb_dma_ux500(hw_ep->musb)) | 701 | if (musb_dma_inventra(hw_ep->musb) || musb_dma_ux500(hw_ep->musb)) |
| 705 | res = musb_tx_dma_set_mode_mentor(dma, hw_ep, qh, urb, | 702 | musb_tx_dma_set_mode_mentor(dma, hw_ep, qh, urb, offset, |
| 706 | offset, &length, &mode); | 703 | &length, &mode); |
| 704 | else if (is_cppi_enabled(hw_ep->musb) || tusb_dma_omap(hw_ep->musb)) | ||
| 705 | musb_tx_dma_set_mode_cppi_tusb(dma, hw_ep, qh, urb, offset, | ||
| 706 | &length, &mode); | ||
| 707 | else | 707 | else |
| 708 | res = musb_tx_dma_set_mode_cppi_tusb(dma, hw_ep, qh, urb, | ||
| 709 | offset, &length, &mode); | ||
| 710 | if (res) | ||
| 711 | return false; | 708 | return false; |
| 712 | 709 | ||
| 713 | qh->segsize = length; | 710 | qh->segsize = length; |
| @@ -995,9 +992,15 @@ static void musb_bulk_nak_timeout(struct musb *musb, struct musb_hw_ep *ep, | |||
| 995 | if (is_in) { | 992 | if (is_in) { |
| 996 | dma = is_dma_capable() ? ep->rx_channel : NULL; | 993 | dma = is_dma_capable() ? ep->rx_channel : NULL; |
| 997 | 994 | ||
| 998 | /* clear nak timeout bit */ | 995 | /* |
| 996 | * Need to stop the transaction by clearing REQPKT first | ||
| 997 | * then the NAK Timeout bit ref MUSBMHDRC USB 2.0 HIGH-SPEED | ||
| 998 | * DUAL-ROLE CONTROLLER Programmer's Guide, section 9.2.2 | ||
| 999 | */ | ||
| 999 | rx_csr = musb_readw(epio, MUSB_RXCSR); | 1000 | rx_csr = musb_readw(epio, MUSB_RXCSR); |
| 1000 | rx_csr |= MUSB_RXCSR_H_WZC_BITS; | 1001 | rx_csr |= MUSB_RXCSR_H_WZC_BITS; |
| 1002 | rx_csr &= ~MUSB_RXCSR_H_REQPKT; | ||
| 1003 | musb_writew(epio, MUSB_RXCSR, rx_csr); | ||
| 1001 | rx_csr &= ~MUSB_RXCSR_DATAERROR; | 1004 | rx_csr &= ~MUSB_RXCSR_DATAERROR; |
| 1002 | musb_writew(epio, MUSB_RXCSR, rx_csr); | 1005 | musb_writew(epio, MUSB_RXCSR, rx_csr); |
| 1003 | 1006 | ||
| @@ -1551,7 +1554,7 @@ static int musb_rx_dma_iso_cppi41(struct dma_controller *dma, | |||
| 1551 | struct urb *urb, | 1554 | struct urb *urb, |
| 1552 | size_t len) | 1555 | size_t len) |
| 1553 | { | 1556 | { |
| 1554 | struct dma_channel *channel = hw_ep->tx_channel; | 1557 | struct dma_channel *channel = hw_ep->rx_channel; |
| 1555 | void __iomem *epio = hw_ep->regs; | 1558 | void __iomem *epio = hw_ep->regs; |
| 1556 | dma_addr_t *buf; | 1559 | dma_addr_t *buf; |
| 1557 | u32 length, res; | 1560 | u32 length, res; |
| @@ -1870,6 +1873,9 @@ void musb_host_rx(struct musb *musb, u8 epnum) | |||
| 1870 | status = -EPROTO; | 1873 | status = -EPROTO; |
| 1871 | musb_writeb(epio, MUSB_RXINTERVAL, 0); | 1874 | musb_writeb(epio, MUSB_RXINTERVAL, 0); |
| 1872 | 1875 | ||
| 1876 | rx_csr &= ~MUSB_RXCSR_H_ERROR; | ||
| 1877 | musb_writew(epio, MUSB_RXCSR, rx_csr); | ||
| 1878 | |||
| 1873 | } else if (rx_csr & MUSB_RXCSR_DATAERROR) { | 1879 | } else if (rx_csr & MUSB_RXCSR_DATAERROR) { |
| 1874 | 1880 | ||
| 1875 | if (USB_ENDPOINT_XFER_ISOC != qh->type) { | 1881 | if (USB_ENDPOINT_XFER_ISOC != qh->type) { |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index c84e0322c108..0b4cec940386 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
| @@ -49,97 +49,14 @@ struct omap2430_glue { | |||
| 49 | enum musb_vbus_id_status status; | 49 | enum musb_vbus_id_status status; |
| 50 | struct work_struct omap_musb_mailbox_work; | 50 | struct work_struct omap_musb_mailbox_work; |
| 51 | struct device *control_otghs; | 51 | struct device *control_otghs; |
| 52 | bool cable_connected; | ||
| 53 | bool enabled; | ||
| 54 | bool powered; | ||
| 52 | }; | 55 | }; |
| 53 | #define glue_to_musb(g) platform_get_drvdata(g->musb) | 56 | #define glue_to_musb(g) platform_get_drvdata(g->musb) |
| 54 | 57 | ||
| 55 | static struct omap2430_glue *_glue; | 58 | static struct omap2430_glue *_glue; |
| 56 | 59 | ||
| 57 | static struct timer_list musb_idle_timer; | ||
| 58 | |||
| 59 | static void musb_do_idle(unsigned long _musb) | ||
| 60 | { | ||
| 61 | struct musb *musb = (void *)_musb; | ||
| 62 | unsigned long flags; | ||
| 63 | u8 power; | ||
| 64 | u8 devctl; | ||
| 65 | |||
| 66 | spin_lock_irqsave(&musb->lock, flags); | ||
| 67 | |||
| 68 | switch (musb->xceiv->otg->state) { | ||
| 69 | case OTG_STATE_A_WAIT_BCON: | ||
| 70 | |||
| 71 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | ||
| 72 | if (devctl & MUSB_DEVCTL_BDEVICE) { | ||
| 73 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; | ||
| 74 | MUSB_DEV_MODE(musb); | ||
| 75 | } else { | ||
| 76 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; | ||
| 77 | MUSB_HST_MODE(musb); | ||
| 78 | } | ||
| 79 | break; | ||
| 80 | case OTG_STATE_A_SUSPEND: | ||
| 81 | /* finish RESUME signaling? */ | ||
| 82 | if (musb->port1_status & MUSB_PORT_STAT_RESUME) { | ||
| 83 | power = musb_readb(musb->mregs, MUSB_POWER); | ||
| 84 | power &= ~MUSB_POWER_RESUME; | ||
| 85 | dev_dbg(musb->controller, "root port resume stopped, power %02x\n", power); | ||
| 86 | musb_writeb(musb->mregs, MUSB_POWER, power); | ||
| 87 | musb->is_active = 1; | ||
| 88 | musb->port1_status &= ~(USB_PORT_STAT_SUSPEND | ||
| 89 | | MUSB_PORT_STAT_RESUME); | ||
| 90 | musb->port1_status |= USB_PORT_STAT_C_SUSPEND << 16; | ||
| 91 | usb_hcd_poll_rh_status(musb->hcd); | ||
| 92 | /* NOTE: it might really be A_WAIT_BCON ... */ | ||
| 93 | musb->xceiv->otg->state = OTG_STATE_A_HOST; | ||
| 94 | } | ||
| 95 | break; | ||
| 96 | case OTG_STATE_A_HOST: | ||
| 97 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | ||
| 98 | if (devctl & MUSB_DEVCTL_BDEVICE) | ||
| 99 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; | ||
| 100 | else | ||
| 101 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON; | ||
| 102 | default: | ||
| 103 | break; | ||
| 104 | } | ||
| 105 | spin_unlock_irqrestore(&musb->lock, flags); | ||
| 106 | } | ||
| 107 | |||
| 108 | |||
| 109 | static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout) | ||
| 110 | { | ||
| 111 | unsigned long default_timeout = jiffies + msecs_to_jiffies(3); | ||
| 112 | static unsigned long last_timer; | ||
| 113 | |||
| 114 | if (timeout == 0) | ||
| 115 | timeout = default_timeout; | ||
| 116 | |||
| 117 | /* Never idle if active, or when VBUS timeout is not set as host */ | ||
| 118 | if (musb->is_active || ((musb->a_wait_bcon == 0) | ||
| 119 | && (musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON))) { | ||
| 120 | dev_dbg(musb->controller, "%s active, deleting timer\n", | ||
| 121 | usb_otg_state_string(musb->xceiv->otg->state)); | ||
| 122 | del_timer(&musb_idle_timer); | ||
| 123 | last_timer = jiffies; | ||
| 124 | return; | ||
| 125 | } | ||
| 126 | |||
| 127 | if (time_after(last_timer, timeout)) { | ||
| 128 | if (!timer_pending(&musb_idle_timer)) | ||
| 129 | last_timer = timeout; | ||
| 130 | else { | ||
| 131 | dev_dbg(musb->controller, "Longer idle timer already pending, ignoring\n"); | ||
| 132 | return; | ||
| 133 | } | ||
| 134 | } | ||
| 135 | last_timer = timeout; | ||
| 136 | |||
| 137 | dev_dbg(musb->controller, "%s inactive, for idle timer for %lu ms\n", | ||
| 138 | usb_otg_state_string(musb->xceiv->otg->state), | ||
| 139 | (unsigned long)jiffies_to_msecs(timeout - jiffies)); | ||
| 140 | mod_timer(&musb_idle_timer, timeout); | ||
| 141 | } | ||
| 142 | |||
| 143 | static void omap2430_musb_set_vbus(struct musb *musb, int is_on) | 60 | static void omap2430_musb_set_vbus(struct musb *musb, int is_on) |
| 144 | { | 61 | { |
| 145 | struct usb_otg *otg = musb->xceiv->otg; | 62 | struct usb_otg *otg = musb->xceiv->otg; |
| @@ -205,16 +122,6 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on) | |||
| 205 | musb_readb(musb->mregs, MUSB_DEVCTL)); | 122 | musb_readb(musb->mregs, MUSB_DEVCTL)); |
| 206 | } | 123 | } |
| 207 | 124 | ||
| 208 | static int omap2430_musb_set_mode(struct musb *musb, u8 musb_mode) | ||
| 209 | { | ||
| 210 | u8 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | ||
| 211 | |||
| 212 | devctl |= MUSB_DEVCTL_SESSION; | ||
| 213 | musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); | ||
| 214 | |||
| 215 | return 0; | ||
| 216 | } | ||
| 217 | |||
| 218 | static inline void omap2430_low_level_exit(struct musb *musb) | 125 | static inline void omap2430_low_level_exit(struct musb *musb) |
| 219 | { | 126 | { |
| 220 | u32 l; | 127 | u32 l; |
| @@ -234,22 +141,63 @@ static inline void omap2430_low_level_init(struct musb *musb) | |||
| 234 | musb_writel(musb->mregs, OTG_FORCESTDBY, l); | 141 | musb_writel(musb->mregs, OTG_FORCESTDBY, l); |
| 235 | } | 142 | } |
| 236 | 143 | ||
| 237 | static void omap2430_musb_mailbox(enum musb_vbus_id_status status) | 144 | /* |
| 145 | * We can get multiple cable events so we need to keep track | ||
| 146 | * of the power state. Only keep power enabled if USB cable is | ||
| 147 | * connected and a gadget is started. | ||
| 148 | */ | ||
| 149 | static void omap2430_set_power(struct musb *musb, bool enabled, bool cable) | ||
| 150 | { | ||
| 151 | struct device *dev = musb->controller; | ||
| 152 | struct omap2430_glue *glue = dev_get_drvdata(dev->parent); | ||
| 153 | bool power_up; | ||
| 154 | int res; | ||
| 155 | |||
| 156 | if (glue->enabled != enabled) | ||
| 157 | glue->enabled = enabled; | ||
| 158 | |||
| 159 | if (glue->cable_connected != cable) | ||
| 160 | glue->cable_connected = cable; | ||
| 161 | |||
| 162 | power_up = glue->enabled && glue->cable_connected; | ||
| 163 | if (power_up == glue->powered) { | ||
| 164 | dev_warn(musb->controller, "power state already %i\n", | ||
| 165 | power_up); | ||
| 166 | return; | ||
| 167 | } | ||
| 168 | |||
| 169 | glue->powered = power_up; | ||
| 170 | |||
| 171 | if (power_up) { | ||
| 172 | res = pm_runtime_get_sync(musb->controller); | ||
| 173 | if (res < 0) { | ||
| 174 | dev_err(musb->controller, "could not enable: %i", res); | ||
| 175 | glue->powered = false; | ||
| 176 | } | ||
| 177 | } else { | ||
| 178 | pm_runtime_mark_last_busy(musb->controller); | ||
| 179 | pm_runtime_put_autosuspend(musb->controller); | ||
| 180 | } | ||
| 181 | } | ||
| 182 | |||
| 183 | static int omap2430_musb_mailbox(enum musb_vbus_id_status status) | ||
| 238 | { | 184 | { |
| 239 | struct omap2430_glue *glue = _glue; | 185 | struct omap2430_glue *glue = _glue; |
| 240 | 186 | ||
| 241 | if (!glue) { | 187 | if (!glue) { |
| 242 | pr_err("%s: musb core is not yet initialized\n", __func__); | 188 | pr_err("%s: musb core is not yet initialized\n", __func__); |
| 243 | return; | 189 | return -EPROBE_DEFER; |
| 244 | } | 190 | } |
| 245 | glue->status = status; | 191 | glue->status = status; |
| 246 | 192 | ||
| 247 | if (!glue_to_musb(glue)) { | 193 | if (!glue_to_musb(glue)) { |
| 248 | pr_err("%s: musb core is not yet ready\n", __func__); | 194 | pr_err("%s: musb core is not yet ready\n", __func__); |
| 249 | return; | 195 | return -EPROBE_DEFER; |
| 250 | } | 196 | } |
| 251 | 197 | ||
| 252 | schedule_work(&glue->omap_musb_mailbox_work); | 198 | schedule_work(&glue->omap_musb_mailbox_work); |
| 199 | |||
| 200 | return 0; | ||
| 253 | } | 201 | } |
| 254 | 202 | ||
| 255 | static void omap_musb_set_mailbox(struct omap2430_glue *glue) | 203 | static void omap_musb_set_mailbox(struct omap2430_glue *glue) |
| @@ -259,6 +207,13 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) | |||
| 259 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(dev); | 207 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(dev); |
| 260 | struct omap_musb_board_data *data = pdata->board_data; | 208 | struct omap_musb_board_data *data = pdata->board_data; |
| 261 | struct usb_otg *otg = musb->xceiv->otg; | 209 | struct usb_otg *otg = musb->xceiv->otg; |
| 210 | bool cable_connected; | ||
| 211 | |||
| 212 | cable_connected = ((glue->status == MUSB_ID_GROUND) || | ||
| 213 | (glue->status == MUSB_VBUS_VALID)); | ||
| 214 | |||
| 215 | if (cable_connected) | ||
| 216 | omap2430_set_power(musb, glue->enabled, cable_connected); | ||
| 262 | 217 | ||
| 263 | switch (glue->status) { | 218 | switch (glue->status) { |
| 264 | case MUSB_ID_GROUND: | 219 | case MUSB_ID_GROUND: |
| @@ -268,7 +223,6 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) | |||
| 268 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; | 223 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; |
| 269 | musb->xceiv->last_event = USB_EVENT_ID; | 224 | musb->xceiv->last_event = USB_EVENT_ID; |
| 270 | if (musb->gadget_driver) { | 225 | if (musb->gadget_driver) { |
| 271 | pm_runtime_get_sync(dev); | ||
| 272 | omap_control_usb_set_mode(glue->control_otghs, | 226 | omap_control_usb_set_mode(glue->control_otghs, |
| 273 | USB_MODE_HOST); | 227 | USB_MODE_HOST); |
| 274 | omap2430_musb_set_vbus(musb, 1); | 228 | omap2430_musb_set_vbus(musb, 1); |
| @@ -281,8 +235,6 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) | |||
| 281 | otg->default_a = false; | 235 | otg->default_a = false; |
| 282 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; | 236 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
| 283 | musb->xceiv->last_event = USB_EVENT_VBUS; | 237 | musb->xceiv->last_event = USB_EVENT_VBUS; |
| 284 | if (musb->gadget_driver) | ||
| 285 | pm_runtime_get_sync(dev); | ||
| 286 | omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE); | 238 | omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE); |
| 287 | break; | 239 | break; |
| 288 | 240 | ||
| @@ -291,11 +243,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) | |||
| 291 | dev_dbg(dev, "VBUS Disconnect\n"); | 243 | dev_dbg(dev, "VBUS Disconnect\n"); |
| 292 | 244 | ||
| 293 | musb->xceiv->last_event = USB_EVENT_NONE; | 245 | musb->xceiv->last_event = USB_EVENT_NONE; |
| 294 | if (musb->gadget_driver) { | 246 | if (musb->gadget_driver) |
| 295 | omap2430_musb_set_vbus(musb, 0); | 247 | omap2430_musb_set_vbus(musb, 0); |
| 296 | pm_runtime_mark_last_busy(dev); | ||
| 297 | pm_runtime_put_autosuspend(dev); | ||
| 298 | } | ||
| 299 | 248 | ||
| 300 | if (data->interface_type == MUSB_INTERFACE_UTMI) | 249 | if (data->interface_type == MUSB_INTERFACE_UTMI) |
| 301 | otg_set_vbus(musb->xceiv->otg, 0); | 250 | otg_set_vbus(musb->xceiv->otg, 0); |
| @@ -307,6 +256,9 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) | |||
| 307 | dev_dbg(dev, "ID float\n"); | 256 | dev_dbg(dev, "ID float\n"); |
| 308 | } | 257 | } |
| 309 | 258 | ||
| 259 | if (!cable_connected) | ||
| 260 | omap2430_set_power(musb, glue->enabled, cable_connected); | ||
| 261 | |||
| 310 | atomic_notifier_call_chain(&musb->xceiv->notifier, | 262 | atomic_notifier_call_chain(&musb->xceiv->notifier, |
| 311 | musb->xceiv->last_event, NULL); | 263 | musb->xceiv->last_event, NULL); |
| 312 | } | 264 | } |
| @@ -316,13 +268,8 @@ static void omap_musb_mailbox_work(struct work_struct *mailbox_work) | |||
| 316 | { | 268 | { |
| 317 | struct omap2430_glue *glue = container_of(mailbox_work, | 269 | struct omap2430_glue *glue = container_of(mailbox_work, |
| 318 | struct omap2430_glue, omap_musb_mailbox_work); | 270 | struct omap2430_glue, omap_musb_mailbox_work); |
| 319 | struct musb *musb = glue_to_musb(glue); | ||
| 320 | struct device *dev = musb->controller; | ||
| 321 | 271 | ||
| 322 | pm_runtime_get_sync(dev); | ||
| 323 | omap_musb_set_mailbox(glue); | 272 | omap_musb_set_mailbox(glue); |
| 324 | pm_runtime_mark_last_busy(dev); | ||
| 325 | pm_runtime_put_autosuspend(dev); | ||
| 326 | } | 273 | } |
| 327 | 274 | ||
| 328 | static irqreturn_t omap2430_musb_interrupt(int irq, void *__hci) | 275 | static irqreturn_t omap2430_musb_interrupt(int irq, void *__hci) |
| @@ -389,23 +336,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
| 389 | return PTR_ERR(musb->phy); | 336 | return PTR_ERR(musb->phy); |
| 390 | } | 337 | } |
| 391 | musb->isr = omap2430_musb_interrupt; | 338 | musb->isr = omap2430_musb_interrupt; |
| 392 | 339 | phy_init(musb->phy); | |
| 393 | /* | ||
| 394 | * Enable runtime PM for musb parent (this driver). We can't | ||
| 395 | * do it earlier as struct musb is not yet allocated and we | ||
| 396 | * need to touch the musb registers for runtime PM. | ||
| 397 | */ | ||
| 398 | pm_runtime_enable(glue->dev); | ||
| 399 | status = pm_runtime_get_sync(glue->dev); | ||
| 400 | if (status < 0) | ||
| 401 | goto err1; | ||
| 402 | |||
| 403 | status = pm_runtime_get_sync(dev); | ||
| 404 | if (status < 0) { | ||
| 405 | dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status); | ||
| 406 | pm_runtime_put_sync(glue->dev); | ||
| 407 | goto err1; | ||
| 408 | } | ||
| 409 | 340 | ||
| 410 | l = musb_readl(musb->mregs, OTG_INTERFSEL); | 341 | l = musb_readl(musb->mregs, OTG_INTERFSEL); |
| 411 | 342 | ||
| @@ -427,20 +358,10 @@ static int omap2430_musb_init(struct musb *musb) | |||
| 427 | musb_readl(musb->mregs, OTG_INTERFSEL), | 358 | musb_readl(musb->mregs, OTG_INTERFSEL), |
| 428 | musb_readl(musb->mregs, OTG_SIMENABLE)); | 359 | musb_readl(musb->mregs, OTG_SIMENABLE)); |
| 429 | 360 | ||
| 430 | setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); | ||
| 431 | |||
| 432 | if (glue->status != MUSB_UNKNOWN) | 361 | if (glue->status != MUSB_UNKNOWN) |
| 433 | omap_musb_set_mailbox(glue); | 362 | omap_musb_set_mailbox(glue); |
| 434 | 363 | ||
| 435 | phy_init(musb->phy); | ||
| 436 | phy_power_on(musb->phy); | ||
| 437 | |||
| 438 | pm_runtime_put_noidle(musb->controller); | ||
| 439 | pm_runtime_put_noidle(glue->dev); | ||
| 440 | return 0; | 364 | return 0; |
| 441 | |||
| 442 | err1: | ||
| 443 | return status; | ||
| 444 | } | 365 | } |
| 445 | 366 | ||
| 446 | static void omap2430_musb_enable(struct musb *musb) | 367 | static void omap2430_musb_enable(struct musb *musb) |
| @@ -452,6 +373,11 @@ static void omap2430_musb_enable(struct musb *musb) | |||
| 452 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(dev); | 373 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(dev); |
| 453 | struct omap_musb_board_data *data = pdata->board_data; | 374 | struct omap_musb_board_data *data = pdata->board_data; |
| 454 | 375 | ||
| 376 | if (!WARN_ON(!musb->phy)) | ||
| 377 | phy_power_on(musb->phy); | ||
| 378 | |||
| 379 | omap2430_set_power(musb, true, glue->cable_connected); | ||
| 380 | |||
| 455 | switch (glue->status) { | 381 | switch (glue->status) { |
| 456 | 382 | ||
| 457 | case MUSB_ID_GROUND: | 383 | case MUSB_ID_GROUND: |
| @@ -487,18 +413,25 @@ static void omap2430_musb_disable(struct musb *musb) | |||
| 487 | struct device *dev = musb->controller; | 413 | struct device *dev = musb->controller; |
| 488 | struct omap2430_glue *glue = dev_get_drvdata(dev->parent); | 414 | struct omap2430_glue *glue = dev_get_drvdata(dev->parent); |
| 489 | 415 | ||
| 416 | if (!WARN_ON(!musb->phy)) | ||
| 417 | phy_power_off(musb->phy); | ||
| 418 | |||
| 490 | if (glue->status != MUSB_UNKNOWN) | 419 | if (glue->status != MUSB_UNKNOWN) |
| 491 | omap_control_usb_set_mode(glue->control_otghs, | 420 | omap_control_usb_set_mode(glue->control_otghs, |
| 492 | USB_MODE_DISCONNECT); | 421 | USB_MODE_DISCONNECT); |
| 422 | |||
| 423 | omap2430_set_power(musb, false, glue->cable_connected); | ||
| 493 | } | 424 | } |
| 494 | 425 | ||
| 495 | static int omap2430_musb_exit(struct musb *musb) | 426 | static int omap2430_musb_exit(struct musb *musb) |
| 496 | { | 427 | { |
| 497 | del_timer_sync(&musb_idle_timer); | 428 | struct device *dev = musb->controller; |
| 429 | struct omap2430_glue *glue = dev_get_drvdata(dev->parent); | ||
| 498 | 430 | ||
| 499 | omap2430_low_level_exit(musb); | 431 | omap2430_low_level_exit(musb); |
| 500 | phy_power_off(musb->phy); | ||
| 501 | phy_exit(musb->phy); | 432 | phy_exit(musb->phy); |
| 433 | musb->phy = NULL; | ||
| 434 | cancel_work_sync(&glue->omap_musb_mailbox_work); | ||
| 502 | 435 | ||
| 503 | return 0; | 436 | return 0; |
| 504 | } | 437 | } |
| @@ -512,9 +445,6 @@ static const struct musb_platform_ops omap2430_ops = { | |||
| 512 | .init = omap2430_musb_init, | 445 | .init = omap2430_musb_init, |
| 513 | .exit = omap2430_musb_exit, | 446 | .exit = omap2430_musb_exit, |
| 514 | 447 | ||
| 515 | .set_mode = omap2430_musb_set_mode, | ||
| 516 | .try_idle = omap2430_musb_try_idle, | ||
| 517 | |||
| 518 | .set_vbus = omap2430_musb_set_vbus, | 448 | .set_vbus = omap2430_musb_set_vbus, |
| 519 | 449 | ||
| 520 | .enable = omap2430_musb_enable, | 450 | .enable = omap2430_musb_enable, |
| @@ -639,11 +569,9 @@ static int omap2430_probe(struct platform_device *pdev) | |||
| 639 | goto err2; | 569 | goto err2; |
| 640 | } | 570 | } |
| 641 | 571 | ||
| 642 | /* | 572 | pm_runtime_enable(glue->dev); |
| 643 | * Note that we cannot enable PM runtime yet for this | 573 | pm_runtime_use_autosuspend(glue->dev); |
| 644 | * driver as we need struct musb initialized first. | 574 | pm_runtime_set_autosuspend_delay(glue->dev, 500); |
| 645 | * See omap2430_musb_init above. | ||
| 646 | */ | ||
| 647 | 575 | ||
| 648 | ret = platform_device_add(musb); | 576 | ret = platform_device_add(musb); |
| 649 | if (ret) { | 577 | if (ret) { |
| @@ -662,12 +590,14 @@ err0: | |||
| 662 | 590 | ||
| 663 | static int omap2430_remove(struct platform_device *pdev) | 591 | static int omap2430_remove(struct platform_device *pdev) |
| 664 | { | 592 | { |
| 665 | struct omap2430_glue *glue = platform_get_drvdata(pdev); | 593 | struct omap2430_glue *glue = platform_get_drvdata(pdev); |
| 594 | struct musb *musb = glue_to_musb(glue); | ||
| 666 | 595 | ||
| 667 | pm_runtime_get_sync(glue->dev); | 596 | pm_runtime_get_sync(glue->dev); |
| 668 | cancel_work_sync(&glue->omap_musb_mailbox_work); | ||
| 669 | platform_device_unregister(glue->musb); | 597 | platform_device_unregister(glue->musb); |
| 598 | omap2430_set_power(musb, false, false); | ||
| 670 | pm_runtime_put_sync(glue->dev); | 599 | pm_runtime_put_sync(glue->dev); |
| 600 | pm_runtime_dont_use_autosuspend(glue->dev); | ||
| 671 | pm_runtime_disable(glue->dev); | 601 | pm_runtime_disable(glue->dev); |
| 672 | 602 | ||
| 673 | return 0; | 603 | return 0; |
| @@ -680,12 +610,13 @@ static int omap2430_runtime_suspend(struct device *dev) | |||
| 680 | struct omap2430_glue *glue = dev_get_drvdata(dev); | 610 | struct omap2430_glue *glue = dev_get_drvdata(dev); |
| 681 | struct musb *musb = glue_to_musb(glue); | 611 | struct musb *musb = glue_to_musb(glue); |
| 682 | 612 | ||
| 683 | if (musb) { | 613 | if (!musb) |
| 684 | musb->context.otg_interfsel = musb_readl(musb->mregs, | 614 | return 0; |
| 685 | OTG_INTERFSEL); | ||
| 686 | 615 | ||
| 687 | omap2430_low_level_exit(musb); | 616 | musb->context.otg_interfsel = musb_readl(musb->mregs, |
| 688 | } | 617 | OTG_INTERFSEL); |
| 618 | |||
| 619 | omap2430_low_level_exit(musb); | ||
| 689 | 620 | ||
| 690 | return 0; | 621 | return 0; |
| 691 | } | 622 | } |
| @@ -696,7 +627,7 @@ static int omap2430_runtime_resume(struct device *dev) | |||
| 696 | struct musb *musb = glue_to_musb(glue); | 627 | struct musb *musb = glue_to_musb(glue); |
| 697 | 628 | ||
| 698 | if (!musb) | 629 | if (!musb) |
| 699 | return -EPROBE_DEFER; | 630 | return 0; |
| 700 | 631 | ||
| 701 | omap2430_low_level_init(musb); | 632 | omap2430_low_level_init(musb); |
| 702 | musb_writel(musb->mregs, OTG_INTERFSEL, | 633 | musb_writel(musb->mregs, OTG_INTERFSEL, |
| @@ -738,18 +669,8 @@ static struct platform_driver omap2430_driver = { | |||
| 738 | }, | 669 | }, |
| 739 | }; | 670 | }; |
| 740 | 671 | ||
| 672 | module_platform_driver(omap2430_driver); | ||
| 673 | |||
| 741 | MODULE_DESCRIPTION("OMAP2PLUS MUSB Glue Layer"); | 674 | MODULE_DESCRIPTION("OMAP2PLUS MUSB Glue Layer"); |
| 742 | MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); | 675 | MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); |
| 743 | MODULE_LICENSE("GPL v2"); | 676 | MODULE_LICENSE("GPL v2"); |
| 744 | |||
| 745 | static int __init omap2430_init(void) | ||
| 746 | { | ||
| 747 | return platform_driver_register(&omap2430_driver); | ||
| 748 | } | ||
| 749 | subsys_initcall(omap2430_init); | ||
| 750 | |||
| 751 | static void __exit omap2430_exit(void) | ||
| 752 | { | ||
| 753 | platform_driver_unregister(&omap2430_driver); | ||
| 754 | } | ||
| 755 | module_exit(omap2430_exit); | ||
diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c index fdab4232cfbf..76500515dd8b 100644 --- a/drivers/usb/musb/sunxi.c +++ b/drivers/usb/musb/sunxi.c | |||
| @@ -80,7 +80,8 @@ static struct musb *sunxi_musb; | |||
| 80 | 80 | ||
| 81 | struct sunxi_glue { | 81 | struct sunxi_glue { |
| 82 | struct device *dev; | 82 | struct device *dev; |
| 83 | struct platform_device *musb; | 83 | struct musb *musb; |
| 84 | struct platform_device *musb_pdev; | ||
| 84 | struct clk *clk; | 85 | struct clk *clk; |
| 85 | struct reset_control *rst; | 86 | struct reset_control *rst; |
| 86 | struct phy *phy; | 87 | struct phy *phy; |
| @@ -102,7 +103,7 @@ static void sunxi_musb_work(struct work_struct *work) | |||
| 102 | return; | 103 | return; |
| 103 | 104 | ||
| 104 | if (test_and_clear_bit(SUNXI_MUSB_FL_HOSTMODE_PEND, &glue->flags)) { | 105 | if (test_and_clear_bit(SUNXI_MUSB_FL_HOSTMODE_PEND, &glue->flags)) { |
| 105 | struct musb *musb = platform_get_drvdata(glue->musb); | 106 | struct musb *musb = glue->musb; |
| 106 | unsigned long flags; | 107 | unsigned long flags; |
| 107 | u8 devctl; | 108 | u8 devctl; |
| 108 | 109 | ||
| @@ -112,7 +113,7 @@ static void sunxi_musb_work(struct work_struct *work) | |||
| 112 | if (test_bit(SUNXI_MUSB_FL_HOSTMODE, &glue->flags)) { | 113 | if (test_bit(SUNXI_MUSB_FL_HOSTMODE, &glue->flags)) { |
| 113 | set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); | 114 | set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); |
| 114 | musb->xceiv->otg->default_a = 1; | 115 | musb->xceiv->otg->default_a = 1; |
| 115 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; | 116 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; |
| 116 | MUSB_HST_MODE(musb); | 117 | MUSB_HST_MODE(musb); |
| 117 | devctl |= MUSB_DEVCTL_SESSION; | 118 | devctl |= MUSB_DEVCTL_SESSION; |
| 118 | } else { | 119 | } else { |
| @@ -145,10 +146,12 @@ static void sunxi_musb_set_vbus(struct musb *musb, int is_on) | |||
| 145 | { | 146 | { |
| 146 | struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); | 147 | struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); |
| 147 | 148 | ||
| 148 | if (is_on) | 149 | if (is_on) { |
| 149 | set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); | 150 | set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); |
| 150 | else | 151 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; |
| 152 | } else { | ||
| 151 | clear_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); | 153 | clear_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); |
| 154 | } | ||
| 152 | 155 | ||
| 153 | schedule_work(&glue->work); | 156 | schedule_work(&glue->work); |
| 154 | } | 157 | } |
| @@ -264,15 +267,6 @@ static int sunxi_musb_init(struct musb *musb) | |||
| 264 | if (ret) | 267 | if (ret) |
| 265 | goto error_unregister_notifier; | 268 | goto error_unregister_notifier; |
| 266 | 269 | ||
| 267 | if (musb->port_mode == MUSB_PORT_MODE_HOST) { | ||
| 268 | ret = phy_power_on(glue->phy); | ||
| 269 | if (ret) | ||
| 270 | goto error_phy_exit; | ||
| 271 | set_bit(SUNXI_MUSB_FL_PHY_ON, &glue->flags); | ||
| 272 | /* Stop musb work from turning vbus off again */ | ||
| 273 | set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); | ||
| 274 | } | ||
| 275 | |||
| 276 | musb->isr = sunxi_musb_interrupt; | 270 | musb->isr = sunxi_musb_interrupt; |
| 277 | 271 | ||
| 278 | /* Stop the musb-core from doing runtime pm (not supported on sunxi) */ | 272 | /* Stop the musb-core from doing runtime pm (not supported on sunxi) */ |
| @@ -280,8 +274,6 @@ static int sunxi_musb_init(struct musb *musb) | |||
| 280 | 274 | ||
| 281 | return 0; | 275 | return 0; |
| 282 | 276 | ||
| 283 | error_phy_exit: | ||
| 284 | phy_exit(glue->phy); | ||
| 285 | error_unregister_notifier: | 277 | error_unregister_notifier: |
| 286 | if (musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) | 278 | if (musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) |
| 287 | extcon_unregister_notifier(glue->extcon, EXTCON_USB_HOST, | 279 | extcon_unregister_notifier(glue->extcon, EXTCON_USB_HOST, |
| @@ -323,10 +315,31 @@ static int sunxi_musb_exit(struct musb *musb) | |||
| 323 | return 0; | 315 | return 0; |
| 324 | } | 316 | } |
| 325 | 317 | ||
| 318 | static int sunxi_set_mode(struct musb *musb, u8 mode) | ||
| 319 | { | ||
| 320 | struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); | ||
| 321 | int ret; | ||
| 322 | |||
| 323 | if (mode == MUSB_HOST) { | ||
| 324 | ret = phy_power_on(glue->phy); | ||
| 325 | if (ret) | ||
| 326 | return ret; | ||
| 327 | |||
| 328 | set_bit(SUNXI_MUSB_FL_PHY_ON, &glue->flags); | ||
| 329 | /* Stop musb work from turning vbus off again */ | ||
| 330 | set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); | ||
| 331 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; | ||
| 332 | } | ||
| 333 | |||
| 334 | return 0; | ||
| 335 | } | ||
| 336 | |||
| 326 | static void sunxi_musb_enable(struct musb *musb) | 337 | static void sunxi_musb_enable(struct musb *musb) |
| 327 | { | 338 | { |
| 328 | struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); | 339 | struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); |
| 329 | 340 | ||
| 341 | glue->musb = musb; | ||
| 342 | |||
| 330 | /* musb_core does not call us in a balanced manner */ | 343 | /* musb_core does not call us in a balanced manner */ |
| 331 | if (test_and_set_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags)) | 344 | if (test_and_set_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags)) |
| 332 | return; | 345 | return; |
| @@ -569,6 +582,7 @@ static const struct musb_platform_ops sunxi_musb_ops = { | |||
| 569 | .exit = sunxi_musb_exit, | 582 | .exit = sunxi_musb_exit, |
| 570 | .enable = sunxi_musb_enable, | 583 | .enable = sunxi_musb_enable, |
| 571 | .disable = sunxi_musb_disable, | 584 | .disable = sunxi_musb_disable, |
| 585 | .set_mode = sunxi_set_mode, | ||
| 572 | .fifo_offset = sunxi_musb_fifo_offset, | 586 | .fifo_offset = sunxi_musb_fifo_offset, |
| 573 | .ep_offset = sunxi_musb_ep_offset, | 587 | .ep_offset = sunxi_musb_ep_offset, |
| 574 | .busctl_offset = sunxi_musb_busctl_offset, | 588 | .busctl_offset = sunxi_musb_busctl_offset, |
| @@ -721,9 +735,9 @@ static int sunxi_musb_probe(struct platform_device *pdev) | |||
| 721 | pinfo.data = &pdata; | 735 | pinfo.data = &pdata; |
| 722 | pinfo.size_data = sizeof(pdata); | 736 | pinfo.size_data = sizeof(pdata); |
| 723 | 737 | ||
| 724 | glue->musb = platform_device_register_full(&pinfo); | 738 | glue->musb_pdev = platform_device_register_full(&pinfo); |
| 725 | if (IS_ERR(glue->musb)) { | 739 | if (IS_ERR(glue->musb_pdev)) { |
| 726 | ret = PTR_ERR(glue->musb); | 740 | ret = PTR_ERR(glue->musb_pdev); |
| 727 | dev_err(&pdev->dev, "Error registering musb dev: %d\n", ret); | 741 | dev_err(&pdev->dev, "Error registering musb dev: %d\n", ret); |
| 728 | goto err_unregister_usb_phy; | 742 | goto err_unregister_usb_phy; |
| 729 | } | 743 | } |
| @@ -740,7 +754,7 @@ static int sunxi_musb_remove(struct platform_device *pdev) | |||
| 740 | struct sunxi_glue *glue = platform_get_drvdata(pdev); | 754 | struct sunxi_glue *glue = platform_get_drvdata(pdev); |
| 741 | struct platform_device *usb_phy = glue->usb_phy; | 755 | struct platform_device *usb_phy = glue->usb_phy; |
| 742 | 756 | ||
| 743 | platform_device_unregister(glue->musb); /* Frees glue ! */ | 757 | platform_device_unregister(glue->musb_pdev); |
| 744 | usb_phy_generic_unregister(usb_phy); | 758 | usb_phy_generic_unregister(usb_phy); |
| 745 | 759 | ||
| 746 | return 0; | 760 | return 0; |
diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c index 24e2b3cf1867..a72e8d670adc 100644 --- a/drivers/usb/phy/phy-twl6030-usb.c +++ b/drivers/usb/phy/phy-twl6030-usb.c | |||
| @@ -97,6 +97,9 @@ struct twl6030_usb { | |||
| 97 | 97 | ||
| 98 | struct regulator *usb3v3; | 98 | struct regulator *usb3v3; |
| 99 | 99 | ||
| 100 | /* used to check initial cable status after probe */ | ||
| 101 | struct delayed_work get_status_work; | ||
| 102 | |||
| 100 | /* used to set vbus, in atomic path */ | 103 | /* used to set vbus, in atomic path */ |
| 101 | struct work_struct set_vbus_work; | 104 | struct work_struct set_vbus_work; |
| 102 | 105 | ||
| @@ -227,12 +230,16 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl) | |||
| 227 | twl->asleep = 1; | 230 | twl->asleep = 1; |
| 228 | status = MUSB_VBUS_VALID; | 231 | status = MUSB_VBUS_VALID; |
| 229 | twl->linkstat = status; | 232 | twl->linkstat = status; |
| 230 | musb_mailbox(status); | 233 | ret = musb_mailbox(status); |
| 234 | if (ret) | ||
| 235 | twl->linkstat = MUSB_UNKNOWN; | ||
| 231 | } else { | 236 | } else { |
| 232 | if (twl->linkstat != MUSB_UNKNOWN) { | 237 | if (twl->linkstat != MUSB_UNKNOWN) { |
| 233 | status = MUSB_VBUS_OFF; | 238 | status = MUSB_VBUS_OFF; |
| 234 | twl->linkstat = status; | 239 | twl->linkstat = status; |
| 235 | musb_mailbox(status); | 240 | ret = musb_mailbox(status); |
| 241 | if (ret) | ||
| 242 | twl->linkstat = MUSB_UNKNOWN; | ||
| 236 | if (twl->asleep) { | 243 | if (twl->asleep) { |
| 237 | regulator_disable(twl->usb3v3); | 244 | regulator_disable(twl->usb3v3); |
| 238 | twl->asleep = 0; | 245 | twl->asleep = 0; |
| @@ -264,7 +271,9 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) | |||
| 264 | twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_SET); | 271 | twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_SET); |
| 265 | status = MUSB_ID_GROUND; | 272 | status = MUSB_ID_GROUND; |
| 266 | twl->linkstat = status; | 273 | twl->linkstat = status; |
| 267 | musb_mailbox(status); | 274 | ret = musb_mailbox(status); |
| 275 | if (ret) | ||
| 276 | twl->linkstat = MUSB_UNKNOWN; | ||
| 268 | } else { | 277 | } else { |
| 269 | twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_CLR); | 278 | twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_CLR); |
| 270 | twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET); | 279 | twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET); |
| @@ -274,6 +283,15 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) | |||
| 274 | return IRQ_HANDLED; | 283 | return IRQ_HANDLED; |
| 275 | } | 284 | } |
| 276 | 285 | ||
| 286 | static void twl6030_status_work(struct work_struct *work) | ||
| 287 | { | ||
| 288 | struct twl6030_usb *twl = container_of(work, struct twl6030_usb, | ||
| 289 | get_status_work.work); | ||
| 290 | |||
| 291 | twl6030_usb_irq(twl->irq2, twl); | ||
| 292 | twl6030_usbotg_irq(twl->irq1, twl); | ||
| 293 | } | ||
| 294 | |||
| 277 | static int twl6030_enable_irq(struct twl6030_usb *twl) | 295 | static int twl6030_enable_irq(struct twl6030_usb *twl) |
| 278 | { | 296 | { |
| 279 | twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET); | 297 | twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET); |
| @@ -284,8 +302,6 @@ static int twl6030_enable_irq(struct twl6030_usb *twl) | |||
| 284 | REG_INT_MSK_LINE_C); | 302 | REG_INT_MSK_LINE_C); |
| 285 | twl6030_interrupt_unmask(TWL6030_CHARGER_CTRL_INT_MASK, | 303 | twl6030_interrupt_unmask(TWL6030_CHARGER_CTRL_INT_MASK, |
| 286 | REG_INT_MSK_STS_C); | 304 | REG_INT_MSK_STS_C); |
| 287 | twl6030_usb_irq(twl->irq2, twl); | ||
| 288 | twl6030_usbotg_irq(twl->irq1, twl); | ||
| 289 | 305 | ||
| 290 | return 0; | 306 | return 0; |
| 291 | } | 307 | } |
| @@ -371,6 +387,7 @@ static int twl6030_usb_probe(struct platform_device *pdev) | |||
| 371 | dev_warn(&pdev->dev, "could not create sysfs file\n"); | 387 | dev_warn(&pdev->dev, "could not create sysfs file\n"); |
| 372 | 388 | ||
| 373 | INIT_WORK(&twl->set_vbus_work, otg_set_vbus_work); | 389 | INIT_WORK(&twl->set_vbus_work, otg_set_vbus_work); |
| 390 | INIT_DELAYED_WORK(&twl->get_status_work, twl6030_status_work); | ||
| 374 | 391 | ||
| 375 | status = request_threaded_irq(twl->irq1, NULL, twl6030_usbotg_irq, | 392 | status = request_threaded_irq(twl->irq1, NULL, twl6030_usbotg_irq, |
| 376 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_ONESHOT, | 393 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_ONESHOT, |
| @@ -395,6 +412,7 @@ static int twl6030_usb_probe(struct platform_device *pdev) | |||
| 395 | 412 | ||
| 396 | twl->asleep = 0; | 413 | twl->asleep = 0; |
| 397 | twl6030_enable_irq(twl); | 414 | twl6030_enable_irq(twl); |
| 415 | schedule_delayed_work(&twl->get_status_work, HZ); | ||
| 398 | dev_info(&pdev->dev, "Initialized TWL6030 USB module\n"); | 416 | dev_info(&pdev->dev, "Initialized TWL6030 USB module\n"); |
| 399 | 417 | ||
| 400 | return 0; | 418 | return 0; |
| @@ -404,6 +422,7 @@ static int twl6030_usb_remove(struct platform_device *pdev) | |||
| 404 | { | 422 | { |
| 405 | struct twl6030_usb *twl = platform_get_drvdata(pdev); | 423 | struct twl6030_usb *twl = platform_get_drvdata(pdev); |
| 406 | 424 | ||
| 425 | cancel_delayed_work(&twl->get_status_work); | ||
| 407 | twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, | 426 | twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, |
| 408 | REG_INT_MSK_LINE_C); | 427 | REG_INT_MSK_LINE_C); |
| 409 | twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, | 428 | twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, |
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 2eddbe538cda..5608af4a369d 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
| @@ -2007,6 +2007,7 @@ static void mos7720_release(struct usb_serial *serial) | |||
| 2007 | urblist_entry) | 2007 | urblist_entry) |
| 2008 | usb_unlink_urb(urbtrack->urb); | 2008 | usb_unlink_urb(urbtrack->urb); |
| 2009 | spin_unlock_irqrestore(&mos_parport->listlock, flags); | 2009 | spin_unlock_irqrestore(&mos_parport->listlock, flags); |
| 2010 | parport_del_port(mos_parport->pp); | ||
| 2010 | 2011 | ||
| 2011 | kref_put(&mos_parport->ref_count, destroy_mos_parport); | 2012 | kref_put(&mos_parport->ref_count, destroy_mos_parport); |
| 2012 | } | 2013 | } |
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 4d49fce406e1..5ef014ba6ae8 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c | |||
| @@ -836,6 +836,7 @@ static int uas_slave_configure(struct scsi_device *sdev) | |||
| 836 | if (devinfo->flags & US_FL_BROKEN_FUA) | 836 | if (devinfo->flags & US_FL_BROKEN_FUA) |
| 837 | sdev->broken_fua = 1; | 837 | sdev->broken_fua = 1; |
| 838 | 838 | ||
| 839 | scsi_change_queue_depth(sdev, devinfo->qdepth - 2); | ||
| 839 | return 0; | 840 | return 0; |
| 840 | } | 841 | } |
| 841 | 842 | ||
| @@ -848,7 +849,6 @@ static struct scsi_host_template uas_host_template = { | |||
| 848 | .slave_configure = uas_slave_configure, | 849 | .slave_configure = uas_slave_configure, |
| 849 | .eh_abort_handler = uas_eh_abort_handler, | 850 | .eh_abort_handler = uas_eh_abort_handler, |
| 850 | .eh_bus_reset_handler = uas_eh_bus_reset_handler, | 851 | .eh_bus_reset_handler = uas_eh_bus_reset_handler, |
| 851 | .can_queue = MAX_CMNDS, | ||
| 852 | .this_id = -1, | 852 | .this_id = -1, |
| 853 | .sg_tablesize = SG_NONE, | 853 | .sg_tablesize = SG_NONE, |
| 854 | .skip_settle_delay = 1, | 854 | .skip_settle_delay = 1, |
diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c index fca51105974e..2e0450bec1b1 100644 --- a/drivers/usb/usbip/vhci_hcd.c +++ b/drivers/usb/usbip/vhci_hcd.c | |||
| @@ -941,7 +941,7 @@ static void vhci_stop(struct usb_hcd *hcd) | |||
| 941 | 941 | ||
| 942 | static int vhci_get_frame_number(struct usb_hcd *hcd) | 942 | static int vhci_get_frame_number(struct usb_hcd *hcd) |
| 943 | { | 943 | { |
| 944 | pr_err("Not yet implemented\n"); | 944 | dev_err_ratelimited(&hcd->self.root_hub->dev, "Not yet implemented\n"); |
| 945 | return 0; | 945 | return 0; |
| 946 | } | 946 | } |
| 947 | 947 | ||
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index b54f26c55dfd..b4b3e256491b 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
| @@ -746,7 +746,7 @@ config ALIM7101_WDT | |||
| 746 | 746 | ||
| 747 | config EBC_C384_WDT | 747 | config EBC_C384_WDT |
| 748 | tristate "WinSystems EBC-C384 Watchdog Timer" | 748 | tristate "WinSystems EBC-C384 Watchdog Timer" |
| 749 | depends on X86 && ISA | 749 | depends on X86 && ISA_BUS_API |
| 750 | select WATCHDOG_CORE | 750 | select WATCHDOG_CORE |
| 751 | help | 751 | help |
| 752 | Enables watchdog timer support for the watchdog timer on the | 752 | Enables watchdog timer support for the watchdog timer on the |
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index b677a6ea6001..7706c8dc5fa6 100644 --- a/fs/btrfs/check-integrity.c +++ b/fs/btrfs/check-integrity.c | |||
| @@ -2645,7 +2645,7 @@ static void btrfsic_dump_tree_sub(const struct btrfsic_state *state, | |||
| 2645 | * This algorithm is recursive because the amount of used stack space | 2645 | * This algorithm is recursive because the amount of used stack space |
| 2646 | * is very small and the max recursion depth is limited. | 2646 | * is very small and the max recursion depth is limited. |
| 2647 | */ | 2647 | */ |
| 2648 | indent_add = sprintf(buf, "%c-%llu(%s/%llu/%d)", | 2648 | indent_add = sprintf(buf, "%c-%llu(%s/%llu/%u)", |
| 2649 | btrfsic_get_block_type(state, block), | 2649 | btrfsic_get_block_type(state, block), |
| 2650 | block->logical_bytenr, block->dev_state->name, | 2650 | block->logical_bytenr, block->dev_state->name, |
| 2651 | block->dev_bytenr, block->mirror_num); | 2651 | block->dev_bytenr, block->mirror_num); |
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 46025688f1d0..6276add8538a 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
| @@ -1554,6 +1554,7 @@ noinline int btrfs_cow_block(struct btrfs_trans_handle *trans, | |||
| 1554 | trans->transid, root->fs_info->generation); | 1554 | trans->transid, root->fs_info->generation); |
| 1555 | 1555 | ||
| 1556 | if (!should_cow_block(trans, root, buf)) { | 1556 | if (!should_cow_block(trans, root, buf)) { |
| 1557 | trans->dirty = true; | ||
| 1557 | *cow_ret = buf; | 1558 | *cow_ret = buf; |
| 1558 | return 0; | 1559 | return 0; |
| 1559 | } | 1560 | } |
| @@ -2512,6 +2513,8 @@ read_block_for_search(struct btrfs_trans_handle *trans, | |||
| 2512 | if (!btrfs_buffer_uptodate(tmp, 0, 0)) | 2513 | if (!btrfs_buffer_uptodate(tmp, 0, 0)) |
| 2513 | ret = -EIO; | 2514 | ret = -EIO; |
| 2514 | free_extent_buffer(tmp); | 2515 | free_extent_buffer(tmp); |
| 2516 | } else { | ||
| 2517 | ret = PTR_ERR(tmp); | ||
| 2515 | } | 2518 | } |
| 2516 | return ret; | 2519 | return ret; |
| 2517 | } | 2520 | } |
| @@ -2775,8 +2778,10 @@ again: | |||
| 2775 | * then we don't want to set the path blocking, | 2778 | * then we don't want to set the path blocking, |
| 2776 | * so we test it here | 2779 | * so we test it here |
| 2777 | */ | 2780 | */ |
| 2778 | if (!should_cow_block(trans, root, b)) | 2781 | if (!should_cow_block(trans, root, b)) { |
| 2782 | trans->dirty = true; | ||
| 2779 | goto cow_done; | 2783 | goto cow_done; |
| 2784 | } | ||
| 2780 | 2785 | ||
| 2781 | /* | 2786 | /* |
| 2782 | * must have write locks on this node and the | 2787 | * must have write locks on this node and the |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 1142127f6e5e..54cca7a1572b 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -1098,7 +1098,7 @@ void readahead_tree_block(struct btrfs_root *root, u64 bytenr) | |||
| 1098 | struct inode *btree_inode = root->fs_info->btree_inode; | 1098 | struct inode *btree_inode = root->fs_info->btree_inode; |
| 1099 | 1099 | ||
| 1100 | buf = btrfs_find_create_tree_block(root, bytenr); | 1100 | buf = btrfs_find_create_tree_block(root, bytenr); |
| 1101 | if (!buf) | 1101 | if (IS_ERR(buf)) |
| 1102 | return; | 1102 | return; |
| 1103 | read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, | 1103 | read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, |
| 1104 | buf, 0, WAIT_NONE, btree_get_extent, 0); | 1104 | buf, 0, WAIT_NONE, btree_get_extent, 0); |
| @@ -1114,7 +1114,7 @@ int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, | |||
| 1114 | int ret; | 1114 | int ret; |
| 1115 | 1115 | ||
| 1116 | buf = btrfs_find_create_tree_block(root, bytenr); | 1116 | buf = btrfs_find_create_tree_block(root, bytenr); |
| 1117 | if (!buf) | 1117 | if (IS_ERR(buf)) |
| 1118 | return 0; | 1118 | return 0; |
| 1119 | 1119 | ||
| 1120 | set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags); | 1120 | set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags); |
| @@ -1172,8 +1172,8 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr, | |||
| 1172 | int ret; | 1172 | int ret; |
| 1173 | 1173 | ||
| 1174 | buf = btrfs_find_create_tree_block(root, bytenr); | 1174 | buf = btrfs_find_create_tree_block(root, bytenr); |
| 1175 | if (!buf) | 1175 | if (IS_ERR(buf)) |
| 1176 | return ERR_PTR(-ENOMEM); | 1176 | return buf; |
| 1177 | 1177 | ||
| 1178 | ret = btree_read_extent_buffer_pages(root, buf, 0, parent_transid); | 1178 | ret = btree_read_extent_buffer_pages(root, buf, 0, parent_transid); |
| 1179 | if (ret) { | 1179 | if (ret) { |
| @@ -1806,6 +1806,13 @@ static int cleaner_kthread(void *arg) | |||
| 1806 | if (btrfs_need_cleaner_sleep(root)) | 1806 | if (btrfs_need_cleaner_sleep(root)) |
| 1807 | goto sleep; | 1807 | goto sleep; |
| 1808 | 1808 | ||
| 1809 | /* | ||
| 1810 | * Do not do anything if we might cause open_ctree() to block | ||
| 1811 | * before we have finished mounting the filesystem. | ||
| 1812 | */ | ||
| 1813 | if (!root->fs_info->open) | ||
| 1814 | goto sleep; | ||
| 1815 | |||
| 1809 | if (!mutex_trylock(&root->fs_info->cleaner_mutex)) | 1816 | if (!mutex_trylock(&root->fs_info->cleaner_mutex)) |
| 1810 | goto sleep; | 1817 | goto sleep; |
| 1811 | 1818 | ||
| @@ -2520,7 +2527,6 @@ int open_ctree(struct super_block *sb, | |||
| 2520 | int num_backups_tried = 0; | 2527 | int num_backups_tried = 0; |
| 2521 | int backup_index = 0; | 2528 | int backup_index = 0; |
| 2522 | int max_active; | 2529 | int max_active; |
| 2523 | bool cleaner_mutex_locked = false; | ||
| 2524 | 2530 | ||
| 2525 | tree_root = fs_info->tree_root = btrfs_alloc_root(fs_info, GFP_KERNEL); | 2531 | tree_root = fs_info->tree_root = btrfs_alloc_root(fs_info, GFP_KERNEL); |
| 2526 | chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info, GFP_KERNEL); | 2532 | chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info, GFP_KERNEL); |
| @@ -2999,13 +3005,6 @@ retry_root_backup: | |||
| 2999 | goto fail_sysfs; | 3005 | goto fail_sysfs; |
| 3000 | } | 3006 | } |
| 3001 | 3007 | ||
| 3002 | /* | ||
| 3003 | * Hold the cleaner_mutex thread here so that we don't block | ||
| 3004 | * for a long time on btrfs_recover_relocation. cleaner_kthread | ||
| 3005 | * will wait for us to finish mounting the filesystem. | ||
| 3006 | */ | ||
| 3007 | mutex_lock(&fs_info->cleaner_mutex); | ||
| 3008 | cleaner_mutex_locked = true; | ||
| 3009 | fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root, | 3008 | fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root, |
| 3010 | "btrfs-cleaner"); | 3009 | "btrfs-cleaner"); |
| 3011 | if (IS_ERR(fs_info->cleaner_kthread)) | 3010 | if (IS_ERR(fs_info->cleaner_kthread)) |
| @@ -3065,8 +3064,10 @@ retry_root_backup: | |||
| 3065 | ret = btrfs_cleanup_fs_roots(fs_info); | 3064 | ret = btrfs_cleanup_fs_roots(fs_info); |
| 3066 | if (ret) | 3065 | if (ret) |
| 3067 | goto fail_qgroup; | 3066 | goto fail_qgroup; |
| 3068 | /* We locked cleaner_mutex before creating cleaner_kthread. */ | 3067 | |
| 3068 | mutex_lock(&fs_info->cleaner_mutex); | ||
| 3069 | ret = btrfs_recover_relocation(tree_root); | 3069 | ret = btrfs_recover_relocation(tree_root); |
| 3070 | mutex_unlock(&fs_info->cleaner_mutex); | ||
| 3070 | if (ret < 0) { | 3071 | if (ret < 0) { |
| 3071 | btrfs_warn(fs_info, "failed to recover relocation: %d", | 3072 | btrfs_warn(fs_info, "failed to recover relocation: %d", |
| 3072 | ret); | 3073 | ret); |
| @@ -3074,8 +3075,6 @@ retry_root_backup: | |||
| 3074 | goto fail_qgroup; | 3075 | goto fail_qgroup; |
| 3075 | } | 3076 | } |
| 3076 | } | 3077 | } |
| 3077 | mutex_unlock(&fs_info->cleaner_mutex); | ||
| 3078 | cleaner_mutex_locked = false; | ||
| 3079 | 3078 | ||
| 3080 | location.objectid = BTRFS_FS_TREE_OBJECTID; | 3079 | location.objectid = BTRFS_FS_TREE_OBJECTID; |
| 3081 | location.type = BTRFS_ROOT_ITEM_KEY; | 3080 | location.type = BTRFS_ROOT_ITEM_KEY; |
| @@ -3189,10 +3188,6 @@ fail_cleaner: | |||
| 3189 | filemap_write_and_wait(fs_info->btree_inode->i_mapping); | 3188 | filemap_write_and_wait(fs_info->btree_inode->i_mapping); |
| 3190 | 3189 | ||
| 3191 | fail_sysfs: | 3190 | fail_sysfs: |
| 3192 | if (cleaner_mutex_locked) { | ||
| 3193 | mutex_unlock(&fs_info->cleaner_mutex); | ||
| 3194 | cleaner_mutex_locked = false; | ||
| 3195 | } | ||
| 3196 | btrfs_sysfs_remove_mounted(fs_info); | 3191 | btrfs_sysfs_remove_mounted(fs_info); |
| 3197 | 3192 | ||
| 3198 | fail_fsdev_sysfs: | 3193 | fail_fsdev_sysfs: |
| @@ -4139,7 +4134,8 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info, | |||
| 4139 | ret = -EINVAL; | 4134 | ret = -EINVAL; |
| 4140 | } | 4135 | } |
| 4141 | if (!is_power_of_2(btrfs_super_stripesize(sb)) || | 4136 | if (!is_power_of_2(btrfs_super_stripesize(sb)) || |
| 4142 | btrfs_super_stripesize(sb) != sectorsize) { | 4137 | ((btrfs_super_stripesize(sb) != sectorsize) && |
| 4138 | (btrfs_super_stripesize(sb) != 4096))) { | ||
| 4143 | btrfs_err(fs_info, "invalid stripesize %u", | 4139 | btrfs_err(fs_info, "invalid stripesize %u", |
| 4144 | btrfs_super_stripesize(sb)); | 4140 | btrfs_super_stripesize(sb)); |
| 4145 | ret = -EINVAL; | 4141 | ret = -EINVAL; |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 689d25ac6a68..29e5d000bbee 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -8016,8 +8016,9 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root, | |||
| 8016 | struct extent_buffer *buf; | 8016 | struct extent_buffer *buf; |
| 8017 | 8017 | ||
| 8018 | buf = btrfs_find_create_tree_block(root, bytenr); | 8018 | buf = btrfs_find_create_tree_block(root, bytenr); |
| 8019 | if (!buf) | 8019 | if (IS_ERR(buf)) |
| 8020 | return ERR_PTR(-ENOMEM); | 8020 | return buf; |
| 8021 | |||
| 8021 | btrfs_set_header_generation(buf, trans->transid); | 8022 | btrfs_set_header_generation(buf, trans->transid); |
| 8022 | btrfs_set_buffer_lockdep_class(root->root_key.objectid, buf, level); | 8023 | btrfs_set_buffer_lockdep_class(root->root_key.objectid, buf, level); |
| 8023 | btrfs_tree_lock(buf); | 8024 | btrfs_tree_lock(buf); |
| @@ -8044,7 +8045,7 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root, | |||
| 8044 | set_extent_dirty(&trans->transaction->dirty_pages, buf->start, | 8045 | set_extent_dirty(&trans->transaction->dirty_pages, buf->start, |
| 8045 | buf->start + buf->len - 1, GFP_NOFS); | 8046 | buf->start + buf->len - 1, GFP_NOFS); |
| 8046 | } | 8047 | } |
| 8047 | trans->blocks_used++; | 8048 | trans->dirty = true; |
| 8048 | /* this returns a buffer locked for blocking */ | 8049 | /* this returns a buffer locked for blocking */ |
| 8049 | return buf; | 8050 | return buf; |
| 8050 | } | 8051 | } |
| @@ -8659,8 +8660,9 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans, | |||
| 8659 | next = btrfs_find_tree_block(root->fs_info, bytenr); | 8660 | next = btrfs_find_tree_block(root->fs_info, bytenr); |
| 8660 | if (!next) { | 8661 | if (!next) { |
| 8661 | next = btrfs_find_create_tree_block(root, bytenr); | 8662 | next = btrfs_find_create_tree_block(root, bytenr); |
| 8662 | if (!next) | 8663 | if (IS_ERR(next)) |
| 8663 | return -ENOMEM; | 8664 | return PTR_ERR(next); |
| 8665 | |||
| 8664 | btrfs_set_buffer_lockdep_class(root->root_key.objectid, next, | 8666 | btrfs_set_buffer_lockdep_class(root->root_key.objectid, next, |
| 8665 | level - 1); | 8667 | level - 1); |
| 8666 | reada = 1; | 8668 | reada = 1; |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index a3412d68ad37..aaee3ef55ed8 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
| @@ -4892,18 +4892,25 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info, | |||
| 4892 | int uptodate = 1; | 4892 | int uptodate = 1; |
| 4893 | int ret; | 4893 | int ret; |
| 4894 | 4894 | ||
| 4895 | if (!IS_ALIGNED(start, fs_info->tree_root->sectorsize)) { | ||
| 4896 | btrfs_err(fs_info, "bad tree block start %llu", start); | ||
| 4897 | return ERR_PTR(-EINVAL); | ||
| 4898 | } | ||
| 4899 | |||
| 4895 | eb = find_extent_buffer(fs_info, start); | 4900 | eb = find_extent_buffer(fs_info, start); |
| 4896 | if (eb) | 4901 | if (eb) |
| 4897 | return eb; | 4902 | return eb; |
| 4898 | 4903 | ||
| 4899 | eb = __alloc_extent_buffer(fs_info, start, len); | 4904 | eb = __alloc_extent_buffer(fs_info, start, len); |
| 4900 | if (!eb) | 4905 | if (!eb) |
| 4901 | return NULL; | 4906 | return ERR_PTR(-ENOMEM); |
| 4902 | 4907 | ||
| 4903 | for (i = 0; i < num_pages; i++, index++) { | 4908 | for (i = 0; i < num_pages; i++, index++) { |
| 4904 | p = find_or_create_page(mapping, index, GFP_NOFS|__GFP_NOFAIL); | 4909 | p = find_or_create_page(mapping, index, GFP_NOFS|__GFP_NOFAIL); |
| 4905 | if (!p) | 4910 | if (!p) { |
| 4911 | exists = ERR_PTR(-ENOMEM); | ||
| 4906 | goto free_eb; | 4912 | goto free_eb; |
| 4913 | } | ||
| 4907 | 4914 | ||
| 4908 | spin_lock(&mapping->private_lock); | 4915 | spin_lock(&mapping->private_lock); |
| 4909 | if (PagePrivate(p)) { | 4916 | if (PagePrivate(p)) { |
| @@ -4948,8 +4955,10 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info, | |||
| 4948 | set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); | 4955 | set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); |
| 4949 | again: | 4956 | again: |
| 4950 | ret = radix_tree_preload(GFP_NOFS); | 4957 | ret = radix_tree_preload(GFP_NOFS); |
| 4951 | if (ret) | 4958 | if (ret) { |
| 4959 | exists = ERR_PTR(ret); | ||
| 4952 | goto free_eb; | 4960 | goto free_eb; |
| 4961 | } | ||
| 4953 | 4962 | ||
| 4954 | spin_lock(&fs_info->buffer_lock); | 4963 | spin_lock(&fs_info->buffer_lock); |
| 4955 | ret = radix_tree_insert(&fs_info->buffer_radix, | 4964 | ret = radix_tree_insert(&fs_info->buffer_radix, |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8b1212e8f7a8..d2be95cfb6d1 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -3271,7 +3271,16 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode) | |||
| 3271 | /* grab metadata reservation from transaction handle */ | 3271 | /* grab metadata reservation from transaction handle */ |
| 3272 | if (reserve) { | 3272 | if (reserve) { |
| 3273 | ret = btrfs_orphan_reserve_metadata(trans, inode); | 3273 | ret = btrfs_orphan_reserve_metadata(trans, inode); |
| 3274 | BUG_ON(ret); /* -ENOSPC in reservation; Logic error? JDM */ | 3274 | ASSERT(!ret); |
| 3275 | if (ret) { | ||
| 3276 | atomic_dec(&root->orphan_inodes); | ||
| 3277 | clear_bit(BTRFS_INODE_ORPHAN_META_RESERVED, | ||
| 3278 | &BTRFS_I(inode)->runtime_flags); | ||
| 3279 | if (insert) | ||
| 3280 | clear_bit(BTRFS_INODE_HAS_ORPHAN_ITEM, | ||
| 3281 | &BTRFS_I(inode)->runtime_flags); | ||
| 3282 | return ret; | ||
| 3283 | } | ||
| 3275 | } | 3284 | } |
| 3276 | 3285 | ||
| 3277 | /* insert an orphan item to track this unlinked/truncated file */ | 3286 | /* insert an orphan item to track this unlinked/truncated file */ |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 4339b6613f19..60e7179ed4b7 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
| @@ -235,7 +235,7 @@ void __btrfs_abort_transaction(struct btrfs_trans_handle *trans, | |||
| 235 | trans->aborted = errno; | 235 | trans->aborted = errno; |
| 236 | /* Nothing used. The other threads that have joined this | 236 | /* Nothing used. The other threads that have joined this |
| 237 | * transaction may be able to continue. */ | 237 | * transaction may be able to continue. */ |
| 238 | if (!trans->blocks_used && list_empty(&trans->new_bgs)) { | 238 | if (!trans->dirty && list_empty(&trans->new_bgs)) { |
| 239 | const char *errstr; | 239 | const char *errstr; |
| 240 | 240 | ||
| 241 | errstr = btrfs_decode_error(errno); | 241 | errstr = btrfs_decode_error(errno); |
| @@ -1807,6 +1807,8 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | |||
| 1807 | } | 1807 | } |
| 1808 | } | 1808 | } |
| 1809 | sb->s_flags &= ~MS_RDONLY; | 1809 | sb->s_flags &= ~MS_RDONLY; |
| 1810 | |||
| 1811 | fs_info->open = 1; | ||
| 1810 | } | 1812 | } |
| 1811 | out: | 1813 | out: |
| 1812 | wake_up_process(fs_info->transaction_kthread); | 1814 | wake_up_process(fs_info->transaction_kthread); |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index f6e24cb423ae..765845742fde 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
| @@ -1311,11 +1311,6 @@ int btrfs_defrag_root(struct btrfs_root *root) | |||
| 1311 | return ret; | 1311 | return ret; |
| 1312 | } | 1312 | } |
| 1313 | 1313 | ||
| 1314 | /* Bisesctability fixup, remove in 4.8 */ | ||
| 1315 | #ifndef btrfs_std_error | ||
| 1316 | #define btrfs_std_error btrfs_handle_fs_error | ||
| 1317 | #endif | ||
| 1318 | |||
| 1319 | /* | 1314 | /* |
| 1320 | * Do all special snapshot related qgroup dirty hack. | 1315 | * Do all special snapshot related qgroup dirty hack. |
| 1321 | * | 1316 | * |
| @@ -1385,7 +1380,7 @@ static int qgroup_account_snapshot(struct btrfs_trans_handle *trans, | |||
| 1385 | switch_commit_roots(trans->transaction, fs_info); | 1380 | switch_commit_roots(trans->transaction, fs_info); |
| 1386 | ret = btrfs_write_and_wait_transaction(trans, src); | 1381 | ret = btrfs_write_and_wait_transaction(trans, src); |
| 1387 | if (ret) | 1382 | if (ret) |
| 1388 | btrfs_std_error(fs_info, ret, | 1383 | btrfs_handle_fs_error(fs_info, ret, |
| 1389 | "Error while writing out transaction for qgroup"); | 1384 | "Error while writing out transaction for qgroup"); |
| 1390 | 1385 | ||
| 1391 | out: | 1386 | out: |
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h index 9fe0ec2bf0fe..c5abee4f01ad 100644 --- a/fs/btrfs/transaction.h +++ b/fs/btrfs/transaction.h | |||
| @@ -110,7 +110,6 @@ struct btrfs_trans_handle { | |||
| 110 | u64 chunk_bytes_reserved; | 110 | u64 chunk_bytes_reserved; |
| 111 | unsigned long use_count; | 111 | unsigned long use_count; |
| 112 | unsigned long blocks_reserved; | 112 | unsigned long blocks_reserved; |
| 113 | unsigned long blocks_used; | ||
| 114 | unsigned long delayed_ref_updates; | 113 | unsigned long delayed_ref_updates; |
| 115 | struct btrfs_transaction *transaction; | 114 | struct btrfs_transaction *transaction; |
| 116 | struct btrfs_block_rsv *block_rsv; | 115 | struct btrfs_block_rsv *block_rsv; |
| @@ -121,6 +120,7 @@ struct btrfs_trans_handle { | |||
| 121 | bool can_flush_pending_bgs; | 120 | bool can_flush_pending_bgs; |
| 122 | bool reloc_reserved; | 121 | bool reloc_reserved; |
| 123 | bool sync; | 122 | bool sync; |
| 123 | bool dirty; | ||
| 124 | unsigned int type; | 124 | unsigned int type; |
| 125 | /* | 125 | /* |
| 126 | * this root is only needed to validate that the root passed to | 126 | * this root is only needed to validate that the root passed to |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index b7665af471d8..c05f69a8ec42 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
| @@ -2422,8 +2422,8 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans, | |||
| 2422 | root_owner = btrfs_header_owner(parent); | 2422 | root_owner = btrfs_header_owner(parent); |
| 2423 | 2423 | ||
| 2424 | next = btrfs_find_create_tree_block(root, bytenr); | 2424 | next = btrfs_find_create_tree_block(root, bytenr); |
| 2425 | if (!next) | 2425 | if (IS_ERR(next)) |
| 2426 | return -ENOMEM; | 2426 | return PTR_ERR(next); |
| 2427 | 2427 | ||
| 2428 | if (*level == 1) { | 2428 | if (*level == 1) { |
| 2429 | ret = wc->process_func(root, next, wc, ptr_gen); | 2429 | ret = wc->process_func(root, next, wc, ptr_gen); |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 548faaa9e169..2f631b58ae00 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -6607,8 +6607,8 @@ int btrfs_read_sys_array(struct btrfs_root *root) | |||
| 6607 | * overallocate but we can keep it as-is, only the first page is used. | 6607 | * overallocate but we can keep it as-is, only the first page is used. |
| 6608 | */ | 6608 | */ |
| 6609 | sb = btrfs_find_create_tree_block(root, BTRFS_SUPER_INFO_OFFSET); | 6609 | sb = btrfs_find_create_tree_block(root, BTRFS_SUPER_INFO_OFFSET); |
| 6610 | if (!sb) | 6610 | if (IS_ERR(sb)) |
| 6611 | return -ENOMEM; | 6611 | return PTR_ERR(sb); |
| 6612 | set_extent_buffer_uptodate(sb); | 6612 | set_extent_buffer_uptodate(sb); |
| 6613 | btrfs_set_buffer_lockdep_class(root->root_key.objectid, sb, 0); | 6613 | btrfs_set_buffer_lockdep_class(root->root_key.objectid, sb, 0); |
| 6614 | /* | 6614 | /* |
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 9c1c9a01b7e5..592059f88e04 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
| @@ -127,7 +127,6 @@ static int open_proxy_open(struct inode *inode, struct file *filp) | |||
| 127 | r = real_fops->open(inode, filp); | 127 | r = real_fops->open(inode, filp); |
| 128 | 128 | ||
| 129 | out: | 129 | out: |
| 130 | fops_put(real_fops); | ||
| 131 | debugfs_use_file_finish(srcu_idx); | 130 | debugfs_use_file_finish(srcu_idx); |
| 132 | return r; | 131 | return r; |
| 133 | } | 132 | } |
| @@ -262,8 +261,10 @@ static int full_proxy_open(struct inode *inode, struct file *filp) | |||
| 262 | 261 | ||
| 263 | if (real_fops->open) { | 262 | if (real_fops->open) { |
| 264 | r = real_fops->open(inode, filp); | 263 | r = real_fops->open(inode, filp); |
| 265 | 264 | if (r) { | |
| 266 | if (filp->f_op != proxy_fops) { | 265 | replace_fops(filp, d_inode(dentry)->i_fop); |
| 266 | goto free_proxy; | ||
| 267 | } else if (filp->f_op != proxy_fops) { | ||
| 267 | /* No protection against file removal anymore. */ | 268 | /* No protection against file removal anymore. */ |
| 268 | WARN(1, "debugfs file owner replaced proxy fops: %pd", | 269 | WARN(1, "debugfs file owner replaced proxy fops: %pd", |
| 269 | dentry); | 270 | dentry); |
diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c index e55b5242614d..31f3df193bdb 100644 --- a/fs/nfsd/blocklayout.c +++ b/fs/nfsd/blocklayout.c | |||
| @@ -290,7 +290,7 @@ out_free_buf: | |||
| 290 | return error; | 290 | return error; |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | #define NFSD_MDS_PR_KEY 0x0100000000000000 | 293 | #define NFSD_MDS_PR_KEY 0x0100000000000000ULL |
| 294 | 294 | ||
| 295 | /* | 295 | /* |
| 296 | * We use the client ID as a unique key for the reservations. | 296 | * We use the client ID as a unique key for the reservations. |
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 7389cb1d7409..04c68d900324 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
| @@ -710,22 +710,6 @@ static struct rpc_cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc | |||
| 710 | } | 710 | } |
| 711 | } | 711 | } |
| 712 | 712 | ||
| 713 | static struct rpc_clnt *create_backchannel_client(struct rpc_create_args *args) | ||
| 714 | { | ||
| 715 | struct rpc_xprt *xprt; | ||
| 716 | |||
| 717 | if (args->protocol != XPRT_TRANSPORT_BC_TCP) | ||
| 718 | return rpc_create(args); | ||
| 719 | |||
| 720 | xprt = args->bc_xprt->xpt_bc_xprt; | ||
| 721 | if (xprt) { | ||
| 722 | xprt_get(xprt); | ||
| 723 | return rpc_create_xprt(args, xprt); | ||
| 724 | } | ||
| 725 | |||
| 726 | return rpc_create(args); | ||
| 727 | } | ||
| 728 | |||
| 729 | static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *conn, struct nfsd4_session *ses) | 713 | static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *conn, struct nfsd4_session *ses) |
| 730 | { | 714 | { |
| 731 | int maxtime = max_cb_time(clp->net); | 715 | int maxtime = max_cb_time(clp->net); |
| @@ -768,7 +752,7 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c | |||
| 768 | args.authflavor = ses->se_cb_sec.flavor; | 752 | args.authflavor = ses->se_cb_sec.flavor; |
| 769 | } | 753 | } |
| 770 | /* Create RPC client */ | 754 | /* Create RPC client */ |
| 771 | client = create_backchannel_client(&args); | 755 | client = rpc_create(&args); |
| 772 | if (IS_ERR(client)) { | 756 | if (IS_ERR(client)) { |
| 773 | dprintk("NFSD: couldn't create callback client: %ld\n", | 757 | dprintk("NFSD: couldn't create callback client: %ld\n", |
| 774 | PTR_ERR(client)); | 758 | PTR_ERR(client)); |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index f5f82e145018..70d0b9b33031 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -3480,12 +3480,17 @@ alloc_init_open_stateowner(unsigned int strhashval, struct nfsd4_open *open, | |||
| 3480 | } | 3480 | } |
| 3481 | 3481 | ||
| 3482 | static struct nfs4_ol_stateid * | 3482 | static struct nfs4_ol_stateid * |
| 3483 | init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp, | 3483 | init_open_stateid(struct nfs4_file *fp, struct nfsd4_open *open) |
| 3484 | struct nfsd4_open *open) | ||
| 3485 | { | 3484 | { |
| 3486 | 3485 | ||
| 3487 | struct nfs4_openowner *oo = open->op_openowner; | 3486 | struct nfs4_openowner *oo = open->op_openowner; |
| 3488 | struct nfs4_ol_stateid *retstp = NULL; | 3487 | struct nfs4_ol_stateid *retstp = NULL; |
| 3488 | struct nfs4_ol_stateid *stp; | ||
| 3489 | |||
| 3490 | stp = open->op_stp; | ||
| 3491 | /* We are moving these outside of the spinlocks to avoid the warnings */ | ||
| 3492 | mutex_init(&stp->st_mutex); | ||
| 3493 | mutex_lock(&stp->st_mutex); | ||
| 3489 | 3494 | ||
| 3490 | spin_lock(&oo->oo_owner.so_client->cl_lock); | 3495 | spin_lock(&oo->oo_owner.so_client->cl_lock); |
| 3491 | spin_lock(&fp->fi_lock); | 3496 | spin_lock(&fp->fi_lock); |
| @@ -3493,6 +3498,8 @@ init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp, | |||
| 3493 | retstp = nfsd4_find_existing_open(fp, open); | 3498 | retstp = nfsd4_find_existing_open(fp, open); |
| 3494 | if (retstp) | 3499 | if (retstp) |
| 3495 | goto out_unlock; | 3500 | goto out_unlock; |
| 3501 | |||
| 3502 | open->op_stp = NULL; | ||
| 3496 | atomic_inc(&stp->st_stid.sc_count); | 3503 | atomic_inc(&stp->st_stid.sc_count); |
| 3497 | stp->st_stid.sc_type = NFS4_OPEN_STID; | 3504 | stp->st_stid.sc_type = NFS4_OPEN_STID; |
| 3498 | INIT_LIST_HEAD(&stp->st_locks); | 3505 | INIT_LIST_HEAD(&stp->st_locks); |
| @@ -3502,14 +3509,19 @@ init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp, | |||
| 3502 | stp->st_access_bmap = 0; | 3509 | stp->st_access_bmap = 0; |
| 3503 | stp->st_deny_bmap = 0; | 3510 | stp->st_deny_bmap = 0; |
| 3504 | stp->st_openstp = NULL; | 3511 | stp->st_openstp = NULL; |
| 3505 | init_rwsem(&stp->st_rwsem); | ||
| 3506 | list_add(&stp->st_perstateowner, &oo->oo_owner.so_stateids); | 3512 | list_add(&stp->st_perstateowner, &oo->oo_owner.so_stateids); |
| 3507 | list_add(&stp->st_perfile, &fp->fi_stateids); | 3513 | list_add(&stp->st_perfile, &fp->fi_stateids); |
| 3508 | 3514 | ||
| 3509 | out_unlock: | 3515 | out_unlock: |
| 3510 | spin_unlock(&fp->fi_lock); | 3516 | spin_unlock(&fp->fi_lock); |
| 3511 | spin_unlock(&oo->oo_owner.so_client->cl_lock); | 3517 | spin_unlock(&oo->oo_owner.so_client->cl_lock); |
| 3512 | return retstp; | 3518 | if (retstp) { |
| 3519 | mutex_lock(&retstp->st_mutex); | ||
| 3520 | /* To keep mutex tracking happy */ | ||
| 3521 | mutex_unlock(&stp->st_mutex); | ||
| 3522 | stp = retstp; | ||
| 3523 | } | ||
| 3524 | return stp; | ||
| 3513 | } | 3525 | } |
| 3514 | 3526 | ||
| 3515 | /* | 3527 | /* |
| @@ -4305,7 +4317,6 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf | |||
| 4305 | struct nfs4_client *cl = open->op_openowner->oo_owner.so_client; | 4317 | struct nfs4_client *cl = open->op_openowner->oo_owner.so_client; |
| 4306 | struct nfs4_file *fp = NULL; | 4318 | struct nfs4_file *fp = NULL; |
| 4307 | struct nfs4_ol_stateid *stp = NULL; | 4319 | struct nfs4_ol_stateid *stp = NULL; |
| 4308 | struct nfs4_ol_stateid *swapstp = NULL; | ||
| 4309 | struct nfs4_delegation *dp = NULL; | 4320 | struct nfs4_delegation *dp = NULL; |
| 4310 | __be32 status; | 4321 | __be32 status; |
| 4311 | 4322 | ||
| @@ -4335,32 +4346,28 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf | |||
| 4335 | */ | 4346 | */ |
| 4336 | if (stp) { | 4347 | if (stp) { |
| 4337 | /* Stateid was found, this is an OPEN upgrade */ | 4348 | /* Stateid was found, this is an OPEN upgrade */ |
| 4338 | down_read(&stp->st_rwsem); | 4349 | mutex_lock(&stp->st_mutex); |
| 4339 | status = nfs4_upgrade_open(rqstp, fp, current_fh, stp, open); | 4350 | status = nfs4_upgrade_open(rqstp, fp, current_fh, stp, open); |
| 4340 | if (status) { | 4351 | if (status) { |
| 4341 | up_read(&stp->st_rwsem); | 4352 | mutex_unlock(&stp->st_mutex); |
| 4342 | goto out; | 4353 | goto out; |
| 4343 | } | 4354 | } |
| 4344 | } else { | 4355 | } else { |
| 4345 | stp = open->op_stp; | 4356 | /* stp is returned locked. */ |
| 4346 | open->op_stp = NULL; | 4357 | stp = init_open_stateid(fp, open); |
| 4347 | swapstp = init_open_stateid(stp, fp, open); | 4358 | /* See if we lost the race to some other thread */ |
| 4348 | if (swapstp) { | 4359 | if (stp->st_access_bmap != 0) { |
| 4349 | nfs4_put_stid(&stp->st_stid); | ||
| 4350 | stp = swapstp; | ||
| 4351 | down_read(&stp->st_rwsem); | ||
| 4352 | status = nfs4_upgrade_open(rqstp, fp, current_fh, | 4360 | status = nfs4_upgrade_open(rqstp, fp, current_fh, |
| 4353 | stp, open); | 4361 | stp, open); |
| 4354 | if (status) { | 4362 | if (status) { |
| 4355 | up_read(&stp->st_rwsem); | 4363 | mutex_unlock(&stp->st_mutex); |
| 4356 | goto out; | 4364 | goto out; |
| 4357 | } | 4365 | } |
| 4358 | goto upgrade_out; | 4366 | goto upgrade_out; |
| 4359 | } | 4367 | } |
| 4360 | down_read(&stp->st_rwsem); | ||
| 4361 | status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, open); | 4368 | status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, open); |
| 4362 | if (status) { | 4369 | if (status) { |
| 4363 | up_read(&stp->st_rwsem); | 4370 | mutex_unlock(&stp->st_mutex); |
| 4364 | release_open_stateid(stp); | 4371 | release_open_stateid(stp); |
| 4365 | goto out; | 4372 | goto out; |
| 4366 | } | 4373 | } |
| @@ -4372,7 +4379,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf | |||
| 4372 | } | 4379 | } |
| 4373 | upgrade_out: | 4380 | upgrade_out: |
| 4374 | nfs4_inc_and_copy_stateid(&open->op_stateid, &stp->st_stid); | 4381 | nfs4_inc_and_copy_stateid(&open->op_stateid, &stp->st_stid); |
| 4375 | up_read(&stp->st_rwsem); | 4382 | mutex_unlock(&stp->st_mutex); |
| 4376 | 4383 | ||
| 4377 | if (nfsd4_has_session(&resp->cstate)) { | 4384 | if (nfsd4_has_session(&resp->cstate)) { |
| 4378 | if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) { | 4385 | if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) { |
| @@ -4977,12 +4984,12 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_compound_state *cstate, stateid_ | |||
| 4977 | * revoked delegations are kept only for free_stateid. | 4984 | * revoked delegations are kept only for free_stateid. |
| 4978 | */ | 4985 | */ |
| 4979 | return nfserr_bad_stateid; | 4986 | return nfserr_bad_stateid; |
| 4980 | down_write(&stp->st_rwsem); | 4987 | mutex_lock(&stp->st_mutex); |
| 4981 | status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate)); | 4988 | status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate)); |
| 4982 | if (status == nfs_ok) | 4989 | if (status == nfs_ok) |
| 4983 | status = nfs4_check_fh(current_fh, &stp->st_stid); | 4990 | status = nfs4_check_fh(current_fh, &stp->st_stid); |
| 4984 | if (status != nfs_ok) | 4991 | if (status != nfs_ok) |
| 4985 | up_write(&stp->st_rwsem); | 4992 | mutex_unlock(&stp->st_mutex); |
| 4986 | return status; | 4993 | return status; |
| 4987 | } | 4994 | } |
| 4988 | 4995 | ||
| @@ -5030,7 +5037,7 @@ static __be32 nfs4_preprocess_confirmed_seqid_op(struct nfsd4_compound_state *cs | |||
| 5030 | return status; | 5037 | return status; |
| 5031 | oo = openowner(stp->st_stateowner); | 5038 | oo = openowner(stp->st_stateowner); |
| 5032 | if (!(oo->oo_flags & NFS4_OO_CONFIRMED)) { | 5039 | if (!(oo->oo_flags & NFS4_OO_CONFIRMED)) { |
| 5033 | up_write(&stp->st_rwsem); | 5040 | mutex_unlock(&stp->st_mutex); |
| 5034 | nfs4_put_stid(&stp->st_stid); | 5041 | nfs4_put_stid(&stp->st_stid); |
| 5035 | return nfserr_bad_stateid; | 5042 | return nfserr_bad_stateid; |
| 5036 | } | 5043 | } |
| @@ -5062,12 +5069,12 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 5062 | oo = openowner(stp->st_stateowner); | 5069 | oo = openowner(stp->st_stateowner); |
| 5063 | status = nfserr_bad_stateid; | 5070 | status = nfserr_bad_stateid; |
| 5064 | if (oo->oo_flags & NFS4_OO_CONFIRMED) { | 5071 | if (oo->oo_flags & NFS4_OO_CONFIRMED) { |
| 5065 | up_write(&stp->st_rwsem); | 5072 | mutex_unlock(&stp->st_mutex); |
| 5066 | goto put_stateid; | 5073 | goto put_stateid; |
| 5067 | } | 5074 | } |
| 5068 | oo->oo_flags |= NFS4_OO_CONFIRMED; | 5075 | oo->oo_flags |= NFS4_OO_CONFIRMED; |
| 5069 | nfs4_inc_and_copy_stateid(&oc->oc_resp_stateid, &stp->st_stid); | 5076 | nfs4_inc_and_copy_stateid(&oc->oc_resp_stateid, &stp->st_stid); |
| 5070 | up_write(&stp->st_rwsem); | 5077 | mutex_unlock(&stp->st_mutex); |
| 5071 | dprintk("NFSD: %s: success, seqid=%d stateid=" STATEID_FMT "\n", | 5078 | dprintk("NFSD: %s: success, seqid=%d stateid=" STATEID_FMT "\n", |
| 5072 | __func__, oc->oc_seqid, STATEID_VAL(&stp->st_stid.sc_stateid)); | 5079 | __func__, oc->oc_seqid, STATEID_VAL(&stp->st_stid.sc_stateid)); |
| 5073 | 5080 | ||
| @@ -5143,7 +5150,7 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp, | |||
| 5143 | nfs4_inc_and_copy_stateid(&od->od_stateid, &stp->st_stid); | 5150 | nfs4_inc_and_copy_stateid(&od->od_stateid, &stp->st_stid); |
| 5144 | status = nfs_ok; | 5151 | status = nfs_ok; |
| 5145 | put_stateid: | 5152 | put_stateid: |
| 5146 | up_write(&stp->st_rwsem); | 5153 | mutex_unlock(&stp->st_mutex); |
| 5147 | nfs4_put_stid(&stp->st_stid); | 5154 | nfs4_put_stid(&stp->st_stid); |
| 5148 | out: | 5155 | out: |
| 5149 | nfsd4_bump_seqid(cstate, status); | 5156 | nfsd4_bump_seqid(cstate, status); |
| @@ -5196,7 +5203,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 5196 | if (status) | 5203 | if (status) |
| 5197 | goto out; | 5204 | goto out; |
| 5198 | nfs4_inc_and_copy_stateid(&close->cl_stateid, &stp->st_stid); | 5205 | nfs4_inc_and_copy_stateid(&close->cl_stateid, &stp->st_stid); |
| 5199 | up_write(&stp->st_rwsem); | 5206 | mutex_unlock(&stp->st_mutex); |
| 5200 | 5207 | ||
| 5201 | nfsd4_close_open_stateid(stp); | 5208 | nfsd4_close_open_stateid(stp); |
| 5202 | 5209 | ||
| @@ -5422,7 +5429,7 @@ init_lock_stateid(struct nfs4_ol_stateid *stp, struct nfs4_lockowner *lo, | |||
| 5422 | stp->st_access_bmap = 0; | 5429 | stp->st_access_bmap = 0; |
| 5423 | stp->st_deny_bmap = open_stp->st_deny_bmap; | 5430 | stp->st_deny_bmap = open_stp->st_deny_bmap; |
| 5424 | stp->st_openstp = open_stp; | 5431 | stp->st_openstp = open_stp; |
| 5425 | init_rwsem(&stp->st_rwsem); | 5432 | mutex_init(&stp->st_mutex); |
| 5426 | list_add(&stp->st_locks, &open_stp->st_locks); | 5433 | list_add(&stp->st_locks, &open_stp->st_locks); |
| 5427 | list_add(&stp->st_perstateowner, &lo->lo_owner.so_stateids); | 5434 | list_add(&stp->st_perstateowner, &lo->lo_owner.so_stateids); |
| 5428 | spin_lock(&fp->fi_lock); | 5435 | spin_lock(&fp->fi_lock); |
| @@ -5591,7 +5598,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 5591 | &open_stp, nn); | 5598 | &open_stp, nn); |
| 5592 | if (status) | 5599 | if (status) |
| 5593 | goto out; | 5600 | goto out; |
| 5594 | up_write(&open_stp->st_rwsem); | 5601 | mutex_unlock(&open_stp->st_mutex); |
| 5595 | open_sop = openowner(open_stp->st_stateowner); | 5602 | open_sop = openowner(open_stp->st_stateowner); |
| 5596 | status = nfserr_bad_stateid; | 5603 | status = nfserr_bad_stateid; |
| 5597 | if (!same_clid(&open_sop->oo_owner.so_client->cl_clientid, | 5604 | if (!same_clid(&open_sop->oo_owner.so_client->cl_clientid, |
| @@ -5600,7 +5607,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 5600 | status = lookup_or_create_lock_state(cstate, open_stp, lock, | 5607 | status = lookup_or_create_lock_state(cstate, open_stp, lock, |
| 5601 | &lock_stp, &new); | 5608 | &lock_stp, &new); |
| 5602 | if (status == nfs_ok) | 5609 | if (status == nfs_ok) |
| 5603 | down_write(&lock_stp->st_rwsem); | 5610 | mutex_lock(&lock_stp->st_mutex); |
| 5604 | } else { | 5611 | } else { |
| 5605 | status = nfs4_preprocess_seqid_op(cstate, | 5612 | status = nfs4_preprocess_seqid_op(cstate, |
| 5606 | lock->lk_old_lock_seqid, | 5613 | lock->lk_old_lock_seqid, |
| @@ -5704,7 +5711,7 @@ out: | |||
| 5704 | seqid_mutating_err(ntohl(status))) | 5711 | seqid_mutating_err(ntohl(status))) |
| 5705 | lock_sop->lo_owner.so_seqid++; | 5712 | lock_sop->lo_owner.so_seqid++; |
| 5706 | 5713 | ||
| 5707 | up_write(&lock_stp->st_rwsem); | 5714 | mutex_unlock(&lock_stp->st_mutex); |
| 5708 | 5715 | ||
| 5709 | /* | 5716 | /* |
| 5710 | * If this is a new, never-before-used stateid, and we are | 5717 | * If this is a new, never-before-used stateid, and we are |
| @@ -5874,7 +5881,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 5874 | fput: | 5881 | fput: |
| 5875 | fput(filp); | 5882 | fput(filp); |
| 5876 | put_stateid: | 5883 | put_stateid: |
| 5877 | up_write(&stp->st_rwsem); | 5884 | mutex_unlock(&stp->st_mutex); |
| 5878 | nfs4_put_stid(&stp->st_stid); | 5885 | nfs4_put_stid(&stp->st_stid); |
| 5879 | out: | 5886 | out: |
| 5880 | nfsd4_bump_seqid(cstate, status); | 5887 | nfsd4_bump_seqid(cstate, status); |
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 986e51e5ceac..64053eadeb81 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h | |||
| @@ -535,7 +535,7 @@ struct nfs4_ol_stateid { | |||
| 535 | unsigned char st_access_bmap; | 535 | unsigned char st_access_bmap; |
| 536 | unsigned char st_deny_bmap; | 536 | unsigned char st_deny_bmap; |
| 537 | struct nfs4_ol_stateid *st_openstp; | 537 | struct nfs4_ol_stateid *st_openstp; |
| 538 | struct rw_semaphore st_rwsem; | 538 | struct mutex st_mutex; |
| 539 | }; | 539 | }; |
| 540 | 540 | ||
| 541 | static inline struct nfs4_ol_stateid *openlockstateid(struct nfs4_stid *s) | 541 | static inline struct nfs4_ol_stateid *openlockstateid(struct nfs4_stid *s) |
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index 22f0253a3567..c2a6b0894022 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c | |||
| @@ -405,12 +405,21 @@ static int ovl_create_or_link(struct dentry *dentry, int mode, dev_t rdev, | |||
| 405 | err = ovl_create_upper(dentry, inode, &stat, link, hardlink); | 405 | err = ovl_create_upper(dentry, inode, &stat, link, hardlink); |
| 406 | } else { | 406 | } else { |
| 407 | const struct cred *old_cred; | 407 | const struct cred *old_cred; |
| 408 | struct cred *override_cred; | ||
| 408 | 409 | ||
| 409 | old_cred = ovl_override_creds(dentry->d_sb); | 410 | old_cred = ovl_override_creds(dentry->d_sb); |
| 410 | 411 | ||
| 411 | err = ovl_create_over_whiteout(dentry, inode, &stat, link, | 412 | err = -ENOMEM; |
| 412 | hardlink); | 413 | override_cred = prepare_creds(); |
| 414 | if (override_cred) { | ||
| 415 | override_cred->fsuid = old_cred->fsuid; | ||
| 416 | override_cred->fsgid = old_cred->fsgid; | ||
| 417 | put_cred(override_creds(override_cred)); | ||
| 418 | put_cred(override_cred); | ||
| 413 | 419 | ||
| 420 | err = ovl_create_over_whiteout(dentry, inode, &stat, | ||
| 421 | link, hardlink); | ||
| 422 | } | ||
| 414 | revert_creds(old_cred); | 423 | revert_creds(old_cred); |
| 415 | } | 424 | } |
| 416 | 425 | ||
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index 0ed7c4012437..1dbeab6cf96e 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c | |||
| @@ -238,41 +238,27 @@ out: | |||
| 238 | return err; | 238 | return err; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | static bool ovl_need_xattr_filter(struct dentry *dentry, | ||
| 242 | enum ovl_path_type type) | ||
| 243 | { | ||
| 244 | if ((type & (__OVL_PATH_PURE | __OVL_PATH_UPPER)) == __OVL_PATH_UPPER) | ||
| 245 | return S_ISDIR(dentry->d_inode->i_mode); | ||
| 246 | else | ||
| 247 | return false; | ||
| 248 | } | ||
| 249 | |||
| 250 | ssize_t ovl_getxattr(struct dentry *dentry, struct inode *inode, | 241 | ssize_t ovl_getxattr(struct dentry *dentry, struct inode *inode, |
| 251 | const char *name, void *value, size_t size) | 242 | const char *name, void *value, size_t size) |
| 252 | { | 243 | { |
| 253 | struct path realpath; | 244 | struct dentry *realdentry = ovl_dentry_real(dentry); |
| 254 | enum ovl_path_type type = ovl_path_real(dentry, &realpath); | ||
| 255 | 245 | ||
| 256 | if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name)) | 246 | if (ovl_is_private_xattr(name)) |
| 257 | return -ENODATA; | 247 | return -ENODATA; |
| 258 | 248 | ||
| 259 | return vfs_getxattr(realpath.dentry, name, value, size); | 249 | return vfs_getxattr(realdentry, name, value, size); |
| 260 | } | 250 | } |
| 261 | 251 | ||
| 262 | ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size) | 252 | ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size) |
| 263 | { | 253 | { |
| 264 | struct path realpath; | 254 | struct dentry *realdentry = ovl_dentry_real(dentry); |
| 265 | enum ovl_path_type type = ovl_path_real(dentry, &realpath); | ||
| 266 | ssize_t res; | 255 | ssize_t res; |
| 267 | int off; | 256 | int off; |
| 268 | 257 | ||
| 269 | res = vfs_listxattr(realpath.dentry, list, size); | 258 | res = vfs_listxattr(realdentry, list, size); |
| 270 | if (res <= 0 || size == 0) | 259 | if (res <= 0 || size == 0) |
| 271 | return res; | 260 | return res; |
| 272 | 261 | ||
| 273 | if (!ovl_need_xattr_filter(dentry, type)) | ||
| 274 | return res; | ||
| 275 | |||
| 276 | /* filter out private xattrs */ | 262 | /* filter out private xattrs */ |
| 277 | for (off = 0; off < res;) { | 263 | for (off = 0; off < res;) { |
| 278 | char *s = list + off; | 264 | char *s = list + off; |
| @@ -302,7 +288,7 @@ int ovl_removexattr(struct dentry *dentry, const char *name) | |||
| 302 | goto out; | 288 | goto out; |
| 303 | 289 | ||
| 304 | err = -ENODATA; | 290 | err = -ENODATA; |
| 305 | if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name)) | 291 | if (ovl_is_private_xattr(name)) |
| 306 | goto out_drop_write; | 292 | goto out_drop_write; |
| 307 | 293 | ||
| 308 | if (!OVL_TYPE_UPPER(type)) { | 294 | if (!OVL_TYPE_UPPER(type)) { |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 484c8792da82..f28100f6b556 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
| @@ -575,5 +575,17 @@ static inline struct inode *vfs_select_inode(struct dentry *dentry, | |||
| 575 | return inode; | 575 | return inode; |
| 576 | } | 576 | } |
| 577 | 577 | ||
| 578 | /** | ||
| 579 | * d_real_inode - Return the real inode | ||
| 580 | * @dentry: The dentry to query | ||
| 581 | * | ||
| 582 | * If dentry is on an union/overlay, then return the underlying, real inode. | ||
| 583 | * Otherwise return d_inode(). | ||
| 584 | */ | ||
| 585 | static inline struct inode *d_real_inode(struct dentry *dentry) | ||
| 586 | { | ||
| 587 | return d_backing_inode(d_real(dentry)); | ||
| 588 | } | ||
| 589 | |||
| 578 | 590 | ||
| 579 | #endif /* __LINUX_DCACHE_H */ | 591 | #endif /* __LINUX_DCACHE_H */ |
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index d029ffac0d69..99403b19092f 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h | |||
| @@ -223,6 +223,8 @@ struct st_sensor_settings { | |||
| 223 | * @get_irq_data_ready: Function to get the IRQ used for data ready signal. | 223 | * @get_irq_data_ready: Function to get the IRQ used for data ready signal. |
| 224 | * @tf: Transfer function structure used by I/O operations. | 224 | * @tf: Transfer function structure used by I/O operations. |
| 225 | * @tb: Transfer buffers and mutex used by I/O operations. | 225 | * @tb: Transfer buffers and mutex used by I/O operations. |
| 226 | * @hw_irq_trigger: if we're using the hardware interrupt on the sensor. | ||
| 227 | * @hw_timestamp: Latest timestamp from the interrupt handler, when in use. | ||
| 226 | */ | 228 | */ |
| 227 | struct st_sensor_data { | 229 | struct st_sensor_data { |
| 228 | struct device *dev; | 230 | struct device *dev; |
| @@ -247,6 +249,9 @@ struct st_sensor_data { | |||
| 247 | 249 | ||
| 248 | const struct st_sensor_transfer_function *tf; | 250 | const struct st_sensor_transfer_function *tf; |
| 249 | struct st_sensor_transfer_buffer tb; | 251 | struct st_sensor_transfer_buffer tb; |
| 252 | |||
| 253 | bool hw_irq_trigger; | ||
| 254 | s64 hw_timestamp; | ||
| 250 | }; | 255 | }; |
| 251 | 256 | ||
| 252 | #ifdef CONFIG_IIO_BUFFER | 257 | #ifdef CONFIG_IIO_BUFFER |
| @@ -260,7 +265,8 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | |||
| 260 | const struct iio_trigger_ops *trigger_ops); | 265 | const struct iio_trigger_ops *trigger_ops); |
| 261 | 266 | ||
| 262 | void st_sensors_deallocate_trigger(struct iio_dev *indio_dev); | 267 | void st_sensors_deallocate_trigger(struct iio_dev *indio_dev); |
| 263 | 268 | int st_sensors_validate_device(struct iio_trigger *trig, | |
| 269 | struct iio_dev *indio_dev); | ||
| 264 | #else | 270 | #else |
| 265 | static inline int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | 271 | static inline int st_sensors_allocate_trigger(struct iio_dev *indio_dev, |
| 266 | const struct iio_trigger_ops *trigger_ops) | 272 | const struct iio_trigger_ops *trigger_ops) |
| @@ -271,6 +277,7 @@ static inline void st_sensors_deallocate_trigger(struct iio_dev *indio_dev) | |||
| 271 | { | 277 | { |
| 272 | return; | 278 | return; |
| 273 | } | 279 | } |
| 280 | #define st_sensors_validate_device NULL | ||
| 274 | #endif | 281 | #endif |
| 275 | 282 | ||
| 276 | int st_sensors_init_sensor(struct iio_dev *indio_dev, | 283 | int st_sensors_init_sensor(struct iio_dev *indio_dev, |
diff --git a/include/linux/isa.h b/include/linux/isa.h index 5ab85281230b..f2d0258414cf 100644 --- a/include/linux/isa.h +++ b/include/linux/isa.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #define __LINUX_ISA_H | 6 | #define __LINUX_ISA_H |
| 7 | 7 | ||
| 8 | #include <linux/device.h> | 8 | #include <linux/device.h> |
| 9 | #include <linux/errno.h> | ||
| 9 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
| 10 | 11 | ||
| 11 | struct isa_driver { | 12 | struct isa_driver { |
| @@ -22,13 +23,13 @@ struct isa_driver { | |||
| 22 | 23 | ||
| 23 | #define to_isa_driver(x) container_of((x), struct isa_driver, driver) | 24 | #define to_isa_driver(x) container_of((x), struct isa_driver, driver) |
| 24 | 25 | ||
| 25 | #ifdef CONFIG_ISA | 26 | #ifdef CONFIG_ISA_BUS_API |
| 26 | int isa_register_driver(struct isa_driver *, unsigned int); | 27 | int isa_register_driver(struct isa_driver *, unsigned int); |
| 27 | void isa_unregister_driver(struct isa_driver *); | 28 | void isa_unregister_driver(struct isa_driver *); |
| 28 | #else | 29 | #else |
| 29 | static inline int isa_register_driver(struct isa_driver *d, unsigned int i) | 30 | static inline int isa_register_driver(struct isa_driver *d, unsigned int i) |
| 30 | { | 31 | { |
| 31 | return 0; | 32 | return -ENODEV; |
| 32 | } | 33 | } |
| 33 | 34 | ||
| 34 | static inline void isa_unregister_driver(struct isa_driver *d) | 35 | static inline void isa_unregister_driver(struct isa_driver *d) |
diff --git a/include/linux/leds.h b/include/linux/leds.h index d2b13066e781..e5e7f2e80a54 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
| @@ -42,15 +42,16 @@ struct led_classdev { | |||
| 42 | #define LED_UNREGISTERING (1 << 1) | 42 | #define LED_UNREGISTERING (1 << 1) |
| 43 | /* Upper 16 bits reflect control information */ | 43 | /* Upper 16 bits reflect control information */ |
| 44 | #define LED_CORE_SUSPENDRESUME (1 << 16) | 44 | #define LED_CORE_SUSPENDRESUME (1 << 16) |
| 45 | #define LED_BLINK_ONESHOT (1 << 17) | 45 | #define LED_BLINK_SW (1 << 17) |
| 46 | #define LED_BLINK_ONESHOT_STOP (1 << 18) | 46 | #define LED_BLINK_ONESHOT (1 << 18) |
| 47 | #define LED_BLINK_INVERT (1 << 19) | 47 | #define LED_BLINK_ONESHOT_STOP (1 << 19) |
| 48 | #define LED_BLINK_BRIGHTNESS_CHANGE (1 << 20) | 48 | #define LED_BLINK_INVERT (1 << 20) |
| 49 | #define LED_BLINK_DISABLE (1 << 21) | 49 | #define LED_BLINK_BRIGHTNESS_CHANGE (1 << 21) |
| 50 | #define LED_SYSFS_DISABLE (1 << 22) | 50 | #define LED_BLINK_DISABLE (1 << 22) |
| 51 | #define LED_DEV_CAP_FLASH (1 << 23) | 51 | #define LED_SYSFS_DISABLE (1 << 23) |
| 52 | #define LED_HW_PLUGGABLE (1 << 24) | 52 | #define LED_DEV_CAP_FLASH (1 << 24) |
| 53 | #define LED_PANIC_INDICATOR (1 << 25) | 53 | #define LED_HW_PLUGGABLE (1 << 25) |
| 54 | #define LED_PANIC_INDICATOR (1 << 26) | ||
| 54 | 55 | ||
| 55 | /* Set LED brightness level | 56 | /* Set LED brightness level |
| 56 | * Must not sleep. Use brightness_set_blocking for drivers | 57 | * Must not sleep. Use brightness_set_blocking for drivers |
| @@ -72,8 +73,8 @@ struct led_classdev { | |||
| 72 | * and if both are zero then a sensible default should be chosen. | 73 | * and if both are zero then a sensible default should be chosen. |
| 73 | * The call should adjust the timings in that case and if it can't | 74 | * The call should adjust the timings in that case and if it can't |
| 74 | * match the values specified exactly. | 75 | * match the values specified exactly. |
| 75 | * Deactivate blinking again when the brightness is set to a fixed | 76 | * Deactivate blinking again when the brightness is set to LED_OFF |
| 76 | * value via the brightness_set() callback. | 77 | * via the brightness_set() callback. |
| 77 | */ | 78 | */ |
| 78 | int (*blink_set)(struct led_classdev *led_cdev, | 79 | int (*blink_set)(struct led_classdev *led_cdev, |
| 79 | unsigned long *delay_on, | 80 | unsigned long *delay_on, |
diff --git a/include/linux/pwm.h b/include/linux/pwm.h index 17018f3c066e..908b67c847cd 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h | |||
| @@ -235,6 +235,9 @@ static inline int pwm_config(struct pwm_device *pwm, int duty_ns, | |||
| 235 | if (!pwm) | 235 | if (!pwm) |
| 236 | return -EINVAL; | 236 | return -EINVAL; |
| 237 | 237 | ||
| 238 | if (duty_ns < 0 || period_ns < 0) | ||
| 239 | return -EINVAL; | ||
| 240 | |||
| 238 | pwm_get_state(pwm, &state); | 241 | pwm_get_state(pwm, &state); |
| 239 | if (state.duty_cycle == duty_ns && state.period == period_ns) | 242 | if (state.duty_cycle == duty_ns && state.period == period_ns) |
| 240 | return 0; | 243 | return 0; |
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 19c659d1c0f8..b6810c92b8bb 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
| @@ -137,8 +137,6 @@ struct rpc_create_args { | |||
| 137 | #define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9) | 137 | #define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9) |
| 138 | 138 | ||
| 139 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); | 139 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); |
| 140 | struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args, | ||
| 141 | struct rpc_xprt *xprt); | ||
| 142 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, | 140 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, |
| 143 | const struct rpc_program *, u32); | 141 | const struct rpc_program *, u32); |
| 144 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); | 142 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); |
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h index b7dabc4baafd..79ba50856707 100644 --- a/include/linux/sunrpc/svc_xprt.h +++ b/include/linux/sunrpc/svc_xprt.h | |||
| @@ -84,6 +84,7 @@ struct svc_xprt { | |||
| 84 | 84 | ||
| 85 | struct net *xpt_net; | 85 | struct net *xpt_net; |
| 86 | struct rpc_xprt *xpt_bc_xprt; /* NFSv4.1 backchannel */ | 86 | struct rpc_xprt *xpt_bc_xprt; /* NFSv4.1 backchannel */ |
| 87 | struct rpc_xprt_switch *xpt_bc_xps; /* NFSv4.1 backchannel */ | ||
| 87 | }; | 88 | }; |
| 88 | 89 | ||
| 89 | static inline void unregister_xpt_user(struct svc_xprt *xpt, struct svc_xpt_user *u) | 90 | static inline void unregister_xpt_user(struct svc_xprt *xpt, struct svc_xpt_user *u) |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 5aa3834619a8..5e3e1b63dbb3 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
| @@ -297,6 +297,7 @@ struct xprt_create { | |||
| 297 | size_t addrlen; | 297 | size_t addrlen; |
| 298 | const char *servername; | 298 | const char *servername; |
| 299 | struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ | 299 | struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ |
| 300 | struct rpc_xprt_switch *bc_xps; | ||
| 300 | unsigned int flags; | 301 | unsigned int flags; |
| 301 | }; | 302 | }; |
| 302 | 303 | ||
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 457651bf45b0..fefe8b06a63d 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
| @@ -1034,6 +1034,8 @@ static inline int usb_gadget_activate(struct usb_gadget *gadget) | |||
| 1034 | * @udc_name: A name of UDC this driver should be bound to. If udc_name is NULL, | 1034 | * @udc_name: A name of UDC this driver should be bound to. If udc_name is NULL, |
| 1035 | * this driver will be bound to any available UDC. | 1035 | * this driver will be bound to any available UDC. |
| 1036 | * @pending: UDC core private data used for deferred probe of this driver. | 1036 | * @pending: UDC core private data used for deferred probe of this driver. |
| 1037 | * @match_existing_only: If udc is not found, return an error and don't add this | ||
| 1038 | * gadget driver to list of pending driver | ||
| 1037 | * | 1039 | * |
| 1038 | * Devices are disabled till a gadget driver successfully bind()s, which | 1040 | * Devices are disabled till a gadget driver successfully bind()s, which |
| 1039 | * means the driver will handle setup() requests needed to enumerate (and | 1041 | * means the driver will handle setup() requests needed to enumerate (and |
| @@ -1097,6 +1099,7 @@ struct usb_gadget_driver { | |||
| 1097 | 1099 | ||
| 1098 | char *udc_name; | 1100 | char *udc_name; |
| 1099 | struct list_head pending; | 1101 | struct list_head pending; |
| 1102 | unsigned match_existing_only:1; | ||
| 1100 | }; | 1103 | }; |
| 1101 | 1104 | ||
| 1102 | 1105 | ||
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index 0b3da40a525e..d315c8907869 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h | |||
| @@ -142,10 +142,11 @@ enum musb_vbus_id_status { | |||
| 142 | }; | 142 | }; |
| 143 | 143 | ||
| 144 | #if IS_ENABLED(CONFIG_USB_MUSB_HDRC) | 144 | #if IS_ENABLED(CONFIG_USB_MUSB_HDRC) |
| 145 | void musb_mailbox(enum musb_vbus_id_status status); | 145 | int musb_mailbox(enum musb_vbus_id_status status); |
| 146 | #else | 146 | #else |
| 147 | static inline void musb_mailbox(enum musb_vbus_id_status status) | 147 | static inline int musb_mailbox(enum musb_vbus_id_status status) |
| 148 | { | 148 | { |
| 149 | return 0; | ||
| 149 | } | 150 | } |
| 150 | #endif | 151 | #endif |
| 151 | 152 | ||
diff --git a/include/media/v4l2-mc.h b/include/media/v4l2-mc.h index 98a938aabdfb..7a8d6037a4bb 100644 --- a/include/media/v4l2-mc.h +++ b/include/media/v4l2-mc.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * v4l2-mc.h - Media Controller V4L2 types and prototypes | 2 | * v4l2-mc.h - Media Controller V4L2 types and prototypes |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2016 Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 4 | * Copyright (C) 2016 Mauro Carvalho Chehab <mchehab@kernel.org> |
| 5 | * Copyright (C) 2006-2010 Nokia Corporation | 5 | * Copyright (C) 2006-2010 Nokia Corporation |
| 6 | * Copyright (c) 2016 Intel Corporation. | 6 | * Copyright (c) 2016 Intel Corporation. |
| 7 | * | 7 | * |
diff --git a/kernel/kcov.c b/kernel/kcov.c index a02f2dddd1d7..8d44b3fea9d0 100644 --- a/kernel/kcov.c +++ b/kernel/kcov.c | |||
| @@ -264,7 +264,12 @@ static const struct file_operations kcov_fops = { | |||
| 264 | 264 | ||
| 265 | static int __init kcov_init(void) | 265 | static int __init kcov_init(void) |
| 266 | { | 266 | { |
| 267 | if (!debugfs_create_file("kcov", 0600, NULL, NULL, &kcov_fops)) { | 267 | /* |
| 268 | * The kcov debugfs file won't ever get removed and thus, | ||
| 269 | * there is no need to protect it against removal races. The | ||
| 270 | * use of debugfs_create_file_unsafe() is actually safe here. | ||
| 271 | */ | ||
| 272 | if (!debugfs_create_file_unsafe("kcov", 0600, NULL, NULL, &kcov_fops)) { | ||
| 268 | pr_err("failed to create kcov in debugfs\n"); | 273 | pr_err("failed to create kcov in debugfs\n"); |
| 269 | return -ENOMEM; | 274 | return -ENOMEM; |
| 270 | } | 275 | } |
diff --git a/mm/percpu.c b/mm/percpu.c index 0c59684f1ff2..9903830aaebb 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
| @@ -112,7 +112,7 @@ struct pcpu_chunk { | |||
| 112 | int map_used; /* # of map entries used before the sentry */ | 112 | int map_used; /* # of map entries used before the sentry */ |
| 113 | int map_alloc; /* # of map entries allocated */ | 113 | int map_alloc; /* # of map entries allocated */ |
| 114 | int *map; /* allocation map */ | 114 | int *map; /* allocation map */ |
| 115 | struct work_struct map_extend_work;/* async ->map[] extension */ | 115 | struct list_head map_extend_list;/* on pcpu_map_extend_chunks */ |
| 116 | 116 | ||
| 117 | void *data; /* chunk data */ | 117 | void *data; /* chunk data */ |
| 118 | int first_free; /* no free below this */ | 118 | int first_free; /* no free below this */ |
| @@ -162,10 +162,13 @@ static struct pcpu_chunk *pcpu_reserved_chunk; | |||
| 162 | static int pcpu_reserved_chunk_limit; | 162 | static int pcpu_reserved_chunk_limit; |
| 163 | 163 | ||
| 164 | static DEFINE_SPINLOCK(pcpu_lock); /* all internal data structures */ | 164 | static DEFINE_SPINLOCK(pcpu_lock); /* all internal data structures */ |
| 165 | static DEFINE_MUTEX(pcpu_alloc_mutex); /* chunk create/destroy, [de]pop */ | 165 | static DEFINE_MUTEX(pcpu_alloc_mutex); /* chunk create/destroy, [de]pop, map ext */ |
| 166 | 166 | ||
| 167 | static struct list_head *pcpu_slot __read_mostly; /* chunk list slots */ | 167 | static struct list_head *pcpu_slot __read_mostly; /* chunk list slots */ |
| 168 | 168 | ||
| 169 | /* chunks which need their map areas extended, protected by pcpu_lock */ | ||
| 170 | static LIST_HEAD(pcpu_map_extend_chunks); | ||
| 171 | |||
| 169 | /* | 172 | /* |
| 170 | * The number of empty populated pages, protected by pcpu_lock. The | 173 | * The number of empty populated pages, protected by pcpu_lock. The |
| 171 | * reserved chunk doesn't contribute to the count. | 174 | * reserved chunk doesn't contribute to the count. |
| @@ -395,13 +398,19 @@ static int pcpu_need_to_extend(struct pcpu_chunk *chunk, bool is_atomic) | |||
| 395 | { | 398 | { |
| 396 | int margin, new_alloc; | 399 | int margin, new_alloc; |
| 397 | 400 | ||
| 401 | lockdep_assert_held(&pcpu_lock); | ||
| 402 | |||
| 398 | if (is_atomic) { | 403 | if (is_atomic) { |
| 399 | margin = 3; | 404 | margin = 3; |
| 400 | 405 | ||
| 401 | if (chunk->map_alloc < | 406 | if (chunk->map_alloc < |
| 402 | chunk->map_used + PCPU_ATOMIC_MAP_MARGIN_LOW && | 407 | chunk->map_used + PCPU_ATOMIC_MAP_MARGIN_LOW) { |
| 403 | pcpu_async_enabled) | 408 | if (list_empty(&chunk->map_extend_list)) { |
| 404 | schedule_work(&chunk->map_extend_work); | 409 | list_add_tail(&chunk->map_extend_list, |
| 410 | &pcpu_map_extend_chunks); | ||
| 411 | pcpu_schedule_balance_work(); | ||
| 412 | } | ||
| 413 | } | ||
| 405 | } else { | 414 | } else { |
| 406 | margin = PCPU_ATOMIC_MAP_MARGIN_HIGH; | 415 | margin = PCPU_ATOMIC_MAP_MARGIN_HIGH; |
| 407 | } | 416 | } |
| @@ -435,6 +444,8 @@ static int pcpu_extend_area_map(struct pcpu_chunk *chunk, int new_alloc) | |||
| 435 | size_t old_size = 0, new_size = new_alloc * sizeof(new[0]); | 444 | size_t old_size = 0, new_size = new_alloc * sizeof(new[0]); |
| 436 | unsigned long flags; | 445 | unsigned long flags; |
| 437 | 446 | ||
| 447 | lockdep_assert_held(&pcpu_alloc_mutex); | ||
| 448 | |||
| 438 | new = pcpu_mem_zalloc(new_size); | 449 | new = pcpu_mem_zalloc(new_size); |
| 439 | if (!new) | 450 | if (!new) |
| 440 | return -ENOMEM; | 451 | return -ENOMEM; |
| @@ -467,20 +478,6 @@ out_unlock: | |||
| 467 | return 0; | 478 | return 0; |
| 468 | } | 479 | } |
| 469 | 480 | ||
| 470 | static void pcpu_map_extend_workfn(struct work_struct *work) | ||
| 471 | { | ||
| 472 | struct pcpu_chunk *chunk = container_of(work, struct pcpu_chunk, | ||
| 473 | map_extend_work); | ||
| 474 | int new_alloc; | ||
| 475 | |||
| 476 | spin_lock_irq(&pcpu_lock); | ||
| 477 | new_alloc = pcpu_need_to_extend(chunk, false); | ||
| 478 | spin_unlock_irq(&pcpu_lock); | ||
| 479 | |||
| 480 | if (new_alloc) | ||
| 481 | pcpu_extend_area_map(chunk, new_alloc); | ||
| 482 | } | ||
| 483 | |||
| 484 | /** | 481 | /** |
| 485 | * pcpu_fit_in_area - try to fit the requested allocation in a candidate area | 482 | * pcpu_fit_in_area - try to fit the requested allocation in a candidate area |
| 486 | * @chunk: chunk the candidate area belongs to | 483 | * @chunk: chunk the candidate area belongs to |
| @@ -740,7 +737,7 @@ static struct pcpu_chunk *pcpu_alloc_chunk(void) | |||
| 740 | chunk->map_used = 1; | 737 | chunk->map_used = 1; |
| 741 | 738 | ||
| 742 | INIT_LIST_HEAD(&chunk->list); | 739 | INIT_LIST_HEAD(&chunk->list); |
| 743 | INIT_WORK(&chunk->map_extend_work, pcpu_map_extend_workfn); | 740 | INIT_LIST_HEAD(&chunk->map_extend_list); |
| 744 | chunk->free_size = pcpu_unit_size; | 741 | chunk->free_size = pcpu_unit_size; |
| 745 | chunk->contig_hint = pcpu_unit_size; | 742 | chunk->contig_hint = pcpu_unit_size; |
| 746 | 743 | ||
| @@ -895,6 +892,9 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved, | |||
| 895 | return NULL; | 892 | return NULL; |
| 896 | } | 893 | } |
| 897 | 894 | ||
| 895 | if (!is_atomic) | ||
| 896 | mutex_lock(&pcpu_alloc_mutex); | ||
| 897 | |||
| 898 | spin_lock_irqsave(&pcpu_lock, flags); | 898 | spin_lock_irqsave(&pcpu_lock, flags); |
| 899 | 899 | ||
| 900 | /* serve reserved allocations from the reserved chunk if available */ | 900 | /* serve reserved allocations from the reserved chunk if available */ |
| @@ -967,12 +967,9 @@ restart: | |||
| 967 | if (is_atomic) | 967 | if (is_atomic) |
| 968 | goto fail; | 968 | goto fail; |
| 969 | 969 | ||
| 970 | mutex_lock(&pcpu_alloc_mutex); | ||
| 971 | |||
| 972 | if (list_empty(&pcpu_slot[pcpu_nr_slots - 1])) { | 970 | if (list_empty(&pcpu_slot[pcpu_nr_slots - 1])) { |
| 973 | chunk = pcpu_create_chunk(); | 971 | chunk = pcpu_create_chunk(); |
| 974 | if (!chunk) { | 972 | if (!chunk) { |
| 975 | mutex_unlock(&pcpu_alloc_mutex); | ||
| 976 | err = "failed to allocate new chunk"; | 973 | err = "failed to allocate new chunk"; |
| 977 | goto fail; | 974 | goto fail; |
| 978 | } | 975 | } |
| @@ -983,7 +980,6 @@ restart: | |||
| 983 | spin_lock_irqsave(&pcpu_lock, flags); | 980 | spin_lock_irqsave(&pcpu_lock, flags); |
| 984 | } | 981 | } |
| 985 | 982 | ||
| 986 | mutex_unlock(&pcpu_alloc_mutex); | ||
| 987 | goto restart; | 983 | goto restart; |
| 988 | 984 | ||
| 989 | area_found: | 985 | area_found: |
| @@ -993,8 +989,6 @@ area_found: | |||
| 993 | if (!is_atomic) { | 989 | if (!is_atomic) { |
| 994 | int page_start, page_end, rs, re; | 990 | int page_start, page_end, rs, re; |
| 995 | 991 | ||
| 996 | mutex_lock(&pcpu_alloc_mutex); | ||
| 997 | |||
| 998 | page_start = PFN_DOWN(off); | 992 | page_start = PFN_DOWN(off); |
| 999 | page_end = PFN_UP(off + size); | 993 | page_end = PFN_UP(off + size); |
| 1000 | 994 | ||
| @@ -1005,7 +999,6 @@ area_found: | |||
| 1005 | 999 | ||
| 1006 | spin_lock_irqsave(&pcpu_lock, flags); | 1000 | spin_lock_irqsave(&pcpu_lock, flags); |
| 1007 | if (ret) { | 1001 | if (ret) { |
| 1008 | mutex_unlock(&pcpu_alloc_mutex); | ||
| 1009 | pcpu_free_area(chunk, off, &occ_pages); | 1002 | pcpu_free_area(chunk, off, &occ_pages); |
| 1010 | err = "failed to populate"; | 1003 | err = "failed to populate"; |
| 1011 | goto fail_unlock; | 1004 | goto fail_unlock; |
| @@ -1045,6 +1038,8 @@ fail: | |||
| 1045 | /* see the flag handling in pcpu_blance_workfn() */ | 1038 | /* see the flag handling in pcpu_blance_workfn() */ |
| 1046 | pcpu_atomic_alloc_failed = true; | 1039 | pcpu_atomic_alloc_failed = true; |
| 1047 | pcpu_schedule_balance_work(); | 1040 | pcpu_schedule_balance_work(); |
| 1041 | } else { | ||
| 1042 | mutex_unlock(&pcpu_alloc_mutex); | ||
| 1048 | } | 1043 | } |
| 1049 | return NULL; | 1044 | return NULL; |
| 1050 | } | 1045 | } |
| @@ -1129,6 +1124,7 @@ static void pcpu_balance_workfn(struct work_struct *work) | |||
| 1129 | if (chunk == list_first_entry(free_head, struct pcpu_chunk, list)) | 1124 | if (chunk == list_first_entry(free_head, struct pcpu_chunk, list)) |
| 1130 | continue; | 1125 | continue; |
| 1131 | 1126 | ||
| 1127 | list_del_init(&chunk->map_extend_list); | ||
| 1132 | list_move(&chunk->list, &to_free); | 1128 | list_move(&chunk->list, &to_free); |
| 1133 | } | 1129 | } |
| 1134 | 1130 | ||
| @@ -1146,6 +1142,25 @@ static void pcpu_balance_workfn(struct work_struct *work) | |||
| 1146 | pcpu_destroy_chunk(chunk); | 1142 | pcpu_destroy_chunk(chunk); |
| 1147 | } | 1143 | } |
| 1148 | 1144 | ||
| 1145 | /* service chunks which requested async area map extension */ | ||
| 1146 | do { | ||
| 1147 | int new_alloc = 0; | ||
| 1148 | |||
| 1149 | spin_lock_irq(&pcpu_lock); | ||
| 1150 | |||
| 1151 | chunk = list_first_entry_or_null(&pcpu_map_extend_chunks, | ||
| 1152 | struct pcpu_chunk, map_extend_list); | ||
| 1153 | if (chunk) { | ||
| 1154 | list_del_init(&chunk->map_extend_list); | ||
| 1155 | new_alloc = pcpu_need_to_extend(chunk, false); | ||
| 1156 | } | ||
| 1157 | |||
| 1158 | spin_unlock_irq(&pcpu_lock); | ||
| 1159 | |||
| 1160 | if (new_alloc) | ||
| 1161 | pcpu_extend_area_map(chunk, new_alloc); | ||
| 1162 | } while (chunk); | ||
| 1163 | |||
| 1149 | /* | 1164 | /* |
| 1150 | * Ensure there are certain number of free populated pages for | 1165 | * Ensure there are certain number of free populated pages for |
| 1151 | * atomic allocs. Fill up from the most packed so that atomic | 1166 | * atomic allocs. Fill up from the most packed so that atomic |
| @@ -1644,7 +1659,7 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, | |||
| 1644 | */ | 1659 | */ |
| 1645 | schunk = memblock_virt_alloc(pcpu_chunk_struct_size, 0); | 1660 | schunk = memblock_virt_alloc(pcpu_chunk_struct_size, 0); |
| 1646 | INIT_LIST_HEAD(&schunk->list); | 1661 | INIT_LIST_HEAD(&schunk->list); |
| 1647 | INIT_WORK(&schunk->map_extend_work, pcpu_map_extend_workfn); | 1662 | INIT_LIST_HEAD(&schunk->map_extend_list); |
| 1648 | schunk->base_addr = base_addr; | 1663 | schunk->base_addr = base_addr; |
| 1649 | schunk->map = smap; | 1664 | schunk->map = smap; |
| 1650 | schunk->map_alloc = ARRAY_SIZE(smap); | 1665 | schunk->map_alloc = ARRAY_SIZE(smap); |
| @@ -1673,7 +1688,7 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, | |||
| 1673 | if (dyn_size) { | 1688 | if (dyn_size) { |
| 1674 | dchunk = memblock_virt_alloc(pcpu_chunk_struct_size, 0); | 1689 | dchunk = memblock_virt_alloc(pcpu_chunk_struct_size, 0); |
| 1675 | INIT_LIST_HEAD(&dchunk->list); | 1690 | INIT_LIST_HEAD(&dchunk->list); |
| 1676 | INIT_WORK(&dchunk->map_extend_work, pcpu_map_extend_workfn); | 1691 | INIT_LIST_HEAD(&dchunk->map_extend_list); |
| 1677 | dchunk->base_addr = base_addr; | 1692 | dchunk->base_addr = base_addr; |
| 1678 | dchunk->map = dmap; | 1693 | dchunk->map = dmap; |
| 1679 | dchunk->map_alloc = ARRAY_SIZE(dmap); | 1694 | dchunk->map_alloc = ARRAY_SIZE(dmap); |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 06b4df9faaa1..2808d550d273 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
| @@ -446,16 +446,27 @@ out_no_rpciod: | |||
| 446 | return ERR_PTR(err); | 446 | return ERR_PTR(err); |
| 447 | } | 447 | } |
| 448 | 448 | ||
| 449 | struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args, | 449 | static struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args, |
| 450 | struct rpc_xprt *xprt) | 450 | struct rpc_xprt *xprt) |
| 451 | { | 451 | { |
| 452 | struct rpc_clnt *clnt = NULL; | 452 | struct rpc_clnt *clnt = NULL; |
| 453 | struct rpc_xprt_switch *xps; | 453 | struct rpc_xprt_switch *xps; |
| 454 | 454 | ||
| 455 | xps = xprt_switch_alloc(xprt, GFP_KERNEL); | 455 | if (args->bc_xprt && args->bc_xprt->xpt_bc_xps) { |
| 456 | if (xps == NULL) | 456 | WARN_ON(args->protocol != XPRT_TRANSPORT_BC_TCP); |
| 457 | return ERR_PTR(-ENOMEM); | 457 | xps = args->bc_xprt->xpt_bc_xps; |
| 458 | 458 | xprt_switch_get(xps); | |
| 459 | } else { | ||
| 460 | xps = xprt_switch_alloc(xprt, GFP_KERNEL); | ||
| 461 | if (xps == NULL) { | ||
| 462 | xprt_put(xprt); | ||
| 463 | return ERR_PTR(-ENOMEM); | ||
| 464 | } | ||
| 465 | if (xprt->bc_xprt) { | ||
| 466 | xprt_switch_get(xps); | ||
| 467 | xprt->bc_xprt->xpt_bc_xps = xps; | ||
| 468 | } | ||
| 469 | } | ||
| 459 | clnt = rpc_new_client(args, xps, xprt, NULL); | 470 | clnt = rpc_new_client(args, xps, xprt, NULL); |
| 460 | if (IS_ERR(clnt)) | 471 | if (IS_ERR(clnt)) |
| 461 | return clnt; | 472 | return clnt; |
| @@ -483,7 +494,6 @@ struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args, | |||
| 483 | 494 | ||
| 484 | return clnt; | 495 | return clnt; |
| 485 | } | 496 | } |
| 486 | EXPORT_SYMBOL_GPL(rpc_create_xprt); | ||
| 487 | 497 | ||
| 488 | /** | 498 | /** |
| 489 | * rpc_create - create an RPC client and transport with one call | 499 | * rpc_create - create an RPC client and transport with one call |
| @@ -509,6 +519,15 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
| 509 | }; | 519 | }; |
| 510 | char servername[48]; | 520 | char servername[48]; |
| 511 | 521 | ||
| 522 | if (args->bc_xprt) { | ||
| 523 | WARN_ON(args->protocol != XPRT_TRANSPORT_BC_TCP); | ||
| 524 | xprt = args->bc_xprt->xpt_bc_xprt; | ||
| 525 | if (xprt) { | ||
| 526 | xprt_get(xprt); | ||
| 527 | return rpc_create_xprt(args, xprt); | ||
| 528 | } | ||
| 529 | } | ||
| 530 | |||
| 512 | if (args->flags & RPC_CLNT_CREATE_INFINITE_SLOTS) | 531 | if (args->flags & RPC_CLNT_CREATE_INFINITE_SLOTS) |
| 513 | xprtargs.flags |= XPRT_CREATE_INFINITE_SLOTS; | 532 | xprtargs.flags |= XPRT_CREATE_INFINITE_SLOTS; |
| 514 | if (args->flags & RPC_CLNT_CREATE_NO_IDLE_TIMEOUT) | 533 | if (args->flags & RPC_CLNT_CREATE_NO_IDLE_TIMEOUT) |
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index f5572e31d518..4f01f63102ee 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
| @@ -136,6 +136,8 @@ static void svc_xprt_free(struct kref *kref) | |||
| 136 | /* See comment on corresponding get in xs_setup_bc_tcp(): */ | 136 | /* See comment on corresponding get in xs_setup_bc_tcp(): */ |
| 137 | if (xprt->xpt_bc_xprt) | 137 | if (xprt->xpt_bc_xprt) |
| 138 | xprt_put(xprt->xpt_bc_xprt); | 138 | xprt_put(xprt->xpt_bc_xprt); |
| 139 | if (xprt->xpt_bc_xps) | ||
| 140 | xprt_switch_put(xprt->xpt_bc_xps); | ||
| 139 | xprt->xpt_ops->xpo_free(xprt); | 141 | xprt->xpt_ops->xpo_free(xprt); |
| 140 | module_put(owner); | 142 | module_put(owner); |
| 141 | } | 143 | } |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 2d3e0c42361e..7e2b2fa189c3 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
| @@ -3057,6 +3057,7 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args) | |||
| 3057 | return xprt; | 3057 | return xprt; |
| 3058 | 3058 | ||
| 3059 | args->bc_xprt->xpt_bc_xprt = NULL; | 3059 | args->bc_xprt->xpt_bc_xprt = NULL; |
| 3060 | args->bc_xprt->xpt_bc_xps = NULL; | ||
| 3060 | xprt_put(xprt); | 3061 | xprt_put(xprt); |
| 3061 | ret = ERR_PTR(-EINVAL); | 3062 | ret = ERR_PTR(-EINVAL); |
| 3062 | out_err: | 3063 | out_err: |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 80aa6a3e6817..735362c26c8e 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
| @@ -315,7 +315,7 @@ static struct sock *unix_find_socket_byinode(struct inode *i) | |||
| 315 | &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { | 315 | &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { |
| 316 | struct dentry *dentry = unix_sk(s)->path.dentry; | 316 | struct dentry *dentry = unix_sk(s)->path.dentry; |
| 317 | 317 | ||
| 318 | if (dentry && d_backing_inode(dentry) == i) { | 318 | if (dentry && d_real_inode(dentry) == i) { |
| 319 | sock_hold(s); | 319 | sock_hold(s); |
| 320 | goto found; | 320 | goto found; |
| 321 | } | 321 | } |
| @@ -911,7 +911,7 @@ static struct sock *unix_find_other(struct net *net, | |||
| 911 | err = kern_path(sunname->sun_path, LOOKUP_FOLLOW, &path); | 911 | err = kern_path(sunname->sun_path, LOOKUP_FOLLOW, &path); |
| 912 | if (err) | 912 | if (err) |
| 913 | goto fail; | 913 | goto fail; |
| 914 | inode = d_backing_inode(path.dentry); | 914 | inode = d_real_inode(path.dentry); |
| 915 | err = inode_permission(inode, MAY_WRITE); | 915 | err = inode_permission(inode, MAY_WRITE); |
| 916 | if (err) | 916 | if (err) |
| 917 | goto put_fail; | 917 | goto put_fail; |
| @@ -1048,7 +1048,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
| 1048 | goto out_up; | 1048 | goto out_up; |
| 1049 | } | 1049 | } |
| 1050 | addr->hash = UNIX_HASH_SIZE; | 1050 | addr->hash = UNIX_HASH_SIZE; |
| 1051 | hash = d_backing_inode(dentry)->i_ino & (UNIX_HASH_SIZE - 1); | 1051 | hash = d_real_inode(dentry)->i_ino & (UNIX_HASH_SIZE - 1); |
| 1052 | spin_lock(&unix_table_lock); | 1052 | spin_lock(&unix_table_lock); |
| 1053 | u->path = u_path; | 1053 | u->path = u_path; |
| 1054 | list = &unix_socket_table[hash]; | 1054 | list = &unix_socket_table[hash]; |
diff --git a/security/keys/key.c b/security/keys/key.c index bd5a272f28a6..346fbf201c22 100644 --- a/security/keys/key.c +++ b/security/keys/key.c | |||
| @@ -597,7 +597,7 @@ int key_reject_and_link(struct key *key, | |||
| 597 | 597 | ||
| 598 | mutex_unlock(&key_construction_mutex); | 598 | mutex_unlock(&key_construction_mutex); |
| 599 | 599 | ||
| 600 | if (keyring) | 600 | if (keyring && link_ret == 0) |
| 601 | __key_link_end(keyring, &key->index_key, edit); | 601 | __key_link_end(keyring, &key->index_key, edit); |
| 602 | 602 | ||
| 603 | /* wake up anyone waiting for a key to be constructed */ | 603 | /* wake up anyone waiting for a key to be constructed */ |
diff --git a/tools/virtio/ringtest/Makefile b/tools/virtio/ringtest/Makefile index 6ba745529833..6173adae9f08 100644 --- a/tools/virtio/ringtest/Makefile +++ b/tools/virtio/ringtest/Makefile | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | all: | 1 | all: |
| 2 | 2 | ||
| 3 | all: ring virtio_ring_0_9 virtio_ring_poll virtio_ring_inorder | 3 | all: ring virtio_ring_0_9 virtio_ring_poll virtio_ring_inorder noring |
| 4 | 4 | ||
| 5 | CFLAGS += -Wall | 5 | CFLAGS += -Wall |
| 6 | CFLAGS += -pthread -O2 -ggdb | 6 | CFLAGS += -pthread -O2 -ggdb |
| @@ -15,11 +15,13 @@ ring: ring.o main.o | |||
| 15 | virtio_ring_0_9: virtio_ring_0_9.o main.o | 15 | virtio_ring_0_9: virtio_ring_0_9.o main.o |
| 16 | virtio_ring_poll: virtio_ring_poll.o main.o | 16 | virtio_ring_poll: virtio_ring_poll.o main.o |
| 17 | virtio_ring_inorder: virtio_ring_inorder.o main.o | 17 | virtio_ring_inorder: virtio_ring_inorder.o main.o |
| 18 | noring: noring.o main.o | ||
| 18 | clean: | 19 | clean: |
| 19 | -rm main.o | 20 | -rm main.o |
| 20 | -rm ring.o ring | 21 | -rm ring.o ring |
| 21 | -rm virtio_ring_0_9.o virtio_ring_0_9 | 22 | -rm virtio_ring_0_9.o virtio_ring_0_9 |
| 22 | -rm virtio_ring_poll.o virtio_ring_poll | 23 | -rm virtio_ring_poll.o virtio_ring_poll |
| 23 | -rm virtio_ring_inorder.o virtio_ring_inorder | 24 | -rm virtio_ring_inorder.o virtio_ring_inorder |
| 25 | -rm noring.o noring | ||
| 24 | 26 | ||
| 25 | .PHONY: all clean | 27 | .PHONY: all clean |
diff --git a/tools/virtio/ringtest/README b/tools/virtio/ringtest/README index 34e94c46104f..d83707a336c9 100644 --- a/tools/virtio/ringtest/README +++ b/tools/virtio/ringtest/README | |||
| @@ -1,2 +1,6 @@ | |||
| 1 | Partial implementation of various ring layouts, useful to tune virtio design. | 1 | Partial implementation of various ring layouts, useful to tune virtio design. |
| 2 | Uses shared memory heavily. | 2 | Uses shared memory heavily. |
| 3 | |||
| 4 | Typical use: | ||
| 5 | |||
| 6 | # sh run-on-all.sh perf stat -r 10 --log-fd 1 -- ./ring | ||
diff --git a/tools/virtio/ringtest/noring.c b/tools/virtio/ringtest/noring.c new file mode 100644 index 000000000000..eda2f4824130 --- /dev/null +++ b/tools/virtio/ringtest/noring.c | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | #define _GNU_SOURCE | ||
| 2 | #include "main.h" | ||
| 3 | #include <assert.h> | ||
| 4 | |||
| 5 | /* stub implementation: useful for measuring overhead */ | ||
| 6 | void alloc_ring(void) | ||
| 7 | { | ||
| 8 | } | ||
| 9 | |||
| 10 | /* guest side */ | ||
| 11 | int add_inbuf(unsigned len, void *buf, void *datap) | ||
| 12 | { | ||
| 13 | return 0; | ||
| 14 | } | ||
| 15 | |||
| 16 | /* | ||
| 17 | * skb_array API provides no way for producer to find out whether a given | ||
| 18 | * buffer was consumed. Our tests merely require that a successful get_buf | ||
| 19 | * implies that add_inbuf succeed in the past, and that add_inbuf will succeed, | ||
| 20 | * fake it accordingly. | ||
| 21 | */ | ||
| 22 | void *get_buf(unsigned *lenp, void **bufp) | ||
| 23 | { | ||
| 24 | return "Buffer"; | ||
| 25 | } | ||
| 26 | |||
| 27 | void poll_used(void) | ||
| 28 | { | ||
| 29 | } | ||
| 30 | |||
| 31 | void disable_call() | ||
| 32 | { | ||
| 33 | assert(0); | ||
| 34 | } | ||
| 35 | |||
| 36 | bool enable_call() | ||
| 37 | { | ||
| 38 | assert(0); | ||
| 39 | } | ||
| 40 | |||
| 41 | void kick_available(void) | ||
| 42 | { | ||
| 43 | assert(0); | ||
| 44 | } | ||
| 45 | |||
| 46 | /* host side */ | ||
| 47 | void disable_kick() | ||
| 48 | { | ||
| 49 | assert(0); | ||
| 50 | } | ||
| 51 | |||
| 52 | bool enable_kick() | ||
| 53 | { | ||
| 54 | assert(0); | ||
| 55 | } | ||
| 56 | |||
| 57 | void poll_avail(void) | ||
| 58 | { | ||
| 59 | } | ||
| 60 | |||
| 61 | bool use_buf(unsigned *lenp, void **bufp) | ||
| 62 | { | ||
| 63 | return true; | ||
| 64 | } | ||
| 65 | |||
| 66 | void call_used(void) | ||
| 67 | { | ||
| 68 | assert(0); | ||
| 69 | } | ||
diff --git a/tools/virtio/ringtest/run-on-all.sh b/tools/virtio/ringtest/run-on-all.sh index 52b0f71ffa8d..2e69ca812b4c 100755 --- a/tools/virtio/ringtest/run-on-all.sh +++ b/tools/virtio/ringtest/run-on-all.sh | |||
| @@ -3,10 +3,10 @@ | |||
| 3 | #use last CPU for host. Why not the first? | 3 | #use last CPU for host. Why not the first? |
| 4 | #many devices tend to use cpu0 by default so | 4 | #many devices tend to use cpu0 by default so |
| 5 | #it tends to be busier | 5 | #it tends to be busier |
| 6 | HOST_AFFINITY=$(cd /dev/cpu; ls|grep -v '[a-z]'|sort -n|tail -1) | 6 | HOST_AFFINITY=$(lscpu -p=cpu | tail -1) |
| 7 | 7 | ||
| 8 | #run command on all cpus | 8 | #run command on all cpus |
| 9 | for cpu in $(cd /dev/cpu; ls|grep -v '[a-z]'|sort -n); | 9 | for cpu in $(seq 0 $HOST_AFFINITY) |
| 10 | do | 10 | do |
| 11 | #Don't run guest and host on same CPU | 11 | #Don't run guest and host on same CPU |
| 12 | #It actually works ok if using signalling | 12 | #It actually works ok if using signalling |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 02e98f3131bd..48bd520fc702 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
| @@ -2941,7 +2941,7 @@ static long kvm_vm_ioctl(struct file *filp, | |||
| 2941 | if (copy_from_user(&routing, argp, sizeof(routing))) | 2941 | if (copy_from_user(&routing, argp, sizeof(routing))) |
| 2942 | goto out; | 2942 | goto out; |
| 2943 | r = -EINVAL; | 2943 | r = -EINVAL; |
| 2944 | if (routing.nr >= KVM_MAX_IRQ_ROUTES) | 2944 | if (routing.nr > KVM_MAX_IRQ_ROUTES) |
| 2945 | goto out; | 2945 | goto out; |
| 2946 | if (routing.flags) | 2946 | if (routing.flags) |
| 2947 | goto out; | 2947 | goto out; |
