1 |
commit: ca1be7247b8e5d2dfeb7ae78ece8b4ec4cb819a2 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Aug 3 19:01:14 2015 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Aug 3 19:01:14 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=ca1be724 |
7 |
|
8 |
Linux patch 4.1.4 |
9 |
|
10 |
0000_README | 4 + |
11 |
1003_linux-4.1.4.patch | 11078 +++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 11082 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index eab69c9..ceda226 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -55,6 +55,10 @@ Patch: 1002_linux-4.1.3.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.1.3 |
21 |
|
22 |
+Patch: 1003_linux-4.1.4.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.1.4 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1003_linux-4.1.4.patch b/1003_linux-4.1.4.patch |
31 |
new file mode 100644 |
32 |
index 0000000..f7598b8 |
33 |
--- /dev/null |
34 |
+++ b/1003_linux-4.1.4.patch |
35 |
@@ -0,0 +1,11078 @@ |
36 |
+diff --git a/Documentation/ABI/testing/ima_policy b/Documentation/ABI/testing/ima_policy |
37 |
+index d0d0c578324c..0a378a88217a 100644 |
38 |
+--- a/Documentation/ABI/testing/ima_policy |
39 |
++++ b/Documentation/ABI/testing/ima_policy |
40 |
+@@ -20,17 +20,19 @@ Description: |
41 |
+ action: measure | dont_measure | appraise | dont_appraise | audit |
42 |
+ condition:= base | lsm [option] |
43 |
+ base: [[func=] [mask=] [fsmagic=] [fsuuid=] [uid=] |
44 |
+- [fowner]] |
45 |
++ [euid=] [fowner=]] |
46 |
+ lsm: [[subj_user=] [subj_role=] [subj_type=] |
47 |
+ [obj_user=] [obj_role=] [obj_type=]] |
48 |
+ option: [[appraise_type=]] [permit_directio] |
49 |
+ |
50 |
+ base: func:= [BPRM_CHECK][MMAP_CHECK][FILE_CHECK][MODULE_CHECK] |
51 |
+ [FIRMWARE_CHECK] |
52 |
+- mask:= [MAY_READ] [MAY_WRITE] [MAY_APPEND] [MAY_EXEC] |
53 |
++ mask:= [[^]MAY_READ] [[^]MAY_WRITE] [[^]MAY_APPEND] |
54 |
++ [[^]MAY_EXEC] |
55 |
+ fsmagic:= hex value |
56 |
+ fsuuid:= file system UUID (e.g 8bcbe394-4f13-4144-be8e-5aa9ea2ce2f6) |
57 |
+ uid:= decimal value |
58 |
++ euid:= decimal value |
59 |
+ fowner:=decimal value |
60 |
+ lsm: are LSM specific |
61 |
+ option: appraise_type:= [imasig] |
62 |
+@@ -49,11 +51,25 @@ Description: |
63 |
+ dont_measure fsmagic=0x01021994 |
64 |
+ dont_appraise fsmagic=0x01021994 |
65 |
+ # RAMFS_MAGIC |
66 |
+- dont_measure fsmagic=0x858458f6 |
67 |
+ dont_appraise fsmagic=0x858458f6 |
68 |
++ # DEVPTS_SUPER_MAGIC |
69 |
++ dont_measure fsmagic=0x1cd1 |
70 |
++ dont_appraise fsmagic=0x1cd1 |
71 |
++ # BINFMTFS_MAGIC |
72 |
++ dont_measure fsmagic=0x42494e4d |
73 |
++ dont_appraise fsmagic=0x42494e4d |
74 |
+ # SECURITYFS_MAGIC |
75 |
+ dont_measure fsmagic=0x73636673 |
76 |
+ dont_appraise fsmagic=0x73636673 |
77 |
++ # SELINUX_MAGIC |
78 |
++ dont_measure fsmagic=0xf97cff8c |
79 |
++ dont_appraise fsmagic=0xf97cff8c |
80 |
++ # CGROUP_SUPER_MAGIC |
81 |
++ dont_measure fsmagic=0x27e0eb |
82 |
++ dont_appraise fsmagic=0x27e0eb |
83 |
++ # NSFS_MAGIC |
84 |
++ dont_measure fsmagic=0x6e736673 |
85 |
++ dont_appraise fsmagic=0x6e736673 |
86 |
+ |
87 |
+ measure func=BPRM_CHECK |
88 |
+ measure func=FILE_MMAP mask=MAY_EXEC |
89 |
+@@ -70,10 +86,6 @@ Description: |
90 |
+ Examples of LSM specific definitions: |
91 |
+ |
92 |
+ SELinux: |
93 |
+- # SELINUX_MAGIC |
94 |
+- dont_measure fsmagic=0xf97cff8c |
95 |
+- dont_appraise fsmagic=0xf97cff8c |
96 |
+- |
97 |
+ dont_measure obj_type=var_log_t |
98 |
+ dont_appraise obj_type=var_log_t |
99 |
+ dont_measure obj_type=auditd_log_t |
100 |
+diff --git a/Documentation/ABI/testing/sysfs-ata b/Documentation/ABI/testing/sysfs-ata |
101 |
+index 0a932155cbba..9231daef3813 100644 |
102 |
+--- a/Documentation/ABI/testing/sysfs-ata |
103 |
++++ b/Documentation/ABI/testing/sysfs-ata |
104 |
+@@ -90,6 +90,17 @@ gscr |
105 |
+ 130: SATA_PMP_GSCR_SII_GPIO |
106 |
+ Only valid if the device is a PM. |
107 |
+ |
108 |
++trim |
109 |
++ |
110 |
++ Shows the DSM TRIM mode currently used by the device. Valid |
111 |
++ values are: |
112 |
++ unsupported: Drive does not support DSM TRIM |
113 |
++ unqueued: Drive supports unqueued DSM TRIM only |
114 |
++ queued: Drive supports queued DSM TRIM |
115 |
++ forced_unqueued: Drive's unqueued DSM support is known to be |
116 |
++ buggy and only unqueued TRIM commands |
117 |
++ are sent |
118 |
++ |
119 |
+ spdn_cnt |
120 |
+ |
121 |
+ Number of time libata decided to lower the speed of link due to errors. |
122 |
+diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio |
123 |
+index 3befcb19f414..1fbdd79d1624 100644 |
124 |
+--- a/Documentation/ABI/testing/sysfs-bus-iio |
125 |
++++ b/Documentation/ABI/testing/sysfs-bus-iio |
126 |
+@@ -1165,10 +1165,8 @@ Description: |
127 |
+ object is near the sensor, usually be observing |
128 |
+ reflectivity of infrared or ultrasound emitted. |
129 |
+ Often these sensors are unit less and as such conversion |
130 |
+- to SI units is not possible. Where it is, the units should |
131 |
+- be meters. If such a conversion is not possible, the reported |
132 |
+- values should behave in the same way as a distance, i.e. lower |
133 |
+- values indicate something is closer to the sensor. |
134 |
++ to SI units is not possible. Higher proximity measurements |
135 |
++ indicate closer objects, and vice versa. |
136 |
+ |
137 |
+ What: /sys/.../iio:deviceX/in_illuminance_input |
138 |
+ What: /sys/.../iio:deviceX/in_illuminance_raw |
139 |
+diff --git a/Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt |
140 |
+index adda2a8d1d52..e357b020861d 100644 |
141 |
+--- a/Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt |
142 |
++++ b/Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt |
143 |
+@@ -92,5 +92,5 @@ mpp61 61 gpo, dev(wen1), uart1(txd), audio(rclk) |
144 |
+ mpp62 62 gpio, dev(a2), uart1(cts), tdm(drx), pcie(clkreq0), |
145 |
+ audio(mclk), uart0(cts) |
146 |
+ mpp63 63 gpo, spi0(sck), tclk |
147 |
+-mpp64 64 gpio, spi0(miso), spi0-1(cs1) |
148 |
+-mpp65 65 gpio, spi0(mosi), spi0-1(cs2) |
149 |
++mpp64 64 gpio, spi0(miso), spi0(cs1) |
150 |
++mpp65 65 gpio, spi0(mosi), spi0(cs2) |
151 |
+diff --git a/Documentation/devicetree/bindings/pinctrl/marvell,armada-375-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/marvell,armada-375-pinctrl.txt |
152 |
+index 7de0cda4a379..bedbe42c8c0a 100644 |
153 |
+--- a/Documentation/devicetree/bindings/pinctrl/marvell,armada-375-pinctrl.txt |
154 |
++++ b/Documentation/devicetree/bindings/pinctrl/marvell,armada-375-pinctrl.txt |
155 |
+@@ -22,8 +22,8 @@ mpp5 5 gpio, dev(ad7), spi0(cs2), spi1(cs2) |
156 |
+ mpp6 6 gpio, dev(ad0), led(p1), audio(rclk) |
157 |
+ mpp7 7 gpio, dev(ad1), ptp(clk), led(p2), audio(extclk) |
158 |
+ mpp8 8 gpio, dev (bootcs), spi0(cs0), spi1(cs0) |
159 |
+-mpp9 9 gpio, nf(wen), spi0(sck), spi1(sck) |
160 |
+-mpp10 10 gpio, nf(ren), dram(vttctrl), led(c1) |
161 |
++mpp9 9 gpio, spi0(sck), spi1(sck), nand(we) |
162 |
++mpp10 10 gpio, dram(vttctrl), led(c1), nand(re) |
163 |
+ mpp11 11 gpio, dev(a0), led(c2), audio(sdo) |
164 |
+ mpp12 12 gpio, dev(a1), audio(bclk) |
165 |
+ mpp13 13 gpio, dev(readyn), pcie0(rstoutn), pcie1(rstoutn) |
166 |
+diff --git a/Documentation/devicetree/bindings/pinctrl/marvell,armada-38x-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/marvell,armada-38x-pinctrl.txt |
167 |
+index b17c96849fc9..4ac138aaaf87 100644 |
168 |
+--- a/Documentation/devicetree/bindings/pinctrl/marvell,armada-38x-pinctrl.txt |
169 |
++++ b/Documentation/devicetree/bindings/pinctrl/marvell,armada-38x-pinctrl.txt |
170 |
+@@ -27,15 +27,15 @@ mpp8 8 gpio, ge0(txd1), dev(ad10) |
171 |
+ mpp9 9 gpio, ge0(txd2), dev(ad11) |
172 |
+ mpp10 10 gpio, ge0(txd3), dev(ad12) |
173 |
+ mpp11 11 gpio, ge0(txctl), dev(ad13) |
174 |
+-mpp12 12 gpio, ge0(rxd0), pcie0(rstout), pcie1(rstout) [1], spi0(cs1), dev(ad14) |
175 |
+-mpp13 13 gpio, ge0(rxd1), pcie0(clkreq), pcie1(clkreq) [1], spi0(cs2), dev(ad15) |
176 |
+-mpp14 14 gpio, ge0(rxd2), ptp(clk), m(vtt_ctrl), spi0(cs3), dev(wen1) |
177 |
+-mpp15 15 gpio, ge0(rxd3), ge(mdc slave), pcie0(rstout), spi0(mosi), pcie1(rstout) [1] |
178 |
+-mpp16 16 gpio, ge0(rxctl), ge(mdio slave), m(decc_err), spi0(miso), pcie0(clkreq) |
179 |
++mpp12 12 gpio, ge0(rxd0), pcie0(rstout), spi0(cs1), dev(ad14), pcie3(clkreq) |
180 |
++mpp13 13 gpio, ge0(rxd1), pcie0(clkreq), pcie1(clkreq) [1], spi0(cs2), dev(ad15), pcie2(clkreq) |
181 |
++mpp14 14 gpio, ge0(rxd2), ptp(clk), m(vtt_ctrl), spi0(cs3), dev(wen1), pcie3(clkreq) |
182 |
++mpp15 15 gpio, ge0(rxd3), ge(mdc slave), pcie0(rstout), spi0(mosi) |
183 |
++mpp16 16 gpio, ge0(rxctl), ge(mdio slave), m(decc_err), spi0(miso), pcie0(clkreq), pcie1(clkreq) [1] |
184 |
+ mpp17 17 gpio, ge0(rxclk), ptp(clk), ua1(rxd), spi0(sck), sata1(prsnt) |
185 |
+-mpp18 18 gpio, ge0(rxerr), ptp(trig_gen), ua1(txd), spi0(cs0), pcie1(rstout) [1] |
186 |
+-mpp19 19 gpio, ge0(col), ptp(event_req), pcie0(clkreq), sata1(prsnt), ua0(cts) |
187 |
+-mpp20 20 gpio, ge0(txclk), ptp(clk), pcie1(rstout) [1], sata0(prsnt), ua0(rts) |
188 |
++mpp18 18 gpio, ge0(rxerr), ptp(trig_gen), ua1(txd), spi0(cs0) |
189 |
++mpp19 19 gpio, ge0(col), ptp(event_req), ge0(txerr), sata1(prsnt), ua0(cts) |
190 |
++mpp20 20 gpio, ge0(txclk), ptp(clk), sata0(prsnt), ua0(rts) |
191 |
+ mpp21 21 gpio, spi0(cs1), ge1(rxd0), sata0(prsnt), sd0(cmd), dev(bootcs) |
192 |
+ mpp22 22 gpio, spi0(mosi), dev(ad0) |
193 |
+ mpp23 23 gpio, spi0(sck), dev(ad2) |
194 |
+@@ -58,23 +58,23 @@ mpp39 39 gpio, i2c1(sck), ge1(rxd2), ua0(cts), sd0(d1), dev(a2) |
195 |
+ mpp40 40 gpio, i2c1(sda), ge1(rxd3), ua0(rts), sd0(d2), dev(ad6) |
196 |
+ mpp41 41 gpio, ua1(rxd), ge1(rxctl), ua0(cts), spi1(cs3), dev(burst/last) |
197 |
+ mpp42 42 gpio, ua1(txd), ua0(rts), dev(ad7) |
198 |
+-mpp43 43 gpio, pcie0(clkreq), m(vtt_ctrl), m(decc_err), pcie0(rstout), dev(clkout) |
199 |
+-mpp44 44 gpio, sata0(prsnt), sata1(prsnt), sata2(prsnt) [2], sata3(prsnt) [3], pcie0(rstout) |
200 |
+-mpp45 45 gpio, ref(clk_out0), pcie0(rstout), pcie1(rstout) [1], pcie2(rstout), pcie3(rstout) |
201 |
+-mpp46 46 gpio, ref(clk_out1), pcie0(rstout), pcie1(rstout) [1], pcie2(rstout), pcie3(rstout) |
202 |
+-mpp47 47 gpio, sata0(prsnt), sata1(prsnt), sata2(prsnt) [2], spi1(cs2), sata3(prsnt) [2] |
203 |
+-mpp48 48 gpio, sata0(prsnt), m(vtt_ctrl), tdm2c(pclk), audio(mclk), sd0(d4) |
204 |
+-mpp49 49 gpio, sata2(prsnt) [2], sata3(prsnt) [2], tdm2c(fsync), audio(lrclk), sd0(d5) |
205 |
+-mpp50 50 gpio, pcie0(rstout), pcie1(rstout) [1], tdm2c(drx), audio(extclk), sd0(cmd) |
206 |
++mpp43 43 gpio, pcie0(clkreq), m(vtt_ctrl), m(decc_err), spi1(cs2), dev(clkout) |
207 |
++mpp44 44 gpio, sata0(prsnt), sata1(prsnt), sata2(prsnt) [2], sata3(prsnt) [3] |
208 |
++mpp45 45 gpio, ref(clk_out0), pcie0(rstout) |
209 |
++mpp46 46 gpio, ref(clk_out1), pcie0(rstout) |
210 |
++mpp47 47 gpio, sata0(prsnt), sata1(prsnt), sata2(prsnt) [2], sata3(prsnt) [2] |
211 |
++mpp48 48 gpio, sata0(prsnt), m(vtt_ctrl), tdm2c(pclk), audio(mclk), sd0(d4), pcie0(clkreq) |
212 |
++mpp49 49 gpio, sata2(prsnt) [2], sata3(prsnt) [2], tdm2c(fsync), audio(lrclk), sd0(d5), pcie1(clkreq) |
213 |
++mpp50 50 gpio, pcie0(rstout), tdm2c(drx), audio(extclk), sd0(cmd) |
214 |
+ mpp51 51 gpio, tdm2c(dtx), audio(sdo), m(decc_err) |
215 |
+-mpp52 52 gpio, pcie0(rstout), pcie1(rstout) [1], tdm2c(intn), audio(sdi), sd0(d6) |
216 |
++mpp52 52 gpio, pcie0(rstout), tdm2c(intn), audio(sdi), sd0(d6) |
217 |
+ mpp53 53 gpio, sata1(prsnt), sata0(prsnt), tdm2c(rstn), audio(bclk), sd0(d7) |
218 |
+-mpp54 54 gpio, sata0(prsnt), sata1(prsnt), pcie0(rstout), pcie1(rstout) [1], sd0(d3) |
219 |
++mpp54 54 gpio, sata0(prsnt), sata1(prsnt), pcie0(rstout), ge0(txerr), sd0(d3) |
220 |
+ mpp55 55 gpio, ua1(cts), ge(mdio), pcie1(clkreq) [1], spi1(cs1), sd0(d0) |
221 |
+ mpp56 56 gpio, ua1(rts), ge(mdc), m(decc_err), spi1(mosi) |
222 |
+ mpp57 57 gpio, spi1(sck), sd0(clk) |
223 |
+ mpp58 58 gpio, pcie1(clkreq) [1], i2c1(sck), pcie2(clkreq), spi1(miso), sd0(d1) |
224 |
+-mpp59 59 gpio, pcie0(rstout), i2c1(sda), pcie1(rstout) [1], spi1(cs0), sd0(d2) |
225 |
++mpp59 59 gpio, pcie0(rstout), i2c1(sda), spi1(cs0), sd0(d2) |
226 |
+ |
227 |
+ [1]: only available on 88F6820 and 88F6828 |
228 |
+ [2]: only available on 88F6828 |
229 |
+diff --git a/Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt |
230 |
+index 373dbccd7ab0..96e7744cab84 100644 |
231 |
+--- a/Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt |
232 |
++++ b/Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt |
233 |
+@@ -42,15 +42,15 @@ mpp20 20 gpio, ge0(rxd4), ge1(rxd2), lcd(d20), ptp(clk) |
234 |
+ mpp21 21 gpio, ge0(rxd5), ge1(rxd3), lcd(d21), mem(bat) |
235 |
+ mpp22 22 gpio, ge0(rxd6), ge1(rxctl), lcd(d22), sata0(prsnt) |
236 |
+ mpp23 23 gpio, ge0(rxd7), ge1(rxclk), lcd(d23), sata1(prsnt) |
237 |
+-mpp24 24 gpio, lcd(hsync), sata1(prsnt), nf(bootcs-re), tdm(rst) |
238 |
+-mpp25 25 gpio, lcd(vsync), sata0(prsnt), nf(bootcs-we), tdm(pclk) |
239 |
+-mpp26 26 gpio, lcd(clk), tdm(fsync), vdd(cpu1-pd) |
240 |
++mpp24 24 gpio, lcd(hsync), sata1(prsnt), tdm(rst) |
241 |
++mpp25 25 gpio, lcd(vsync), sata0(prsnt), tdm(pclk) |
242 |
++mpp26 26 gpio, lcd(clk), tdm(fsync) |
243 |
+ mpp27 27 gpio, lcd(e), tdm(dtx), ptp(trig) |
244 |
+ mpp28 28 gpio, lcd(pwm), tdm(drx), ptp(evreq) |
245 |
+-mpp29 29 gpio, lcd(ref-clk), tdm(int0), ptp(clk), vdd(cpu0-pd) |
246 |
++mpp29 29 gpio, lcd(ref-clk), tdm(int0), ptp(clk) |
247 |
+ mpp30 30 gpio, tdm(int1), sd0(clk) |
248 |
+-mpp31 31 gpio, tdm(int2), sd0(cmd), vdd(cpu0-pd) |
249 |
+-mpp32 32 gpio, tdm(int3), sd0(d0), vdd(cpu1-pd) |
250 |
++mpp31 31 gpio, tdm(int2), sd0(cmd) |
251 |
++mpp32 32 gpio, tdm(int3), sd0(d0) |
252 |
+ mpp33 33 gpio, tdm(int4), sd0(d1), mem(bat) |
253 |
+ mpp34 34 gpio, tdm(int5), sd0(d2), sata0(prsnt) |
254 |
+ mpp35 35 gpio, tdm(int6), sd0(d3), sata1(prsnt) |
255 |
+@@ -58,21 +58,18 @@ mpp36 36 gpio, spi(mosi) |
256 |
+ mpp37 37 gpio, spi(miso) |
257 |
+ mpp38 38 gpio, spi(sck) |
258 |
+ mpp39 39 gpio, spi(cs0) |
259 |
+-mpp40 40 gpio, spi(cs1), uart2(cts), lcd(vga-hsync), vdd(cpu1-pd), |
260 |
+- pcie(clkreq0) |
261 |
++mpp40 40 gpio, spi(cs1), uart2(cts), lcd(vga-hsync), pcie(clkreq0) |
262 |
+ mpp41 41 gpio, spi(cs2), uart2(rts), lcd(vga-vsync), sata1(prsnt), |
263 |
+ pcie(clkreq1) |
264 |
+-mpp42 42 gpio, uart2(rxd), uart0(cts), tdm(int7), tdm-1(timer), |
265 |
+- vdd(cpu0-pd) |
266 |
+-mpp43 43 gpio, uart2(txd), uart0(rts), spi(cs3), pcie(rstout), |
267 |
+- vdd(cpu2-3-pd){1} |
268 |
++mpp42 42 gpio, uart2(rxd), uart0(cts), tdm(int7), tdm-1(timer) |
269 |
++mpp43 43 gpio, uart2(txd), uart0(rts), spi(cs3), pcie(rstout) |
270 |
+ mpp44 44 gpio, uart2(cts), uart3(rxd), spi(cs4), pcie(clkreq2), |
271 |
+ mem(bat) |
272 |
+ mpp45 45 gpio, uart2(rts), uart3(txd), spi(cs5), sata1(prsnt) |
273 |
+ mpp46 46 gpio, uart3(rts), uart1(rts), spi(cs6), sata0(prsnt) |
274 |
+ mpp47 47 gpio, uart3(cts), uart1(cts), spi(cs7), pcie(clkreq3), |
275 |
+ ref(clkout) |
276 |
+-mpp48 48 gpio, tclk, dev(burst/last) |
277 |
++mpp48 48 gpio, dev(clkout), dev(burst/last) |
278 |
+ |
279 |
+ * Marvell Armada XP (mv78260 and mv78460 only) |
280 |
+ |
281 |
+@@ -84,9 +81,9 @@ mpp51 51 gpio, dev(ad16) |
282 |
+ mpp52 52 gpio, dev(ad17) |
283 |
+ mpp53 53 gpio, dev(ad18) |
284 |
+ mpp54 54 gpio, dev(ad19) |
285 |
+-mpp55 55 gpio, dev(ad20), vdd(cpu0-pd) |
286 |
+-mpp56 56 gpio, dev(ad21), vdd(cpu1-pd) |
287 |
+-mpp57 57 gpio, dev(ad22), vdd(cpu2-3-pd){1} |
288 |
++mpp55 55 gpio, dev(ad20) |
289 |
++mpp56 56 gpio, dev(ad21) |
290 |
++mpp57 57 gpio, dev(ad22) |
291 |
+ mpp58 58 gpio, dev(ad23) |
292 |
+ mpp59 59 gpio, dev(ad24) |
293 |
+ mpp60 60 gpio, dev(ad25) |
294 |
+@@ -96,6 +93,3 @@ mpp63 63 gpio, dev(ad28) |
295 |
+ mpp64 64 gpio, dev(ad29) |
296 |
+ mpp65 65 gpio, dev(ad30) |
297 |
+ mpp66 66 gpio, dev(ad31) |
298 |
+- |
299 |
+-Notes: |
300 |
+-* {1} vdd(cpu2-3-pd) only available on mv78460. |
301 |
+diff --git a/Documentation/devicetree/bindings/usb/atmel-usb.txt b/Documentation/devicetree/bindings/usb/atmel-usb.txt |
302 |
+index e180d56c75db..de773a00e2d4 100644 |
303 |
+--- a/Documentation/devicetree/bindings/usb/atmel-usb.txt |
304 |
++++ b/Documentation/devicetree/bindings/usb/atmel-usb.txt |
305 |
+@@ -60,9 +60,9 @@ Atmel High-Speed USB device controller |
306 |
+ |
307 |
+ Required properties: |
308 |
+ - compatible: Should be one of the following |
309 |
+- "at91sam9rl-udc" |
310 |
+- "at91sam9g45-udc" |
311 |
+- "sama5d3-udc" |
312 |
++ "atmel,at91sam9rl-udc" |
313 |
++ "atmel,at91sam9g45-udc" |
314 |
++ "atmel,sama5d3-udc" |
315 |
+ - reg: Address and length of the register set for the device |
316 |
+ - interrupts: Should contain usba interrupt |
317 |
+ - ep childnode: To specify the number of endpoints and their properties. |
318 |
+diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt |
319 |
+index 6726139bd289..cd03a0faca8f 100644 |
320 |
+--- a/Documentation/kernel-parameters.txt |
321 |
++++ b/Documentation/kernel-parameters.txt |
322 |
+@@ -1398,7 +1398,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted. |
323 |
+ The list of supported hash algorithms is defined |
324 |
+ in crypto/hash_info.h. |
325 |
+ |
326 |
+- ima_tcb [IMA] |
327 |
++ ima_policy= [IMA] |
328 |
++ The builtin measurement policy to load during IMA |
329 |
++ setup. Specyfing "tcb" as the value, measures all |
330 |
++ programs exec'd, files mmap'd for exec, and all files |
331 |
++ opened with the read mode bit set by either the |
332 |
++ effective uid (euid=0) or uid=0. |
333 |
++ Format: "tcb" |
334 |
++ |
335 |
++ ima_tcb [IMA] Deprecated. Use ima_policy= instead. |
336 |
+ Load a policy which meets the needs of the Trusted |
337 |
+ Computing Base. This means IMA will measure all |
338 |
+ programs exec'd, files mmap'd for exec, and all files |
339 |
+diff --git a/Makefile b/Makefile |
340 |
+index e3cdec4898be..36f3225cdf1f 100644 |
341 |
+--- a/Makefile |
342 |
++++ b/Makefile |
343 |
+@@ -1,6 +1,6 @@ |
344 |
+ VERSION = 4 |
345 |
+ PATCHLEVEL = 1 |
346 |
+-SUBLEVEL = 3 |
347 |
++SUBLEVEL = 4 |
348 |
+ EXTRAVERSION = |
349 |
+ NAME = Series 4800 |
350 |
+ |
351 |
+diff --git a/arch/arm/boot/dts/at91-sama5d4ek.dts b/arch/arm/boot/dts/at91-sama5d4ek.dts |
352 |
+index 89ef4a540db5..45e7761b7a29 100644 |
353 |
+--- a/arch/arm/boot/dts/at91-sama5d4ek.dts |
354 |
++++ b/arch/arm/boot/dts/at91-sama5d4ek.dts |
355 |
+@@ -108,8 +108,8 @@ |
356 |
+ mmc0: mmc@f8000000 { |
357 |
+ pinctrl-names = "default"; |
358 |
+ pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3 &pinctrl_mmc0_cd>; |
359 |
+- slot@1 { |
360 |
+- reg = <1>; |
361 |
++ slot@0 { |
362 |
++ reg = <0>; |
363 |
+ bus-width = <4>; |
364 |
+ cd-gpios = <&pioE 5 0>; |
365 |
+ }; |
366 |
+diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi |
367 |
+index 70e59c5ceb2f..e54421176af8 100644 |
368 |
+--- a/arch/arm/boot/dts/at91sam9g45.dtsi |
369 |
++++ b/arch/arm/boot/dts/at91sam9g45.dtsi |
370 |
+@@ -1148,7 +1148,7 @@ |
371 |
+ usb2: gadget@fff78000 { |
372 |
+ #address-cells = <1>; |
373 |
+ #size-cells = <0>; |
374 |
+- compatible = "atmel,at91sam9rl-udc"; |
375 |
++ compatible = "atmel,at91sam9g45-udc"; |
376 |
+ reg = <0x00600000 0x80000 |
377 |
+ 0xfff78000 0x400>; |
378 |
+ interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>; |
379 |
+diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi |
380 |
+index 3aa56ae3410a..3314a7303754 100644 |
381 |
+--- a/arch/arm/boot/dts/at91sam9x5.dtsi |
382 |
++++ b/arch/arm/boot/dts/at91sam9x5.dtsi |
383 |
+@@ -1062,7 +1062,7 @@ |
384 |
+ usb2: gadget@f803c000 { |
385 |
+ #address-cells = <1>; |
386 |
+ #size-cells = <0>; |
387 |
+- compatible = "atmel,at91sam9rl-udc"; |
388 |
++ compatible = "atmel,at91sam9g45-udc"; |
389 |
+ reg = <0x00500000 0x80000 |
390 |
+ 0xf803c000 0x400>; |
391 |
+ interrupts = <23 IRQ_TYPE_LEVEL_HIGH 0>; |
392 |
+diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi |
393 |
+index bbcfb5a19c77..0cb8b0b11c3f 100644 |
394 |
+--- a/arch/arm/boot/dts/imx23.dtsi |
395 |
++++ b/arch/arm/boot/dts/imx23.dtsi |
396 |
+@@ -435,6 +435,7 @@ |
397 |
+ interrupts = <36 37 38 39 40 41 42 43 44>; |
398 |
+ status = "disabled"; |
399 |
+ clocks = <&clks 26>; |
400 |
++ #io-channel-cells = <1>; |
401 |
+ }; |
402 |
+ |
403 |
+ spdif@80054000 { |
404 |
+diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi |
405 |
+index 57ab8587f7b9..37e6182f1470 100644 |
406 |
+--- a/arch/arm/boot/dts/sama5d3.dtsi |
407 |
++++ b/arch/arm/boot/dts/sama5d3.dtsi |
408 |
+@@ -1321,7 +1321,7 @@ |
409 |
+ usb0: gadget@00500000 { |
410 |
+ #address-cells = <1>; |
411 |
+ #size-cells = <0>; |
412 |
+- compatible = "atmel,at91sam9rl-udc"; |
413 |
++ compatible = "atmel,sama5d3-udc"; |
414 |
+ reg = <0x00500000 0x100000 |
415 |
+ 0xf8030000 0x4000>; |
416 |
+ interrupts = <33 IRQ_TYPE_LEVEL_HIGH 2>; |
417 |
+diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi |
418 |
+index 6b1bb58f9c0b..a5f5f4090af6 100644 |
419 |
+--- a/arch/arm/boot/dts/sama5d4.dtsi |
420 |
++++ b/arch/arm/boot/dts/sama5d4.dtsi |
421 |
+@@ -123,7 +123,7 @@ |
422 |
+ usb0: gadget@00400000 { |
423 |
+ #address-cells = <1>; |
424 |
+ #size-cells = <0>; |
425 |
+- compatible = "atmel,at91sam9rl-udc"; |
426 |
++ compatible = "atmel,sama5d3-udc"; |
427 |
+ reg = <0x00400000 0x100000 |
428 |
+ 0xfc02c000 0x4000>; |
429 |
+ interrupts = <47 IRQ_TYPE_LEVEL_HIGH 2>; |
430 |
+@@ -1125,10 +1125,10 @@ |
431 |
+ compatible = "atmel,at91sam9g46-aes"; |
432 |
+ reg = <0xfc044000 0x100>; |
433 |
+ interrupts = <12 IRQ_TYPE_LEVEL_HIGH 0>; |
434 |
+- dmas = <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)) |
435 |
+- AT91_XDMAC_DT_PERID(41)>, |
436 |
+- <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)) |
437 |
+- AT91_XDMAC_DT_PERID(40)>; |
438 |
++ dmas = <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
439 |
++ | AT91_XDMAC_DT_PERID(41))>, |
440 |
++ <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
441 |
++ | AT91_XDMAC_DT_PERID(40))>; |
442 |
+ dma-names = "tx", "rx"; |
443 |
+ clocks = <&aes_clk>; |
444 |
+ clock-names = "aes_clk"; |
445 |
+@@ -1139,10 +1139,10 @@ |
446 |
+ compatible = "atmel,at91sam9g46-tdes"; |
447 |
+ reg = <0xfc04c000 0x100>; |
448 |
+ interrupts = <14 IRQ_TYPE_LEVEL_HIGH 0>; |
449 |
+- dmas = <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)) |
450 |
+- AT91_XDMAC_DT_PERID(42)>, |
451 |
+- <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)) |
452 |
+- AT91_XDMAC_DT_PERID(43)>; |
453 |
++ dmas = <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
454 |
++ | AT91_XDMAC_DT_PERID(42))>, |
455 |
++ <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
456 |
++ | AT91_XDMAC_DT_PERID(43))>; |
457 |
+ dma-names = "tx", "rx"; |
458 |
+ clocks = <&tdes_clk>; |
459 |
+ clock-names = "tdes_clk"; |
460 |
+@@ -1153,8 +1153,8 @@ |
461 |
+ compatible = "atmel,at91sam9g46-sha"; |
462 |
+ reg = <0xfc050000 0x100>; |
463 |
+ interrupts = <15 IRQ_TYPE_LEVEL_HIGH 0>; |
464 |
+- dmas = <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)) |
465 |
+- AT91_XDMAC_DT_PERID(44)>; |
466 |
++ dmas = <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
467 |
++ | AT91_XDMAC_DT_PERID(44))>; |
468 |
+ dma-names = "tx"; |
469 |
+ clocks = <&sha_clk>; |
470 |
+ clock-names = "sha_clk"; |
471 |
+diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c |
472 |
+index cca5b8758185..f11d82527076 100644 |
473 |
+--- a/arch/arm/kernel/smp.c |
474 |
++++ b/arch/arm/kernel/smp.c |
475 |
+@@ -576,7 +576,7 @@ void handle_IPI(int ipinr, struct pt_regs *regs) |
476 |
+ struct pt_regs *old_regs = set_irq_regs(regs); |
477 |
+ |
478 |
+ if ((unsigned)ipinr < NR_IPI) { |
479 |
+- trace_ipi_entry(ipi_types[ipinr]); |
480 |
++ trace_ipi_entry_rcuidle(ipi_types[ipinr]); |
481 |
+ __inc_irq_stat(cpu, ipi_irqs[ipinr]); |
482 |
+ } |
483 |
+ |
484 |
+@@ -635,7 +635,7 @@ void handle_IPI(int ipinr, struct pt_regs *regs) |
485 |
+ } |
486 |
+ |
487 |
+ if ((unsigned)ipinr < NR_IPI) |
488 |
+- trace_ipi_exit(ipi_types[ipinr]); |
489 |
++ trace_ipi_exit_rcuidle(ipi_types[ipinr]); |
490 |
+ set_irq_regs(old_regs); |
491 |
+ } |
492 |
+ |
493 |
+diff --git a/arch/arm/mach-dove/include/mach/irqs.h b/arch/arm/mach-dove/include/mach/irqs.h |
494 |
+index 03d401d20453..3f29e6bca058 100644 |
495 |
+--- a/arch/arm/mach-dove/include/mach/irqs.h |
496 |
++++ b/arch/arm/mach-dove/include/mach/irqs.h |
497 |
+@@ -14,73 +14,73 @@ |
498 |
+ /* |
499 |
+ * Dove Low Interrupt Controller |
500 |
+ */ |
501 |
+-#define IRQ_DOVE_BRIDGE 0 |
502 |
+-#define IRQ_DOVE_H2C 1 |
503 |
+-#define IRQ_DOVE_C2H 2 |
504 |
+-#define IRQ_DOVE_NAND 3 |
505 |
+-#define IRQ_DOVE_PDMA 4 |
506 |
+-#define IRQ_DOVE_SPI1 5 |
507 |
+-#define IRQ_DOVE_SPI0 6 |
508 |
+-#define IRQ_DOVE_UART_0 7 |
509 |
+-#define IRQ_DOVE_UART_1 8 |
510 |
+-#define IRQ_DOVE_UART_2 9 |
511 |
+-#define IRQ_DOVE_UART_3 10 |
512 |
+-#define IRQ_DOVE_I2C 11 |
513 |
+-#define IRQ_DOVE_GPIO_0_7 12 |
514 |
+-#define IRQ_DOVE_GPIO_8_15 13 |
515 |
+-#define IRQ_DOVE_GPIO_16_23 14 |
516 |
+-#define IRQ_DOVE_PCIE0_ERR 15 |
517 |
+-#define IRQ_DOVE_PCIE0 16 |
518 |
+-#define IRQ_DOVE_PCIE1_ERR 17 |
519 |
+-#define IRQ_DOVE_PCIE1 18 |
520 |
+-#define IRQ_DOVE_I2S0 19 |
521 |
+-#define IRQ_DOVE_I2S0_ERR 20 |
522 |
+-#define IRQ_DOVE_I2S1 21 |
523 |
+-#define IRQ_DOVE_I2S1_ERR 22 |
524 |
+-#define IRQ_DOVE_USB_ERR 23 |
525 |
+-#define IRQ_DOVE_USB0 24 |
526 |
+-#define IRQ_DOVE_USB1 25 |
527 |
+-#define IRQ_DOVE_GE00_RX 26 |
528 |
+-#define IRQ_DOVE_GE00_TX 27 |
529 |
+-#define IRQ_DOVE_GE00_MISC 28 |
530 |
+-#define IRQ_DOVE_GE00_SUM 29 |
531 |
+-#define IRQ_DOVE_GE00_ERR 30 |
532 |
+-#define IRQ_DOVE_CRYPTO 31 |
533 |
++#define IRQ_DOVE_BRIDGE (1 + 0) |
534 |
++#define IRQ_DOVE_H2C (1 + 1) |
535 |
++#define IRQ_DOVE_C2H (1 + 2) |
536 |
++#define IRQ_DOVE_NAND (1 + 3) |
537 |
++#define IRQ_DOVE_PDMA (1 + 4) |
538 |
++#define IRQ_DOVE_SPI1 (1 + 5) |
539 |
++#define IRQ_DOVE_SPI0 (1 + 6) |
540 |
++#define IRQ_DOVE_UART_0 (1 + 7) |
541 |
++#define IRQ_DOVE_UART_1 (1 + 8) |
542 |
++#define IRQ_DOVE_UART_2 (1 + 9) |
543 |
++#define IRQ_DOVE_UART_3 (1 + 10) |
544 |
++#define IRQ_DOVE_I2C (1 + 11) |
545 |
++#define IRQ_DOVE_GPIO_0_7 (1 + 12) |
546 |
++#define IRQ_DOVE_GPIO_8_15 (1 + 13) |
547 |
++#define IRQ_DOVE_GPIO_16_23 (1 + 14) |
548 |
++#define IRQ_DOVE_PCIE0_ERR (1 + 15) |
549 |
++#define IRQ_DOVE_PCIE0 (1 + 16) |
550 |
++#define IRQ_DOVE_PCIE1_ERR (1 + 17) |
551 |
++#define IRQ_DOVE_PCIE1 (1 + 18) |
552 |
++#define IRQ_DOVE_I2S0 (1 + 19) |
553 |
++#define IRQ_DOVE_I2S0_ERR (1 + 20) |
554 |
++#define IRQ_DOVE_I2S1 (1 + 21) |
555 |
++#define IRQ_DOVE_I2S1_ERR (1 + 22) |
556 |
++#define IRQ_DOVE_USB_ERR (1 + 23) |
557 |
++#define IRQ_DOVE_USB0 (1 + 24) |
558 |
++#define IRQ_DOVE_USB1 (1 + 25) |
559 |
++#define IRQ_DOVE_GE00_RX (1 + 26) |
560 |
++#define IRQ_DOVE_GE00_TX (1 + 27) |
561 |
++#define IRQ_DOVE_GE00_MISC (1 + 28) |
562 |
++#define IRQ_DOVE_GE00_SUM (1 + 29) |
563 |
++#define IRQ_DOVE_GE00_ERR (1 + 30) |
564 |
++#define IRQ_DOVE_CRYPTO (1 + 31) |
565 |
+ |
566 |
+ /* |
567 |
+ * Dove High Interrupt Controller |
568 |
+ */ |
569 |
+-#define IRQ_DOVE_AC97 32 |
570 |
+-#define IRQ_DOVE_PMU 33 |
571 |
+-#define IRQ_DOVE_CAM 34 |
572 |
+-#define IRQ_DOVE_SDIO0 35 |
573 |
+-#define IRQ_DOVE_SDIO1 36 |
574 |
+-#define IRQ_DOVE_SDIO0_WAKEUP 37 |
575 |
+-#define IRQ_DOVE_SDIO1_WAKEUP 38 |
576 |
+-#define IRQ_DOVE_XOR_00 39 |
577 |
+-#define IRQ_DOVE_XOR_01 40 |
578 |
+-#define IRQ_DOVE_XOR0_ERR 41 |
579 |
+-#define IRQ_DOVE_XOR_10 42 |
580 |
+-#define IRQ_DOVE_XOR_11 43 |
581 |
+-#define IRQ_DOVE_XOR1_ERR 44 |
582 |
+-#define IRQ_DOVE_LCD_DCON 45 |
583 |
+-#define IRQ_DOVE_LCD1 46 |
584 |
+-#define IRQ_DOVE_LCD0 47 |
585 |
+-#define IRQ_DOVE_GPU 48 |
586 |
+-#define IRQ_DOVE_PERFORM_MNTR 49 |
587 |
+-#define IRQ_DOVE_VPRO_DMA1 51 |
588 |
+-#define IRQ_DOVE_SSP_TIMER 54 |
589 |
+-#define IRQ_DOVE_SSP 55 |
590 |
+-#define IRQ_DOVE_MC_L2_ERR 56 |
591 |
+-#define IRQ_DOVE_CRYPTO_ERR 59 |
592 |
+-#define IRQ_DOVE_GPIO_24_31 60 |
593 |
+-#define IRQ_DOVE_HIGH_GPIO 61 |
594 |
+-#define IRQ_DOVE_SATA 62 |
595 |
++#define IRQ_DOVE_AC97 (1 + 32) |
596 |
++#define IRQ_DOVE_PMU (1 + 33) |
597 |
++#define IRQ_DOVE_CAM (1 + 34) |
598 |
++#define IRQ_DOVE_SDIO0 (1 + 35) |
599 |
++#define IRQ_DOVE_SDIO1 (1 + 36) |
600 |
++#define IRQ_DOVE_SDIO0_WAKEUP (1 + 37) |
601 |
++#define IRQ_DOVE_SDIO1_WAKEUP (1 + 38) |
602 |
++#define IRQ_DOVE_XOR_00 (1 + 39) |
603 |
++#define IRQ_DOVE_XOR_01 (1 + 40) |
604 |
++#define IRQ_DOVE_XOR0_ERR (1 + 41) |
605 |
++#define IRQ_DOVE_XOR_10 (1 + 42) |
606 |
++#define IRQ_DOVE_XOR_11 (1 + 43) |
607 |
++#define IRQ_DOVE_XOR1_ERR (1 + 44) |
608 |
++#define IRQ_DOVE_LCD_DCON (1 + 45) |
609 |
++#define IRQ_DOVE_LCD1 (1 + 46) |
610 |
++#define IRQ_DOVE_LCD0 (1 + 47) |
611 |
++#define IRQ_DOVE_GPU (1 + 48) |
612 |
++#define IRQ_DOVE_PERFORM_MNTR (1 + 49) |
613 |
++#define IRQ_DOVE_VPRO_DMA1 (1 + 51) |
614 |
++#define IRQ_DOVE_SSP_TIMER (1 + 54) |
615 |
++#define IRQ_DOVE_SSP (1 + 55) |
616 |
++#define IRQ_DOVE_MC_L2_ERR (1 + 56) |
617 |
++#define IRQ_DOVE_CRYPTO_ERR (1 + 59) |
618 |
++#define IRQ_DOVE_GPIO_24_31 (1 + 60) |
619 |
++#define IRQ_DOVE_HIGH_GPIO (1 + 61) |
620 |
++#define IRQ_DOVE_SATA (1 + 62) |
621 |
+ |
622 |
+ /* |
623 |
+ * DOVE General Purpose Pins |
624 |
+ */ |
625 |
+-#define IRQ_DOVE_GPIO_START 64 |
626 |
++#define IRQ_DOVE_GPIO_START 65 |
627 |
+ #define NR_GPIO_IRQS 64 |
628 |
+ |
629 |
+ /* |
630 |
+diff --git a/arch/arm/mach-dove/irq.c b/arch/arm/mach-dove/irq.c |
631 |
+index 4a5a7aedcb76..df0223f76fa9 100644 |
632 |
+--- a/arch/arm/mach-dove/irq.c |
633 |
++++ b/arch/arm/mach-dove/irq.c |
634 |
+@@ -126,14 +126,14 @@ __exception_irq_entry dove_legacy_handle_irq(struct pt_regs *regs) |
635 |
+ stat = readl_relaxed(dove_irq_base + IRQ_CAUSE_LOW_OFF); |
636 |
+ stat &= readl_relaxed(dove_irq_base + IRQ_MASK_LOW_OFF); |
637 |
+ if (stat) { |
638 |
+- unsigned int hwirq = __fls(stat); |
639 |
++ unsigned int hwirq = 1 + __fls(stat); |
640 |
+ handle_IRQ(hwirq, regs); |
641 |
+ return; |
642 |
+ } |
643 |
+ stat = readl_relaxed(dove_irq_base + IRQ_CAUSE_HIGH_OFF); |
644 |
+ stat &= readl_relaxed(dove_irq_base + IRQ_MASK_HIGH_OFF); |
645 |
+ if (stat) { |
646 |
+- unsigned int hwirq = 32 + __fls(stat); |
647 |
++ unsigned int hwirq = 33 + __fls(stat); |
648 |
+ handle_IRQ(hwirq, regs); |
649 |
+ return; |
650 |
+ } |
651 |
+@@ -144,8 +144,8 @@ void __init dove_init_irq(void) |
652 |
+ { |
653 |
+ int i; |
654 |
+ |
655 |
+- orion_irq_init(0, IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF); |
656 |
+- orion_irq_init(32, IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF); |
657 |
++ orion_irq_init(1, IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF); |
658 |
++ orion_irq_init(33, IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF); |
659 |
+ |
660 |
+ #ifdef CONFIG_MULTI_IRQ_HANDLER |
661 |
+ set_handle_irq(dove_legacy_handle_irq); |
662 |
+diff --git a/arch/arm/vdso/vdsomunge.c b/arch/arm/vdso/vdsomunge.c |
663 |
+index 9005b07296c8..aedec81d1198 100644 |
664 |
+--- a/arch/arm/vdso/vdsomunge.c |
665 |
++++ b/arch/arm/vdso/vdsomunge.c |
666 |
+@@ -45,13 +45,11 @@ |
667 |
+ * it does. |
668 |
+ */ |
669 |
+ |
670 |
+-#define _GNU_SOURCE |
671 |
+- |
672 |
+ #include <byteswap.h> |
673 |
+ #include <elf.h> |
674 |
+ #include <errno.h> |
675 |
+-#include <error.h> |
676 |
+ #include <fcntl.h> |
677 |
++#include <stdarg.h> |
678 |
+ #include <stdbool.h> |
679 |
+ #include <stdio.h> |
680 |
+ #include <stdlib.h> |
681 |
+@@ -82,11 +80,25 @@ |
682 |
+ #define EF_ARM_ABI_FLOAT_HARD 0x400 |
683 |
+ #endif |
684 |
+ |
685 |
++static int failed; |
686 |
++static const char *argv0; |
687 |
+ static const char *outfile; |
688 |
+ |
689 |
++static void fail(const char *fmt, ...) |
690 |
++{ |
691 |
++ va_list ap; |
692 |
++ |
693 |
++ failed = 1; |
694 |
++ fprintf(stderr, "%s: ", argv0); |
695 |
++ va_start(ap, fmt); |
696 |
++ vfprintf(stderr, fmt, ap); |
697 |
++ va_end(ap); |
698 |
++ exit(EXIT_FAILURE); |
699 |
++} |
700 |
++ |
701 |
+ static void cleanup(void) |
702 |
+ { |
703 |
+- if (error_message_count > 0 && outfile != NULL) |
704 |
++ if (failed && outfile != NULL) |
705 |
+ unlink(outfile); |
706 |
+ } |
707 |
+ |
708 |
+@@ -119,68 +131,66 @@ int main(int argc, char **argv) |
709 |
+ int infd; |
710 |
+ |
711 |
+ atexit(cleanup); |
712 |
++ argv0 = argv[0]; |
713 |
+ |
714 |
+ if (argc != 3) |
715 |
+- error(EXIT_FAILURE, 0, "Usage: %s [infile] [outfile]", argv[0]); |
716 |
++ fail("Usage: %s [infile] [outfile]\n", argv[0]); |
717 |
+ |
718 |
+ infile = argv[1]; |
719 |
+ outfile = argv[2]; |
720 |
+ |
721 |
+ infd = open(infile, O_RDONLY); |
722 |
+ if (infd < 0) |
723 |
+- error(EXIT_FAILURE, errno, "Cannot open %s", infile); |
724 |
++ fail("Cannot open %s: %s\n", infile, strerror(errno)); |
725 |
+ |
726 |
+ if (fstat(infd, &stat) != 0) |
727 |
+- error(EXIT_FAILURE, errno, "Failed stat for %s", infile); |
728 |
++ fail("Failed stat for %s: %s\n", infile, strerror(errno)); |
729 |
+ |
730 |
+ inbuf = mmap(NULL, stat.st_size, PROT_READ, MAP_PRIVATE, infd, 0); |
731 |
+ if (inbuf == MAP_FAILED) |
732 |
+- error(EXIT_FAILURE, errno, "Failed to map %s", infile); |
733 |
++ fail("Failed to map %s: %s\n", infile, strerror(errno)); |
734 |
+ |
735 |
+ close(infd); |
736 |
+ |
737 |
+ inhdr = inbuf; |
738 |
+ |
739 |
+ if (memcmp(&inhdr->e_ident, ELFMAG, SELFMAG) != 0) |
740 |
+- error(EXIT_FAILURE, 0, "Not an ELF file"); |
741 |
++ fail("Not an ELF file\n"); |
742 |
+ |
743 |
+ if (inhdr->e_ident[EI_CLASS] != ELFCLASS32) |
744 |
+- error(EXIT_FAILURE, 0, "Unsupported ELF class"); |
745 |
++ fail("Unsupported ELF class\n"); |
746 |
+ |
747 |
+ swap = inhdr->e_ident[EI_DATA] != HOST_ORDER; |
748 |
+ |
749 |
+ if (read_elf_half(inhdr->e_type, swap) != ET_DYN) |
750 |
+- error(EXIT_FAILURE, 0, "Not a shared object"); |
751 |
++ fail("Not a shared object\n"); |
752 |
+ |
753 |
+- if (read_elf_half(inhdr->e_machine, swap) != EM_ARM) { |
754 |
+- error(EXIT_FAILURE, 0, "Unsupported architecture %#x", |
755 |
+- inhdr->e_machine); |
756 |
+- } |
757 |
++ if (read_elf_half(inhdr->e_machine, swap) != EM_ARM) |
758 |
++ fail("Unsupported architecture %#x\n", inhdr->e_machine); |
759 |
+ |
760 |
+ e_flags = read_elf_word(inhdr->e_flags, swap); |
761 |
+ |
762 |
+ if (EF_ARM_EABI_VERSION(e_flags) != EF_ARM_EABI_VER5) { |
763 |
+- error(EXIT_FAILURE, 0, "Unsupported EABI version %#x", |
764 |
+- EF_ARM_EABI_VERSION(e_flags)); |
765 |
++ fail("Unsupported EABI version %#x\n", |
766 |
++ EF_ARM_EABI_VERSION(e_flags)); |
767 |
+ } |
768 |
+ |
769 |
+ if (e_flags & EF_ARM_ABI_FLOAT_HARD) |
770 |
+- error(EXIT_FAILURE, 0, |
771 |
+- "Unexpected hard-float flag set in e_flags"); |
772 |
++ fail("Unexpected hard-float flag set in e_flags\n"); |
773 |
+ |
774 |
+ clear_soft_float = !!(e_flags & EF_ARM_ABI_FLOAT_SOFT); |
775 |
+ |
776 |
+ outfd = open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); |
777 |
+ if (outfd < 0) |
778 |
+- error(EXIT_FAILURE, errno, "Cannot open %s", outfile); |
779 |
++ fail("Cannot open %s: %s\n", outfile, strerror(errno)); |
780 |
+ |
781 |
+ if (ftruncate(outfd, stat.st_size) != 0) |
782 |
+- error(EXIT_FAILURE, errno, "Cannot truncate %s", outfile); |
783 |
++ fail("Cannot truncate %s: %s\n", outfile, strerror(errno)); |
784 |
+ |
785 |
+ outbuf = mmap(NULL, stat.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, |
786 |
+ outfd, 0); |
787 |
+ if (outbuf == MAP_FAILED) |
788 |
+- error(EXIT_FAILURE, errno, "Failed to map %s", outfile); |
789 |
++ fail("Failed to map %s: %s\n", outfile, strerror(errno)); |
790 |
+ |
791 |
+ close(outfd); |
792 |
+ |
793 |
+@@ -195,7 +205,7 @@ int main(int argc, char **argv) |
794 |
+ } |
795 |
+ |
796 |
+ if (msync(outbuf, stat.st_size, MS_SYNC) != 0) |
797 |
+- error(EXIT_FAILURE, errno, "Failed to sync %s", outfile); |
798 |
++ fail("Failed to sync %s: %s\n", outfile, strerror(errno)); |
799 |
+ |
800 |
+ return EXIT_SUCCESS; |
801 |
+ } |
802 |
+diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c |
803 |
+index 2cb008177252..d3a202b85ba6 100644 |
804 |
+--- a/arch/arm64/kernel/smp.c |
805 |
++++ b/arch/arm64/kernel/smp.c |
806 |
+@@ -569,7 +569,7 @@ void handle_IPI(int ipinr, struct pt_regs *regs) |
807 |
+ struct pt_regs *old_regs = set_irq_regs(regs); |
808 |
+ |
809 |
+ if ((unsigned)ipinr < NR_IPI) { |
810 |
+- trace_ipi_entry(ipi_types[ipinr]); |
811 |
++ trace_ipi_entry_rcuidle(ipi_types[ipinr]); |
812 |
+ __inc_irq_stat(cpu, ipi_irqs[ipinr]); |
813 |
+ } |
814 |
+ |
815 |
+@@ -612,7 +612,7 @@ void handle_IPI(int ipinr, struct pt_regs *regs) |
816 |
+ } |
817 |
+ |
818 |
+ if ((unsigned)ipinr < NR_IPI) |
819 |
+- trace_ipi_exit(ipi_types[ipinr]); |
820 |
++ trace_ipi_exit_rcuidle(ipi_types[ipinr]); |
821 |
+ set_irq_regs(old_regs); |
822 |
+ } |
823 |
+ |
824 |
+diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c |
825 |
+index 2de9d2e59d96..0eeb4f0930a0 100644 |
826 |
+--- a/arch/arm64/mm/hugetlbpage.c |
827 |
++++ b/arch/arm64/mm/hugetlbpage.c |
828 |
+@@ -40,13 +40,13 @@ int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep) |
829 |
+ |
830 |
+ int pmd_huge(pmd_t pmd) |
831 |
+ { |
832 |
+- return !(pmd_val(pmd) & PMD_TABLE_BIT); |
833 |
++ return pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT); |
834 |
+ } |
835 |
+ |
836 |
+ int pud_huge(pud_t pud) |
837 |
+ { |
838 |
+ #ifndef __PAGETABLE_PMD_FOLDED |
839 |
+- return !(pud_val(pud) & PUD_TABLE_BIT); |
840 |
++ return pud_val(pud) && !(pud_val(pud) & PUD_TABLE_BIT); |
841 |
+ #else |
842 |
+ return 0; |
843 |
+ #endif |
844 |
+diff --git a/arch/arm64/net/bpf_jit.h b/arch/arm64/net/bpf_jit.h |
845 |
+index de0a81a539a0..98a26ce82d26 100644 |
846 |
+--- a/arch/arm64/net/bpf_jit.h |
847 |
++++ b/arch/arm64/net/bpf_jit.h |
848 |
+@@ -110,6 +110,10 @@ |
849 |
+ /* Rd = Rn >> shift; signed */ |
850 |
+ #define A64_ASR(sf, Rd, Rn, shift) A64_SBFM(sf, Rd, Rn, shift, (sf) ? 63 : 31) |
851 |
+ |
852 |
++/* Zero extend */ |
853 |
++#define A64_UXTH(sf, Rd, Rn) A64_UBFM(sf, Rd, Rn, 0, 15) |
854 |
++#define A64_UXTW(sf, Rd, Rn) A64_UBFM(sf, Rd, Rn, 0, 31) |
855 |
++ |
856 |
+ /* Move wide (immediate) */ |
857 |
+ #define A64_MOVEW(sf, Rd, imm16, shift, type) \ |
858 |
+ aarch64_insn_gen_movewide(Rd, imm16, shift, \ |
859 |
+diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c |
860 |
+index dc6a4842683a..c047598b09e0 100644 |
861 |
+--- a/arch/arm64/net/bpf_jit_comp.c |
862 |
++++ b/arch/arm64/net/bpf_jit_comp.c |
863 |
+@@ -113,9 +113,9 @@ static inline void emit_a64_mov_i(const int is64, const int reg, |
864 |
+ static inline int bpf2a64_offset(int bpf_to, int bpf_from, |
865 |
+ const struct jit_ctx *ctx) |
866 |
+ { |
867 |
+- int to = ctx->offset[bpf_to + 1]; |
868 |
++ int to = ctx->offset[bpf_to]; |
869 |
+ /* -1 to account for the Branch instruction */ |
870 |
+- int from = ctx->offset[bpf_from + 1] - 1; |
871 |
++ int from = ctx->offset[bpf_from] - 1; |
872 |
+ |
873 |
+ return to - from; |
874 |
+ } |
875 |
+@@ -289,23 +289,41 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx) |
876 |
+ case BPF_ALU | BPF_END | BPF_FROM_BE: |
877 |
+ #ifdef CONFIG_CPU_BIG_ENDIAN |
878 |
+ if (BPF_SRC(code) == BPF_FROM_BE) |
879 |
+- break; |
880 |
++ goto emit_bswap_uxt; |
881 |
+ #else /* !CONFIG_CPU_BIG_ENDIAN */ |
882 |
+ if (BPF_SRC(code) == BPF_FROM_LE) |
883 |
+- break; |
884 |
++ goto emit_bswap_uxt; |
885 |
+ #endif |
886 |
+ switch (imm) { |
887 |
+ case 16: |
888 |
+ emit(A64_REV16(is64, dst, dst), ctx); |
889 |
++ /* zero-extend 16 bits into 64 bits */ |
890 |
++ emit(A64_UXTH(is64, dst, dst), ctx); |
891 |
+ break; |
892 |
+ case 32: |
893 |
+ emit(A64_REV32(is64, dst, dst), ctx); |
894 |
++ /* upper 32 bits already cleared */ |
895 |
+ break; |
896 |
+ case 64: |
897 |
+ emit(A64_REV64(dst, dst), ctx); |
898 |
+ break; |
899 |
+ } |
900 |
+ break; |
901 |
++emit_bswap_uxt: |
902 |
++ switch (imm) { |
903 |
++ case 16: |
904 |
++ /* zero-extend 16 bits into 64 bits */ |
905 |
++ emit(A64_UXTH(is64, dst, dst), ctx); |
906 |
++ break; |
907 |
++ case 32: |
908 |
++ /* zero-extend 32 bits into 64 bits */ |
909 |
++ emit(A64_UXTW(is64, dst, dst), ctx); |
910 |
++ break; |
911 |
++ case 64: |
912 |
++ /* nop */ |
913 |
++ break; |
914 |
++ } |
915 |
++ break; |
916 |
+ /* dst = imm */ |
917 |
+ case BPF_ALU | BPF_MOV | BPF_K: |
918 |
+ case BPF_ALU64 | BPF_MOV | BPF_K: |
919 |
+@@ -640,10 +658,11 @@ static int build_body(struct jit_ctx *ctx) |
920 |
+ const struct bpf_insn *insn = &prog->insnsi[i]; |
921 |
+ int ret; |
922 |
+ |
923 |
++ ret = build_insn(insn, ctx); |
924 |
++ |
925 |
+ if (ctx->image == NULL) |
926 |
+ ctx->offset[i] = ctx->idx; |
927 |
+ |
928 |
+- ret = build_insn(insn, ctx); |
929 |
+ if (ret > 0) { |
930 |
+ i++; |
931 |
+ continue; |
932 |
+diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu |
933 |
+index 33013dfcd3e1..5c68c85d5dbe 100644 |
934 |
+--- a/arch/m68k/Kconfig.cpu |
935 |
++++ b/arch/m68k/Kconfig.cpu |
936 |
+@@ -125,6 +125,13 @@ endif # M68KCLASSIC |
937 |
+ |
938 |
+ if COLDFIRE |
939 |
+ |
940 |
++choice |
941 |
++ prompt "ColdFire SoC type" |
942 |
++ default M520x |
943 |
++ help |
944 |
++ Select the type of ColdFire System-on-Chip (SoC) that you want |
945 |
++ to build for. |
946 |
++ |
947 |
+ config M5206 |
948 |
+ bool "MCF5206" |
949 |
+ depends on !MMU |
950 |
+@@ -174,9 +181,6 @@ config M525x |
951 |
+ help |
952 |
+ Freescale (Motorola) Coldfire 5251/5253 processor support. |
953 |
+ |
954 |
+-config M527x |
955 |
+- bool |
956 |
+- |
957 |
+ config M5271 |
958 |
+ bool "MCF5271" |
959 |
+ depends on !MMU |
960 |
+@@ -223,9 +227,6 @@ config M5307 |
961 |
+ help |
962 |
+ Motorola ColdFire 5307 processor support. |
963 |
+ |
964 |
+-config M53xx |
965 |
+- bool |
966 |
+- |
967 |
+ config M532x |
968 |
+ bool "MCF532x" |
969 |
+ depends on !MMU |
970 |
+@@ -251,9 +252,6 @@ config M5407 |
971 |
+ help |
972 |
+ Motorola ColdFire 5407 processor support. |
973 |
+ |
974 |
+-config M54xx |
975 |
+- bool |
976 |
+- |
977 |
+ config M547x |
978 |
+ bool "MCF547x" |
979 |
+ select M54xx |
980 |
+@@ -280,6 +278,17 @@ config M5441x |
981 |
+ help |
982 |
+ Freescale Coldfire 54410/54415/54416/54417/54418 processor support. |
983 |
+ |
984 |
++endchoice |
985 |
++ |
986 |
++config M527x |
987 |
++ bool |
988 |
++ |
989 |
++config M53xx |
990 |
++ bool |
991 |
++ |
992 |
++config M54xx |
993 |
++ bool |
994 |
++ |
995 |
+ endif # COLDFIRE |
996 |
+ |
997 |
+ |
998 |
+@@ -416,22 +425,10 @@ config HAVE_MBAR |
999 |
+ config HAVE_IPSBAR |
1000 |
+ bool |
1001 |
+ |
1002 |
+-config CLOCK_SET |
1003 |
+- bool "Enable setting the CPU clock frequency" |
1004 |
+- depends on COLDFIRE |
1005 |
+- default n |
1006 |
+- help |
1007 |
+- On some CPU's you do not need to know what the core CPU clock |
1008 |
+- frequency is. On these you can disable clock setting. On some |
1009 |
+- traditional 68K parts, and on all ColdFire parts you need to set |
1010 |
+- the appropriate CPU clock frequency. On these devices many of the |
1011 |
+- onboard peripherals derive their timing from the master CPU clock |
1012 |
+- frequency. |
1013 |
+- |
1014 |
+ config CLOCK_FREQ |
1015 |
+ int "Set the core clock frequency" |
1016 |
+ default "66666666" |
1017 |
+- depends on CLOCK_SET |
1018 |
++ depends on COLDFIRE |
1019 |
+ help |
1020 |
+ Define the CPU clock frequency in use. This is the core clock |
1021 |
+ frequency, it may or may not be the same as the external clock |
1022 |
+diff --git a/arch/m68k/include/asm/coldfire.h b/arch/m68k/include/asm/coldfire.h |
1023 |
+index c94557b91448..50aa4dac9ca2 100644 |
1024 |
+--- a/arch/m68k/include/asm/coldfire.h |
1025 |
++++ b/arch/m68k/include/asm/coldfire.h |
1026 |
+@@ -19,7 +19,7 @@ |
1027 |
+ * in any case new boards come along from time to time that have yet |
1028 |
+ * another different clocking frequency. |
1029 |
+ */ |
1030 |
+-#ifdef CONFIG_CLOCK_SET |
1031 |
++#ifdef CONFIG_CLOCK_FREQ |
1032 |
+ #define MCF_CLK CONFIG_CLOCK_FREQ |
1033 |
+ #else |
1034 |
+ #error "Don't know what your ColdFire CPU clock frequency is??" |
1035 |
+diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig |
1036 |
+index e5a693b16da2..443f44de1020 100644 |
1037 |
+--- a/arch/openrisc/Kconfig |
1038 |
++++ b/arch/openrisc/Kconfig |
1039 |
+@@ -17,6 +17,7 @@ config OPENRISC |
1040 |
+ select GENERIC_IRQ_SHOW |
1041 |
+ select GENERIC_IOMAP |
1042 |
+ select GENERIC_CPU_DEVICES |
1043 |
++ select HAVE_UID16 |
1044 |
+ select GENERIC_ATOMIC64 |
1045 |
+ select GENERIC_CLOCKEVENTS |
1046 |
+ select GENERIC_STRNCPY_FROM_USER |
1047 |
+@@ -31,9 +32,6 @@ config MMU |
1048 |
+ config HAVE_DMA_ATTRS |
1049 |
+ def_bool y |
1050 |
+ |
1051 |
+-config UID16 |
1052 |
+- def_bool y |
1053 |
+- |
1054 |
+ config RWSEM_GENERIC_SPINLOCK |
1055 |
+ def_bool y |
1056 |
+ |
1057 |
+diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c |
1058 |
+index 9d518d693b4b..844b06d67df4 100644 |
1059 |
+--- a/arch/x86/mm/mmap.c |
1060 |
++++ b/arch/x86/mm/mmap.c |
1061 |
+@@ -126,3 +126,10 @@ void arch_pick_mmap_layout(struct mm_struct *mm) |
1062 |
+ mm->get_unmapped_area = arch_get_unmapped_area_topdown; |
1063 |
+ } |
1064 |
+ } |
1065 |
++ |
1066 |
++const char *arch_vma_name(struct vm_area_struct *vma) |
1067 |
++{ |
1068 |
++ if (vma->vm_flags & VM_MPX) |
1069 |
++ return "[mpx]"; |
1070 |
++ return NULL; |
1071 |
++} |
1072 |
+diff --git a/arch/x86/mm/mpx.c b/arch/x86/mm/mpx.c |
1073 |
+index c439ec478216..4d1c11c07fe1 100644 |
1074 |
+--- a/arch/x86/mm/mpx.c |
1075 |
++++ b/arch/x86/mm/mpx.c |
1076 |
+@@ -18,26 +18,9 @@ |
1077 |
+ #include <asm/processor.h> |
1078 |
+ #include <asm/fpu-internal.h> |
1079 |
+ |
1080 |
+-static const char *mpx_mapping_name(struct vm_area_struct *vma) |
1081 |
+-{ |
1082 |
+- return "[mpx]"; |
1083 |
+-} |
1084 |
+- |
1085 |
+-static struct vm_operations_struct mpx_vma_ops = { |
1086 |
+- .name = mpx_mapping_name, |
1087 |
+-}; |
1088 |
+- |
1089 |
+-static int is_mpx_vma(struct vm_area_struct *vma) |
1090 |
+-{ |
1091 |
+- return (vma->vm_ops == &mpx_vma_ops); |
1092 |
+-} |
1093 |
+- |
1094 |
+ /* |
1095 |
+ * This is really a simplified "vm_mmap". it only handles MPX |
1096 |
+ * bounds tables (the bounds directory is user-allocated). |
1097 |
+- * |
1098 |
+- * Later on, we use the vma->vm_ops to uniquely identify these |
1099 |
+- * VMAs. |
1100 |
+ */ |
1101 |
+ static unsigned long mpx_mmap(unsigned long len) |
1102 |
+ { |
1103 |
+@@ -83,7 +66,6 @@ static unsigned long mpx_mmap(unsigned long len) |
1104 |
+ ret = -ENOMEM; |
1105 |
+ goto out; |
1106 |
+ } |
1107 |
+- vma->vm_ops = &mpx_vma_ops; |
1108 |
+ |
1109 |
+ if (vm_flags & VM_LOCKED) { |
1110 |
+ up_write(&mm->mmap_sem); |
1111 |
+@@ -661,7 +643,7 @@ static int zap_bt_entries(struct mm_struct *mm, |
1112 |
+ * so stop immediately and return an error. This |
1113 |
+ * probably results in a SIGSEGV. |
1114 |
+ */ |
1115 |
+- if (!is_mpx_vma(vma)) |
1116 |
++ if (!(vma->vm_flags & VM_MPX)) |
1117 |
+ return -EINVAL; |
1118 |
+ |
1119 |
+ len = min(vma->vm_end, end) - addr; |
1120 |
+diff --git a/block/bio.c b/block/bio.c |
1121 |
+index f66a4eae16ee..4441522ca339 100644 |
1122 |
+--- a/block/bio.c |
1123 |
++++ b/block/bio.c |
1124 |
+@@ -1814,8 +1814,9 @@ EXPORT_SYMBOL(bio_endio_nodec); |
1125 |
+ * Allocates and returns a new bio which represents @sectors from the start of |
1126 |
+ * @bio, and updates @bio to represent the remaining sectors. |
1127 |
+ * |
1128 |
+- * The newly allocated bio will point to @bio's bi_io_vec; it is the caller's |
1129 |
+- * responsibility to ensure that @bio is not freed before the split. |
1130 |
++ * Unless this is a discard request the newly allocated bio will point |
1131 |
++ * to @bio's bi_io_vec; it is the caller's responsibility to ensure that |
1132 |
++ * @bio is not freed before the split. |
1133 |
+ */ |
1134 |
+ struct bio *bio_split(struct bio *bio, int sectors, |
1135 |
+ gfp_t gfp, struct bio_set *bs) |
1136 |
+@@ -1825,7 +1826,15 @@ struct bio *bio_split(struct bio *bio, int sectors, |
1137 |
+ BUG_ON(sectors <= 0); |
1138 |
+ BUG_ON(sectors >= bio_sectors(bio)); |
1139 |
+ |
1140 |
+- split = bio_clone_fast(bio, gfp, bs); |
1141 |
++ /* |
1142 |
++ * Discards need a mutable bio_vec to accommodate the payload |
1143 |
++ * required by the DSM TRIM and UNMAP commands. |
1144 |
++ */ |
1145 |
++ if (bio->bi_rw & REQ_DISCARD) |
1146 |
++ split = bio_clone_bioset(bio, gfp, bs); |
1147 |
++ else |
1148 |
++ split = bio_clone_fast(bio, gfp, bs); |
1149 |
++ |
1150 |
+ if (!split) |
1151 |
+ return NULL; |
1152 |
+ |
1153 |
+diff --git a/crypto/asymmetric_keys/asymmetric_keys.h b/crypto/asymmetric_keys/asymmetric_keys.h |
1154 |
+index f97330886d58..3f5b537ab33e 100644 |
1155 |
+--- a/crypto/asymmetric_keys/asymmetric_keys.h |
1156 |
++++ b/crypto/asymmetric_keys/asymmetric_keys.h |
1157 |
+@@ -11,6 +11,9 @@ |
1158 |
+ |
1159 |
+ extern struct asymmetric_key_id *asymmetric_key_hex_to_key_id(const char *id); |
1160 |
+ |
1161 |
++extern int __asymmetric_key_hex_to_key_id(const char *id, |
1162 |
++ struct asymmetric_key_id *match_id, |
1163 |
++ size_t hexlen); |
1164 |
+ static inline |
1165 |
+ const struct asymmetric_key_ids *asymmetric_key_ids(const struct key *key) |
1166 |
+ { |
1167 |
+diff --git a/crypto/asymmetric_keys/asymmetric_type.c b/crypto/asymmetric_keys/asymmetric_type.c |
1168 |
+index bcbbbd794e1d..b0e4ed23d668 100644 |
1169 |
+--- a/crypto/asymmetric_keys/asymmetric_type.c |
1170 |
++++ b/crypto/asymmetric_keys/asymmetric_type.c |
1171 |
+@@ -104,6 +104,15 @@ static bool asymmetric_match_key_ids( |
1172 |
+ return false; |
1173 |
+ } |
1174 |
+ |
1175 |
++/* helper function can be called directly with pre-allocated memory */ |
1176 |
++inline int __asymmetric_key_hex_to_key_id(const char *id, |
1177 |
++ struct asymmetric_key_id *match_id, |
1178 |
++ size_t hexlen) |
1179 |
++{ |
1180 |
++ match_id->len = hexlen; |
1181 |
++ return hex2bin(match_id->data, id, hexlen); |
1182 |
++} |
1183 |
++ |
1184 |
+ /** |
1185 |
+ * asymmetric_key_hex_to_key_id - Convert a hex string into a key ID. |
1186 |
+ * @id: The ID as a hex string. |
1187 |
+@@ -111,21 +120,20 @@ static bool asymmetric_match_key_ids( |
1188 |
+ struct asymmetric_key_id *asymmetric_key_hex_to_key_id(const char *id) |
1189 |
+ { |
1190 |
+ struct asymmetric_key_id *match_id; |
1191 |
+- size_t hexlen; |
1192 |
++ size_t asciihexlen; |
1193 |
+ int ret; |
1194 |
+ |
1195 |
+ if (!*id) |
1196 |
+ return ERR_PTR(-EINVAL); |
1197 |
+- hexlen = strlen(id); |
1198 |
+- if (hexlen & 1) |
1199 |
++ asciihexlen = strlen(id); |
1200 |
++ if (asciihexlen & 1) |
1201 |
+ return ERR_PTR(-EINVAL); |
1202 |
+ |
1203 |
+- match_id = kmalloc(sizeof(struct asymmetric_key_id) + hexlen / 2, |
1204 |
++ match_id = kmalloc(sizeof(struct asymmetric_key_id) + asciihexlen / 2, |
1205 |
+ GFP_KERNEL); |
1206 |
+ if (!match_id) |
1207 |
+ return ERR_PTR(-ENOMEM); |
1208 |
+- match_id->len = hexlen / 2; |
1209 |
+- ret = hex2bin(match_id->data, id, hexlen / 2); |
1210 |
++ ret = __asymmetric_key_hex_to_key_id(id, match_id, asciihexlen / 2); |
1211 |
+ if (ret < 0) { |
1212 |
+ kfree(match_id); |
1213 |
+ return ERR_PTR(-EINVAL); |
1214 |
+diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c |
1215 |
+index a6c42031628e..24f17e6c5904 100644 |
1216 |
+--- a/crypto/asymmetric_keys/x509_public_key.c |
1217 |
++++ b/crypto/asymmetric_keys/x509_public_key.c |
1218 |
+@@ -28,17 +28,30 @@ static bool use_builtin_keys; |
1219 |
+ static struct asymmetric_key_id *ca_keyid; |
1220 |
+ |
1221 |
+ #ifndef MODULE |
1222 |
++static struct { |
1223 |
++ struct asymmetric_key_id id; |
1224 |
++ unsigned char data[10]; |
1225 |
++} cakey; |
1226 |
++ |
1227 |
+ static int __init ca_keys_setup(char *str) |
1228 |
+ { |
1229 |
+ if (!str) /* default system keyring */ |
1230 |
+ return 1; |
1231 |
+ |
1232 |
+ if (strncmp(str, "id:", 3) == 0) { |
1233 |
+- struct asymmetric_key_id *p; |
1234 |
+- p = asymmetric_key_hex_to_key_id(str + 3); |
1235 |
+- if (p == ERR_PTR(-EINVAL)) |
1236 |
+- pr_err("Unparsable hex string in ca_keys\n"); |
1237 |
+- else if (!IS_ERR(p)) |
1238 |
++ struct asymmetric_key_id *p = &cakey.id; |
1239 |
++ size_t hexlen = (strlen(str) - 3) / 2; |
1240 |
++ int ret; |
1241 |
++ |
1242 |
++ if (hexlen == 0 || hexlen > sizeof(cakey.data)) { |
1243 |
++ pr_err("Missing or invalid ca_keys id\n"); |
1244 |
++ return 1; |
1245 |
++ } |
1246 |
++ |
1247 |
++ ret = __asymmetric_key_hex_to_key_id(str + 3, p, hexlen); |
1248 |
++ if (ret < 0) |
1249 |
++ pr_err("Unparsable ca_keys id hex string\n"); |
1250 |
++ else |
1251 |
+ ca_keyid = p; /* owner key 'id:xxxxxx' */ |
1252 |
+ } else if (strcmp(str, "builtin") == 0) { |
1253 |
+ use_builtin_keys = true; |
1254 |
+diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c |
1255 |
+index 37fb19047603..73f056a597a9 100644 |
1256 |
+--- a/drivers/acpi/acpi_lpss.c |
1257 |
++++ b/drivers/acpi/acpi_lpss.c |
1258 |
+@@ -352,13 +352,16 @@ static int acpi_lpss_create_device(struct acpi_device *adev, |
1259 |
+ pdata->mmio_size = resource_size(rentry->res); |
1260 |
+ pdata->mmio_base = ioremap(rentry->res->start, |
1261 |
+ pdata->mmio_size); |
1262 |
+- if (!pdata->mmio_base) |
1263 |
+- goto err_out; |
1264 |
+ break; |
1265 |
+ } |
1266 |
+ |
1267 |
+ acpi_dev_free_resource_list(&resource_list); |
1268 |
+ |
1269 |
++ if (!pdata->mmio_base) { |
1270 |
++ ret = -ENOMEM; |
1271 |
++ goto err_out; |
1272 |
++ } |
1273 |
++ |
1274 |
+ pdata->dev_desc = dev_desc; |
1275 |
+ |
1276 |
+ if (dev_desc->setup) |
1277 |
+diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h |
1278 |
+index 87b27521fcac..7f50dd9eb1d0 100644 |
1279 |
+--- a/drivers/acpi/acpica/aclocal.h |
1280 |
++++ b/drivers/acpi/acpica/aclocal.h |
1281 |
+@@ -213,6 +213,7 @@ struct acpi_table_list { |
1282 |
+ |
1283 |
+ #define ACPI_TABLE_INDEX_DSDT (0) |
1284 |
+ #define ACPI_TABLE_INDEX_FACS (1) |
1285 |
++#define ACPI_TABLE_INDEX_X_FACS (2) |
1286 |
+ |
1287 |
+ struct acpi_find_context { |
1288 |
+ char *search_for; |
1289 |
+diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c |
1290 |
+index 7d2486005e3f..05be59c772c7 100644 |
1291 |
+--- a/drivers/acpi/acpica/tbfadt.c |
1292 |
++++ b/drivers/acpi/acpica/tbfadt.c |
1293 |
+@@ -350,9 +350,18 @@ void acpi_tb_parse_fadt(u32 table_index) |
1294 |
+ /* If Hardware Reduced flag is set, there is no FACS */ |
1295 |
+ |
1296 |
+ if (!acpi_gbl_reduced_hardware) { |
1297 |
+- acpi_tb_install_fixed_table((acpi_physical_address) |
1298 |
+- acpi_gbl_FADT.Xfacs, ACPI_SIG_FACS, |
1299 |
+- ACPI_TABLE_INDEX_FACS); |
1300 |
++ if (acpi_gbl_FADT.facs) { |
1301 |
++ acpi_tb_install_fixed_table((acpi_physical_address) |
1302 |
++ acpi_gbl_FADT.facs, |
1303 |
++ ACPI_SIG_FACS, |
1304 |
++ ACPI_TABLE_INDEX_FACS); |
1305 |
++ } |
1306 |
++ if (acpi_gbl_FADT.Xfacs) { |
1307 |
++ acpi_tb_install_fixed_table((acpi_physical_address) |
1308 |
++ acpi_gbl_FADT.Xfacs, |
1309 |
++ ACPI_SIG_FACS, |
1310 |
++ ACPI_TABLE_INDEX_X_FACS); |
1311 |
++ } |
1312 |
+ } |
1313 |
+ } |
1314 |
+ |
1315 |
+@@ -491,13 +500,9 @@ static void acpi_tb_convert_fadt(void) |
1316 |
+ acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt); |
1317 |
+ |
1318 |
+ /* |
1319 |
+- * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. |
1320 |
++ * Expand the 32-bit DSDT addresses to 64-bit as necessary. |
1321 |
+ * Later ACPICA code will always use the X 64-bit field. |
1322 |
+ */ |
1323 |
+- acpi_gbl_FADT.Xfacs = acpi_tb_select_address("FACS", |
1324 |
+- acpi_gbl_FADT.facs, |
1325 |
+- acpi_gbl_FADT.Xfacs); |
1326 |
+- |
1327 |
+ acpi_gbl_FADT.Xdsdt = acpi_tb_select_address("DSDT", |
1328 |
+ acpi_gbl_FADT.dsdt, |
1329 |
+ acpi_gbl_FADT.Xdsdt); |
1330 |
+diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c |
1331 |
+index 6559a58439c5..2fb1afaacc6d 100644 |
1332 |
+--- a/drivers/acpi/acpica/tbutils.c |
1333 |
++++ b/drivers/acpi/acpica/tbutils.c |
1334 |
+@@ -68,7 +68,8 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size); |
1335 |
+ |
1336 |
+ acpi_status acpi_tb_initialize_facs(void) |
1337 |
+ { |
1338 |
+- acpi_status status; |
1339 |
++ struct acpi_table_facs *facs32; |
1340 |
++ struct acpi_table_facs *facs64; |
1341 |
+ |
1342 |
+ /* If Hardware Reduced flag is set, there is no FACS */ |
1343 |
+ |
1344 |
+@@ -77,11 +78,22 @@ acpi_status acpi_tb_initialize_facs(void) |
1345 |
+ return (AE_OK); |
1346 |
+ } |
1347 |
+ |
1348 |
+- status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, |
1349 |
+- ACPI_CAST_INDIRECT_PTR(struct |
1350 |
+- acpi_table_header, |
1351 |
+- &acpi_gbl_FACS)); |
1352 |
+- return (status); |
1353 |
++ (void)acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, |
1354 |
++ ACPI_CAST_INDIRECT_PTR(struct |
1355 |
++ acpi_table_header, |
1356 |
++ &facs32)); |
1357 |
++ (void)acpi_get_table_by_index(ACPI_TABLE_INDEX_X_FACS, |
1358 |
++ ACPI_CAST_INDIRECT_PTR(struct |
1359 |
++ acpi_table_header, |
1360 |
++ &facs64)); |
1361 |
++ |
1362 |
++ if (acpi_gbl_use32_bit_facs_addresses) { |
1363 |
++ acpi_gbl_FACS = facs32 ? facs32 : facs64; |
1364 |
++ } else { |
1365 |
++ acpi_gbl_FACS = facs64 ? facs64 : facs32; |
1366 |
++ } |
1367 |
++ |
1368 |
++ return (AE_OK); |
1369 |
+ } |
1370 |
+ #endif /* !ACPI_REDUCED_HARDWARE */ |
1371 |
+ |
1372 |
+@@ -101,7 +113,7 @@ acpi_status acpi_tb_initialize_facs(void) |
1373 |
+ u8 acpi_tb_tables_loaded(void) |
1374 |
+ { |
1375 |
+ |
1376 |
+- if (acpi_gbl_root_table_list.current_table_count >= 3) { |
1377 |
++ if (acpi_gbl_root_table_list.current_table_count >= 4) { |
1378 |
+ return (TRUE); |
1379 |
+ } |
1380 |
+ |
1381 |
+@@ -357,11 +369,11 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) |
1382 |
+ table_entry = ACPI_ADD_PTR(u8, table, sizeof(struct acpi_table_header)); |
1383 |
+ |
1384 |
+ /* |
1385 |
+- * First two entries in the table array are reserved for the DSDT |
1386 |
+- * and FACS, which are not actually present in the RSDT/XSDT - they |
1387 |
+- * come from the FADT |
1388 |
++ * First three entries in the table array are reserved for the DSDT |
1389 |
++ * and 32bit/64bit FACS, which are not actually present in the |
1390 |
++ * RSDT/XSDT - they come from the FADT |
1391 |
+ */ |
1392 |
+- acpi_gbl_root_table_list.current_table_count = 2; |
1393 |
++ acpi_gbl_root_table_list.current_table_count = 3; |
1394 |
+ |
1395 |
+ /* Initialize the root table array from the RSDT/XSDT */ |
1396 |
+ |
1397 |
+diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c |
1398 |
+index aadb3002a2dd..b63e35d6d1bf 100644 |
1399 |
+--- a/drivers/acpi/acpica/tbxfload.c |
1400 |
++++ b/drivers/acpi/acpica/tbxfload.c |
1401 |
+@@ -166,7 +166,8 @@ static acpi_status acpi_tb_load_namespace(void) |
1402 |
+ |
1403 |
+ (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
1404 |
+ for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) { |
1405 |
+- if ((!ACPI_COMPARE_NAME |
1406 |
++ if (!acpi_gbl_root_table_list.tables[i].address || |
1407 |
++ (!ACPI_COMPARE_NAME |
1408 |
+ (&(acpi_gbl_root_table_list.tables[i].signature), |
1409 |
+ ACPI_SIG_SSDT) |
1410 |
+ && |
1411 |
+diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c |
1412 |
+index 083a76891889..42a32a66ef22 100644 |
1413 |
+--- a/drivers/acpi/acpica/utxfinit.c |
1414 |
++++ b/drivers/acpi/acpica/utxfinit.c |
1415 |
+@@ -179,10 +179,12 @@ acpi_status __init acpi_enable_subsystem(u32 flags) |
1416 |
+ * Obtain a permanent mapping for the FACS. This is required for the |
1417 |
+ * Global Lock and the Firmware Waking Vector |
1418 |
+ */ |
1419 |
+- status = acpi_tb_initialize_facs(); |
1420 |
+- if (ACPI_FAILURE(status)) { |
1421 |
+- ACPI_WARNING((AE_INFO, "Could not map the FACS table")); |
1422 |
+- return_ACPI_STATUS(status); |
1423 |
++ if (!(flags & ACPI_NO_FACS_INIT)) { |
1424 |
++ status = acpi_tb_initialize_facs(); |
1425 |
++ if (ACPI_FAILURE(status)) { |
1426 |
++ ACPI_WARNING((AE_INFO, "Could not map the FACS table")); |
1427 |
++ return_ACPI_STATUS(status); |
1428 |
++ } |
1429 |
+ } |
1430 |
+ #endif /* !ACPI_REDUCED_HARDWARE */ |
1431 |
+ |
1432 |
+diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c |
1433 |
+index 5226a8b921ae..98f5316aad72 100644 |
1434 |
+--- a/drivers/acpi/osl.c |
1435 |
++++ b/drivers/acpi/osl.c |
1436 |
+@@ -175,10 +175,14 @@ static void __init acpi_request_region (struct acpi_generic_address *gas, |
1437 |
+ if (!addr || !length) |
1438 |
+ return; |
1439 |
+ |
1440 |
+- acpi_reserve_region(addr, length, gas->space_id, 0, desc); |
1441 |
++ /* Resources are never freed */ |
1442 |
++ if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) |
1443 |
++ request_region(addr, length, desc); |
1444 |
++ else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) |
1445 |
++ request_mem_region(addr, length, desc); |
1446 |
+ } |
1447 |
+ |
1448 |
+-static void __init acpi_reserve_resources(void) |
1449 |
++static int __init acpi_reserve_resources(void) |
1450 |
+ { |
1451 |
+ acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length, |
1452 |
+ "ACPI PM1a_EVT_BLK"); |
1453 |
+@@ -207,7 +211,10 @@ static void __init acpi_reserve_resources(void) |
1454 |
+ if (!(acpi_gbl_FADT.gpe1_block_length & 0x1)) |
1455 |
+ acpi_request_region(&acpi_gbl_FADT.xgpe1_block, |
1456 |
+ acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK"); |
1457 |
++ |
1458 |
++ return 0; |
1459 |
+ } |
1460 |
++fs_initcall_sync(acpi_reserve_resources); |
1461 |
+ |
1462 |
+ void acpi_os_printf(const char *fmt, ...) |
1463 |
+ { |
1464 |
+@@ -1838,7 +1845,6 @@ acpi_status __init acpi_os_initialize(void) |
1465 |
+ |
1466 |
+ acpi_status __init acpi_os_initialize1(void) |
1467 |
+ { |
1468 |
+- acpi_reserve_resources(); |
1469 |
+ kacpid_wq = alloc_workqueue("kacpid", 0, 1); |
1470 |
+ kacpi_notify_wq = alloc_workqueue("kacpi_notify", 0, 1); |
1471 |
+ kacpi_hotplug_wq = alloc_ordered_workqueue("kacpi_hotplug", 0); |
1472 |
+diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c |
1473 |
+index fcb7807ea8b7..f1c966e05078 100644 |
1474 |
+--- a/drivers/acpi/resource.c |
1475 |
++++ b/drivers/acpi/resource.c |
1476 |
+@@ -26,7 +26,6 @@ |
1477 |
+ #include <linux/device.h> |
1478 |
+ #include <linux/export.h> |
1479 |
+ #include <linux/ioport.h> |
1480 |
+-#include <linux/list.h> |
1481 |
+ #include <linux/slab.h> |
1482 |
+ |
1483 |
+ #ifdef CONFIG_X86 |
1484 |
+@@ -194,6 +193,7 @@ static bool acpi_decode_space(struct resource_win *win, |
1485 |
+ u8 iodec = attr->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16; |
1486 |
+ bool wp = addr->info.mem.write_protect; |
1487 |
+ u64 len = attr->address_length; |
1488 |
++ u64 start, end, offset = 0; |
1489 |
+ struct resource *res = &win->res; |
1490 |
+ |
1491 |
+ /* |
1492 |
+@@ -205,9 +205,6 @@ static bool acpi_decode_space(struct resource_win *win, |
1493 |
+ pr_debug("ACPI: Invalid address space min_addr_fix %d, max_addr_fix %d, len %llx\n", |
1494 |
+ addr->min_address_fixed, addr->max_address_fixed, len); |
1495 |
+ |
1496 |
+- res->start = attr->minimum; |
1497 |
+- res->end = attr->maximum; |
1498 |
+- |
1499 |
+ /* |
1500 |
+ * For bridges that translate addresses across the bridge, |
1501 |
+ * translation_offset is the offset that must be added to the |
1502 |
+@@ -215,12 +212,22 @@ static bool acpi_decode_space(struct resource_win *win, |
1503 |
+ * primary side. Non-bridge devices must list 0 for all Address |
1504 |
+ * Translation offset bits. |
1505 |
+ */ |
1506 |
+- if (addr->producer_consumer == ACPI_PRODUCER) { |
1507 |
+- res->start += attr->translation_offset; |
1508 |
+- res->end += attr->translation_offset; |
1509 |
+- } else if (attr->translation_offset) { |
1510 |
++ if (addr->producer_consumer == ACPI_PRODUCER) |
1511 |
++ offset = attr->translation_offset; |
1512 |
++ else if (attr->translation_offset) |
1513 |
+ pr_debug("ACPI: translation_offset(%lld) is invalid for non-bridge device.\n", |
1514 |
+ attr->translation_offset); |
1515 |
++ start = attr->minimum + offset; |
1516 |
++ end = attr->maximum + offset; |
1517 |
++ |
1518 |
++ win->offset = offset; |
1519 |
++ res->start = start; |
1520 |
++ res->end = end; |
1521 |
++ if (sizeof(resource_size_t) < sizeof(u64) && |
1522 |
++ (offset != win->offset || start != res->start || end != res->end)) { |
1523 |
++ pr_warn("acpi resource window ([%#llx-%#llx] ignored, not CPU addressable)\n", |
1524 |
++ attr->minimum, attr->maximum); |
1525 |
++ return false; |
1526 |
+ } |
1527 |
+ |
1528 |
+ switch (addr->resource_type) { |
1529 |
+@@ -237,8 +244,6 @@ static bool acpi_decode_space(struct resource_win *win, |
1530 |
+ return false; |
1531 |
+ } |
1532 |
+ |
1533 |
+- win->offset = attr->translation_offset; |
1534 |
+- |
1535 |
+ if (addr->producer_consumer == ACPI_PRODUCER) |
1536 |
+ res->flags |= IORESOURCE_WINDOW; |
1537 |
+ |
1538 |
+@@ -622,162 +627,3 @@ int acpi_dev_filter_resource_type(struct acpi_resource *ares, |
1539 |
+ return (type & types) ? 0 : 1; |
1540 |
+ } |
1541 |
+ EXPORT_SYMBOL_GPL(acpi_dev_filter_resource_type); |
1542 |
+- |
1543 |
+-struct reserved_region { |
1544 |
+- struct list_head node; |
1545 |
+- u64 start; |
1546 |
+- u64 end; |
1547 |
+-}; |
1548 |
+- |
1549 |
+-static LIST_HEAD(reserved_io_regions); |
1550 |
+-static LIST_HEAD(reserved_mem_regions); |
1551 |
+- |
1552 |
+-static int request_range(u64 start, u64 end, u8 space_id, unsigned long flags, |
1553 |
+- char *desc) |
1554 |
+-{ |
1555 |
+- unsigned int length = end - start + 1; |
1556 |
+- struct resource *res; |
1557 |
+- |
1558 |
+- res = space_id == ACPI_ADR_SPACE_SYSTEM_IO ? |
1559 |
+- request_region(start, length, desc) : |
1560 |
+- request_mem_region(start, length, desc); |
1561 |
+- if (!res) |
1562 |
+- return -EIO; |
1563 |
+- |
1564 |
+- res->flags &= ~flags; |
1565 |
+- return 0; |
1566 |
+-} |
1567 |
+- |
1568 |
+-static int add_region_before(u64 start, u64 end, u8 space_id, |
1569 |
+- unsigned long flags, char *desc, |
1570 |
+- struct list_head *head) |
1571 |
+-{ |
1572 |
+- struct reserved_region *reg; |
1573 |
+- int error; |
1574 |
+- |
1575 |
+- reg = kmalloc(sizeof(*reg), GFP_KERNEL); |
1576 |
+- if (!reg) |
1577 |
+- return -ENOMEM; |
1578 |
+- |
1579 |
+- error = request_range(start, end, space_id, flags, desc); |
1580 |
+- if (error) |
1581 |
+- return error; |
1582 |
+- |
1583 |
+- reg->start = start; |
1584 |
+- reg->end = end; |
1585 |
+- list_add_tail(®->node, head); |
1586 |
+- return 0; |
1587 |
+-} |
1588 |
+- |
1589 |
+-/** |
1590 |
+- * acpi_reserve_region - Reserve an I/O or memory region as a system resource. |
1591 |
+- * @start: Starting address of the region. |
1592 |
+- * @length: Length of the region. |
1593 |
+- * @space_id: Identifier of address space to reserve the region from. |
1594 |
+- * @flags: Resource flags to clear for the region after requesting it. |
1595 |
+- * @desc: Region description (for messages). |
1596 |
+- * |
1597 |
+- * Reserve an I/O or memory region as a system resource to prevent others from |
1598 |
+- * using it. If the new region overlaps with one of the regions (in the given |
1599 |
+- * address space) already reserved by this routine, only the non-overlapping |
1600 |
+- * parts of it will be reserved. |
1601 |
+- * |
1602 |
+- * Returned is either 0 (success) or a negative error code indicating a resource |
1603 |
+- * reservation problem. It is the code of the first encountered error, but the |
1604 |
+- * routine doesn't abort until it has attempted to request all of the parts of |
1605 |
+- * the new region that don't overlap with other regions reserved previously. |
1606 |
+- * |
1607 |
+- * The resources requested by this routine are never released. |
1608 |
+- */ |
1609 |
+-int acpi_reserve_region(u64 start, unsigned int length, u8 space_id, |
1610 |
+- unsigned long flags, char *desc) |
1611 |
+-{ |
1612 |
+- struct list_head *regions; |
1613 |
+- struct reserved_region *reg; |
1614 |
+- u64 end = start + length - 1; |
1615 |
+- int ret = 0, error = 0; |
1616 |
+- |
1617 |
+- if (space_id == ACPI_ADR_SPACE_SYSTEM_IO) |
1618 |
+- regions = &reserved_io_regions; |
1619 |
+- else if (space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) |
1620 |
+- regions = &reserved_mem_regions; |
1621 |
+- else |
1622 |
+- return -EINVAL; |
1623 |
+- |
1624 |
+- if (list_empty(regions)) |
1625 |
+- return add_region_before(start, end, space_id, flags, desc, regions); |
1626 |
+- |
1627 |
+- list_for_each_entry(reg, regions, node) |
1628 |
+- if (reg->start == end + 1) { |
1629 |
+- /* The new region can be prepended to this one. */ |
1630 |
+- ret = request_range(start, end, space_id, flags, desc); |
1631 |
+- if (!ret) |
1632 |
+- reg->start = start; |
1633 |
+- |
1634 |
+- return ret; |
1635 |
+- } else if (reg->start > end) { |
1636 |
+- /* No overlap. Add the new region here and get out. */ |
1637 |
+- return add_region_before(start, end, space_id, flags, |
1638 |
+- desc, ®->node); |
1639 |
+- } else if (reg->end == start - 1) { |
1640 |
+- goto combine; |
1641 |
+- } else if (reg->end >= start) { |
1642 |
+- goto overlap; |
1643 |
+- } |
1644 |
+- |
1645 |
+- /* The new region goes after the last existing one. */ |
1646 |
+- return add_region_before(start, end, space_id, flags, desc, regions); |
1647 |
+- |
1648 |
+- overlap: |
1649 |
+- /* |
1650 |
+- * The new region overlaps an existing one. |
1651 |
+- * |
1652 |
+- * The head part of the new region immediately preceding the existing |
1653 |
+- * overlapping one can be combined with it right away. |
1654 |
+- */ |
1655 |
+- if (reg->start > start) { |
1656 |
+- error = request_range(start, reg->start - 1, space_id, flags, desc); |
1657 |
+- if (error) |
1658 |
+- ret = error; |
1659 |
+- else |
1660 |
+- reg->start = start; |
1661 |
+- } |
1662 |
+- |
1663 |
+- combine: |
1664 |
+- /* |
1665 |
+- * The new region is adjacent to an existing one. If it extends beyond |
1666 |
+- * that region all the way to the next one, it is possible to combine |
1667 |
+- * all three of them. |
1668 |
+- */ |
1669 |
+- while (reg->end < end) { |
1670 |
+- struct reserved_region *next = NULL; |
1671 |
+- u64 a = reg->end + 1, b = end; |
1672 |
+- |
1673 |
+- if (!list_is_last(®->node, regions)) { |
1674 |
+- next = list_next_entry(reg, node); |
1675 |
+- if (next->start <= end) |
1676 |
+- b = next->start - 1; |
1677 |
+- } |
1678 |
+- error = request_range(a, b, space_id, flags, desc); |
1679 |
+- if (!error) { |
1680 |
+- if (next && next->start == b + 1) { |
1681 |
+- reg->end = next->end; |
1682 |
+- list_del(&next->node); |
1683 |
+- kfree(next); |
1684 |
+- } else { |
1685 |
+- reg->end = end; |
1686 |
+- break; |
1687 |
+- } |
1688 |
+- } else if (next) { |
1689 |
+- if (!ret) |
1690 |
+- ret = error; |
1691 |
+- |
1692 |
+- reg = next; |
1693 |
+- } else { |
1694 |
+- break; |
1695 |
+- } |
1696 |
+- } |
1697 |
+- |
1698 |
+- return ret ? ret : error; |
1699 |
+-} |
1700 |
+-EXPORT_SYMBOL_GPL(acpi_reserve_region); |
1701 |
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
1702 |
+index 577849c6611a..41c99be9bd41 100644 |
1703 |
+--- a/drivers/ata/libata-core.c |
1704 |
++++ b/drivers/ata/libata-core.c |
1705 |
+@@ -2478,6 +2478,10 @@ int ata_dev_configure(struct ata_device *dev) |
1706 |
+ dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, |
1707 |
+ dev->max_sectors); |
1708 |
+ |
1709 |
++ if (dev->horkage & ATA_HORKAGE_MAX_SEC_1024) |
1710 |
++ dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_1024, |
1711 |
++ dev->max_sectors); |
1712 |
++ |
1713 |
+ if (dev->horkage & ATA_HORKAGE_MAX_SEC_LBA48) |
1714 |
+ dev->max_sectors = ATA_MAX_SECTORS_LBA48; |
1715 |
+ |
1716 |
+@@ -4146,6 +4150,12 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { |
1717 |
+ { "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, |
1718 |
+ { "Slimtype DVD A DS8A9SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, |
1719 |
+ |
1720 |
++ /* |
1721 |
++ * Causes silent data corruption with higher max sects. |
1722 |
++ * http://lkml.kernel.org/g/x49wpy40ysk.fsf@××××××××××××××××××××××××××××.com |
1723 |
++ */ |
1724 |
++ { "ST380013AS", "3.20", ATA_HORKAGE_MAX_SEC_1024 }, |
1725 |
++ |
1726 |
+ /* Devices we expect to fail diagnostics */ |
1727 |
+ |
1728 |
+ /* Devices where NCQ should be avoided */ |
1729 |
+@@ -4174,9 +4184,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { |
1730 |
+ { "ST3320[68]13AS", "SD1[5-9]", ATA_HORKAGE_NONCQ | |
1731 |
+ ATA_HORKAGE_FIRMWARE_WARN }, |
1732 |
+ |
1733 |
+- /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */ |
1734 |
++ /* drives which fail FPDMA_AA activation (some may freeze afterwards) */ |
1735 |
+ { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA }, |
1736 |
+ { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA }, |
1737 |
++ { "VB0250EAVER", "HPG7", ATA_HORKAGE_BROKEN_FPDMA_AA }, |
1738 |
+ |
1739 |
+ /* Blacklist entries taken from Silicon Image 3124/3132 |
1740 |
+ Windows driver .inf file - also several Linux problem reports */ |
1741 |
+@@ -4225,11 +4236,11 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { |
1742 |
+ { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, |
1743 |
+ |
1744 |
+ /* devices that don't properly handle queued TRIM commands */ |
1745 |
+- { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
1746 |
++ { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
1747 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
1748 |
+ { "Crucial_CT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
1749 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
1750 |
+- { "Micron_M5[15]0*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
1751 |
++ { "Micron_M5[15]0_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
1752 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
1753 |
+ { "Crucial_CT*M550*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
1754 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
1755 |
+@@ -4238,6 +4249,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { |
1756 |
+ { "Samsung SSD 8*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
1757 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
1758 |
+ |
1759 |
++ /* devices that don't properly handle TRIM commands */ |
1760 |
++ { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, }, |
1761 |
++ |
1762 |
+ /* |
1763 |
+ * As defined, the DRAT (Deterministic Read After Trim) and RZAT |
1764 |
+ * (Return Zero After Trim) flags in the ATA Command Set are |
1765 |
+@@ -4501,7 +4515,8 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev) |
1766 |
+ else /* In the ancient relic department - skip all of this */ |
1767 |
+ return 0; |
1768 |
+ |
1769 |
+- err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); |
1770 |
++ /* On some disks, this command causes spin-up, so we need longer timeout */ |
1771 |
++ err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 15000); |
1772 |
+ |
1773 |
+ DPRINTK("EXIT, err_mask=%x\n", err_mask); |
1774 |
+ return err_mask; |
1775 |
+diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c |
1776 |
+index cf0022ec07f2..7465031a893c 100644 |
1777 |
+--- a/drivers/ata/libata-eh.c |
1778 |
++++ b/drivers/ata/libata-eh.c |
1779 |
+@@ -1507,16 +1507,21 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log, |
1780 |
+ { |
1781 |
+ struct ata_taskfile tf; |
1782 |
+ unsigned int err_mask; |
1783 |
++ bool dma = false; |
1784 |
+ |
1785 |
+ DPRINTK("read log page - log 0x%x, page 0x%x\n", log, page); |
1786 |
+ |
1787 |
++retry: |
1788 |
+ ata_tf_init(dev, &tf); |
1789 |
+- if (dev->dma_mode && ata_id_has_read_log_dma_ext(dev->id)) { |
1790 |
++ if (dev->dma_mode && ata_id_has_read_log_dma_ext(dev->id) && |
1791 |
++ !(dev->horkage & ATA_HORKAGE_NO_NCQ_LOG)) { |
1792 |
+ tf.command = ATA_CMD_READ_LOG_DMA_EXT; |
1793 |
+ tf.protocol = ATA_PROT_DMA; |
1794 |
++ dma = true; |
1795 |
+ } else { |
1796 |
+ tf.command = ATA_CMD_READ_LOG_EXT; |
1797 |
+ tf.protocol = ATA_PROT_PIO; |
1798 |
++ dma = false; |
1799 |
+ } |
1800 |
+ tf.lbal = log; |
1801 |
+ tf.lbam = page; |
1802 |
+@@ -1527,6 +1532,12 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log, |
1803 |
+ err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE, |
1804 |
+ buf, sectors * ATA_SECT_SIZE, 0); |
1805 |
+ |
1806 |
++ if (err_mask && dma) { |
1807 |
++ dev->horkage |= ATA_HORKAGE_NO_NCQ_LOG; |
1808 |
++ ata_dev_warn(dev, "READ LOG DMA EXT failed, trying unqueued\n"); |
1809 |
++ goto retry; |
1810 |
++ } |
1811 |
++ |
1812 |
+ DPRINTK("EXIT, err_mask=%x\n", err_mask); |
1813 |
+ return err_mask; |
1814 |
+ } |
1815 |
+diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c |
1816 |
+index 3131adcc1f87..641a61a59e89 100644 |
1817 |
+--- a/drivers/ata/libata-scsi.c |
1818 |
++++ b/drivers/ata/libata-scsi.c |
1819 |
+@@ -2568,7 +2568,8 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf) |
1820 |
+ rbuf[14] = (lowest_aligned >> 8) & 0x3f; |
1821 |
+ rbuf[15] = lowest_aligned; |
1822 |
+ |
1823 |
+- if (ata_id_has_trim(args->id)) { |
1824 |
++ if (ata_id_has_trim(args->id) && |
1825 |
++ !(dev->horkage & ATA_HORKAGE_NOTRIM)) { |
1826 |
+ rbuf[14] |= 0x80; /* LBPME */ |
1827 |
+ |
1828 |
+ if (ata_id_has_zero_after_trim(args->id) && |
1829 |
+diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c |
1830 |
+index 3227b7c8a05f..e2d94972962d 100644 |
1831 |
+--- a/drivers/ata/libata-transport.c |
1832 |
++++ b/drivers/ata/libata-transport.c |
1833 |
+@@ -560,6 +560,29 @@ show_ata_dev_gscr(struct device *dev, |
1834 |
+ |
1835 |
+ static DEVICE_ATTR(gscr, S_IRUGO, show_ata_dev_gscr, NULL); |
1836 |
+ |
1837 |
++static ssize_t |
1838 |
++show_ata_dev_trim(struct device *dev, |
1839 |
++ struct device_attribute *attr, char *buf) |
1840 |
++{ |
1841 |
++ struct ata_device *ata_dev = transport_class_to_dev(dev); |
1842 |
++ unsigned char *mode; |
1843 |
++ |
1844 |
++ if (!ata_id_has_trim(ata_dev->id)) |
1845 |
++ mode = "unsupported"; |
1846 |
++ else if (ata_dev->horkage & ATA_HORKAGE_NOTRIM) |
1847 |
++ mode = "forced_unsupported"; |
1848 |
++ else if (ata_dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM) |
1849 |
++ mode = "forced_unqueued"; |
1850 |
++ else if (ata_fpdma_dsm_supported(ata_dev)) |
1851 |
++ mode = "queued"; |
1852 |
++ else |
1853 |
++ mode = "unqueued"; |
1854 |
++ |
1855 |
++ return snprintf(buf, 20, "%s\n", mode); |
1856 |
++} |
1857 |
++ |
1858 |
++static DEVICE_ATTR(trim, S_IRUGO, show_ata_dev_trim, NULL); |
1859 |
++ |
1860 |
+ static DECLARE_TRANSPORT_CLASS(ata_dev_class, |
1861 |
+ "ata_device", NULL, NULL, NULL); |
1862 |
+ |
1863 |
+@@ -733,6 +756,7 @@ struct scsi_transport_template *ata_attach_transport(void) |
1864 |
+ SETUP_DEV_ATTRIBUTE(ering); |
1865 |
+ SETUP_DEV_ATTRIBUTE(id); |
1866 |
+ SETUP_DEV_ATTRIBUTE(gscr); |
1867 |
++ SETUP_DEV_ATTRIBUTE(trim); |
1868 |
+ BUG_ON(count > ATA_DEV_ATTRS); |
1869 |
+ i->dev_attrs[count] = NULL; |
1870 |
+ |
1871 |
+diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c |
1872 |
+index 171841ad1008..4d1d9de4f9bf 100644 |
1873 |
+--- a/drivers/base/firmware_class.c |
1874 |
++++ b/drivers/base/firmware_class.c |
1875 |
+@@ -544,10 +544,8 @@ static void fw_dev_release(struct device *dev) |
1876 |
+ kfree(fw_priv); |
1877 |
+ } |
1878 |
+ |
1879 |
+-static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env) |
1880 |
++static int do_firmware_uevent(struct firmware_priv *fw_priv, struct kobj_uevent_env *env) |
1881 |
+ { |
1882 |
+- struct firmware_priv *fw_priv = to_firmware_priv(dev); |
1883 |
+- |
1884 |
+ if (add_uevent_var(env, "FIRMWARE=%s", fw_priv->buf->fw_id)) |
1885 |
+ return -ENOMEM; |
1886 |
+ if (add_uevent_var(env, "TIMEOUT=%i", loading_timeout)) |
1887 |
+@@ -558,6 +556,18 @@ static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env) |
1888 |
+ return 0; |
1889 |
+ } |
1890 |
+ |
1891 |
++static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env) |
1892 |
++{ |
1893 |
++ struct firmware_priv *fw_priv = to_firmware_priv(dev); |
1894 |
++ int err = 0; |
1895 |
++ |
1896 |
++ mutex_lock(&fw_lock); |
1897 |
++ if (fw_priv->buf) |
1898 |
++ err = do_firmware_uevent(fw_priv, env); |
1899 |
++ mutex_unlock(&fw_lock); |
1900 |
++ return err; |
1901 |
++} |
1902 |
++ |
1903 |
+ static struct class firmware_class = { |
1904 |
+ .name = "firmware", |
1905 |
+ .class_attrs = firmware_class_attrs, |
1906 |
+diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c |
1907 |
+index 7fdd0172605a..c7b0fcebf168 100644 |
1908 |
+--- a/drivers/base/power/clock_ops.c |
1909 |
++++ b/drivers/base/power/clock_ops.c |
1910 |
+@@ -93,7 +93,7 @@ static int __pm_clk_add(struct device *dev, const char *con_id, |
1911 |
+ return -ENOMEM; |
1912 |
+ } |
1913 |
+ } else { |
1914 |
+- if (IS_ERR(ce->clk) || !__clk_get(clk)) { |
1915 |
++ if (IS_ERR(clk) || !__clk_get(clk)) { |
1916 |
+ kfree(ce); |
1917 |
+ return -ENOENT; |
1918 |
+ } |
1919 |
+diff --git a/drivers/block/loop.c b/drivers/block/loop.c |
1920 |
+index d7173cb1ea76..cef6fa83a274 100644 |
1921 |
+--- a/drivers/block/loop.c |
1922 |
++++ b/drivers/block/loop.c |
1923 |
+@@ -86,8 +86,6 @@ static DEFINE_MUTEX(loop_index_mutex); |
1924 |
+ static int max_part; |
1925 |
+ static int part_shift; |
1926 |
+ |
1927 |
+-static struct workqueue_struct *loop_wq; |
1928 |
+- |
1929 |
+ static int transfer_xor(struct loop_device *lo, int cmd, |
1930 |
+ struct page *raw_page, unsigned raw_off, |
1931 |
+ struct page *loop_page, unsigned loop_off, |
1932 |
+@@ -725,6 +723,12 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, |
1933 |
+ size = get_loop_size(lo, file); |
1934 |
+ if ((loff_t)(sector_t)size != size) |
1935 |
+ goto out_putf; |
1936 |
++ error = -ENOMEM; |
1937 |
++ lo->wq = alloc_workqueue("kloopd%d", |
1938 |
++ WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_UNBOUND, 16, |
1939 |
++ lo->lo_number); |
1940 |
++ if (!lo->wq) |
1941 |
++ goto out_putf; |
1942 |
+ |
1943 |
+ error = 0; |
1944 |
+ |
1945 |
+@@ -872,6 +876,8 @@ static int loop_clr_fd(struct loop_device *lo) |
1946 |
+ lo->lo_flags = 0; |
1947 |
+ if (!part_shift) |
1948 |
+ lo->lo_disk->flags |= GENHD_FL_NO_PART_SCAN; |
1949 |
++ destroy_workqueue(lo->wq); |
1950 |
++ lo->wq = NULL; |
1951 |
+ mutex_unlock(&lo->lo_ctl_mutex); |
1952 |
+ /* |
1953 |
+ * Need not hold lo_ctl_mutex to fput backing file. |
1954 |
+@@ -1425,9 +1431,13 @@ static int loop_queue_rq(struct blk_mq_hw_ctx *hctx, |
1955 |
+ const struct blk_mq_queue_data *bd) |
1956 |
+ { |
1957 |
+ struct loop_cmd *cmd = blk_mq_rq_to_pdu(bd->rq); |
1958 |
++ struct loop_device *lo = cmd->rq->q->queuedata; |
1959 |
+ |
1960 |
+ blk_mq_start_request(bd->rq); |
1961 |
+ |
1962 |
++ if (lo->lo_state != Lo_bound) |
1963 |
++ return -EIO; |
1964 |
++ |
1965 |
+ if (cmd->rq->cmd_flags & REQ_WRITE) { |
1966 |
+ struct loop_device *lo = cmd->rq->q->queuedata; |
1967 |
+ bool need_sched = true; |
1968 |
+@@ -1441,9 +1451,9 @@ static int loop_queue_rq(struct blk_mq_hw_ctx *hctx, |
1969 |
+ spin_unlock_irq(&lo->lo_lock); |
1970 |
+ |
1971 |
+ if (need_sched) |
1972 |
+- queue_work(loop_wq, &lo->write_work); |
1973 |
++ queue_work(lo->wq, &lo->write_work); |
1974 |
+ } else { |
1975 |
+- queue_work(loop_wq, &cmd->read_work); |
1976 |
++ queue_work(lo->wq, &cmd->read_work); |
1977 |
+ } |
1978 |
+ |
1979 |
+ return BLK_MQ_RQ_QUEUE_OK; |
1980 |
+@@ -1455,9 +1465,6 @@ static void loop_handle_cmd(struct loop_cmd *cmd) |
1981 |
+ struct loop_device *lo = cmd->rq->q->queuedata; |
1982 |
+ int ret = -EIO; |
1983 |
+ |
1984 |
+- if (lo->lo_state != Lo_bound) |
1985 |
+- goto failed; |
1986 |
+- |
1987 |
+ if (write && (lo->lo_flags & LO_FLAGS_READ_ONLY)) |
1988 |
+ goto failed; |
1989 |
+ |
1990 |
+@@ -1806,13 +1813,6 @@ static int __init loop_init(void) |
1991 |
+ goto misc_out; |
1992 |
+ } |
1993 |
+ |
1994 |
+- loop_wq = alloc_workqueue("kloopd", |
1995 |
+- WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_UNBOUND, 0); |
1996 |
+- if (!loop_wq) { |
1997 |
+- err = -ENOMEM; |
1998 |
+- goto misc_out; |
1999 |
+- } |
2000 |
+- |
2001 |
+ blk_register_region(MKDEV(LOOP_MAJOR, 0), range, |
2002 |
+ THIS_MODULE, loop_probe, NULL, NULL); |
2003 |
+ |
2004 |
+@@ -1850,8 +1850,6 @@ static void __exit loop_exit(void) |
2005 |
+ blk_unregister_region(MKDEV(LOOP_MAJOR, 0), range); |
2006 |
+ unregister_blkdev(LOOP_MAJOR, "loop"); |
2007 |
+ |
2008 |
+- destroy_workqueue(loop_wq); |
2009 |
+- |
2010 |
+ misc_deregister(&loop_misc); |
2011 |
+ } |
2012 |
+ |
2013 |
+diff --git a/drivers/block/loop.h b/drivers/block/loop.h |
2014 |
+index 301c27f8323f..49564edf5581 100644 |
2015 |
+--- a/drivers/block/loop.h |
2016 |
++++ b/drivers/block/loop.h |
2017 |
+@@ -54,6 +54,7 @@ struct loop_device { |
2018 |
+ gfp_t old_gfp_mask; |
2019 |
+ |
2020 |
+ spinlock_t lo_lock; |
2021 |
++ struct workqueue_struct *wq; |
2022 |
+ struct list_head write_cmd_head; |
2023 |
+ struct work_struct write_work; |
2024 |
+ bool write_started; |
2025 |
+diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c |
2026 |
+index ec6c5c6e1ac9..53f253574abe 100644 |
2027 |
+--- a/drivers/block/rbd.c |
2028 |
++++ b/drivers/block/rbd.c |
2029 |
+@@ -2001,11 +2001,11 @@ static struct rbd_obj_request *rbd_obj_request_create(const char *object_name, |
2030 |
+ rbd_assert(obj_request_type_valid(type)); |
2031 |
+ |
2032 |
+ size = strlen(object_name) + 1; |
2033 |
+- name = kmalloc(size, GFP_KERNEL); |
2034 |
++ name = kmalloc(size, GFP_NOIO); |
2035 |
+ if (!name) |
2036 |
+ return NULL; |
2037 |
+ |
2038 |
+- obj_request = kmem_cache_zalloc(rbd_obj_request_cache, GFP_KERNEL); |
2039 |
++ obj_request = kmem_cache_zalloc(rbd_obj_request_cache, GFP_NOIO); |
2040 |
+ if (!obj_request) { |
2041 |
+ kfree(name); |
2042 |
+ return NULL; |
2043 |
+diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c |
2044 |
+index 4bba86677adc..3f146c9911c1 100644 |
2045 |
+--- a/drivers/bluetooth/btbcm.c |
2046 |
++++ b/drivers/bluetooth/btbcm.c |
2047 |
+@@ -378,12 +378,11 @@ int btbcm_setup_apple(struct hci_dev *hdev) |
2048 |
+ |
2049 |
+ /* Read Verbose Config Version Info */ |
2050 |
+ skb = btbcm_read_verbose_config(hdev); |
2051 |
+- if (IS_ERR(skb)) |
2052 |
+- return PTR_ERR(skb); |
2053 |
+- |
2054 |
+- BT_INFO("%s: BCM: chip id %u build %4.4u", hdev->name, skb->data[1], |
2055 |
+- get_unaligned_le16(skb->data + 5)); |
2056 |
+- kfree_skb(skb); |
2057 |
++ if (!IS_ERR(skb)) { |
2058 |
++ BT_INFO("%s: BCM: chip id %u build %4.4u", hdev->name, skb->data[1], |
2059 |
++ get_unaligned_le16(skb->data + 5)); |
2060 |
++ kfree_skb(skb); |
2061 |
++ } |
2062 |
+ |
2063 |
+ set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); |
2064 |
+ |
2065 |
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
2066 |
+index 420cc9f3eb76..c65501539224 100644 |
2067 |
+--- a/drivers/bluetooth/btusb.c |
2068 |
++++ b/drivers/bluetooth/btusb.c |
2069 |
+@@ -268,7 +268,7 @@ static const struct usb_device_id blacklist_table[] = { |
2070 |
+ { USB_DEVICE(0x0e5e, 0x6622), .driver_info = BTUSB_BROKEN_ISOC }, |
2071 |
+ |
2072 |
+ /* Roper Class 1 Bluetooth Dongle (Silicon Wave based) */ |
2073 |
+- { USB_DEVICE(0x1300, 0x0001), .driver_info = BTUSB_SWAVE }, |
2074 |
++ { USB_DEVICE(0x1310, 0x0001), .driver_info = BTUSB_SWAVE }, |
2075 |
+ |
2076 |
+ /* Digianswer devices */ |
2077 |
+ { USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER }, |
2078 |
+@@ -1993,6 +1993,8 @@ static int btusb_setup_intel(struct hci_dev *hdev) |
2079 |
+ } |
2080 |
+ fw_ptr = fw->data; |
2081 |
+ |
2082 |
++ kfree_skb(skb); |
2083 |
++ |
2084 |
+ /* This Intel specific command enables the manufacturer mode of the |
2085 |
+ * controller. |
2086 |
+ * |
2087 |
+@@ -2334,6 +2336,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) |
2088 |
+ struct intel_boot_params *params; |
2089 |
+ const struct firmware *fw; |
2090 |
+ const u8 *fw_ptr; |
2091 |
++ u32 frag_len; |
2092 |
+ char fwname[64]; |
2093 |
+ ktime_t calltime, delta, rettime; |
2094 |
+ unsigned long long duration; |
2095 |
+@@ -2540,24 +2543,33 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) |
2096 |
+ } |
2097 |
+ |
2098 |
+ fw_ptr = fw->data + 644; |
2099 |
++ frag_len = 0; |
2100 |
+ |
2101 |
+ while (fw_ptr - fw->data < fw->size) { |
2102 |
+- struct hci_command_hdr *cmd = (void *)fw_ptr; |
2103 |
+- u8 cmd_len; |
2104 |
++ struct hci_command_hdr *cmd = (void *)(fw_ptr + frag_len); |
2105 |
+ |
2106 |
+- cmd_len = sizeof(*cmd) + cmd->plen; |
2107 |
++ frag_len += sizeof(*cmd) + cmd->plen; |
2108 |
+ |
2109 |
+- /* Send each command from the firmware data buffer as |
2110 |
+- * a single Data fragment. |
2111 |
++ /* The paramter length of the secure send command requires |
2112 |
++ * a 4 byte alignment. It happens so that the firmware file |
2113 |
++ * contains proper Intel_NOP commands to align the fragments |
2114 |
++ * as needed. |
2115 |
++ * |
2116 |
++ * Send set of commands with 4 byte alignment from the |
2117 |
++ * firmware data buffer as a single Data fragement. |
2118 |
+ */ |
2119 |
+- err = btusb_intel_secure_send(hdev, 0x01, cmd_len, fw_ptr); |
2120 |
+- if (err < 0) { |
2121 |
+- BT_ERR("%s: Failed to send firmware data (%d)", |
2122 |
+- hdev->name, err); |
2123 |
+- goto done; |
2124 |
+- } |
2125 |
++ if (!(frag_len % 4)) { |
2126 |
++ err = btusb_intel_secure_send(hdev, 0x01, frag_len, |
2127 |
++ fw_ptr); |
2128 |
++ if (err < 0) { |
2129 |
++ BT_ERR("%s: Failed to send firmware data (%d)", |
2130 |
++ hdev->name, err); |
2131 |
++ goto done; |
2132 |
++ } |
2133 |
+ |
2134 |
+- fw_ptr += cmd_len; |
2135 |
++ fw_ptr += frag_len; |
2136 |
++ frag_len = 0; |
2137 |
++ } |
2138 |
+ } |
2139 |
+ |
2140 |
+ set_bit(BTUSB_FIRMWARE_LOADED, &data->flags); |
2141 |
+diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c |
2142 |
+index aaa0f2a87118..60397ec77ff7 100644 |
2143 |
+--- a/drivers/bus/arm-ccn.c |
2144 |
++++ b/drivers/bus/arm-ccn.c |
2145 |
+@@ -212,7 +212,7 @@ static int arm_ccn_node_to_xp_port(int node) |
2146 |
+ |
2147 |
+ static void arm_ccn_pmu_config_set(u64 *config, u32 node_xp, u32 type, u32 port) |
2148 |
+ { |
2149 |
+- *config &= ~((0xff << 0) | (0xff << 8) | (0xff << 24)); |
2150 |
++ *config &= ~((0xff << 0) | (0xff << 8) | (0x3 << 24)); |
2151 |
+ *config |= (node_xp << 0) | (type << 8) | (port << 24); |
2152 |
+ } |
2153 |
+ |
2154 |
+diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c |
2155 |
+index 0b4188b9af7c..c6dea3f6917b 100644 |
2156 |
+--- a/drivers/char/agp/intel-gtt.c |
2157 |
++++ b/drivers/char/agp/intel-gtt.c |
2158 |
+@@ -581,7 +581,7 @@ static inline int needs_ilk_vtd_wa(void) |
2159 |
+ /* Query intel_iommu to see if we need the workaround. Presumably that |
2160 |
+ * was loaded first. |
2161 |
+ */ |
2162 |
+- if ((gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB || |
2163 |
++ if ((gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG || |
2164 |
+ gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG) && |
2165 |
+ intel_iommu_gfx_mapped) |
2166 |
+ return 1; |
2167 |
+diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c |
2168 |
+index 283f00a7f036..1082d4bb016a 100644 |
2169 |
+--- a/drivers/char/tpm/tpm-chip.c |
2170 |
++++ b/drivers/char/tpm/tpm-chip.c |
2171 |
+@@ -129,8 +129,9 @@ struct tpm_chip *tpmm_chip_alloc(struct device *dev, |
2172 |
+ |
2173 |
+ device_initialize(&chip->dev); |
2174 |
+ |
2175 |
+- chip->cdev.owner = chip->pdev->driver->owner; |
2176 |
+ cdev_init(&chip->cdev, &tpm_fops); |
2177 |
++ chip->cdev.owner = chip->pdev->driver->owner; |
2178 |
++ chip->cdev.kobj.parent = &chip->dev.kobj; |
2179 |
+ |
2180 |
+ return chip; |
2181 |
+ } |
2182 |
+diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c |
2183 |
+index b26ceee3585e..1267322595da 100644 |
2184 |
+--- a/drivers/char/tpm/tpm_crb.c |
2185 |
++++ b/drivers/char/tpm/tpm_crb.c |
2186 |
+@@ -233,6 +233,14 @@ static int crb_acpi_add(struct acpi_device *device) |
2187 |
+ return -ENODEV; |
2188 |
+ } |
2189 |
+ |
2190 |
++ /* At least some versions of AMI BIOS have a bug that TPM2 table has |
2191 |
++ * zero address for the control area and therefore we must fail. |
2192 |
++ */ |
2193 |
++ if (!buf->control_area_pa) { |
2194 |
++ dev_err(dev, "TPM2 ACPI table has a zero address for the control area\n"); |
2195 |
++ return -EINVAL; |
2196 |
++ } |
2197 |
++ |
2198 |
+ if (buf->hdr.length < sizeof(struct acpi_tpm2)) { |
2199 |
+ dev_err(dev, "TPM2 ACPI table has wrong size"); |
2200 |
+ return -EINVAL; |
2201 |
+@@ -267,7 +275,7 @@ static int crb_acpi_add(struct acpi_device *device) |
2202 |
+ |
2203 |
+ memcpy_fromio(&pa, &priv->cca->cmd_pa, 8); |
2204 |
+ pa = le64_to_cpu(pa); |
2205 |
+- priv->cmd = devm_ioremap_nocache(dev, le64_to_cpu(pa), |
2206 |
++ priv->cmd = devm_ioremap_nocache(dev, pa, |
2207 |
+ ioread32(&priv->cca->cmd_size)); |
2208 |
+ if (!priv->cmd) { |
2209 |
+ dev_err(dev, "ioremap of the command buffer failed\n"); |
2210 |
+@@ -276,7 +284,7 @@ static int crb_acpi_add(struct acpi_device *device) |
2211 |
+ |
2212 |
+ memcpy_fromio(&pa, &priv->cca->rsp_pa, 8); |
2213 |
+ pa = le64_to_cpu(pa); |
2214 |
+- priv->rsp = devm_ioremap_nocache(dev, le64_to_cpu(pa), |
2215 |
++ priv->rsp = devm_ioremap_nocache(dev, pa, |
2216 |
+ ioread32(&priv->cca->rsp_size)); |
2217 |
+ if (!priv->rsp) { |
2218 |
+ dev_err(dev, "ioremap of the response buffer failed\n"); |
2219 |
+diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c |
2220 |
+index 42ffa5e7a1e0..27ebf9511cb4 100644 |
2221 |
+--- a/drivers/char/tpm/tpm_ibmvtpm.c |
2222 |
++++ b/drivers/char/tpm/tpm_ibmvtpm.c |
2223 |
+@@ -578,6 +578,9 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev, |
2224 |
+ goto cleanup; |
2225 |
+ } |
2226 |
+ |
2227 |
++ ibmvtpm->dev = dev; |
2228 |
++ ibmvtpm->vdev = vio_dev; |
2229 |
++ |
2230 |
+ crq_q = &ibmvtpm->crq_queue; |
2231 |
+ crq_q->crq_addr = (struct ibmvtpm_crq *)get_zeroed_page(GFP_KERNEL); |
2232 |
+ if (!crq_q->crq_addr) { |
2233 |
+@@ -622,8 +625,6 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev, |
2234 |
+ |
2235 |
+ crq_q->index = 0; |
2236 |
+ |
2237 |
+- ibmvtpm->dev = dev; |
2238 |
+- ibmvtpm->vdev = vio_dev; |
2239 |
+ TPM_VPRIV(chip) = (void *)ibmvtpm; |
2240 |
+ |
2241 |
+ spin_lock_init(&ibmvtpm->rtce_lock); |
2242 |
+diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c |
2243 |
+index 5b0f41868b42..9f9cadd00bc8 100644 |
2244 |
+--- a/drivers/clk/clk.c |
2245 |
++++ b/drivers/clk/clk.c |
2246 |
+@@ -230,11 +230,12 @@ static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level) |
2247 |
+ if (!c) |
2248 |
+ return; |
2249 |
+ |
2250 |
++ /* This should be JSON format, i.e. elements separated with a comma */ |
2251 |
+ seq_printf(s, "\"%s\": { ", c->name); |
2252 |
+ seq_printf(s, "\"enable_count\": %d,", c->enable_count); |
2253 |
+ seq_printf(s, "\"prepare_count\": %d,", c->prepare_count); |
2254 |
+- seq_printf(s, "\"rate\": %lu", clk_core_get_rate(c)); |
2255 |
+- seq_printf(s, "\"accuracy\": %lu", clk_core_get_accuracy(c)); |
2256 |
++ seq_printf(s, "\"rate\": %lu,", clk_core_get_rate(c)); |
2257 |
++ seq_printf(s, "\"accuracy\": %lu,", clk_core_get_accuracy(c)); |
2258 |
+ seq_printf(s, "\"phase\": %d", clk_core_get_phase(c)); |
2259 |
+ } |
2260 |
+ |
2261 |
+diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c |
2262 |
+index b95d17fbb8d7..92936f0912d2 100644 |
2263 |
+--- a/drivers/clk/qcom/clk-rcg2.c |
2264 |
++++ b/drivers/clk/qcom/clk-rcg2.c |
2265 |
+@@ -530,19 +530,16 @@ static int clk_pixel_set_rate(struct clk_hw *hw, unsigned long rate, |
2266 |
+ struct clk_rcg2 *rcg = to_clk_rcg2(hw); |
2267 |
+ struct freq_tbl f = *rcg->freq_tbl; |
2268 |
+ const struct frac_entry *frac = frac_table_pixel; |
2269 |
+- unsigned long request, src_rate; |
2270 |
++ unsigned long request; |
2271 |
+ int delta = 100000; |
2272 |
+ u32 mask = BIT(rcg->hid_width) - 1; |
2273 |
+ u32 hid_div; |
2274 |
+- int index = qcom_find_src_index(hw, rcg->parent_map, f.src); |
2275 |
+- struct clk *parent = clk_get_parent_by_index(hw->clk, index); |
2276 |
+ |
2277 |
+ for (; frac->num; frac++) { |
2278 |
+ request = (rate * frac->den) / frac->num; |
2279 |
+ |
2280 |
+- src_rate = __clk_round_rate(parent, request); |
2281 |
+- if ((src_rate < (request - delta)) || |
2282 |
+- (src_rate > (request + delta))) |
2283 |
++ if ((parent_rate < (request - delta)) || |
2284 |
++ (parent_rate > (request + delta))) |
2285 |
+ continue; |
2286 |
+ |
2287 |
+ regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, |
2288 |
+diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c |
2289 |
+index d86bc46b93bd..0a1df821860f 100644 |
2290 |
+--- a/drivers/clk/ti/clk-dra7-atl.c |
2291 |
++++ b/drivers/clk/ti/clk-dra7-atl.c |
2292 |
+@@ -252,6 +252,11 @@ static int of_dra7_atl_clk_probe(struct platform_device *pdev) |
2293 |
+ } |
2294 |
+ |
2295 |
+ clk = of_clk_get_from_provider(&clkspec); |
2296 |
++ if (IS_ERR(clk)) { |
2297 |
++ pr_err("%s: failed to get atl clock %d from provider\n", |
2298 |
++ __func__, i); |
2299 |
++ return PTR_ERR(clk); |
2300 |
++ } |
2301 |
+ |
2302 |
+ cdesc = to_atl_desc(__clk_get_hw(clk)); |
2303 |
+ cdesc->cinfo = cinfo; |
2304 |
+diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c |
2305 |
+index 83564c9cfdbe..c844616028d2 100644 |
2306 |
+--- a/drivers/clocksource/exynos_mct.c |
2307 |
++++ b/drivers/clocksource/exynos_mct.c |
2308 |
+@@ -466,15 +466,12 @@ static int exynos4_local_timer_setup(struct clock_event_device *evt) |
2309 |
+ exynos4_mct_write(TICK_BASE_CNT, mevt->base + MCT_L_TCNTB_OFFSET); |
2310 |
+ |
2311 |
+ if (mct_int_type == MCT_INT_SPI) { |
2312 |
+- evt->irq = mct_irqs[MCT_L0_IRQ + cpu]; |
2313 |
+- if (request_irq(evt->irq, exynos4_mct_tick_isr, |
2314 |
+- IRQF_TIMER | IRQF_NOBALANCING, |
2315 |
+- evt->name, mevt)) { |
2316 |
+- pr_err("exynos-mct: cannot register IRQ %d\n", |
2317 |
+- evt->irq); |
2318 |
++ |
2319 |
++ if (evt->irq == -1) |
2320 |
+ return -EIO; |
2321 |
+- } |
2322 |
+- irq_force_affinity(mct_irqs[MCT_L0_IRQ + cpu], cpumask_of(cpu)); |
2323 |
++ |
2324 |
++ irq_force_affinity(evt->irq, cpumask_of(cpu)); |
2325 |
++ enable_irq(evt->irq); |
2326 |
+ } else { |
2327 |
+ enable_percpu_irq(mct_irqs[MCT_L0_IRQ], 0); |
2328 |
+ } |
2329 |
+@@ -487,10 +484,12 @@ static int exynos4_local_timer_setup(struct clock_event_device *evt) |
2330 |
+ static void exynos4_local_timer_stop(struct clock_event_device *evt) |
2331 |
+ { |
2332 |
+ evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt); |
2333 |
+- if (mct_int_type == MCT_INT_SPI) |
2334 |
+- free_irq(evt->irq, this_cpu_ptr(&percpu_mct_tick)); |
2335 |
+- else |
2336 |
++ if (mct_int_type == MCT_INT_SPI) { |
2337 |
++ if (evt->irq != -1) |
2338 |
++ disable_irq_nosync(evt->irq); |
2339 |
++ } else { |
2340 |
+ disable_percpu_irq(mct_irqs[MCT_L0_IRQ]); |
2341 |
++ } |
2342 |
+ } |
2343 |
+ |
2344 |
+ static int exynos4_mct_cpu_notify(struct notifier_block *self, |
2345 |
+@@ -522,7 +521,7 @@ static struct notifier_block exynos4_mct_cpu_nb = { |
2346 |
+ |
2347 |
+ static void __init exynos4_timer_resources(struct device_node *np, void __iomem *base) |
2348 |
+ { |
2349 |
+- int err; |
2350 |
++ int err, cpu; |
2351 |
+ struct mct_clock_event_device *mevt = this_cpu_ptr(&percpu_mct_tick); |
2352 |
+ struct clk *mct_clk, *tick_clk; |
2353 |
+ |
2354 |
+@@ -549,7 +548,25 @@ static void __init exynos4_timer_resources(struct device_node *np, void __iomem |
2355 |
+ WARN(err, "MCT: can't request IRQ %d (%d)\n", |
2356 |
+ mct_irqs[MCT_L0_IRQ], err); |
2357 |
+ } else { |
2358 |
+- irq_set_affinity(mct_irqs[MCT_L0_IRQ], cpumask_of(0)); |
2359 |
++ for_each_possible_cpu(cpu) { |
2360 |
++ int mct_irq = mct_irqs[MCT_L0_IRQ + cpu]; |
2361 |
++ struct mct_clock_event_device *pcpu_mevt = |
2362 |
++ per_cpu_ptr(&percpu_mct_tick, cpu); |
2363 |
++ |
2364 |
++ pcpu_mevt->evt.irq = -1; |
2365 |
++ |
2366 |
++ irq_set_status_flags(mct_irq, IRQ_NOAUTOEN); |
2367 |
++ if (request_irq(mct_irq, |
2368 |
++ exynos4_mct_tick_isr, |
2369 |
++ IRQF_TIMER | IRQF_NOBALANCING, |
2370 |
++ pcpu_mevt->name, pcpu_mevt)) { |
2371 |
++ pr_err("exynos-mct: cannot register IRQ (cpu%d)\n", |
2372 |
++ cpu); |
2373 |
++ |
2374 |
++ continue; |
2375 |
++ } |
2376 |
++ pcpu_mevt->evt.irq = mct_irq; |
2377 |
++ } |
2378 |
+ } |
2379 |
+ |
2380 |
+ err = register_cpu_notifier(&exynos4_mct_cpu_nb); |
2381 |
+diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c |
2382 |
+index 1c56001df676..50f1b422dee3 100644 |
2383 |
+--- a/drivers/dma/mv_xor.c |
2384 |
++++ b/drivers/dma/mv_xor.c |
2385 |
+@@ -273,7 +273,8 @@ static void mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan) |
2386 |
+ dma_cookie_t cookie = 0; |
2387 |
+ int busy = mv_chan_is_busy(mv_chan); |
2388 |
+ u32 current_desc = mv_chan_get_current_desc(mv_chan); |
2389 |
+- int seen_current = 0; |
2390 |
++ int current_cleaned = 0; |
2391 |
++ struct mv_xor_desc *hw_desc; |
2392 |
+ |
2393 |
+ dev_dbg(mv_chan_to_devp(mv_chan), "%s %d\n", __func__, __LINE__); |
2394 |
+ dev_dbg(mv_chan_to_devp(mv_chan), "current_desc %x\n", current_desc); |
2395 |
+@@ -285,38 +286,57 @@ static void mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan) |
2396 |
+ |
2397 |
+ list_for_each_entry_safe(iter, _iter, &mv_chan->chain, |
2398 |
+ chain_node) { |
2399 |
+- prefetch(_iter); |
2400 |
+- prefetch(&_iter->async_tx); |
2401 |
+ |
2402 |
+- /* do not advance past the current descriptor loaded into the |
2403 |
+- * hardware channel, subsequent descriptors are either in |
2404 |
+- * process or have not been submitted |
2405 |
+- */ |
2406 |
+- if (seen_current) |
2407 |
+- break; |
2408 |
++ /* clean finished descriptors */ |
2409 |
++ hw_desc = iter->hw_desc; |
2410 |
++ if (hw_desc->status & XOR_DESC_SUCCESS) { |
2411 |
++ cookie = mv_xor_run_tx_complete_actions(iter, mv_chan, |
2412 |
++ cookie); |
2413 |
+ |
2414 |
+- /* stop the search if we reach the current descriptor and the |
2415 |
+- * channel is busy |
2416 |
+- */ |
2417 |
+- if (iter->async_tx.phys == current_desc) { |
2418 |
+- seen_current = 1; |
2419 |
+- if (busy) |
2420 |
++ /* done processing desc, clean slot */ |
2421 |
++ mv_xor_clean_slot(iter, mv_chan); |
2422 |
++ |
2423 |
++ /* break if we did cleaned the current */ |
2424 |
++ if (iter->async_tx.phys == current_desc) { |
2425 |
++ current_cleaned = 1; |
2426 |
++ break; |
2427 |
++ } |
2428 |
++ } else { |
2429 |
++ if (iter->async_tx.phys == current_desc) { |
2430 |
++ current_cleaned = 0; |
2431 |
+ break; |
2432 |
++ } |
2433 |
+ } |
2434 |
+- |
2435 |
+- cookie = mv_xor_run_tx_complete_actions(iter, mv_chan, cookie); |
2436 |
+- |
2437 |
+- if (mv_xor_clean_slot(iter, mv_chan)) |
2438 |
+- break; |
2439 |
+ } |
2440 |
+ |
2441 |
+ if ((busy == 0) && !list_empty(&mv_chan->chain)) { |
2442 |
+- struct mv_xor_desc_slot *chain_head; |
2443 |
+- chain_head = list_entry(mv_chan->chain.next, |
2444 |
+- struct mv_xor_desc_slot, |
2445 |
+- chain_node); |
2446 |
+- |
2447 |
+- mv_xor_start_new_chain(mv_chan, chain_head); |
2448 |
++ if (current_cleaned) { |
2449 |
++ /* |
2450 |
++ * current descriptor cleaned and removed, run |
2451 |
++ * from list head |
2452 |
++ */ |
2453 |
++ iter = list_entry(mv_chan->chain.next, |
2454 |
++ struct mv_xor_desc_slot, |
2455 |
++ chain_node); |
2456 |
++ mv_xor_start_new_chain(mv_chan, iter); |
2457 |
++ } else { |
2458 |
++ if (!list_is_last(&iter->chain_node, &mv_chan->chain)) { |
2459 |
++ /* |
2460 |
++ * descriptors are still waiting after |
2461 |
++ * current, trigger them |
2462 |
++ */ |
2463 |
++ iter = list_entry(iter->chain_node.next, |
2464 |
++ struct mv_xor_desc_slot, |
2465 |
++ chain_node); |
2466 |
++ mv_xor_start_new_chain(mv_chan, iter); |
2467 |
++ } else { |
2468 |
++ /* |
2469 |
++ * some descriptors are still waiting |
2470 |
++ * to be cleaned |
2471 |
++ */ |
2472 |
++ tasklet_schedule(&mv_chan->irq_tasklet); |
2473 |
++ } |
2474 |
++ } |
2475 |
+ } |
2476 |
+ |
2477 |
+ if (cookie > 0) |
2478 |
+diff --git a/drivers/dma/mv_xor.h b/drivers/dma/mv_xor.h |
2479 |
+index 91958dba39a2..0e302b3a33ad 100644 |
2480 |
+--- a/drivers/dma/mv_xor.h |
2481 |
++++ b/drivers/dma/mv_xor.h |
2482 |
+@@ -31,6 +31,7 @@ |
2483 |
+ #define XOR_OPERATION_MODE_XOR 0 |
2484 |
+ #define XOR_OPERATION_MODE_MEMCPY 2 |
2485 |
+ #define XOR_DESCRIPTOR_SWAP BIT(14) |
2486 |
++#define XOR_DESC_SUCCESS 0x40000000 |
2487 |
+ |
2488 |
+ #define XOR_DESC_DMA_OWNED BIT(31) |
2489 |
+ #define XOR_DESC_EOD_INT_EN BIT(31) |
2490 |
+diff --git a/drivers/edac/octeon_edac-l2c.c b/drivers/edac/octeon_edac-l2c.c |
2491 |
+index 7e98084d3645..afea7fc625cc 100644 |
2492 |
+--- a/drivers/edac/octeon_edac-l2c.c |
2493 |
++++ b/drivers/edac/octeon_edac-l2c.c |
2494 |
+@@ -151,7 +151,7 @@ static int octeon_l2c_probe(struct platform_device *pdev) |
2495 |
+ l2c->ctl_name = "octeon_l2c_err"; |
2496 |
+ |
2497 |
+ |
2498 |
+- if (OCTEON_IS_MODEL(OCTEON_FAM_1_PLUS)) { |
2499 |
++ if (OCTEON_IS_OCTEON1PLUS()) { |
2500 |
+ union cvmx_l2t_err l2t_err; |
2501 |
+ union cvmx_l2d_err l2d_err; |
2502 |
+ |
2503 |
+diff --git a/drivers/edac/octeon_edac-lmc.c b/drivers/edac/octeon_edac-lmc.c |
2504 |
+index bb19e0732681..cda6dab5067a 100644 |
2505 |
+--- a/drivers/edac/octeon_edac-lmc.c |
2506 |
++++ b/drivers/edac/octeon_edac-lmc.c |
2507 |
+@@ -234,7 +234,7 @@ static int octeon_lmc_edac_probe(struct platform_device *pdev) |
2508 |
+ layers[0].size = 1; |
2509 |
+ layers[0].is_virt_csrow = false; |
2510 |
+ |
2511 |
+- if (OCTEON_IS_MODEL(OCTEON_FAM_1_PLUS)) { |
2512 |
++ if (OCTEON_IS_OCTEON1PLUS()) { |
2513 |
+ union cvmx_lmcx_mem_cfg0 cfg0; |
2514 |
+ |
2515 |
+ cfg0.u64 = cvmx_read_csr(CVMX_LMCX_MEM_CFG0(0)); |
2516 |
+diff --git a/drivers/edac/octeon_edac-pc.c b/drivers/edac/octeon_edac-pc.c |
2517 |
+index 0f83c33a7d1f..2ab6cf24c959 100644 |
2518 |
+--- a/drivers/edac/octeon_edac-pc.c |
2519 |
++++ b/drivers/edac/octeon_edac-pc.c |
2520 |
+@@ -73,7 +73,7 @@ static int co_cache_error_event(struct notifier_block *this, |
2521 |
+ edac_device_handle_ce(p->ed, cpu, 0, "dcache"); |
2522 |
+ |
2523 |
+ /* Clear the error indication */ |
2524 |
+- if (OCTEON_IS_MODEL(OCTEON_FAM_2)) |
2525 |
++ if (OCTEON_IS_OCTEON2()) |
2526 |
+ write_octeon_c0_dcacheerr(1); |
2527 |
+ else |
2528 |
+ write_octeon_c0_dcacheerr(0); |
2529 |
+diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c |
2530 |
+index 97b1616aa391..bba843c2b0ac 100644 |
2531 |
+--- a/drivers/firmware/dmi_scan.c |
2532 |
++++ b/drivers/firmware/dmi_scan.c |
2533 |
+@@ -89,9 +89,9 @@ static void dmi_table(u8 *buf, |
2534 |
+ |
2535 |
+ /* |
2536 |
+ * Stop when we have seen all the items the table claimed to have |
2537 |
+- * (SMBIOS < 3.0 only) OR we reach an end-of-table marker OR we run |
2538 |
+- * off the end of the table (should never happen but sometimes does |
2539 |
+- * on bogus implementations.) |
2540 |
++ * (SMBIOS < 3.0 only) OR we reach an end-of-table marker (SMBIOS |
2541 |
++ * >= 3.0 only) OR we run off the end of the table (should never |
2542 |
++ * happen but sometimes does on bogus implementations.) |
2543 |
+ */ |
2544 |
+ while ((!dmi_num || i < dmi_num) && |
2545 |
+ (data - buf + sizeof(struct dmi_header)) <= dmi_len) { |
2546 |
+@@ -110,8 +110,13 @@ static void dmi_table(u8 *buf, |
2547 |
+ |
2548 |
+ /* |
2549 |
+ * 7.45 End-of-Table (Type 127) [SMBIOS reference spec v3.0.0] |
2550 |
++ * For tables behind a 64-bit entry point, we have no item |
2551 |
++ * count and no exact table length, so stop on end-of-table |
2552 |
++ * marker. For tables behind a 32-bit entry point, we have |
2553 |
++ * seen OEM structures behind the end-of-table marker on |
2554 |
++ * some systems, so don't trust it. |
2555 |
+ */ |
2556 |
+- if (dm->type == DMI_ENTRY_END_OF_TABLE) |
2557 |
++ if (!dmi_num && dm->type == DMI_ENTRY_END_OF_TABLE) |
2558 |
+ break; |
2559 |
+ |
2560 |
+ data += 2; |
2561 |
+diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c |
2562 |
+index 9d2f053382e1..63a09e4079f3 100644 |
2563 |
+--- a/drivers/gpu/drm/bridge/ptn3460.c |
2564 |
++++ b/drivers/gpu/drm/bridge/ptn3460.c |
2565 |
+@@ -15,6 +15,7 @@ |
2566 |
+ |
2567 |
+ #include <linux/delay.h> |
2568 |
+ #include <linux/gpio.h> |
2569 |
++#include <linux/gpio/consumer.h> |
2570 |
+ #include <linux/i2c.h> |
2571 |
+ #include <linux/module.h> |
2572 |
+ #include <linux/of.h> |
2573 |
+diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c |
2574 |
+index 3007b44e6bf4..800a025dd062 100644 |
2575 |
+--- a/drivers/gpu/drm/drm_crtc.c |
2576 |
++++ b/drivers/gpu/drm/drm_crtc.c |
2577 |
+@@ -2749,8 +2749,11 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, |
2578 |
+ if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
2579 |
+ return -EINVAL; |
2580 |
+ |
2581 |
+- /* For some reason crtc x/y offsets are signed internally. */ |
2582 |
+- if (crtc_req->x > INT_MAX || crtc_req->y > INT_MAX) |
2583 |
++ /* |
2584 |
++ * Universal plane src offsets are only 16.16, prevent havoc for |
2585 |
++ * drivers using universal plane code internally. |
2586 |
++ */ |
2587 |
++ if (crtc_req->x & 0xffff0000 || crtc_req->y & 0xffff0000) |
2588 |
+ return -ERANGE; |
2589 |
+ |
2590 |
+ drm_modeset_lock_all(dev); |
2591 |
+@@ -5048,12 +5051,9 @@ void drm_mode_config_reset(struct drm_device *dev) |
2592 |
+ if (encoder->funcs->reset) |
2593 |
+ encoder->funcs->reset(encoder); |
2594 |
+ |
2595 |
+- list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
2596 |
+- connector->status = connector_status_unknown; |
2597 |
+- |
2598 |
++ list_for_each_entry(connector, &dev->mode_config.connector_list, head) |
2599 |
+ if (connector->funcs->reset) |
2600 |
+ connector->funcs->reset(connector); |
2601 |
+- } |
2602 |
+ } |
2603 |
+ EXPORT_SYMBOL(drm_mode_config_reset); |
2604 |
+ |
2605 |
+diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c |
2606 |
+index 132581ca4ad8..778bbb6425b8 100644 |
2607 |
+--- a/drivers/gpu/drm/drm_dp_mst_topology.c |
2608 |
++++ b/drivers/gpu/drm/drm_dp_mst_topology.c |
2609 |
+@@ -867,8 +867,16 @@ static void drm_dp_destroy_port(struct kref *kref) |
2610 |
+ port->vcpi.num_slots = 0; |
2611 |
+ |
2612 |
+ kfree(port->cached_edid); |
2613 |
+- if (port->connector) |
2614 |
+- (*port->mgr->cbs->destroy_connector)(mgr, port->connector); |
2615 |
++ |
2616 |
++ /* we can't destroy the connector here, as |
2617 |
++ we might be holding the mode_config.mutex |
2618 |
++ from an EDID retrieval */ |
2619 |
++ if (port->connector) { |
2620 |
++ mutex_lock(&mgr->destroy_connector_lock); |
2621 |
++ list_add(&port->connector->destroy_list, &mgr->destroy_connector_list); |
2622 |
++ mutex_unlock(&mgr->destroy_connector_lock); |
2623 |
++ schedule_work(&mgr->destroy_connector_work); |
2624 |
++ } |
2625 |
+ drm_dp_port_teardown_pdt(port, port->pdt); |
2626 |
+ |
2627 |
+ if (!port->input && port->vcpi.vcpi > 0) |
2628 |
+@@ -1163,6 +1171,8 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_ |
2629 |
+ struct drm_dp_mst_port *port; |
2630 |
+ int i; |
2631 |
+ /* find the port by iterating down */ |
2632 |
++ |
2633 |
++ mutex_lock(&mgr->lock); |
2634 |
+ mstb = mgr->mst_primary; |
2635 |
+ |
2636 |
+ for (i = 0; i < lct - 1; i++) { |
2637 |
+@@ -1182,6 +1192,7 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_ |
2638 |
+ } |
2639 |
+ } |
2640 |
+ kref_get(&mstb->kref); |
2641 |
++ mutex_unlock(&mgr->lock); |
2642 |
+ return mstb; |
2643 |
+ } |
2644 |
+ |
2645 |
+@@ -1189,7 +1200,7 @@ static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *m |
2646 |
+ struct drm_dp_mst_branch *mstb) |
2647 |
+ { |
2648 |
+ struct drm_dp_mst_port *port; |
2649 |
+- |
2650 |
++ struct drm_dp_mst_branch *mstb_child; |
2651 |
+ if (!mstb->link_address_sent) { |
2652 |
+ drm_dp_send_link_address(mgr, mstb); |
2653 |
+ mstb->link_address_sent = true; |
2654 |
+@@ -1204,17 +1215,31 @@ static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *m |
2655 |
+ if (!port->available_pbn) |
2656 |
+ drm_dp_send_enum_path_resources(mgr, mstb, port); |
2657 |
+ |
2658 |
+- if (port->mstb) |
2659 |
+- drm_dp_check_and_send_link_address(mgr, port->mstb); |
2660 |
++ if (port->mstb) { |
2661 |
++ mstb_child = drm_dp_get_validated_mstb_ref(mgr, port->mstb); |
2662 |
++ if (mstb_child) { |
2663 |
++ drm_dp_check_and_send_link_address(mgr, mstb_child); |
2664 |
++ drm_dp_put_mst_branch_device(mstb_child); |
2665 |
++ } |
2666 |
++ } |
2667 |
+ } |
2668 |
+ } |
2669 |
+ |
2670 |
+ static void drm_dp_mst_link_probe_work(struct work_struct *work) |
2671 |
+ { |
2672 |
+ struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct drm_dp_mst_topology_mgr, work); |
2673 |
++ struct drm_dp_mst_branch *mstb; |
2674 |
+ |
2675 |
+- drm_dp_check_and_send_link_address(mgr, mgr->mst_primary); |
2676 |
+- |
2677 |
++ mutex_lock(&mgr->lock); |
2678 |
++ mstb = mgr->mst_primary; |
2679 |
++ if (mstb) { |
2680 |
++ kref_get(&mstb->kref); |
2681 |
++ } |
2682 |
++ mutex_unlock(&mgr->lock); |
2683 |
++ if (mstb) { |
2684 |
++ drm_dp_check_and_send_link_address(mgr, mstb); |
2685 |
++ drm_dp_put_mst_branch_device(mstb); |
2686 |
++ } |
2687 |
+ } |
2688 |
+ |
2689 |
+ static bool drm_dp_validate_guid(struct drm_dp_mst_topology_mgr *mgr, |
2690 |
+@@ -2632,6 +2657,30 @@ static void drm_dp_tx_work(struct work_struct *work) |
2691 |
+ mutex_unlock(&mgr->qlock); |
2692 |
+ } |
2693 |
+ |
2694 |
++static void drm_dp_destroy_connector_work(struct work_struct *work) |
2695 |
++{ |
2696 |
++ struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct drm_dp_mst_topology_mgr, destroy_connector_work); |
2697 |
++ struct drm_connector *connector; |
2698 |
++ |
2699 |
++ /* |
2700 |
++ * Not a regular list traverse as we have to drop the destroy |
2701 |
++ * connector lock before destroying the connector, to avoid AB->BA |
2702 |
++ * ordering between this lock and the config mutex. |
2703 |
++ */ |
2704 |
++ for (;;) { |
2705 |
++ mutex_lock(&mgr->destroy_connector_lock); |
2706 |
++ connector = list_first_entry_or_null(&mgr->destroy_connector_list, struct drm_connector, destroy_list); |
2707 |
++ if (!connector) { |
2708 |
++ mutex_unlock(&mgr->destroy_connector_lock); |
2709 |
++ break; |
2710 |
++ } |
2711 |
++ list_del(&connector->destroy_list); |
2712 |
++ mutex_unlock(&mgr->destroy_connector_lock); |
2713 |
++ |
2714 |
++ mgr->cbs->destroy_connector(mgr, connector); |
2715 |
++ } |
2716 |
++} |
2717 |
++ |
2718 |
+ /** |
2719 |
+ * drm_dp_mst_topology_mgr_init - initialise a topology manager |
2720 |
+ * @mgr: manager struct to initialise |
2721 |
+@@ -2651,10 +2700,13 @@ int drm_dp_mst_topology_mgr_init(struct drm_dp_mst_topology_mgr *mgr, |
2722 |
+ mutex_init(&mgr->lock); |
2723 |
+ mutex_init(&mgr->qlock); |
2724 |
+ mutex_init(&mgr->payload_lock); |
2725 |
++ mutex_init(&mgr->destroy_connector_lock); |
2726 |
+ INIT_LIST_HEAD(&mgr->tx_msg_upq); |
2727 |
+ INIT_LIST_HEAD(&mgr->tx_msg_downq); |
2728 |
++ INIT_LIST_HEAD(&mgr->destroy_connector_list); |
2729 |
+ INIT_WORK(&mgr->work, drm_dp_mst_link_probe_work); |
2730 |
+ INIT_WORK(&mgr->tx_work, drm_dp_tx_work); |
2731 |
++ INIT_WORK(&mgr->destroy_connector_work, drm_dp_destroy_connector_work); |
2732 |
+ init_waitqueue_head(&mgr->tx_waitq); |
2733 |
+ mgr->dev = dev; |
2734 |
+ mgr->aux = aux; |
2735 |
+@@ -2679,6 +2731,7 @@ EXPORT_SYMBOL(drm_dp_mst_topology_mgr_init); |
2736 |
+ */ |
2737 |
+ void drm_dp_mst_topology_mgr_destroy(struct drm_dp_mst_topology_mgr *mgr) |
2738 |
+ { |
2739 |
++ flush_work(&mgr->destroy_connector_work); |
2740 |
+ mutex_lock(&mgr->payload_lock); |
2741 |
+ kfree(mgr->payloads); |
2742 |
+ mgr->payloads = NULL; |
2743 |
+diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c |
2744 |
+index aa8bbb460c57..9cfcd0aef0df 100644 |
2745 |
+--- a/drivers/gpu/drm/drm_ioc32.c |
2746 |
++++ b/drivers/gpu/drm/drm_ioc32.c |
2747 |
+@@ -70,6 +70,8 @@ |
2748 |
+ |
2749 |
+ #define DRM_IOCTL_WAIT_VBLANK32 DRM_IOWR(0x3a, drm_wait_vblank32_t) |
2750 |
+ |
2751 |
++#define DRM_IOCTL_MODE_ADDFB232 DRM_IOWR(0xb8, drm_mode_fb_cmd232_t) |
2752 |
++ |
2753 |
+ typedef struct drm_version_32 { |
2754 |
+ int version_major; /**< Major version */ |
2755 |
+ int version_minor; /**< Minor version */ |
2756 |
+@@ -1016,6 +1018,63 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd, |
2757 |
+ return 0; |
2758 |
+ } |
2759 |
+ |
2760 |
++typedef struct drm_mode_fb_cmd232 { |
2761 |
++ u32 fb_id; |
2762 |
++ u32 width; |
2763 |
++ u32 height; |
2764 |
++ u32 pixel_format; |
2765 |
++ u32 flags; |
2766 |
++ u32 handles[4]; |
2767 |
++ u32 pitches[4]; |
2768 |
++ u32 offsets[4]; |
2769 |
++ u64 modifier[4]; |
2770 |
++} __attribute__((packed)) drm_mode_fb_cmd232_t; |
2771 |
++ |
2772 |
++static int compat_drm_mode_addfb2(struct file *file, unsigned int cmd, |
2773 |
++ unsigned long arg) |
2774 |
++{ |
2775 |
++ struct drm_mode_fb_cmd232 __user *argp = (void __user *)arg; |
2776 |
++ struct drm_mode_fb_cmd232 req32; |
2777 |
++ struct drm_mode_fb_cmd2 __user *req64; |
2778 |
++ int i; |
2779 |
++ int err; |
2780 |
++ |
2781 |
++ if (copy_from_user(&req32, argp, sizeof(req32))) |
2782 |
++ return -EFAULT; |
2783 |
++ |
2784 |
++ req64 = compat_alloc_user_space(sizeof(*req64)); |
2785 |
++ |
2786 |
++ if (!access_ok(VERIFY_WRITE, req64, sizeof(*req64)) |
2787 |
++ || __put_user(req32.width, &req64->width) |
2788 |
++ || __put_user(req32.height, &req64->height) |
2789 |
++ || __put_user(req32.pixel_format, &req64->pixel_format) |
2790 |
++ || __put_user(req32.flags, &req64->flags)) |
2791 |
++ return -EFAULT; |
2792 |
++ |
2793 |
++ for (i = 0; i < 4; i++) { |
2794 |
++ if (__put_user(req32.handles[i], &req64->handles[i])) |
2795 |
++ return -EFAULT; |
2796 |
++ if (__put_user(req32.pitches[i], &req64->pitches[i])) |
2797 |
++ return -EFAULT; |
2798 |
++ if (__put_user(req32.offsets[i], &req64->offsets[i])) |
2799 |
++ return -EFAULT; |
2800 |
++ if (__put_user(req32.modifier[i], &req64->modifier[i])) |
2801 |
++ return -EFAULT; |
2802 |
++ } |
2803 |
++ |
2804 |
++ err = drm_ioctl(file, DRM_IOCTL_MODE_ADDFB2, (unsigned long)req64); |
2805 |
++ if (err) |
2806 |
++ return err; |
2807 |
++ |
2808 |
++ if (__get_user(req32.fb_id, &req64->fb_id)) |
2809 |
++ return -EFAULT; |
2810 |
++ |
2811 |
++ if (copy_to_user(argp, &req32, sizeof(req32))) |
2812 |
++ return -EFAULT; |
2813 |
++ |
2814 |
++ return 0; |
2815 |
++} |
2816 |
++ |
2817 |
+ static drm_ioctl_compat_t *drm_compat_ioctls[] = { |
2818 |
+ [DRM_IOCTL_NR(DRM_IOCTL_VERSION32)] = compat_drm_version, |
2819 |
+ [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE32)] = compat_drm_getunique, |
2820 |
+@@ -1048,6 +1107,7 @@ static drm_ioctl_compat_t *drm_compat_ioctls[] = { |
2821 |
+ [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw, |
2822 |
+ #endif |
2823 |
+ [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank, |
2824 |
++ [DRM_IOCTL_NR(DRM_IOCTL_MODE_ADDFB232)] = compat_drm_mode_addfb2, |
2825 |
+ }; |
2826 |
+ |
2827 |
+ /** |
2828 |
+diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c |
2829 |
+index 2d0995e7afc3..596bce56e379 100644 |
2830 |
+--- a/drivers/gpu/drm/i915/i915_gem.c |
2831 |
++++ b/drivers/gpu/drm/i915/i915_gem.c |
2832 |
+@@ -2401,6 +2401,7 @@ int __i915_add_request(struct intel_engine_cs *ring, |
2833 |
+ } |
2834 |
+ |
2835 |
+ request->emitted_jiffies = jiffies; |
2836 |
++ ring->last_submitted_seqno = request->seqno; |
2837 |
+ list_add_tail(&request->list, &ring->request_list); |
2838 |
+ request->file_priv = NULL; |
2839 |
+ |
2840 |
+diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c |
2841 |
+index 0239fbff7bf7..ad90fa3045e5 100644 |
2842 |
+--- a/drivers/gpu/drm/i915/i915_gem_gtt.c |
2843 |
++++ b/drivers/gpu/drm/i915/i915_gem_gtt.c |
2844 |
+@@ -502,17 +502,17 @@ static void gen8_ppgtt_clear_range(struct i915_address_space *vm, |
2845 |
+ struct page *page_table; |
2846 |
+ |
2847 |
+ if (WARN_ON(!ppgtt->pdp.page_directory[pdpe])) |
2848 |
+- continue; |
2849 |
++ break; |
2850 |
+ |
2851 |
+ pd = ppgtt->pdp.page_directory[pdpe]; |
2852 |
+ |
2853 |
+ if (WARN_ON(!pd->page_table[pde])) |
2854 |
+- continue; |
2855 |
++ break; |
2856 |
+ |
2857 |
+ pt = pd->page_table[pde]; |
2858 |
+ |
2859 |
+ if (WARN_ON(!pt->page)) |
2860 |
+- continue; |
2861 |
++ break; |
2862 |
+ |
2863 |
+ page_table = pt->page; |
2864 |
+ |
2865 |
+diff --git a/drivers/gpu/drm/i915/i915_ioc32.c b/drivers/gpu/drm/i915/i915_ioc32.c |
2866 |
+index 176de6322e4d..23aa04cded6b 100644 |
2867 |
+--- a/drivers/gpu/drm/i915/i915_ioc32.c |
2868 |
++++ b/drivers/gpu/drm/i915/i915_ioc32.c |
2869 |
+@@ -204,7 +204,7 @@ long i915_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
2870 |
+ drm_ioctl_compat_t *fn = NULL; |
2871 |
+ int ret; |
2872 |
+ |
2873 |
+- if (nr < DRM_COMMAND_BASE) |
2874 |
++ if (nr < DRM_COMMAND_BASE || nr >= DRM_COMMAND_END) |
2875 |
+ return drm_compat_ioctl(filp, cmd, arg); |
2876 |
+ |
2877 |
+ if (nr < DRM_COMMAND_BASE + ARRAY_SIZE(i915_compat_ioctls)) |
2878 |
+diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c |
2879 |
+index 6d494432b19f..b0df8d10482a 100644 |
2880 |
+--- a/drivers/gpu/drm/i915/i915_irq.c |
2881 |
++++ b/drivers/gpu/drm/i915/i915_irq.c |
2882 |
+@@ -2650,18 +2650,11 @@ static void gen8_disable_vblank(struct drm_device *dev, int pipe) |
2883 |
+ spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); |
2884 |
+ } |
2885 |
+ |
2886 |
+-static struct drm_i915_gem_request * |
2887 |
+-ring_last_request(struct intel_engine_cs *ring) |
2888 |
+-{ |
2889 |
+- return list_entry(ring->request_list.prev, |
2890 |
+- struct drm_i915_gem_request, list); |
2891 |
+-} |
2892 |
+- |
2893 |
+ static bool |
2894 |
+-ring_idle(struct intel_engine_cs *ring) |
2895 |
++ring_idle(struct intel_engine_cs *ring, u32 seqno) |
2896 |
+ { |
2897 |
+ return (list_empty(&ring->request_list) || |
2898 |
+- i915_gem_request_completed(ring_last_request(ring), false)); |
2899 |
++ i915_seqno_passed(seqno, ring->last_submitted_seqno)); |
2900 |
+ } |
2901 |
+ |
2902 |
+ static bool |
2903 |
+@@ -2883,7 +2876,7 @@ static void i915_hangcheck_elapsed(struct work_struct *work) |
2904 |
+ acthd = intel_ring_get_active_head(ring); |
2905 |
+ |
2906 |
+ if (ring->hangcheck.seqno == seqno) { |
2907 |
+- if (ring_idle(ring)) { |
2908 |
++ if (ring_idle(ring, seqno)) { |
2909 |
+ ring->hangcheck.action = HANGCHECK_IDLE; |
2910 |
+ |
2911 |
+ if (waitqueue_active(&ring->irq_queue)) { |
2912 |
+diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h |
2913 |
+index 773d1d24e604..a30db4b4050e 100644 |
2914 |
+--- a/drivers/gpu/drm/i915/i915_reg.h |
2915 |
++++ b/drivers/gpu/drm/i915/i915_reg.h |
2916 |
+@@ -3209,6 +3209,7 @@ enum skl_disp_power_wells { |
2917 |
+ #define BLM_POLARITY_PNV (1 << 0) /* pnv only */ |
2918 |
+ |
2919 |
+ #define BLC_HIST_CTL (dev_priv->info.display_mmio_offset + 0x61260) |
2920 |
++#define BLM_HISTOGRAM_ENABLE (1 << 31) |
2921 |
+ |
2922 |
+ /* New registers for PCH-split platforms. Safe where new bits show up, the |
2923 |
+ * register layout machtes with gen4 BLC_PWM_CTL[12]. */ |
2924 |
+diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
2925 |
+index d0f3cbc87474..57c887843dc3 100644 |
2926 |
+--- a/drivers/gpu/drm/i915/intel_display.c |
2927 |
++++ b/drivers/gpu/drm/i915/intel_display.c |
2928 |
+@@ -12499,6 +12499,16 @@ intel_check_primary_plane(struct drm_plane *plane, |
2929 |
+ intel_crtc->atomic.wait_vblank = true; |
2930 |
+ } |
2931 |
+ |
2932 |
++ /* |
2933 |
++ * FIXME: Actually if we will still have any other plane enabled |
2934 |
++ * on the pipe we could let IPS enabled still, but for |
2935 |
++ * now lets consider that when we make primary invisible |
2936 |
++ * by setting DSPCNTR to 0 on update_primary_plane function |
2937 |
++ * IPS needs to be disable. |
2938 |
++ */ |
2939 |
++ if (!state->visible || !fb) |
2940 |
++ intel_crtc->atomic.disable_ips = true; |
2941 |
++ |
2942 |
+ intel_crtc->atomic.fb_bits |= |
2943 |
+ INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe); |
2944 |
+ |
2945 |
+@@ -12590,6 +12600,9 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc) |
2946 |
+ if (intel_crtc->atomic.disable_fbc) |
2947 |
+ intel_fbc_disable(dev); |
2948 |
+ |
2949 |
++ if (intel_crtc->atomic.disable_ips) |
2950 |
++ hsw_disable_ips(intel_crtc); |
2951 |
++ |
2952 |
+ if (intel_crtc->atomic.pre_disable_primary) |
2953 |
+ intel_pre_disable_primary(crtc); |
2954 |
+ |
2955 |
+diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h |
2956 |
+index 897f17db08af..68d1f74a7403 100644 |
2957 |
+--- a/drivers/gpu/drm/i915/intel_drv.h |
2958 |
++++ b/drivers/gpu/drm/i915/intel_drv.h |
2959 |
+@@ -424,6 +424,7 @@ struct intel_crtc_atomic_commit { |
2960 |
+ /* Sleepable operations to perform before commit */ |
2961 |
+ bool wait_for_flips; |
2962 |
+ bool disable_fbc; |
2963 |
++ bool disable_ips; |
2964 |
+ bool pre_disable_primary; |
2965 |
+ bool update_wm; |
2966 |
+ unsigned disabled_planes; |
2967 |
+diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c |
2968 |
+index 08532d4ffe0a..2bf92cba4a55 100644 |
2969 |
+--- a/drivers/gpu/drm/i915/intel_panel.c |
2970 |
++++ b/drivers/gpu/drm/i915/intel_panel.c |
2971 |
+@@ -879,6 +879,14 @@ static void i9xx_enable_backlight(struct intel_connector *connector) |
2972 |
+ |
2973 |
+ /* XXX: combine this into above write? */ |
2974 |
+ intel_panel_actually_set_backlight(connector, panel->backlight.level); |
2975 |
++ |
2976 |
++ /* |
2977 |
++ * Needed to enable backlight on some 855gm models. BLC_HIST_CTL is |
2978 |
++ * 855gm only, but checking for gen2 is safe, as 855gm is the only gen2 |
2979 |
++ * that has backlight. |
2980 |
++ */ |
2981 |
++ if (IS_GEN2(dev)) |
2982 |
++ I915_WRITE(BLC_HIST_CTL, BLM_HISTOGRAM_ENABLE); |
2983 |
+ } |
2984 |
+ |
2985 |
+ static void i965_enable_backlight(struct intel_connector *connector) |
2986 |
+diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h |
2987 |
+index c761fe05ad6f..94514d364d25 100644 |
2988 |
+--- a/drivers/gpu/drm/i915/intel_ringbuffer.h |
2989 |
++++ b/drivers/gpu/drm/i915/intel_ringbuffer.h |
2990 |
+@@ -266,6 +266,13 @@ struct intel_engine_cs { |
2991 |
+ * Do we have some not yet emitted requests outstanding? |
2992 |
+ */ |
2993 |
+ struct drm_i915_gem_request *outstanding_lazy_request; |
2994 |
++ /** |
2995 |
++ * Seqno of request most recently submitted to request_list. |
2996 |
++ * Used exclusively by hang checker to avoid grabbing lock while |
2997 |
++ * inspecting request list. |
2998 |
++ */ |
2999 |
++ u32 last_submitted_seqno; |
3000 |
++ |
3001 |
+ bool gpu_caches_dirty; |
3002 |
+ |
3003 |
+ wait_queue_head_t irq_queue; |
3004 |
+diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c |
3005 |
+index ff2a74651dd4..a18807ec8371 100644 |
3006 |
+--- a/drivers/gpu/drm/i915/intel_uncore.c |
3007 |
++++ b/drivers/gpu/drm/i915/intel_uncore.c |
3008 |
+@@ -1220,10 +1220,12 @@ int i915_reg_read_ioctl(struct drm_device *dev, |
3009 |
+ struct drm_i915_private *dev_priv = dev->dev_private; |
3010 |
+ struct drm_i915_reg_read *reg = data; |
3011 |
+ struct register_whitelist const *entry = whitelist; |
3012 |
++ unsigned size; |
3013 |
++ u64 offset; |
3014 |
+ int i, ret = 0; |
3015 |
+ |
3016 |
+ for (i = 0; i < ARRAY_SIZE(whitelist); i++, entry++) { |
3017 |
+- if (entry->offset == reg->offset && |
3018 |
++ if (entry->offset == (reg->offset & -entry->size) && |
3019 |
+ (1 << INTEL_INFO(dev)->gen & entry->gen_bitmask)) |
3020 |
+ break; |
3021 |
+ } |
3022 |
+@@ -1231,23 +1233,33 @@ int i915_reg_read_ioctl(struct drm_device *dev, |
3023 |
+ if (i == ARRAY_SIZE(whitelist)) |
3024 |
+ return -EINVAL; |
3025 |
+ |
3026 |
++ /* We use the low bits to encode extra flags as the register should |
3027 |
++ * be naturally aligned (and those that are not so aligned merely |
3028 |
++ * limit the available flags for that register). |
3029 |
++ */ |
3030 |
++ offset = entry->offset; |
3031 |
++ size = entry->size; |
3032 |
++ size |= reg->offset ^ offset; |
3033 |
++ |
3034 |
+ intel_runtime_pm_get(dev_priv); |
3035 |
+ |
3036 |
+- switch (entry->size) { |
3037 |
++ switch (size) { |
3038 |
++ case 8 | 1: |
3039 |
++ reg->val = I915_READ64_2x32(offset, offset+4); |
3040 |
++ break; |
3041 |
+ case 8: |
3042 |
+- reg->val = I915_READ64(reg->offset); |
3043 |
++ reg->val = I915_READ64(offset); |
3044 |
+ break; |
3045 |
+ case 4: |
3046 |
+- reg->val = I915_READ(reg->offset); |
3047 |
++ reg->val = I915_READ(offset); |
3048 |
+ break; |
3049 |
+ case 2: |
3050 |
+- reg->val = I915_READ16(reg->offset); |
3051 |
++ reg->val = I915_READ16(offset); |
3052 |
+ break; |
3053 |
+ case 1: |
3054 |
+- reg->val = I915_READ8(reg->offset); |
3055 |
++ reg->val = I915_READ8(offset); |
3056 |
+ break; |
3057 |
+ default: |
3058 |
+- MISSING_CASE(entry->size); |
3059 |
+ ret = -EINVAL; |
3060 |
+ goto out; |
3061 |
+ } |
3062 |
+diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c |
3063 |
+index 97823644d347..f33251d67914 100644 |
3064 |
+--- a/drivers/gpu/drm/qxl/qxl_cmd.c |
3065 |
++++ b/drivers/gpu/drm/qxl/qxl_cmd.c |
3066 |
+@@ -505,6 +505,7 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev, |
3067 |
+ |
3068 |
+ cmd = (struct qxl_surface_cmd *)qxl_release_map(qdev, release); |
3069 |
+ cmd->type = QXL_SURFACE_CMD_CREATE; |
3070 |
++ cmd->flags = QXL_SURF_FLAG_KEEP_DATA; |
3071 |
+ cmd->u.surface_create.format = surf->surf.format; |
3072 |
+ cmd->u.surface_create.width = surf->surf.width; |
3073 |
+ cmd->u.surface_create.height = surf->surf.height; |
3074 |
+diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c |
3075 |
+index b110883f8253..7354a4cda59d 100644 |
3076 |
+--- a/drivers/gpu/drm/qxl/qxl_ioctl.c |
3077 |
++++ b/drivers/gpu/drm/qxl/qxl_ioctl.c |
3078 |
+@@ -122,8 +122,10 @@ static struct qxl_bo *qxlhw_handle_to_bo(struct qxl_device *qdev, |
3079 |
+ qobj = gem_to_qxl_bo(gobj); |
3080 |
+ |
3081 |
+ ret = qxl_release_list_add(release, qobj); |
3082 |
+- if (ret) |
3083 |
++ if (ret) { |
3084 |
++ drm_gem_object_unreference_unlocked(gobj); |
3085 |
+ return NULL; |
3086 |
++ } |
3087 |
+ |
3088 |
+ return qobj; |
3089 |
+ } |
3090 |
+diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c |
3091 |
+index 8730562323a8..4a09947be244 100644 |
3092 |
+--- a/drivers/gpu/drm/radeon/ci_dpm.c |
3093 |
++++ b/drivers/gpu/drm/radeon/ci_dpm.c |
3094 |
+@@ -5818,7 +5818,7 @@ int ci_dpm_init(struct radeon_device *rdev) |
3095 |
+ tmp |= DPM_ENABLED; |
3096 |
+ break; |
3097 |
+ default: |
3098 |
+- DRM_ERROR("Invalid PCC GPIO: %u!\n", gpio.shift); |
3099 |
++ DRM_DEBUG("Invalid PCC GPIO: %u!\n", gpio.shift); |
3100 |
+ break; |
3101 |
+ } |
3102 |
+ WREG32_SMC(CNB_PWRMGT_CNTL, tmp); |
3103 |
+diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c |
3104 |
+index ba50f3c1c2e0..845665362475 100644 |
3105 |
+--- a/drivers/gpu/drm/radeon/cik.c |
3106 |
++++ b/drivers/gpu/drm/radeon/cik.c |
3107 |
+@@ -4579,6 +4579,31 @@ void cik_compute_set_wptr(struct radeon_device *rdev, |
3108 |
+ WDOORBELL32(ring->doorbell_index, ring->wptr); |
3109 |
+ } |
3110 |
+ |
3111 |
++static void cik_compute_stop(struct radeon_device *rdev, |
3112 |
++ struct radeon_ring *ring) |
3113 |
++{ |
3114 |
++ u32 j, tmp; |
3115 |
++ |
3116 |
++ cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); |
3117 |
++ /* Disable wptr polling. */ |
3118 |
++ tmp = RREG32(CP_PQ_WPTR_POLL_CNTL); |
3119 |
++ tmp &= ~WPTR_POLL_EN; |
3120 |
++ WREG32(CP_PQ_WPTR_POLL_CNTL, tmp); |
3121 |
++ /* Disable HQD. */ |
3122 |
++ if (RREG32(CP_HQD_ACTIVE) & 1) { |
3123 |
++ WREG32(CP_HQD_DEQUEUE_REQUEST, 1); |
3124 |
++ for (j = 0; j < rdev->usec_timeout; j++) { |
3125 |
++ if (!(RREG32(CP_HQD_ACTIVE) & 1)) |
3126 |
++ break; |
3127 |
++ udelay(1); |
3128 |
++ } |
3129 |
++ WREG32(CP_HQD_DEQUEUE_REQUEST, 0); |
3130 |
++ WREG32(CP_HQD_PQ_RPTR, 0); |
3131 |
++ WREG32(CP_HQD_PQ_WPTR, 0); |
3132 |
++ } |
3133 |
++ cik_srbm_select(rdev, 0, 0, 0, 0); |
3134 |
++} |
3135 |
++ |
3136 |
+ /** |
3137 |
+ * cik_cp_compute_enable - enable/disable the compute CP MEs |
3138 |
+ * |
3139 |
+@@ -4592,6 +4617,15 @@ static void cik_cp_compute_enable(struct radeon_device *rdev, bool enable) |
3140 |
+ if (enable) |
3141 |
+ WREG32(CP_MEC_CNTL, 0); |
3142 |
+ else { |
3143 |
++ /* |
3144 |
++ * To make hibernation reliable we need to clear compute ring |
3145 |
++ * configuration before halting the compute ring. |
3146 |
++ */ |
3147 |
++ mutex_lock(&rdev->srbm_mutex); |
3148 |
++ cik_compute_stop(rdev,&rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX]); |
3149 |
++ cik_compute_stop(rdev,&rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX]); |
3150 |
++ mutex_unlock(&rdev->srbm_mutex); |
3151 |
++ |
3152 |
+ WREG32(CP_MEC_CNTL, (MEC_ME1_HALT | MEC_ME2_HALT)); |
3153 |
+ rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX].ready = false; |
3154 |
+ rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX].ready = false; |
3155 |
+@@ -7905,23 +7939,27 @@ restart_ih: |
3156 |
+ case 1: /* D1 vblank/vline */ |
3157 |
+ switch (src_data) { |
3158 |
+ case 0: /* D1 vblank */ |
3159 |
+- if (rdev->irq.stat_regs.cik.disp_int & LB_D1_VBLANK_INTERRUPT) { |
3160 |
+- if (rdev->irq.crtc_vblank_int[0]) { |
3161 |
+- drm_handle_vblank(rdev->ddev, 0); |
3162 |
+- rdev->pm.vblank_sync = true; |
3163 |
+- wake_up(&rdev->irq.vblank_queue); |
3164 |
+- } |
3165 |
+- if (atomic_read(&rdev->irq.pflip[0])) |
3166 |
+- radeon_crtc_handle_vblank(rdev, 0); |
3167 |
+- rdev->irq.stat_regs.cik.disp_int &= ~LB_D1_VBLANK_INTERRUPT; |
3168 |
+- DRM_DEBUG("IH: D1 vblank\n"); |
3169 |
++ if (!(rdev->irq.stat_regs.cik.disp_int & LB_D1_VBLANK_INTERRUPT)) |
3170 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3171 |
++ |
3172 |
++ if (rdev->irq.crtc_vblank_int[0]) { |
3173 |
++ drm_handle_vblank(rdev->ddev, 0); |
3174 |
++ rdev->pm.vblank_sync = true; |
3175 |
++ wake_up(&rdev->irq.vblank_queue); |
3176 |
+ } |
3177 |
++ if (atomic_read(&rdev->irq.pflip[0])) |
3178 |
++ radeon_crtc_handle_vblank(rdev, 0); |
3179 |
++ rdev->irq.stat_regs.cik.disp_int &= ~LB_D1_VBLANK_INTERRUPT; |
3180 |
++ DRM_DEBUG("IH: D1 vblank\n"); |
3181 |
++ |
3182 |
+ break; |
3183 |
+ case 1: /* D1 vline */ |
3184 |
+- if (rdev->irq.stat_regs.cik.disp_int & LB_D1_VLINE_INTERRUPT) { |
3185 |
+- rdev->irq.stat_regs.cik.disp_int &= ~LB_D1_VLINE_INTERRUPT; |
3186 |
+- DRM_DEBUG("IH: D1 vline\n"); |
3187 |
+- } |
3188 |
++ if (!(rdev->irq.stat_regs.cik.disp_int & LB_D1_VLINE_INTERRUPT)) |
3189 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3190 |
++ |
3191 |
++ rdev->irq.stat_regs.cik.disp_int &= ~LB_D1_VLINE_INTERRUPT; |
3192 |
++ DRM_DEBUG("IH: D1 vline\n"); |
3193 |
++ |
3194 |
+ break; |
3195 |
+ default: |
3196 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
3197 |
+@@ -7931,23 +7969,27 @@ restart_ih: |
3198 |
+ case 2: /* D2 vblank/vline */ |
3199 |
+ switch (src_data) { |
3200 |
+ case 0: /* D2 vblank */ |
3201 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont & LB_D2_VBLANK_INTERRUPT) { |
3202 |
+- if (rdev->irq.crtc_vblank_int[1]) { |
3203 |
+- drm_handle_vblank(rdev->ddev, 1); |
3204 |
+- rdev->pm.vblank_sync = true; |
3205 |
+- wake_up(&rdev->irq.vblank_queue); |
3206 |
+- } |
3207 |
+- if (atomic_read(&rdev->irq.pflip[1])) |
3208 |
+- radeon_crtc_handle_vblank(rdev, 1); |
3209 |
+- rdev->irq.stat_regs.cik.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT; |
3210 |
+- DRM_DEBUG("IH: D2 vblank\n"); |
3211 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont & LB_D2_VBLANK_INTERRUPT)) |
3212 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3213 |
++ |
3214 |
++ if (rdev->irq.crtc_vblank_int[1]) { |
3215 |
++ drm_handle_vblank(rdev->ddev, 1); |
3216 |
++ rdev->pm.vblank_sync = true; |
3217 |
++ wake_up(&rdev->irq.vblank_queue); |
3218 |
+ } |
3219 |
++ if (atomic_read(&rdev->irq.pflip[1])) |
3220 |
++ radeon_crtc_handle_vblank(rdev, 1); |
3221 |
++ rdev->irq.stat_regs.cik.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT; |
3222 |
++ DRM_DEBUG("IH: D2 vblank\n"); |
3223 |
++ |
3224 |
+ break; |
3225 |
+ case 1: /* D2 vline */ |
3226 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont & LB_D2_VLINE_INTERRUPT) { |
3227 |
+- rdev->irq.stat_regs.cik.disp_int_cont &= ~LB_D2_VLINE_INTERRUPT; |
3228 |
+- DRM_DEBUG("IH: D2 vline\n"); |
3229 |
+- } |
3230 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont & LB_D2_VLINE_INTERRUPT)) |
3231 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3232 |
++ |
3233 |
++ rdev->irq.stat_regs.cik.disp_int_cont &= ~LB_D2_VLINE_INTERRUPT; |
3234 |
++ DRM_DEBUG("IH: D2 vline\n"); |
3235 |
++ |
3236 |
+ break; |
3237 |
+ default: |
3238 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
3239 |
+@@ -7957,23 +7999,27 @@ restart_ih: |
3240 |
+ case 3: /* D3 vblank/vline */ |
3241 |
+ switch (src_data) { |
3242 |
+ case 0: /* D3 vblank */ |
3243 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT) { |
3244 |
+- if (rdev->irq.crtc_vblank_int[2]) { |
3245 |
+- drm_handle_vblank(rdev->ddev, 2); |
3246 |
+- rdev->pm.vblank_sync = true; |
3247 |
+- wake_up(&rdev->irq.vblank_queue); |
3248 |
+- } |
3249 |
+- if (atomic_read(&rdev->irq.pflip[2])) |
3250 |
+- radeon_crtc_handle_vblank(rdev, 2); |
3251 |
+- rdev->irq.stat_regs.cik.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT; |
3252 |
+- DRM_DEBUG("IH: D3 vblank\n"); |
3253 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT)) |
3254 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3255 |
++ |
3256 |
++ if (rdev->irq.crtc_vblank_int[2]) { |
3257 |
++ drm_handle_vblank(rdev->ddev, 2); |
3258 |
++ rdev->pm.vblank_sync = true; |
3259 |
++ wake_up(&rdev->irq.vblank_queue); |
3260 |
+ } |
3261 |
++ if (atomic_read(&rdev->irq.pflip[2])) |
3262 |
++ radeon_crtc_handle_vblank(rdev, 2); |
3263 |
++ rdev->irq.stat_regs.cik.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT; |
3264 |
++ DRM_DEBUG("IH: D3 vblank\n"); |
3265 |
++ |
3266 |
+ break; |
3267 |
+ case 1: /* D3 vline */ |
3268 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont2 & LB_D3_VLINE_INTERRUPT) { |
3269 |
+- rdev->irq.stat_regs.cik.disp_int_cont2 &= ~LB_D3_VLINE_INTERRUPT; |
3270 |
+- DRM_DEBUG("IH: D3 vline\n"); |
3271 |
+- } |
3272 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont2 & LB_D3_VLINE_INTERRUPT)) |
3273 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3274 |
++ |
3275 |
++ rdev->irq.stat_regs.cik.disp_int_cont2 &= ~LB_D3_VLINE_INTERRUPT; |
3276 |
++ DRM_DEBUG("IH: D3 vline\n"); |
3277 |
++ |
3278 |
+ break; |
3279 |
+ default: |
3280 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
3281 |
+@@ -7983,23 +8029,27 @@ restart_ih: |
3282 |
+ case 4: /* D4 vblank/vline */ |
3283 |
+ switch (src_data) { |
3284 |
+ case 0: /* D4 vblank */ |
3285 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont3 & LB_D4_VBLANK_INTERRUPT) { |
3286 |
+- if (rdev->irq.crtc_vblank_int[3]) { |
3287 |
+- drm_handle_vblank(rdev->ddev, 3); |
3288 |
+- rdev->pm.vblank_sync = true; |
3289 |
+- wake_up(&rdev->irq.vblank_queue); |
3290 |
+- } |
3291 |
+- if (atomic_read(&rdev->irq.pflip[3])) |
3292 |
+- radeon_crtc_handle_vblank(rdev, 3); |
3293 |
+- rdev->irq.stat_regs.cik.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT; |
3294 |
+- DRM_DEBUG("IH: D4 vblank\n"); |
3295 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont3 & LB_D4_VBLANK_INTERRUPT)) |
3296 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3297 |
++ |
3298 |
++ if (rdev->irq.crtc_vblank_int[3]) { |
3299 |
++ drm_handle_vblank(rdev->ddev, 3); |
3300 |
++ rdev->pm.vblank_sync = true; |
3301 |
++ wake_up(&rdev->irq.vblank_queue); |
3302 |
+ } |
3303 |
++ if (atomic_read(&rdev->irq.pflip[3])) |
3304 |
++ radeon_crtc_handle_vblank(rdev, 3); |
3305 |
++ rdev->irq.stat_regs.cik.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT; |
3306 |
++ DRM_DEBUG("IH: D4 vblank\n"); |
3307 |
++ |
3308 |
+ break; |
3309 |
+ case 1: /* D4 vline */ |
3310 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont3 & LB_D4_VLINE_INTERRUPT) { |
3311 |
+- rdev->irq.stat_regs.cik.disp_int_cont3 &= ~LB_D4_VLINE_INTERRUPT; |
3312 |
+- DRM_DEBUG("IH: D4 vline\n"); |
3313 |
+- } |
3314 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont3 & LB_D4_VLINE_INTERRUPT)) |
3315 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3316 |
++ |
3317 |
++ rdev->irq.stat_regs.cik.disp_int_cont3 &= ~LB_D4_VLINE_INTERRUPT; |
3318 |
++ DRM_DEBUG("IH: D4 vline\n"); |
3319 |
++ |
3320 |
+ break; |
3321 |
+ default: |
3322 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
3323 |
+@@ -8009,23 +8059,27 @@ restart_ih: |
3324 |
+ case 5: /* D5 vblank/vline */ |
3325 |
+ switch (src_data) { |
3326 |
+ case 0: /* D5 vblank */ |
3327 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT) { |
3328 |
+- if (rdev->irq.crtc_vblank_int[4]) { |
3329 |
+- drm_handle_vblank(rdev->ddev, 4); |
3330 |
+- rdev->pm.vblank_sync = true; |
3331 |
+- wake_up(&rdev->irq.vblank_queue); |
3332 |
+- } |
3333 |
+- if (atomic_read(&rdev->irq.pflip[4])) |
3334 |
+- radeon_crtc_handle_vblank(rdev, 4); |
3335 |
+- rdev->irq.stat_regs.cik.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT; |
3336 |
+- DRM_DEBUG("IH: D5 vblank\n"); |
3337 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT)) |
3338 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3339 |
++ |
3340 |
++ if (rdev->irq.crtc_vblank_int[4]) { |
3341 |
++ drm_handle_vblank(rdev->ddev, 4); |
3342 |
++ rdev->pm.vblank_sync = true; |
3343 |
++ wake_up(&rdev->irq.vblank_queue); |
3344 |
+ } |
3345 |
++ if (atomic_read(&rdev->irq.pflip[4])) |
3346 |
++ radeon_crtc_handle_vblank(rdev, 4); |
3347 |
++ rdev->irq.stat_regs.cik.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT; |
3348 |
++ DRM_DEBUG("IH: D5 vblank\n"); |
3349 |
++ |
3350 |
+ break; |
3351 |
+ case 1: /* D5 vline */ |
3352 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont4 & LB_D5_VLINE_INTERRUPT) { |
3353 |
+- rdev->irq.stat_regs.cik.disp_int_cont4 &= ~LB_D5_VLINE_INTERRUPT; |
3354 |
+- DRM_DEBUG("IH: D5 vline\n"); |
3355 |
+- } |
3356 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont4 & LB_D5_VLINE_INTERRUPT)) |
3357 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3358 |
++ |
3359 |
++ rdev->irq.stat_regs.cik.disp_int_cont4 &= ~LB_D5_VLINE_INTERRUPT; |
3360 |
++ DRM_DEBUG("IH: D5 vline\n"); |
3361 |
++ |
3362 |
+ break; |
3363 |
+ default: |
3364 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
3365 |
+@@ -8035,23 +8089,27 @@ restart_ih: |
3366 |
+ case 6: /* D6 vblank/vline */ |
3367 |
+ switch (src_data) { |
3368 |
+ case 0: /* D6 vblank */ |
3369 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont5 & LB_D6_VBLANK_INTERRUPT) { |
3370 |
+- if (rdev->irq.crtc_vblank_int[5]) { |
3371 |
+- drm_handle_vblank(rdev->ddev, 5); |
3372 |
+- rdev->pm.vblank_sync = true; |
3373 |
+- wake_up(&rdev->irq.vblank_queue); |
3374 |
+- } |
3375 |
+- if (atomic_read(&rdev->irq.pflip[5])) |
3376 |
+- radeon_crtc_handle_vblank(rdev, 5); |
3377 |
+- rdev->irq.stat_regs.cik.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT; |
3378 |
+- DRM_DEBUG("IH: D6 vblank\n"); |
3379 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont5 & LB_D6_VBLANK_INTERRUPT)) |
3380 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3381 |
++ |
3382 |
++ if (rdev->irq.crtc_vblank_int[5]) { |
3383 |
++ drm_handle_vblank(rdev->ddev, 5); |
3384 |
++ rdev->pm.vblank_sync = true; |
3385 |
++ wake_up(&rdev->irq.vblank_queue); |
3386 |
+ } |
3387 |
++ if (atomic_read(&rdev->irq.pflip[5])) |
3388 |
++ radeon_crtc_handle_vblank(rdev, 5); |
3389 |
++ rdev->irq.stat_regs.cik.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT; |
3390 |
++ DRM_DEBUG("IH: D6 vblank\n"); |
3391 |
++ |
3392 |
+ break; |
3393 |
+ case 1: /* D6 vline */ |
3394 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont5 & LB_D6_VLINE_INTERRUPT) { |
3395 |
+- rdev->irq.stat_regs.cik.disp_int_cont5 &= ~LB_D6_VLINE_INTERRUPT; |
3396 |
+- DRM_DEBUG("IH: D6 vline\n"); |
3397 |
+- } |
3398 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont5 & LB_D6_VLINE_INTERRUPT)) |
3399 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3400 |
++ |
3401 |
++ rdev->irq.stat_regs.cik.disp_int_cont5 &= ~LB_D6_VLINE_INTERRUPT; |
3402 |
++ DRM_DEBUG("IH: D6 vline\n"); |
3403 |
++ |
3404 |
+ break; |
3405 |
+ default: |
3406 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
3407 |
+@@ -8071,88 +8129,112 @@ restart_ih: |
3408 |
+ case 42: /* HPD hotplug */ |
3409 |
+ switch (src_data) { |
3410 |
+ case 0: |
3411 |
+- if (rdev->irq.stat_regs.cik.disp_int & DC_HPD1_INTERRUPT) { |
3412 |
+- rdev->irq.stat_regs.cik.disp_int &= ~DC_HPD1_INTERRUPT; |
3413 |
+- queue_hotplug = true; |
3414 |
+- DRM_DEBUG("IH: HPD1\n"); |
3415 |
+- } |
3416 |
++ if (!(rdev->irq.stat_regs.cik.disp_int & DC_HPD1_INTERRUPT)) |
3417 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3418 |
++ |
3419 |
++ rdev->irq.stat_regs.cik.disp_int &= ~DC_HPD1_INTERRUPT; |
3420 |
++ queue_hotplug = true; |
3421 |
++ DRM_DEBUG("IH: HPD1\n"); |
3422 |
++ |
3423 |
+ break; |
3424 |
+ case 1: |
3425 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont & DC_HPD2_INTERRUPT) { |
3426 |
+- rdev->irq.stat_regs.cik.disp_int_cont &= ~DC_HPD2_INTERRUPT; |
3427 |
+- queue_hotplug = true; |
3428 |
+- DRM_DEBUG("IH: HPD2\n"); |
3429 |
+- } |
3430 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont & DC_HPD2_INTERRUPT)) |
3431 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3432 |
++ |
3433 |
++ rdev->irq.stat_regs.cik.disp_int_cont &= ~DC_HPD2_INTERRUPT; |
3434 |
++ queue_hotplug = true; |
3435 |
++ DRM_DEBUG("IH: HPD2\n"); |
3436 |
++ |
3437 |
+ break; |
3438 |
+ case 2: |
3439 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont2 & DC_HPD3_INTERRUPT) { |
3440 |
+- rdev->irq.stat_regs.cik.disp_int_cont2 &= ~DC_HPD3_INTERRUPT; |
3441 |
+- queue_hotplug = true; |
3442 |
+- DRM_DEBUG("IH: HPD3\n"); |
3443 |
+- } |
3444 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont2 & DC_HPD3_INTERRUPT)) |
3445 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3446 |
++ |
3447 |
++ rdev->irq.stat_regs.cik.disp_int_cont2 &= ~DC_HPD3_INTERRUPT; |
3448 |
++ queue_hotplug = true; |
3449 |
++ DRM_DEBUG("IH: HPD3\n"); |
3450 |
++ |
3451 |
+ break; |
3452 |
+ case 3: |
3453 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont3 & DC_HPD4_INTERRUPT) { |
3454 |
+- rdev->irq.stat_regs.cik.disp_int_cont3 &= ~DC_HPD4_INTERRUPT; |
3455 |
+- queue_hotplug = true; |
3456 |
+- DRM_DEBUG("IH: HPD4\n"); |
3457 |
+- } |
3458 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont3 & DC_HPD4_INTERRUPT)) |
3459 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3460 |
++ |
3461 |
++ rdev->irq.stat_regs.cik.disp_int_cont3 &= ~DC_HPD4_INTERRUPT; |
3462 |
++ queue_hotplug = true; |
3463 |
++ DRM_DEBUG("IH: HPD4\n"); |
3464 |
++ |
3465 |
+ break; |
3466 |
+ case 4: |
3467 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont4 & DC_HPD5_INTERRUPT) { |
3468 |
+- rdev->irq.stat_regs.cik.disp_int_cont4 &= ~DC_HPD5_INTERRUPT; |
3469 |
+- queue_hotplug = true; |
3470 |
+- DRM_DEBUG("IH: HPD5\n"); |
3471 |
+- } |
3472 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont4 & DC_HPD5_INTERRUPT)) |
3473 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3474 |
++ |
3475 |
++ rdev->irq.stat_regs.cik.disp_int_cont4 &= ~DC_HPD5_INTERRUPT; |
3476 |
++ queue_hotplug = true; |
3477 |
++ DRM_DEBUG("IH: HPD5\n"); |
3478 |
++ |
3479 |
+ break; |
3480 |
+ case 5: |
3481 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont5 & DC_HPD6_INTERRUPT) { |
3482 |
+- rdev->irq.stat_regs.cik.disp_int_cont5 &= ~DC_HPD6_INTERRUPT; |
3483 |
+- queue_hotplug = true; |
3484 |
+- DRM_DEBUG("IH: HPD6\n"); |
3485 |
+- } |
3486 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont5 & DC_HPD6_INTERRUPT)) |
3487 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3488 |
++ |
3489 |
++ rdev->irq.stat_regs.cik.disp_int_cont5 &= ~DC_HPD6_INTERRUPT; |
3490 |
++ queue_hotplug = true; |
3491 |
++ DRM_DEBUG("IH: HPD6\n"); |
3492 |
++ |
3493 |
+ break; |
3494 |
+ case 6: |
3495 |
+- if (rdev->irq.stat_regs.cik.disp_int & DC_HPD1_RX_INTERRUPT) { |
3496 |
+- rdev->irq.stat_regs.cik.disp_int &= ~DC_HPD1_RX_INTERRUPT; |
3497 |
+- queue_dp = true; |
3498 |
+- DRM_DEBUG("IH: HPD_RX 1\n"); |
3499 |
+- } |
3500 |
++ if (!(rdev->irq.stat_regs.cik.disp_int & DC_HPD1_RX_INTERRUPT)) |
3501 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3502 |
++ |
3503 |
++ rdev->irq.stat_regs.cik.disp_int &= ~DC_HPD1_RX_INTERRUPT; |
3504 |
++ queue_dp = true; |
3505 |
++ DRM_DEBUG("IH: HPD_RX 1\n"); |
3506 |
++ |
3507 |
+ break; |
3508 |
+ case 7: |
3509 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont & DC_HPD2_RX_INTERRUPT) { |
3510 |
+- rdev->irq.stat_regs.cik.disp_int_cont &= ~DC_HPD2_RX_INTERRUPT; |
3511 |
+- queue_dp = true; |
3512 |
+- DRM_DEBUG("IH: HPD_RX 2\n"); |
3513 |
+- } |
3514 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont & DC_HPD2_RX_INTERRUPT)) |
3515 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3516 |
++ |
3517 |
++ rdev->irq.stat_regs.cik.disp_int_cont &= ~DC_HPD2_RX_INTERRUPT; |
3518 |
++ queue_dp = true; |
3519 |
++ DRM_DEBUG("IH: HPD_RX 2\n"); |
3520 |
++ |
3521 |
+ break; |
3522 |
+ case 8: |
3523 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont2 & DC_HPD3_RX_INTERRUPT) { |
3524 |
+- rdev->irq.stat_regs.cik.disp_int_cont2 &= ~DC_HPD3_RX_INTERRUPT; |
3525 |
+- queue_dp = true; |
3526 |
+- DRM_DEBUG("IH: HPD_RX 3\n"); |
3527 |
+- } |
3528 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont2 & DC_HPD3_RX_INTERRUPT)) |
3529 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3530 |
++ |
3531 |
++ rdev->irq.stat_regs.cik.disp_int_cont2 &= ~DC_HPD3_RX_INTERRUPT; |
3532 |
++ queue_dp = true; |
3533 |
++ DRM_DEBUG("IH: HPD_RX 3\n"); |
3534 |
++ |
3535 |
+ break; |
3536 |
+ case 9: |
3537 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont3 & DC_HPD4_RX_INTERRUPT) { |
3538 |
+- rdev->irq.stat_regs.cik.disp_int_cont3 &= ~DC_HPD4_RX_INTERRUPT; |
3539 |
+- queue_dp = true; |
3540 |
+- DRM_DEBUG("IH: HPD_RX 4\n"); |
3541 |
+- } |
3542 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont3 & DC_HPD4_RX_INTERRUPT)) |
3543 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3544 |
++ |
3545 |
++ rdev->irq.stat_regs.cik.disp_int_cont3 &= ~DC_HPD4_RX_INTERRUPT; |
3546 |
++ queue_dp = true; |
3547 |
++ DRM_DEBUG("IH: HPD_RX 4\n"); |
3548 |
++ |
3549 |
+ break; |
3550 |
+ case 10: |
3551 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont4 & DC_HPD5_RX_INTERRUPT) { |
3552 |
+- rdev->irq.stat_regs.cik.disp_int_cont4 &= ~DC_HPD5_RX_INTERRUPT; |
3553 |
+- queue_dp = true; |
3554 |
+- DRM_DEBUG("IH: HPD_RX 5\n"); |
3555 |
+- } |
3556 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont4 & DC_HPD5_RX_INTERRUPT)) |
3557 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3558 |
++ |
3559 |
++ rdev->irq.stat_regs.cik.disp_int_cont4 &= ~DC_HPD5_RX_INTERRUPT; |
3560 |
++ queue_dp = true; |
3561 |
++ DRM_DEBUG("IH: HPD_RX 5\n"); |
3562 |
++ |
3563 |
+ break; |
3564 |
+ case 11: |
3565 |
+- if (rdev->irq.stat_regs.cik.disp_int_cont5 & DC_HPD6_RX_INTERRUPT) { |
3566 |
+- rdev->irq.stat_regs.cik.disp_int_cont5 &= ~DC_HPD6_RX_INTERRUPT; |
3567 |
+- queue_dp = true; |
3568 |
+- DRM_DEBUG("IH: HPD_RX 6\n"); |
3569 |
+- } |
3570 |
++ if (!(rdev->irq.stat_regs.cik.disp_int_cont5 & DC_HPD6_RX_INTERRUPT)) |
3571 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3572 |
++ |
3573 |
++ rdev->irq.stat_regs.cik.disp_int_cont5 &= ~DC_HPD6_RX_INTERRUPT; |
3574 |
++ queue_dp = true; |
3575 |
++ DRM_DEBUG("IH: HPD_RX 6\n"); |
3576 |
++ |
3577 |
+ break; |
3578 |
+ default: |
3579 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
3580 |
+diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c |
3581 |
+index f86eb54e7763..d16f2eebd95e 100644 |
3582 |
+--- a/drivers/gpu/drm/radeon/cik_sdma.c |
3583 |
++++ b/drivers/gpu/drm/radeon/cik_sdma.c |
3584 |
+@@ -268,6 +268,17 @@ static void cik_sdma_gfx_stop(struct radeon_device *rdev) |
3585 |
+ } |
3586 |
+ rdev->ring[R600_RING_TYPE_DMA_INDEX].ready = false; |
3587 |
+ rdev->ring[CAYMAN_RING_TYPE_DMA1_INDEX].ready = false; |
3588 |
++ |
3589 |
++ /* FIXME use something else than big hammer but after few days can not |
3590 |
++ * seem to find good combination so reset SDMA blocks as it seems we |
3591 |
++ * do not shut them down properly. This fix hibernation and does not |
3592 |
++ * affect suspend to ram. |
3593 |
++ */ |
3594 |
++ WREG32(SRBM_SOFT_RESET, SOFT_RESET_SDMA | SOFT_RESET_SDMA1); |
3595 |
++ (void)RREG32(SRBM_SOFT_RESET); |
3596 |
++ udelay(50); |
3597 |
++ WREG32(SRBM_SOFT_RESET, 0); |
3598 |
++ (void)RREG32(SRBM_SOFT_RESET); |
3599 |
+ } |
3600 |
+ |
3601 |
+ /** |
3602 |
+diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c |
3603 |
+index f848acfd3fc8..feef136cdb55 100644 |
3604 |
+--- a/drivers/gpu/drm/radeon/evergreen.c |
3605 |
++++ b/drivers/gpu/drm/radeon/evergreen.c |
3606 |
+@@ -4855,7 +4855,7 @@ restart_ih: |
3607 |
+ return IRQ_NONE; |
3608 |
+ |
3609 |
+ rptr = rdev->ih.rptr; |
3610 |
+- DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr); |
3611 |
++ DRM_DEBUG("evergreen_irq_process start: rptr %d, wptr %d\n", rptr, wptr); |
3612 |
+ |
3613 |
+ /* Order reading of wptr vs. reading of IH ring data */ |
3614 |
+ rmb(); |
3615 |
+@@ -4873,23 +4873,27 @@ restart_ih: |
3616 |
+ case 1: /* D1 vblank/vline */ |
3617 |
+ switch (src_data) { |
3618 |
+ case 0: /* D1 vblank */ |
3619 |
+- if (rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VBLANK_INTERRUPT) { |
3620 |
+- if (rdev->irq.crtc_vblank_int[0]) { |
3621 |
+- drm_handle_vblank(rdev->ddev, 0); |
3622 |
+- rdev->pm.vblank_sync = true; |
3623 |
+- wake_up(&rdev->irq.vblank_queue); |
3624 |
+- } |
3625 |
+- if (atomic_read(&rdev->irq.pflip[0])) |
3626 |
+- radeon_crtc_handle_vblank(rdev, 0); |
3627 |
+- rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VBLANK_INTERRUPT; |
3628 |
+- DRM_DEBUG("IH: D1 vblank\n"); |
3629 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VBLANK_INTERRUPT)) |
3630 |
++ DRM_DEBUG("IH: D1 vblank - IH event w/o asserted irq bit?\n"); |
3631 |
++ |
3632 |
++ if (rdev->irq.crtc_vblank_int[0]) { |
3633 |
++ drm_handle_vblank(rdev->ddev, 0); |
3634 |
++ rdev->pm.vblank_sync = true; |
3635 |
++ wake_up(&rdev->irq.vblank_queue); |
3636 |
+ } |
3637 |
++ if (atomic_read(&rdev->irq.pflip[0])) |
3638 |
++ radeon_crtc_handle_vblank(rdev, 0); |
3639 |
++ rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VBLANK_INTERRUPT; |
3640 |
++ DRM_DEBUG("IH: D1 vblank\n"); |
3641 |
++ |
3642 |
+ break; |
3643 |
+ case 1: /* D1 vline */ |
3644 |
+- if (rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VLINE_INTERRUPT) { |
3645 |
+- rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VLINE_INTERRUPT; |
3646 |
+- DRM_DEBUG("IH: D1 vline\n"); |
3647 |
+- } |
3648 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VLINE_INTERRUPT)) |
3649 |
++ DRM_DEBUG("IH: D1 vline - IH event w/o asserted irq bit?\n"); |
3650 |
++ |
3651 |
++ rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VLINE_INTERRUPT; |
3652 |
++ DRM_DEBUG("IH: D1 vline\n"); |
3653 |
++ |
3654 |
+ break; |
3655 |
+ default: |
3656 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
3657 |
+@@ -4899,23 +4903,27 @@ restart_ih: |
3658 |
+ case 2: /* D2 vblank/vline */ |
3659 |
+ switch (src_data) { |
3660 |
+ case 0: /* D2 vblank */ |
3661 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VBLANK_INTERRUPT) { |
3662 |
+- if (rdev->irq.crtc_vblank_int[1]) { |
3663 |
+- drm_handle_vblank(rdev->ddev, 1); |
3664 |
+- rdev->pm.vblank_sync = true; |
3665 |
+- wake_up(&rdev->irq.vblank_queue); |
3666 |
+- } |
3667 |
+- if (atomic_read(&rdev->irq.pflip[1])) |
3668 |
+- radeon_crtc_handle_vblank(rdev, 1); |
3669 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT; |
3670 |
+- DRM_DEBUG("IH: D2 vblank\n"); |
3671 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VBLANK_INTERRUPT)) |
3672 |
++ DRM_DEBUG("IH: D2 vblank - IH event w/o asserted irq bit?\n"); |
3673 |
++ |
3674 |
++ if (rdev->irq.crtc_vblank_int[1]) { |
3675 |
++ drm_handle_vblank(rdev->ddev, 1); |
3676 |
++ rdev->pm.vblank_sync = true; |
3677 |
++ wake_up(&rdev->irq.vblank_queue); |
3678 |
+ } |
3679 |
++ if (atomic_read(&rdev->irq.pflip[1])) |
3680 |
++ radeon_crtc_handle_vblank(rdev, 1); |
3681 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT; |
3682 |
++ DRM_DEBUG("IH: D2 vblank\n"); |
3683 |
++ |
3684 |
+ break; |
3685 |
+ case 1: /* D2 vline */ |
3686 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VLINE_INTERRUPT) { |
3687 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VLINE_INTERRUPT; |
3688 |
+- DRM_DEBUG("IH: D2 vline\n"); |
3689 |
+- } |
3690 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VLINE_INTERRUPT)) |
3691 |
++ DRM_DEBUG("IH: D2 vline - IH event w/o asserted irq bit?\n"); |
3692 |
++ |
3693 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VLINE_INTERRUPT; |
3694 |
++ DRM_DEBUG("IH: D2 vline\n"); |
3695 |
++ |
3696 |
+ break; |
3697 |
+ default: |
3698 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
3699 |
+@@ -4925,23 +4933,27 @@ restart_ih: |
3700 |
+ case 3: /* D3 vblank/vline */ |
3701 |
+ switch (src_data) { |
3702 |
+ case 0: /* D3 vblank */ |
3703 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT) { |
3704 |
+- if (rdev->irq.crtc_vblank_int[2]) { |
3705 |
+- drm_handle_vblank(rdev->ddev, 2); |
3706 |
+- rdev->pm.vblank_sync = true; |
3707 |
+- wake_up(&rdev->irq.vblank_queue); |
3708 |
+- } |
3709 |
+- if (atomic_read(&rdev->irq.pflip[2])) |
3710 |
+- radeon_crtc_handle_vblank(rdev, 2); |
3711 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT; |
3712 |
+- DRM_DEBUG("IH: D3 vblank\n"); |
3713 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT)) |
3714 |
++ DRM_DEBUG("IH: D3 vblank - IH event w/o asserted irq bit?\n"); |
3715 |
++ |
3716 |
++ if (rdev->irq.crtc_vblank_int[2]) { |
3717 |
++ drm_handle_vblank(rdev->ddev, 2); |
3718 |
++ rdev->pm.vblank_sync = true; |
3719 |
++ wake_up(&rdev->irq.vblank_queue); |
3720 |
+ } |
3721 |
++ if (atomic_read(&rdev->irq.pflip[2])) |
3722 |
++ radeon_crtc_handle_vblank(rdev, 2); |
3723 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT; |
3724 |
++ DRM_DEBUG("IH: D3 vblank\n"); |
3725 |
++ |
3726 |
+ break; |
3727 |
+ case 1: /* D3 vline */ |
3728 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VLINE_INTERRUPT) { |
3729 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VLINE_INTERRUPT; |
3730 |
+- DRM_DEBUG("IH: D3 vline\n"); |
3731 |
+- } |
3732 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VLINE_INTERRUPT)) |
3733 |
++ DRM_DEBUG("IH: D3 vline - IH event w/o asserted irq bit?\n"); |
3734 |
++ |
3735 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VLINE_INTERRUPT; |
3736 |
++ DRM_DEBUG("IH: D3 vline\n"); |
3737 |
++ |
3738 |
+ break; |
3739 |
+ default: |
3740 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
3741 |
+@@ -4951,23 +4963,27 @@ restart_ih: |
3742 |
+ case 4: /* D4 vblank/vline */ |
3743 |
+ switch (src_data) { |
3744 |
+ case 0: /* D4 vblank */ |
3745 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VBLANK_INTERRUPT) { |
3746 |
+- if (rdev->irq.crtc_vblank_int[3]) { |
3747 |
+- drm_handle_vblank(rdev->ddev, 3); |
3748 |
+- rdev->pm.vblank_sync = true; |
3749 |
+- wake_up(&rdev->irq.vblank_queue); |
3750 |
+- } |
3751 |
+- if (atomic_read(&rdev->irq.pflip[3])) |
3752 |
+- radeon_crtc_handle_vblank(rdev, 3); |
3753 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT; |
3754 |
+- DRM_DEBUG("IH: D4 vblank\n"); |
3755 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VBLANK_INTERRUPT)) |
3756 |
++ DRM_DEBUG("IH: D4 vblank - IH event w/o asserted irq bit?\n"); |
3757 |
++ |
3758 |
++ if (rdev->irq.crtc_vblank_int[3]) { |
3759 |
++ drm_handle_vblank(rdev->ddev, 3); |
3760 |
++ rdev->pm.vblank_sync = true; |
3761 |
++ wake_up(&rdev->irq.vblank_queue); |
3762 |
+ } |
3763 |
++ if (atomic_read(&rdev->irq.pflip[3])) |
3764 |
++ radeon_crtc_handle_vblank(rdev, 3); |
3765 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT; |
3766 |
++ DRM_DEBUG("IH: D4 vblank\n"); |
3767 |
++ |
3768 |
+ break; |
3769 |
+ case 1: /* D4 vline */ |
3770 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VLINE_INTERRUPT) { |
3771 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VLINE_INTERRUPT; |
3772 |
+- DRM_DEBUG("IH: D4 vline\n"); |
3773 |
+- } |
3774 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VLINE_INTERRUPT)) |
3775 |
++ DRM_DEBUG("IH: D4 vline - IH event w/o asserted irq bit?\n"); |
3776 |
++ |
3777 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VLINE_INTERRUPT; |
3778 |
++ DRM_DEBUG("IH: D4 vline\n"); |
3779 |
++ |
3780 |
+ break; |
3781 |
+ default: |
3782 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
3783 |
+@@ -4977,23 +4993,27 @@ restart_ih: |
3784 |
+ case 5: /* D5 vblank/vline */ |
3785 |
+ switch (src_data) { |
3786 |
+ case 0: /* D5 vblank */ |
3787 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT) { |
3788 |
+- if (rdev->irq.crtc_vblank_int[4]) { |
3789 |
+- drm_handle_vblank(rdev->ddev, 4); |
3790 |
+- rdev->pm.vblank_sync = true; |
3791 |
+- wake_up(&rdev->irq.vblank_queue); |
3792 |
+- } |
3793 |
+- if (atomic_read(&rdev->irq.pflip[4])) |
3794 |
+- radeon_crtc_handle_vblank(rdev, 4); |
3795 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT; |
3796 |
+- DRM_DEBUG("IH: D5 vblank\n"); |
3797 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT)) |
3798 |
++ DRM_DEBUG("IH: D5 vblank - IH event w/o asserted irq bit?\n"); |
3799 |
++ |
3800 |
++ if (rdev->irq.crtc_vblank_int[4]) { |
3801 |
++ drm_handle_vblank(rdev->ddev, 4); |
3802 |
++ rdev->pm.vblank_sync = true; |
3803 |
++ wake_up(&rdev->irq.vblank_queue); |
3804 |
+ } |
3805 |
++ if (atomic_read(&rdev->irq.pflip[4])) |
3806 |
++ radeon_crtc_handle_vblank(rdev, 4); |
3807 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT; |
3808 |
++ DRM_DEBUG("IH: D5 vblank\n"); |
3809 |
++ |
3810 |
+ break; |
3811 |
+ case 1: /* D5 vline */ |
3812 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VLINE_INTERRUPT) { |
3813 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VLINE_INTERRUPT; |
3814 |
+- DRM_DEBUG("IH: D5 vline\n"); |
3815 |
+- } |
3816 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VLINE_INTERRUPT)) |
3817 |
++ DRM_DEBUG("IH: D5 vline - IH event w/o asserted irq bit?\n"); |
3818 |
++ |
3819 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VLINE_INTERRUPT; |
3820 |
++ DRM_DEBUG("IH: D5 vline\n"); |
3821 |
++ |
3822 |
+ break; |
3823 |
+ default: |
3824 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
3825 |
+@@ -5003,23 +5023,27 @@ restart_ih: |
3826 |
+ case 6: /* D6 vblank/vline */ |
3827 |
+ switch (src_data) { |
3828 |
+ case 0: /* D6 vblank */ |
3829 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VBLANK_INTERRUPT) { |
3830 |
+- if (rdev->irq.crtc_vblank_int[5]) { |
3831 |
+- drm_handle_vblank(rdev->ddev, 5); |
3832 |
+- rdev->pm.vblank_sync = true; |
3833 |
+- wake_up(&rdev->irq.vblank_queue); |
3834 |
+- } |
3835 |
+- if (atomic_read(&rdev->irq.pflip[5])) |
3836 |
+- radeon_crtc_handle_vblank(rdev, 5); |
3837 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT; |
3838 |
+- DRM_DEBUG("IH: D6 vblank\n"); |
3839 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VBLANK_INTERRUPT)) |
3840 |
++ DRM_DEBUG("IH: D6 vblank - IH event w/o asserted irq bit?\n"); |
3841 |
++ |
3842 |
++ if (rdev->irq.crtc_vblank_int[5]) { |
3843 |
++ drm_handle_vblank(rdev->ddev, 5); |
3844 |
++ rdev->pm.vblank_sync = true; |
3845 |
++ wake_up(&rdev->irq.vblank_queue); |
3846 |
+ } |
3847 |
++ if (atomic_read(&rdev->irq.pflip[5])) |
3848 |
++ radeon_crtc_handle_vblank(rdev, 5); |
3849 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT; |
3850 |
++ DRM_DEBUG("IH: D6 vblank\n"); |
3851 |
++ |
3852 |
+ break; |
3853 |
+ case 1: /* D6 vline */ |
3854 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VLINE_INTERRUPT) { |
3855 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VLINE_INTERRUPT; |
3856 |
+- DRM_DEBUG("IH: D6 vline\n"); |
3857 |
+- } |
3858 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VLINE_INTERRUPT)) |
3859 |
++ DRM_DEBUG("IH: D6 vline - IH event w/o asserted irq bit?\n"); |
3860 |
++ |
3861 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VLINE_INTERRUPT; |
3862 |
++ DRM_DEBUG("IH: D6 vline\n"); |
3863 |
++ |
3864 |
+ break; |
3865 |
+ default: |
3866 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
3867 |
+@@ -5039,88 +5063,100 @@ restart_ih: |
3868 |
+ case 42: /* HPD hotplug */ |
3869 |
+ switch (src_data) { |
3870 |
+ case 0: |
3871 |
+- if (rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_INTERRUPT) { |
3872 |
+- rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_INTERRUPT; |
3873 |
+- queue_hotplug = true; |
3874 |
+- DRM_DEBUG("IH: HPD1\n"); |
3875 |
+- } |
3876 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_INTERRUPT)) |
3877 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3878 |
++ |
3879 |
++ rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_INTERRUPT; |
3880 |
++ queue_hotplug = true; |
3881 |
++ DRM_DEBUG("IH: HPD1\n"); |
3882 |
+ break; |
3883 |
+ case 1: |
3884 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_INTERRUPT) { |
3885 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_INTERRUPT; |
3886 |
+- queue_hotplug = true; |
3887 |
+- DRM_DEBUG("IH: HPD2\n"); |
3888 |
+- } |
3889 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_INTERRUPT)) |
3890 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3891 |
++ |
3892 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_INTERRUPT; |
3893 |
++ queue_hotplug = true; |
3894 |
++ DRM_DEBUG("IH: HPD2\n"); |
3895 |
+ break; |
3896 |
+ case 2: |
3897 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_INTERRUPT) { |
3898 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_INTERRUPT; |
3899 |
+- queue_hotplug = true; |
3900 |
+- DRM_DEBUG("IH: HPD3\n"); |
3901 |
+- } |
3902 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_INTERRUPT)) |
3903 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3904 |
++ |
3905 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_INTERRUPT; |
3906 |
++ queue_hotplug = true; |
3907 |
++ DRM_DEBUG("IH: HPD3\n"); |
3908 |
+ break; |
3909 |
+ case 3: |
3910 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_INTERRUPT) { |
3911 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_INTERRUPT; |
3912 |
+- queue_hotplug = true; |
3913 |
+- DRM_DEBUG("IH: HPD4\n"); |
3914 |
+- } |
3915 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_INTERRUPT)) |
3916 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3917 |
++ |
3918 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_INTERRUPT; |
3919 |
++ queue_hotplug = true; |
3920 |
++ DRM_DEBUG("IH: HPD4\n"); |
3921 |
+ break; |
3922 |
+ case 4: |
3923 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_INTERRUPT) { |
3924 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_INTERRUPT; |
3925 |
+- queue_hotplug = true; |
3926 |
+- DRM_DEBUG("IH: HPD5\n"); |
3927 |
+- } |
3928 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_INTERRUPT)) |
3929 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3930 |
++ |
3931 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_INTERRUPT; |
3932 |
++ queue_hotplug = true; |
3933 |
++ DRM_DEBUG("IH: HPD5\n"); |
3934 |
+ break; |
3935 |
+ case 5: |
3936 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_INTERRUPT) { |
3937 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_INTERRUPT; |
3938 |
+- queue_hotplug = true; |
3939 |
+- DRM_DEBUG("IH: HPD6\n"); |
3940 |
+- } |
3941 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_INTERRUPT)) |
3942 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3943 |
++ |
3944 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_INTERRUPT; |
3945 |
++ queue_hotplug = true; |
3946 |
++ DRM_DEBUG("IH: HPD6\n"); |
3947 |
+ break; |
3948 |
+ case 6: |
3949 |
+- if (rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_RX_INTERRUPT) { |
3950 |
+- rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_RX_INTERRUPT; |
3951 |
+- queue_dp = true; |
3952 |
+- DRM_DEBUG("IH: HPD_RX 1\n"); |
3953 |
+- } |
3954 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_RX_INTERRUPT)) |
3955 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3956 |
++ |
3957 |
++ rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_RX_INTERRUPT; |
3958 |
++ queue_dp = true; |
3959 |
++ DRM_DEBUG("IH: HPD_RX 1\n"); |
3960 |
+ break; |
3961 |
+ case 7: |
3962 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_RX_INTERRUPT) { |
3963 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_RX_INTERRUPT; |
3964 |
+- queue_dp = true; |
3965 |
+- DRM_DEBUG("IH: HPD_RX 2\n"); |
3966 |
+- } |
3967 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_RX_INTERRUPT)) |
3968 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3969 |
++ |
3970 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_RX_INTERRUPT; |
3971 |
++ queue_dp = true; |
3972 |
++ DRM_DEBUG("IH: HPD_RX 2\n"); |
3973 |
+ break; |
3974 |
+ case 8: |
3975 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_RX_INTERRUPT) { |
3976 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_RX_INTERRUPT; |
3977 |
+- queue_dp = true; |
3978 |
+- DRM_DEBUG("IH: HPD_RX 3\n"); |
3979 |
+- } |
3980 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_RX_INTERRUPT)) |
3981 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3982 |
++ |
3983 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_RX_INTERRUPT; |
3984 |
++ queue_dp = true; |
3985 |
++ DRM_DEBUG("IH: HPD_RX 3\n"); |
3986 |
+ break; |
3987 |
+ case 9: |
3988 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_RX_INTERRUPT) { |
3989 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_RX_INTERRUPT; |
3990 |
+- queue_dp = true; |
3991 |
+- DRM_DEBUG("IH: HPD_RX 4\n"); |
3992 |
+- } |
3993 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_RX_INTERRUPT)) |
3994 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
3995 |
++ |
3996 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_RX_INTERRUPT; |
3997 |
++ queue_dp = true; |
3998 |
++ DRM_DEBUG("IH: HPD_RX 4\n"); |
3999 |
+ break; |
4000 |
+ case 10: |
4001 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_RX_INTERRUPT) { |
4002 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_RX_INTERRUPT; |
4003 |
+- queue_dp = true; |
4004 |
+- DRM_DEBUG("IH: HPD_RX 5\n"); |
4005 |
+- } |
4006 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_RX_INTERRUPT)) |
4007 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4008 |
++ |
4009 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_RX_INTERRUPT; |
4010 |
++ queue_dp = true; |
4011 |
++ DRM_DEBUG("IH: HPD_RX 5\n"); |
4012 |
+ break; |
4013 |
+ case 11: |
4014 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_RX_INTERRUPT) { |
4015 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_RX_INTERRUPT; |
4016 |
+- queue_dp = true; |
4017 |
+- DRM_DEBUG("IH: HPD_RX 6\n"); |
4018 |
+- } |
4019 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_RX_INTERRUPT)) |
4020 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4021 |
++ |
4022 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_RX_INTERRUPT; |
4023 |
++ queue_dp = true; |
4024 |
++ DRM_DEBUG("IH: HPD_RX 6\n"); |
4025 |
+ break; |
4026 |
+ default: |
4027 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
4028 |
+@@ -5130,46 +5166,52 @@ restart_ih: |
4029 |
+ case 44: /* hdmi */ |
4030 |
+ switch (src_data) { |
4031 |
+ case 0: |
4032 |
+- if (rdev->irq.stat_regs.evergreen.afmt_status1 & AFMT_AZ_FORMAT_WTRIG) { |
4033 |
+- rdev->irq.stat_regs.evergreen.afmt_status1 &= ~AFMT_AZ_FORMAT_WTRIG; |
4034 |
+- queue_hdmi = true; |
4035 |
+- DRM_DEBUG("IH: HDMI0\n"); |
4036 |
+- } |
4037 |
++ if (!(rdev->irq.stat_regs.evergreen.afmt_status1 & AFMT_AZ_FORMAT_WTRIG)) |
4038 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4039 |
++ |
4040 |
++ rdev->irq.stat_regs.evergreen.afmt_status1 &= ~AFMT_AZ_FORMAT_WTRIG; |
4041 |
++ queue_hdmi = true; |
4042 |
++ DRM_DEBUG("IH: HDMI0\n"); |
4043 |
+ break; |
4044 |
+ case 1: |
4045 |
+- if (rdev->irq.stat_regs.evergreen.afmt_status2 & AFMT_AZ_FORMAT_WTRIG) { |
4046 |
+- rdev->irq.stat_regs.evergreen.afmt_status2 &= ~AFMT_AZ_FORMAT_WTRIG; |
4047 |
+- queue_hdmi = true; |
4048 |
+- DRM_DEBUG("IH: HDMI1\n"); |
4049 |
+- } |
4050 |
++ if (!(rdev->irq.stat_regs.evergreen.afmt_status2 & AFMT_AZ_FORMAT_WTRIG)) |
4051 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4052 |
++ |
4053 |
++ rdev->irq.stat_regs.evergreen.afmt_status2 &= ~AFMT_AZ_FORMAT_WTRIG; |
4054 |
++ queue_hdmi = true; |
4055 |
++ DRM_DEBUG("IH: HDMI1\n"); |
4056 |
+ break; |
4057 |
+ case 2: |
4058 |
+- if (rdev->irq.stat_regs.evergreen.afmt_status3 & AFMT_AZ_FORMAT_WTRIG) { |
4059 |
+- rdev->irq.stat_regs.evergreen.afmt_status3 &= ~AFMT_AZ_FORMAT_WTRIG; |
4060 |
+- queue_hdmi = true; |
4061 |
+- DRM_DEBUG("IH: HDMI2\n"); |
4062 |
+- } |
4063 |
++ if (!(rdev->irq.stat_regs.evergreen.afmt_status3 & AFMT_AZ_FORMAT_WTRIG)) |
4064 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4065 |
++ |
4066 |
++ rdev->irq.stat_regs.evergreen.afmt_status3 &= ~AFMT_AZ_FORMAT_WTRIG; |
4067 |
++ queue_hdmi = true; |
4068 |
++ DRM_DEBUG("IH: HDMI2\n"); |
4069 |
+ break; |
4070 |
+ case 3: |
4071 |
+- if (rdev->irq.stat_regs.evergreen.afmt_status4 & AFMT_AZ_FORMAT_WTRIG) { |
4072 |
+- rdev->irq.stat_regs.evergreen.afmt_status4 &= ~AFMT_AZ_FORMAT_WTRIG; |
4073 |
+- queue_hdmi = true; |
4074 |
+- DRM_DEBUG("IH: HDMI3\n"); |
4075 |
+- } |
4076 |
++ if (!(rdev->irq.stat_regs.evergreen.afmt_status4 & AFMT_AZ_FORMAT_WTRIG)) |
4077 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4078 |
++ |
4079 |
++ rdev->irq.stat_regs.evergreen.afmt_status4 &= ~AFMT_AZ_FORMAT_WTRIG; |
4080 |
++ queue_hdmi = true; |
4081 |
++ DRM_DEBUG("IH: HDMI3\n"); |
4082 |
+ break; |
4083 |
+ case 4: |
4084 |
+- if (rdev->irq.stat_regs.evergreen.afmt_status5 & AFMT_AZ_FORMAT_WTRIG) { |
4085 |
+- rdev->irq.stat_regs.evergreen.afmt_status5 &= ~AFMT_AZ_FORMAT_WTRIG; |
4086 |
+- queue_hdmi = true; |
4087 |
+- DRM_DEBUG("IH: HDMI4\n"); |
4088 |
+- } |
4089 |
++ if (!(rdev->irq.stat_regs.evergreen.afmt_status5 & AFMT_AZ_FORMAT_WTRIG)) |
4090 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4091 |
++ |
4092 |
++ rdev->irq.stat_regs.evergreen.afmt_status5 &= ~AFMT_AZ_FORMAT_WTRIG; |
4093 |
++ queue_hdmi = true; |
4094 |
++ DRM_DEBUG("IH: HDMI4\n"); |
4095 |
+ break; |
4096 |
+ case 5: |
4097 |
+- if (rdev->irq.stat_regs.evergreen.afmt_status6 & AFMT_AZ_FORMAT_WTRIG) { |
4098 |
+- rdev->irq.stat_regs.evergreen.afmt_status6 &= ~AFMT_AZ_FORMAT_WTRIG; |
4099 |
+- queue_hdmi = true; |
4100 |
+- DRM_DEBUG("IH: HDMI5\n"); |
4101 |
+- } |
4102 |
++ if (!(rdev->irq.stat_regs.evergreen.afmt_status6 & AFMT_AZ_FORMAT_WTRIG)) |
4103 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4104 |
++ |
4105 |
++ rdev->irq.stat_regs.evergreen.afmt_status6 &= ~AFMT_AZ_FORMAT_WTRIG; |
4106 |
++ queue_hdmi = true; |
4107 |
++ DRM_DEBUG("IH: HDMI5\n"); |
4108 |
+ break; |
4109 |
+ default: |
4110 |
+ DRM_ERROR("Unhandled interrupt: %d %d\n", src_id, src_data); |
4111 |
+diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c |
4112 |
+index 8f6d862a1882..21e479fefcab 100644 |
4113 |
+--- a/drivers/gpu/drm/radeon/r600.c |
4114 |
++++ b/drivers/gpu/drm/radeon/r600.c |
4115 |
+@@ -4039,23 +4039,27 @@ restart_ih: |
4116 |
+ case 1: /* D1 vblank/vline */ |
4117 |
+ switch (src_data) { |
4118 |
+ case 0: /* D1 vblank */ |
4119 |
+- if (rdev->irq.stat_regs.r600.disp_int & LB_D1_VBLANK_INTERRUPT) { |
4120 |
+- if (rdev->irq.crtc_vblank_int[0]) { |
4121 |
+- drm_handle_vblank(rdev->ddev, 0); |
4122 |
+- rdev->pm.vblank_sync = true; |
4123 |
+- wake_up(&rdev->irq.vblank_queue); |
4124 |
+- } |
4125 |
+- if (atomic_read(&rdev->irq.pflip[0])) |
4126 |
+- radeon_crtc_handle_vblank(rdev, 0); |
4127 |
+- rdev->irq.stat_regs.r600.disp_int &= ~LB_D1_VBLANK_INTERRUPT; |
4128 |
+- DRM_DEBUG("IH: D1 vblank\n"); |
4129 |
++ if (!(rdev->irq.stat_regs.r600.disp_int & LB_D1_VBLANK_INTERRUPT)) |
4130 |
++ DRM_DEBUG("IH: D1 vblank - IH event w/o asserted irq bit?\n"); |
4131 |
++ |
4132 |
++ if (rdev->irq.crtc_vblank_int[0]) { |
4133 |
++ drm_handle_vblank(rdev->ddev, 0); |
4134 |
++ rdev->pm.vblank_sync = true; |
4135 |
++ wake_up(&rdev->irq.vblank_queue); |
4136 |
+ } |
4137 |
++ if (atomic_read(&rdev->irq.pflip[0])) |
4138 |
++ radeon_crtc_handle_vblank(rdev, 0); |
4139 |
++ rdev->irq.stat_regs.r600.disp_int &= ~LB_D1_VBLANK_INTERRUPT; |
4140 |
++ DRM_DEBUG("IH: D1 vblank\n"); |
4141 |
++ |
4142 |
+ break; |
4143 |
+ case 1: /* D1 vline */ |
4144 |
+- if (rdev->irq.stat_regs.r600.disp_int & LB_D1_VLINE_INTERRUPT) { |
4145 |
+- rdev->irq.stat_regs.r600.disp_int &= ~LB_D1_VLINE_INTERRUPT; |
4146 |
+- DRM_DEBUG("IH: D1 vline\n"); |
4147 |
+- } |
4148 |
++ if (!(rdev->irq.stat_regs.r600.disp_int & LB_D1_VLINE_INTERRUPT)) |
4149 |
++ DRM_DEBUG("IH: D1 vline - IH event w/o asserted irq bit?\n"); |
4150 |
++ |
4151 |
++ rdev->irq.stat_regs.r600.disp_int &= ~LB_D1_VLINE_INTERRUPT; |
4152 |
++ DRM_DEBUG("IH: D1 vline\n"); |
4153 |
++ |
4154 |
+ break; |
4155 |
+ default: |
4156 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
4157 |
+@@ -4065,23 +4069,27 @@ restart_ih: |
4158 |
+ case 5: /* D2 vblank/vline */ |
4159 |
+ switch (src_data) { |
4160 |
+ case 0: /* D2 vblank */ |
4161 |
+- if (rdev->irq.stat_regs.r600.disp_int & LB_D2_VBLANK_INTERRUPT) { |
4162 |
+- if (rdev->irq.crtc_vblank_int[1]) { |
4163 |
+- drm_handle_vblank(rdev->ddev, 1); |
4164 |
+- rdev->pm.vblank_sync = true; |
4165 |
+- wake_up(&rdev->irq.vblank_queue); |
4166 |
+- } |
4167 |
+- if (atomic_read(&rdev->irq.pflip[1])) |
4168 |
+- radeon_crtc_handle_vblank(rdev, 1); |
4169 |
+- rdev->irq.stat_regs.r600.disp_int &= ~LB_D2_VBLANK_INTERRUPT; |
4170 |
+- DRM_DEBUG("IH: D2 vblank\n"); |
4171 |
++ if (!(rdev->irq.stat_regs.r600.disp_int & LB_D2_VBLANK_INTERRUPT)) |
4172 |
++ DRM_DEBUG("IH: D2 vblank - IH event w/o asserted irq bit?\n"); |
4173 |
++ |
4174 |
++ if (rdev->irq.crtc_vblank_int[1]) { |
4175 |
++ drm_handle_vblank(rdev->ddev, 1); |
4176 |
++ rdev->pm.vblank_sync = true; |
4177 |
++ wake_up(&rdev->irq.vblank_queue); |
4178 |
+ } |
4179 |
++ if (atomic_read(&rdev->irq.pflip[1])) |
4180 |
++ radeon_crtc_handle_vblank(rdev, 1); |
4181 |
++ rdev->irq.stat_regs.r600.disp_int &= ~LB_D2_VBLANK_INTERRUPT; |
4182 |
++ DRM_DEBUG("IH: D2 vblank\n"); |
4183 |
++ |
4184 |
+ break; |
4185 |
+ case 1: /* D1 vline */ |
4186 |
+- if (rdev->irq.stat_regs.r600.disp_int & LB_D2_VLINE_INTERRUPT) { |
4187 |
+- rdev->irq.stat_regs.r600.disp_int &= ~LB_D2_VLINE_INTERRUPT; |
4188 |
+- DRM_DEBUG("IH: D2 vline\n"); |
4189 |
+- } |
4190 |
++ if (!(rdev->irq.stat_regs.r600.disp_int & LB_D2_VLINE_INTERRUPT)) |
4191 |
++ DRM_DEBUG("IH: D2 vline - IH event w/o asserted irq bit?\n"); |
4192 |
++ |
4193 |
++ rdev->irq.stat_regs.r600.disp_int &= ~LB_D2_VLINE_INTERRUPT; |
4194 |
++ DRM_DEBUG("IH: D2 vline\n"); |
4195 |
++ |
4196 |
+ break; |
4197 |
+ default: |
4198 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
4199 |
+@@ -4101,46 +4109,53 @@ restart_ih: |
4200 |
+ case 19: /* HPD/DAC hotplug */ |
4201 |
+ switch (src_data) { |
4202 |
+ case 0: |
4203 |
+- if (rdev->irq.stat_regs.r600.disp_int & DC_HPD1_INTERRUPT) { |
4204 |
+- rdev->irq.stat_regs.r600.disp_int &= ~DC_HPD1_INTERRUPT; |
4205 |
+- queue_hotplug = true; |
4206 |
+- DRM_DEBUG("IH: HPD1\n"); |
4207 |
+- } |
4208 |
++ if (!(rdev->irq.stat_regs.r600.disp_int & DC_HPD1_INTERRUPT)) |
4209 |
++ DRM_DEBUG("IH: HPD1 - IH event w/o asserted irq bit?\n"); |
4210 |
++ |
4211 |
++ rdev->irq.stat_regs.r600.disp_int &= ~DC_HPD1_INTERRUPT; |
4212 |
++ queue_hotplug = true; |
4213 |
++ DRM_DEBUG("IH: HPD1\n"); |
4214 |
+ break; |
4215 |
+ case 1: |
4216 |
+- if (rdev->irq.stat_regs.r600.disp_int & DC_HPD2_INTERRUPT) { |
4217 |
+- rdev->irq.stat_regs.r600.disp_int &= ~DC_HPD2_INTERRUPT; |
4218 |
+- queue_hotplug = true; |
4219 |
+- DRM_DEBUG("IH: HPD2\n"); |
4220 |
+- } |
4221 |
++ if (!(rdev->irq.stat_regs.r600.disp_int & DC_HPD2_INTERRUPT)) |
4222 |
++ DRM_DEBUG("IH: HPD2 - IH event w/o asserted irq bit?\n"); |
4223 |
++ |
4224 |
++ rdev->irq.stat_regs.r600.disp_int &= ~DC_HPD2_INTERRUPT; |
4225 |
++ queue_hotplug = true; |
4226 |
++ DRM_DEBUG("IH: HPD2\n"); |
4227 |
+ break; |
4228 |
+ case 4: |
4229 |
+- if (rdev->irq.stat_regs.r600.disp_int_cont & DC_HPD3_INTERRUPT) { |
4230 |
+- rdev->irq.stat_regs.r600.disp_int_cont &= ~DC_HPD3_INTERRUPT; |
4231 |
+- queue_hotplug = true; |
4232 |
+- DRM_DEBUG("IH: HPD3\n"); |
4233 |
+- } |
4234 |
++ if (!(rdev->irq.stat_regs.r600.disp_int_cont & DC_HPD3_INTERRUPT)) |
4235 |
++ DRM_DEBUG("IH: HPD3 - IH event w/o asserted irq bit?\n"); |
4236 |
++ |
4237 |
++ rdev->irq.stat_regs.r600.disp_int_cont &= ~DC_HPD3_INTERRUPT; |
4238 |
++ queue_hotplug = true; |
4239 |
++ DRM_DEBUG("IH: HPD3\n"); |
4240 |
+ break; |
4241 |
+ case 5: |
4242 |
+- if (rdev->irq.stat_regs.r600.disp_int_cont & DC_HPD4_INTERRUPT) { |
4243 |
+- rdev->irq.stat_regs.r600.disp_int_cont &= ~DC_HPD4_INTERRUPT; |
4244 |
+- queue_hotplug = true; |
4245 |
+- DRM_DEBUG("IH: HPD4\n"); |
4246 |
+- } |
4247 |
++ if (!(rdev->irq.stat_regs.r600.disp_int_cont & DC_HPD4_INTERRUPT)) |
4248 |
++ DRM_DEBUG("IH: HPD4 - IH event w/o asserted irq bit?\n"); |
4249 |
++ |
4250 |
++ rdev->irq.stat_regs.r600.disp_int_cont &= ~DC_HPD4_INTERRUPT; |
4251 |
++ queue_hotplug = true; |
4252 |
++ DRM_DEBUG("IH: HPD4\n"); |
4253 |
+ break; |
4254 |
+ case 10: |
4255 |
+- if (rdev->irq.stat_regs.r600.disp_int_cont2 & DC_HPD5_INTERRUPT) { |
4256 |
+- rdev->irq.stat_regs.r600.disp_int_cont2 &= ~DC_HPD5_INTERRUPT; |
4257 |
+- queue_hotplug = true; |
4258 |
+- DRM_DEBUG("IH: HPD5\n"); |
4259 |
+- } |
4260 |
++ if (!(rdev->irq.stat_regs.r600.disp_int_cont2 & DC_HPD5_INTERRUPT)) |
4261 |
++ DRM_DEBUG("IH: HPD5 - IH event w/o asserted irq bit?\n"); |
4262 |
++ |
4263 |
++ rdev->irq.stat_regs.r600.disp_int_cont2 &= ~DC_HPD5_INTERRUPT; |
4264 |
++ queue_hotplug = true; |
4265 |
++ DRM_DEBUG("IH: HPD5\n"); |
4266 |
+ break; |
4267 |
+ case 12: |
4268 |
+- if (rdev->irq.stat_regs.r600.disp_int_cont2 & DC_HPD6_INTERRUPT) { |
4269 |
+- rdev->irq.stat_regs.r600.disp_int_cont2 &= ~DC_HPD6_INTERRUPT; |
4270 |
+- queue_hotplug = true; |
4271 |
+- DRM_DEBUG("IH: HPD6\n"); |
4272 |
+- } |
4273 |
++ if (!(rdev->irq.stat_regs.r600.disp_int_cont2 & DC_HPD6_INTERRUPT)) |
4274 |
++ DRM_DEBUG("IH: HPD6 - IH event w/o asserted irq bit?\n"); |
4275 |
++ |
4276 |
++ rdev->irq.stat_regs.r600.disp_int_cont2 &= ~DC_HPD6_INTERRUPT; |
4277 |
++ queue_hotplug = true; |
4278 |
++ DRM_DEBUG("IH: HPD6\n"); |
4279 |
++ |
4280 |
+ break; |
4281 |
+ default: |
4282 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
4283 |
+@@ -4150,18 +4165,22 @@ restart_ih: |
4284 |
+ case 21: /* hdmi */ |
4285 |
+ switch (src_data) { |
4286 |
+ case 4: |
4287 |
+- if (rdev->irq.stat_regs.r600.hdmi0_status & HDMI0_AZ_FORMAT_WTRIG) { |
4288 |
+- rdev->irq.stat_regs.r600.hdmi0_status &= ~HDMI0_AZ_FORMAT_WTRIG; |
4289 |
+- queue_hdmi = true; |
4290 |
+- DRM_DEBUG("IH: HDMI0\n"); |
4291 |
+- } |
4292 |
++ if (!(rdev->irq.stat_regs.r600.hdmi0_status & HDMI0_AZ_FORMAT_WTRIG)) |
4293 |
++ DRM_DEBUG("IH: HDMI0 - IH event w/o asserted irq bit?\n"); |
4294 |
++ |
4295 |
++ rdev->irq.stat_regs.r600.hdmi0_status &= ~HDMI0_AZ_FORMAT_WTRIG; |
4296 |
++ queue_hdmi = true; |
4297 |
++ DRM_DEBUG("IH: HDMI0\n"); |
4298 |
++ |
4299 |
+ break; |
4300 |
+ case 5: |
4301 |
+- if (rdev->irq.stat_regs.r600.hdmi1_status & HDMI0_AZ_FORMAT_WTRIG) { |
4302 |
+- rdev->irq.stat_regs.r600.hdmi1_status &= ~HDMI0_AZ_FORMAT_WTRIG; |
4303 |
+- queue_hdmi = true; |
4304 |
+- DRM_DEBUG("IH: HDMI1\n"); |
4305 |
+- } |
4306 |
++ if (!(rdev->irq.stat_regs.r600.hdmi1_status & HDMI0_AZ_FORMAT_WTRIG)) |
4307 |
++ DRM_DEBUG("IH: HDMI1 - IH event w/o asserted irq bit?\n"); |
4308 |
++ |
4309 |
++ rdev->irq.stat_regs.r600.hdmi1_status &= ~HDMI0_AZ_FORMAT_WTRIG; |
4310 |
++ queue_hdmi = true; |
4311 |
++ DRM_DEBUG("IH: HDMI1\n"); |
4312 |
++ |
4313 |
+ break; |
4314 |
+ default: |
4315 |
+ DRM_ERROR("Unhandled interrupt: %d %d\n", src_id, src_data); |
4316 |
+diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c |
4317 |
+index 25191f126f3b..fa719c53449b 100644 |
4318 |
+--- a/drivers/gpu/drm/radeon/radeon_audio.c |
4319 |
++++ b/drivers/gpu/drm/radeon/radeon_audio.c |
4320 |
+@@ -242,6 +242,13 @@ static struct radeon_audio_funcs dce6_dp_funcs = { |
4321 |
+ .dpms = evergreen_dp_enable, |
4322 |
+ }; |
4323 |
+ |
4324 |
++static void radeon_audio_enable(struct radeon_device *rdev, |
4325 |
++ struct r600_audio_pin *pin, u8 enable_mask) |
4326 |
++{ |
4327 |
++ if (rdev->audio.funcs->enable) |
4328 |
++ rdev->audio.funcs->enable(rdev, pin, enable_mask); |
4329 |
++} |
4330 |
++ |
4331 |
+ static void radeon_audio_interface_init(struct radeon_device *rdev) |
4332 |
+ { |
4333 |
+ if (ASIC_IS_DCE6(rdev)) { |
4334 |
+@@ -307,7 +314,7 @@ int radeon_audio_init(struct radeon_device *rdev) |
4335 |
+ |
4336 |
+ /* disable audio. it will be set up later */ |
4337 |
+ for (i = 0; i < rdev->audio.num_pins; i++) |
4338 |
+- radeon_audio_enable(rdev, &rdev->audio.pin[i], false); |
4339 |
++ radeon_audio_enable(rdev, &rdev->audio.pin[i], 0); |
4340 |
+ |
4341 |
+ return 0; |
4342 |
+ } |
4343 |
+@@ -443,13 +450,6 @@ static void radeon_audio_select_pin(struct drm_encoder *encoder) |
4344 |
+ radeon_encoder->audio->select_pin(encoder); |
4345 |
+ } |
4346 |
+ |
4347 |
+-void radeon_audio_enable(struct radeon_device *rdev, |
4348 |
+- struct r600_audio_pin *pin, u8 enable_mask) |
4349 |
+-{ |
4350 |
+- if (rdev->audio.funcs->enable) |
4351 |
+- rdev->audio.funcs->enable(rdev, pin, enable_mask); |
4352 |
+-} |
4353 |
+- |
4354 |
+ void radeon_audio_detect(struct drm_connector *connector, |
4355 |
+ enum drm_connector_status status) |
4356 |
+ { |
4357 |
+@@ -469,22 +469,22 @@ void radeon_audio_detect(struct drm_connector *connector, |
4358 |
+ dig = radeon_encoder->enc_priv; |
4359 |
+ |
4360 |
+ if (status == connector_status_connected) { |
4361 |
+- struct radeon_connector *radeon_connector; |
4362 |
+- int sink_type; |
4363 |
+- |
4364 |
+ if (!drm_detect_monitor_audio(radeon_connector_edid(connector))) { |
4365 |
+ radeon_encoder->audio = NULL; |
4366 |
+ return; |
4367 |
+ } |
4368 |
+ |
4369 |
+- radeon_connector = to_radeon_connector(connector); |
4370 |
+- sink_type = radeon_dp_getsinktype(radeon_connector); |
4371 |
++ if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) { |
4372 |
++ struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
4373 |
+ |
4374 |
+- if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort && |
4375 |
+- sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) |
4376 |
+- radeon_encoder->audio = rdev->audio.dp_funcs; |
4377 |
+- else |
4378 |
++ if (radeon_dp_getsinktype(radeon_connector) == |
4379 |
++ CONNECTOR_OBJECT_ID_DISPLAYPORT) |
4380 |
++ radeon_encoder->audio = rdev->audio.dp_funcs; |
4381 |
++ else |
4382 |
++ radeon_encoder->audio = rdev->audio.hdmi_funcs; |
4383 |
++ } else { |
4384 |
+ radeon_encoder->audio = rdev->audio.hdmi_funcs; |
4385 |
++ } |
4386 |
+ |
4387 |
+ dig->afmt->pin = radeon_audio_get_pin(connector->encoder); |
4388 |
+ radeon_audio_enable(rdev, dig->afmt->pin, 0xf); |
4389 |
+@@ -502,7 +502,7 @@ void radeon_audio_fini(struct radeon_device *rdev) |
4390 |
+ return; |
4391 |
+ |
4392 |
+ for (i = 0; i < rdev->audio.num_pins; i++) |
4393 |
+- radeon_audio_enable(rdev, &rdev->audio.pin[i], false); |
4394 |
++ radeon_audio_enable(rdev, &rdev->audio.pin[i], 0); |
4395 |
+ |
4396 |
+ rdev->audio.enabled = false; |
4397 |
+ } |
4398 |
+diff --git a/drivers/gpu/drm/radeon/radeon_audio.h b/drivers/gpu/drm/radeon/radeon_audio.h |
4399 |
+index c92d059ab204..8438304f7139 100644 |
4400 |
+--- a/drivers/gpu/drm/radeon/radeon_audio.h |
4401 |
++++ b/drivers/gpu/drm/radeon/radeon_audio.h |
4402 |
+@@ -74,8 +74,6 @@ u32 radeon_audio_endpoint_rreg(struct radeon_device *rdev, |
4403 |
+ void radeon_audio_endpoint_wreg(struct radeon_device *rdev, |
4404 |
+ u32 offset, u32 reg, u32 v); |
4405 |
+ struct r600_audio_pin *radeon_audio_get_pin(struct drm_encoder *encoder); |
4406 |
+-void radeon_audio_enable(struct radeon_device *rdev, |
4407 |
+- struct r600_audio_pin *pin, u8 enable_mask); |
4408 |
+ void radeon_audio_fini(struct radeon_device *rdev); |
4409 |
+ void radeon_audio_mode_set(struct drm_encoder *encoder, |
4410 |
+ struct drm_display_mode *mode); |
4411 |
+diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c |
4412 |
+index 45e54060ee97..fa661744a1f5 100644 |
4413 |
+--- a/drivers/gpu/drm/radeon/radeon_cursor.c |
4414 |
++++ b/drivers/gpu/drm/radeon/radeon_cursor.c |
4415 |
+@@ -205,8 +205,9 @@ static int radeon_cursor_move_locked(struct drm_crtc *crtc, int x, int y) |
4416 |
+ | (x << 16) |
4417 |
+ | y)); |
4418 |
+ /* offset is from DISP(2)_BASE_ADDRESS */ |
4419 |
+- WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, (radeon_crtc->legacy_cursor_offset + |
4420 |
+- (yorigin * 256))); |
4421 |
++ WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, |
4422 |
++ radeon_crtc->cursor_addr - radeon_crtc->legacy_display_base_addr + |
4423 |
++ yorigin * 256); |
4424 |
+ } |
4425 |
+ |
4426 |
+ radeon_crtc->cursor_x = x; |
4427 |
+@@ -227,51 +228,32 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc, |
4428 |
+ return ret; |
4429 |
+ } |
4430 |
+ |
4431 |
+-static int radeon_set_cursor(struct drm_crtc *crtc, struct drm_gem_object *obj) |
4432 |
++static void radeon_set_cursor(struct drm_crtc *crtc) |
4433 |
+ { |
4434 |
+ struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
4435 |
+ struct radeon_device *rdev = crtc->dev->dev_private; |
4436 |
+- struct radeon_bo *robj = gem_to_radeon_bo(obj); |
4437 |
+- uint64_t gpu_addr; |
4438 |
+- int ret; |
4439 |
+- |
4440 |
+- ret = radeon_bo_reserve(robj, false); |
4441 |
+- if (unlikely(ret != 0)) |
4442 |
+- goto fail; |
4443 |
+- /* Only 27 bit offset for legacy cursor */ |
4444 |
+- ret = radeon_bo_pin_restricted(robj, RADEON_GEM_DOMAIN_VRAM, |
4445 |
+- ASIC_IS_AVIVO(rdev) ? 0 : 1 << 27, |
4446 |
+- &gpu_addr); |
4447 |
+- radeon_bo_unreserve(robj); |
4448 |
+- if (ret) |
4449 |
+- goto fail; |
4450 |
+ |
4451 |
+ if (ASIC_IS_DCE4(rdev)) { |
4452 |
+ WREG32(EVERGREEN_CUR_SURFACE_ADDRESS_HIGH + radeon_crtc->crtc_offset, |
4453 |
+- upper_32_bits(gpu_addr)); |
4454 |
++ upper_32_bits(radeon_crtc->cursor_addr)); |
4455 |
+ WREG32(EVERGREEN_CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, |
4456 |
+- gpu_addr & 0xffffffff); |
4457 |
++ lower_32_bits(radeon_crtc->cursor_addr)); |
4458 |
+ } else if (ASIC_IS_AVIVO(rdev)) { |
4459 |
+ if (rdev->family >= CHIP_RV770) { |
4460 |
+ if (radeon_crtc->crtc_id) |
4461 |
+- WREG32(R700_D2CUR_SURFACE_ADDRESS_HIGH, upper_32_bits(gpu_addr)); |
4462 |
++ WREG32(R700_D2CUR_SURFACE_ADDRESS_HIGH, |
4463 |
++ upper_32_bits(radeon_crtc->cursor_addr)); |
4464 |
+ else |
4465 |
+- WREG32(R700_D1CUR_SURFACE_ADDRESS_HIGH, upper_32_bits(gpu_addr)); |
4466 |
++ WREG32(R700_D1CUR_SURFACE_ADDRESS_HIGH, |
4467 |
++ upper_32_bits(radeon_crtc->cursor_addr)); |
4468 |
+ } |
4469 |
+ WREG32(AVIVO_D1CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, |
4470 |
+- gpu_addr & 0xffffffff); |
4471 |
++ lower_32_bits(radeon_crtc->cursor_addr)); |
4472 |
+ } else { |
4473 |
+- radeon_crtc->legacy_cursor_offset = gpu_addr - radeon_crtc->legacy_display_base_addr; |
4474 |
+ /* offset is from DISP(2)_BASE_ADDRESS */ |
4475 |
+- WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, radeon_crtc->legacy_cursor_offset); |
4476 |
++ WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, |
4477 |
++ radeon_crtc->cursor_addr - radeon_crtc->legacy_display_base_addr); |
4478 |
+ } |
4479 |
+- |
4480 |
+- return 0; |
4481 |
+- |
4482 |
+-fail: |
4483 |
+- drm_gem_object_unreference_unlocked(obj); |
4484 |
+- |
4485 |
+- return ret; |
4486 |
+ } |
4487 |
+ |
4488 |
+ int radeon_crtc_cursor_set2(struct drm_crtc *crtc, |
4489 |
+@@ -283,7 +265,9 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc, |
4490 |
+ int32_t hot_y) |
4491 |
+ { |
4492 |
+ struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
4493 |
++ struct radeon_device *rdev = crtc->dev->dev_private; |
4494 |
+ struct drm_gem_object *obj; |
4495 |
++ struct radeon_bo *robj; |
4496 |
+ int ret; |
4497 |
+ |
4498 |
+ if (!handle) { |
4499 |
+@@ -305,6 +289,23 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc, |
4500 |
+ return -ENOENT; |
4501 |
+ } |
4502 |
+ |
4503 |
++ robj = gem_to_radeon_bo(obj); |
4504 |
++ ret = radeon_bo_reserve(robj, false); |
4505 |
++ if (ret != 0) { |
4506 |
++ drm_gem_object_unreference_unlocked(obj); |
4507 |
++ return ret; |
4508 |
++ } |
4509 |
++ /* Only 27 bit offset for legacy cursor */ |
4510 |
++ ret = radeon_bo_pin_restricted(robj, RADEON_GEM_DOMAIN_VRAM, |
4511 |
++ ASIC_IS_AVIVO(rdev) ? 0 : 1 << 27, |
4512 |
++ &radeon_crtc->cursor_addr); |
4513 |
++ radeon_bo_unreserve(robj); |
4514 |
++ if (ret) { |
4515 |
++ DRM_ERROR("Failed to pin new cursor BO (%d)\n", ret); |
4516 |
++ drm_gem_object_unreference_unlocked(obj); |
4517 |
++ return ret; |
4518 |
++ } |
4519 |
++ |
4520 |
+ radeon_crtc->cursor_width = width; |
4521 |
+ radeon_crtc->cursor_height = height; |
4522 |
+ |
4523 |
+@@ -323,13 +324,8 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc, |
4524 |
+ radeon_crtc->cursor_hot_y = hot_y; |
4525 |
+ } |
4526 |
+ |
4527 |
+- ret = radeon_set_cursor(crtc, obj); |
4528 |
+- |
4529 |
+- if (ret) |
4530 |
+- DRM_ERROR("radeon_set_cursor returned %d, not changing cursor\n", |
4531 |
+- ret); |
4532 |
+- else |
4533 |
+- radeon_show_cursor(crtc); |
4534 |
++ radeon_set_cursor(crtc); |
4535 |
++ radeon_show_cursor(crtc); |
4536 |
+ |
4537 |
+ radeon_lock_cursor(crtc, false); |
4538 |
+ |
4539 |
+@@ -341,8 +337,7 @@ unpin: |
4540 |
+ radeon_bo_unpin(robj); |
4541 |
+ radeon_bo_unreserve(robj); |
4542 |
+ } |
4543 |
+- if (radeon_crtc->cursor_bo != obj) |
4544 |
+- drm_gem_object_unreference_unlocked(radeon_crtc->cursor_bo); |
4545 |
++ drm_gem_object_unreference_unlocked(radeon_crtc->cursor_bo); |
4546 |
+ } |
4547 |
+ |
4548 |
+ radeon_crtc->cursor_bo = obj; |
4549 |
+@@ -360,7 +355,6 @@ unpin: |
4550 |
+ void radeon_cursor_reset(struct drm_crtc *crtc) |
4551 |
+ { |
4552 |
+ struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
4553 |
+- int ret; |
4554 |
+ |
4555 |
+ if (radeon_crtc->cursor_bo) { |
4556 |
+ radeon_lock_cursor(crtc, true); |
4557 |
+@@ -368,12 +362,8 @@ void radeon_cursor_reset(struct drm_crtc *crtc) |
4558 |
+ radeon_cursor_move_locked(crtc, radeon_crtc->cursor_x, |
4559 |
+ radeon_crtc->cursor_y); |
4560 |
+ |
4561 |
+- ret = radeon_set_cursor(crtc, radeon_crtc->cursor_bo); |
4562 |
+- if (ret) |
4563 |
+- DRM_ERROR("radeon_set_cursor returned %d, not showing " |
4564 |
+- "cursor\n", ret); |
4565 |
+- else |
4566 |
+- radeon_show_cursor(crtc); |
4567 |
++ radeon_set_cursor(crtc); |
4568 |
++ radeon_show_cursor(crtc); |
4569 |
+ |
4570 |
+ radeon_lock_cursor(crtc, false); |
4571 |
+ } |
4572 |
+diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c |
4573 |
+index a7fdfa4f0857..604c44d88e7a 100644 |
4574 |
+--- a/drivers/gpu/drm/radeon/radeon_device.c |
4575 |
++++ b/drivers/gpu/drm/radeon/radeon_device.c |
4576 |
+@@ -1572,11 +1572,21 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon) |
4577 |
+ drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); |
4578 |
+ } |
4579 |
+ |
4580 |
+- /* unpin the front buffers */ |
4581 |
++ /* unpin the front buffers and cursors */ |
4582 |
+ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
4583 |
++ struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
4584 |
+ struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->primary->fb); |
4585 |
+ struct radeon_bo *robj; |
4586 |
+ |
4587 |
++ if (radeon_crtc->cursor_bo) { |
4588 |
++ struct radeon_bo *robj = gem_to_radeon_bo(radeon_crtc->cursor_bo); |
4589 |
++ r = radeon_bo_reserve(robj, false); |
4590 |
++ if (r == 0) { |
4591 |
++ radeon_bo_unpin(robj); |
4592 |
++ radeon_bo_unreserve(robj); |
4593 |
++ } |
4594 |
++ } |
4595 |
++ |
4596 |
+ if (rfb == NULL || rfb->obj == NULL) { |
4597 |
+ continue; |
4598 |
+ } |
4599 |
+@@ -1639,6 +1649,7 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon) |
4600 |
+ { |
4601 |
+ struct drm_connector *connector; |
4602 |
+ struct radeon_device *rdev = dev->dev_private; |
4603 |
++ struct drm_crtc *crtc; |
4604 |
+ int r; |
4605 |
+ |
4606 |
+ if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
4607 |
+@@ -1678,6 +1689,27 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon) |
4608 |
+ |
4609 |
+ radeon_restore_bios_scratch_regs(rdev); |
4610 |
+ |
4611 |
++ /* pin cursors */ |
4612 |
++ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
4613 |
++ struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
4614 |
++ |
4615 |
++ if (radeon_crtc->cursor_bo) { |
4616 |
++ struct radeon_bo *robj = gem_to_radeon_bo(radeon_crtc->cursor_bo); |
4617 |
++ r = radeon_bo_reserve(robj, false); |
4618 |
++ if (r == 0) { |
4619 |
++ /* Only 27 bit offset for legacy cursor */ |
4620 |
++ r = radeon_bo_pin_restricted(robj, |
4621 |
++ RADEON_GEM_DOMAIN_VRAM, |
4622 |
++ ASIC_IS_AVIVO(rdev) ? |
4623 |
++ 0 : 1 << 27, |
4624 |
++ &radeon_crtc->cursor_addr); |
4625 |
++ if (r != 0) |
4626 |
++ DRM_ERROR("Failed to pin cursor BO (%d)\n", r); |
4627 |
++ radeon_bo_unreserve(robj); |
4628 |
++ } |
4629 |
++ } |
4630 |
++ } |
4631 |
++ |
4632 |
+ /* init dig PHYs, disp eng pll */ |
4633 |
+ if (rdev->is_atom_bios) { |
4634 |
+ radeon_atom_encoder_init(rdev); |
4635 |
+diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c |
4636 |
+index aeb676708e60..634793ea8418 100644 |
4637 |
+--- a/drivers/gpu/drm/radeon/radeon_fb.c |
4638 |
++++ b/drivers/gpu/drm/radeon/radeon_fb.c |
4639 |
+@@ -257,7 +257,6 @@ static int radeonfb_create(struct drm_fb_helper *helper, |
4640 |
+ } |
4641 |
+ |
4642 |
+ info->par = rfbdev; |
4643 |
+- info->skip_vt_switch = true; |
4644 |
+ |
4645 |
+ ret = radeon_framebuffer_init(rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj); |
4646 |
+ if (ret) { |
4647 |
+diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c |
4648 |
+index 5450fa95a47e..c4777c8d0312 100644 |
4649 |
+--- a/drivers/gpu/drm/radeon/radeon_gart.c |
4650 |
++++ b/drivers/gpu/drm/radeon/radeon_gart.c |
4651 |
+@@ -260,8 +260,10 @@ void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset, |
4652 |
+ } |
4653 |
+ } |
4654 |
+ } |
4655 |
+- mb(); |
4656 |
+- radeon_gart_tlb_flush(rdev); |
4657 |
++ if (rdev->gart.ptr) { |
4658 |
++ mb(); |
4659 |
++ radeon_gart_tlb_flush(rdev); |
4660 |
++ } |
4661 |
+ } |
4662 |
+ |
4663 |
+ /** |
4664 |
+@@ -306,8 +308,10 @@ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset, |
4665 |
+ page_base += RADEON_GPU_PAGE_SIZE; |
4666 |
+ } |
4667 |
+ } |
4668 |
+- mb(); |
4669 |
+- radeon_gart_tlb_flush(rdev); |
4670 |
++ if (rdev->gart.ptr) { |
4671 |
++ mb(); |
4672 |
++ radeon_gart_tlb_flush(rdev); |
4673 |
++ } |
4674 |
+ return 0; |
4675 |
+ } |
4676 |
+ |
4677 |
+diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c |
4678 |
+index ac3c1310b953..186d0b792a02 100644 |
4679 |
+--- a/drivers/gpu/drm/radeon/radeon_gem.c |
4680 |
++++ b/drivers/gpu/drm/radeon/radeon_gem.c |
4681 |
+@@ -36,6 +36,7 @@ void radeon_gem_object_free(struct drm_gem_object *gobj) |
4682 |
+ if (robj) { |
4683 |
+ if (robj->gem_base.import_attach) |
4684 |
+ drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg); |
4685 |
++ radeon_mn_unregister(robj); |
4686 |
+ radeon_bo_unref(&robj); |
4687 |
+ } |
4688 |
+ } |
4689 |
+@@ -471,6 +472,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, |
4690 |
+ r = ret; |
4691 |
+ |
4692 |
+ /* Flush HDP cache via MMIO if necessary */ |
4693 |
++ cur_placement = ACCESS_ONCE(robj->tbo.mem.mem_type); |
4694 |
+ if (rdev->asic->mmio_hdp_flush && |
4695 |
+ radeon_mem_type_to_domain(cur_placement) == RADEON_GEM_DOMAIN_VRAM) |
4696 |
+ robj->rdev->asic->mmio_hdp_flush(rdev); |
4697 |
+diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c |
4698 |
+index 7162c935371c..f682e5351252 100644 |
4699 |
+--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c |
4700 |
++++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c |
4701 |
+@@ -79,10 +79,12 @@ static void radeon_hotplug_work_func(struct work_struct *work) |
4702 |
+ struct drm_mode_config *mode_config = &dev->mode_config; |
4703 |
+ struct drm_connector *connector; |
4704 |
+ |
4705 |
++ mutex_lock(&mode_config->mutex); |
4706 |
+ if (mode_config->num_connector) { |
4707 |
+ list_for_each_entry(connector, &mode_config->connector_list, head) |
4708 |
+ radeon_connector_hotplug(connector); |
4709 |
+ } |
4710 |
++ mutex_unlock(&mode_config->mutex); |
4711 |
+ /* Just fire off a uevent and let userspace tell us what to do */ |
4712 |
+ drm_helper_hpd_irq_event(dev); |
4713 |
+ } |
4714 |
+diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h |
4715 |
+index fa91a17b81b6..f01c797b78cf 100644 |
4716 |
+--- a/drivers/gpu/drm/radeon/radeon_mode.h |
4717 |
++++ b/drivers/gpu/drm/radeon/radeon_mode.h |
4718 |
+@@ -343,7 +343,6 @@ struct radeon_crtc { |
4719 |
+ int max_cursor_width; |
4720 |
+ int max_cursor_height; |
4721 |
+ uint32_t legacy_display_base_addr; |
4722 |
+- uint32_t legacy_cursor_offset; |
4723 |
+ enum radeon_rmx_type rmx_type; |
4724 |
+ u8 h_border; |
4725 |
+ u8 v_border; |
4726 |
+diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c |
4727 |
+index 318165d4855c..676362769b8d 100644 |
4728 |
+--- a/drivers/gpu/drm/radeon/radeon_object.c |
4729 |
++++ b/drivers/gpu/drm/radeon/radeon_object.c |
4730 |
+@@ -75,7 +75,6 @@ static void radeon_ttm_bo_destroy(struct ttm_buffer_object *tbo) |
4731 |
+ bo = container_of(tbo, struct radeon_bo, tbo); |
4732 |
+ |
4733 |
+ radeon_update_memory_usage(bo, bo->tbo.mem.mem_type, -1); |
4734 |
+- radeon_mn_unregister(bo); |
4735 |
+ |
4736 |
+ mutex_lock(&bo->rdev->gem.mutex); |
4737 |
+ list_del_init(&bo->list); |
4738 |
+diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c |
4739 |
+index 4c679b802bc8..e15185b16504 100644 |
4740 |
+--- a/drivers/gpu/drm/radeon/si.c |
4741 |
++++ b/drivers/gpu/drm/radeon/si.c |
4742 |
+@@ -6466,23 +6466,27 @@ restart_ih: |
4743 |
+ case 1: /* D1 vblank/vline */ |
4744 |
+ switch (src_data) { |
4745 |
+ case 0: /* D1 vblank */ |
4746 |
+- if (rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VBLANK_INTERRUPT) { |
4747 |
+- if (rdev->irq.crtc_vblank_int[0]) { |
4748 |
+- drm_handle_vblank(rdev->ddev, 0); |
4749 |
+- rdev->pm.vblank_sync = true; |
4750 |
+- wake_up(&rdev->irq.vblank_queue); |
4751 |
+- } |
4752 |
+- if (atomic_read(&rdev->irq.pflip[0])) |
4753 |
+- radeon_crtc_handle_vblank(rdev, 0); |
4754 |
+- rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VBLANK_INTERRUPT; |
4755 |
+- DRM_DEBUG("IH: D1 vblank\n"); |
4756 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VBLANK_INTERRUPT)) |
4757 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4758 |
++ |
4759 |
++ if (rdev->irq.crtc_vblank_int[0]) { |
4760 |
++ drm_handle_vblank(rdev->ddev, 0); |
4761 |
++ rdev->pm.vblank_sync = true; |
4762 |
++ wake_up(&rdev->irq.vblank_queue); |
4763 |
+ } |
4764 |
++ if (atomic_read(&rdev->irq.pflip[0])) |
4765 |
++ radeon_crtc_handle_vblank(rdev, 0); |
4766 |
++ rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VBLANK_INTERRUPT; |
4767 |
++ DRM_DEBUG("IH: D1 vblank\n"); |
4768 |
++ |
4769 |
+ break; |
4770 |
+ case 1: /* D1 vline */ |
4771 |
+- if (rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VLINE_INTERRUPT) { |
4772 |
+- rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VLINE_INTERRUPT; |
4773 |
+- DRM_DEBUG("IH: D1 vline\n"); |
4774 |
+- } |
4775 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VLINE_INTERRUPT)) |
4776 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4777 |
++ |
4778 |
++ rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VLINE_INTERRUPT; |
4779 |
++ DRM_DEBUG("IH: D1 vline\n"); |
4780 |
++ |
4781 |
+ break; |
4782 |
+ default: |
4783 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
4784 |
+@@ -6492,23 +6496,27 @@ restart_ih: |
4785 |
+ case 2: /* D2 vblank/vline */ |
4786 |
+ switch (src_data) { |
4787 |
+ case 0: /* D2 vblank */ |
4788 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VBLANK_INTERRUPT) { |
4789 |
+- if (rdev->irq.crtc_vblank_int[1]) { |
4790 |
+- drm_handle_vblank(rdev->ddev, 1); |
4791 |
+- rdev->pm.vblank_sync = true; |
4792 |
+- wake_up(&rdev->irq.vblank_queue); |
4793 |
+- } |
4794 |
+- if (atomic_read(&rdev->irq.pflip[1])) |
4795 |
+- radeon_crtc_handle_vblank(rdev, 1); |
4796 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT; |
4797 |
+- DRM_DEBUG("IH: D2 vblank\n"); |
4798 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VBLANK_INTERRUPT)) |
4799 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4800 |
++ |
4801 |
++ if (rdev->irq.crtc_vblank_int[1]) { |
4802 |
++ drm_handle_vblank(rdev->ddev, 1); |
4803 |
++ rdev->pm.vblank_sync = true; |
4804 |
++ wake_up(&rdev->irq.vblank_queue); |
4805 |
+ } |
4806 |
++ if (atomic_read(&rdev->irq.pflip[1])) |
4807 |
++ radeon_crtc_handle_vblank(rdev, 1); |
4808 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT; |
4809 |
++ DRM_DEBUG("IH: D2 vblank\n"); |
4810 |
++ |
4811 |
+ break; |
4812 |
+ case 1: /* D2 vline */ |
4813 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VLINE_INTERRUPT) { |
4814 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VLINE_INTERRUPT; |
4815 |
+- DRM_DEBUG("IH: D2 vline\n"); |
4816 |
+- } |
4817 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VLINE_INTERRUPT)) |
4818 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4819 |
++ |
4820 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VLINE_INTERRUPT; |
4821 |
++ DRM_DEBUG("IH: D2 vline\n"); |
4822 |
++ |
4823 |
+ break; |
4824 |
+ default: |
4825 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
4826 |
+@@ -6518,23 +6526,27 @@ restart_ih: |
4827 |
+ case 3: /* D3 vblank/vline */ |
4828 |
+ switch (src_data) { |
4829 |
+ case 0: /* D3 vblank */ |
4830 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT) { |
4831 |
+- if (rdev->irq.crtc_vblank_int[2]) { |
4832 |
+- drm_handle_vblank(rdev->ddev, 2); |
4833 |
+- rdev->pm.vblank_sync = true; |
4834 |
+- wake_up(&rdev->irq.vblank_queue); |
4835 |
+- } |
4836 |
+- if (atomic_read(&rdev->irq.pflip[2])) |
4837 |
+- radeon_crtc_handle_vblank(rdev, 2); |
4838 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT; |
4839 |
+- DRM_DEBUG("IH: D3 vblank\n"); |
4840 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT)) |
4841 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4842 |
++ |
4843 |
++ if (rdev->irq.crtc_vblank_int[2]) { |
4844 |
++ drm_handle_vblank(rdev->ddev, 2); |
4845 |
++ rdev->pm.vblank_sync = true; |
4846 |
++ wake_up(&rdev->irq.vblank_queue); |
4847 |
+ } |
4848 |
++ if (atomic_read(&rdev->irq.pflip[2])) |
4849 |
++ radeon_crtc_handle_vblank(rdev, 2); |
4850 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT; |
4851 |
++ DRM_DEBUG("IH: D3 vblank\n"); |
4852 |
++ |
4853 |
+ break; |
4854 |
+ case 1: /* D3 vline */ |
4855 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VLINE_INTERRUPT) { |
4856 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VLINE_INTERRUPT; |
4857 |
+- DRM_DEBUG("IH: D3 vline\n"); |
4858 |
+- } |
4859 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VLINE_INTERRUPT)) |
4860 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4861 |
++ |
4862 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VLINE_INTERRUPT; |
4863 |
++ DRM_DEBUG("IH: D3 vline\n"); |
4864 |
++ |
4865 |
+ break; |
4866 |
+ default: |
4867 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
4868 |
+@@ -6544,23 +6556,27 @@ restart_ih: |
4869 |
+ case 4: /* D4 vblank/vline */ |
4870 |
+ switch (src_data) { |
4871 |
+ case 0: /* D4 vblank */ |
4872 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VBLANK_INTERRUPT) { |
4873 |
+- if (rdev->irq.crtc_vblank_int[3]) { |
4874 |
+- drm_handle_vblank(rdev->ddev, 3); |
4875 |
+- rdev->pm.vblank_sync = true; |
4876 |
+- wake_up(&rdev->irq.vblank_queue); |
4877 |
+- } |
4878 |
+- if (atomic_read(&rdev->irq.pflip[3])) |
4879 |
+- radeon_crtc_handle_vblank(rdev, 3); |
4880 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT; |
4881 |
+- DRM_DEBUG("IH: D4 vblank\n"); |
4882 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VBLANK_INTERRUPT)) |
4883 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4884 |
++ |
4885 |
++ if (rdev->irq.crtc_vblank_int[3]) { |
4886 |
++ drm_handle_vblank(rdev->ddev, 3); |
4887 |
++ rdev->pm.vblank_sync = true; |
4888 |
++ wake_up(&rdev->irq.vblank_queue); |
4889 |
+ } |
4890 |
++ if (atomic_read(&rdev->irq.pflip[3])) |
4891 |
++ radeon_crtc_handle_vblank(rdev, 3); |
4892 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT; |
4893 |
++ DRM_DEBUG("IH: D4 vblank\n"); |
4894 |
++ |
4895 |
+ break; |
4896 |
+ case 1: /* D4 vline */ |
4897 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VLINE_INTERRUPT) { |
4898 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VLINE_INTERRUPT; |
4899 |
+- DRM_DEBUG("IH: D4 vline\n"); |
4900 |
+- } |
4901 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VLINE_INTERRUPT)) |
4902 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4903 |
++ |
4904 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VLINE_INTERRUPT; |
4905 |
++ DRM_DEBUG("IH: D4 vline\n"); |
4906 |
++ |
4907 |
+ break; |
4908 |
+ default: |
4909 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
4910 |
+@@ -6570,23 +6586,27 @@ restart_ih: |
4911 |
+ case 5: /* D5 vblank/vline */ |
4912 |
+ switch (src_data) { |
4913 |
+ case 0: /* D5 vblank */ |
4914 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT) { |
4915 |
+- if (rdev->irq.crtc_vblank_int[4]) { |
4916 |
+- drm_handle_vblank(rdev->ddev, 4); |
4917 |
+- rdev->pm.vblank_sync = true; |
4918 |
+- wake_up(&rdev->irq.vblank_queue); |
4919 |
+- } |
4920 |
+- if (atomic_read(&rdev->irq.pflip[4])) |
4921 |
+- radeon_crtc_handle_vblank(rdev, 4); |
4922 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT; |
4923 |
+- DRM_DEBUG("IH: D5 vblank\n"); |
4924 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT)) |
4925 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4926 |
++ |
4927 |
++ if (rdev->irq.crtc_vblank_int[4]) { |
4928 |
++ drm_handle_vblank(rdev->ddev, 4); |
4929 |
++ rdev->pm.vblank_sync = true; |
4930 |
++ wake_up(&rdev->irq.vblank_queue); |
4931 |
+ } |
4932 |
++ if (atomic_read(&rdev->irq.pflip[4])) |
4933 |
++ radeon_crtc_handle_vblank(rdev, 4); |
4934 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT; |
4935 |
++ DRM_DEBUG("IH: D5 vblank\n"); |
4936 |
++ |
4937 |
+ break; |
4938 |
+ case 1: /* D5 vline */ |
4939 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VLINE_INTERRUPT) { |
4940 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VLINE_INTERRUPT; |
4941 |
+- DRM_DEBUG("IH: D5 vline\n"); |
4942 |
+- } |
4943 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VLINE_INTERRUPT)) |
4944 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4945 |
++ |
4946 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VLINE_INTERRUPT; |
4947 |
++ DRM_DEBUG("IH: D5 vline\n"); |
4948 |
++ |
4949 |
+ break; |
4950 |
+ default: |
4951 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
4952 |
+@@ -6596,23 +6616,27 @@ restart_ih: |
4953 |
+ case 6: /* D6 vblank/vline */ |
4954 |
+ switch (src_data) { |
4955 |
+ case 0: /* D6 vblank */ |
4956 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VBLANK_INTERRUPT) { |
4957 |
+- if (rdev->irq.crtc_vblank_int[5]) { |
4958 |
+- drm_handle_vblank(rdev->ddev, 5); |
4959 |
+- rdev->pm.vblank_sync = true; |
4960 |
+- wake_up(&rdev->irq.vblank_queue); |
4961 |
+- } |
4962 |
+- if (atomic_read(&rdev->irq.pflip[5])) |
4963 |
+- radeon_crtc_handle_vblank(rdev, 5); |
4964 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT; |
4965 |
+- DRM_DEBUG("IH: D6 vblank\n"); |
4966 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VBLANK_INTERRUPT)) |
4967 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4968 |
++ |
4969 |
++ if (rdev->irq.crtc_vblank_int[5]) { |
4970 |
++ drm_handle_vblank(rdev->ddev, 5); |
4971 |
++ rdev->pm.vblank_sync = true; |
4972 |
++ wake_up(&rdev->irq.vblank_queue); |
4973 |
+ } |
4974 |
++ if (atomic_read(&rdev->irq.pflip[5])) |
4975 |
++ radeon_crtc_handle_vblank(rdev, 5); |
4976 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT; |
4977 |
++ DRM_DEBUG("IH: D6 vblank\n"); |
4978 |
++ |
4979 |
+ break; |
4980 |
+ case 1: /* D6 vline */ |
4981 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VLINE_INTERRUPT) { |
4982 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VLINE_INTERRUPT; |
4983 |
+- DRM_DEBUG("IH: D6 vline\n"); |
4984 |
+- } |
4985 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VLINE_INTERRUPT)) |
4986 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
4987 |
++ |
4988 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VLINE_INTERRUPT; |
4989 |
++ DRM_DEBUG("IH: D6 vline\n"); |
4990 |
++ |
4991 |
+ break; |
4992 |
+ default: |
4993 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
4994 |
+@@ -6632,88 +6656,112 @@ restart_ih: |
4995 |
+ case 42: /* HPD hotplug */ |
4996 |
+ switch (src_data) { |
4997 |
+ case 0: |
4998 |
+- if (rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_INTERRUPT) { |
4999 |
+- rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_INTERRUPT; |
5000 |
+- queue_hotplug = true; |
5001 |
+- DRM_DEBUG("IH: HPD1\n"); |
5002 |
+- } |
5003 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_INTERRUPT)) |
5004 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5005 |
++ |
5006 |
++ rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_INTERRUPT; |
5007 |
++ queue_hotplug = true; |
5008 |
++ DRM_DEBUG("IH: HPD1\n"); |
5009 |
++ |
5010 |
+ break; |
5011 |
+ case 1: |
5012 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_INTERRUPT) { |
5013 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_INTERRUPT; |
5014 |
+- queue_hotplug = true; |
5015 |
+- DRM_DEBUG("IH: HPD2\n"); |
5016 |
+- } |
5017 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_INTERRUPT)) |
5018 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5019 |
++ |
5020 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_INTERRUPT; |
5021 |
++ queue_hotplug = true; |
5022 |
++ DRM_DEBUG("IH: HPD2\n"); |
5023 |
++ |
5024 |
+ break; |
5025 |
+ case 2: |
5026 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_INTERRUPT) { |
5027 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_INTERRUPT; |
5028 |
+- queue_hotplug = true; |
5029 |
+- DRM_DEBUG("IH: HPD3\n"); |
5030 |
+- } |
5031 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_INTERRUPT)) |
5032 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5033 |
++ |
5034 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_INTERRUPT; |
5035 |
++ queue_hotplug = true; |
5036 |
++ DRM_DEBUG("IH: HPD3\n"); |
5037 |
++ |
5038 |
+ break; |
5039 |
+ case 3: |
5040 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_INTERRUPT) { |
5041 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_INTERRUPT; |
5042 |
+- queue_hotplug = true; |
5043 |
+- DRM_DEBUG("IH: HPD4\n"); |
5044 |
+- } |
5045 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_INTERRUPT)) |
5046 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5047 |
++ |
5048 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_INTERRUPT; |
5049 |
++ queue_hotplug = true; |
5050 |
++ DRM_DEBUG("IH: HPD4\n"); |
5051 |
++ |
5052 |
+ break; |
5053 |
+ case 4: |
5054 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_INTERRUPT) { |
5055 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_INTERRUPT; |
5056 |
+- queue_hotplug = true; |
5057 |
+- DRM_DEBUG("IH: HPD5\n"); |
5058 |
+- } |
5059 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_INTERRUPT)) |
5060 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5061 |
++ |
5062 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_INTERRUPT; |
5063 |
++ queue_hotplug = true; |
5064 |
++ DRM_DEBUG("IH: HPD5\n"); |
5065 |
++ |
5066 |
+ break; |
5067 |
+ case 5: |
5068 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_INTERRUPT) { |
5069 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_INTERRUPT; |
5070 |
+- queue_hotplug = true; |
5071 |
+- DRM_DEBUG("IH: HPD6\n"); |
5072 |
+- } |
5073 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_INTERRUPT)) |
5074 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5075 |
++ |
5076 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_INTERRUPT; |
5077 |
++ queue_hotplug = true; |
5078 |
++ DRM_DEBUG("IH: HPD6\n"); |
5079 |
++ |
5080 |
+ break; |
5081 |
+ case 6: |
5082 |
+- if (rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_RX_INTERRUPT) { |
5083 |
+- rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_RX_INTERRUPT; |
5084 |
+- queue_dp = true; |
5085 |
+- DRM_DEBUG("IH: HPD_RX 1\n"); |
5086 |
+- } |
5087 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_RX_INTERRUPT)) |
5088 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5089 |
++ |
5090 |
++ rdev->irq.stat_regs.evergreen.disp_int &= ~DC_HPD1_RX_INTERRUPT; |
5091 |
++ queue_dp = true; |
5092 |
++ DRM_DEBUG("IH: HPD_RX 1\n"); |
5093 |
++ |
5094 |
+ break; |
5095 |
+ case 7: |
5096 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_RX_INTERRUPT) { |
5097 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_RX_INTERRUPT; |
5098 |
+- queue_dp = true; |
5099 |
+- DRM_DEBUG("IH: HPD_RX 2\n"); |
5100 |
+- } |
5101 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont & DC_HPD2_RX_INTERRUPT)) |
5102 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5103 |
++ |
5104 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont &= ~DC_HPD2_RX_INTERRUPT; |
5105 |
++ queue_dp = true; |
5106 |
++ DRM_DEBUG("IH: HPD_RX 2\n"); |
5107 |
++ |
5108 |
+ break; |
5109 |
+ case 8: |
5110 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_RX_INTERRUPT) { |
5111 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_RX_INTERRUPT; |
5112 |
+- queue_dp = true; |
5113 |
+- DRM_DEBUG("IH: HPD_RX 3\n"); |
5114 |
+- } |
5115 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont2 & DC_HPD3_RX_INTERRUPT)) |
5116 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5117 |
++ |
5118 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~DC_HPD3_RX_INTERRUPT; |
5119 |
++ queue_dp = true; |
5120 |
++ DRM_DEBUG("IH: HPD_RX 3\n"); |
5121 |
++ |
5122 |
+ break; |
5123 |
+ case 9: |
5124 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_RX_INTERRUPT) { |
5125 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_RX_INTERRUPT; |
5126 |
+- queue_dp = true; |
5127 |
+- DRM_DEBUG("IH: HPD_RX 4\n"); |
5128 |
+- } |
5129 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont3 & DC_HPD4_RX_INTERRUPT)) |
5130 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5131 |
++ |
5132 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~DC_HPD4_RX_INTERRUPT; |
5133 |
++ queue_dp = true; |
5134 |
++ DRM_DEBUG("IH: HPD_RX 4\n"); |
5135 |
++ |
5136 |
+ break; |
5137 |
+ case 10: |
5138 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_RX_INTERRUPT) { |
5139 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_RX_INTERRUPT; |
5140 |
+- queue_dp = true; |
5141 |
+- DRM_DEBUG("IH: HPD_RX 5\n"); |
5142 |
+- } |
5143 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont4 & DC_HPD5_RX_INTERRUPT)) |
5144 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5145 |
++ |
5146 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~DC_HPD5_RX_INTERRUPT; |
5147 |
++ queue_dp = true; |
5148 |
++ DRM_DEBUG("IH: HPD_RX 5\n"); |
5149 |
++ |
5150 |
+ break; |
5151 |
+ case 11: |
5152 |
+- if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_RX_INTERRUPT) { |
5153 |
+- rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_RX_INTERRUPT; |
5154 |
+- queue_dp = true; |
5155 |
+- DRM_DEBUG("IH: HPD_RX 6\n"); |
5156 |
+- } |
5157 |
++ if (!(rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_RX_INTERRUPT)) |
5158 |
++ DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
5159 |
++ |
5160 |
++ rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~DC_HPD6_RX_INTERRUPT; |
5161 |
++ queue_dp = true; |
5162 |
++ DRM_DEBUG("IH: HPD_RX 6\n"); |
5163 |
++ |
5164 |
+ break; |
5165 |
+ default: |
5166 |
+ DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data); |
5167 |
+diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c |
5168 |
+index ff8b83f5e929..9dfcedec05a6 100644 |
5169 |
+--- a/drivers/gpu/drm/radeon/si_dpm.c |
5170 |
++++ b/drivers/gpu/drm/radeon/si_dpm.c |
5171 |
+@@ -2925,6 +2925,7 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = { |
5172 |
+ /* PITCAIRN - https://bugs.freedesktop.org/show_bug.cgi?id=76490 */ |
5173 |
+ { PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 }, |
5174 |
+ { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 }, |
5175 |
++ { PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 }, |
5176 |
+ { 0, 0, 0, 0 }, |
5177 |
+ }; |
5178 |
+ |
5179 |
+diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c |
5180 |
+index eb2282cc4a56..eba5f8a52fbd 100644 |
5181 |
+--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c |
5182 |
++++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c |
5183 |
+@@ -54,55 +54,56 @@ static void rockchip_gem_free_buf(struct rockchip_gem_object *rk_obj) |
5184 |
+ &rk_obj->dma_attrs); |
5185 |
+ } |
5186 |
+ |
5187 |
+-int rockchip_gem_mmap_buf(struct drm_gem_object *obj, |
5188 |
+- struct vm_area_struct *vma) |
5189 |
++static int rockchip_drm_gem_object_mmap(struct drm_gem_object *obj, |
5190 |
++ struct vm_area_struct *vma) |
5191 |
++ |
5192 |
+ { |
5193 |
++ int ret; |
5194 |
+ struct rockchip_gem_object *rk_obj = to_rockchip_obj(obj); |
5195 |
+ struct drm_device *drm = obj->dev; |
5196 |
+- unsigned long vm_size; |
5197 |
+ |
5198 |
+- vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; |
5199 |
+- vm_size = vma->vm_end - vma->vm_start; |
5200 |
+- |
5201 |
+- if (vm_size > obj->size) |
5202 |
+- return -EINVAL; |
5203 |
++ /* |
5204 |
++ * dma_alloc_attrs() allocated a struct page table for rk_obj, so clear |
5205 |
++ * VM_PFNMAP flag that was set by drm_gem_mmap_obj()/drm_gem_mmap(). |
5206 |
++ */ |
5207 |
++ vma->vm_flags &= ~VM_PFNMAP; |
5208 |
+ |
5209 |
+- return dma_mmap_attrs(drm->dev, vma, rk_obj->kvaddr, rk_obj->dma_addr, |
5210 |
++ ret = dma_mmap_attrs(drm->dev, vma, rk_obj->kvaddr, rk_obj->dma_addr, |
5211 |
+ obj->size, &rk_obj->dma_attrs); |
5212 |
++ if (ret) |
5213 |
++ drm_gem_vm_close(vma); |
5214 |
++ |
5215 |
++ return ret; |
5216 |
+ } |
5217 |
+ |
5218 |
+-/* drm driver mmap file operations */ |
5219 |
+-int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma) |
5220 |
++int rockchip_gem_mmap_buf(struct drm_gem_object *obj, |
5221 |
++ struct vm_area_struct *vma) |
5222 |
+ { |
5223 |
+- struct drm_file *priv = filp->private_data; |
5224 |
+- struct drm_device *dev = priv->minor->dev; |
5225 |
+- struct drm_gem_object *obj; |
5226 |
+- struct drm_vma_offset_node *node; |
5227 |
++ struct drm_device *drm = obj->dev; |
5228 |
+ int ret; |
5229 |
+ |
5230 |
+- if (drm_device_is_unplugged(dev)) |
5231 |
+- return -ENODEV; |
5232 |
++ mutex_lock(&drm->struct_mutex); |
5233 |
++ ret = drm_gem_mmap_obj(obj, obj->size, vma); |
5234 |
++ mutex_unlock(&drm->struct_mutex); |
5235 |
++ if (ret) |
5236 |
++ return ret; |
5237 |
+ |
5238 |
+- mutex_lock(&dev->struct_mutex); |
5239 |
++ return rockchip_drm_gem_object_mmap(obj, vma); |
5240 |
++} |
5241 |
+ |
5242 |
+- node = drm_vma_offset_exact_lookup(dev->vma_offset_manager, |
5243 |
+- vma->vm_pgoff, |
5244 |
+- vma_pages(vma)); |
5245 |
+- if (!node) { |
5246 |
+- mutex_unlock(&dev->struct_mutex); |
5247 |
+- DRM_ERROR("failed to find vma node.\n"); |
5248 |
+- return -EINVAL; |
5249 |
+- } else if (!drm_vma_node_is_allowed(node, filp)) { |
5250 |
+- mutex_unlock(&dev->struct_mutex); |
5251 |
+- return -EACCES; |
5252 |
+- } |
5253 |
++/* drm driver mmap file operations */ |
5254 |
++int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma) |
5255 |
++{ |
5256 |
++ struct drm_gem_object *obj; |
5257 |
++ int ret; |
5258 |
+ |
5259 |
+- obj = container_of(node, struct drm_gem_object, vma_node); |
5260 |
+- ret = rockchip_gem_mmap_buf(obj, vma); |
5261 |
++ ret = drm_gem_mmap(filp, vma); |
5262 |
++ if (ret) |
5263 |
++ return ret; |
5264 |
+ |
5265 |
+- mutex_unlock(&dev->struct_mutex); |
5266 |
++ obj = vma->vm_private_data; |
5267 |
+ |
5268 |
+- return ret; |
5269 |
++ return rockchip_drm_gem_object_mmap(obj, vma); |
5270 |
+ } |
5271 |
+ |
5272 |
+ struct rockchip_gem_object * |
5273 |
+diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c |
5274 |
+index d6b55e3e3716..a43a836e6f88 100644 |
5275 |
+--- a/drivers/gpu/drm/tegra/dpaux.c |
5276 |
++++ b/drivers/gpu/drm/tegra/dpaux.c |
5277 |
+@@ -72,34 +72,32 @@ static inline void tegra_dpaux_writel(struct tegra_dpaux *dpaux, |
5278 |
+ static void tegra_dpaux_write_fifo(struct tegra_dpaux *dpaux, const u8 *buffer, |
5279 |
+ size_t size) |
5280 |
+ { |
5281 |
+- unsigned long offset = DPAUX_DP_AUXDATA_WRITE(0); |
5282 |
+ size_t i, j; |
5283 |
+ |
5284 |
+- for (i = 0; i < size; i += 4) { |
5285 |
+- size_t num = min_t(size_t, size - i, 4); |
5286 |
++ for (i = 0; i < DIV_ROUND_UP(size, 4); i++) { |
5287 |
++ size_t num = min_t(size_t, size - i * 4, 4); |
5288 |
+ unsigned long value = 0; |
5289 |
+ |
5290 |
+ for (j = 0; j < num; j++) |
5291 |
+- value |= buffer[i + j] << (j * 8); |
5292 |
++ value |= buffer[i * 4 + j] << (j * 8); |
5293 |
+ |
5294 |
+- tegra_dpaux_writel(dpaux, value, offset++); |
5295 |
++ tegra_dpaux_writel(dpaux, value, DPAUX_DP_AUXDATA_WRITE(i)); |
5296 |
+ } |
5297 |
+ } |
5298 |
+ |
5299 |
+ static void tegra_dpaux_read_fifo(struct tegra_dpaux *dpaux, u8 *buffer, |
5300 |
+ size_t size) |
5301 |
+ { |
5302 |
+- unsigned long offset = DPAUX_DP_AUXDATA_READ(0); |
5303 |
+ size_t i, j; |
5304 |
+ |
5305 |
+- for (i = 0; i < size; i += 4) { |
5306 |
+- size_t num = min_t(size_t, size - i, 4); |
5307 |
++ for (i = 0; i < DIV_ROUND_UP(size, 4); i++) { |
5308 |
++ size_t num = min_t(size_t, size - i * 4, 4); |
5309 |
+ unsigned long value; |
5310 |
+ |
5311 |
+- value = tegra_dpaux_readl(dpaux, offset++); |
5312 |
++ value = tegra_dpaux_readl(dpaux, DPAUX_DP_AUXDATA_READ(i)); |
5313 |
+ |
5314 |
+ for (j = 0; j < num; j++) |
5315 |
+- buffer[i + j] = value >> (j * 8); |
5316 |
++ buffer[i * 4 + j] = value >> (j * 8); |
5317 |
+ } |
5318 |
+ } |
5319 |
+ |
5320 |
+diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c |
5321 |
+index 7a207ca547be..6394547cf67a 100644 |
5322 |
+--- a/drivers/gpu/drm/vgem/vgem_drv.c |
5323 |
++++ b/drivers/gpu/drm/vgem/vgem_drv.c |
5324 |
+@@ -328,6 +328,8 @@ static int __init vgem_init(void) |
5325 |
+ goto out; |
5326 |
+ } |
5327 |
+ |
5328 |
++ drm_dev_set_unique(vgem_device, "vgem"); |
5329 |
++ |
5330 |
+ ret = drm_dev_register(vgem_device, 0); |
5331 |
+ |
5332 |
+ if (ret) |
5333 |
+diff --git a/drivers/hwmon/mcp3021.c b/drivers/hwmon/mcp3021.c |
5334 |
+index d219c06a857b..972444a14cca 100644 |
5335 |
+--- a/drivers/hwmon/mcp3021.c |
5336 |
++++ b/drivers/hwmon/mcp3021.c |
5337 |
+@@ -31,14 +31,11 @@ |
5338 |
+ /* output format */ |
5339 |
+ #define MCP3021_SAR_SHIFT 2 |
5340 |
+ #define MCP3021_SAR_MASK 0x3ff |
5341 |
+- |
5342 |
+ #define MCP3021_OUTPUT_RES 10 /* 10-bit resolution */ |
5343 |
+-#define MCP3021_OUTPUT_SCALE 4 |
5344 |
+ |
5345 |
+ #define MCP3221_SAR_SHIFT 0 |
5346 |
+ #define MCP3221_SAR_MASK 0xfff |
5347 |
+ #define MCP3221_OUTPUT_RES 12 /* 12-bit resolution */ |
5348 |
+-#define MCP3221_OUTPUT_SCALE 1 |
5349 |
+ |
5350 |
+ enum chips { |
5351 |
+ mcp3021, |
5352 |
+@@ -54,7 +51,6 @@ struct mcp3021_data { |
5353 |
+ u16 sar_shift; |
5354 |
+ u16 sar_mask; |
5355 |
+ u8 output_res; |
5356 |
+- u8 output_scale; |
5357 |
+ }; |
5358 |
+ |
5359 |
+ static int mcp3021_read16(struct i2c_client *client) |
5360 |
+@@ -84,13 +80,7 @@ static int mcp3021_read16(struct i2c_client *client) |
5361 |
+ |
5362 |
+ static inline u16 volts_from_reg(struct mcp3021_data *data, u16 val) |
5363 |
+ { |
5364 |
+- if (val == 0) |
5365 |
+- return 0; |
5366 |
+- |
5367 |
+- val = val * data->output_scale - data->output_scale / 2; |
5368 |
+- |
5369 |
+- return val * DIV_ROUND_CLOSEST(data->vdd, |
5370 |
+- (1 << data->output_res) * data->output_scale); |
5371 |
++ return DIV_ROUND_CLOSEST(data->vdd * val, 1 << data->output_res); |
5372 |
+ } |
5373 |
+ |
5374 |
+ static ssize_t show_in_input(struct device *dev, struct device_attribute *attr, |
5375 |
+@@ -132,14 +122,12 @@ static int mcp3021_probe(struct i2c_client *client, |
5376 |
+ data->sar_shift = MCP3021_SAR_SHIFT; |
5377 |
+ data->sar_mask = MCP3021_SAR_MASK; |
5378 |
+ data->output_res = MCP3021_OUTPUT_RES; |
5379 |
+- data->output_scale = MCP3021_OUTPUT_SCALE; |
5380 |
+ break; |
5381 |
+ |
5382 |
+ case mcp3221: |
5383 |
+ data->sar_shift = MCP3221_SAR_SHIFT; |
5384 |
+ data->sar_mask = MCP3221_SAR_MASK; |
5385 |
+ data->output_res = MCP3221_OUTPUT_RES; |
5386 |
+- data->output_scale = MCP3221_OUTPUT_SCALE; |
5387 |
+ break; |
5388 |
+ } |
5389 |
+ |
5390 |
+diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c |
5391 |
+index 55765790907b..28fcb2e246d5 100644 |
5392 |
+--- a/drivers/hwmon/nct7802.c |
5393 |
++++ b/drivers/hwmon/nct7802.c |
5394 |
+@@ -547,7 +547,7 @@ static umode_t nct7802_temp_is_visible(struct kobject *kobj, |
5395 |
+ if (index >= 9 && index < 18 && |
5396 |
+ (reg & 0x0c) != 0x04 && (reg & 0x0c) != 0x08) /* RD2 */ |
5397 |
+ return 0; |
5398 |
+- if (index >= 18 && index < 27 && (reg & 0x30) != 0x10) /* RD3 */ |
5399 |
++ if (index >= 18 && index < 27 && (reg & 0x30) != 0x20) /* RD3 */ |
5400 |
+ return 0; |
5401 |
+ if (index >= 27 && index < 35) /* local */ |
5402 |
+ return attr->mode; |
5403 |
+diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c |
5404 |
+index ff23d1bdd230..9bd10a9b4b50 100644 |
5405 |
+--- a/drivers/i2c/busses/i2c-at91.c |
5406 |
++++ b/drivers/i2c/busses/i2c-at91.c |
5407 |
+@@ -65,6 +65,9 @@ |
5408 |
+ #define AT91_TWI_UNRE 0x0080 /* Underrun Error */ |
5409 |
+ #define AT91_TWI_NACK 0x0100 /* Not Acknowledged */ |
5410 |
+ |
5411 |
++#define AT91_TWI_INT_MASK \ |
5412 |
++ (AT91_TWI_TXCOMP | AT91_TWI_RXRDY | AT91_TWI_TXRDY | AT91_TWI_NACK) |
5413 |
++ |
5414 |
+ #define AT91_TWI_IER 0x0024 /* Interrupt Enable Register */ |
5415 |
+ #define AT91_TWI_IDR 0x0028 /* Interrupt Disable Register */ |
5416 |
+ #define AT91_TWI_IMR 0x002c /* Interrupt Mask Register */ |
5417 |
+@@ -119,13 +122,12 @@ static void at91_twi_write(struct at91_twi_dev *dev, unsigned reg, unsigned val) |
5418 |
+ |
5419 |
+ static void at91_disable_twi_interrupts(struct at91_twi_dev *dev) |
5420 |
+ { |
5421 |
+- at91_twi_write(dev, AT91_TWI_IDR, |
5422 |
+- AT91_TWI_TXCOMP | AT91_TWI_RXRDY | AT91_TWI_TXRDY); |
5423 |
++ at91_twi_write(dev, AT91_TWI_IDR, AT91_TWI_INT_MASK); |
5424 |
+ } |
5425 |
+ |
5426 |
+ static void at91_twi_irq_save(struct at91_twi_dev *dev) |
5427 |
+ { |
5428 |
+- dev->imr = at91_twi_read(dev, AT91_TWI_IMR) & 0x7; |
5429 |
++ dev->imr = at91_twi_read(dev, AT91_TWI_IMR) & AT91_TWI_INT_MASK; |
5430 |
+ at91_disable_twi_interrupts(dev); |
5431 |
+ } |
5432 |
+ |
5433 |
+@@ -215,6 +217,14 @@ static void at91_twi_write_data_dma_callback(void *data) |
5434 |
+ dma_unmap_single(dev->dev, sg_dma_address(&dev->dma.sg), |
5435 |
+ dev->buf_len, DMA_TO_DEVICE); |
5436 |
+ |
5437 |
++ /* |
5438 |
++ * When this callback is called, THR/TX FIFO is likely not to be empty |
5439 |
++ * yet. So we have to wait for TXCOMP or NACK bits to be set into the |
5440 |
++ * Status Register to be sure that the STOP bit has been sent and the |
5441 |
++ * transfer is completed. The NACK interrupt has already been enabled, |
5442 |
++ * we just have to enable TXCOMP one. |
5443 |
++ */ |
5444 |
++ at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_TXCOMP); |
5445 |
+ at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_STOP); |
5446 |
+ } |
5447 |
+ |
5448 |
+@@ -309,7 +319,7 @@ static void at91_twi_read_data_dma_callback(void *data) |
5449 |
+ /* The last two bytes have to be read without using dma */ |
5450 |
+ dev->buf += dev->buf_len - 2; |
5451 |
+ dev->buf_len = 2; |
5452 |
+- at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_RXRDY); |
5453 |
++ at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_RXRDY | AT91_TWI_TXCOMP); |
5454 |
+ } |
5455 |
+ |
5456 |
+ static void at91_twi_read_data_dma(struct at91_twi_dev *dev) |
5457 |
+@@ -370,7 +380,7 @@ static irqreturn_t atmel_twi_interrupt(int irq, void *dev_id) |
5458 |
+ /* catch error flags */ |
5459 |
+ dev->transfer_status |= status; |
5460 |
+ |
5461 |
+- if (irqstatus & AT91_TWI_TXCOMP) { |
5462 |
++ if (irqstatus & (AT91_TWI_TXCOMP | AT91_TWI_NACK)) { |
5463 |
+ at91_disable_twi_interrupts(dev); |
5464 |
+ complete(&dev->cmd_complete); |
5465 |
+ } |
5466 |
+@@ -384,6 +394,34 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) |
5467 |
+ unsigned long time_left; |
5468 |
+ bool has_unre_flag = dev->pdata->has_unre_flag; |
5469 |
+ |
5470 |
++ /* |
5471 |
++ * WARNING: the TXCOMP bit in the Status Register is NOT a clear on |
5472 |
++ * read flag but shows the state of the transmission at the time the |
5473 |
++ * Status Register is read. According to the programmer datasheet, |
5474 |
++ * TXCOMP is set when both holding register and internal shifter are |
5475 |
++ * empty and STOP condition has been sent. |
5476 |
++ * Consequently, we should enable NACK interrupt rather than TXCOMP to |
5477 |
++ * detect transmission failure. |
5478 |
++ * |
5479 |
++ * Besides, the TXCOMP bit is already set before the i2c transaction |
5480 |
++ * has been started. For read transactions, this bit is cleared when |
5481 |
++ * writing the START bit into the Control Register. So the |
5482 |
++ * corresponding interrupt can safely be enabled just after. |
5483 |
++ * However for write transactions managed by the CPU, we first write |
5484 |
++ * into THR, so TXCOMP is cleared. Then we can safely enable TXCOMP |
5485 |
++ * interrupt. If TXCOMP interrupt were enabled before writing into THR, |
5486 |
++ * the interrupt handler would be called immediately and the i2c command |
5487 |
++ * would be reported as completed. |
5488 |
++ * Also when a write transaction is managed by the DMA controller, |
5489 |
++ * enabling the TXCOMP interrupt in this function may lead to a race |
5490 |
++ * condition since we don't know whether the TXCOMP interrupt is enabled |
5491 |
++ * before or after the DMA has started to write into THR. So the TXCOMP |
5492 |
++ * interrupt is enabled later by at91_twi_write_data_dma_callback(). |
5493 |
++ * Immediately after in that DMA callback, we still need to send the |
5494 |
++ * STOP condition manually writing the corresponding bit into the |
5495 |
++ * Control Register. |
5496 |
++ */ |
5497 |
++ |
5498 |
+ dev_dbg(dev->dev, "transfer: %s %d bytes.\n", |
5499 |
+ (dev->msg->flags & I2C_M_RD) ? "read" : "write", dev->buf_len); |
5500 |
+ |
5501 |
+@@ -414,26 +452,24 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) |
5502 |
+ * seems to be the best solution. |
5503 |
+ */ |
5504 |
+ if (dev->use_dma && (dev->buf_len > AT91_I2C_DMA_THRESHOLD)) { |
5505 |
++ at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_NACK); |
5506 |
+ at91_twi_read_data_dma(dev); |
5507 |
+- /* |
5508 |
+- * It is important to enable TXCOMP irq here because |
5509 |
+- * doing it only when transferring the last two bytes |
5510 |
+- * will mask NACK errors since TXCOMP is set when a |
5511 |
+- * NACK occurs. |
5512 |
+- */ |
5513 |
+- at91_twi_write(dev, AT91_TWI_IER, |
5514 |
+- AT91_TWI_TXCOMP); |
5515 |
+- } else |
5516 |
++ } else { |
5517 |
+ at91_twi_write(dev, AT91_TWI_IER, |
5518 |
+- AT91_TWI_TXCOMP | AT91_TWI_RXRDY); |
5519 |
++ AT91_TWI_TXCOMP | |
5520 |
++ AT91_TWI_NACK | |
5521 |
++ AT91_TWI_RXRDY); |
5522 |
++ } |
5523 |
+ } else { |
5524 |
+ if (dev->use_dma && (dev->buf_len > AT91_I2C_DMA_THRESHOLD)) { |
5525 |
++ at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_NACK); |
5526 |
+ at91_twi_write_data_dma(dev); |
5527 |
+- at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_TXCOMP); |
5528 |
+ } else { |
5529 |
+ at91_twi_write_next_byte(dev); |
5530 |
+ at91_twi_write(dev, AT91_TWI_IER, |
5531 |
+- AT91_TWI_TXCOMP | AT91_TWI_TXRDY); |
5532 |
++ AT91_TWI_TXCOMP | |
5533 |
++ AT91_TWI_NACK | |
5534 |
++ AT91_TWI_TXRDY); |
5535 |
+ } |
5536 |
+ } |
5537 |
+ |
5538 |
+diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c |
5539 |
+index 06cc1ff088f1..2ba7c0fbc615 100644 |
5540 |
+--- a/drivers/i2c/i2c-mux.c |
5541 |
++++ b/drivers/i2c/i2c-mux.c |
5542 |
+@@ -51,7 +51,7 @@ static int i2c_mux_master_xfer(struct i2c_adapter *adap, |
5543 |
+ |
5544 |
+ ret = priv->select(parent, priv->mux_priv, priv->chan_id); |
5545 |
+ if (ret >= 0) |
5546 |
+- ret = parent->algo->master_xfer(parent, msgs, num); |
5547 |
++ ret = __i2c_transfer(parent, msgs, num); |
5548 |
+ if (priv->deselect) |
5549 |
+ priv->deselect(parent, priv->mux_priv, priv->chan_id); |
5550 |
+ |
5551 |
+@@ -144,6 +144,7 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, |
5552 |
+ priv->adap.dev.parent = &parent->dev; |
5553 |
+ priv->adap.retries = parent->retries; |
5554 |
+ priv->adap.timeout = parent->timeout; |
5555 |
++ priv->adap.quirks = parent->quirks; |
5556 |
+ |
5557 |
+ /* Sanity check on class */ |
5558 |
+ if (i2c_mux_parent_classes(parent) & class) |
5559 |
+diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c |
5560 |
+index cb772775da43..0c8d4d2cbdaf 100644 |
5561 |
+--- a/drivers/i2c/muxes/i2c-mux-pca9541.c |
5562 |
++++ b/drivers/i2c/muxes/i2c-mux-pca9541.c |
5563 |
+@@ -104,7 +104,7 @@ static int pca9541_reg_write(struct i2c_client *client, u8 command, u8 val) |
5564 |
+ buf[0] = command; |
5565 |
+ buf[1] = val; |
5566 |
+ msg.buf = buf; |
5567 |
+- ret = adap->algo->master_xfer(adap, &msg, 1); |
5568 |
++ ret = __i2c_transfer(adap, &msg, 1); |
5569 |
+ } else { |
5570 |
+ union i2c_smbus_data data; |
5571 |
+ |
5572 |
+@@ -144,7 +144,7 @@ static int pca9541_reg_read(struct i2c_client *client, u8 command) |
5573 |
+ .buf = &val |
5574 |
+ } |
5575 |
+ }; |
5576 |
+- ret = adap->algo->master_xfer(adap, msg, 2); |
5577 |
++ ret = __i2c_transfer(adap, msg, 2); |
5578 |
+ if (ret == 2) |
5579 |
+ ret = val; |
5580 |
+ else if (ret >= 0) |
5581 |
+diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c |
5582 |
+index bea0d2de2993..ea4aa9dfcea9 100644 |
5583 |
+--- a/drivers/i2c/muxes/i2c-mux-pca954x.c |
5584 |
++++ b/drivers/i2c/muxes/i2c-mux-pca954x.c |
5585 |
+@@ -134,7 +134,7 @@ static int pca954x_reg_write(struct i2c_adapter *adap, |
5586 |
+ msg.len = 1; |
5587 |
+ buf[0] = val; |
5588 |
+ msg.buf = buf; |
5589 |
+- ret = adap->algo->master_xfer(adap, &msg, 1); |
5590 |
++ ret = __i2c_transfer(adap, &msg, 1); |
5591 |
+ } else { |
5592 |
+ union i2c_smbus_data data; |
5593 |
+ ret = adap->algo->smbus_xfer(adap, client->addr, |
5594 |
+diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c |
5595 |
+index 73e87739d219..bf827d012a71 100644 |
5596 |
+--- a/drivers/iio/accel/bmc150-accel.c |
5597 |
++++ b/drivers/iio/accel/bmc150-accel.c |
5598 |
+@@ -1465,7 +1465,7 @@ static void bmc150_accel_unregister_triggers(struct bmc150_accel_data *data, |
5599 |
+ { |
5600 |
+ int i; |
5601 |
+ |
5602 |
+- for (i = from; i >= 0; i++) { |
5603 |
++ for (i = from; i >= 0; i--) { |
5604 |
+ if (data->triggers[i].indio_trig) { |
5605 |
+ iio_trigger_unregister(data->triggers[i].indio_trig); |
5606 |
+ data->triggers[i].indio_trig = NULL; |
5607 |
+diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig |
5608 |
+index e36a73e7c3a8..1bcb65b8d4a1 100644 |
5609 |
+--- a/drivers/iio/adc/Kconfig |
5610 |
++++ b/drivers/iio/adc/Kconfig |
5611 |
+@@ -146,8 +146,7 @@ config DA9150_GPADC |
5612 |
+ |
5613 |
+ config CC10001_ADC |
5614 |
+ tristate "Cosmic Circuits 10001 ADC driver" |
5615 |
+- depends on HAVE_CLK || REGULATOR |
5616 |
+- depends on HAS_IOMEM |
5617 |
++ depends on HAS_IOMEM && HAVE_CLK && REGULATOR |
5618 |
+ select IIO_BUFFER |
5619 |
+ select IIO_TRIGGERED_BUFFER |
5620 |
+ help |
5621 |
+diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c |
5622 |
+index 8a0eb4a04fb5..7b40925dd4ff 100644 |
5623 |
+--- a/drivers/iio/adc/at91_adc.c |
5624 |
++++ b/drivers/iio/adc/at91_adc.c |
5625 |
+@@ -182,7 +182,7 @@ struct at91_adc_caps { |
5626 |
+ u8 ts_pen_detect_sensitivity; |
5627 |
+ |
5628 |
+ /* startup time calculate function */ |
5629 |
+- u32 (*calc_startup_ticks)(u8 startup_time, u32 adc_clk_khz); |
5630 |
++ u32 (*calc_startup_ticks)(u32 startup_time, u32 adc_clk_khz); |
5631 |
+ |
5632 |
+ u8 num_channels; |
5633 |
+ struct at91_adc_reg_desc registers; |
5634 |
+@@ -201,7 +201,7 @@ struct at91_adc_state { |
5635 |
+ u8 num_channels; |
5636 |
+ void __iomem *reg_base; |
5637 |
+ struct at91_adc_reg_desc *registers; |
5638 |
+- u8 startup_time; |
5639 |
++ u32 startup_time; |
5640 |
+ u8 sample_hold_time; |
5641 |
+ bool sleep_mode; |
5642 |
+ struct iio_trigger **trig; |
5643 |
+@@ -779,7 +779,7 @@ ret: |
5644 |
+ return ret; |
5645 |
+ } |
5646 |
+ |
5647 |
+-static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz) |
5648 |
++static u32 calc_startup_ticks_9260(u32 startup_time, u32 adc_clk_khz) |
5649 |
+ { |
5650 |
+ /* |
5651 |
+ * Number of ticks needed to cover the startup time of the ADC |
5652 |
+@@ -790,7 +790,7 @@ static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz) |
5653 |
+ return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8; |
5654 |
+ } |
5655 |
+ |
5656 |
+-static u32 calc_startup_ticks_9x5(u8 startup_time, u32 adc_clk_khz) |
5657 |
++static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz) |
5658 |
+ { |
5659 |
+ /* |
5660 |
+ * For sama5d3x and at91sam9x5, the formula changes to: |
5661 |
+diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c |
5662 |
+index 8d4e019ea4ca..9c311c1e1ac7 100644 |
5663 |
+--- a/drivers/iio/adc/rockchip_saradc.c |
5664 |
++++ b/drivers/iio/adc/rockchip_saradc.c |
5665 |
+@@ -349,3 +349,7 @@ static struct platform_driver rockchip_saradc_driver = { |
5666 |
+ }; |
5667 |
+ |
5668 |
+ module_platform_driver(rockchip_saradc_driver); |
5669 |
++ |
5670 |
++MODULE_AUTHOR("Heiko Stuebner <heiko@××××××.de>"); |
5671 |
++MODULE_DESCRIPTION("Rockchip SARADC driver"); |
5672 |
++MODULE_LICENSE("GPL v2"); |
5673 |
+diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c |
5674 |
+index 94c5f05b4bc1..4caecbea4c97 100644 |
5675 |
+--- a/drivers/iio/adc/twl4030-madc.c |
5676 |
++++ b/drivers/iio/adc/twl4030-madc.c |
5677 |
+@@ -835,7 +835,8 @@ static int twl4030_madc_probe(struct platform_device *pdev) |
5678 |
+ irq = platform_get_irq(pdev, 0); |
5679 |
+ ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, |
5680 |
+ twl4030_madc_threaded_irq_handler, |
5681 |
+- IRQF_TRIGGER_RISING, "twl4030_madc", madc); |
5682 |
++ IRQF_TRIGGER_RISING | IRQF_ONESHOT, |
5683 |
++ "twl4030_madc", madc); |
5684 |
+ if (ret) { |
5685 |
+ dev_err(&pdev->dev, "could not request irq\n"); |
5686 |
+ goto err_i2c; |
5687 |
+diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c |
5688 |
+index 610fc98f88ef..595511022795 100644 |
5689 |
+--- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c |
5690 |
++++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c |
5691 |
+@@ -36,6 +36,8 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state) |
5692 |
+ s32 poll_value = 0; |
5693 |
+ |
5694 |
+ if (state) { |
5695 |
++ if (!atomic_read(&st->user_requested_state)) |
5696 |
++ return 0; |
5697 |
+ if (sensor_hub_device_open(st->hsdev)) |
5698 |
+ return -EIO; |
5699 |
+ |
5700 |
+@@ -52,8 +54,12 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state) |
5701 |
+ |
5702 |
+ poll_value = hid_sensor_read_poll_value(st); |
5703 |
+ } else { |
5704 |
+- if (!atomic_dec_and_test(&st->data_ready)) |
5705 |
++ int val; |
5706 |
++ |
5707 |
++ val = atomic_dec_if_positive(&st->data_ready); |
5708 |
++ if (val < 0) |
5709 |
+ return 0; |
5710 |
++ |
5711 |
+ sensor_hub_device_close(st->hsdev); |
5712 |
+ state_val = hid_sensor_get_usage_index(st->hsdev, |
5713 |
+ st->power_state.report_id, |
5714 |
+@@ -92,9 +98,11 @@ EXPORT_SYMBOL(hid_sensor_power_state); |
5715 |
+ |
5716 |
+ int hid_sensor_power_state(struct hid_sensor_common *st, bool state) |
5717 |
+ { |
5718 |
++ |
5719 |
+ #ifdef CONFIG_PM |
5720 |
+ int ret; |
5721 |
+ |
5722 |
++ atomic_set(&st->user_requested_state, state); |
5723 |
+ if (state) |
5724 |
+ ret = pm_runtime_get_sync(&st->pdev->dev); |
5725 |
+ else { |
5726 |
+@@ -109,6 +117,7 @@ int hid_sensor_power_state(struct hid_sensor_common *st, bool state) |
5727 |
+ |
5728 |
+ return 0; |
5729 |
+ #else |
5730 |
++ atomic_set(&st->user_requested_state, state); |
5731 |
+ return _hid_sensor_power_state(st, state); |
5732 |
+ #endif |
5733 |
+ } |
5734 |
+diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c |
5735 |
+index 61bb9d4239ea..e98428df0d44 100644 |
5736 |
+--- a/drivers/iio/dac/ad5624r_spi.c |
5737 |
++++ b/drivers/iio/dac/ad5624r_spi.c |
5738 |
+@@ -22,7 +22,7 @@ |
5739 |
+ #include "ad5624r.h" |
5740 |
+ |
5741 |
+ static int ad5624r_spi_write(struct spi_device *spi, |
5742 |
+- u8 cmd, u8 addr, u16 val, u8 len) |
5743 |
++ u8 cmd, u8 addr, u16 val, u8 shift) |
5744 |
+ { |
5745 |
+ u32 data; |
5746 |
+ u8 msg[3]; |
5747 |
+@@ -35,7 +35,7 @@ static int ad5624r_spi_write(struct spi_device *spi, |
5748 |
+ * 14-, 12-bit input code followed by 0, 2, or 4 don't care bits, |
5749 |
+ * for the AD5664R, AD5644R, and AD5624R, respectively. |
5750 |
+ */ |
5751 |
+- data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << (16 - len)); |
5752 |
++ data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << shift); |
5753 |
+ msg[0] = data >> 16; |
5754 |
+ msg[1] = data >> 8; |
5755 |
+ msg[2] = data; |
5756 |
+diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c |
5757 |
+index 17d4bb15be4d..65ce86837177 100644 |
5758 |
+--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c |
5759 |
++++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c |
5760 |
+@@ -431,6 +431,23 @@ static int inv_mpu6050_write_gyro_scale(struct inv_mpu6050_state *st, int val) |
5761 |
+ return -EINVAL; |
5762 |
+ } |
5763 |
+ |
5764 |
++static int inv_write_raw_get_fmt(struct iio_dev *indio_dev, |
5765 |
++ struct iio_chan_spec const *chan, long mask) |
5766 |
++{ |
5767 |
++ switch (mask) { |
5768 |
++ case IIO_CHAN_INFO_SCALE: |
5769 |
++ switch (chan->type) { |
5770 |
++ case IIO_ANGL_VEL: |
5771 |
++ return IIO_VAL_INT_PLUS_NANO; |
5772 |
++ default: |
5773 |
++ return IIO_VAL_INT_PLUS_MICRO; |
5774 |
++ } |
5775 |
++ default: |
5776 |
++ return IIO_VAL_INT_PLUS_MICRO; |
5777 |
++ } |
5778 |
++ |
5779 |
++ return -EINVAL; |
5780 |
++} |
5781 |
+ static int inv_mpu6050_write_accel_scale(struct inv_mpu6050_state *st, int val) |
5782 |
+ { |
5783 |
+ int result, i; |
5784 |
+@@ -696,6 +713,7 @@ static const struct iio_info mpu_info = { |
5785 |
+ .driver_module = THIS_MODULE, |
5786 |
+ .read_raw = &inv_mpu6050_read_raw, |
5787 |
+ .write_raw = &inv_mpu6050_write_raw, |
5788 |
++ .write_raw_get_fmt = &inv_write_raw_get_fmt, |
5789 |
+ .attrs = &inv_attribute_group, |
5790 |
+ .validate_trigger = inv_mpu6050_validate_trigger, |
5791 |
+ }; |
5792 |
+diff --git a/drivers/iio/light/cm3323.c b/drivers/iio/light/cm3323.c |
5793 |
+index 869033e48a1f..a1d4905cc9d2 100644 |
5794 |
+--- a/drivers/iio/light/cm3323.c |
5795 |
++++ b/drivers/iio/light/cm3323.c |
5796 |
+@@ -123,7 +123,7 @@ static int cm3323_set_it_bits(struct cm3323_data *data, int val, int val2) |
5797 |
+ for (i = 0; i < ARRAY_SIZE(cm3323_int_time); i++) { |
5798 |
+ if (val == cm3323_int_time[i].val && |
5799 |
+ val2 == cm3323_int_time[i].val2) { |
5800 |
+- reg_conf = data->reg_conf; |
5801 |
++ reg_conf = data->reg_conf & ~CM3323_CONF_IT_MASK; |
5802 |
+ reg_conf |= i << CM3323_CONF_IT_SHIFT; |
5803 |
+ |
5804 |
+ ret = i2c_smbus_write_word_data(data->client, |
5805 |
+diff --git a/drivers/iio/light/tcs3414.c b/drivers/iio/light/tcs3414.c |
5806 |
+index 71c2bde275aa..f8b1df018abe 100644 |
5807 |
+--- a/drivers/iio/light/tcs3414.c |
5808 |
++++ b/drivers/iio/light/tcs3414.c |
5809 |
+@@ -185,7 +185,7 @@ static int tcs3414_write_raw(struct iio_dev *indio_dev, |
5810 |
+ if (val != 0) |
5811 |
+ return -EINVAL; |
5812 |
+ for (i = 0; i < ARRAY_SIZE(tcs3414_times); i++) { |
5813 |
+- if (val == tcs3414_times[i] * 1000) { |
5814 |
++ if (val2 == tcs3414_times[i] * 1000) { |
5815 |
+ data->timing &= ~TCS3414_INTEG_MASK; |
5816 |
+ data->timing |= i; |
5817 |
+ return i2c_smbus_write_byte_data( |
5818 |
+diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c |
5819 |
+index fa40f6d0ca39..bd26a484abcc 100644 |
5820 |
+--- a/drivers/iio/proximity/sx9500.c |
5821 |
++++ b/drivers/iio/proximity/sx9500.c |
5822 |
+@@ -206,7 +206,7 @@ static int sx9500_read_proximity(struct sx9500_data *data, |
5823 |
+ if (ret < 0) |
5824 |
+ return ret; |
5825 |
+ |
5826 |
+- *val = 32767 - (s16)be16_to_cpu(regval); |
5827 |
++ *val = be16_to_cpu(regval); |
5828 |
+ |
5829 |
+ return IIO_VAL_INT; |
5830 |
+ } |
5831 |
+diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c |
5832 |
+index 84a0789c3d96..7a8050996b4e 100644 |
5833 |
+--- a/drivers/iio/temperature/tmp006.c |
5834 |
++++ b/drivers/iio/temperature/tmp006.c |
5835 |
+@@ -132,6 +132,9 @@ static int tmp006_write_raw(struct iio_dev *indio_dev, |
5836 |
+ struct tmp006_data *data = iio_priv(indio_dev); |
5837 |
+ int i; |
5838 |
+ |
5839 |
++ if (mask != IIO_CHAN_INFO_SAMP_FREQ) |
5840 |
++ return -EINVAL; |
5841 |
++ |
5842 |
+ for (i = 0; i < ARRAY_SIZE(tmp006_freqs); i++) |
5843 |
+ if ((val == tmp006_freqs[i][0]) && |
5844 |
+ (val2 == tmp006_freqs[i][1])) { |
5845 |
+diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c |
5846 |
+index 9dcb66077d6c..219f2122f9b9 100644 |
5847 |
+--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c |
5848 |
++++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c |
5849 |
+@@ -679,7 +679,6 @@ err: |
5850 |
+ ocrdma_release_ucontext_pd(uctx); |
5851 |
+ } else { |
5852 |
+ status = _ocrdma_dealloc_pd(dev, pd); |
5853 |
+- kfree(pd); |
5854 |
+ } |
5855 |
+ exit: |
5856 |
+ return ERR_PTR(status); |
5857 |
+diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c |
5858 |
+index 135a0907e9de..c90118e90708 100644 |
5859 |
+--- a/drivers/md/bitmap.c |
5860 |
++++ b/drivers/md/bitmap.c |
5861 |
+@@ -494,7 +494,7 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap) |
5862 |
+ bitmap_super_t *sb; |
5863 |
+ unsigned long chunksize, daemon_sleep, write_behind; |
5864 |
+ |
5865 |
+- bitmap->storage.sb_page = alloc_page(GFP_KERNEL); |
5866 |
++ bitmap->storage.sb_page = alloc_page(GFP_KERNEL | __GFP_ZERO); |
5867 |
+ if (bitmap->storage.sb_page == NULL) |
5868 |
+ return -ENOMEM; |
5869 |
+ bitmap->storage.sb_page->index = 0; |
5870 |
+@@ -541,6 +541,7 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap) |
5871 |
+ sb->state = cpu_to_le32(bitmap->flags); |
5872 |
+ bitmap->events_cleared = bitmap->mddev->events; |
5873 |
+ sb->events_cleared = cpu_to_le64(bitmap->mddev->events); |
5874 |
++ bitmap->mddev->bitmap_info.nodes = 0; |
5875 |
+ |
5876 |
+ kunmap_atomic(sb); |
5877 |
+ |
5878 |
+@@ -611,8 +612,16 @@ re_read: |
5879 |
+ daemon_sleep = le32_to_cpu(sb->daemon_sleep) * HZ; |
5880 |
+ write_behind = le32_to_cpu(sb->write_behind); |
5881 |
+ sectors_reserved = le32_to_cpu(sb->sectors_reserved); |
5882 |
+- nodes = le32_to_cpu(sb->nodes); |
5883 |
+- strlcpy(bitmap->mddev->bitmap_info.cluster_name, sb->cluster_name, 64); |
5884 |
++ /* XXX: This is a hack to ensure that we don't use clustering |
5885 |
++ * in case: |
5886 |
++ * - dm-raid is in use and |
5887 |
++ * - the nodes written in bitmap_sb is erroneous. |
5888 |
++ */ |
5889 |
++ if (!bitmap->mddev->sync_super) { |
5890 |
++ nodes = le32_to_cpu(sb->nodes); |
5891 |
++ strlcpy(bitmap->mddev->bitmap_info.cluster_name, |
5892 |
++ sb->cluster_name, 64); |
5893 |
++ } |
5894 |
+ |
5895 |
+ /* verify that the bitmap-specific fields are valid */ |
5896 |
+ if (sb->magic != cpu_to_le32(BITMAP_MAGIC)) |
5897 |
+diff --git a/drivers/md/dm-cache-policy-cleaner.c b/drivers/md/dm-cache-policy-cleaner.c |
5898 |
+index b04d1f904d07..004e463c9423 100644 |
5899 |
+--- a/drivers/md/dm-cache-policy-cleaner.c |
5900 |
++++ b/drivers/md/dm-cache-policy-cleaner.c |
5901 |
+@@ -171,7 +171,8 @@ static void remove_cache_hash_entry(struct wb_cache_entry *e) |
5902 |
+ /* Public interface (see dm-cache-policy.h */ |
5903 |
+ static int wb_map(struct dm_cache_policy *pe, dm_oblock_t oblock, |
5904 |
+ bool can_block, bool can_migrate, bool discarded_oblock, |
5905 |
+- struct bio *bio, struct policy_result *result) |
5906 |
++ struct bio *bio, struct policy_locker *locker, |
5907 |
++ struct policy_result *result) |
5908 |
+ { |
5909 |
+ struct policy *p = to_policy(pe); |
5910 |
+ struct wb_cache_entry *e; |
5911 |
+diff --git a/drivers/md/dm-cache-policy-internal.h b/drivers/md/dm-cache-policy-internal.h |
5912 |
+index 2256a1f24f73..c198e6defb9c 100644 |
5913 |
+--- a/drivers/md/dm-cache-policy-internal.h |
5914 |
++++ b/drivers/md/dm-cache-policy-internal.h |
5915 |
+@@ -16,9 +16,10 @@ |
5916 |
+ */ |
5917 |
+ static inline int policy_map(struct dm_cache_policy *p, dm_oblock_t oblock, |
5918 |
+ bool can_block, bool can_migrate, bool discarded_oblock, |
5919 |
+- struct bio *bio, struct policy_result *result) |
5920 |
++ struct bio *bio, struct policy_locker *locker, |
5921 |
++ struct policy_result *result) |
5922 |
+ { |
5923 |
+- return p->map(p, oblock, can_block, can_migrate, discarded_oblock, bio, result); |
5924 |
++ return p->map(p, oblock, can_block, can_migrate, discarded_oblock, bio, locker, result); |
5925 |
+ } |
5926 |
+ |
5927 |
+ static inline int policy_lookup(struct dm_cache_policy *p, dm_oblock_t oblock, dm_cblock_t *cblock) |
5928 |
+diff --git a/drivers/md/dm-cache-policy-mq.c b/drivers/md/dm-cache-policy-mq.c |
5929 |
+index 3ddd1162334d..515d44bf24d3 100644 |
5930 |
+--- a/drivers/md/dm-cache-policy-mq.c |
5931 |
++++ b/drivers/md/dm-cache-policy-mq.c |
5932 |
+@@ -693,9 +693,10 @@ static void requeue(struct mq_policy *mq, struct entry *e) |
5933 |
+ * - set the hit count to a hard coded value other than 1, eg, is it better |
5934 |
+ * if it goes in at level 2? |
5935 |
+ */ |
5936 |
+-static int demote_cblock(struct mq_policy *mq, dm_oblock_t *oblock) |
5937 |
++static int demote_cblock(struct mq_policy *mq, |
5938 |
++ struct policy_locker *locker, dm_oblock_t *oblock) |
5939 |
+ { |
5940 |
+- struct entry *demoted = pop(mq, &mq->cache_clean); |
5941 |
++ struct entry *demoted = peek(&mq->cache_clean); |
5942 |
+ |
5943 |
+ if (!demoted) |
5944 |
+ /* |
5945 |
+@@ -707,6 +708,13 @@ static int demote_cblock(struct mq_policy *mq, dm_oblock_t *oblock) |
5946 |
+ */ |
5947 |
+ return -ENOSPC; |
5948 |
+ |
5949 |
++ if (locker->fn(locker, demoted->oblock)) |
5950 |
++ /* |
5951 |
++ * We couldn't lock the demoted block. |
5952 |
++ */ |
5953 |
++ return -EBUSY; |
5954 |
++ |
5955 |
++ del(mq, demoted); |
5956 |
+ *oblock = demoted->oblock; |
5957 |
+ free_entry(&mq->cache_pool, demoted); |
5958 |
+ |
5959 |
+@@ -795,6 +803,7 @@ static int cache_entry_found(struct mq_policy *mq, |
5960 |
+ * finding which cache block to use. |
5961 |
+ */ |
5962 |
+ static int pre_cache_to_cache(struct mq_policy *mq, struct entry *e, |
5963 |
++ struct policy_locker *locker, |
5964 |
+ struct policy_result *result) |
5965 |
+ { |
5966 |
+ int r; |
5967 |
+@@ -803,11 +812,12 @@ static int pre_cache_to_cache(struct mq_policy *mq, struct entry *e, |
5968 |
+ /* Ensure there's a free cblock in the cache */ |
5969 |
+ if (epool_empty(&mq->cache_pool)) { |
5970 |
+ result->op = POLICY_REPLACE; |
5971 |
+- r = demote_cblock(mq, &result->old_oblock); |
5972 |
++ r = demote_cblock(mq, locker, &result->old_oblock); |
5973 |
+ if (r) { |
5974 |
+ result->op = POLICY_MISS; |
5975 |
+ return 0; |
5976 |
+ } |
5977 |
++ |
5978 |
+ } else |
5979 |
+ result->op = POLICY_NEW; |
5980 |
+ |
5981 |
+@@ -829,7 +839,8 @@ static int pre_cache_to_cache(struct mq_policy *mq, struct entry *e, |
5982 |
+ |
5983 |
+ static int pre_cache_entry_found(struct mq_policy *mq, struct entry *e, |
5984 |
+ bool can_migrate, bool discarded_oblock, |
5985 |
+- int data_dir, struct policy_result *result) |
5986 |
++ int data_dir, struct policy_locker *locker, |
5987 |
++ struct policy_result *result) |
5988 |
+ { |
5989 |
+ int r = 0; |
5990 |
+ |
5991 |
+@@ -842,7 +853,7 @@ static int pre_cache_entry_found(struct mq_policy *mq, struct entry *e, |
5992 |
+ |
5993 |
+ else { |
5994 |
+ requeue(mq, e); |
5995 |
+- r = pre_cache_to_cache(mq, e, result); |
5996 |
++ r = pre_cache_to_cache(mq, e, locker, result); |
5997 |
+ } |
5998 |
+ |
5999 |
+ return r; |
6000 |
+@@ -872,6 +883,7 @@ static void insert_in_pre_cache(struct mq_policy *mq, |
6001 |
+ } |
6002 |
+ |
6003 |
+ static void insert_in_cache(struct mq_policy *mq, dm_oblock_t oblock, |
6004 |
++ struct policy_locker *locker, |
6005 |
+ struct policy_result *result) |
6006 |
+ { |
6007 |
+ int r; |
6008 |
+@@ -879,7 +891,7 @@ static void insert_in_cache(struct mq_policy *mq, dm_oblock_t oblock, |
6009 |
+ |
6010 |
+ if (epool_empty(&mq->cache_pool)) { |
6011 |
+ result->op = POLICY_REPLACE; |
6012 |
+- r = demote_cblock(mq, &result->old_oblock); |
6013 |
++ r = demote_cblock(mq, locker, &result->old_oblock); |
6014 |
+ if (unlikely(r)) { |
6015 |
+ result->op = POLICY_MISS; |
6016 |
+ insert_in_pre_cache(mq, oblock); |
6017 |
+@@ -907,11 +919,12 @@ static void insert_in_cache(struct mq_policy *mq, dm_oblock_t oblock, |
6018 |
+ |
6019 |
+ static int no_entry_found(struct mq_policy *mq, dm_oblock_t oblock, |
6020 |
+ bool can_migrate, bool discarded_oblock, |
6021 |
+- int data_dir, struct policy_result *result) |
6022 |
++ int data_dir, struct policy_locker *locker, |
6023 |
++ struct policy_result *result) |
6024 |
+ { |
6025 |
+ if (adjusted_promote_threshold(mq, discarded_oblock, data_dir) <= 1) { |
6026 |
+ if (can_migrate) |
6027 |
+- insert_in_cache(mq, oblock, result); |
6028 |
++ insert_in_cache(mq, oblock, locker, result); |
6029 |
+ else |
6030 |
+ return -EWOULDBLOCK; |
6031 |
+ } else { |
6032 |
+@@ -928,7 +941,8 @@ static int no_entry_found(struct mq_policy *mq, dm_oblock_t oblock, |
6033 |
+ */ |
6034 |
+ static int map(struct mq_policy *mq, dm_oblock_t oblock, |
6035 |
+ bool can_migrate, bool discarded_oblock, |
6036 |
+- int data_dir, struct policy_result *result) |
6037 |
++ int data_dir, struct policy_locker *locker, |
6038 |
++ struct policy_result *result) |
6039 |
+ { |
6040 |
+ int r = 0; |
6041 |
+ struct entry *e = hash_lookup(mq, oblock); |
6042 |
+@@ -942,11 +956,11 @@ static int map(struct mq_policy *mq, dm_oblock_t oblock, |
6043 |
+ |
6044 |
+ else if (e) |
6045 |
+ r = pre_cache_entry_found(mq, e, can_migrate, discarded_oblock, |
6046 |
+- data_dir, result); |
6047 |
++ data_dir, locker, result); |
6048 |
+ |
6049 |
+ else |
6050 |
+ r = no_entry_found(mq, oblock, can_migrate, discarded_oblock, |
6051 |
+- data_dir, result); |
6052 |
++ data_dir, locker, result); |
6053 |
+ |
6054 |
+ if (r == -EWOULDBLOCK) |
6055 |
+ result->op = POLICY_MISS; |
6056 |
+@@ -1012,7 +1026,8 @@ static void copy_tick(struct mq_policy *mq) |
6057 |
+ |
6058 |
+ static int mq_map(struct dm_cache_policy *p, dm_oblock_t oblock, |
6059 |
+ bool can_block, bool can_migrate, bool discarded_oblock, |
6060 |
+- struct bio *bio, struct policy_result *result) |
6061 |
++ struct bio *bio, struct policy_locker *locker, |
6062 |
++ struct policy_result *result) |
6063 |
+ { |
6064 |
+ int r; |
6065 |
+ struct mq_policy *mq = to_mq_policy(p); |
6066 |
+@@ -1028,7 +1043,7 @@ static int mq_map(struct dm_cache_policy *p, dm_oblock_t oblock, |
6067 |
+ |
6068 |
+ iot_examine_bio(&mq->tracker, bio); |
6069 |
+ r = map(mq, oblock, can_migrate, discarded_oblock, |
6070 |
+- bio_data_dir(bio), result); |
6071 |
++ bio_data_dir(bio), locker, result); |
6072 |
+ |
6073 |
+ mutex_unlock(&mq->lock); |
6074 |
+ |
6075 |
+diff --git a/drivers/md/dm-cache-policy.h b/drivers/md/dm-cache-policy.h |
6076 |
+index f50fe360c546..5524e21e4836 100644 |
6077 |
+--- a/drivers/md/dm-cache-policy.h |
6078 |
++++ b/drivers/md/dm-cache-policy.h |
6079 |
+@@ -70,6 +70,18 @@ enum policy_operation { |
6080 |
+ }; |
6081 |
+ |
6082 |
+ /* |
6083 |
++ * When issuing a POLICY_REPLACE the policy needs to make a callback to |
6084 |
++ * lock the block being demoted. This doesn't need to occur during a |
6085 |
++ * writeback operation since the block remains in the cache. |
6086 |
++ */ |
6087 |
++struct policy_locker; |
6088 |
++typedef int (*policy_lock_fn)(struct policy_locker *l, dm_oblock_t oblock); |
6089 |
++ |
6090 |
++struct policy_locker { |
6091 |
++ policy_lock_fn fn; |
6092 |
++}; |
6093 |
++ |
6094 |
++/* |
6095 |
+ * This is the instruction passed back to the core target. |
6096 |
+ */ |
6097 |
+ struct policy_result { |
6098 |
+@@ -122,7 +134,8 @@ struct dm_cache_policy { |
6099 |
+ */ |
6100 |
+ int (*map)(struct dm_cache_policy *p, dm_oblock_t oblock, |
6101 |
+ bool can_block, bool can_migrate, bool discarded_oblock, |
6102 |
+- struct bio *bio, struct policy_result *result); |
6103 |
++ struct bio *bio, struct policy_locker *locker, |
6104 |
++ struct policy_result *result); |
6105 |
+ |
6106 |
+ /* |
6107 |
+ * Sometimes we want to see if a block is in the cache, without |
6108 |
+diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c |
6109 |
+index 7755af351867..e049becaaf2d 100644 |
6110 |
+--- a/drivers/md/dm-cache-target.c |
6111 |
++++ b/drivers/md/dm-cache-target.c |
6112 |
+@@ -1445,16 +1445,43 @@ static void inc_miss_counter(struct cache *cache, struct bio *bio) |
6113 |
+ &cache->stats.read_miss : &cache->stats.write_miss); |
6114 |
+ } |
6115 |
+ |
6116 |
++/*----------------------------------------------------------------*/ |
6117 |
++ |
6118 |
++struct old_oblock_lock { |
6119 |
++ struct policy_locker locker; |
6120 |
++ struct cache *cache; |
6121 |
++ struct prealloc *structs; |
6122 |
++ struct dm_bio_prison_cell *cell; |
6123 |
++}; |
6124 |
++ |
6125 |
++static int null_locker(struct policy_locker *locker, dm_oblock_t b) |
6126 |
++{ |
6127 |
++ /* This should never be called */ |
6128 |
++ BUG(); |
6129 |
++ return 0; |
6130 |
++} |
6131 |
++ |
6132 |
++static int cell_locker(struct policy_locker *locker, dm_oblock_t b) |
6133 |
++{ |
6134 |
++ struct old_oblock_lock *l = container_of(locker, struct old_oblock_lock, locker); |
6135 |
++ struct dm_bio_prison_cell *cell_prealloc = prealloc_get_cell(l->structs); |
6136 |
++ |
6137 |
++ return bio_detain(l->cache, b, NULL, cell_prealloc, |
6138 |
++ (cell_free_fn) prealloc_put_cell, |
6139 |
++ l->structs, &l->cell); |
6140 |
++} |
6141 |
++ |
6142 |
+ static void process_bio(struct cache *cache, struct prealloc *structs, |
6143 |
+ struct bio *bio) |
6144 |
+ { |
6145 |
+ int r; |
6146 |
+ bool release_cell = true; |
6147 |
+ dm_oblock_t block = get_bio_block(cache, bio); |
6148 |
+- struct dm_bio_prison_cell *cell_prealloc, *old_ocell, *new_ocell; |
6149 |
++ struct dm_bio_prison_cell *cell_prealloc, *new_ocell; |
6150 |
+ struct policy_result lookup_result; |
6151 |
+ bool passthrough = passthrough_mode(&cache->features); |
6152 |
+ bool discarded_block, can_migrate; |
6153 |
++ struct old_oblock_lock ool; |
6154 |
+ |
6155 |
+ /* |
6156 |
+ * Check to see if that block is currently migrating. |
6157 |
+@@ -1469,8 +1496,12 @@ static void process_bio(struct cache *cache, struct prealloc *structs, |
6158 |
+ discarded_block = is_discarded_oblock(cache, block); |
6159 |
+ can_migrate = !passthrough && (discarded_block || spare_migration_bandwidth(cache)); |
6160 |
+ |
6161 |
++ ool.locker.fn = cell_locker; |
6162 |
++ ool.cache = cache; |
6163 |
++ ool.structs = structs; |
6164 |
++ ool.cell = NULL; |
6165 |
+ r = policy_map(cache->policy, block, true, can_migrate, discarded_block, |
6166 |
+- bio, &lookup_result); |
6167 |
++ bio, &ool.locker, &lookup_result); |
6168 |
+ |
6169 |
+ if (r == -EWOULDBLOCK) |
6170 |
+ /* migration has been denied */ |
6171 |
+@@ -1527,27 +1558,11 @@ static void process_bio(struct cache *cache, struct prealloc *structs, |
6172 |
+ break; |
6173 |
+ |
6174 |
+ case POLICY_REPLACE: |
6175 |
+- cell_prealloc = prealloc_get_cell(structs); |
6176 |
+- r = bio_detain(cache, lookup_result.old_oblock, bio, cell_prealloc, |
6177 |
+- (cell_free_fn) prealloc_put_cell, |
6178 |
+- structs, &old_ocell); |
6179 |
+- if (r > 0) { |
6180 |
+- /* |
6181 |
+- * We have to be careful to avoid lock inversion of |
6182 |
+- * the cells. So we back off, and wait for the |
6183 |
+- * old_ocell to become free. |
6184 |
+- */ |
6185 |
+- policy_force_mapping(cache->policy, block, |
6186 |
+- lookup_result.old_oblock); |
6187 |
+- atomic_inc(&cache->stats.cache_cell_clash); |
6188 |
+- break; |
6189 |
+- } |
6190 |
+ atomic_inc(&cache->stats.demotion); |
6191 |
+ atomic_inc(&cache->stats.promotion); |
6192 |
+- |
6193 |
+ demote_then_promote(cache, structs, lookup_result.old_oblock, |
6194 |
+ block, lookup_result.cblock, |
6195 |
+- old_ocell, new_ocell); |
6196 |
++ ool.cell, new_ocell); |
6197 |
+ release_cell = false; |
6198 |
+ break; |
6199 |
+ |
6200 |
+@@ -2595,6 +2610,9 @@ static int __cache_map(struct cache *cache, struct bio *bio, struct dm_bio_priso |
6201 |
+ bool discarded_block; |
6202 |
+ struct policy_result lookup_result; |
6203 |
+ struct per_bio_data *pb = init_per_bio_data(bio, pb_data_size); |
6204 |
++ struct old_oblock_lock ool; |
6205 |
++ |
6206 |
++ ool.locker.fn = null_locker; |
6207 |
+ |
6208 |
+ if (unlikely(from_oblock(block) >= from_oblock(cache->origin_blocks))) { |
6209 |
+ /* |
6210 |
+@@ -2633,7 +2651,7 @@ static int __cache_map(struct cache *cache, struct bio *bio, struct dm_bio_priso |
6211 |
+ discarded_block = is_discarded_oblock(cache, block); |
6212 |
+ |
6213 |
+ r = policy_map(cache->policy, block, false, can_migrate, discarded_block, |
6214 |
+- bio, &lookup_result); |
6215 |
++ bio, &ool.locker, &lookup_result); |
6216 |
+ if (r == -EWOULDBLOCK) { |
6217 |
+ cell_defer(cache, *cell, true); |
6218 |
+ return DM_MAPIO_SUBMITTED; |
6219 |
+diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c |
6220 |
+index f478a4c96d2f..419bdd4fc8b8 100644 |
6221 |
+--- a/drivers/md/dm-stats.c |
6222 |
++++ b/drivers/md/dm-stats.c |
6223 |
+@@ -795,6 +795,8 @@ static int message_stats_create(struct mapped_device *md, |
6224 |
+ return -EINVAL; |
6225 |
+ |
6226 |
+ if (sscanf(argv[2], "/%u%c", &divisor, &dummy) == 1) { |
6227 |
++ if (!divisor) |
6228 |
++ return -EINVAL; |
6229 |
+ step = end - start; |
6230 |
+ if (do_div(step, divisor)) |
6231 |
+ step++; |
6232 |
+diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c |
6233 |
+index 921aafd12aee..e22e6c892b8a 100644 |
6234 |
+--- a/drivers/md/dm-thin.c |
6235 |
++++ b/drivers/md/dm-thin.c |
6236 |
+@@ -18,6 +18,7 @@ |
6237 |
+ #include <linux/init.h> |
6238 |
+ #include <linux/module.h> |
6239 |
+ #include <linux/slab.h> |
6240 |
++#include <linux/vmalloc.h> |
6241 |
+ #include <linux/sort.h> |
6242 |
+ #include <linux/rbtree.h> |
6243 |
+ |
6244 |
+@@ -260,7 +261,7 @@ struct pool { |
6245 |
+ process_mapping_fn process_prepared_mapping; |
6246 |
+ process_mapping_fn process_prepared_discard; |
6247 |
+ |
6248 |
+- struct dm_bio_prison_cell *cell_sort_array[CELL_SORT_ARRAY_SIZE]; |
6249 |
++ struct dm_bio_prison_cell **cell_sort_array; |
6250 |
+ }; |
6251 |
+ |
6252 |
+ static enum pool_mode get_pool_mode(struct pool *pool); |
6253 |
+@@ -2499,6 +2500,7 @@ static void __pool_destroy(struct pool *pool) |
6254 |
+ { |
6255 |
+ __pool_table_remove(pool); |
6256 |
+ |
6257 |
++ vfree(pool->cell_sort_array); |
6258 |
+ if (dm_pool_metadata_close(pool->pmd) < 0) |
6259 |
+ DMWARN("%s: dm_pool_metadata_close() failed.", __func__); |
6260 |
+ |
6261 |
+@@ -2611,6 +2613,13 @@ static struct pool *pool_create(struct mapped_device *pool_md, |
6262 |
+ goto bad_mapping_pool; |
6263 |
+ } |
6264 |
+ |
6265 |
++ pool->cell_sort_array = vmalloc(sizeof(*pool->cell_sort_array) * CELL_SORT_ARRAY_SIZE); |
6266 |
++ if (!pool->cell_sort_array) { |
6267 |
++ *error = "Error allocating cell sort array"; |
6268 |
++ err_p = ERR_PTR(-ENOMEM); |
6269 |
++ goto bad_sort_array; |
6270 |
++ } |
6271 |
++ |
6272 |
+ pool->ref_count = 1; |
6273 |
+ pool->last_commit_jiffies = jiffies; |
6274 |
+ pool->pool_md = pool_md; |
6275 |
+@@ -2619,6 +2628,8 @@ static struct pool *pool_create(struct mapped_device *pool_md, |
6276 |
+ |
6277 |
+ return pool; |
6278 |
+ |
6279 |
++bad_sort_array: |
6280 |
++ mempool_destroy(pool->mapping_pool); |
6281 |
+ bad_mapping_pool: |
6282 |
+ dm_deferred_set_destroy(pool->all_io_ds); |
6283 |
+ bad_all_io_ds: |
6284 |
+diff --git a/drivers/md/md.c b/drivers/md/md.c |
6285 |
+index 4dbed4a67aaf..b9200282fd77 100644 |
6286 |
+--- a/drivers/md/md.c |
6287 |
++++ b/drivers/md/md.c |
6288 |
+@@ -4005,8 +4005,10 @@ new_dev_store(struct mddev *mddev, const char *buf, size_t len) |
6289 |
+ else |
6290 |
+ rdev = md_import_device(dev, -1, -1); |
6291 |
+ |
6292 |
+- if (IS_ERR(rdev)) |
6293 |
++ if (IS_ERR(rdev)) { |
6294 |
++ mddev_unlock(mddev); |
6295 |
+ return PTR_ERR(rdev); |
6296 |
++ } |
6297 |
+ err = bind_rdev_to_array(rdev, mddev); |
6298 |
+ out: |
6299 |
+ if (err) |
6300 |
+@@ -5159,6 +5161,7 @@ int md_run(struct mddev *mddev) |
6301 |
+ mddev_detach(mddev); |
6302 |
+ if (mddev->private) |
6303 |
+ pers->free(mddev, mddev->private); |
6304 |
++ mddev->private = NULL; |
6305 |
+ module_put(pers->owner); |
6306 |
+ bitmap_destroy(mddev); |
6307 |
+ return err; |
6308 |
+@@ -5294,6 +5297,7 @@ static void md_clean(struct mddev *mddev) |
6309 |
+ mddev->changed = 0; |
6310 |
+ mddev->degraded = 0; |
6311 |
+ mddev->safemode = 0; |
6312 |
++ mddev->private = NULL; |
6313 |
+ mddev->merge_check_needed = 0; |
6314 |
+ mddev->bitmap_info.offset = 0; |
6315 |
+ mddev->bitmap_info.default_offset = 0; |
6316 |
+@@ -5366,6 +5370,7 @@ static void __md_stop(struct mddev *mddev) |
6317 |
+ mddev->pers = NULL; |
6318 |
+ spin_unlock(&mddev->lock); |
6319 |
+ pers->free(mddev, mddev->private); |
6320 |
++ mddev->private = NULL; |
6321 |
+ if (pers->sync_request && mddev->to_remove == NULL) |
6322 |
+ mddev->to_remove = &md_redundancy_group; |
6323 |
+ module_put(pers->owner); |
6324 |
+@@ -6375,7 +6380,7 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info) |
6325 |
+ mddev->ctime != info->ctime || |
6326 |
+ mddev->level != info->level || |
6327 |
+ /* mddev->layout != info->layout || */ |
6328 |
+- !mddev->persistent != info->not_persistent|| |
6329 |
++ mddev->persistent != !info->not_persistent || |
6330 |
+ mddev->chunk_sectors != info->chunk_size >> 9 || |
6331 |
+ /* ignore bottom 8 bits of state, and allow SB_BITMAP_PRESENT to change */ |
6332 |
+ ((state^info->state) & 0xfffffe00) |
6333 |
+diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c |
6334 |
+index b88757cd0d1d..a03178e91a79 100644 |
6335 |
+--- a/drivers/md/persistent-data/dm-btree-remove.c |
6336 |
++++ b/drivers/md/persistent-data/dm-btree-remove.c |
6337 |
+@@ -309,8 +309,8 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent, |
6338 |
+ |
6339 |
+ if (s < 0 && nr_center < -s) { |
6340 |
+ /* not enough in central node */ |
6341 |
+- shift(left, center, nr_center); |
6342 |
+- s = nr_center - target; |
6343 |
++ shift(left, center, -nr_center); |
6344 |
++ s += nr_center; |
6345 |
+ shift(left, right, s); |
6346 |
+ nr_right += s; |
6347 |
+ } else |
6348 |
+@@ -323,7 +323,7 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent, |
6349 |
+ if (s > 0 && nr_center < s) { |
6350 |
+ /* not enough in central node */ |
6351 |
+ shift(center, right, nr_center); |
6352 |
+- s = target - nr_center; |
6353 |
++ s -= nr_center; |
6354 |
+ shift(left, right, s); |
6355 |
+ nr_left -= s; |
6356 |
+ } else |
6357 |
+diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c |
6358 |
+index 200ac12a1d40..fdd3793e22f9 100644 |
6359 |
+--- a/drivers/md/persistent-data/dm-btree.c |
6360 |
++++ b/drivers/md/persistent-data/dm-btree.c |
6361 |
+@@ -255,7 +255,7 @@ int dm_btree_del(struct dm_btree_info *info, dm_block_t root) |
6362 |
+ int r; |
6363 |
+ struct del_stack *s; |
6364 |
+ |
6365 |
+- s = kmalloc(sizeof(*s), GFP_KERNEL); |
6366 |
++ s = kmalloc(sizeof(*s), GFP_NOIO); |
6367 |
+ if (!s) |
6368 |
+ return -ENOMEM; |
6369 |
+ s->info = info; |
6370 |
+diff --git a/drivers/md/persistent-data/dm-space-map-metadata.c b/drivers/md/persistent-data/dm-space-map-metadata.c |
6371 |
+index e8a904298887..53091295fce9 100644 |
6372 |
+--- a/drivers/md/persistent-data/dm-space-map-metadata.c |
6373 |
++++ b/drivers/md/persistent-data/dm-space-map-metadata.c |
6374 |
+@@ -204,6 +204,27 @@ static void in(struct sm_metadata *smm) |
6375 |
+ smm->recursion_count++; |
6376 |
+ } |
6377 |
+ |
6378 |
++static int apply_bops(struct sm_metadata *smm) |
6379 |
++{ |
6380 |
++ int r = 0; |
6381 |
++ |
6382 |
++ while (!brb_empty(&smm->uncommitted)) { |
6383 |
++ struct block_op bop; |
6384 |
++ |
6385 |
++ r = brb_pop(&smm->uncommitted, &bop); |
6386 |
++ if (r) { |
6387 |
++ DMERR("bug in bop ring buffer"); |
6388 |
++ break; |
6389 |
++ } |
6390 |
++ |
6391 |
++ r = commit_bop(smm, &bop); |
6392 |
++ if (r) |
6393 |
++ break; |
6394 |
++ } |
6395 |
++ |
6396 |
++ return r; |
6397 |
++} |
6398 |
++ |
6399 |
+ static int out(struct sm_metadata *smm) |
6400 |
+ { |
6401 |
+ int r = 0; |
6402 |
+@@ -216,21 +237,8 @@ static int out(struct sm_metadata *smm) |
6403 |
+ return -ENOMEM; |
6404 |
+ } |
6405 |
+ |
6406 |
+- if (smm->recursion_count == 1) { |
6407 |
+- while (!brb_empty(&smm->uncommitted)) { |
6408 |
+- struct block_op bop; |
6409 |
+- |
6410 |
+- r = brb_pop(&smm->uncommitted, &bop); |
6411 |
+- if (r) { |
6412 |
+- DMERR("bug in bop ring buffer"); |
6413 |
+- break; |
6414 |
+- } |
6415 |
+- |
6416 |
+- r = commit_bop(smm, &bop); |
6417 |
+- if (r) |
6418 |
+- break; |
6419 |
+- } |
6420 |
+- } |
6421 |
++ if (smm->recursion_count == 1) |
6422 |
++ apply_bops(smm); |
6423 |
+ |
6424 |
+ smm->recursion_count--; |
6425 |
+ |
6426 |
+@@ -704,6 +712,12 @@ static int sm_metadata_extend(struct dm_space_map *sm, dm_block_t extra_blocks) |
6427 |
+ } |
6428 |
+ old_len = smm->begin; |
6429 |
+ |
6430 |
++ r = apply_bops(smm); |
6431 |
++ if (r) { |
6432 |
++ DMERR("%s: apply_bops failed", __func__); |
6433 |
++ goto out; |
6434 |
++ } |
6435 |
++ |
6436 |
+ r = sm_ll_commit(&smm->ll); |
6437 |
+ if (r) |
6438 |
+ goto out; |
6439 |
+@@ -773,6 +787,12 @@ int dm_sm_metadata_create(struct dm_space_map *sm, |
6440 |
+ if (r) |
6441 |
+ return r; |
6442 |
+ |
6443 |
++ r = apply_bops(smm); |
6444 |
++ if (r) { |
6445 |
++ DMERR("%s: apply_bops failed", __func__); |
6446 |
++ return r; |
6447 |
++ } |
6448 |
++ |
6449 |
+ return sm_metadata_commit(sm); |
6450 |
+ } |
6451 |
+ |
6452 |
+diff --git a/drivers/media/dvb-frontends/af9013.c b/drivers/media/dvb-frontends/af9013.c |
6453 |
+index 8001690d7576..ba6c8f6c42a1 100644 |
6454 |
+--- a/drivers/media/dvb-frontends/af9013.c |
6455 |
++++ b/drivers/media/dvb-frontends/af9013.c |
6456 |
+@@ -605,6 +605,10 @@ static int af9013_set_frontend(struct dvb_frontend *fe) |
6457 |
+ } |
6458 |
+ } |
6459 |
+ |
6460 |
++ /* Return an error if can't find bandwidth or the right clock */ |
6461 |
++ if (i == ARRAY_SIZE(coeff_lut)) |
6462 |
++ return -EINVAL; |
6463 |
++ |
6464 |
+ ret = af9013_wr_regs(state, 0xae00, coeff_lut[i].val, |
6465 |
+ sizeof(coeff_lut[i].val)); |
6466 |
+ } |
6467 |
+diff --git a/drivers/media/dvb-frontends/cx24116.c b/drivers/media/dvb-frontends/cx24116.c |
6468 |
+index 2916d7c74a1d..7bc68b355c0b 100644 |
6469 |
+--- a/drivers/media/dvb-frontends/cx24116.c |
6470 |
++++ b/drivers/media/dvb-frontends/cx24116.c |
6471 |
+@@ -963,6 +963,10 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe, |
6472 |
+ struct cx24116_state *state = fe->demodulator_priv; |
6473 |
+ int i, ret; |
6474 |
+ |
6475 |
++ /* Validate length */ |
6476 |
++ if (d->msg_len > sizeof(d->msg)) |
6477 |
++ return -EINVAL; |
6478 |
++ |
6479 |
+ /* Dump DiSEqC message */ |
6480 |
+ if (debug) { |
6481 |
+ printk(KERN_INFO "cx24116: %s(", __func__); |
6482 |
+@@ -974,10 +978,6 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe, |
6483 |
+ printk(") toneburst=%d\n", toneburst); |
6484 |
+ } |
6485 |
+ |
6486 |
+- /* Validate length */ |
6487 |
+- if (d->msg_len > (CX24116_ARGLEN - CX24116_DISEQC_MSGOFS)) |
6488 |
+- return -EINVAL; |
6489 |
+- |
6490 |
+ /* DiSEqC message */ |
6491 |
+ for (i = 0; i < d->msg_len; i++) |
6492 |
+ state->dsec_cmd.args[CX24116_DISEQC_MSGOFS + i] = d->msg[i]; |
6493 |
+diff --git a/drivers/media/dvb-frontends/cx24117.c b/drivers/media/dvb-frontends/cx24117.c |
6494 |
+index acb965ce0358..af6363573efd 100644 |
6495 |
+--- a/drivers/media/dvb-frontends/cx24117.c |
6496 |
++++ b/drivers/media/dvb-frontends/cx24117.c |
6497 |
+@@ -1043,7 +1043,7 @@ static int cx24117_send_diseqc_msg(struct dvb_frontend *fe, |
6498 |
+ dev_dbg(&state->priv->i2c->dev, ")\n"); |
6499 |
+ |
6500 |
+ /* Validate length */ |
6501 |
+- if (d->msg_len > 15) |
6502 |
++ if (d->msg_len > sizeof(d->msg)) |
6503 |
+ return -EINVAL; |
6504 |
+ |
6505 |
+ /* DiSEqC message */ |
6506 |
+diff --git a/drivers/media/dvb-frontends/s5h1420.c b/drivers/media/dvb-frontends/s5h1420.c |
6507 |
+index 93eeaf7118fd..0b4f8fe6bf99 100644 |
6508 |
+--- a/drivers/media/dvb-frontends/s5h1420.c |
6509 |
++++ b/drivers/media/dvb-frontends/s5h1420.c |
6510 |
+@@ -180,7 +180,7 @@ static int s5h1420_send_master_cmd (struct dvb_frontend* fe, |
6511 |
+ int result = 0; |
6512 |
+ |
6513 |
+ dprintk("enter %s\n", __func__); |
6514 |
+- if (cmd->msg_len > 8) |
6515 |
++ if (cmd->msg_len > sizeof(cmd->msg)) |
6516 |
+ return -EINVAL; |
6517 |
+ |
6518 |
+ /* setup for DISEQC */ |
6519 |
+diff --git a/drivers/media/pci/cx18/cx18-streams.c b/drivers/media/pci/cx18/cx18-streams.c |
6520 |
+index c82d25d53341..c9860845264f 100644 |
6521 |
+--- a/drivers/media/pci/cx18/cx18-streams.c |
6522 |
++++ b/drivers/media/pci/cx18/cx18-streams.c |
6523 |
+@@ -90,6 +90,7 @@ static struct { |
6524 |
+ "encoder PCM audio", |
6525 |
+ VFL_TYPE_GRABBER, CX18_V4L2_ENC_PCM_OFFSET, |
6526 |
+ PCI_DMA_FROMDEVICE, |
6527 |
++ V4L2_CAP_TUNER | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE, |
6528 |
+ }, |
6529 |
+ { /* CX18_ENC_STREAM_TYPE_IDX */ |
6530 |
+ "encoder IDX", |
6531 |
+diff --git a/drivers/media/pci/saa7164/saa7164-encoder.c b/drivers/media/pci/saa7164/saa7164-encoder.c |
6532 |
+index 9266965412c3..7a0a65146723 100644 |
6533 |
+--- a/drivers/media/pci/saa7164/saa7164-encoder.c |
6534 |
++++ b/drivers/media/pci/saa7164/saa7164-encoder.c |
6535 |
+@@ -721,13 +721,14 @@ static int vidioc_querycap(struct file *file, void *priv, |
6536 |
+ sizeof(cap->card)); |
6537 |
+ sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); |
6538 |
+ |
6539 |
+- cap->capabilities = |
6540 |
++ cap->device_caps = |
6541 |
+ V4L2_CAP_VIDEO_CAPTURE | |
6542 |
+- V4L2_CAP_READWRITE | |
6543 |
+- 0; |
6544 |
++ V4L2_CAP_READWRITE | |
6545 |
++ V4L2_CAP_TUNER; |
6546 |
+ |
6547 |
+- cap->capabilities |= V4L2_CAP_TUNER; |
6548 |
+- cap->version = 0; |
6549 |
++ cap->capabilities = cap->device_caps | |
6550 |
++ V4L2_CAP_VBI_CAPTURE | |
6551 |
++ V4L2_CAP_DEVICE_CAPS; |
6552 |
+ |
6553 |
+ return 0; |
6554 |
+ } |
6555 |
+diff --git a/drivers/media/pci/saa7164/saa7164-vbi.c b/drivers/media/pci/saa7164/saa7164-vbi.c |
6556 |
+index 6e025fea2542..06117e6c0596 100644 |
6557 |
+--- a/drivers/media/pci/saa7164/saa7164-vbi.c |
6558 |
++++ b/drivers/media/pci/saa7164/saa7164-vbi.c |
6559 |
+@@ -660,13 +660,14 @@ static int vidioc_querycap(struct file *file, void *priv, |
6560 |
+ sizeof(cap->card)); |
6561 |
+ sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); |
6562 |
+ |
6563 |
+- cap->capabilities = |
6564 |
++ cap->device_caps = |
6565 |
+ V4L2_CAP_VBI_CAPTURE | |
6566 |
+- V4L2_CAP_READWRITE | |
6567 |
+- 0; |
6568 |
++ V4L2_CAP_READWRITE | |
6569 |
++ V4L2_CAP_TUNER; |
6570 |
+ |
6571 |
+- cap->capabilities |= V4L2_CAP_TUNER; |
6572 |
+- cap->version = 0; |
6573 |
++ cap->capabilities = cap->device_caps | |
6574 |
++ V4L2_CAP_VIDEO_CAPTURE | |
6575 |
++ V4L2_CAP_DEVICE_CAPS; |
6576 |
+ |
6577 |
+ return 0; |
6578 |
+ } |
6579 |
+diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c |
6580 |
+index 2b40393836ff..0d248ce02a9b 100644 |
6581 |
+--- a/drivers/media/usb/dvb-usb/dib0700_core.c |
6582 |
++++ b/drivers/media/usb/dvb-usb/dib0700_core.c |
6583 |
+@@ -655,10 +655,20 @@ out: |
6584 |
+ struct dib0700_rc_response { |
6585 |
+ u8 report_id; |
6586 |
+ u8 data_state; |
6587 |
+- u8 system; |
6588 |
+- u8 not_system; |
6589 |
+- u8 data; |
6590 |
+- u8 not_data; |
6591 |
++ union { |
6592 |
++ struct { |
6593 |
++ u8 system; |
6594 |
++ u8 not_system; |
6595 |
++ u8 data; |
6596 |
++ u8 not_data; |
6597 |
++ } nec; |
6598 |
++ struct { |
6599 |
++ u8 not_used; |
6600 |
++ u8 system; |
6601 |
++ u8 data; |
6602 |
++ u8 not_data; |
6603 |
++ } rc5; |
6604 |
++ }; |
6605 |
+ }; |
6606 |
+ #define RC_MSG_SIZE_V1_20 6 |
6607 |
+ |
6608 |
+@@ -694,8 +704,8 @@ static void dib0700_rc_urb_completion(struct urb *purb) |
6609 |
+ |
6610 |
+ deb_data("IR ID = %02X state = %02X System = %02X %02X Cmd = %02X %02X (len %d)\n", |
6611 |
+ poll_reply->report_id, poll_reply->data_state, |
6612 |
+- poll_reply->system, poll_reply->not_system, |
6613 |
+- poll_reply->data, poll_reply->not_data, |
6614 |
++ poll_reply->nec.system, poll_reply->nec.not_system, |
6615 |
++ poll_reply->nec.data, poll_reply->nec.not_data, |
6616 |
+ purb->actual_length); |
6617 |
+ |
6618 |
+ switch (d->props.rc.core.protocol) { |
6619 |
+@@ -704,30 +714,30 @@ static void dib0700_rc_urb_completion(struct urb *purb) |
6620 |
+ toggle = 0; |
6621 |
+ |
6622 |
+ /* NEC protocol sends repeat code as 0 0 0 FF */ |
6623 |
+- if (poll_reply->system == 0x00 && |
6624 |
+- poll_reply->not_system == 0x00 && |
6625 |
+- poll_reply->data == 0x00 && |
6626 |
+- poll_reply->not_data == 0xff) { |
6627 |
++ if (poll_reply->nec.system == 0x00 && |
6628 |
++ poll_reply->nec.not_system == 0x00 && |
6629 |
++ poll_reply->nec.data == 0x00 && |
6630 |
++ poll_reply->nec.not_data == 0xff) { |
6631 |
+ poll_reply->data_state = 2; |
6632 |
+ break; |
6633 |
+ } |
6634 |
+ |
6635 |
+- if ((poll_reply->data ^ poll_reply->not_data) != 0xff) { |
6636 |
++ if ((poll_reply->nec.data ^ poll_reply->nec.not_data) != 0xff) { |
6637 |
+ deb_data("NEC32 protocol\n"); |
6638 |
+- keycode = RC_SCANCODE_NEC32(poll_reply->system << 24 | |
6639 |
+- poll_reply->not_system << 16 | |
6640 |
+- poll_reply->data << 8 | |
6641 |
+- poll_reply->not_data); |
6642 |
+- } else if ((poll_reply->system ^ poll_reply->not_system) != 0xff) { |
6643 |
++ keycode = RC_SCANCODE_NEC32(poll_reply->nec.system << 24 | |
6644 |
++ poll_reply->nec.not_system << 16 | |
6645 |
++ poll_reply->nec.data << 8 | |
6646 |
++ poll_reply->nec.not_data); |
6647 |
++ } else if ((poll_reply->nec.system ^ poll_reply->nec.not_system) != 0xff) { |
6648 |
+ deb_data("NEC extended protocol\n"); |
6649 |
+- keycode = RC_SCANCODE_NECX(poll_reply->system << 8 | |
6650 |
+- poll_reply->not_system, |
6651 |
+- poll_reply->data); |
6652 |
++ keycode = RC_SCANCODE_NECX(poll_reply->nec.system << 8 | |
6653 |
++ poll_reply->nec.not_system, |
6654 |
++ poll_reply->nec.data); |
6655 |
+ |
6656 |
+ } else { |
6657 |
+ deb_data("NEC normal protocol\n"); |
6658 |
+- keycode = RC_SCANCODE_NEC(poll_reply->system, |
6659 |
+- poll_reply->data); |
6660 |
++ keycode = RC_SCANCODE_NEC(poll_reply->nec.system, |
6661 |
++ poll_reply->nec.data); |
6662 |
+ } |
6663 |
+ |
6664 |
+ break; |
6665 |
+@@ -735,19 +745,19 @@ static void dib0700_rc_urb_completion(struct urb *purb) |
6666 |
+ deb_data("RC5 protocol\n"); |
6667 |
+ protocol = RC_TYPE_RC5; |
6668 |
+ toggle = poll_reply->report_id; |
6669 |
+- keycode = RC_SCANCODE_RC5(poll_reply->system, poll_reply->data); |
6670 |
++ keycode = RC_SCANCODE_RC5(poll_reply->rc5.system, poll_reply->rc5.data); |
6671 |
++ |
6672 |
++ if ((poll_reply->rc5.data ^ poll_reply->rc5.not_data) != 0xff) { |
6673 |
++ /* Key failed integrity check */ |
6674 |
++ err("key failed integrity check: %02x %02x %02x %02x", |
6675 |
++ poll_reply->rc5.not_used, poll_reply->rc5.system, |
6676 |
++ poll_reply->rc5.data, poll_reply->rc5.not_data); |
6677 |
++ goto resubmit; |
6678 |
++ } |
6679 |
+ |
6680 |
+ break; |
6681 |
+ } |
6682 |
+ |
6683 |
+- if ((poll_reply->data + poll_reply->not_data) != 0xff) { |
6684 |
+- /* Key failed integrity check */ |
6685 |
+- err("key failed integrity check: %02x %02x %02x %02x", |
6686 |
+- poll_reply->system, poll_reply->not_system, |
6687 |
+- poll_reply->data, poll_reply->not_data); |
6688 |
+- goto resubmit; |
6689 |
+- } |
6690 |
+- |
6691 |
+ rc_keydown(d->rc_dev, protocol, keycode, toggle); |
6692 |
+ |
6693 |
+ resubmit: |
6694 |
+diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c |
6695 |
+index d7d55a20e959..c170523226aa 100644 |
6696 |
+--- a/drivers/media/usb/dvb-usb/dib0700_devices.c |
6697 |
++++ b/drivers/media/usb/dvb-usb/dib0700_devices.c |
6698 |
+@@ -3944,6 +3944,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { |
6699 |
+ |
6700 |
+ DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
6701 |
+ }}, |
6702 |
++ .size_of_priv = sizeof(struct |
6703 |
++ dib0700_adapter_state), |
6704 |
+ }, { |
6705 |
+ .num_frontends = 1, |
6706 |
+ .fe = {{ |
6707 |
+@@ -3956,6 +3958,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { |
6708 |
+ |
6709 |
+ DIB0700_DEFAULT_STREAMING_CONFIG(0x03), |
6710 |
+ }}, |
6711 |
++ .size_of_priv = sizeof(struct |
6712 |
++ dib0700_adapter_state), |
6713 |
+ } |
6714 |
+ }, |
6715 |
+ |
6716 |
+@@ -4009,6 +4013,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { |
6717 |
+ |
6718 |
+ DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
6719 |
+ }}, |
6720 |
++ .size_of_priv = sizeof(struct |
6721 |
++ dib0700_adapter_state), |
6722 |
+ }, |
6723 |
+ }, |
6724 |
+ |
6725 |
+diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c |
6726 |
+index 66ada01c796c..cf9d644a8aff 100644 |
6727 |
+--- a/drivers/media/v4l2-core/videobuf2-core.c |
6728 |
++++ b/drivers/media/v4l2-core/videobuf2-core.c |
6729 |
+@@ -1237,6 +1237,23 @@ void vb2_discard_done(struct vb2_queue *q) |
6730 |
+ } |
6731 |
+ EXPORT_SYMBOL_GPL(vb2_discard_done); |
6732 |
+ |
6733 |
++static void vb2_warn_zero_bytesused(struct vb2_buffer *vb) |
6734 |
++{ |
6735 |
++ static bool __check_once __read_mostly; |
6736 |
++ |
6737 |
++ if (__check_once) |
6738 |
++ return; |
6739 |
++ |
6740 |
++ __check_once = true; |
6741 |
++ __WARN(); |
6742 |
++ |
6743 |
++ pr_warn_once("use of bytesused == 0 is deprecated and will be removed in the future,\n"); |
6744 |
++ if (vb->vb2_queue->allow_zero_bytesused) |
6745 |
++ pr_warn_once("use VIDIOC_DECODER_CMD(V4L2_DEC_CMD_STOP) instead.\n"); |
6746 |
++ else |
6747 |
++ pr_warn_once("use the actual size instead.\n"); |
6748 |
++} |
6749 |
++ |
6750 |
+ /** |
6751 |
+ * __fill_vb2_buffer() - fill a vb2_buffer with information provided in a |
6752 |
+ * v4l2_buffer by the userspace. The caller has already verified that struct |
6753 |
+@@ -1247,16 +1264,6 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, const struct v4l2_buffer *b |
6754 |
+ { |
6755 |
+ unsigned int plane; |
6756 |
+ |
6757 |
+- if (V4L2_TYPE_IS_OUTPUT(b->type)) { |
6758 |
+- if (WARN_ON_ONCE(b->bytesused == 0)) { |
6759 |
+- pr_warn_once("use of bytesused == 0 is deprecated and will be removed in the future,\n"); |
6760 |
+- if (vb->vb2_queue->allow_zero_bytesused) |
6761 |
+- pr_warn_once("use VIDIOC_DECODER_CMD(V4L2_DEC_CMD_STOP) instead.\n"); |
6762 |
+- else |
6763 |
+- pr_warn_once("use the actual size instead.\n"); |
6764 |
+- } |
6765 |
+- } |
6766 |
+- |
6767 |
+ if (V4L2_TYPE_IS_MULTIPLANAR(b->type)) { |
6768 |
+ if (b->memory == V4L2_MEMORY_USERPTR) { |
6769 |
+ for (plane = 0; plane < vb->num_planes; ++plane) { |
6770 |
+@@ -1297,6 +1304,9 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, const struct v4l2_buffer *b |
6771 |
+ struct v4l2_plane *pdst = &v4l2_planes[plane]; |
6772 |
+ struct v4l2_plane *psrc = &b->m.planes[plane]; |
6773 |
+ |
6774 |
++ if (psrc->bytesused == 0) |
6775 |
++ vb2_warn_zero_bytesused(vb); |
6776 |
++ |
6777 |
+ if (vb->vb2_queue->allow_zero_bytesused) |
6778 |
+ pdst->bytesused = psrc->bytesused; |
6779 |
+ else |
6780 |
+@@ -1331,6 +1341,9 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, const struct v4l2_buffer *b |
6781 |
+ } |
6782 |
+ |
6783 |
+ if (V4L2_TYPE_IS_OUTPUT(b->type)) { |
6784 |
++ if (b->bytesused == 0) |
6785 |
++ vb2_warn_zero_bytesused(vb); |
6786 |
++ |
6787 |
+ if (vb->vb2_queue->allow_zero_bytesused) |
6788 |
+ v4l2_planes[0].bytesused = b->bytesused; |
6789 |
+ else |
6790 |
+diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c |
6791 |
+index 60f7141a6b02..31d2627d9d4d 100644 |
6792 |
+--- a/drivers/mmc/card/block.c |
6793 |
++++ b/drivers/mmc/card/block.c |
6794 |
+@@ -208,6 +208,8 @@ static ssize_t power_ro_lock_show(struct device *dev, |
6795 |
+ |
6796 |
+ ret = snprintf(buf, PAGE_SIZE, "%d\n", locked); |
6797 |
+ |
6798 |
++ mmc_blk_put(md); |
6799 |
++ |
6800 |
+ return ret; |
6801 |
+ } |
6802 |
+ |
6803 |
+@@ -1910,9 +1912,11 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) |
6804 |
+ break; |
6805 |
+ case MMC_BLK_CMD_ERR: |
6806 |
+ ret = mmc_blk_cmd_err(md, card, brq, req, ret); |
6807 |
+- if (!mmc_blk_reset(md, card->host, type)) |
6808 |
+- break; |
6809 |
+- goto cmd_abort; |
6810 |
++ if (mmc_blk_reset(md, card->host, type)) |
6811 |
++ goto cmd_abort; |
6812 |
++ if (!ret) |
6813 |
++ goto start_new_req; |
6814 |
++ break; |
6815 |
+ case MMC_BLK_RETRY: |
6816 |
+ if (retry++ < 5) |
6817 |
+ break; |
6818 |
+diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c |
6819 |
+index 9231cdfe2757..d3dbb28057e9 100644 |
6820 |
+--- a/drivers/mmc/host/sdhci.c |
6821 |
++++ b/drivers/mmc/host/sdhci.c |
6822 |
+@@ -3315,13 +3315,14 @@ int sdhci_add_host(struct sdhci_host *host) |
6823 |
+ SDHCI_MAX_CURRENT_MULTIPLIER; |
6824 |
+ } |
6825 |
+ |
6826 |
+- /* If OCR set by external regulators, use it instead */ |
6827 |
++ /* If OCR set by host, use it instead. */ |
6828 |
++ if (host->ocr_mask) |
6829 |
++ ocr_avail = host->ocr_mask; |
6830 |
++ |
6831 |
++ /* If OCR set by external regulators, give it highest prio. */ |
6832 |
+ if (mmc->ocr_avail) |
6833 |
+ ocr_avail = mmc->ocr_avail; |
6834 |
+ |
6835 |
+- if (host->ocr_mask) |
6836 |
+- ocr_avail &= host->ocr_mask; |
6837 |
+- |
6838 |
+ mmc->ocr_avail = ocr_avail; |
6839 |
+ mmc->ocr_avail_sdio = ocr_avail; |
6840 |
+ if (host->ocr_avail_sdio) |
6841 |
+diff --git a/drivers/net/ethernet/intel/e1000e/82571.c b/drivers/net/ethernet/intel/e1000e/82571.c |
6842 |
+index dc79ed85030b..32e77755a9c6 100644 |
6843 |
+--- a/drivers/net/ethernet/intel/e1000e/82571.c |
6844 |
++++ b/drivers/net/ethernet/intel/e1000e/82571.c |
6845 |
+@@ -2010,7 +2010,7 @@ const struct e1000_info e1000_82573_info = { |
6846 |
+ .flags2 = FLAG2_DISABLE_ASPM_L1 |
6847 |
+ | FLAG2_DISABLE_ASPM_L0S, |
6848 |
+ .pba = 20, |
6849 |
+- .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, |
6850 |
++ .max_hw_frame_size = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN, |
6851 |
+ .get_variants = e1000_get_variants_82571, |
6852 |
+ .mac_ops = &e82571_mac_ops, |
6853 |
+ .phy_ops = &e82_phy_ops_m88, |
6854 |
+diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c |
6855 |
+index 9d81c0317433..e2498dbf3c3b 100644 |
6856 |
+--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c |
6857 |
++++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c |
6858 |
+@@ -1563,7 +1563,7 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter) |
6859 |
+ ((adapter->hw.mac.type >= e1000_pch2lan) && |
6860 |
+ (!(er32(CTRL_EXT) & E1000_CTRL_EXT_LSECCK)))) { |
6861 |
+ adapter->flags &= ~FLAG_HAS_JUMBO_FRAMES; |
6862 |
+- adapter->max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN; |
6863 |
++ adapter->max_hw_frame_size = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN; |
6864 |
+ |
6865 |
+ hw->mac.ops.blink_led = NULL; |
6866 |
+ } |
6867 |
+@@ -5681,7 +5681,7 @@ const struct e1000_info e1000_ich8_info = { |
6868 |
+ | FLAG_HAS_FLASH |
6869 |
+ | FLAG_APME_IN_WUC, |
6870 |
+ .pba = 8, |
6871 |
+- .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, |
6872 |
++ .max_hw_frame_size = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN, |
6873 |
+ .get_variants = e1000_get_variants_ich8lan, |
6874 |
+ .mac_ops = &ich8_mac_ops, |
6875 |
+ .phy_ops = &ich8_phy_ops, |
6876 |
+@@ -5754,7 +5754,7 @@ const struct e1000_info e1000_pch2_info = { |
6877 |
+ .flags2 = FLAG2_HAS_PHY_STATS |
6878 |
+ | FLAG2_HAS_EEE, |
6879 |
+ .pba = 26, |
6880 |
+- .max_hw_frame_size = 9018, |
6881 |
++ .max_hw_frame_size = 9022, |
6882 |
+ .get_variants = e1000_get_variants_ich8lan, |
6883 |
+ .mac_ops = &ich8_mac_ops, |
6884 |
+ .phy_ops = &ich8_phy_ops, |
6885 |
+@@ -5774,7 +5774,7 @@ const struct e1000_info e1000_pch_lpt_info = { |
6886 |
+ .flags2 = FLAG2_HAS_PHY_STATS |
6887 |
+ | FLAG2_HAS_EEE, |
6888 |
+ .pba = 26, |
6889 |
+- .max_hw_frame_size = 9018, |
6890 |
++ .max_hw_frame_size = 9022, |
6891 |
+ .get_variants = e1000_get_variants_ich8lan, |
6892 |
+ .mac_ops = &ich8_mac_ops, |
6893 |
+ .phy_ops = &ich8_phy_ops, |
6894 |
+@@ -5794,7 +5794,7 @@ const struct e1000_info e1000_pch_spt_info = { |
6895 |
+ .flags2 = FLAG2_HAS_PHY_STATS |
6896 |
+ | FLAG2_HAS_EEE, |
6897 |
+ .pba = 26, |
6898 |
+- .max_hw_frame_size = 9018, |
6899 |
++ .max_hw_frame_size = 9022, |
6900 |
+ .get_variants = e1000_get_variants_ich8lan, |
6901 |
+ .mac_ops = &ich8_mac_ops, |
6902 |
+ .phy_ops = &ich8_phy_ops, |
6903 |
+diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c |
6904 |
+index c509a5c900f5..68913d103542 100644 |
6905 |
+--- a/drivers/net/ethernet/intel/e1000e/netdev.c |
6906 |
++++ b/drivers/net/ethernet/intel/e1000e/netdev.c |
6907 |
+@@ -3807,7 +3807,7 @@ void e1000e_reset(struct e1000_adapter *adapter) |
6908 |
+ /* reset Packet Buffer Allocation to default */ |
6909 |
+ ew32(PBA, pba); |
6910 |
+ |
6911 |
+- if (adapter->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN) { |
6912 |
++ if (adapter->max_frame_size > (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN)) { |
6913 |
+ /* To maintain wire speed transmits, the Tx FIFO should be |
6914 |
+ * large enough to accommodate two full transmit packets, |
6915 |
+ * rounded up to the next 1KB and expressed in KB. Likewise, |
6916 |
+@@ -4196,9 +4196,9 @@ static int e1000_sw_init(struct e1000_adapter *adapter) |
6917 |
+ { |
6918 |
+ struct net_device *netdev = adapter->netdev; |
6919 |
+ |
6920 |
+- adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN + ETH_FCS_LEN; |
6921 |
++ adapter->rx_buffer_len = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN; |
6922 |
+ adapter->rx_ps_bsize0 = 128; |
6923 |
+- adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; |
6924 |
++ adapter->max_frame_size = netdev->mtu + VLAN_ETH_HLEN + ETH_FCS_LEN; |
6925 |
+ adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; |
6926 |
+ adapter->tx_ring_count = E1000_DEFAULT_TXD; |
6927 |
+ adapter->rx_ring_count = E1000_DEFAULT_RXD; |
6928 |
+@@ -5781,17 +5781,17 @@ struct rtnl_link_stats64 *e1000e_get_stats64(struct net_device *netdev, |
6929 |
+ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) |
6930 |
+ { |
6931 |
+ struct e1000_adapter *adapter = netdev_priv(netdev); |
6932 |
+- int max_frame = new_mtu + VLAN_HLEN + ETH_HLEN + ETH_FCS_LEN; |
6933 |
++ int max_frame = new_mtu + VLAN_ETH_HLEN + ETH_FCS_LEN; |
6934 |
+ |
6935 |
+ /* Jumbo frame support */ |
6936 |
+- if ((max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) && |
6937 |
++ if ((max_frame > (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN)) && |
6938 |
+ !(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) { |
6939 |
+ e_err("Jumbo Frames not supported.\n"); |
6940 |
+ return -EINVAL; |
6941 |
+ } |
6942 |
+ |
6943 |
+ /* Supported frame sizes */ |
6944 |
+- if ((new_mtu < ETH_ZLEN + ETH_FCS_LEN + VLAN_HLEN) || |
6945 |
++ if ((new_mtu < (VLAN_ETH_ZLEN + ETH_FCS_LEN)) || |
6946 |
+ (max_frame > adapter->max_hw_frame_size)) { |
6947 |
+ e_err("Unsupported MTU setting\n"); |
6948 |
+ return -EINVAL; |
6949 |
+@@ -5831,10 +5831,8 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) |
6950 |
+ adapter->rx_buffer_len = 4096; |
6951 |
+ |
6952 |
+ /* adjust allocation if LPE protects us, and we aren't using SBP */ |
6953 |
+- if ((max_frame == ETH_FRAME_LEN + ETH_FCS_LEN) || |
6954 |
+- (max_frame == ETH_FRAME_LEN + VLAN_HLEN + ETH_FCS_LEN)) |
6955 |
+- adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN |
6956 |
+- + ETH_FCS_LEN; |
6957 |
++ if (max_frame <= (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN)) |
6958 |
++ adapter->rx_buffer_len = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN; |
6959 |
+ |
6960 |
+ if (netif_running(netdev)) |
6961 |
+ e1000e_up(adapter); |
6962 |
+diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h |
6963 |
+index e82a0d4ce23f..5dbc617ecf8a 100644 |
6964 |
+--- a/drivers/net/wireless/ath/ath9k/htc.h |
6965 |
++++ b/drivers/net/wireless/ath/ath9k/htc.h |
6966 |
+@@ -440,9 +440,9 @@ static inline void ath9k_htc_stop_btcoex(struct ath9k_htc_priv *priv) |
6967 |
+ } |
6968 |
+ #endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ |
6969 |
+ |
6970 |
+-#define OP_BT_PRIORITY_DETECTED BIT(3) |
6971 |
+-#define OP_BT_SCAN BIT(4) |
6972 |
+-#define OP_TSF_RESET BIT(6) |
6973 |
++#define OP_BT_PRIORITY_DETECTED 3 |
6974 |
++#define OP_BT_SCAN 4 |
6975 |
++#define OP_TSF_RESET 6 |
6976 |
+ |
6977 |
+ enum htc_op_flags { |
6978 |
+ HTC_FWFLAG_NO_RMW, |
6979 |
+diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c |
6980 |
+index b0badef71ce7..d5f2fbf62d72 100644 |
6981 |
+--- a/drivers/net/wireless/ath/ath9k/main.c |
6982 |
++++ b/drivers/net/wireless/ath/ath9k/main.c |
6983 |
+@@ -216,11 +216,13 @@ static bool ath_prepare_reset(struct ath_softc *sc) |
6984 |
+ ath_stop_ani(sc); |
6985 |
+ ath9k_hw_disable_interrupts(ah); |
6986 |
+ |
6987 |
+- if (!ath_drain_all_txq(sc)) |
6988 |
+- ret = false; |
6989 |
+- |
6990 |
+- if (!ath_stoprecv(sc)) |
6991 |
+- ret = false; |
6992 |
++ if (AR_SREV_9300_20_OR_LATER(ah)) { |
6993 |
++ ret &= ath_stoprecv(sc); |
6994 |
++ ret &= ath_drain_all_txq(sc); |
6995 |
++ } else { |
6996 |
++ ret &= ath_drain_all_txq(sc); |
6997 |
++ ret &= ath_stoprecv(sc); |
6998 |
++ } |
6999 |
+ |
7000 |
+ return ret; |
7001 |
+ } |
7002 |
+diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c |
7003 |
+index 9ac04c1ea706..8c17b943cc6f 100644 |
7004 |
+--- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c |
7005 |
++++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c |
7006 |
+@@ -6,7 +6,7 @@ |
7007 |
+ * GPL LICENSE SUMMARY |
7008 |
+ * |
7009 |
+ * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
7010 |
+- * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
7011 |
++ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
7012 |
+ * |
7013 |
+ * This program is free software; you can redistribute it and/or modify |
7014 |
+ * it under the terms of version 2 of the GNU General Public License as |
7015 |
+@@ -32,7 +32,7 @@ |
7016 |
+ * BSD LICENSE |
7017 |
+ * |
7018 |
+ * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
7019 |
+- * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
7020 |
++ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
7021 |
+ * All rights reserved. |
7022 |
+ * |
7023 |
+ * Redistribution and use in source and binary forms, with or without |
7024 |
+@@ -1356,6 +1356,7 @@ static ssize_t iwl_dbgfs_d0i3_refs_read(struct file *file, |
7025 |
+ PRINT_MVM_REF(IWL_MVM_REF_UCODE_DOWN); |
7026 |
+ PRINT_MVM_REF(IWL_MVM_REF_SCAN); |
7027 |
+ PRINT_MVM_REF(IWL_MVM_REF_ROC); |
7028 |
++ PRINT_MVM_REF(IWL_MVM_REF_ROC_AUX); |
7029 |
+ PRINT_MVM_REF(IWL_MVM_REF_P2P_CLIENT); |
7030 |
+ PRINT_MVM_REF(IWL_MVM_REF_AP_IBSS); |
7031 |
+ PRINT_MVM_REF(IWL_MVM_REF_USER); |
7032 |
+diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c |
7033 |
+index dda9f7b5f342..60c138a9bf4f 100644 |
7034 |
+--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c |
7035 |
++++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c |
7036 |
+@@ -1404,7 +1404,7 @@ void __iwl_mvm_mac_stop(struct iwl_mvm *mvm) |
7037 |
+ * The work item could be running or queued if the |
7038 |
+ * ROC time event stops just as we get here. |
7039 |
+ */ |
7040 |
+- cancel_work_sync(&mvm->roc_done_wk); |
7041 |
++ flush_work(&mvm->roc_done_wk); |
7042 |
+ |
7043 |
+ iwl_trans_stop_device(mvm->trans); |
7044 |
+ |
7045 |
+diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h |
7046 |
+index cf70f681d1ac..6af21daaaaef 100644 |
7047 |
+--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h |
7048 |
++++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h |
7049 |
+@@ -275,6 +275,7 @@ enum iwl_mvm_ref_type { |
7050 |
+ IWL_MVM_REF_UCODE_DOWN, |
7051 |
+ IWL_MVM_REF_SCAN, |
7052 |
+ IWL_MVM_REF_ROC, |
7053 |
++ IWL_MVM_REF_ROC_AUX, |
7054 |
+ IWL_MVM_REF_P2P_CLIENT, |
7055 |
+ IWL_MVM_REF_AP_IBSS, |
7056 |
+ IWL_MVM_REF_USER, |
7057 |
+diff --git a/drivers/net/wireless/iwlwifi/mvm/time-event.c b/drivers/net/wireless/iwlwifi/mvm/time-event.c |
7058 |
+index fd7b0d36f9a6..a7448cf01688 100644 |
7059 |
+--- a/drivers/net/wireless/iwlwifi/mvm/time-event.c |
7060 |
++++ b/drivers/net/wireless/iwlwifi/mvm/time-event.c |
7061 |
+@@ -6,7 +6,7 @@ |
7062 |
+ * GPL LICENSE SUMMARY |
7063 |
+ * |
7064 |
+ * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
7065 |
+- * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
7066 |
++ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
7067 |
+ * |
7068 |
+ * This program is free software; you can redistribute it and/or modify |
7069 |
+ * it under the terms of version 2 of the GNU General Public License as |
7070 |
+@@ -32,7 +32,7 @@ |
7071 |
+ * BSD LICENSE |
7072 |
+ * |
7073 |
+ * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
7074 |
+- * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
7075 |
++ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
7076 |
+ * All rights reserved. |
7077 |
+ * |
7078 |
+ * Redistribution and use in source and binary forms, with or without |
7079 |
+@@ -108,12 +108,14 @@ void iwl_mvm_roc_done_wk(struct work_struct *wk) |
7080 |
+ * in the case that the time event actually completed in the firmware |
7081 |
+ * (which is handled in iwl_mvm_te_handle_notif). |
7082 |
+ */ |
7083 |
+- if (test_and_clear_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status)) |
7084 |
++ if (test_and_clear_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status)) { |
7085 |
+ queues |= BIT(IWL_MVM_OFFCHANNEL_QUEUE); |
7086 |
+- if (test_and_clear_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status)) |
7087 |
++ iwl_mvm_unref(mvm, IWL_MVM_REF_ROC); |
7088 |
++ } |
7089 |
++ if (test_and_clear_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status)) { |
7090 |
+ queues |= BIT(mvm->aux_queue); |
7091 |
+- |
7092 |
+- iwl_mvm_unref(mvm, IWL_MVM_REF_ROC); |
7093 |
++ iwl_mvm_unref(mvm, IWL_MVM_REF_ROC_AUX); |
7094 |
++ } |
7095 |
+ |
7096 |
+ synchronize_net(); |
7097 |
+ |
7098 |
+@@ -393,6 +395,7 @@ static int iwl_mvm_aux_roc_te_handle_notif(struct iwl_mvm *mvm, |
7099 |
+ } else if (le32_to_cpu(notif->action) == TE_V2_NOTIF_HOST_EVENT_START) { |
7100 |
+ set_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status); |
7101 |
+ te_data->running = true; |
7102 |
++ iwl_mvm_ref(mvm, IWL_MVM_REF_ROC_AUX); |
7103 |
+ ieee80211_ready_on_channel(mvm->hw); /* Start TE */ |
7104 |
+ } else { |
7105 |
+ IWL_DEBUG_TE(mvm, |
7106 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c |
7107 |
+index 86ce5b1930e6..e5d8108f1987 100644 |
7108 |
+--- a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c |
7109 |
++++ b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c |
7110 |
+@@ -1354,27 +1354,11 @@ void rtl88ee_set_qos(struct ieee80211_hw *hw, int aci) |
7111 |
+ } |
7112 |
+ } |
7113 |
+ |
7114 |
+-static void rtl88ee_clear_interrupt(struct ieee80211_hw *hw) |
7115 |
+-{ |
7116 |
+- struct rtl_priv *rtlpriv = rtl_priv(hw); |
7117 |
+- u32 tmp; |
7118 |
+- |
7119 |
+- tmp = rtl_read_dword(rtlpriv, REG_HISR); |
7120 |
+- rtl_write_dword(rtlpriv, REG_HISR, tmp); |
7121 |
+- |
7122 |
+- tmp = rtl_read_dword(rtlpriv, REG_HISRE); |
7123 |
+- rtl_write_dword(rtlpriv, REG_HISRE, tmp); |
7124 |
+- |
7125 |
+- tmp = rtl_read_dword(rtlpriv, REG_HSISR); |
7126 |
+- rtl_write_dword(rtlpriv, REG_HSISR, tmp); |
7127 |
+-} |
7128 |
+- |
7129 |
+ void rtl88ee_enable_interrupt(struct ieee80211_hw *hw) |
7130 |
+ { |
7131 |
+ struct rtl_priv *rtlpriv = rtl_priv(hw); |
7132 |
+ struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
7133 |
+ |
7134 |
+- rtl88ee_clear_interrupt(hw);/*clear it here first*/ |
7135 |
+ rtl_write_dword(rtlpriv, REG_HIMR, |
7136 |
+ rtlpci->irq_mask[0] & 0xFFFFFFFF); |
7137 |
+ rtl_write_dword(rtlpriv, REG_HIMRE, |
7138 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c |
7139 |
+index da0a6125f314..cbf2ca7c7c6d 100644 |
7140 |
+--- a/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c |
7141 |
++++ b/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c |
7142 |
+@@ -1584,28 +1584,11 @@ void rtl92ee_set_qos(struct ieee80211_hw *hw, int aci) |
7143 |
+ } |
7144 |
+ } |
7145 |
+ |
7146 |
+-static void rtl92ee_clear_interrupt(struct ieee80211_hw *hw) |
7147 |
+-{ |
7148 |
+- struct rtl_priv *rtlpriv = rtl_priv(hw); |
7149 |
+- u32 tmp; |
7150 |
+- |
7151 |
+- tmp = rtl_read_dword(rtlpriv, REG_HISR); |
7152 |
+- rtl_write_dword(rtlpriv, REG_HISR, tmp); |
7153 |
+- |
7154 |
+- tmp = rtl_read_dword(rtlpriv, REG_HISRE); |
7155 |
+- rtl_write_dword(rtlpriv, REG_HISRE, tmp); |
7156 |
+- |
7157 |
+- tmp = rtl_read_dword(rtlpriv, REG_HSISR); |
7158 |
+- rtl_write_dword(rtlpriv, REG_HSISR, tmp); |
7159 |
+-} |
7160 |
+- |
7161 |
+ void rtl92ee_enable_interrupt(struct ieee80211_hw *hw) |
7162 |
+ { |
7163 |
+ struct rtl_priv *rtlpriv = rtl_priv(hw); |
7164 |
+ struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
7165 |
+ |
7166 |
+- rtl92ee_clear_interrupt(hw);/*clear it here first*/ |
7167 |
+- |
7168 |
+ rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF); |
7169 |
+ rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF); |
7170 |
+ rtlpci->irq_enabled = true; |
7171 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c |
7172 |
+index 67bb47d77b68..a4b7eac6856f 100644 |
7173 |
+--- a/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c |
7174 |
++++ b/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c |
7175 |
+@@ -1258,18 +1258,6 @@ void rtl8723e_set_qos(struct ieee80211_hw *hw, int aci) |
7176 |
+ } |
7177 |
+ } |
7178 |
+ |
7179 |
+-static void rtl8723e_clear_interrupt(struct ieee80211_hw *hw) |
7180 |
+-{ |
7181 |
+- struct rtl_priv *rtlpriv = rtl_priv(hw); |
7182 |
+- u32 tmp; |
7183 |
+- |
7184 |
+- tmp = rtl_read_dword(rtlpriv, REG_HISR); |
7185 |
+- rtl_write_dword(rtlpriv, REG_HISR, tmp); |
7186 |
+- |
7187 |
+- tmp = rtl_read_dword(rtlpriv, REG_HISRE); |
7188 |
+- rtl_write_dword(rtlpriv, REG_HISRE, tmp); |
7189 |
+-} |
7190 |
+- |
7191 |
+ void rtl8723e_enable_interrupt(struct ieee80211_hw *hw) |
7192 |
+ { |
7193 |
+ struct rtl_priv *rtlpriv = rtl_priv(hw); |
7194 |
+@@ -1284,7 +1272,6 @@ void rtl8723e_disable_interrupt(struct ieee80211_hw *hw) |
7195 |
+ { |
7196 |
+ struct rtl_priv *rtlpriv = rtl_priv(hw); |
7197 |
+ struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
7198 |
+- rtl8723e_clear_interrupt(hw);/*clear it here first*/ |
7199 |
+ rtl_write_dword(rtlpriv, 0x3a8, IMR8190_DISABLED); |
7200 |
+ rtl_write_dword(rtlpriv, 0x3ac, IMR8190_DISABLED); |
7201 |
+ rtlpci->irq_enabled = false; |
7202 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/rtlwifi/rtl8723be/hw.c |
7203 |
+index b681af3c7a35..b9417268427e 100644 |
7204 |
+--- a/drivers/net/wireless/rtlwifi/rtl8723be/hw.c |
7205 |
++++ b/drivers/net/wireless/rtlwifi/rtl8723be/hw.c |
7206 |
+@@ -1634,28 +1634,11 @@ void rtl8723be_set_qos(struct ieee80211_hw *hw, int aci) |
7207 |
+ } |
7208 |
+ } |
7209 |
+ |
7210 |
+-static void rtl8723be_clear_interrupt(struct ieee80211_hw *hw) |
7211 |
+-{ |
7212 |
+- struct rtl_priv *rtlpriv = rtl_priv(hw); |
7213 |
+- u32 tmp; |
7214 |
+- |
7215 |
+- tmp = rtl_read_dword(rtlpriv, REG_HISR); |
7216 |
+- rtl_write_dword(rtlpriv, REG_HISR, tmp); |
7217 |
+- |
7218 |
+- tmp = rtl_read_dword(rtlpriv, REG_HISRE); |
7219 |
+- rtl_write_dword(rtlpriv, REG_HISRE, tmp); |
7220 |
+- |
7221 |
+- tmp = rtl_read_dword(rtlpriv, REG_HSISR); |
7222 |
+- rtl_write_dword(rtlpriv, REG_HSISR, tmp); |
7223 |
+-} |
7224 |
+- |
7225 |
+ void rtl8723be_enable_interrupt(struct ieee80211_hw *hw) |
7226 |
+ { |
7227 |
+ struct rtl_priv *rtlpriv = rtl_priv(hw); |
7228 |
+ struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
7229 |
+ |
7230 |
+- rtl8723be_clear_interrupt(hw);/*clear it here first*/ |
7231 |
+- |
7232 |
+ rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF); |
7233 |
+ rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF); |
7234 |
+ rtlpci->irq_enabled = true; |
7235 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c |
7236 |
+index 8704eee9f3a4..57966e3c8e8d 100644 |
7237 |
+--- a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c |
7238 |
++++ b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c |
7239 |
+@@ -2253,31 +2253,11 @@ void rtl8821ae_set_qos(struct ieee80211_hw *hw, int aci) |
7240 |
+ } |
7241 |
+ } |
7242 |
+ |
7243 |
+-static void rtl8821ae_clear_interrupt(struct ieee80211_hw *hw) |
7244 |
+-{ |
7245 |
+- struct rtl_priv *rtlpriv = rtl_priv(hw); |
7246 |
+- u32 tmp; |
7247 |
+- tmp = rtl_read_dword(rtlpriv, REG_HISR); |
7248 |
+- /*printk("clear interrupt first:\n"); |
7249 |
+- printk("0x%x = 0x%08x\n",REG_HISR, tmp);*/ |
7250 |
+- rtl_write_dword(rtlpriv, REG_HISR, tmp); |
7251 |
+- |
7252 |
+- tmp = rtl_read_dword(rtlpriv, REG_HISRE); |
7253 |
+- /*printk("0x%x = 0x%08x\n",REG_HISRE, tmp);*/ |
7254 |
+- rtl_write_dword(rtlpriv, REG_HISRE, tmp); |
7255 |
+- |
7256 |
+- tmp = rtl_read_dword(rtlpriv, REG_HSISR); |
7257 |
+- /*printk("0x%x = 0x%08x\n",REG_HSISR, tmp);*/ |
7258 |
+- rtl_write_dword(rtlpriv, REG_HSISR, tmp); |
7259 |
+-} |
7260 |
+- |
7261 |
+ void rtl8821ae_enable_interrupt(struct ieee80211_hw *hw) |
7262 |
+ { |
7263 |
+ struct rtl_priv *rtlpriv = rtl_priv(hw); |
7264 |
+ struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
7265 |
+ |
7266 |
+- rtl8821ae_clear_interrupt(hw);/*clear it here first*/ |
7267 |
+- |
7268 |
+ rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF); |
7269 |
+ rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF); |
7270 |
+ rtlpci->irq_enabled = true; |
7271 |
+diff --git a/drivers/nfc/st21nfcb/i2c.c b/drivers/nfc/st21nfcb/i2c.c |
7272 |
+index 76a4cad41cec..c44f8cf5391a 100644 |
7273 |
+--- a/drivers/nfc/st21nfcb/i2c.c |
7274 |
++++ b/drivers/nfc/st21nfcb/i2c.c |
7275 |
+@@ -87,11 +87,6 @@ static void st21nfcb_nci_i2c_disable(void *phy_id) |
7276 |
+ gpio_set_value(phy->gpio_reset, 1); |
7277 |
+ } |
7278 |
+ |
7279 |
+-static void st21nfcb_nci_remove_header(struct sk_buff *skb) |
7280 |
+-{ |
7281 |
+- skb_pull(skb, ST21NFCB_FRAME_HEADROOM); |
7282 |
+-} |
7283 |
+- |
7284 |
+ /* |
7285 |
+ * Writing a frame must not return the number of written bytes. |
7286 |
+ * It must return either zero for success, or <0 for error. |
7287 |
+@@ -121,8 +116,6 @@ static int st21nfcb_nci_i2c_write(void *phy_id, struct sk_buff *skb) |
7288 |
+ r = 0; |
7289 |
+ } |
7290 |
+ |
7291 |
+- st21nfcb_nci_remove_header(skb); |
7292 |
+- |
7293 |
+ return r; |
7294 |
+ } |
7295 |
+ |
7296 |
+@@ -366,9 +359,6 @@ static int st21nfcb_nci_i2c_remove(struct i2c_client *client) |
7297 |
+ |
7298 |
+ ndlc_remove(phy->ndlc); |
7299 |
+ |
7300 |
+- if (phy->powered) |
7301 |
+- st21nfcb_nci_i2c_disable(phy); |
7302 |
+- |
7303 |
+ return 0; |
7304 |
+ } |
7305 |
+ |
7306 |
+diff --git a/drivers/nfc/st21nfcb/st21nfcb.c b/drivers/nfc/st21nfcb/st21nfcb.c |
7307 |
+index ca9871ab3fb3..c7dc282d5c3b 100644 |
7308 |
+--- a/drivers/nfc/st21nfcb/st21nfcb.c |
7309 |
++++ b/drivers/nfc/st21nfcb/st21nfcb.c |
7310 |
+@@ -131,11 +131,8 @@ EXPORT_SYMBOL_GPL(st21nfcb_nci_probe); |
7311 |
+ |
7312 |
+ void st21nfcb_nci_remove(struct nci_dev *ndev) |
7313 |
+ { |
7314 |
+- struct st21nfcb_nci_info *info = nci_get_drvdata(ndev); |
7315 |
+- |
7316 |
+ nci_unregister_device(ndev); |
7317 |
+ nci_free_device(ndev); |
7318 |
+- kfree(info); |
7319 |
+ } |
7320 |
+ EXPORT_SYMBOL_GPL(st21nfcb_nci_remove); |
7321 |
+ |
7322 |
+diff --git a/drivers/of/address.c b/drivers/of/address.c |
7323 |
+index 6906a3f61bd8..8bfda6ade2c0 100644 |
7324 |
+--- a/drivers/of/address.c |
7325 |
++++ b/drivers/of/address.c |
7326 |
+@@ -712,7 +712,7 @@ int __weak pci_register_io_range(phys_addr_t addr, resource_size_t size) |
7327 |
+ } |
7328 |
+ |
7329 |
+ /* add the range to the list */ |
7330 |
+- range = kzalloc(sizeof(*range), GFP_KERNEL); |
7331 |
++ range = kzalloc(sizeof(*range), GFP_ATOMIC); |
7332 |
+ if (!range) { |
7333 |
+ err = -ENOMEM; |
7334 |
+ goto end_register; |
7335 |
+diff --git a/drivers/of/base.c b/drivers/of/base.c |
7336 |
+index f0650265febf..5ed97246c2e7 100644 |
7337 |
+--- a/drivers/of/base.c |
7338 |
++++ b/drivers/of/base.c |
7339 |
+@@ -89,7 +89,7 @@ EXPORT_SYMBOL(of_n_size_cells); |
7340 |
+ #ifdef CONFIG_NUMA |
7341 |
+ int __weak of_node_to_nid(struct device_node *np) |
7342 |
+ { |
7343 |
+- return numa_node_id(); |
7344 |
++ return NUMA_NO_NODE; |
7345 |
+ } |
7346 |
+ #endif |
7347 |
+ |
7348 |
+diff --git a/drivers/phy/phy-berlin-usb.c b/drivers/phy/phy-berlin-usb.c |
7349 |
+index c6fc95b53083..ab54f2864451 100644 |
7350 |
+--- a/drivers/phy/phy-berlin-usb.c |
7351 |
++++ b/drivers/phy/phy-berlin-usb.c |
7352 |
+@@ -106,8 +106,8 @@ |
7353 |
+ static const u32 phy_berlin_pll_dividers[] = { |
7354 |
+ /* Berlin 2 */ |
7355 |
+ CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54), |
7356 |
+- /* Berlin 2CD */ |
7357 |
+- CLK_REF_DIV(0x6) | FEEDBACK_CLK_DIV(0x55), |
7358 |
++ /* Berlin 2CD/Q */ |
7359 |
++ CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54), |
7360 |
+ }; |
7361 |
+ |
7362 |
+ struct phy_berlin_usb_priv { |
7363 |
+diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c |
7364 |
+index bc42d6a8939f..8882afbef688 100644 |
7365 |
+--- a/drivers/phy/phy-twl4030-usb.c |
7366 |
++++ b/drivers/phy/phy-twl4030-usb.c |
7367 |
+@@ -711,7 +711,6 @@ static int twl4030_usb_probe(struct platform_device *pdev) |
7368 |
+ pm_runtime_use_autosuspend(&pdev->dev); |
7369 |
+ pm_runtime_set_autosuspend_delay(&pdev->dev, 2000); |
7370 |
+ pm_runtime_enable(&pdev->dev); |
7371 |
+- pm_runtime_get_sync(&pdev->dev); |
7372 |
+ |
7373 |
+ /* Our job is to use irqs and status from the power module |
7374 |
+ * to keep the transceiver disabled when nothing's connected. |
7375 |
+diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-370.c b/drivers/pinctrl/mvebu/pinctrl-armada-370.c |
7376 |
+index 03aa58c4cb85..1eb084c3b0c9 100644 |
7377 |
+--- a/drivers/pinctrl/mvebu/pinctrl-armada-370.c |
7378 |
++++ b/drivers/pinctrl/mvebu/pinctrl-armada-370.c |
7379 |
+@@ -370,11 +370,11 @@ static struct mvebu_mpp_mode mv88f6710_mpp_modes[] = { |
7380 |
+ MPP_MODE(64, |
7381 |
+ MPP_FUNCTION(0x0, "gpio", NULL), |
7382 |
+ MPP_FUNCTION(0x1, "spi0", "miso"), |
7383 |
+- MPP_FUNCTION(0x2, "spi0-1", "cs1")), |
7384 |
++ MPP_FUNCTION(0x2, "spi0", "cs1")), |
7385 |
+ MPP_MODE(65, |
7386 |
+ MPP_FUNCTION(0x0, "gpio", NULL), |
7387 |
+ MPP_FUNCTION(0x1, "spi0", "mosi"), |
7388 |
+- MPP_FUNCTION(0x2, "spi0-1", "cs2")), |
7389 |
++ MPP_FUNCTION(0x2, "spi0", "cs2")), |
7390 |
+ }; |
7391 |
+ |
7392 |
+ static struct mvebu_pinctrl_soc_info armada_370_pinctrl_info; |
7393 |
+diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-375.c b/drivers/pinctrl/mvebu/pinctrl-armada-375.c |
7394 |
+index ca1e7571fedb..203291bde608 100644 |
7395 |
+--- a/drivers/pinctrl/mvebu/pinctrl-armada-375.c |
7396 |
++++ b/drivers/pinctrl/mvebu/pinctrl-armada-375.c |
7397 |
+@@ -92,19 +92,17 @@ static struct mvebu_mpp_mode mv88f6720_mpp_modes[] = { |
7398 |
+ MPP_FUNCTION(0x5, "nand", "io1")), |
7399 |
+ MPP_MODE(8, |
7400 |
+ MPP_FUNCTION(0x0, "gpio", NULL), |
7401 |
+- MPP_FUNCTION(0x1, "dev ", "bootcs"), |
7402 |
++ MPP_FUNCTION(0x1, "dev", "bootcs"), |
7403 |
+ MPP_FUNCTION(0x2, "spi0", "cs0"), |
7404 |
+ MPP_FUNCTION(0x3, "spi1", "cs0"), |
7405 |
+ MPP_FUNCTION(0x5, "nand", "ce")), |
7406 |
+ MPP_MODE(9, |
7407 |
+ MPP_FUNCTION(0x0, "gpio", NULL), |
7408 |
+- MPP_FUNCTION(0x1, "nf", "wen"), |
7409 |
+ MPP_FUNCTION(0x2, "spi0", "sck"), |
7410 |
+ MPP_FUNCTION(0x3, "spi1", "sck"), |
7411 |
+ MPP_FUNCTION(0x5, "nand", "we")), |
7412 |
+ MPP_MODE(10, |
7413 |
+ MPP_FUNCTION(0x0, "gpio", NULL), |
7414 |
+- MPP_FUNCTION(0x1, "nf", "ren"), |
7415 |
+ MPP_FUNCTION(0x2, "dram", "vttctrl"), |
7416 |
+ MPP_FUNCTION(0x3, "led", "c1"), |
7417 |
+ MPP_FUNCTION(0x5, "nand", "re"), |
7418 |
+diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-38x.c b/drivers/pinctrl/mvebu/pinctrl-armada-38x.c |
7419 |
+index 83bbcc72be1f..ff411a53b5a4 100644 |
7420 |
+--- a/drivers/pinctrl/mvebu/pinctrl-armada-38x.c |
7421 |
++++ b/drivers/pinctrl/mvebu/pinctrl-armada-38x.c |
7422 |
+@@ -94,37 +94,39 @@ static struct mvebu_mpp_mode armada_38x_mpp_modes[] = { |
7423 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7424 |
+ MPP_VAR_FUNCTION(1, "ge0", "rxd0", V_88F6810_PLUS), |
7425 |
+ MPP_VAR_FUNCTION(2, "pcie0", "rstout", V_88F6810_PLUS), |
7426 |
+- MPP_VAR_FUNCTION(3, "pcie1", "rstout", V_88F6820_PLUS), |
7427 |
+ MPP_VAR_FUNCTION(4, "spi0", "cs1", V_88F6810_PLUS), |
7428 |
+- MPP_VAR_FUNCTION(5, "dev", "ad14", V_88F6810_PLUS)), |
7429 |
++ MPP_VAR_FUNCTION(5, "dev", "ad14", V_88F6810_PLUS), |
7430 |
++ MPP_VAR_FUNCTION(6, "pcie3", "clkreq", V_88F6810_PLUS)), |
7431 |
+ MPP_MODE(13, |
7432 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7433 |
+ MPP_VAR_FUNCTION(1, "ge0", "rxd1", V_88F6810_PLUS), |
7434 |
+ MPP_VAR_FUNCTION(2, "pcie0", "clkreq", V_88F6810_PLUS), |
7435 |
+ MPP_VAR_FUNCTION(3, "pcie1", "clkreq", V_88F6820_PLUS), |
7436 |
+ MPP_VAR_FUNCTION(4, "spi0", "cs2", V_88F6810_PLUS), |
7437 |
+- MPP_VAR_FUNCTION(5, "dev", "ad15", V_88F6810_PLUS)), |
7438 |
++ MPP_VAR_FUNCTION(5, "dev", "ad15", V_88F6810_PLUS), |
7439 |
++ MPP_VAR_FUNCTION(6, "pcie2", "clkreq", V_88F6810_PLUS)), |
7440 |
+ MPP_MODE(14, |
7441 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7442 |
+ MPP_VAR_FUNCTION(1, "ge0", "rxd2", V_88F6810_PLUS), |
7443 |
+ MPP_VAR_FUNCTION(2, "ptp", "clk", V_88F6810_PLUS), |
7444 |
+ MPP_VAR_FUNCTION(3, "m", "vtt_ctrl", V_88F6810_PLUS), |
7445 |
+ MPP_VAR_FUNCTION(4, "spi0", "cs3", V_88F6810_PLUS), |
7446 |
+- MPP_VAR_FUNCTION(5, "dev", "wen1", V_88F6810_PLUS)), |
7447 |
++ MPP_VAR_FUNCTION(5, "dev", "wen1", V_88F6810_PLUS), |
7448 |
++ MPP_VAR_FUNCTION(6, "pcie3", "clkreq", V_88F6810_PLUS)), |
7449 |
+ MPP_MODE(15, |
7450 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7451 |
+ MPP_VAR_FUNCTION(1, "ge0", "rxd3", V_88F6810_PLUS), |
7452 |
+ MPP_VAR_FUNCTION(2, "ge", "mdc slave", V_88F6810_PLUS), |
7453 |
+ MPP_VAR_FUNCTION(3, "pcie0", "rstout", V_88F6810_PLUS), |
7454 |
+- MPP_VAR_FUNCTION(4, "spi0", "mosi", V_88F6810_PLUS), |
7455 |
+- MPP_VAR_FUNCTION(5, "pcie1", "rstout", V_88F6820_PLUS)), |
7456 |
++ MPP_VAR_FUNCTION(4, "spi0", "mosi", V_88F6810_PLUS)), |
7457 |
+ MPP_MODE(16, |
7458 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7459 |
+ MPP_VAR_FUNCTION(1, "ge0", "rxctl", V_88F6810_PLUS), |
7460 |
+ MPP_VAR_FUNCTION(2, "ge", "mdio slave", V_88F6810_PLUS), |
7461 |
+ MPP_VAR_FUNCTION(3, "m", "decc_err", V_88F6810_PLUS), |
7462 |
+ MPP_VAR_FUNCTION(4, "spi0", "miso", V_88F6810_PLUS), |
7463 |
+- MPP_VAR_FUNCTION(5, "pcie0", "clkreq", V_88F6810_PLUS)), |
7464 |
++ MPP_VAR_FUNCTION(5, "pcie0", "clkreq", V_88F6810_PLUS), |
7465 |
++ MPP_VAR_FUNCTION(6, "pcie1", "clkreq", V_88F6820_PLUS)), |
7466 |
+ MPP_MODE(17, |
7467 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7468 |
+ MPP_VAR_FUNCTION(1, "ge0", "rxclk", V_88F6810_PLUS), |
7469 |
+@@ -137,13 +139,12 @@ static struct mvebu_mpp_mode armada_38x_mpp_modes[] = { |
7470 |
+ MPP_VAR_FUNCTION(1, "ge0", "rxerr", V_88F6810_PLUS), |
7471 |
+ MPP_VAR_FUNCTION(2, "ptp", "trig_gen", V_88F6810_PLUS), |
7472 |
+ MPP_VAR_FUNCTION(3, "ua1", "txd", V_88F6810_PLUS), |
7473 |
+- MPP_VAR_FUNCTION(4, "spi0", "cs0", V_88F6810_PLUS), |
7474 |
+- MPP_VAR_FUNCTION(5, "pcie1", "rstout", V_88F6820_PLUS)), |
7475 |
++ MPP_VAR_FUNCTION(4, "spi0", "cs0", V_88F6810_PLUS)), |
7476 |
+ MPP_MODE(19, |
7477 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7478 |
+ MPP_VAR_FUNCTION(1, "ge0", "col", V_88F6810_PLUS), |
7479 |
+ MPP_VAR_FUNCTION(2, "ptp", "event_req", V_88F6810_PLUS), |
7480 |
+- MPP_VAR_FUNCTION(3, "pcie0", "clkreq", V_88F6810_PLUS), |
7481 |
++ MPP_VAR_FUNCTION(3, "ge0", "txerr", V_88F6810_PLUS), |
7482 |
+ MPP_VAR_FUNCTION(4, "sata1", "prsnt", V_88F6810_PLUS), |
7483 |
+ MPP_VAR_FUNCTION(5, "ua0", "cts", V_88F6810_PLUS), |
7484 |
+ MPP_VAR_FUNCTION(6, "ua1", "rxd", V_88F6810_PLUS)), |
7485 |
+@@ -151,7 +152,6 @@ static struct mvebu_mpp_mode armada_38x_mpp_modes[] = { |
7486 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7487 |
+ MPP_VAR_FUNCTION(1, "ge0", "txclk", V_88F6810_PLUS), |
7488 |
+ MPP_VAR_FUNCTION(2, "ptp", "clk", V_88F6810_PLUS), |
7489 |
+- MPP_VAR_FUNCTION(3, "pcie1", "rstout", V_88F6820_PLUS), |
7490 |
+ MPP_VAR_FUNCTION(4, "sata0", "prsnt", V_88F6810_PLUS), |
7491 |
+ MPP_VAR_FUNCTION(5, "ua0", "rts", V_88F6810_PLUS), |
7492 |
+ MPP_VAR_FUNCTION(6, "ua1", "txd", V_88F6810_PLUS)), |
7493 |
+@@ -277,35 +277,27 @@ static struct mvebu_mpp_mode armada_38x_mpp_modes[] = { |
7494 |
+ MPP_VAR_FUNCTION(1, "pcie0", "clkreq", V_88F6810_PLUS), |
7495 |
+ MPP_VAR_FUNCTION(2, "m", "vtt_ctrl", V_88F6810_PLUS), |
7496 |
+ MPP_VAR_FUNCTION(3, "m", "decc_err", V_88F6810_PLUS), |
7497 |
+- MPP_VAR_FUNCTION(4, "pcie0", "rstout", V_88F6810_PLUS), |
7498 |
++ MPP_VAR_FUNCTION(4, "spi1", "cs2", V_88F6810_PLUS), |
7499 |
+ MPP_VAR_FUNCTION(5, "dev", "clkout", V_88F6810_PLUS)), |
7500 |
+ MPP_MODE(44, |
7501 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7502 |
+ MPP_VAR_FUNCTION(1, "sata0", "prsnt", V_88F6810_PLUS), |
7503 |
+ MPP_VAR_FUNCTION(2, "sata1", "prsnt", V_88F6810_PLUS), |
7504 |
+ MPP_VAR_FUNCTION(3, "sata2", "prsnt", V_88F6828), |
7505 |
+- MPP_VAR_FUNCTION(4, "sata3", "prsnt", V_88F6828), |
7506 |
+- MPP_VAR_FUNCTION(5, "pcie0", "rstout", V_88F6810_PLUS)), |
7507 |
++ MPP_VAR_FUNCTION(4, "sata3", "prsnt", V_88F6828)), |
7508 |
+ MPP_MODE(45, |
7509 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7510 |
+ MPP_VAR_FUNCTION(1, "ref", "clk_out0", V_88F6810_PLUS), |
7511 |
+- MPP_VAR_FUNCTION(2, "pcie0", "rstout", V_88F6810_PLUS), |
7512 |
+- MPP_VAR_FUNCTION(3, "pcie1", "rstout", V_88F6820_PLUS), |
7513 |
+- MPP_VAR_FUNCTION(4, "pcie2", "rstout", V_88F6810_PLUS), |
7514 |
+- MPP_VAR_FUNCTION(5, "pcie3", "rstout", V_88F6810_PLUS)), |
7515 |
++ MPP_VAR_FUNCTION(2, "pcie0", "rstout", V_88F6810_PLUS)), |
7516 |
+ MPP_MODE(46, |
7517 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7518 |
+ MPP_VAR_FUNCTION(1, "ref", "clk_out1", V_88F6810_PLUS), |
7519 |
+- MPP_VAR_FUNCTION(2, "pcie0", "rstout", V_88F6810_PLUS), |
7520 |
+- MPP_VAR_FUNCTION(3, "pcie1", "rstout", V_88F6820_PLUS), |
7521 |
+- MPP_VAR_FUNCTION(4, "pcie2", "rstout", V_88F6810_PLUS), |
7522 |
+- MPP_VAR_FUNCTION(5, "pcie3", "rstout", V_88F6810_PLUS)), |
7523 |
++ MPP_VAR_FUNCTION(2, "pcie0", "rstout", V_88F6810_PLUS)), |
7524 |
+ MPP_MODE(47, |
7525 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7526 |
+ MPP_VAR_FUNCTION(1, "sata0", "prsnt", V_88F6810_PLUS), |
7527 |
+ MPP_VAR_FUNCTION(2, "sata1", "prsnt", V_88F6810_PLUS), |
7528 |
+ MPP_VAR_FUNCTION(3, "sata2", "prsnt", V_88F6828), |
7529 |
+- MPP_VAR_FUNCTION(4, "spi1", "cs2", V_88F6810_PLUS), |
7530 |
+ MPP_VAR_FUNCTION(5, "sata3", "prsnt", V_88F6828)), |
7531 |
+ MPP_MODE(48, |
7532 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7533 |
+@@ -313,18 +305,19 @@ static struct mvebu_mpp_mode armada_38x_mpp_modes[] = { |
7534 |
+ MPP_VAR_FUNCTION(2, "m", "vtt_ctrl", V_88F6810_PLUS), |
7535 |
+ MPP_VAR_FUNCTION(3, "tdm2c", "pclk", V_88F6810_PLUS), |
7536 |
+ MPP_VAR_FUNCTION(4, "audio", "mclk", V_88F6810_PLUS), |
7537 |
+- MPP_VAR_FUNCTION(5, "sd0", "d4", V_88F6810_PLUS)), |
7538 |
++ MPP_VAR_FUNCTION(5, "sd0", "d4", V_88F6810_PLUS), |
7539 |
++ MPP_VAR_FUNCTION(6, "pcie0", "clkreq", V_88F6810_PLUS)), |
7540 |
+ MPP_MODE(49, |
7541 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7542 |
+ MPP_VAR_FUNCTION(1, "sata2", "prsnt", V_88F6828), |
7543 |
+ MPP_VAR_FUNCTION(2, "sata3", "prsnt", V_88F6828), |
7544 |
+ MPP_VAR_FUNCTION(3, "tdm2c", "fsync", V_88F6810_PLUS), |
7545 |
+ MPP_VAR_FUNCTION(4, "audio", "lrclk", V_88F6810_PLUS), |
7546 |
+- MPP_VAR_FUNCTION(5, "sd0", "d5", V_88F6810_PLUS)), |
7547 |
++ MPP_VAR_FUNCTION(5, "sd0", "d5", V_88F6810_PLUS), |
7548 |
++ MPP_VAR_FUNCTION(6, "pcie1", "clkreq", V_88F6820_PLUS)), |
7549 |
+ MPP_MODE(50, |
7550 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7551 |
+ MPP_VAR_FUNCTION(1, "pcie0", "rstout", V_88F6810_PLUS), |
7552 |
+- MPP_VAR_FUNCTION(2, "pcie1", "rstout", V_88F6820_PLUS), |
7553 |
+ MPP_VAR_FUNCTION(3, "tdm2c", "drx", V_88F6810_PLUS), |
7554 |
+ MPP_VAR_FUNCTION(4, "audio", "extclk", V_88F6810_PLUS), |
7555 |
+ MPP_VAR_FUNCTION(5, "sd0", "cmd", V_88F6810_PLUS)), |
7556 |
+@@ -336,7 +329,6 @@ static struct mvebu_mpp_mode armada_38x_mpp_modes[] = { |
7557 |
+ MPP_MODE(52, |
7558 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7559 |
+ MPP_VAR_FUNCTION(1, "pcie0", "rstout", V_88F6810_PLUS), |
7560 |
+- MPP_VAR_FUNCTION(2, "pcie1", "rstout", V_88F6820_PLUS), |
7561 |
+ MPP_VAR_FUNCTION(3, "tdm2c", "intn", V_88F6810_PLUS), |
7562 |
+ MPP_VAR_FUNCTION(4, "audio", "sdi", V_88F6810_PLUS), |
7563 |
+ MPP_VAR_FUNCTION(5, "sd0", "d6", V_88F6810_PLUS)), |
7564 |
+@@ -352,7 +344,7 @@ static struct mvebu_mpp_mode armada_38x_mpp_modes[] = { |
7565 |
+ MPP_VAR_FUNCTION(1, "sata0", "prsnt", V_88F6810_PLUS), |
7566 |
+ MPP_VAR_FUNCTION(2, "sata1", "prsnt", V_88F6810_PLUS), |
7567 |
+ MPP_VAR_FUNCTION(3, "pcie0", "rstout", V_88F6810_PLUS), |
7568 |
+- MPP_VAR_FUNCTION(4, "pcie1", "rstout", V_88F6820_PLUS), |
7569 |
++ MPP_VAR_FUNCTION(4, "ge0", "txerr", V_88F6810_PLUS), |
7570 |
+ MPP_VAR_FUNCTION(5, "sd0", "d3", V_88F6810_PLUS)), |
7571 |
+ MPP_MODE(55, |
7572 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7573 |
+@@ -382,7 +374,6 @@ static struct mvebu_mpp_mode armada_38x_mpp_modes[] = { |
7574 |
+ MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), |
7575 |
+ MPP_VAR_FUNCTION(1, "pcie0", "rstout", V_88F6810_PLUS), |
7576 |
+ MPP_VAR_FUNCTION(2, "i2c1", "sda", V_88F6810_PLUS), |
7577 |
+- MPP_VAR_FUNCTION(3, "pcie1", "rstout", V_88F6820_PLUS), |
7578 |
+ MPP_VAR_FUNCTION(4, "spi1", "cs0", V_88F6810_PLUS), |
7579 |
+ MPP_VAR_FUNCTION(5, "sd0", "d2", V_88F6810_PLUS)), |
7580 |
+ }; |
7581 |
+@@ -411,7 +402,7 @@ static struct mvebu_mpp_ctrl armada_38x_mpp_controls[] = { |
7582 |
+ |
7583 |
+ static struct pinctrl_gpio_range armada_38x_mpp_gpio_ranges[] = { |
7584 |
+ MPP_GPIO_RANGE(0, 0, 0, 32), |
7585 |
+- MPP_GPIO_RANGE(1, 32, 32, 27), |
7586 |
++ MPP_GPIO_RANGE(1, 32, 32, 28), |
7587 |
+ }; |
7588 |
+ |
7589 |
+ static int armada_38x_pinctrl_probe(struct platform_device *pdev) |
7590 |
+diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-39x.c b/drivers/pinctrl/mvebu/pinctrl-armada-39x.c |
7591 |
+index 42491624d660..2dcf9b41e01e 100644 |
7592 |
+--- a/drivers/pinctrl/mvebu/pinctrl-armada-39x.c |
7593 |
++++ b/drivers/pinctrl/mvebu/pinctrl-armada-39x.c |
7594 |
+@@ -380,7 +380,7 @@ static struct mvebu_mpp_ctrl armada_39x_mpp_controls[] = { |
7595 |
+ |
7596 |
+ static struct pinctrl_gpio_range armada_39x_mpp_gpio_ranges[] = { |
7597 |
+ MPP_GPIO_RANGE(0, 0, 0, 32), |
7598 |
+- MPP_GPIO_RANGE(1, 32, 32, 27), |
7599 |
++ MPP_GPIO_RANGE(1, 32, 32, 28), |
7600 |
+ }; |
7601 |
+ |
7602 |
+ static int armada_39x_pinctrl_probe(struct platform_device *pdev) |
7603 |
+diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-xp.c b/drivers/pinctrl/mvebu/pinctrl-armada-xp.c |
7604 |
+index 578db9f033b2..d7cdb146f44d 100644 |
7605 |
+--- a/drivers/pinctrl/mvebu/pinctrl-armada-xp.c |
7606 |
++++ b/drivers/pinctrl/mvebu/pinctrl-armada-xp.c |
7607 |
+@@ -14,10 +14,7 @@ |
7608 |
+ * available: mv78230, mv78260 and mv78460. From a pin muxing |
7609 |
+ * perspective, the mv78230 has 49 MPP pins. The mv78260 and mv78460 |
7610 |
+ * both have 67 MPP pins (more GPIOs and address lines for the memory |
7611 |
+- * bus mainly). The only difference between the mv78260 and the |
7612 |
+- * mv78460 in terms of pin muxing is the addition of two functions on |
7613 |
+- * pins 43 and 56 to access the VDD of the CPU2 and 3 (mv78260 has two |
7614 |
+- * cores, mv78460 has four cores). |
7615 |
++ * bus mainly). |
7616 |
+ */ |
7617 |
+ |
7618 |
+ #include <linux/err.h> |
7619 |
+@@ -172,20 +169,17 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { |
7620 |
+ MPP_MODE(24, |
7621 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), |
7622 |
+ MPP_VAR_FUNCTION(0x1, "sata1", "prsnt", V_MV78230_PLUS), |
7623 |
+- MPP_VAR_FUNCTION(0x2, "nf", "bootcs-re", V_MV78230_PLUS), |
7624 |
+ MPP_VAR_FUNCTION(0x3, "tdm", "rst", V_MV78230_PLUS), |
7625 |
+ MPP_VAR_FUNCTION(0x4, "lcd", "hsync", V_MV78230_PLUS)), |
7626 |
+ MPP_MODE(25, |
7627 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), |
7628 |
+ MPP_VAR_FUNCTION(0x1, "sata0", "prsnt", V_MV78230_PLUS), |
7629 |
+- MPP_VAR_FUNCTION(0x2, "nf", "bootcs-we", V_MV78230_PLUS), |
7630 |
+ MPP_VAR_FUNCTION(0x3, "tdm", "pclk", V_MV78230_PLUS), |
7631 |
+ MPP_VAR_FUNCTION(0x4, "lcd", "vsync", V_MV78230_PLUS)), |
7632 |
+ MPP_MODE(26, |
7633 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), |
7634 |
+ MPP_VAR_FUNCTION(0x3, "tdm", "fsync", V_MV78230_PLUS), |
7635 |
+- MPP_VAR_FUNCTION(0x4, "lcd", "clk", V_MV78230_PLUS), |
7636 |
+- MPP_VAR_FUNCTION(0x5, "vdd", "cpu1-pd", V_MV78230_PLUS)), |
7637 |
++ MPP_VAR_FUNCTION(0x4, "lcd", "clk", V_MV78230_PLUS)), |
7638 |
+ MPP_MODE(27, |
7639 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), |
7640 |
+ MPP_VAR_FUNCTION(0x1, "ptp", "trig", V_MV78230_PLUS), |
7641 |
+@@ -200,8 +194,7 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { |
7642 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), |
7643 |
+ MPP_VAR_FUNCTION(0x1, "ptp", "clk", V_MV78230_PLUS), |
7644 |
+ MPP_VAR_FUNCTION(0x3, "tdm", "int0", V_MV78230_PLUS), |
7645 |
+- MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk", V_MV78230_PLUS), |
7646 |
+- MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd", V_MV78230_PLUS)), |
7647 |
++ MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk", V_MV78230_PLUS)), |
7648 |
+ MPP_MODE(30, |
7649 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), |
7650 |
+ MPP_VAR_FUNCTION(0x1, "sd0", "clk", V_MV78230_PLUS), |
7651 |
+@@ -209,13 +202,11 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { |
7652 |
+ MPP_MODE(31, |
7653 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), |
7654 |
+ MPP_VAR_FUNCTION(0x1, "sd0", "cmd", V_MV78230_PLUS), |
7655 |
+- MPP_VAR_FUNCTION(0x3, "tdm", "int2", V_MV78230_PLUS), |
7656 |
+- MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd", V_MV78230_PLUS)), |
7657 |
++ MPP_VAR_FUNCTION(0x3, "tdm", "int2", V_MV78230_PLUS)), |
7658 |
+ MPP_MODE(32, |
7659 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), |
7660 |
+ MPP_VAR_FUNCTION(0x1, "sd0", "d0", V_MV78230_PLUS), |
7661 |
+- MPP_VAR_FUNCTION(0x3, "tdm", "int3", V_MV78230_PLUS), |
7662 |
+- MPP_VAR_FUNCTION(0x5, "vdd", "cpu1-pd", V_MV78230_PLUS)), |
7663 |
++ MPP_VAR_FUNCTION(0x3, "tdm", "int3", V_MV78230_PLUS)), |
7664 |
+ MPP_MODE(33, |
7665 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), |
7666 |
+ MPP_VAR_FUNCTION(0x1, "sd0", "d1", V_MV78230_PLUS), |
7667 |
+@@ -247,7 +238,6 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { |
7668 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), |
7669 |
+ MPP_VAR_FUNCTION(0x1, "spi", "cs1", V_MV78230_PLUS), |
7670 |
+ MPP_VAR_FUNCTION(0x2, "uart2", "cts", V_MV78230_PLUS), |
7671 |
+- MPP_VAR_FUNCTION(0x3, "vdd", "cpu1-pd", V_MV78230_PLUS), |
7672 |
+ MPP_VAR_FUNCTION(0x4, "lcd", "vga-hsync", V_MV78230_PLUS), |
7673 |
+ MPP_VAR_FUNCTION(0x5, "pcie", "clkreq0", V_MV78230_PLUS)), |
7674 |
+ MPP_MODE(41, |
7675 |
+@@ -262,15 +252,13 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { |
7676 |
+ MPP_VAR_FUNCTION(0x1, "uart2", "rxd", V_MV78230_PLUS), |
7677 |
+ MPP_VAR_FUNCTION(0x2, "uart0", "cts", V_MV78230_PLUS), |
7678 |
+ MPP_VAR_FUNCTION(0x3, "tdm", "int7", V_MV78230_PLUS), |
7679 |
+- MPP_VAR_FUNCTION(0x4, "tdm-1", "timer", V_MV78230_PLUS), |
7680 |
+- MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd", V_MV78230_PLUS)), |
7681 |
++ MPP_VAR_FUNCTION(0x4, "tdm-1", "timer", V_MV78230_PLUS)), |
7682 |
+ MPP_MODE(43, |
7683 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), |
7684 |
+ MPP_VAR_FUNCTION(0x1, "uart2", "txd", V_MV78230_PLUS), |
7685 |
+ MPP_VAR_FUNCTION(0x2, "uart0", "rts", V_MV78230_PLUS), |
7686 |
+ MPP_VAR_FUNCTION(0x3, "spi", "cs3", V_MV78230_PLUS), |
7687 |
+- MPP_VAR_FUNCTION(0x4, "pcie", "rstout", V_MV78230_PLUS), |
7688 |
+- MPP_VAR_FUNCTION(0x5, "vdd", "cpu2-3-pd", V_MV78460)), |
7689 |
++ MPP_VAR_FUNCTION(0x4, "pcie", "rstout", V_MV78230_PLUS)), |
7690 |
+ MPP_MODE(44, |
7691 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), |
7692 |
+ MPP_VAR_FUNCTION(0x1, "uart2", "cts", V_MV78230_PLUS), |
7693 |
+@@ -299,7 +287,7 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { |
7694 |
+ MPP_VAR_FUNCTION(0x5, "pcie", "clkreq3", V_MV78230_PLUS)), |
7695 |
+ MPP_MODE(48, |
7696 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), |
7697 |
+- MPP_VAR_FUNCTION(0x1, "tclk", NULL, V_MV78230_PLUS), |
7698 |
++ MPP_VAR_FUNCTION(0x1, "dev", "clkout", V_MV78230_PLUS), |
7699 |
+ MPP_VAR_FUNCTION(0x2, "dev", "burst/last", V_MV78230_PLUS)), |
7700 |
+ MPP_MODE(49, |
7701 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), |
7702 |
+@@ -321,16 +309,13 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { |
7703 |
+ MPP_VAR_FUNCTION(0x1, "dev", "ad19", V_MV78260_PLUS)), |
7704 |
+ MPP_MODE(55, |
7705 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), |
7706 |
+- MPP_VAR_FUNCTION(0x1, "dev", "ad20", V_MV78260_PLUS), |
7707 |
+- MPP_VAR_FUNCTION(0x2, "vdd", "cpu0-pd", V_MV78260_PLUS)), |
7708 |
++ MPP_VAR_FUNCTION(0x1, "dev", "ad20", V_MV78260_PLUS)), |
7709 |
+ MPP_MODE(56, |
7710 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), |
7711 |
+- MPP_VAR_FUNCTION(0x1, "dev", "ad21", V_MV78260_PLUS), |
7712 |
+- MPP_VAR_FUNCTION(0x2, "vdd", "cpu1-pd", V_MV78260_PLUS)), |
7713 |
++ MPP_VAR_FUNCTION(0x1, "dev", "ad21", V_MV78260_PLUS)), |
7714 |
+ MPP_MODE(57, |
7715 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), |
7716 |
+- MPP_VAR_FUNCTION(0x1, "dev", "ad22", V_MV78260_PLUS), |
7717 |
+- MPP_VAR_FUNCTION(0x2, "vdd", "cpu2-3-pd", V_MV78460)), |
7718 |
++ MPP_VAR_FUNCTION(0x1, "dev", "ad22", V_MV78260_PLUS)), |
7719 |
+ MPP_MODE(58, |
7720 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), |
7721 |
+ MPP_VAR_FUNCTION(0x1, "dev", "ad23", V_MV78260_PLUS)), |
7722 |
+diff --git a/drivers/pinctrl/pinctrl-zynq.c b/drivers/pinctrl/pinctrl-zynq.c |
7723 |
+index 22280bddb9e2..8c51a3c65513 100644 |
7724 |
+--- a/drivers/pinctrl/pinctrl-zynq.c |
7725 |
++++ b/drivers/pinctrl/pinctrl-zynq.c |
7726 |
+@@ -714,12 +714,13 @@ static const char * const gpio0_groups[] = {"gpio0_0_grp", |
7727 |
+ .mux_val = mval, \ |
7728 |
+ } |
7729 |
+ |
7730 |
+-#define DEFINE_ZYNQ_PINMUX_FUNCTION_MUX(fname, mval, mux, mask, shift) \ |
7731 |
++#define DEFINE_ZYNQ_PINMUX_FUNCTION_MUX(fname, mval, offset, mask, shift)\ |
7732 |
+ [ZYNQ_PMUX_##fname] = { \ |
7733 |
+ .name = #fname, \ |
7734 |
+ .groups = fname##_groups, \ |
7735 |
+ .ngroups = ARRAY_SIZE(fname##_groups), \ |
7736 |
+ .mux_val = mval, \ |
7737 |
++ .mux = offset, \ |
7738 |
+ .mux_mask = mask, \ |
7739 |
+ .mux_shift = shift, \ |
7740 |
+ } |
7741 |
+@@ -744,15 +745,15 @@ static const struct zynq_pinmux_function zynq_pmux_functions[] = { |
7742 |
+ DEFINE_ZYNQ_PINMUX_FUNCTION(spi1, 0x50), |
7743 |
+ DEFINE_ZYNQ_PINMUX_FUNCTION(sdio0, 0x40), |
7744 |
+ DEFINE_ZYNQ_PINMUX_FUNCTION(sdio0_pc, 0xc), |
7745 |
+- DEFINE_ZYNQ_PINMUX_FUNCTION_MUX(sdio0_wp, 0, 130, ZYNQ_SDIO_WP_MASK, |
7746 |
++ DEFINE_ZYNQ_PINMUX_FUNCTION_MUX(sdio0_wp, 0, 0x130, ZYNQ_SDIO_WP_MASK, |
7747 |
+ ZYNQ_SDIO_WP_SHIFT), |
7748 |
+- DEFINE_ZYNQ_PINMUX_FUNCTION_MUX(sdio0_cd, 0, 130, ZYNQ_SDIO_CD_MASK, |
7749 |
++ DEFINE_ZYNQ_PINMUX_FUNCTION_MUX(sdio0_cd, 0, 0x130, ZYNQ_SDIO_CD_MASK, |
7750 |
+ ZYNQ_SDIO_CD_SHIFT), |
7751 |
+ DEFINE_ZYNQ_PINMUX_FUNCTION(sdio1, 0x40), |
7752 |
+ DEFINE_ZYNQ_PINMUX_FUNCTION(sdio1_pc, 0xc), |
7753 |
+- DEFINE_ZYNQ_PINMUX_FUNCTION_MUX(sdio1_wp, 0, 134, ZYNQ_SDIO_WP_MASK, |
7754 |
++ DEFINE_ZYNQ_PINMUX_FUNCTION_MUX(sdio1_wp, 0, 0x134, ZYNQ_SDIO_WP_MASK, |
7755 |
+ ZYNQ_SDIO_WP_SHIFT), |
7756 |
+- DEFINE_ZYNQ_PINMUX_FUNCTION_MUX(sdio1_cd, 0, 134, ZYNQ_SDIO_CD_MASK, |
7757 |
++ DEFINE_ZYNQ_PINMUX_FUNCTION_MUX(sdio1_cd, 0, 0x134, ZYNQ_SDIO_CD_MASK, |
7758 |
+ ZYNQ_SDIO_CD_SHIFT), |
7759 |
+ DEFINE_ZYNQ_PINMUX_FUNCTION(smc0_nor, 4), |
7760 |
+ DEFINE_ZYNQ_PINMUX_FUNCTION(smc0_nor_cs1, 8), |
7761 |
+diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c |
7762 |
+index d688d806a8a5..2c1d5f5432a9 100644 |
7763 |
+--- a/drivers/platform/x86/dell-laptop.c |
7764 |
++++ b/drivers/platform/x86/dell-laptop.c |
7765 |
+@@ -305,7 +305,6 @@ static const struct dmi_system_id dell_quirks[] __initconst = { |
7766 |
+ }; |
7767 |
+ |
7768 |
+ static struct calling_interface_buffer *buffer; |
7769 |
+-static struct page *bufferpage; |
7770 |
+ static DEFINE_MUTEX(buffer_mutex); |
7771 |
+ |
7772 |
+ static int hwswitch_state; |
7773 |
+@@ -1896,12 +1895,11 @@ static int __init dell_init(void) |
7774 |
+ * Allocate buffer below 4GB for SMI data--only 32-bit physical addr |
7775 |
+ * is passed to SMI handler. |
7776 |
+ */ |
7777 |
+- bufferpage = alloc_page(GFP_KERNEL | GFP_DMA32); |
7778 |
+- if (!bufferpage) { |
7779 |
++ buffer = (void *)__get_free_page(GFP_KERNEL | GFP_DMA32); |
7780 |
++ if (!buffer) { |
7781 |
+ ret = -ENOMEM; |
7782 |
+ goto fail_buffer; |
7783 |
+ } |
7784 |
+- buffer = page_address(bufferpage); |
7785 |
+ |
7786 |
+ ret = dell_setup_rfkill(); |
7787 |
+ |
7788 |
+@@ -1965,7 +1963,7 @@ fail_backlight: |
7789 |
+ cancel_delayed_work_sync(&dell_rfkill_work); |
7790 |
+ dell_cleanup_rfkill(); |
7791 |
+ fail_rfkill: |
7792 |
+- free_page((unsigned long)bufferpage); |
7793 |
++ free_page((unsigned long)buffer); |
7794 |
+ fail_buffer: |
7795 |
+ platform_device_del(platform_device); |
7796 |
+ fail_platform_device2: |
7797 |
+diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c |
7798 |
+index b496db87bc05..cb7cd8d79329 100644 |
7799 |
+--- a/drivers/platform/x86/ideapad-laptop.c |
7800 |
++++ b/drivers/platform/x86/ideapad-laptop.c |
7801 |
+@@ -464,8 +464,9 @@ static const struct ideapad_rfk_data ideapad_rfk_data[] = { |
7802 |
+ static int ideapad_rfk_set(void *data, bool blocked) |
7803 |
+ { |
7804 |
+ struct ideapad_rfk_priv *priv = data; |
7805 |
++ int opcode = ideapad_rfk_data[priv->dev].opcode; |
7806 |
+ |
7807 |
+- return write_ec_cmd(priv->priv->adev->handle, priv->dev, !blocked); |
7808 |
++ return write_ec_cmd(priv->priv->adev->handle, opcode, !blocked); |
7809 |
+ } |
7810 |
+ |
7811 |
+ static struct rfkill_ops ideapad_rfk_ops = { |
7812 |
+@@ -837,6 +838,13 @@ static const struct dmi_system_id no_hw_rfkill_list[] = { |
7813 |
+ }, |
7814 |
+ }, |
7815 |
+ { |
7816 |
++ .ident = "Lenovo G50-30", |
7817 |
++ .matches = { |
7818 |
++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
7819 |
++ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo G50-30"), |
7820 |
++ }, |
7821 |
++ }, |
7822 |
++ { |
7823 |
+ .ident = "Lenovo Yoga 2 11 / 13 / Pro", |
7824 |
+ .matches = { |
7825 |
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
7826 |
+diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c |
7827 |
+index 515f33882ab8..49c1720df59a 100644 |
7828 |
+--- a/drivers/pnp/system.c |
7829 |
++++ b/drivers/pnp/system.c |
7830 |
+@@ -7,7 +7,6 @@ |
7831 |
+ * Bjorn Helgaas <bjorn.helgaas@××.com> |
7832 |
+ */ |
7833 |
+ |
7834 |
+-#include <linux/acpi.h> |
7835 |
+ #include <linux/pnp.h> |
7836 |
+ #include <linux/device.h> |
7837 |
+ #include <linux/init.h> |
7838 |
+@@ -23,41 +22,25 @@ static const struct pnp_device_id pnp_dev_table[] = { |
7839 |
+ {"", 0} |
7840 |
+ }; |
7841 |
+ |
7842 |
+-#ifdef CONFIG_ACPI |
7843 |
+-static bool __reserve_range(u64 start, unsigned int length, bool io, char *desc) |
7844 |
+-{ |
7845 |
+- u8 space_id = io ? ACPI_ADR_SPACE_SYSTEM_IO : ACPI_ADR_SPACE_SYSTEM_MEMORY; |
7846 |
+- return !acpi_reserve_region(start, length, space_id, IORESOURCE_BUSY, desc); |
7847 |
+-} |
7848 |
+-#else |
7849 |
+-static bool __reserve_range(u64 start, unsigned int length, bool io, char *desc) |
7850 |
+-{ |
7851 |
+- struct resource *res; |
7852 |
+- |
7853 |
+- res = io ? request_region(start, length, desc) : |
7854 |
+- request_mem_region(start, length, desc); |
7855 |
+- if (res) { |
7856 |
+- res->flags &= ~IORESOURCE_BUSY; |
7857 |
+- return true; |
7858 |
+- } |
7859 |
+- return false; |
7860 |
+-} |
7861 |
+-#endif |
7862 |
+- |
7863 |
+ static void reserve_range(struct pnp_dev *dev, struct resource *r, int port) |
7864 |
+ { |
7865 |
+ char *regionid; |
7866 |
+ const char *pnpid = dev_name(&dev->dev); |
7867 |
+ resource_size_t start = r->start, end = r->end; |
7868 |
+- bool reserved; |
7869 |
++ struct resource *res; |
7870 |
+ |
7871 |
+ regionid = kmalloc(16, GFP_KERNEL); |
7872 |
+ if (!regionid) |
7873 |
+ return; |
7874 |
+ |
7875 |
+ snprintf(regionid, 16, "pnp %s", pnpid); |
7876 |
+- reserved = __reserve_range(start, end - start + 1, !!port, regionid); |
7877 |
+- if (!reserved) |
7878 |
++ if (port) |
7879 |
++ res = request_region(start, end - start + 1, regionid); |
7880 |
++ else |
7881 |
++ res = request_mem_region(start, end - start + 1, regionid); |
7882 |
++ if (res) |
7883 |
++ res->flags &= ~IORESOURCE_BUSY; |
7884 |
++ else |
7885 |
+ kfree(regionid); |
7886 |
+ |
7887 |
+ /* |
7888 |
+@@ -66,7 +49,7 @@ static void reserve_range(struct pnp_dev *dev, struct resource *r, int port) |
7889 |
+ * have double reservations. |
7890 |
+ */ |
7891 |
+ dev_info(&dev->dev, "%pR %s reserved\n", r, |
7892 |
+- reserved ? "has been" : "could not be"); |
7893 |
++ res ? "has been" : "could not be"); |
7894 |
+ } |
7895 |
+ |
7896 |
+ static void reserve_resources_of_dev(struct pnp_dev *dev) |
7897 |
+diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c |
7898 |
+index 0479e807a776..d87a85cefb66 100644 |
7899 |
+--- a/drivers/rtc/rtc-snvs.c |
7900 |
++++ b/drivers/rtc/rtc-snvs.c |
7901 |
+@@ -322,6 +322,13 @@ static int snvs_rtc_suspend(struct device *dev) |
7902 |
+ if (device_may_wakeup(dev)) |
7903 |
+ enable_irq_wake(data->irq); |
7904 |
+ |
7905 |
++ return 0; |
7906 |
++} |
7907 |
++ |
7908 |
++static int snvs_rtc_suspend_noirq(struct device *dev) |
7909 |
++{ |
7910 |
++ struct snvs_rtc_data *data = dev_get_drvdata(dev); |
7911 |
++ |
7912 |
+ if (data->clk) |
7913 |
+ clk_disable_unprepare(data->clk); |
7914 |
+ |
7915 |
+@@ -331,23 +338,28 @@ static int snvs_rtc_suspend(struct device *dev) |
7916 |
+ static int snvs_rtc_resume(struct device *dev) |
7917 |
+ { |
7918 |
+ struct snvs_rtc_data *data = dev_get_drvdata(dev); |
7919 |
+- int ret; |
7920 |
+ |
7921 |
+ if (device_may_wakeup(dev)) |
7922 |
+- disable_irq_wake(data->irq); |
7923 |
++ return disable_irq_wake(data->irq); |
7924 |
+ |
7925 |
+- if (data->clk) { |
7926 |
+- ret = clk_prepare_enable(data->clk); |
7927 |
+- if (ret) |
7928 |
+- return ret; |
7929 |
+- } |
7930 |
++ return 0; |
7931 |
++} |
7932 |
++ |
7933 |
++static int snvs_rtc_resume_noirq(struct device *dev) |
7934 |
++{ |
7935 |
++ struct snvs_rtc_data *data = dev_get_drvdata(dev); |
7936 |
++ |
7937 |
++ if (data->clk) |
7938 |
++ return clk_prepare_enable(data->clk); |
7939 |
+ |
7940 |
+ return 0; |
7941 |
+ } |
7942 |
+ |
7943 |
+ static const struct dev_pm_ops snvs_rtc_pm_ops = { |
7944 |
+- .suspend_noirq = snvs_rtc_suspend, |
7945 |
+- .resume_noirq = snvs_rtc_resume, |
7946 |
++ .suspend = snvs_rtc_suspend, |
7947 |
++ .suspend_noirq = snvs_rtc_suspend_noirq, |
7948 |
++ .resume = snvs_rtc_resume, |
7949 |
++ .resume_noirq = snvs_rtc_resume_noirq, |
7950 |
+ }; |
7951 |
+ |
7952 |
+ #define SNVS_RTC_PM_OPS (&snvs_rtc_pm_ops) |
7953 |
+diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c |
7954 |
+index c458e5010a74..4ebf5aae5019 100644 |
7955 |
+--- a/drivers/staging/comedi/drivers/cb_pcimdas.c |
7956 |
++++ b/drivers/staging/comedi/drivers/cb_pcimdas.c |
7957 |
+@@ -243,7 +243,7 @@ static int cb_pcimdas_ao_insn_write(struct comedi_device *dev, |
7958 |
+ return insn->n; |
7959 |
+ } |
7960 |
+ |
7961 |
+-static int cb_pcimdas_di_insn_read(struct comedi_device *dev, |
7962 |
++static int cb_pcimdas_di_insn_bits(struct comedi_device *dev, |
7963 |
+ struct comedi_subdevice *s, |
7964 |
+ struct comedi_insn *insn, |
7965 |
+ unsigned int *data) |
7966 |
+@@ -258,7 +258,7 @@ static int cb_pcimdas_di_insn_read(struct comedi_device *dev, |
7967 |
+ return insn->n; |
7968 |
+ } |
7969 |
+ |
7970 |
+-static int cb_pcimdas_do_insn_write(struct comedi_device *dev, |
7971 |
++static int cb_pcimdas_do_insn_bits(struct comedi_device *dev, |
7972 |
+ struct comedi_subdevice *s, |
7973 |
+ struct comedi_insn *insn, |
7974 |
+ unsigned int *data) |
7975 |
+@@ -424,7 +424,7 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, |
7976 |
+ s->n_chan = 4; |
7977 |
+ s->maxdata = 1; |
7978 |
+ s->range_table = &range_digital; |
7979 |
+- s->insn_read = cb_pcimdas_di_insn_read; |
7980 |
++ s->insn_bits = cb_pcimdas_di_insn_bits; |
7981 |
+ |
7982 |
+ /* Digital Output subdevice (main connector) */ |
7983 |
+ s = &dev->subdevices[4]; |
7984 |
+@@ -433,7 +433,7 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, |
7985 |
+ s->n_chan = 4; |
7986 |
+ s->maxdata = 1; |
7987 |
+ s->range_table = &range_digital; |
7988 |
+- s->insn_write = cb_pcimdas_do_insn_write; |
7989 |
++ s->insn_bits = cb_pcimdas_do_insn_bits; |
7990 |
+ |
7991 |
+ /* Counter subdevice (8254) */ |
7992 |
+ s = &dev->subdevices[5]; |
7993 |
+diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c |
7994 |
+index 50227b598e0c..fcb8c61b2884 100644 |
7995 |
+--- a/drivers/staging/rtl8712/rtl8712_recv.c |
7996 |
++++ b/drivers/staging/rtl8712/rtl8712_recv.c |
7997 |
+@@ -1056,7 +1056,8 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb) |
7998 |
+ /* for first fragment packet, driver need allocate 1536 + |
7999 |
+ * drvinfo_sz + RXDESC_SIZE to defrag packet. */ |
8000 |
+ if ((mf == 1) && (frag == 0)) |
8001 |
+- alloc_sz = 1658;/*1658+6=1664, 1664 is 128 alignment.*/ |
8002 |
++ /*1658+6=1664, 1664 is 128 alignment.*/ |
8003 |
++ alloc_sz = max_t(u16, tmp_len, 1658); |
8004 |
+ else |
8005 |
+ alloc_sz = tmp_len; |
8006 |
+ /* 2 is for IP header 4 bytes alignment in QoS packet case. |
8007 |
+diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c |
8008 |
+index 0343ae386f03..15baacb126ad 100644 |
8009 |
+--- a/drivers/staging/vt6655/device_main.c |
8010 |
++++ b/drivers/staging/vt6655/device_main.c |
8011 |
+@@ -807,6 +807,10 @@ static int device_rx_srv(struct vnt_private *pDevice, unsigned int uIdx) |
8012 |
+ pRD = pRD->next) { |
8013 |
+ if (works++ > 15) |
8014 |
+ break; |
8015 |
++ |
8016 |
++ if (!pRD->pRDInfo->skb) |
8017 |
++ break; |
8018 |
++ |
8019 |
+ if (vnt_receive_frame(pDevice, pRD)) { |
8020 |
+ if (!device_alloc_rx_buf(pDevice, pRD)) { |
8021 |
+ dev_err(&pDevice->pcid->dev, |
8022 |
+@@ -1417,7 +1421,7 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, |
8023 |
+ |
8024 |
+ priv->current_aid = conf->aid; |
8025 |
+ |
8026 |
+- if (changed & BSS_CHANGED_BSSID) { |
8027 |
++ if (changed & BSS_CHANGED_BSSID && conf->bssid) { |
8028 |
+ unsigned long flags; |
8029 |
+ |
8030 |
+ spin_lock_irqsave(&priv->lock, flags); |
8031 |
+diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c |
8032 |
+index ab3ab84cb0a7..766fdcece074 100644 |
8033 |
+--- a/drivers/staging/vt6656/main_usb.c |
8034 |
++++ b/drivers/staging/vt6656/main_usb.c |
8035 |
+@@ -701,7 +701,7 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, |
8036 |
+ |
8037 |
+ priv->current_aid = conf->aid; |
8038 |
+ |
8039 |
+- if (changed & BSS_CHANGED_BSSID) |
8040 |
++ if (changed & BSS_CHANGED_BSSID && conf->bssid) |
8041 |
+ vnt_mac_set_bssid_addr(priv, (u8 *)conf->bssid); |
8042 |
+ |
8043 |
+ |
8044 |
+diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig |
8045 |
+index f8120c1bde14..8cd35348fc19 100644 |
8046 |
+--- a/drivers/tty/serial/Kconfig |
8047 |
++++ b/drivers/tty/serial/Kconfig |
8048 |
+@@ -241,7 +241,6 @@ config SERIAL_SAMSUNG |
8049 |
+ tristate "Samsung SoC serial support" |
8050 |
+ depends on PLAT_SAMSUNG || ARCH_EXYNOS |
8051 |
+ select SERIAL_CORE |
8052 |
+- select SERIAL_EARLYCON |
8053 |
+ help |
8054 |
+ Support for the on-chip UARTs on the Samsung S3C24XX series CPUs, |
8055 |
+ providing /dev/ttySAC0, 1 and 2 (note, some machines may not |
8056 |
+@@ -277,6 +276,7 @@ config SERIAL_SAMSUNG_CONSOLE |
8057 |
+ bool "Support for console on Samsung SoC serial port" |
8058 |
+ depends on SERIAL_SAMSUNG=y |
8059 |
+ select SERIAL_CORE_CONSOLE |
8060 |
++ select SERIAL_EARLYCON |
8061 |
+ help |
8062 |
+ Allow selection of the S3C24XX on-board serial ports for use as |
8063 |
+ an virtual console. |
8064 |
+diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c |
8065 |
+index 27dade29646b..5ca1dfb0561c 100644 |
8066 |
+--- a/drivers/tty/serial/atmel_serial.c |
8067 |
++++ b/drivers/tty/serial/atmel_serial.c |
8068 |
+@@ -315,8 +315,7 @@ static int atmel_config_rs485(struct uart_port *port, |
8069 |
+ if (rs485conf->flags & SER_RS485_ENABLED) { |
8070 |
+ dev_dbg(port->dev, "Setting UART to RS485\n"); |
8071 |
+ atmel_port->tx_done_mask = ATMEL_US_TXEMPTY; |
8072 |
+- if ((rs485conf->delay_rts_after_send) > 0) |
8073 |
+- UART_PUT_TTGR(port, rs485conf->delay_rts_after_send); |
8074 |
++ UART_PUT_TTGR(port, rs485conf->delay_rts_after_send); |
8075 |
+ mode |= ATMEL_US_USMODE_RS485; |
8076 |
+ } else { |
8077 |
+ dev_dbg(port->dev, "Setting UART to RS232\n"); |
8078 |
+@@ -354,8 +353,7 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl) |
8079 |
+ |
8080 |
+ /* override mode to RS485 if needed, otherwise keep the current mode */ |
8081 |
+ if (port->rs485.flags & SER_RS485_ENABLED) { |
8082 |
+- if ((port->rs485.delay_rts_after_send) > 0) |
8083 |
+- UART_PUT_TTGR(port, port->rs485.delay_rts_after_send); |
8084 |
++ UART_PUT_TTGR(port, port->rs485.delay_rts_after_send); |
8085 |
+ mode &= ~ATMEL_US_USMODE; |
8086 |
+ mode |= ATMEL_US_USMODE_RS485; |
8087 |
+ } |
8088 |
+@@ -2061,8 +2059,7 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, |
8089 |
+ |
8090 |
+ /* mode */ |
8091 |
+ if (port->rs485.flags & SER_RS485_ENABLED) { |
8092 |
+- if ((port->rs485.delay_rts_after_send) > 0) |
8093 |
+- UART_PUT_TTGR(port, port->rs485.delay_rts_after_send); |
8094 |
++ UART_PUT_TTGR(port, port->rs485.delay_rts_after_send); |
8095 |
+ mode |= ATMEL_US_USMODE_RS485; |
8096 |
+ } else if (termios->c_cflag & CRTSCTS) { |
8097 |
+ /* RS232 with hardware handshake (RTS/CTS) */ |
8098 |
+diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c |
8099 |
+index 843f2cdc280b..9ffdfcf2ec6e 100644 |
8100 |
+--- a/drivers/tty/sysrq.c |
8101 |
++++ b/drivers/tty/sysrq.c |
8102 |
+@@ -55,9 +55,6 @@ |
8103 |
+ static int __read_mostly sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE; |
8104 |
+ static bool __read_mostly sysrq_always_enabled; |
8105 |
+ |
8106 |
+-unsigned short platform_sysrq_reset_seq[] __weak = { KEY_RESERVED }; |
8107 |
+-int sysrq_reset_downtime_ms __weak; |
8108 |
+- |
8109 |
+ static bool sysrq_on(void) |
8110 |
+ { |
8111 |
+ return sysrq_enabled || sysrq_always_enabled; |
8112 |
+@@ -569,6 +566,7 @@ void handle_sysrq(int key) |
8113 |
+ EXPORT_SYMBOL(handle_sysrq); |
8114 |
+ |
8115 |
+ #ifdef CONFIG_INPUT |
8116 |
++static int sysrq_reset_downtime_ms; |
8117 |
+ |
8118 |
+ /* Simple translation table for the SysRq keys */ |
8119 |
+ static const unsigned char sysrq_xlate[KEY_CNT] = |
8120 |
+@@ -949,23 +947,8 @@ static bool sysrq_handler_registered; |
8121 |
+ |
8122 |
+ static inline void sysrq_register_handler(void) |
8123 |
+ { |
8124 |
+- unsigned short key; |
8125 |
+ int error; |
8126 |
+- int i; |
8127 |
+- |
8128 |
+- /* First check if a __weak interface was instantiated. */ |
8129 |
+- for (i = 0; i < ARRAY_SIZE(sysrq_reset_seq); i++) { |
8130 |
+- key = platform_sysrq_reset_seq[i]; |
8131 |
+- if (key == KEY_RESERVED || key > KEY_MAX) |
8132 |
+- break; |
8133 |
+- |
8134 |
+- sysrq_reset_seq[sysrq_reset_seq_len++] = key; |
8135 |
+- } |
8136 |
+ |
8137 |
+- /* |
8138 |
+- * DT configuration takes precedence over anything that would |
8139 |
+- * have been defined via the __weak interface. |
8140 |
+- */ |
8141 |
+ sysrq_of_get_keyreset_config(); |
8142 |
+ |
8143 |
+ error = input_register_handler(&sysrq_handler); |
8144 |
+diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c |
8145 |
+index 4b0448c26810..986abde07683 100644 |
8146 |
+--- a/drivers/usb/core/devio.c |
8147 |
++++ b/drivers/usb/core/devio.c |
8148 |
+@@ -513,7 +513,7 @@ static void async_completed(struct urb *urb) |
8149 |
+ snoop(&urb->dev->dev, "urb complete\n"); |
8150 |
+ snoop_urb(urb->dev, as->userurb, urb->pipe, urb->actual_length, |
8151 |
+ as->status, COMPLETE, NULL, 0); |
8152 |
+- if ((urb->transfer_flags & URB_DIR_MASK) == USB_DIR_IN) |
8153 |
++ if ((urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN) |
8154 |
+ snoop_urb_data(urb, urb->actual_length); |
8155 |
+ |
8156 |
+ if (as->status < 0 && as->bulk_addr && as->status != -ECONNRESET && |
8157 |
+diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c |
8158 |
+index 45a915ccd71c..1c1385e3a824 100644 |
8159 |
+--- a/drivers/usb/core/hcd.c |
8160 |
++++ b/drivers/usb/core/hcd.c |
8161 |
+@@ -1022,9 +1022,12 @@ static int register_root_hub(struct usb_hcd *hcd) |
8162 |
+ dev_name(&usb_dev->dev), retval); |
8163 |
+ return (retval < 0) ? retval : -EMSGSIZE; |
8164 |
+ } |
8165 |
+- if (usb_dev->speed == USB_SPEED_SUPER) { |
8166 |
++ |
8167 |
++ if (le16_to_cpu(usb_dev->descriptor.bcdUSB) >= 0x0201) { |
8168 |
+ retval = usb_get_bos_descriptor(usb_dev); |
8169 |
+- if (retval < 0) { |
8170 |
++ if (!retval) { |
8171 |
++ usb_dev->lpm_capable = usb_device_supports_lpm(usb_dev); |
8172 |
++ } else if (usb_dev->speed == USB_SPEED_SUPER) { |
8173 |
+ mutex_unlock(&usb_bus_list_lock); |
8174 |
+ dev_dbg(parent_dev, "can't read %s bos descriptor %d\n", |
8175 |
+ dev_name(&usb_dev->dev), retval); |
8176 |
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
8177 |
+index 3b7151687776..1e9a8c9aa531 100644 |
8178 |
+--- a/drivers/usb/core/hub.c |
8179 |
++++ b/drivers/usb/core/hub.c |
8180 |
+@@ -122,7 +122,7 @@ struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev) |
8181 |
+ return usb_get_intfdata(hdev->actconfig->interface[0]); |
8182 |
+ } |
8183 |
+ |
8184 |
+-static int usb_device_supports_lpm(struct usb_device *udev) |
8185 |
++int usb_device_supports_lpm(struct usb_device *udev) |
8186 |
+ { |
8187 |
+ /* USB 2.1 (and greater) devices indicate LPM support through |
8188 |
+ * their USB 2.0 Extended Capabilities BOS descriptor. |
8189 |
+@@ -2616,9 +2616,6 @@ static bool use_new_scheme(struct usb_device *udev, int retry) |
8190 |
+ return USE_NEW_SCHEME(retry); |
8191 |
+ } |
8192 |
+ |
8193 |
+-static int hub_port_reset(struct usb_hub *hub, int port1, |
8194 |
+- struct usb_device *udev, unsigned int delay, bool warm); |
8195 |
+- |
8196 |
+ /* Is a USB 3.0 port in the Inactive or Compliance Mode state? |
8197 |
+ * Port worm reset is required to recover |
8198 |
+ */ |
8199 |
+@@ -2706,44 +2703,6 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, |
8200 |
+ return 0; |
8201 |
+ } |
8202 |
+ |
8203 |
+-static void hub_port_finish_reset(struct usb_hub *hub, int port1, |
8204 |
+- struct usb_device *udev, int *status) |
8205 |
+-{ |
8206 |
+- switch (*status) { |
8207 |
+- case 0: |
8208 |
+- /* TRSTRCY = 10 ms; plus some extra */ |
8209 |
+- msleep(10 + 40); |
8210 |
+- if (udev) { |
8211 |
+- struct usb_hcd *hcd = bus_to_hcd(udev->bus); |
8212 |
+- |
8213 |
+- update_devnum(udev, 0); |
8214 |
+- /* The xHC may think the device is already reset, |
8215 |
+- * so ignore the status. |
8216 |
+- */ |
8217 |
+- if (hcd->driver->reset_device) |
8218 |
+- hcd->driver->reset_device(hcd, udev); |
8219 |
+- } |
8220 |
+- /* FALL THROUGH */ |
8221 |
+- case -ENOTCONN: |
8222 |
+- case -ENODEV: |
8223 |
+- usb_clear_port_feature(hub->hdev, |
8224 |
+- port1, USB_PORT_FEAT_C_RESET); |
8225 |
+- if (hub_is_superspeed(hub->hdev)) { |
8226 |
+- usb_clear_port_feature(hub->hdev, port1, |
8227 |
+- USB_PORT_FEAT_C_BH_PORT_RESET); |
8228 |
+- usb_clear_port_feature(hub->hdev, port1, |
8229 |
+- USB_PORT_FEAT_C_PORT_LINK_STATE); |
8230 |
+- usb_clear_port_feature(hub->hdev, port1, |
8231 |
+- USB_PORT_FEAT_C_CONNECTION); |
8232 |
+- } |
8233 |
+- if (udev) |
8234 |
+- usb_set_device_state(udev, *status |
8235 |
+- ? USB_STATE_NOTATTACHED |
8236 |
+- : USB_STATE_DEFAULT); |
8237 |
+- break; |
8238 |
+- } |
8239 |
+-} |
8240 |
+- |
8241 |
+ /* Handle port reset and port warm(BH) reset (for USB3 protocol ports) */ |
8242 |
+ static int hub_port_reset(struct usb_hub *hub, int port1, |
8243 |
+ struct usb_device *udev, unsigned int delay, bool warm) |
8244 |
+@@ -2767,13 +2726,10 @@ static int hub_port_reset(struct usb_hub *hub, int port1, |
8245 |
+ * If the caller hasn't explicitly requested a warm reset, |
8246 |
+ * double check and see if one is needed. |
8247 |
+ */ |
8248 |
+- status = hub_port_status(hub, port1, |
8249 |
+- &portstatus, &portchange); |
8250 |
+- if (status < 0) |
8251 |
+- goto done; |
8252 |
+- |
8253 |
+- if (hub_port_warm_reset_required(hub, port1, portstatus)) |
8254 |
+- warm = true; |
8255 |
++ if (hub_port_status(hub, port1, &portstatus, &portchange) == 0) |
8256 |
++ if (hub_port_warm_reset_required(hub, port1, |
8257 |
++ portstatus)) |
8258 |
++ warm = true; |
8259 |
+ } |
8260 |
+ clear_bit(port1, hub->warm_reset_bits); |
8261 |
+ |
8262 |
+@@ -2799,11 +2755,19 @@ static int hub_port_reset(struct usb_hub *hub, int port1, |
8263 |
+ |
8264 |
+ /* Check for disconnect or reset */ |
8265 |
+ if (status == 0 || status == -ENOTCONN || status == -ENODEV) { |
8266 |
+- hub_port_finish_reset(hub, port1, udev, &status); |
8267 |
++ usb_clear_port_feature(hub->hdev, port1, |
8268 |
++ USB_PORT_FEAT_C_RESET); |
8269 |
+ |
8270 |
+ if (!hub_is_superspeed(hub->hdev)) |
8271 |
+ goto done; |
8272 |
+ |
8273 |
++ usb_clear_port_feature(hub->hdev, port1, |
8274 |
++ USB_PORT_FEAT_C_BH_PORT_RESET); |
8275 |
++ usb_clear_port_feature(hub->hdev, port1, |
8276 |
++ USB_PORT_FEAT_C_PORT_LINK_STATE); |
8277 |
++ usb_clear_port_feature(hub->hdev, port1, |
8278 |
++ USB_PORT_FEAT_C_CONNECTION); |
8279 |
++ |
8280 |
+ /* |
8281 |
+ * If a USB 3.0 device migrates from reset to an error |
8282 |
+ * state, re-issue the warm reset. |
8283 |
+@@ -2836,6 +2800,26 @@ static int hub_port_reset(struct usb_hub *hub, int port1, |
8284 |
+ dev_err(&port_dev->dev, "Cannot enable. Maybe the USB cable is bad?\n"); |
8285 |
+ |
8286 |
+ done: |
8287 |
++ if (status == 0) { |
8288 |
++ /* TRSTRCY = 10 ms; plus some extra */ |
8289 |
++ msleep(10 + 40); |
8290 |
++ if (udev) { |
8291 |
++ struct usb_hcd *hcd = bus_to_hcd(udev->bus); |
8292 |
++ |
8293 |
++ update_devnum(udev, 0); |
8294 |
++ /* The xHC may think the device is already reset, |
8295 |
++ * so ignore the status. |
8296 |
++ */ |
8297 |
++ if (hcd->driver->reset_device) |
8298 |
++ hcd->driver->reset_device(hcd, udev); |
8299 |
++ |
8300 |
++ usb_set_device_state(udev, USB_STATE_DEFAULT); |
8301 |
++ } |
8302 |
++ } else { |
8303 |
++ if (udev) |
8304 |
++ usb_set_device_state(udev, USB_STATE_NOTATTACHED); |
8305 |
++ } |
8306 |
++ |
8307 |
+ if (!hub_is_superspeed(hub->hdev)) |
8308 |
+ up_read(&ehci_cf_port_reset_rwsem); |
8309 |
+ |
8310 |
+diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h |
8311 |
+index 7eb1e26798e5..457255a3306a 100644 |
8312 |
+--- a/drivers/usb/core/usb.h |
8313 |
++++ b/drivers/usb/core/usb.h |
8314 |
+@@ -65,6 +65,7 @@ extern int usb_hub_init(void); |
8315 |
+ extern void usb_hub_cleanup(void); |
8316 |
+ extern int usb_major_init(void); |
8317 |
+ extern void usb_major_cleanup(void); |
8318 |
++extern int usb_device_supports_lpm(struct usb_device *udev); |
8319 |
+ |
8320 |
+ #ifdef CONFIG_PM |
8321 |
+ |
8322 |
+diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c |
8323 |
+index 2ef3c8d6a9db..69e769c35cf5 100644 |
8324 |
+--- a/drivers/usb/dwc3/ep0.c |
8325 |
++++ b/drivers/usb/dwc3/ep0.c |
8326 |
+@@ -727,6 +727,10 @@ static int dwc3_ep0_std_request(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) |
8327 |
+ dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_ISOCH_DELAY"); |
8328 |
+ ret = dwc3_ep0_set_isoch_delay(dwc, ctrl); |
8329 |
+ break; |
8330 |
++ case USB_REQ_SET_INTERFACE: |
8331 |
++ dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_INTERFACE"); |
8332 |
++ dwc->start_config_issued = false; |
8333 |
++ /* Fall through */ |
8334 |
+ default: |
8335 |
+ dwc3_trace(trace_dwc3_ep0, "Forwarding to gadget driver"); |
8336 |
+ ret = dwc3_ep0_delegate_req(dwc, ctrl); |
8337 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
8338 |
+index 8946c32047e9..333a7c0078fc 100644 |
8339 |
+--- a/drivers/usb/dwc3/gadget.c |
8340 |
++++ b/drivers/usb/dwc3/gadget.c |
8341 |
+@@ -291,6 +291,8 @@ int dwc3_send_gadget_generic_command(struct dwc3 *dwc, unsigned cmd, u32 param) |
8342 |
+ dwc3_trace(trace_dwc3_gadget, |
8343 |
+ "Command Complete --> %d", |
8344 |
+ DWC3_DGCMD_STATUS(reg)); |
8345 |
++ if (DWC3_DGCMD_STATUS(reg)) |
8346 |
++ return -EINVAL; |
8347 |
+ return 0; |
8348 |
+ } |
8349 |
+ |
8350 |
+@@ -328,6 +330,8 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep, |
8351 |
+ dwc3_trace(trace_dwc3_gadget, |
8352 |
+ "Command Complete --> %d", |
8353 |
+ DWC3_DEPCMD_STATUS(reg)); |
8354 |
++ if (DWC3_DEPCMD_STATUS(reg)) |
8355 |
++ return -EINVAL; |
8356 |
+ return 0; |
8357 |
+ } |
8358 |
+ |
8359 |
+@@ -1902,12 +1906,16 @@ static void dwc3_endpoint_transfer_complete(struct dwc3 *dwc, |
8360 |
+ { |
8361 |
+ unsigned status = 0; |
8362 |
+ int clean_busy; |
8363 |
++ u32 is_xfer_complete; |
8364 |
++ |
8365 |
++ is_xfer_complete = (event->endpoint_event == DWC3_DEPEVT_XFERCOMPLETE); |
8366 |
+ |
8367 |
+ if (event->status & DEPEVT_STATUS_BUSERR) |
8368 |
+ status = -ECONNRESET; |
8369 |
+ |
8370 |
+ clean_busy = dwc3_cleanup_done_reqs(dwc, dep, event, status); |
8371 |
+- if (clean_busy) |
8372 |
++ if (clean_busy && (is_xfer_complete || |
8373 |
++ usb_endpoint_xfer_isoc(dep->endpoint.desc))) |
8374 |
+ dep->flags &= ~DWC3_EP_BUSY; |
8375 |
+ |
8376 |
+ /* |
8377 |
+diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c |
8378 |
+index 4e3447bbd097..58b4657fc721 100644 |
8379 |
+--- a/drivers/usb/gadget/composite.c |
8380 |
++++ b/drivers/usb/gadget/composite.c |
8381 |
+@@ -1758,10 +1758,13 @@ unknown: |
8382 |
+ * take such requests too, if that's ever needed: to work |
8383 |
+ * in config 0, etc. |
8384 |
+ */ |
8385 |
+- list_for_each_entry(f, &cdev->config->functions, list) |
8386 |
+- if (f->req_match && f->req_match(f, ctrl)) |
8387 |
+- goto try_fun_setup; |
8388 |
+- f = NULL; |
8389 |
++ if (cdev->config) { |
8390 |
++ list_for_each_entry(f, &cdev->config->functions, list) |
8391 |
++ if (f->req_match && f->req_match(f, ctrl)) |
8392 |
++ goto try_fun_setup; |
8393 |
++ f = NULL; |
8394 |
++ } |
8395 |
++ |
8396 |
+ switch (ctrl->bRequestType & USB_RECIP_MASK) { |
8397 |
+ case USB_RECIP_INTERFACE: |
8398 |
+ if (!cdev->config || intf >= MAX_CONFIG_INTERFACES) |
8399 |
+diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
8400 |
+index 45b8c8b338df..6e7be91e6097 100644 |
8401 |
+--- a/drivers/usb/gadget/function/f_fs.c |
8402 |
++++ b/drivers/usb/gadget/function/f_fs.c |
8403 |
+@@ -924,7 +924,8 @@ static ssize_t ffs_epfile_write_iter(struct kiocb *kiocb, struct iov_iter *from) |
8404 |
+ |
8405 |
+ kiocb->private = p; |
8406 |
+ |
8407 |
+- kiocb_set_cancel_fn(kiocb, ffs_aio_cancel); |
8408 |
++ if (p->aio) |
8409 |
++ kiocb_set_cancel_fn(kiocb, ffs_aio_cancel); |
8410 |
+ |
8411 |
+ res = ffs_epfile_io(kiocb->ki_filp, p); |
8412 |
+ if (res == -EIOCBQUEUED) |
8413 |
+@@ -968,7 +969,8 @@ static ssize_t ffs_epfile_read_iter(struct kiocb *kiocb, struct iov_iter *to) |
8414 |
+ |
8415 |
+ kiocb->private = p; |
8416 |
+ |
8417 |
+- kiocb_set_cancel_fn(kiocb, ffs_aio_cancel); |
8418 |
++ if (p->aio) |
8419 |
++ kiocb_set_cancel_fn(kiocb, ffs_aio_cancel); |
8420 |
+ |
8421 |
+ res = ffs_epfile_io(kiocb->ki_filp, p); |
8422 |
+ if (res == -EIOCBQUEUED) |
8423 |
+diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c |
8424 |
+index 3cc109f3c9c8..15c307155037 100644 |
8425 |
+--- a/drivers/usb/gadget/function/f_mass_storage.c |
8426 |
++++ b/drivers/usb/gadget/function/f_mass_storage.c |
8427 |
+@@ -2786,7 +2786,7 @@ int fsg_common_set_nluns(struct fsg_common *common, int nluns) |
8428 |
+ return -EINVAL; |
8429 |
+ } |
8430 |
+ |
8431 |
+- curlun = kcalloc(nluns, sizeof(*curlun), GFP_KERNEL); |
8432 |
++ curlun = kcalloc(FSG_MAX_LUNS, sizeof(*curlun), GFP_KERNEL); |
8433 |
+ if (unlikely(!curlun)) |
8434 |
+ return -ENOMEM; |
8435 |
+ |
8436 |
+@@ -2796,8 +2796,6 @@ int fsg_common_set_nluns(struct fsg_common *common, int nluns) |
8437 |
+ common->luns = curlun; |
8438 |
+ common->nluns = nluns; |
8439 |
+ |
8440 |
+- pr_info("Number of LUNs=%d\n", common->nluns); |
8441 |
+- |
8442 |
+ return 0; |
8443 |
+ } |
8444 |
+ EXPORT_SYMBOL_GPL(fsg_common_set_nluns); |
8445 |
+@@ -3563,14 +3561,26 @@ static struct usb_function *fsg_alloc(struct usb_function_instance *fi) |
8446 |
+ struct fsg_opts *opts = fsg_opts_from_func_inst(fi); |
8447 |
+ struct fsg_common *common = opts->common; |
8448 |
+ struct fsg_dev *fsg; |
8449 |
++ unsigned nluns, i; |
8450 |
+ |
8451 |
+ fsg = kzalloc(sizeof(*fsg), GFP_KERNEL); |
8452 |
+ if (unlikely(!fsg)) |
8453 |
+ return ERR_PTR(-ENOMEM); |
8454 |
+ |
8455 |
+ mutex_lock(&opts->lock); |
8456 |
++ if (!opts->refcnt) { |
8457 |
++ for (nluns = i = 0; i < FSG_MAX_LUNS; ++i) |
8458 |
++ if (common->luns[i]) |
8459 |
++ nluns = i + 1; |
8460 |
++ if (!nluns) |
8461 |
++ pr_warn("No LUNS defined, continuing anyway\n"); |
8462 |
++ else |
8463 |
++ common->nluns = nluns; |
8464 |
++ pr_info("Number of LUNs=%u\n", common->nluns); |
8465 |
++ } |
8466 |
+ opts->refcnt++; |
8467 |
+ mutex_unlock(&opts->lock); |
8468 |
++ |
8469 |
+ fsg->function.name = FSG_DRIVER_DESC; |
8470 |
+ fsg->function.bind = fsg_bind; |
8471 |
+ fsg->function.unbind = fsg_unbind; |
8472 |
+diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c |
8473 |
+index d32160d6463f..5da37c957b53 100644 |
8474 |
+--- a/drivers/usb/gadget/udc/mv_udc_core.c |
8475 |
++++ b/drivers/usb/gadget/udc/mv_udc_core.c |
8476 |
+@@ -2167,7 +2167,7 @@ static int mv_udc_probe(struct platform_device *pdev) |
8477 |
+ return -ENODEV; |
8478 |
+ } |
8479 |
+ |
8480 |
+- udc->phy_regs = ioremap(r->start, resource_size(r)); |
8481 |
++ udc->phy_regs = devm_ioremap(&pdev->dev, r->start, resource_size(r)); |
8482 |
+ if (udc->phy_regs == NULL) { |
8483 |
+ dev_err(&pdev->dev, "failed to map phy I/O memory\n"); |
8484 |
+ return -EBUSY; |
8485 |
+diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c |
8486 |
+index 1463c398d322..fe1d5fc7da2d 100644 |
8487 |
+--- a/drivers/usb/host/ohci-q.c |
8488 |
++++ b/drivers/usb/host/ohci-q.c |
8489 |
+@@ -980,10 +980,6 @@ rescan_all: |
8490 |
+ int completed, modified; |
8491 |
+ __hc32 *prev; |
8492 |
+ |
8493 |
+- /* Is this ED already invisible to the hardware? */ |
8494 |
+- if (ed->state == ED_IDLE) |
8495 |
+- goto ed_idle; |
8496 |
+- |
8497 |
+ /* only take off EDs that the HC isn't using, accounting for |
8498 |
+ * frame counter wraps and EDs with partially retired TDs |
8499 |
+ */ |
8500 |
+@@ -1011,12 +1007,10 @@ skip_ed: |
8501 |
+ } |
8502 |
+ |
8503 |
+ /* ED's now officially unlinked, hc doesn't see */ |
8504 |
+- ed->state = ED_IDLE; |
8505 |
+ ed->hwHeadP &= ~cpu_to_hc32(ohci, ED_H); |
8506 |
+ ed->hwNextED = 0; |
8507 |
+ wmb(); |
8508 |
+ ed->hwINFO &= ~cpu_to_hc32(ohci, ED_SKIP | ED_DEQUEUE); |
8509 |
+-ed_idle: |
8510 |
+ |
8511 |
+ /* reentrancy: if we drop the schedule lock, someone might |
8512 |
+ * have modified this list. normally it's just prepending |
8513 |
+@@ -1087,6 +1081,7 @@ rescan_this: |
8514 |
+ if (list_empty(&ed->td_list)) { |
8515 |
+ *last = ed->ed_next; |
8516 |
+ ed->ed_next = NULL; |
8517 |
++ ed->state = ED_IDLE; |
8518 |
+ list_del(&ed->in_use_list); |
8519 |
+ } else if (ohci->rh_state == OHCI_RH_RUNNING) { |
8520 |
+ *last = ed->ed_next; |
8521 |
+diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c |
8522 |
+index f8336408ef07..3e442f77a2b9 100644 |
8523 |
+--- a/drivers/usb/host/xhci-mem.c |
8524 |
++++ b/drivers/usb/host/xhci-mem.c |
8525 |
+@@ -1427,10 +1427,10 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, |
8526 |
+ /* Attempt to use the ring cache */ |
8527 |
+ if (virt_dev->num_rings_cached == 0) |
8528 |
+ return -ENOMEM; |
8529 |
++ virt_dev->num_rings_cached--; |
8530 |
+ virt_dev->eps[ep_index].new_ring = |
8531 |
+ virt_dev->ring_cache[virt_dev->num_rings_cached]; |
8532 |
+ virt_dev->ring_cache[virt_dev->num_rings_cached] = NULL; |
8533 |
+- virt_dev->num_rings_cached--; |
8534 |
+ xhci_reinit_cached_ring(xhci, virt_dev->eps[ep_index].new_ring, |
8535 |
+ 1, type); |
8536 |
+ } |
8537 |
+diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c |
8538 |
+index 86c4b533e90b..4731baca377f 100644 |
8539 |
+--- a/drivers/usb/musb/musb_virthub.c |
8540 |
++++ b/drivers/usb/musb/musb_virthub.c |
8541 |
+@@ -273,9 +273,7 @@ static int musb_has_gadget(struct musb *musb) |
8542 |
+ #ifdef CONFIG_USB_MUSB_HOST |
8543 |
+ return 1; |
8544 |
+ #else |
8545 |
+- if (musb->port_mode == MUSB_PORT_MODE_HOST) |
8546 |
+- return 1; |
8547 |
+- return musb->g.dev.driver != NULL; |
8548 |
++ return musb->port_mode == MUSB_PORT_MODE_HOST; |
8549 |
+ #endif |
8550 |
+ } |
8551 |
+ |
8552 |
+diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c |
8553 |
+index 8f7cb068d29b..3fcc0483a081 100644 |
8554 |
+--- a/drivers/usb/phy/phy-mxs-usb.c |
8555 |
++++ b/drivers/usb/phy/phy-mxs-usb.c |
8556 |
+@@ -217,6 +217,9 @@ static bool mxs_phy_get_vbus_status(struct mxs_phy *mxs_phy) |
8557 |
+ { |
8558 |
+ unsigned int vbus_value; |
8559 |
+ |
8560 |
++ if (!mxs_phy->regmap_anatop) |
8561 |
++ return false; |
8562 |
++ |
8563 |
+ if (mxs_phy->port_id == 0) |
8564 |
+ regmap_read(mxs_phy->regmap_anatop, |
8565 |
+ ANADIG_USB1_VBUS_DET_STAT, |
8566 |
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
8567 |
+index ffd739e31bfc..eac7ccaa3c85 100644 |
8568 |
+--- a/drivers/usb/serial/cp210x.c |
8569 |
++++ b/drivers/usb/serial/cp210x.c |
8570 |
+@@ -187,6 +187,7 @@ static const struct usb_device_id id_table[] = { |
8571 |
+ { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */ |
8572 |
+ { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */ |
8573 |
+ { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */ |
8574 |
++ { USB_DEVICE(0x2626, 0xEA60) }, /* Aruba Networks 7xxx USB Serial Console */ |
8575 |
+ { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ |
8576 |
+ { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ |
8577 |
+ { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ |
8578 |
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
8579 |
+index f0c0c53359ad..19b85ee98a72 100644 |
8580 |
+--- a/drivers/usb/serial/option.c |
8581 |
++++ b/drivers/usb/serial/option.c |
8582 |
+@@ -1765,6 +1765,7 @@ static const struct usb_device_id option_ids[] = { |
8583 |
+ { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) }, |
8584 |
+ { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ |
8585 |
+ { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ |
8586 |
++ { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ |
8587 |
+ { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, |
8588 |
+ { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, |
8589 |
+ { } /* Terminating entry */ |
8590 |
+diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c |
8591 |
+index 529066bbc7e8..46f1f13b41f1 100644 |
8592 |
+--- a/drivers/usb/serial/usb-serial.c |
8593 |
++++ b/drivers/usb/serial/usb-serial.c |
8594 |
+@@ -1306,6 +1306,7 @@ static void __exit usb_serial_exit(void) |
8595 |
+ tty_unregister_driver(usb_serial_tty_driver); |
8596 |
+ put_tty_driver(usb_serial_tty_driver); |
8597 |
+ bus_unregister(&usb_serial_bus_type); |
8598 |
++ idr_destroy(&serial_minors); |
8599 |
+ } |
8600 |
+ |
8601 |
+ |
8602 |
+diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c |
8603 |
+index 1f11a20a8ab9..55eb86c9e214 100644 |
8604 |
+--- a/drivers/w1/slaves/w1_therm.c |
8605 |
++++ b/drivers/w1/slaves/w1_therm.c |
8606 |
+@@ -59,16 +59,32 @@ MODULE_ALIAS("w1-family-" __stringify(W1_THERM_DS28EA00)); |
8607 |
+ static int w1_strong_pullup = 1; |
8608 |
+ module_param_named(strong_pullup, w1_strong_pullup, int, 0); |
8609 |
+ |
8610 |
++struct w1_therm_family_data { |
8611 |
++ uint8_t rom[9]; |
8612 |
++ atomic_t refcnt; |
8613 |
++}; |
8614 |
++ |
8615 |
++/* return the address of the refcnt in the family data */ |
8616 |
++#define THERM_REFCNT(family_data) \ |
8617 |
++ (&((struct w1_therm_family_data*)family_data)->refcnt) |
8618 |
++ |
8619 |
+ static int w1_therm_add_slave(struct w1_slave *sl) |
8620 |
+ { |
8621 |
+- sl->family_data = kzalloc(9, GFP_KERNEL); |
8622 |
++ sl->family_data = kzalloc(sizeof(struct w1_therm_family_data), |
8623 |
++ GFP_KERNEL); |
8624 |
+ if (!sl->family_data) |
8625 |
+ return -ENOMEM; |
8626 |
++ atomic_set(THERM_REFCNT(sl->family_data), 1); |
8627 |
+ return 0; |
8628 |
+ } |
8629 |
+ |
8630 |
+ static void w1_therm_remove_slave(struct w1_slave *sl) |
8631 |
+ { |
8632 |
++ int refcnt = atomic_sub_return(1, THERM_REFCNT(sl->family_data)); |
8633 |
++ while(refcnt) { |
8634 |
++ msleep(1000); |
8635 |
++ refcnt = atomic_read(THERM_REFCNT(sl->family_data)); |
8636 |
++ } |
8637 |
+ kfree(sl->family_data); |
8638 |
+ sl->family_data = NULL; |
8639 |
+ } |
8640 |
+@@ -194,13 +210,22 @@ static ssize_t w1_slave_show(struct device *device, |
8641 |
+ struct w1_slave *sl = dev_to_w1_slave(device); |
8642 |
+ struct w1_master *dev = sl->master; |
8643 |
+ u8 rom[9], crc, verdict, external_power; |
8644 |
+- int i, max_trying = 10; |
8645 |
++ int i, ret, max_trying = 10; |
8646 |
+ ssize_t c = PAGE_SIZE; |
8647 |
++ u8 *family_data = sl->family_data; |
8648 |
++ |
8649 |
++ ret = mutex_lock_interruptible(&dev->bus_mutex); |
8650 |
++ if (ret != 0) |
8651 |
++ goto post_unlock; |
8652 |
+ |
8653 |
+- i = mutex_lock_interruptible(&dev->bus_mutex); |
8654 |
+- if (i != 0) |
8655 |
+- return i; |
8656 |
++ if(!sl->family_data) |
8657 |
++ { |
8658 |
++ ret = -ENODEV; |
8659 |
++ goto pre_unlock; |
8660 |
++ } |
8661 |
+ |
8662 |
++ /* prevent the slave from going away in sleep */ |
8663 |
++ atomic_inc(THERM_REFCNT(family_data)); |
8664 |
+ memset(rom, 0, sizeof(rom)); |
8665 |
+ |
8666 |
+ while (max_trying--) { |
8667 |
+@@ -230,17 +255,19 @@ static ssize_t w1_slave_show(struct device *device, |
8668 |
+ mutex_unlock(&dev->bus_mutex); |
8669 |
+ |
8670 |
+ sleep_rem = msleep_interruptible(tm); |
8671 |
+- if (sleep_rem != 0) |
8672 |
+- return -EINTR; |
8673 |
++ if (sleep_rem != 0) { |
8674 |
++ ret = -EINTR; |
8675 |
++ goto post_unlock; |
8676 |
++ } |
8677 |
+ |
8678 |
+- i = mutex_lock_interruptible(&dev->bus_mutex); |
8679 |
+- if (i != 0) |
8680 |
+- return i; |
8681 |
++ ret = mutex_lock_interruptible(&dev->bus_mutex); |
8682 |
++ if (ret != 0) |
8683 |
++ goto post_unlock; |
8684 |
+ } else if (!w1_strong_pullup) { |
8685 |
+ sleep_rem = msleep_interruptible(tm); |
8686 |
+ if (sleep_rem != 0) { |
8687 |
+- mutex_unlock(&dev->bus_mutex); |
8688 |
+- return -EINTR; |
8689 |
++ ret = -EINTR; |
8690 |
++ goto pre_unlock; |
8691 |
+ } |
8692 |
+ } |
8693 |
+ |
8694 |
+@@ -269,19 +296,24 @@ static ssize_t w1_slave_show(struct device *device, |
8695 |
+ c -= snprintf(buf + PAGE_SIZE - c, c, ": crc=%02x %s\n", |
8696 |
+ crc, (verdict) ? "YES" : "NO"); |
8697 |
+ if (verdict) |
8698 |
+- memcpy(sl->family_data, rom, sizeof(rom)); |
8699 |
++ memcpy(family_data, rom, sizeof(rom)); |
8700 |
+ else |
8701 |
+ dev_warn(device, "Read failed CRC check\n"); |
8702 |
+ |
8703 |
+ for (i = 0; i < 9; ++i) |
8704 |
+ c -= snprintf(buf + PAGE_SIZE - c, c, "%02x ", |
8705 |
+- ((u8 *)sl->family_data)[i]); |
8706 |
++ ((u8 *)family_data)[i]); |
8707 |
+ |
8708 |
+ c -= snprintf(buf + PAGE_SIZE - c, c, "t=%d\n", |
8709 |
+ w1_convert_temp(rom, sl->family->fid)); |
8710 |
++ ret = PAGE_SIZE - c; |
8711 |
++ |
8712 |
++pre_unlock: |
8713 |
+ mutex_unlock(&dev->bus_mutex); |
8714 |
+ |
8715 |
+- return PAGE_SIZE - c; |
8716 |
++post_unlock: |
8717 |
++ atomic_dec(THERM_REFCNT(family_data)); |
8718 |
++ return ret; |
8719 |
+ } |
8720 |
+ |
8721 |
+ static int __init w1_therm_init(void) |
8722 |
+diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c |
8723 |
+index 1e6be9e40577..c9c97dacf452 100644 |
8724 |
+--- a/drivers/watchdog/omap_wdt.c |
8725 |
++++ b/drivers/watchdog/omap_wdt.c |
8726 |
+@@ -132,6 +132,13 @@ static int omap_wdt_start(struct watchdog_device *wdog) |
8727 |
+ |
8728 |
+ pm_runtime_get_sync(wdev->dev); |
8729 |
+ |
8730 |
++ /* |
8731 |
++ * Make sure the watchdog is disabled. This is unfortunately required |
8732 |
++ * because writing to various registers with the watchdog running has no |
8733 |
++ * effect. |
8734 |
++ */ |
8735 |
++ omap_wdt_disable(wdev); |
8736 |
++ |
8737 |
+ /* initialize prescaler */ |
8738 |
+ while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x01) |
8739 |
+ cpu_relax(); |
8740 |
+diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c |
8741 |
+index 703342e309f5..53f1e8a21707 100644 |
8742 |
+--- a/fs/9p/vfs_inode.c |
8743 |
++++ b/fs/9p/vfs_inode.c |
8744 |
+@@ -540,8 +540,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, |
8745 |
+ unlock_new_inode(inode); |
8746 |
+ return inode; |
8747 |
+ error: |
8748 |
+- unlock_new_inode(inode); |
8749 |
+- iput(inode); |
8750 |
++ iget_failed(inode); |
8751 |
+ return ERR_PTR(retval); |
8752 |
+ |
8753 |
+ } |
8754 |
+diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c |
8755 |
+index 9861c7c951a6..4d3ecfb55fcf 100644 |
8756 |
+--- a/fs/9p/vfs_inode_dotl.c |
8757 |
++++ b/fs/9p/vfs_inode_dotl.c |
8758 |
+@@ -149,8 +149,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, |
8759 |
+ unlock_new_inode(inode); |
8760 |
+ return inode; |
8761 |
+ error: |
8762 |
+- unlock_new_inode(inode); |
8763 |
+- iput(inode); |
8764 |
++ iget_failed(inode); |
8765 |
+ return ERR_PTR(retval); |
8766 |
+ |
8767 |
+ } |
8768 |
+diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c |
8769 |
+index f6a596d5a637..d4a582ac3f73 100644 |
8770 |
+--- a/fs/btrfs/inode-map.c |
8771 |
++++ b/fs/btrfs/inode-map.c |
8772 |
+@@ -246,6 +246,7 @@ void btrfs_unpin_free_ino(struct btrfs_root *root) |
8773 |
+ { |
8774 |
+ struct btrfs_free_space_ctl *ctl = root->free_ino_ctl; |
8775 |
+ struct rb_root *rbroot = &root->free_ino_pinned->free_space_offset; |
8776 |
++ spinlock_t *rbroot_lock = &root->free_ino_pinned->tree_lock; |
8777 |
+ struct btrfs_free_space *info; |
8778 |
+ struct rb_node *n; |
8779 |
+ u64 count; |
8780 |
+@@ -254,24 +255,30 @@ void btrfs_unpin_free_ino(struct btrfs_root *root) |
8781 |
+ return; |
8782 |
+ |
8783 |
+ while (1) { |
8784 |
++ bool add_to_ctl = true; |
8785 |
++ |
8786 |
++ spin_lock(rbroot_lock); |
8787 |
+ n = rb_first(rbroot); |
8788 |
+- if (!n) |
8789 |
++ if (!n) { |
8790 |
++ spin_unlock(rbroot_lock); |
8791 |
+ break; |
8792 |
++ } |
8793 |
+ |
8794 |
+ info = rb_entry(n, struct btrfs_free_space, offset_index); |
8795 |
+ BUG_ON(info->bitmap); /* Logic error */ |
8796 |
+ |
8797 |
+ if (info->offset > root->ino_cache_progress) |
8798 |
+- goto free; |
8799 |
++ add_to_ctl = false; |
8800 |
+ else if (info->offset + info->bytes > root->ino_cache_progress) |
8801 |
+ count = root->ino_cache_progress - info->offset + 1; |
8802 |
+ else |
8803 |
+ count = info->bytes; |
8804 |
+ |
8805 |
+- __btrfs_add_free_space(ctl, info->offset, count); |
8806 |
+-free: |
8807 |
+ rb_erase(&info->offset_index, rbroot); |
8808 |
+- kfree(info); |
8809 |
++ spin_unlock(rbroot_lock); |
8810 |
++ if (add_to_ctl) |
8811 |
++ __btrfs_add_free_space(ctl, info->offset, count); |
8812 |
++ kmem_cache_free(btrfs_free_space_cachep, info); |
8813 |
+ } |
8814 |
+ } |
8815 |
+ |
8816 |
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c |
8817 |
+index 1c22c6518504..37d456a9a3b8 100644 |
8818 |
+--- a/fs/btrfs/ioctl.c |
8819 |
++++ b/fs/btrfs/ioctl.c |
8820 |
+@@ -2413,8 +2413,6 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, |
8821 |
+ goto out_unlock_inode; |
8822 |
+ } |
8823 |
+ |
8824 |
+- d_invalidate(dentry); |
8825 |
+- |
8826 |
+ down_write(&root->fs_info->subvol_sem); |
8827 |
+ |
8828 |
+ err = may_destroy_subvol(dest); |
8829 |
+@@ -2508,7 +2506,7 @@ out_up_write: |
8830 |
+ out_unlock_inode: |
8831 |
+ mutex_unlock(&inode->i_mutex); |
8832 |
+ if (!err) { |
8833 |
+- shrink_dcache_sb(root->fs_info->sb); |
8834 |
++ d_invalidate(dentry); |
8835 |
+ btrfs_invalidate_inodes(dest); |
8836 |
+ d_delete(dentry); |
8837 |
+ ASSERT(dest->send_in_progress == 0); |
8838 |
+@@ -2940,7 +2938,7 @@ out_unlock: |
8839 |
+ static long btrfs_ioctl_file_extent_same(struct file *file, |
8840 |
+ struct btrfs_ioctl_same_args __user *argp) |
8841 |
+ { |
8842 |
+- struct btrfs_ioctl_same_args *same; |
8843 |
++ struct btrfs_ioctl_same_args *same = NULL; |
8844 |
+ struct btrfs_ioctl_same_extent_info *info; |
8845 |
+ struct inode *src = file_inode(file); |
8846 |
+ u64 off; |
8847 |
+@@ -2970,6 +2968,7 @@ static long btrfs_ioctl_file_extent_same(struct file *file, |
8848 |
+ |
8849 |
+ if (IS_ERR(same)) { |
8850 |
+ ret = PTR_ERR(same); |
8851 |
++ same = NULL; |
8852 |
+ goto out; |
8853 |
+ } |
8854 |
+ |
8855 |
+@@ -3040,6 +3039,7 @@ static long btrfs_ioctl_file_extent_same(struct file *file, |
8856 |
+ |
8857 |
+ out: |
8858 |
+ mnt_drop_write_file(file); |
8859 |
++ kfree(same); |
8860 |
+ return ret; |
8861 |
+ } |
8862 |
+ |
8863 |
+@@ -3434,6 +3434,20 @@ process_slot: |
8864 |
+ u64 trim = 0; |
8865 |
+ u64 aligned_end = 0; |
8866 |
+ |
8867 |
++ /* |
8868 |
++ * Don't copy an inline extent into an offset |
8869 |
++ * greater than zero. Having an inline extent |
8870 |
++ * at such an offset results in chaos as btrfs |
8871 |
++ * isn't prepared for such cases. Just skip |
8872 |
++ * this case for the same reasons as commented |
8873 |
++ * at btrfs_ioctl_clone(). |
8874 |
++ */ |
8875 |
++ if (last_dest_end > 0) { |
8876 |
++ ret = -EOPNOTSUPP; |
8877 |
++ btrfs_end_transaction(trans, root); |
8878 |
++ goto out; |
8879 |
++ } |
8880 |
++ |
8881 |
+ if (off > key.offset) { |
8882 |
+ skip = off - key.offset; |
8883 |
+ new_key.offset += skip; |
8884 |
+diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c |
8885 |
+index 5628e25250c0..94e909c5a503 100644 |
8886 |
+--- a/fs/btrfs/transaction.c |
8887 |
++++ b/fs/btrfs/transaction.c |
8888 |
+@@ -758,7 +758,7 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, |
8889 |
+ |
8890 |
+ if (!list_empty(&trans->ordered)) { |
8891 |
+ spin_lock(&info->trans_lock); |
8892 |
+- list_splice(&trans->ordered, &cur_trans->pending_ordered); |
8893 |
++ list_splice_init(&trans->ordered, &cur_trans->pending_ordered); |
8894 |
+ spin_unlock(&info->trans_lock); |
8895 |
+ } |
8896 |
+ |
8897 |
+@@ -1848,7 +1848,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, |
8898 |
+ } |
8899 |
+ |
8900 |
+ spin_lock(&root->fs_info->trans_lock); |
8901 |
+- list_splice(&trans->ordered, &cur_trans->pending_ordered); |
8902 |
++ list_splice_init(&trans->ordered, &cur_trans->pending_ordered); |
8903 |
+ if (cur_trans->state >= TRANS_STATE_COMMIT_START) { |
8904 |
+ spin_unlock(&root->fs_info->trans_lock); |
8905 |
+ atomic_inc(&cur_trans->use_count); |
8906 |
+diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
8907 |
+index d04968374e9d..4920fceffacb 100644 |
8908 |
+--- a/fs/btrfs/tree-log.c |
8909 |
++++ b/fs/btrfs/tree-log.c |
8910 |
+@@ -4161,6 +4161,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, |
8911 |
+ u64 ino = btrfs_ino(inode); |
8912 |
+ struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; |
8913 |
+ u64 logged_isize = 0; |
8914 |
++ bool need_log_inode_item = true; |
8915 |
+ |
8916 |
+ path = btrfs_alloc_path(); |
8917 |
+ if (!path) |
8918 |
+@@ -4269,11 +4270,6 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, |
8919 |
+ } else { |
8920 |
+ if (inode_only == LOG_INODE_ALL) |
8921 |
+ fast_search = true; |
8922 |
+- ret = log_inode_item(trans, log, dst_path, inode); |
8923 |
+- if (ret) { |
8924 |
+- err = ret; |
8925 |
+- goto out_unlock; |
8926 |
+- } |
8927 |
+ goto log_extents; |
8928 |
+ } |
8929 |
+ |
8930 |
+@@ -4296,6 +4292,9 @@ again: |
8931 |
+ if (min_key.type > max_key.type) |
8932 |
+ break; |
8933 |
+ |
8934 |
++ if (min_key.type == BTRFS_INODE_ITEM_KEY) |
8935 |
++ need_log_inode_item = false; |
8936 |
++ |
8937 |
+ src = path->nodes[0]; |
8938 |
+ if (ins_nr && ins_start_slot + ins_nr == path->slots[0]) { |
8939 |
+ ins_nr++; |
8940 |
+@@ -4366,6 +4365,11 @@ next_slot: |
8941 |
+ log_extents: |
8942 |
+ btrfs_release_path(path); |
8943 |
+ btrfs_release_path(dst_path); |
8944 |
++ if (need_log_inode_item) { |
8945 |
++ err = log_inode_item(trans, log, dst_path, inode); |
8946 |
++ if (err) |
8947 |
++ goto out_unlock; |
8948 |
++ } |
8949 |
+ if (fast_search) { |
8950 |
+ /* |
8951 |
+ * Some ordered extents started by fsync might have completed |
8952 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
8953 |
+index e003a1e81dc3..87ba10d1d3bc 100644 |
8954 |
+--- a/fs/ext4/extents.c |
8955 |
++++ b/fs/ext4/extents.c |
8956 |
+@@ -503,7 +503,7 @@ __read_extent_tree_block(const char *function, unsigned int line, |
8957 |
+ struct buffer_head *bh; |
8958 |
+ int err; |
8959 |
+ |
8960 |
+- bh = sb_getblk(inode->i_sb, pblk); |
8961 |
++ bh = sb_getblk_gfp(inode->i_sb, pblk, __GFP_MOVABLE | GFP_NOFS); |
8962 |
+ if (unlikely(!bh)) |
8963 |
+ return ERR_PTR(-ENOMEM); |
8964 |
+ |
8965 |
+@@ -1088,7 +1088,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode, |
8966 |
+ err = -EIO; |
8967 |
+ goto cleanup; |
8968 |
+ } |
8969 |
+- bh = sb_getblk(inode->i_sb, newblock); |
8970 |
++ bh = sb_getblk_gfp(inode->i_sb, newblock, __GFP_MOVABLE | GFP_NOFS); |
8971 |
+ if (unlikely(!bh)) { |
8972 |
+ err = -ENOMEM; |
8973 |
+ goto cleanup; |
8974 |
+@@ -1282,7 +1282,7 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode, |
8975 |
+ if (newblock == 0) |
8976 |
+ return err; |
8977 |
+ |
8978 |
+- bh = sb_getblk(inode->i_sb, newblock); |
8979 |
++ bh = sb_getblk_gfp(inode->i_sb, newblock, __GFP_MOVABLE | GFP_NOFS); |
8980 |
+ if (unlikely(!bh)) |
8981 |
+ return -ENOMEM; |
8982 |
+ lock_buffer(bh); |
8983 |
+diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c |
8984 |
+index 958824019509..94ae6874c2cb 100644 |
8985 |
+--- a/fs/ext4/indirect.c |
8986 |
++++ b/fs/ext4/indirect.c |
8987 |
+@@ -565,7 +565,7 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode, |
8988 |
+ EXT4_FEATURE_RO_COMPAT_BIGALLOC)) { |
8989 |
+ EXT4_ERROR_INODE(inode, "Can't allocate blocks for " |
8990 |
+ "non-extent mapped inodes with bigalloc"); |
8991 |
+- return -ENOSPC; |
8992 |
++ return -EUCLEAN; |
8993 |
+ } |
8994 |
+ |
8995 |
+ /* Set up for the direct block allocation */ |
8996 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
8997 |
+index 0554b0b5957b..966c614822cc 100644 |
8998 |
+--- a/fs/ext4/inode.c |
8999 |
++++ b/fs/ext4/inode.c |
9000 |
+@@ -1342,7 +1342,7 @@ static void ext4_da_page_release_reservation(struct page *page, |
9001 |
+ unsigned int offset, |
9002 |
+ unsigned int length) |
9003 |
+ { |
9004 |
+- int to_release = 0; |
9005 |
++ int to_release = 0, contiguous_blks = 0; |
9006 |
+ struct buffer_head *head, *bh; |
9007 |
+ unsigned int curr_off = 0; |
9008 |
+ struct inode *inode = page->mapping->host; |
9009 |
+@@ -1363,14 +1363,23 @@ static void ext4_da_page_release_reservation(struct page *page, |
9010 |
+ |
9011 |
+ if ((offset <= curr_off) && (buffer_delay(bh))) { |
9012 |
+ to_release++; |
9013 |
++ contiguous_blks++; |
9014 |
+ clear_buffer_delay(bh); |
9015 |
++ } else if (contiguous_blks) { |
9016 |
++ lblk = page->index << |
9017 |
++ (PAGE_CACHE_SHIFT - inode->i_blkbits); |
9018 |
++ lblk += (curr_off >> inode->i_blkbits) - |
9019 |
++ contiguous_blks; |
9020 |
++ ext4_es_remove_extent(inode, lblk, contiguous_blks); |
9021 |
++ contiguous_blks = 0; |
9022 |
+ } |
9023 |
+ curr_off = next_off; |
9024 |
+ } while ((bh = bh->b_this_page) != head); |
9025 |
+ |
9026 |
+- if (to_release) { |
9027 |
++ if (contiguous_blks) { |
9028 |
+ lblk = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits); |
9029 |
+- ext4_es_remove_extent(inode, lblk, to_release); |
9030 |
++ lblk += (curr_off >> inode->i_blkbits) - contiguous_blks; |
9031 |
++ ext4_es_remove_extent(inode, lblk, contiguous_blks); |
9032 |
+ } |
9033 |
+ |
9034 |
+ /* If we have released all the blocks belonging to a cluster, then we |
9035 |
+@@ -1701,19 +1710,32 @@ static int __ext4_journalled_writepage(struct page *page, |
9036 |
+ ext4_walk_page_buffers(handle, page_bufs, 0, len, |
9037 |
+ NULL, bget_one); |
9038 |
+ } |
9039 |
+- /* As soon as we unlock the page, it can go away, but we have |
9040 |
+- * references to buffers so we are safe */ |
9041 |
++ /* |
9042 |
++ * We need to release the page lock before we start the |
9043 |
++ * journal, so grab a reference so the page won't disappear |
9044 |
++ * out from under us. |
9045 |
++ */ |
9046 |
++ get_page(page); |
9047 |
+ unlock_page(page); |
9048 |
+ |
9049 |
+ handle = ext4_journal_start(inode, EXT4_HT_WRITE_PAGE, |
9050 |
+ ext4_writepage_trans_blocks(inode)); |
9051 |
+ if (IS_ERR(handle)) { |
9052 |
+ ret = PTR_ERR(handle); |
9053 |
+- goto out; |
9054 |
++ put_page(page); |
9055 |
++ goto out_no_pagelock; |
9056 |
+ } |
9057 |
+- |
9058 |
+ BUG_ON(!ext4_handle_valid(handle)); |
9059 |
+ |
9060 |
++ lock_page(page); |
9061 |
++ put_page(page); |
9062 |
++ if (page->mapping != mapping) { |
9063 |
++ /* The page got truncated from under us */ |
9064 |
++ ext4_journal_stop(handle); |
9065 |
++ ret = 0; |
9066 |
++ goto out; |
9067 |
++ } |
9068 |
++ |
9069 |
+ if (inline_data) { |
9070 |
+ BUFFER_TRACE(inode_bh, "get write access"); |
9071 |
+ ret = ext4_journal_get_write_access(handle, inode_bh); |
9072 |
+@@ -1739,6 +1761,8 @@ static int __ext4_journalled_writepage(struct page *page, |
9073 |
+ NULL, bput_one); |
9074 |
+ ext4_set_inode_state(inode, EXT4_STATE_JDATA); |
9075 |
+ out: |
9076 |
++ unlock_page(page); |
9077 |
++out_no_pagelock: |
9078 |
+ brelse(inode_bh); |
9079 |
+ return ret; |
9080 |
+ } |
9081 |
+@@ -4345,7 +4369,12 @@ static void ext4_update_other_inodes_time(struct super_block *sb, |
9082 |
+ int inode_size = EXT4_INODE_SIZE(sb); |
9083 |
+ |
9084 |
+ oi.orig_ino = orig_ino; |
9085 |
+- ino = (orig_ino & ~(inodes_per_block - 1)) + 1; |
9086 |
++ /* |
9087 |
++ * Calculate the first inode in the inode table block. Inode |
9088 |
++ * numbers are one-based. That is, the first inode in a block |
9089 |
++ * (assuming 4k blocks and 256 byte inodes) is (n*16 + 1). |
9090 |
++ */ |
9091 |
++ ino = ((orig_ino - 1) & ~(inodes_per_block - 1)) + 1; |
9092 |
+ for (i = 0; i < inodes_per_block; i++, ino++, buf += inode_size) { |
9093 |
+ if (ino == orig_ino) |
9094 |
+ continue; |
9095 |
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
9096 |
+index 8d1e60214ef0..41260489d3bc 100644 |
9097 |
+--- a/fs/ext4/mballoc.c |
9098 |
++++ b/fs/ext4/mballoc.c |
9099 |
+@@ -4800,18 +4800,12 @@ do_more: |
9100 |
+ /* |
9101 |
+ * blocks being freed are metadata. these blocks shouldn't |
9102 |
+ * be used until this transaction is committed |
9103 |
++ * |
9104 |
++ * We use __GFP_NOFAIL because ext4_free_blocks() is not allowed |
9105 |
++ * to fail. |
9106 |
+ */ |
9107 |
+- retry: |
9108 |
+- new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS); |
9109 |
+- if (!new_entry) { |
9110 |
+- /* |
9111 |
+- * We use a retry loop because |
9112 |
+- * ext4_free_blocks() is not allowed to fail. |
9113 |
+- */ |
9114 |
+- cond_resched(); |
9115 |
+- congestion_wait(BLK_RW_ASYNC, HZ/50); |
9116 |
+- goto retry; |
9117 |
+- } |
9118 |
++ new_entry = kmem_cache_alloc(ext4_free_data_cachep, |
9119 |
++ GFP_NOFS|__GFP_NOFAIL); |
9120 |
+ new_entry->efd_start_cluster = bit; |
9121 |
+ new_entry->efd_group = block_group; |
9122 |
+ new_entry->efd_count = count_clusters; |
9123 |
+diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c |
9124 |
+index b52374e42102..6163ad21cb0e 100644 |
9125 |
+--- a/fs/ext4/migrate.c |
9126 |
++++ b/fs/ext4/migrate.c |
9127 |
+@@ -620,6 +620,7 @@ int ext4_ind_migrate(struct inode *inode) |
9128 |
+ struct ext4_inode_info *ei = EXT4_I(inode); |
9129 |
+ struct ext4_extent *ex; |
9130 |
+ unsigned int i, len; |
9131 |
++ ext4_lblk_t start, end; |
9132 |
+ ext4_fsblk_t blk; |
9133 |
+ handle_t *handle; |
9134 |
+ int ret; |
9135 |
+@@ -633,6 +634,14 @@ int ext4_ind_migrate(struct inode *inode) |
9136 |
+ EXT4_FEATURE_RO_COMPAT_BIGALLOC)) |
9137 |
+ return -EOPNOTSUPP; |
9138 |
+ |
9139 |
++ /* |
9140 |
++ * In order to get correct extent info, force all delayed allocation |
9141 |
++ * blocks to be allocated, otherwise delayed allocation blocks may not |
9142 |
++ * be reflected and bypass the checks on extent header. |
9143 |
++ */ |
9144 |
++ if (test_opt(inode->i_sb, DELALLOC)) |
9145 |
++ ext4_alloc_da_blocks(inode); |
9146 |
++ |
9147 |
+ handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, 1); |
9148 |
+ if (IS_ERR(handle)) |
9149 |
+ return PTR_ERR(handle); |
9150 |
+@@ -650,11 +659,13 @@ int ext4_ind_migrate(struct inode *inode) |
9151 |
+ goto errout; |
9152 |
+ } |
9153 |
+ if (eh->eh_entries == 0) |
9154 |
+- blk = len = 0; |
9155 |
++ blk = len = start = end = 0; |
9156 |
+ else { |
9157 |
+ len = le16_to_cpu(ex->ee_len); |
9158 |
+ blk = ext4_ext_pblock(ex); |
9159 |
+- if (len > EXT4_NDIR_BLOCKS) { |
9160 |
++ start = le32_to_cpu(ex->ee_block); |
9161 |
++ end = start + len - 1; |
9162 |
++ if (end >= EXT4_NDIR_BLOCKS) { |
9163 |
+ ret = -EOPNOTSUPP; |
9164 |
+ goto errout; |
9165 |
+ } |
9166 |
+@@ -662,7 +673,7 @@ int ext4_ind_migrate(struct inode *inode) |
9167 |
+ |
9168 |
+ ext4_clear_inode_flag(inode, EXT4_INODE_EXTENTS); |
9169 |
+ memset(ei->i_data, 0, sizeof(ei->i_data)); |
9170 |
+- for (i=0; i < len; i++) |
9171 |
++ for (i = start; i <= end; i++) |
9172 |
+ ei->i_data[i] = cpu_to_le32(blk++); |
9173 |
+ ext4_mark_inode_dirty(handle, inode); |
9174 |
+ errout: |
9175 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
9176 |
+index ca9d4a2fed41..ca12affdba96 100644 |
9177 |
+--- a/fs/ext4/super.c |
9178 |
++++ b/fs/ext4/super.c |
9179 |
+@@ -807,6 +807,7 @@ static void ext4_put_super(struct super_block *sb) |
9180 |
+ dump_orphan_list(sb, sbi); |
9181 |
+ J_ASSERT(list_empty(&sbi->s_orphan)); |
9182 |
+ |
9183 |
++ sync_blockdev(sb->s_bdev); |
9184 |
+ invalidate_bdev(sb->s_bdev); |
9185 |
+ if (sbi->journal_bdev && sbi->journal_bdev != sb->s_bdev) { |
9186 |
+ /* |
9187 |
+@@ -4943,6 +4944,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
9188 |
+ set_task_ioprio(sbi->s_journal->j_task, journal_ioprio); |
9189 |
+ } |
9190 |
+ |
9191 |
++ if (*flags & MS_LAZYTIME) |
9192 |
++ sb->s_flags |= MS_LAZYTIME; |
9193 |
++ |
9194 |
+ if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { |
9195 |
+ if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) { |
9196 |
+ err = -EROFS; |
9197 |
+diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c |
9198 |
+index 18dacf9ed8ff..708d697113fc 100644 |
9199 |
+--- a/fs/fuse/inode.c |
9200 |
++++ b/fs/fuse/inode.c |
9201 |
+@@ -1026,6 +1026,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) |
9202 |
+ goto err_fput; |
9203 |
+ |
9204 |
+ fuse_conn_init(fc); |
9205 |
++ fc->release = fuse_free_conn; |
9206 |
+ |
9207 |
+ fc->dev = sb->s_dev; |
9208 |
+ fc->sb = sb; |
9209 |
+@@ -1040,7 +1041,6 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) |
9210 |
+ fc->dont_mask = 1; |
9211 |
+ sb->s_flags |= MS_POSIXACL; |
9212 |
+ |
9213 |
+- fc->release = fuse_free_conn; |
9214 |
+ fc->flags = d.flags; |
9215 |
+ fc->user_id = d.user_id; |
9216 |
+ fc->group_id = d.group_id; |
9217 |
+diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c |
9218 |
+index 7cd00d3a7c9b..8685c655737f 100644 |
9219 |
+--- a/fs/hpfs/super.c |
9220 |
++++ b/fs/hpfs/super.c |
9221 |
+@@ -52,17 +52,20 @@ static void unmark_dirty(struct super_block *s) |
9222 |
+ } |
9223 |
+ |
9224 |
+ /* Filesystem error... */ |
9225 |
+-static char err_buf[1024]; |
9226 |
+- |
9227 |
+ void hpfs_error(struct super_block *s, const char *fmt, ...) |
9228 |
+ { |
9229 |
++ struct va_format vaf; |
9230 |
+ va_list args; |
9231 |
+ |
9232 |
+ va_start(args, fmt); |
9233 |
+- vsnprintf(err_buf, sizeof(err_buf), fmt, args); |
9234 |
++ |
9235 |
++ vaf.fmt = fmt; |
9236 |
++ vaf.va = &args; |
9237 |
++ |
9238 |
++ pr_err("filesystem error: %pV", &vaf); |
9239 |
++ |
9240 |
+ va_end(args); |
9241 |
+ |
9242 |
+- pr_err("filesystem error: %s", err_buf); |
9243 |
+ if (!hpfs_sb(s)->sb_was_error) { |
9244 |
+ if (hpfs_sb(s)->sb_err == 2) { |
9245 |
+ pr_cont("; crashing the system because you wanted it\n"); |
9246 |
+@@ -424,11 +427,14 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) |
9247 |
+ int o; |
9248 |
+ struct hpfs_sb_info *sbi = hpfs_sb(s); |
9249 |
+ char *new_opts = kstrdup(data, GFP_KERNEL); |
9250 |
+- |
9251 |
++ |
9252 |
++ if (!new_opts) |
9253 |
++ return -ENOMEM; |
9254 |
++ |
9255 |
+ sync_filesystem(s); |
9256 |
+ |
9257 |
+ *flags |= MS_NOATIME; |
9258 |
+- |
9259 |
++ |
9260 |
+ hpfs_lock(s); |
9261 |
+ uid = sbi->sb_uid; gid = sbi->sb_gid; |
9262 |
+ umask = 0777 & ~sbi->sb_mode; |
9263 |
+diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c |
9264 |
+index 988b32ed4c87..4227dc4f7437 100644 |
9265 |
+--- a/fs/jbd2/checkpoint.c |
9266 |
++++ b/fs/jbd2/checkpoint.c |
9267 |
+@@ -390,7 +390,7 @@ int jbd2_cleanup_journal_tail(journal_t *journal) |
9268 |
+ unsigned long blocknr; |
9269 |
+ |
9270 |
+ if (is_journal_aborted(journal)) |
9271 |
+- return 1; |
9272 |
++ return -EIO; |
9273 |
+ |
9274 |
+ if (!jbd2_journal_get_log_tail(journal, &first_tid, &blocknr)) |
9275 |
+ return 1; |
9276 |
+@@ -405,10 +405,9 @@ int jbd2_cleanup_journal_tail(journal_t *journal) |
9277 |
+ * jbd2_cleanup_journal_tail() doesn't get called all that often. |
9278 |
+ */ |
9279 |
+ if (journal->j_flags & JBD2_BARRIER) |
9280 |
+- blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL); |
9281 |
++ blkdev_issue_flush(journal->j_fs_dev, GFP_NOFS, NULL); |
9282 |
+ |
9283 |
+- __jbd2_update_log_tail(journal, first_tid, blocknr); |
9284 |
+- return 0; |
9285 |
++ return __jbd2_update_log_tail(journal, first_tid, blocknr); |
9286 |
+ } |
9287 |
+ |
9288 |
+ |
9289 |
+diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c |
9290 |
+index b96bd8076b70..112fad9e1e20 100644 |
9291 |
+--- a/fs/jbd2/journal.c |
9292 |
++++ b/fs/jbd2/journal.c |
9293 |
+@@ -885,9 +885,10 @@ int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid, |
9294 |
+ * |
9295 |
+ * Requires j_checkpoint_mutex |
9296 |
+ */ |
9297 |
+-void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block) |
9298 |
++int __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block) |
9299 |
+ { |
9300 |
+ unsigned long freed; |
9301 |
++ int ret; |
9302 |
+ |
9303 |
+ BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex)); |
9304 |
+ |
9305 |
+@@ -897,7 +898,10 @@ void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block) |
9306 |
+ * space and if we lose sb update during power failure we'd replay |
9307 |
+ * old transaction with possibly newly overwritten data. |
9308 |
+ */ |
9309 |
+- jbd2_journal_update_sb_log_tail(journal, tid, block, WRITE_FUA); |
9310 |
++ ret = jbd2_journal_update_sb_log_tail(journal, tid, block, WRITE_FUA); |
9311 |
++ if (ret) |
9312 |
++ goto out; |
9313 |
++ |
9314 |
+ write_lock(&journal->j_state_lock); |
9315 |
+ freed = block - journal->j_tail; |
9316 |
+ if (block < journal->j_tail) |
9317 |
+@@ -913,6 +917,9 @@ void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block) |
9318 |
+ journal->j_tail_sequence = tid; |
9319 |
+ journal->j_tail = block; |
9320 |
+ write_unlock(&journal->j_state_lock); |
9321 |
++ |
9322 |
++out: |
9323 |
++ return ret; |
9324 |
+ } |
9325 |
+ |
9326 |
+ /* |
9327 |
+@@ -1331,7 +1338,7 @@ static int journal_reset(journal_t *journal) |
9328 |
+ return jbd2_journal_start_thread(journal); |
9329 |
+ } |
9330 |
+ |
9331 |
+-static void jbd2_write_superblock(journal_t *journal, int write_op) |
9332 |
++static int jbd2_write_superblock(journal_t *journal, int write_op) |
9333 |
+ { |
9334 |
+ struct buffer_head *bh = journal->j_sb_buffer; |
9335 |
+ journal_superblock_t *sb = journal->j_superblock; |
9336 |
+@@ -1370,7 +1377,10 @@ static void jbd2_write_superblock(journal_t *journal, int write_op) |
9337 |
+ printk(KERN_ERR "JBD2: Error %d detected when updating " |
9338 |
+ "journal superblock for %s.\n", ret, |
9339 |
+ journal->j_devname); |
9340 |
++ jbd2_journal_abort(journal, ret); |
9341 |
+ } |
9342 |
++ |
9343 |
++ return ret; |
9344 |
+ } |
9345 |
+ |
9346 |
+ /** |
9347 |
+@@ -1383,10 +1393,11 @@ static void jbd2_write_superblock(journal_t *journal, int write_op) |
9348 |
+ * Update a journal's superblock information about log tail and write it to |
9349 |
+ * disk, waiting for the IO to complete. |
9350 |
+ */ |
9351 |
+-void jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid, |
9352 |
++int jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid, |
9353 |
+ unsigned long tail_block, int write_op) |
9354 |
+ { |
9355 |
+ journal_superblock_t *sb = journal->j_superblock; |
9356 |
++ int ret; |
9357 |
+ |
9358 |
+ BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex)); |
9359 |
+ jbd_debug(1, "JBD2: updating superblock (start %lu, seq %u)\n", |
9360 |
+@@ -1395,13 +1406,18 @@ void jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid, |
9361 |
+ sb->s_sequence = cpu_to_be32(tail_tid); |
9362 |
+ sb->s_start = cpu_to_be32(tail_block); |
9363 |
+ |
9364 |
+- jbd2_write_superblock(journal, write_op); |
9365 |
++ ret = jbd2_write_superblock(journal, write_op); |
9366 |
++ if (ret) |
9367 |
++ goto out; |
9368 |
+ |
9369 |
+ /* Log is no longer empty */ |
9370 |
+ write_lock(&journal->j_state_lock); |
9371 |
+ WARN_ON(!sb->s_sequence); |
9372 |
+ journal->j_flags &= ~JBD2_FLUSHED; |
9373 |
+ write_unlock(&journal->j_state_lock); |
9374 |
++ |
9375 |
++out: |
9376 |
++ return ret; |
9377 |
+ } |
9378 |
+ |
9379 |
+ /** |
9380 |
+@@ -1950,7 +1966,14 @@ int jbd2_journal_flush(journal_t *journal) |
9381 |
+ return -EIO; |
9382 |
+ |
9383 |
+ mutex_lock(&journal->j_checkpoint_mutex); |
9384 |
+- jbd2_cleanup_journal_tail(journal); |
9385 |
++ if (!err) { |
9386 |
++ err = jbd2_cleanup_journal_tail(journal); |
9387 |
++ if (err < 0) { |
9388 |
++ mutex_unlock(&journal->j_checkpoint_mutex); |
9389 |
++ goto out; |
9390 |
++ } |
9391 |
++ err = 0; |
9392 |
++ } |
9393 |
+ |
9394 |
+ /* Finally, mark the journal as really needing no recovery. |
9395 |
+ * This sets s_start==0 in the underlying superblock, which is |
9396 |
+@@ -1966,7 +1989,8 @@ int jbd2_journal_flush(journal_t *journal) |
9397 |
+ J_ASSERT(journal->j_head == journal->j_tail); |
9398 |
+ J_ASSERT(journal->j_tail_sequence == journal->j_transaction_sequence); |
9399 |
+ write_unlock(&journal->j_state_lock); |
9400 |
+- return 0; |
9401 |
++out: |
9402 |
++ return err; |
9403 |
+ } |
9404 |
+ |
9405 |
+ /** |
9406 |
+diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c |
9407 |
+index 7d05089e52d6..6f5f0f425e86 100644 |
9408 |
+--- a/fs/nfs/flexfilelayout/flexfilelayout.c |
9409 |
++++ b/fs/nfs/flexfilelayout/flexfilelayout.c |
9410 |
+@@ -631,7 +631,7 @@ static void ff_layout_reset_write(struct nfs_pgio_header *hdr, bool retry_pnfs) |
9411 |
+ nfs_direct_set_resched_writes(hdr->dreq); |
9412 |
+ /* fake unstable write to let common nfs resend pages */ |
9413 |
+ hdr->verf.committed = NFS_UNSTABLE; |
9414 |
+- hdr->good_bytes = 0; |
9415 |
++ hdr->good_bytes = hdr->args.count; |
9416 |
+ } |
9417 |
+ return; |
9418 |
+ } |
9419 |
+diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c |
9420 |
+index 77a2d026aa12..f13e1969eedd 100644 |
9421 |
+--- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c |
9422 |
++++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c |
9423 |
+@@ -324,7 +324,8 @@ static int ff_layout_update_mirror_cred(struct nfs4_ff_layout_mirror *mirror, |
9424 |
+ __func__, PTR_ERR(cred)); |
9425 |
+ return PTR_ERR(cred); |
9426 |
+ } else { |
9427 |
+- mirror->cred = cred; |
9428 |
++ if (cmpxchg(&mirror->cred, NULL, cred)) |
9429 |
++ put_rpccred(cred); |
9430 |
+ } |
9431 |
+ } |
9432 |
+ return 0; |
9433 |
+@@ -386,7 +387,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx, |
9434 |
+ /* matching smp_wmb() in _nfs4_pnfs_v3/4_ds_connect */ |
9435 |
+ smp_rmb(); |
9436 |
+ if (ds->ds_clp) |
9437 |
+- goto out; |
9438 |
++ goto out_update_creds; |
9439 |
+ |
9440 |
+ flavor = nfs4_ff_layout_choose_authflavor(mirror); |
9441 |
+ |
9442 |
+@@ -430,7 +431,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx, |
9443 |
+ } |
9444 |
+ } |
9445 |
+ } |
9446 |
+- |
9447 |
++out_update_creds: |
9448 |
+ if (ff_layout_update_mirror_cred(mirror, ds)) |
9449 |
+ ds = NULL; |
9450 |
+ out: |
9451 |
+diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c |
9452 |
+index 53852a4bd88b..9b04c2e6fffc 100644 |
9453 |
+--- a/fs/nfs/nfs3xdr.c |
9454 |
++++ b/fs/nfs/nfs3xdr.c |
9455 |
+@@ -1342,7 +1342,7 @@ static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req, |
9456 |
+ if (args->npages != 0) |
9457 |
+ xdr_write_pages(xdr, args->pages, 0, args->len); |
9458 |
+ else |
9459 |
+- xdr_reserve_space(xdr, NFS_ACL_INLINE_BUFSIZE); |
9460 |
++ xdr_reserve_space(xdr, args->len); |
9461 |
+ |
9462 |
+ error = nfsacl_encode(xdr->buf, base, args->inode, |
9463 |
+ (args->mask & NFS_ACL) ? |
9464 |
+diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c |
9465 |
+index 2782cfca2265..ddef1dc80cf7 100644 |
9466 |
+--- a/fs/nfs/nfs4state.c |
9467 |
++++ b/fs/nfs/nfs4state.c |
9468 |
+@@ -1482,6 +1482,8 @@ restart: |
9469 |
+ spin_unlock(&state->state_lock); |
9470 |
+ } |
9471 |
+ nfs4_put_open_state(state); |
9472 |
++ clear_bit(NFS4CLNT_RECLAIM_NOGRACE, |
9473 |
++ &state->flags); |
9474 |
+ spin_lock(&sp->so_lock); |
9475 |
+ goto restart; |
9476 |
+ } |
9477 |
+diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c |
9478 |
+index 230606243be6..d47c188682b1 100644 |
9479 |
+--- a/fs/nfs/pnfs.c |
9480 |
++++ b/fs/nfs/pnfs.c |
9481 |
+@@ -1821,6 +1821,7 @@ int pnfs_write_done_resend_to_mds(struct nfs_pgio_header *hdr) |
9482 |
+ /* Resend all requests through the MDS */ |
9483 |
+ nfs_pageio_init_write(&pgio, hdr->inode, FLUSH_STABLE, true, |
9484 |
+ hdr->completion_ops); |
9485 |
++ set_bit(NFS_CONTEXT_RESEND_WRITES, &hdr->args.context->flags); |
9486 |
+ return nfs_pageio_resend(&pgio, hdr); |
9487 |
+ } |
9488 |
+ EXPORT_SYMBOL_GPL(pnfs_write_done_resend_to_mds); |
9489 |
+@@ -1865,6 +1866,7 @@ pnfs_write_through_mds(struct nfs_pageio_descriptor *desc, |
9490 |
+ mirror->pg_recoalesce = 1; |
9491 |
+ } |
9492 |
+ nfs_pgio_data_destroy(hdr); |
9493 |
++ hdr->release(hdr); |
9494 |
+ } |
9495 |
+ |
9496 |
+ static enum pnfs_try_status |
9497 |
+@@ -1979,6 +1981,7 @@ pnfs_read_through_mds(struct nfs_pageio_descriptor *desc, |
9498 |
+ mirror->pg_recoalesce = 1; |
9499 |
+ } |
9500 |
+ nfs_pgio_data_destroy(hdr); |
9501 |
++ hdr->release(hdr); |
9502 |
+ } |
9503 |
+ |
9504 |
+ /* |
9505 |
+diff --git a/fs/nfs/write.c b/fs/nfs/write.c |
9506 |
+index dfc19f1575a1..daf355642845 100644 |
9507 |
+--- a/fs/nfs/write.c |
9508 |
++++ b/fs/nfs/write.c |
9509 |
+@@ -1289,6 +1289,7 @@ static void nfs_initiate_write(struct nfs_pgio_header *hdr, |
9510 |
+ static void nfs_redirty_request(struct nfs_page *req) |
9511 |
+ { |
9512 |
+ nfs_mark_request_dirty(req); |
9513 |
++ set_bit(NFS_CONTEXT_RESEND_WRITES, &req->wb_context->flags); |
9514 |
+ nfs_unlock_request(req); |
9515 |
+ nfs_end_page_writeback(req); |
9516 |
+ nfs_release_request(req); |
9517 |
+diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c |
9518 |
+index 907870e81a72..70e9af551600 100644 |
9519 |
+--- a/fs/overlayfs/readdir.c |
9520 |
++++ b/fs/overlayfs/readdir.c |
9521 |
+@@ -23,6 +23,7 @@ struct ovl_cache_entry { |
9522 |
+ u64 ino; |
9523 |
+ struct list_head l_node; |
9524 |
+ struct rb_node node; |
9525 |
++ struct ovl_cache_entry *next_maybe_whiteout; |
9526 |
+ bool is_whiteout; |
9527 |
+ char name[]; |
9528 |
+ }; |
9529 |
+@@ -39,7 +40,7 @@ struct ovl_readdir_data { |
9530 |
+ struct rb_root root; |
9531 |
+ struct list_head *list; |
9532 |
+ struct list_head middle; |
9533 |
+- struct dentry *dir; |
9534 |
++ struct ovl_cache_entry *first_maybe_whiteout; |
9535 |
+ int count; |
9536 |
+ int err; |
9537 |
+ }; |
9538 |
+@@ -79,7 +80,7 @@ static struct ovl_cache_entry *ovl_cache_entry_find(struct rb_root *root, |
9539 |
+ return NULL; |
9540 |
+ } |
9541 |
+ |
9542 |
+-static struct ovl_cache_entry *ovl_cache_entry_new(struct dentry *dir, |
9543 |
++static struct ovl_cache_entry *ovl_cache_entry_new(struct ovl_readdir_data *rdd, |
9544 |
+ const char *name, int len, |
9545 |
+ u64 ino, unsigned int d_type) |
9546 |
+ { |
9547 |
+@@ -98,29 +99,8 @@ static struct ovl_cache_entry *ovl_cache_entry_new(struct dentry *dir, |
9548 |
+ p->is_whiteout = false; |
9549 |
+ |
9550 |
+ if (d_type == DT_CHR) { |
9551 |
+- struct dentry *dentry; |
9552 |
+- const struct cred *old_cred; |
9553 |
+- struct cred *override_cred; |
9554 |
+- |
9555 |
+- override_cred = prepare_creds(); |
9556 |
+- if (!override_cred) { |
9557 |
+- kfree(p); |
9558 |
+- return NULL; |
9559 |
+- } |
9560 |
+- |
9561 |
+- /* |
9562 |
+- * CAP_DAC_OVERRIDE for lookup |
9563 |
+- */ |
9564 |
+- cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); |
9565 |
+- old_cred = override_creds(override_cred); |
9566 |
+- |
9567 |
+- dentry = lookup_one_len(name, dir, len); |
9568 |
+- if (!IS_ERR(dentry)) { |
9569 |
+- p->is_whiteout = ovl_is_whiteout(dentry); |
9570 |
+- dput(dentry); |
9571 |
+- } |
9572 |
+- revert_creds(old_cred); |
9573 |
+- put_cred(override_cred); |
9574 |
++ p->next_maybe_whiteout = rdd->first_maybe_whiteout; |
9575 |
++ rdd->first_maybe_whiteout = p; |
9576 |
+ } |
9577 |
+ return p; |
9578 |
+ } |
9579 |
+@@ -148,7 +128,7 @@ static int ovl_cache_entry_add_rb(struct ovl_readdir_data *rdd, |
9580 |
+ return 0; |
9581 |
+ } |
9582 |
+ |
9583 |
+- p = ovl_cache_entry_new(rdd->dir, name, len, ino, d_type); |
9584 |
++ p = ovl_cache_entry_new(rdd, name, len, ino, d_type); |
9585 |
+ if (p == NULL) |
9586 |
+ return -ENOMEM; |
9587 |
+ |
9588 |
+@@ -169,7 +149,7 @@ static int ovl_fill_lower(struct ovl_readdir_data *rdd, |
9589 |
+ if (p) { |
9590 |
+ list_move_tail(&p->l_node, &rdd->middle); |
9591 |
+ } else { |
9592 |
+- p = ovl_cache_entry_new(rdd->dir, name, namelen, ino, d_type); |
9593 |
++ p = ovl_cache_entry_new(rdd, name, namelen, ino, d_type); |
9594 |
+ if (p == NULL) |
9595 |
+ rdd->err = -ENOMEM; |
9596 |
+ else |
9597 |
+@@ -219,6 +199,43 @@ static int ovl_fill_merge(struct dir_context *ctx, const char *name, |
9598 |
+ return ovl_fill_lower(rdd, name, namelen, offset, ino, d_type); |
9599 |
+ } |
9600 |
+ |
9601 |
++static int ovl_check_whiteouts(struct dentry *dir, struct ovl_readdir_data *rdd) |
9602 |
++{ |
9603 |
++ int err; |
9604 |
++ struct ovl_cache_entry *p; |
9605 |
++ struct dentry *dentry; |
9606 |
++ const struct cred *old_cred; |
9607 |
++ struct cred *override_cred; |
9608 |
++ |
9609 |
++ override_cred = prepare_creds(); |
9610 |
++ if (!override_cred) |
9611 |
++ return -ENOMEM; |
9612 |
++ |
9613 |
++ /* |
9614 |
++ * CAP_DAC_OVERRIDE for lookup |
9615 |
++ */ |
9616 |
++ cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); |
9617 |
++ old_cred = override_creds(override_cred); |
9618 |
++ |
9619 |
++ err = mutex_lock_killable(&dir->d_inode->i_mutex); |
9620 |
++ if (!err) { |
9621 |
++ while (rdd->first_maybe_whiteout) { |
9622 |
++ p = rdd->first_maybe_whiteout; |
9623 |
++ rdd->first_maybe_whiteout = p->next_maybe_whiteout; |
9624 |
++ dentry = lookup_one_len(p->name, dir, p->len); |
9625 |
++ if (!IS_ERR(dentry)) { |
9626 |
++ p->is_whiteout = ovl_is_whiteout(dentry); |
9627 |
++ dput(dentry); |
9628 |
++ } |
9629 |
++ } |
9630 |
++ mutex_unlock(&dir->d_inode->i_mutex); |
9631 |
++ } |
9632 |
++ revert_creds(old_cred); |
9633 |
++ put_cred(override_cred); |
9634 |
++ |
9635 |
++ return err; |
9636 |
++} |
9637 |
++ |
9638 |
+ static inline int ovl_dir_read(struct path *realpath, |
9639 |
+ struct ovl_readdir_data *rdd) |
9640 |
+ { |
9641 |
+@@ -229,7 +246,7 @@ static inline int ovl_dir_read(struct path *realpath, |
9642 |
+ if (IS_ERR(realfile)) |
9643 |
+ return PTR_ERR(realfile); |
9644 |
+ |
9645 |
+- rdd->dir = realpath->dentry; |
9646 |
++ rdd->first_maybe_whiteout = NULL; |
9647 |
+ rdd->ctx.pos = 0; |
9648 |
+ do { |
9649 |
+ rdd->count = 0; |
9650 |
+@@ -238,6 +255,10 @@ static inline int ovl_dir_read(struct path *realpath, |
9651 |
+ if (err >= 0) |
9652 |
+ err = rdd->err; |
9653 |
+ } while (!err && rdd->count); |
9654 |
++ |
9655 |
++ if (!err && rdd->first_maybe_whiteout) |
9656 |
++ err = ovl_check_whiteouts(realpath->dentry, rdd); |
9657 |
++ |
9658 |
+ fput(realfile); |
9659 |
+ |
9660 |
+ return err; |
9661 |
+diff --git a/fs/xfs/xfs_attr_inactive.c b/fs/xfs/xfs_attr_inactive.c |
9662 |
+index 3fbf167cfb4c..73e75a87af50 100644 |
9663 |
+--- a/fs/xfs/xfs_attr_inactive.c |
9664 |
++++ b/fs/xfs/xfs_attr_inactive.c |
9665 |
+@@ -435,8 +435,14 @@ xfs_attr_inactive( |
9666 |
+ */ |
9667 |
+ xfs_trans_ijoin(trans, dp, 0); |
9668 |
+ |
9669 |
+- /* invalidate and truncate the attribute fork extents */ |
9670 |
+- if (dp->i_d.di_aformat != XFS_DINODE_FMT_LOCAL) { |
9671 |
++ /* |
9672 |
++ * Invalidate and truncate the attribute fork extents. Make sure the |
9673 |
++ * fork actually has attributes as otherwise the invalidation has no |
9674 |
++ * blocks to read and returns an error. In this case, just do the fork |
9675 |
++ * removal below. |
9676 |
++ */ |
9677 |
++ if (xfs_inode_hasattr(dp) && |
9678 |
++ dp->i_d.di_aformat != XFS_DINODE_FMT_LOCAL) { |
9679 |
+ error = xfs_attr3_root_inactive(&trans, dp); |
9680 |
+ if (error) |
9681 |
+ goto out_cancel; |
9682 |
+diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c |
9683 |
+index 3df411eadb86..40c076523cfa 100644 |
9684 |
+--- a/fs/xfs/xfs_symlink.c |
9685 |
++++ b/fs/xfs/xfs_symlink.c |
9686 |
+@@ -104,7 +104,7 @@ xfs_readlink_bmap( |
9687 |
+ cur_chunk += sizeof(struct xfs_dsymlink_hdr); |
9688 |
+ } |
9689 |
+ |
9690 |
+- memcpy(link + offset, bp->b_addr, byte_cnt); |
9691 |
++ memcpy(link + offset, cur_chunk, byte_cnt); |
9692 |
+ |
9693 |
+ pathlen -= byte_cnt; |
9694 |
+ offset += byte_cnt; |
9695 |
+diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h |
9696 |
+index 08ef57bc8d63..f5ed1f17f061 100644 |
9697 |
+--- a/include/acpi/acpixf.h |
9698 |
++++ b/include/acpi/acpixf.h |
9699 |
+@@ -195,9 +195,18 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE); |
9700 |
+ * address. Although ACPICA adheres to the ACPI specification which |
9701 |
+ * requires the use of the corresponding 64-bit address if it is non-zero, |
9702 |
+ * some machines have been found to have a corrupted non-zero 64-bit |
9703 |
+- * address. Default is TRUE, favor the 32-bit addresses. |
9704 |
++ * address. Default is FALSE, do not favor the 32-bit addresses. |
9705 |
+ */ |
9706 |
+-ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE); |
9707 |
++ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, FALSE); |
9708 |
++ |
9709 |
++/* |
9710 |
++ * Optionally use 32-bit FACS table addresses. |
9711 |
++ * It is reported that some platforms fail to resume from system suspending |
9712 |
++ * if 64-bit FACS table address is selected: |
9713 |
++ * https://bugzilla.kernel.org/show_bug.cgi?id=74021 |
9714 |
++ * Default is TRUE, favor the 32-bit addresses. |
9715 |
++ */ |
9716 |
++ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_facs_addresses, TRUE); |
9717 |
+ |
9718 |
+ /* |
9719 |
+ * Optionally truncate I/O addresses to 16 bits. Provides compatibility |
9720 |
+diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h |
9721 |
+index 1c3002e1db20..181427ef3549 100644 |
9722 |
+--- a/include/acpi/actypes.h |
9723 |
++++ b/include/acpi/actypes.h |
9724 |
+@@ -572,6 +572,7 @@ typedef u64 acpi_integer; |
9725 |
+ #define ACPI_NO_ACPI_ENABLE 0x10 |
9726 |
+ #define ACPI_NO_DEVICE_INIT 0x20 |
9727 |
+ #define ACPI_NO_OBJECT_INIT 0x40 |
9728 |
++#define ACPI_NO_FACS_INIT 0x80 |
9729 |
+ |
9730 |
+ /* |
9731 |
+ * Initialization state |
9732 |
+diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h |
9733 |
+index c157103492b0..3f13b910f8d2 100644 |
9734 |
+--- a/include/drm/drm_atomic.h |
9735 |
++++ b/include/drm/drm_atomic.h |
9736 |
+@@ -77,26 +77,26 @@ int __must_check drm_atomic_async_commit(struct drm_atomic_state *state); |
9737 |
+ |
9738 |
+ #define for_each_connector_in_state(state, connector, connector_state, __i) \ |
9739 |
+ for ((__i) = 0; \ |
9740 |
+- (connector) = (state)->connectors[__i], \ |
9741 |
+- (connector_state) = (state)->connector_states[__i], \ |
9742 |
+- (__i) < (state)->num_connector; \ |
9743 |
++ (__i) < (state)->num_connector && \ |
9744 |
++ ((connector) = (state)->connectors[__i], \ |
9745 |
++ (connector_state) = (state)->connector_states[__i], 1); \ |
9746 |
+ (__i)++) \ |
9747 |
+ if (connector) |
9748 |
+ |
9749 |
+ #define for_each_crtc_in_state(state, crtc, crtc_state, __i) \ |
9750 |
+ for ((__i) = 0; \ |
9751 |
+- (crtc) = (state)->crtcs[__i], \ |
9752 |
+- (crtc_state) = (state)->crtc_states[__i], \ |
9753 |
+- (__i) < (state)->dev->mode_config.num_crtc; \ |
9754 |
++ (__i) < (state)->dev->mode_config.num_crtc && \ |
9755 |
++ ((crtc) = (state)->crtcs[__i], \ |
9756 |
++ (crtc_state) = (state)->crtc_states[__i], 1); \ |
9757 |
+ (__i)++) \ |
9758 |
+ if (crtc_state) |
9759 |
+ |
9760 |
+-#define for_each_plane_in_state(state, plane, plane_state, __i) \ |
9761 |
+- for ((__i) = 0; \ |
9762 |
+- (plane) = (state)->planes[__i], \ |
9763 |
+- (plane_state) = (state)->plane_states[__i], \ |
9764 |
+- (__i) < (state)->dev->mode_config.num_total_plane; \ |
9765 |
+- (__i)++) \ |
9766 |
++#define for_each_plane_in_state(state, plane, plane_state, __i) \ |
9767 |
++ for ((__i) = 0; \ |
9768 |
++ (__i) < (state)->dev->mode_config.num_total_plane && \ |
9769 |
++ ((plane) = (state)->planes[__i], \ |
9770 |
++ (plane_state) = (state)->plane_states[__i], 1); \ |
9771 |
++ (__i)++) \ |
9772 |
+ if (plane_state) |
9773 |
+ |
9774 |
+ #endif /* DRM_ATOMIC_H_ */ |
9775 |
+diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h |
9776 |
+index ca71c03143d1..54233583c6cb 100644 |
9777 |
+--- a/include/drm/drm_crtc.h |
9778 |
++++ b/include/drm/drm_crtc.h |
9779 |
+@@ -731,6 +731,8 @@ struct drm_connector { |
9780 |
+ uint8_t num_h_tile, num_v_tile; |
9781 |
+ uint8_t tile_h_loc, tile_v_loc; |
9782 |
+ uint16_t tile_h_size, tile_v_size; |
9783 |
++ |
9784 |
++ struct list_head destroy_list; |
9785 |
+ }; |
9786 |
+ |
9787 |
+ /** |
9788 |
+diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h |
9789 |
+index a2507817be41..86d0b25ed054 100644 |
9790 |
+--- a/include/drm/drm_dp_mst_helper.h |
9791 |
++++ b/include/drm/drm_dp_mst_helper.h |
9792 |
+@@ -463,6 +463,10 @@ struct drm_dp_mst_topology_mgr { |
9793 |
+ struct work_struct work; |
9794 |
+ |
9795 |
+ struct work_struct tx_work; |
9796 |
++ |
9797 |
++ struct list_head destroy_connector_list; |
9798 |
++ struct mutex destroy_connector_lock; |
9799 |
++ struct work_struct destroy_connector_work; |
9800 |
+ }; |
9801 |
+ |
9802 |
+ int drm_dp_mst_topology_mgr_init(struct drm_dp_mst_topology_mgr *mgr, struct device *dev, struct drm_dp_aux *aux, int max_dpcd_transaction_bytes, int max_payloads, int conn_base_id); |
9803 |
+diff --git a/include/linux/acpi.h b/include/linux/acpi.h |
9804 |
+index 5da2d2e9d38e..4550be3bb63b 100644 |
9805 |
+--- a/include/linux/acpi.h |
9806 |
++++ b/include/linux/acpi.h |
9807 |
+@@ -332,9 +332,6 @@ int acpi_check_region(resource_size_t start, resource_size_t n, |
9808 |
+ |
9809 |
+ int acpi_resources_are_enforced(void); |
9810 |
+ |
9811 |
+-int acpi_reserve_region(u64 start, unsigned int length, u8 space_id, |
9812 |
+- unsigned long flags, char *desc); |
9813 |
+- |
9814 |
+ #ifdef CONFIG_HIBERNATION |
9815 |
+ void __init acpi_no_s4_hw_signature(void); |
9816 |
+ #endif |
9817 |
+@@ -530,13 +527,6 @@ static inline int acpi_check_region(resource_size_t start, resource_size_t n, |
9818 |
+ return 0; |
9819 |
+ } |
9820 |
+ |
9821 |
+-static inline int acpi_reserve_region(u64 start, unsigned int length, |
9822 |
+- u8 space_id, unsigned long flags, |
9823 |
+- char *desc) |
9824 |
+-{ |
9825 |
+- return -ENXIO; |
9826 |
+-} |
9827 |
+- |
9828 |
+ struct acpi_table_header; |
9829 |
+ static inline int acpi_table_parse(char *id, |
9830 |
+ int (*handler)(struct acpi_table_header *)) |
9831 |
+diff --git a/include/linux/ata.h b/include/linux/ata.h |
9832 |
+index b666b773e111..533dbb6428f5 100644 |
9833 |
+--- a/include/linux/ata.h |
9834 |
++++ b/include/linux/ata.h |
9835 |
+@@ -45,6 +45,7 @@ enum { |
9836 |
+ ATA_SECT_SIZE = 512, |
9837 |
+ ATA_MAX_SECTORS_128 = 128, |
9838 |
+ ATA_MAX_SECTORS = 256, |
9839 |
++ ATA_MAX_SECTORS_1024 = 1024, |
9840 |
+ ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ |
9841 |
+ ATA_MAX_SECTORS_TAPE = 65535, |
9842 |
+ |
9843 |
+diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h |
9844 |
+index 73b45225a7ca..e6797ded700e 100644 |
9845 |
+--- a/include/linux/buffer_head.h |
9846 |
++++ b/include/linux/buffer_head.h |
9847 |
+@@ -317,6 +317,13 @@ sb_getblk(struct super_block *sb, sector_t block) |
9848 |
+ return __getblk_gfp(sb->s_bdev, block, sb->s_blocksize, __GFP_MOVABLE); |
9849 |
+ } |
9850 |
+ |
9851 |
++ |
9852 |
++static inline struct buffer_head * |
9853 |
++sb_getblk_gfp(struct super_block *sb, sector_t block, gfp_t gfp) |
9854 |
++{ |
9855 |
++ return __getblk_gfp(sb->s_bdev, block, sb->s_blocksize, gfp); |
9856 |
++} |
9857 |
++ |
9858 |
+ static inline struct buffer_head * |
9859 |
+ sb_find_get_block(struct super_block *sb, sector_t block) |
9860 |
+ { |
9861 |
+diff --git a/include/linux/compiler-intel.h b/include/linux/compiler-intel.h |
9862 |
+index 0c9a2f2c2802..d4c71132d07f 100644 |
9863 |
+--- a/include/linux/compiler-intel.h |
9864 |
++++ b/include/linux/compiler-intel.h |
9865 |
+@@ -13,10 +13,12 @@ |
9866 |
+ /* Intel ECC compiler doesn't support gcc specific asm stmts. |
9867 |
+ * It uses intrinsics to do the equivalent things. |
9868 |
+ */ |
9869 |
++#undef barrier |
9870 |
+ #undef barrier_data |
9871 |
+ #undef RELOC_HIDE |
9872 |
+ #undef OPTIMIZER_HIDE_VAR |
9873 |
+ |
9874 |
++#define barrier() __memory_barrier() |
9875 |
+ #define barrier_data(ptr) barrier() |
9876 |
+ |
9877 |
+ #define RELOC_HIDE(ptr, off) \ |
9878 |
+diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h |
9879 |
+index 3a7c9ffd5ab9..da042657dc31 100644 |
9880 |
+--- a/include/linux/gpio/consumer.h |
9881 |
++++ b/include/linux/gpio/consumer.h |
9882 |
+@@ -406,6 +406,21 @@ static inline int desc_to_gpio(const struct gpio_desc *desc) |
9883 |
+ return -EINVAL; |
9884 |
+ } |
9885 |
+ |
9886 |
++/* Child properties interface */ |
9887 |
++struct fwnode_handle; |
9888 |
++ |
9889 |
++static inline struct gpio_desc *fwnode_get_named_gpiod( |
9890 |
++ struct fwnode_handle *fwnode, const char *propname) |
9891 |
++{ |
9892 |
++ return ERR_PTR(-ENOSYS); |
9893 |
++} |
9894 |
++ |
9895 |
++static inline struct gpio_desc *devm_get_gpiod_from_child( |
9896 |
++ struct device *dev, const char *con_id, struct fwnode_handle *child) |
9897 |
++{ |
9898 |
++ return ERR_PTR(-ENOSYS); |
9899 |
++} |
9900 |
++ |
9901 |
+ #endif /* CONFIG_GPIOLIB */ |
9902 |
+ |
9903 |
+ /* |
9904 |
+diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h |
9905 |
+index 0042bf330b99..c02b5ce6c5cd 100644 |
9906 |
+--- a/include/linux/hid-sensor-hub.h |
9907 |
++++ b/include/linux/hid-sensor-hub.h |
9908 |
+@@ -230,6 +230,7 @@ struct hid_sensor_common { |
9909 |
+ struct platform_device *pdev; |
9910 |
+ unsigned usage_id; |
9911 |
+ atomic_t data_ready; |
9912 |
++ atomic_t user_requested_state; |
9913 |
+ struct iio_trigger *trigger; |
9914 |
+ struct hid_sensor_hub_attribute_info poll; |
9915 |
+ struct hid_sensor_hub_attribute_info report_state; |
9916 |
+diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h |
9917 |
+index 20e7f78041c8..edb640ae9a94 100644 |
9918 |
+--- a/include/linux/jbd2.h |
9919 |
++++ b/include/linux/jbd2.h |
9920 |
+@@ -1035,7 +1035,7 @@ struct buffer_head *jbd2_journal_get_descriptor_buffer(journal_t *journal); |
9921 |
+ int jbd2_journal_next_log_block(journal_t *, unsigned long long *); |
9922 |
+ int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid, |
9923 |
+ unsigned long *block); |
9924 |
+-void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block); |
9925 |
++int __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block); |
9926 |
+ void jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block); |
9927 |
+ |
9928 |
+ /* Commit management */ |
9929 |
+@@ -1157,7 +1157,7 @@ extern int jbd2_journal_recover (journal_t *journal); |
9930 |
+ extern int jbd2_journal_wipe (journal_t *, int); |
9931 |
+ extern int jbd2_journal_skip_recovery (journal_t *); |
9932 |
+ extern void jbd2_journal_update_sb_errno(journal_t *); |
9933 |
+-extern void jbd2_journal_update_sb_log_tail (journal_t *, tid_t, |
9934 |
++extern int jbd2_journal_update_sb_log_tail (journal_t *, tid_t, |
9935 |
+ unsigned long, int); |
9936 |
+ extern void __jbd2_journal_abort_hard (journal_t *); |
9937 |
+ extern void jbd2_journal_abort (journal_t *, int); |
9938 |
+diff --git a/include/linux/libata.h b/include/linux/libata.h |
9939 |
+index 28aeae46f355..e0e33787c485 100644 |
9940 |
+--- a/include/linux/libata.h |
9941 |
++++ b/include/linux/libata.h |
9942 |
+@@ -431,6 +431,9 @@ enum { |
9943 |
+ ATA_HORKAGE_NOLPM = (1 << 20), /* don't use LPM */ |
9944 |
+ ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21), /* some WDs have broken LPM */ |
9945 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM = (1 << 22),/* guarantees zero after trim */ |
9946 |
++ ATA_HORKAGE_NO_NCQ_LOG = (1 << 23), /* don't use NCQ for log read */ |
9947 |
++ ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ |
9948 |
++ ATA_HORKAGE_MAX_SEC_1024 = (1 << 25), /* Limit max sects to 1024 */ |
9949 |
+ |
9950 |
+ /* DMA mask for user DMA control: User visible values; DO NOT |
9951 |
+ renumber */ |
9952 |
+diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h |
9953 |
+index 93ab6071bbe9..e9e9a8dcfb47 100644 |
9954 |
+--- a/include/linux/nfs_xdr.h |
9955 |
++++ b/include/linux/nfs_xdr.h |
9956 |
+@@ -1142,7 +1142,7 @@ struct nfs41_state_protection { |
9957 |
+ struct nfs4_op_map allow; |
9958 |
+ }; |
9959 |
+ |
9960 |
+-#define NFS4_EXCHANGE_ID_LEN (48) |
9961 |
++#define NFS4_EXCHANGE_ID_LEN (127) |
9962 |
+ struct nfs41_exchange_id_args { |
9963 |
+ struct nfs_client *client; |
9964 |
+ nfs4_verifier *verifier; |
9965 |
+diff --git a/include/linux/of.h b/include/linux/of.h |
9966 |
+index b871ff9d81d7..8135d507d089 100644 |
9967 |
+--- a/include/linux/of.h |
9968 |
++++ b/include/linux/of.h |
9969 |
+@@ -673,7 +673,10 @@ static inline void of_property_clear_flag(struct property *p, unsigned long flag |
9970 |
+ #if defined(CONFIG_OF) && defined(CONFIG_NUMA) |
9971 |
+ extern int of_node_to_nid(struct device_node *np); |
9972 |
+ #else |
9973 |
+-static inline int of_node_to_nid(struct device_node *device) { return 0; } |
9974 |
++static inline int of_node_to_nid(struct device_node *device) |
9975 |
++{ |
9976 |
++ return NUMA_NO_NODE; |
9977 |
++} |
9978 |
+ #endif |
9979 |
+ |
9980 |
+ static inline struct device_node *of_find_matching_node( |
9981 |
+diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h |
9982 |
+index 551b6737f5df..a7e41fb6ed54 100644 |
9983 |
+--- a/include/uapi/drm/i915_drm.h |
9984 |
++++ b/include/uapi/drm/i915_drm.h |
9985 |
+@@ -1065,6 +1065,14 @@ struct drm_i915_reg_read { |
9986 |
+ __u64 offset; |
9987 |
+ __u64 val; /* Return value */ |
9988 |
+ }; |
9989 |
++/* Known registers: |
9990 |
++ * |
9991 |
++ * Render engine timestamp - 0x2358 + 64bit - gen7+ |
9992 |
++ * - Note this register returns an invalid value if using the default |
9993 |
++ * single instruction 8byte read, in order to workaround that use |
9994 |
++ * offset (0x2538 | 1) instead. |
9995 |
++ * |
9996 |
++ */ |
9997 |
+ |
9998 |
+ struct drm_i915_reset_stats { |
9999 |
+ __u32 ctx_id; |
10000 |
+diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig |
10001 |
+index 7e01f78f0417..9e302315e33d 100644 |
10002 |
+--- a/kernel/power/Kconfig |
10003 |
++++ b/kernel/power/Kconfig |
10004 |
+@@ -187,7 +187,7 @@ config DPM_WATCHDOG |
10005 |
+ config DPM_WATCHDOG_TIMEOUT |
10006 |
+ int "Watchdog timeout in seconds" |
10007 |
+ range 1 120 |
10008 |
+- default 12 |
10009 |
++ default 60 |
10010 |
+ depends on DPM_WATCHDOG |
10011 |
+ |
10012 |
+ config PM_TRACE |
10013 |
+diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c |
10014 |
+index c099b082cd02..bff0169e1ad8 100644 |
10015 |
+--- a/kernel/printk/printk.c |
10016 |
++++ b/kernel/printk/printk.c |
10017 |
+@@ -484,11 +484,11 @@ int check_syslog_permissions(int type, bool from_file) |
10018 |
+ * already done the capabilities checks at open time. |
10019 |
+ */ |
10020 |
+ if (from_file && type != SYSLOG_ACTION_OPEN) |
10021 |
+- return 0; |
10022 |
++ goto ok; |
10023 |
+ |
10024 |
+ if (syslog_action_restricted(type)) { |
10025 |
+ if (capable(CAP_SYSLOG)) |
10026 |
+- return 0; |
10027 |
++ goto ok; |
10028 |
+ /* |
10029 |
+ * For historical reasons, accept CAP_SYS_ADMIN too, with |
10030 |
+ * a warning. |
10031 |
+@@ -498,10 +498,11 @@ int check_syslog_permissions(int type, bool from_file) |
10032 |
+ "CAP_SYS_ADMIN but no CAP_SYSLOG " |
10033 |
+ "(deprecated).\n", |
10034 |
+ current->comm, task_pid_nr(current)); |
10035 |
+- return 0; |
10036 |
++ goto ok; |
10037 |
+ } |
10038 |
+ return -EPERM; |
10039 |
+ } |
10040 |
++ok: |
10041 |
+ return security_syslog(type); |
10042 |
+ } |
10043 |
+ |
10044 |
+@@ -1263,10 +1264,6 @@ int do_syslog(int type, char __user *buf, int len, bool from_file) |
10045 |
+ if (error) |
10046 |
+ goto out; |
10047 |
+ |
10048 |
+- error = security_syslog(type); |
10049 |
+- if (error) |
10050 |
+- return error; |
10051 |
+- |
10052 |
+ switch (type) { |
10053 |
+ case SYSLOG_ACTION_CLOSE: /* Close log */ |
10054 |
+ break; |
10055 |
+diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h |
10056 |
+index d2612016de94..921691c5cb04 100644 |
10057 |
+--- a/kernel/trace/trace.h |
10058 |
++++ b/kernel/trace/trace.h |
10059 |
+@@ -444,6 +444,7 @@ enum { |
10060 |
+ |
10061 |
+ TRACE_CONTROL_BIT, |
10062 |
+ |
10063 |
++ TRACE_BRANCH_BIT, |
10064 |
+ /* |
10065 |
+ * Abuse of the trace_recursion. |
10066 |
+ * As we need a way to maintain state if we are tracing the function |
10067 |
+@@ -1312,7 +1313,7 @@ void trace_event_init(void); |
10068 |
+ void trace_event_enum_update(struct trace_enum_map **map, int len); |
10069 |
+ #else |
10070 |
+ static inline void __init trace_event_init(void) { } |
10071 |
+-static inlin void trace_event_enum_update(struct trace_enum_map **map, int len) { } |
10072 |
++static inline void trace_event_enum_update(struct trace_enum_map **map, int len) { } |
10073 |
+ #endif |
10074 |
+ |
10075 |
+ extern struct trace_iterator *tracepoint_print_iter; |
10076 |
+diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c |
10077 |
+index 57cbf1efdd44..1879980f06c2 100644 |
10078 |
+--- a/kernel/trace/trace_branch.c |
10079 |
++++ b/kernel/trace/trace_branch.c |
10080 |
+@@ -36,9 +36,12 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect) |
10081 |
+ struct trace_branch *entry; |
10082 |
+ struct ring_buffer *buffer; |
10083 |
+ unsigned long flags; |
10084 |
+- int cpu, pc; |
10085 |
++ int pc; |
10086 |
+ const char *p; |
10087 |
+ |
10088 |
++ if (current->trace_recursion & TRACE_BRANCH_BIT) |
10089 |
++ return; |
10090 |
++ |
10091 |
+ /* |
10092 |
+ * I would love to save just the ftrace_likely_data pointer, but |
10093 |
+ * this code can also be used by modules. Ugly things can happen |
10094 |
+@@ -49,10 +52,10 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect) |
10095 |
+ if (unlikely(!tr)) |
10096 |
+ return; |
10097 |
+ |
10098 |
+- local_irq_save(flags); |
10099 |
+- cpu = raw_smp_processor_id(); |
10100 |
+- data = per_cpu_ptr(tr->trace_buffer.data, cpu); |
10101 |
+- if (atomic_inc_return(&data->disabled) != 1) |
10102 |
++ raw_local_irq_save(flags); |
10103 |
++ current->trace_recursion |= TRACE_BRANCH_BIT; |
10104 |
++ data = this_cpu_ptr(tr->trace_buffer.data); |
10105 |
++ if (atomic_read(&data->disabled)) |
10106 |
+ goto out; |
10107 |
+ |
10108 |
+ pc = preempt_count(); |
10109 |
+@@ -81,8 +84,8 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect) |
10110 |
+ __buffer_unlock_commit(buffer, event); |
10111 |
+ |
10112 |
+ out: |
10113 |
+- atomic_dec(&data->disabled); |
10114 |
+- local_irq_restore(flags); |
10115 |
++ current->trace_recursion &= ~TRACE_BRANCH_BIT; |
10116 |
++ raw_local_irq_restore(flags); |
10117 |
+ } |
10118 |
+ |
10119 |
+ static inline |
10120 |
+diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c |
10121 |
+index 7f2e97ce71a7..52adf02d7619 100644 |
10122 |
+--- a/kernel/trace/trace_events_filter.c |
10123 |
++++ b/kernel/trace/trace_events_filter.c |
10124 |
+@@ -1056,6 +1056,9 @@ static void parse_init(struct filter_parse_state *ps, |
10125 |
+ |
10126 |
+ static char infix_next(struct filter_parse_state *ps) |
10127 |
+ { |
10128 |
++ if (!ps->infix.cnt) |
10129 |
++ return 0; |
10130 |
++ |
10131 |
+ ps->infix.cnt--; |
10132 |
+ |
10133 |
+ return ps->infix.string[ps->infix.tail++]; |
10134 |
+@@ -1071,6 +1074,9 @@ static char infix_peek(struct filter_parse_state *ps) |
10135 |
+ |
10136 |
+ static void infix_advance(struct filter_parse_state *ps) |
10137 |
+ { |
10138 |
++ if (!ps->infix.cnt) |
10139 |
++ return; |
10140 |
++ |
10141 |
+ ps->infix.cnt--; |
10142 |
+ ps->infix.tail++; |
10143 |
+ } |
10144 |
+@@ -1385,7 +1391,9 @@ static int check_preds(struct filter_parse_state *ps) |
10145 |
+ if (elt->op != OP_NOT) |
10146 |
+ cnt--; |
10147 |
+ n_normal_preds++; |
10148 |
+- WARN_ON_ONCE(cnt < 0); |
10149 |
++ /* all ops should have operands */ |
10150 |
++ if (cnt < 0) |
10151 |
++ break; |
10152 |
+ } |
10153 |
+ |
10154 |
+ if (cnt != 1 || !n_normal_preds || n_logical_preds >= n_normal_preds) { |
10155 |
+diff --git a/lib/bitmap.c b/lib/bitmap.c |
10156 |
+index 64c0926f5dd8..40162f87ea2d 100644 |
10157 |
+--- a/lib/bitmap.c |
10158 |
++++ b/lib/bitmap.c |
10159 |
+@@ -506,12 +506,12 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen, |
10160 |
+ unsigned a, b; |
10161 |
+ int c, old_c, totaldigits; |
10162 |
+ const char __user __force *ubuf = (const char __user __force *)buf; |
10163 |
+- int exp_digit, in_range; |
10164 |
++ int at_start, in_range; |
10165 |
+ |
10166 |
+ totaldigits = c = 0; |
10167 |
+ bitmap_zero(maskp, nmaskbits); |
10168 |
+ do { |
10169 |
+- exp_digit = 1; |
10170 |
++ at_start = 1; |
10171 |
+ in_range = 0; |
10172 |
+ a = b = 0; |
10173 |
+ |
10174 |
+@@ -540,11 +540,10 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen, |
10175 |
+ break; |
10176 |
+ |
10177 |
+ if (c == '-') { |
10178 |
+- if (exp_digit || in_range) |
10179 |
++ if (at_start || in_range) |
10180 |
+ return -EINVAL; |
10181 |
+ b = 0; |
10182 |
+ in_range = 1; |
10183 |
+- exp_digit = 1; |
10184 |
+ continue; |
10185 |
+ } |
10186 |
+ |
10187 |
+@@ -554,16 +553,18 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen, |
10188 |
+ b = b * 10 + (c - '0'); |
10189 |
+ if (!in_range) |
10190 |
+ a = b; |
10191 |
+- exp_digit = 0; |
10192 |
++ at_start = 0; |
10193 |
+ totaldigits++; |
10194 |
+ } |
10195 |
+ if (!(a <= b)) |
10196 |
+ return -EINVAL; |
10197 |
+ if (b >= nmaskbits) |
10198 |
+ return -ERANGE; |
10199 |
+- while (a <= b) { |
10200 |
+- set_bit(a, maskp); |
10201 |
+- a++; |
10202 |
++ if (!at_start) { |
10203 |
++ while (a <= b) { |
10204 |
++ set_bit(a, maskp); |
10205 |
++ a++; |
10206 |
++ } |
10207 |
+ } |
10208 |
+ } while (buflen && c == ','); |
10209 |
+ return 0; |
10210 |
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
10211 |
+index 271e4432734c..8c4c1f9f9a9a 100644 |
10212 |
+--- a/mm/hugetlb.c |
10213 |
++++ b/mm/hugetlb.c |
10214 |
+@@ -40,6 +40,11 @@ int hugepages_treat_as_movable; |
10215 |
+ int hugetlb_max_hstate __read_mostly; |
10216 |
+ unsigned int default_hstate_idx; |
10217 |
+ struct hstate hstates[HUGE_MAX_HSTATE]; |
10218 |
++/* |
10219 |
++ * Minimum page order among possible hugepage sizes, set to a proper value |
10220 |
++ * at boot time. |
10221 |
++ */ |
10222 |
++static unsigned int minimum_order __read_mostly = UINT_MAX; |
10223 |
+ |
10224 |
+ __initdata LIST_HEAD(huge_boot_pages); |
10225 |
+ |
10226 |
+@@ -1188,19 +1193,13 @@ static void dissolve_free_huge_page(struct page *page) |
10227 |
+ */ |
10228 |
+ void dissolve_free_huge_pages(unsigned long start_pfn, unsigned long end_pfn) |
10229 |
+ { |
10230 |
+- unsigned int order = 8 * sizeof(void *); |
10231 |
+ unsigned long pfn; |
10232 |
+- struct hstate *h; |
10233 |
+ |
10234 |
+ if (!hugepages_supported()) |
10235 |
+ return; |
10236 |
+ |
10237 |
+- /* Set scan step to minimum hugepage size */ |
10238 |
+- for_each_hstate(h) |
10239 |
+- if (order > huge_page_order(h)) |
10240 |
+- order = huge_page_order(h); |
10241 |
+- VM_BUG_ON(!IS_ALIGNED(start_pfn, 1 << order)); |
10242 |
+- for (pfn = start_pfn; pfn < end_pfn; pfn += 1 << order) |
10243 |
++ VM_BUG_ON(!IS_ALIGNED(start_pfn, 1 << minimum_order)); |
10244 |
++ for (pfn = start_pfn; pfn < end_pfn; pfn += 1 << minimum_order) |
10245 |
+ dissolve_free_huge_page(pfn_to_page(pfn)); |
10246 |
+ } |
10247 |
+ |
10248 |
+@@ -1627,10 +1626,14 @@ static void __init hugetlb_init_hstates(void) |
10249 |
+ struct hstate *h; |
10250 |
+ |
10251 |
+ for_each_hstate(h) { |
10252 |
++ if (minimum_order > huge_page_order(h)) |
10253 |
++ minimum_order = huge_page_order(h); |
10254 |
++ |
10255 |
+ /* oversize hugepages were init'ed in early boot */ |
10256 |
+ if (!hstate_is_gigantic(h)) |
10257 |
+ hugetlb_hstate_alloc_pages(h); |
10258 |
+ } |
10259 |
++ VM_BUG_ON(minimum_order == UINT_MAX); |
10260 |
+ } |
10261 |
+ |
10262 |
+ static char * __init memfmt(char *buf, unsigned long n) |
10263 |
+diff --git a/mm/memory.c b/mm/memory.c |
10264 |
+index 22e037e3364e..2a9e09870c20 100644 |
10265 |
+--- a/mm/memory.c |
10266 |
++++ b/mm/memory.c |
10267 |
+@@ -2669,6 +2669,10 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, |
10268 |
+ |
10269 |
+ pte_unmap(page_table); |
10270 |
+ |
10271 |
++ /* File mapping without ->vm_ops ? */ |
10272 |
++ if (vma->vm_flags & VM_SHARED) |
10273 |
++ return VM_FAULT_SIGBUS; |
10274 |
++ |
10275 |
+ /* Check if we need to add a guard page to the stack */ |
10276 |
+ if (check_stack_guard_page(vma, address) < 0) |
10277 |
+ return VM_FAULT_SIGSEGV; |
10278 |
+@@ -3097,6 +3101,9 @@ static int do_fault(struct mm_struct *mm, struct vm_area_struct *vma, |
10279 |
+ - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; |
10280 |
+ |
10281 |
+ pte_unmap(page_table); |
10282 |
++ /* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */ |
10283 |
++ if (!vma->vm_ops->fault) |
10284 |
++ return VM_FAULT_SIGBUS; |
10285 |
+ if (!(flags & FAULT_FLAG_WRITE)) |
10286 |
+ return do_read_fault(mm, vma, address, pmd, pgoff, flags, |
10287 |
+ orig_pte); |
10288 |
+@@ -3242,13 +3249,12 @@ static int handle_pte_fault(struct mm_struct *mm, |
10289 |
+ barrier(); |
10290 |
+ if (!pte_present(entry)) { |
10291 |
+ if (pte_none(entry)) { |
10292 |
+- if (vma->vm_ops) { |
10293 |
+- if (likely(vma->vm_ops->fault)) |
10294 |
+- return do_fault(mm, vma, address, pte, |
10295 |
+- pmd, flags, entry); |
10296 |
+- } |
10297 |
+- return do_anonymous_page(mm, vma, address, |
10298 |
+- pte, pmd, flags); |
10299 |
++ if (vma->vm_ops) |
10300 |
++ return do_fault(mm, vma, address, pte, pmd, |
10301 |
++ flags, entry); |
10302 |
++ |
10303 |
++ return do_anonymous_page(mm, vma, address, pte, pmd, |
10304 |
++ flags); |
10305 |
+ } |
10306 |
+ return do_swap_page(mm, vma, address, |
10307 |
+ pte, pmd, flags, entry); |
10308 |
+diff --git a/net/9p/client.c b/net/9p/client.c |
10309 |
+index 6f4c4c88db84..81925b923318 100644 |
10310 |
+--- a/net/9p/client.c |
10311 |
++++ b/net/9p/client.c |
10312 |
+@@ -843,7 +843,8 @@ static struct p9_req_t *p9_client_zc_rpc(struct p9_client *c, int8_t type, |
10313 |
+ if (err < 0) { |
10314 |
+ if (err == -EIO) |
10315 |
+ c->status = Disconnected; |
10316 |
+- goto reterr; |
10317 |
++ if (err != -ERESTARTSYS) |
10318 |
++ goto reterr; |
10319 |
+ } |
10320 |
+ if (req->status == REQ_STATUS_ERROR) { |
10321 |
+ p9_debug(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err); |
10322 |
+@@ -1647,6 +1648,7 @@ p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err) |
10323 |
+ if (*err) { |
10324 |
+ trace_9p_protocol_dump(clnt, req->rc); |
10325 |
+ p9_free_req(clnt, req); |
10326 |
++ break; |
10327 |
+ } |
10328 |
+ |
10329 |
+ p9_debug(P9_DEBUG_9P, "<<< RWRITE count %d\n", count); |
10330 |
+diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c |
10331 |
+index 56f9edbf3d05..e11a5cfda4b1 100644 |
10332 |
+--- a/net/bluetooth/hci_sock.c |
10333 |
++++ b/net/bluetooth/hci_sock.c |
10334 |
+@@ -741,10 +741,11 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, |
10335 |
+ goto done; |
10336 |
+ } |
10337 |
+ |
10338 |
+- if (test_bit(HCI_UP, &hdev->flags) || |
10339 |
+- test_bit(HCI_INIT, &hdev->flags) || |
10340 |
++ if (test_bit(HCI_INIT, &hdev->flags) || |
10341 |
+ hci_dev_test_flag(hdev, HCI_SETUP) || |
10342 |
+- hci_dev_test_flag(hdev, HCI_CONFIG)) { |
10343 |
++ hci_dev_test_flag(hdev, HCI_CONFIG) || |
10344 |
++ (!hci_dev_test_flag(hdev, HCI_AUTO_OFF) && |
10345 |
++ test_bit(HCI_UP, &hdev->flags))) { |
10346 |
+ err = -EBUSY; |
10347 |
+ hci_dev_put(hdev); |
10348 |
+ goto done; |
10349 |
+@@ -760,10 +761,21 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, |
10350 |
+ |
10351 |
+ err = hci_dev_open(hdev->id); |
10352 |
+ if (err) { |
10353 |
+- hci_dev_clear_flag(hdev, HCI_USER_CHANNEL); |
10354 |
+- mgmt_index_added(hdev); |
10355 |
+- hci_dev_put(hdev); |
10356 |
+- goto done; |
10357 |
++ if (err == -EALREADY) { |
10358 |
++ /* In case the transport is already up and |
10359 |
++ * running, clear the error here. |
10360 |
++ * |
10361 |
++ * This can happen when opening an user |
10362 |
++ * channel and HCI_AUTO_OFF grace period |
10363 |
++ * is still active. |
10364 |
++ */ |
10365 |
++ err = 0; |
10366 |
++ } else { |
10367 |
++ hci_dev_clear_flag(hdev, HCI_USER_CHANNEL); |
10368 |
++ mgmt_index_added(hdev); |
10369 |
++ hci_dev_put(hdev); |
10370 |
++ goto done; |
10371 |
++ } |
10372 |
+ } |
10373 |
+ |
10374 |
+ atomic_inc(&hdev->promisc); |
10375 |
+diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c |
10376 |
+index 15796696d64e..4a3125836b64 100644 |
10377 |
+--- a/net/ceph/osdmap.c |
10378 |
++++ b/net/ceph/osdmap.c |
10379 |
+@@ -89,7 +89,7 @@ static int crush_decode_tree_bucket(void **p, void *end, |
10380 |
+ { |
10381 |
+ int j; |
10382 |
+ dout("crush_decode_tree_bucket %p to %p\n", *p, end); |
10383 |
+- ceph_decode_32_safe(p, end, b->num_nodes, bad); |
10384 |
++ ceph_decode_8_safe(p, end, b->num_nodes, bad); |
10385 |
+ b->node_weights = kcalloc(b->num_nodes, sizeof(u32), GFP_NOFS); |
10386 |
+ if (b->node_weights == NULL) |
10387 |
+ return -ENOMEM; |
10388 |
+diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c |
10389 |
+index b60c65f70346..627a2537634e 100644 |
10390 |
+--- a/net/ieee802154/socket.c |
10391 |
++++ b/net/ieee802154/socket.c |
10392 |
+@@ -739,6 +739,12 @@ static int dgram_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, |
10393 |
+ sock_recv_ts_and_drops(msg, sk, skb); |
10394 |
+ |
10395 |
+ if (saddr) { |
10396 |
++ /* Clear the implicit padding in struct sockaddr_ieee802154 |
10397 |
++ * (16 bits between 'family' and 'addr') and in struct |
10398 |
++ * ieee802154_addr_sa (16 bits at the end of the structure). |
10399 |
++ */ |
10400 |
++ memset(saddr, 0, sizeof(*saddr)); |
10401 |
++ |
10402 |
+ saddr->family = AF_IEEE802154; |
10403 |
+ ieee802154_addr_to_sa(&saddr->addr, &mac_cb(skb)->source); |
10404 |
+ *addr_len = sizeof(*saddr); |
10405 |
+diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c |
10406 |
+index ff347a0eebd4..f06d42267306 100644 |
10407 |
+--- a/net/mac80211/cfg.c |
10408 |
++++ b/net/mac80211/cfg.c |
10409 |
+@@ -3356,6 +3356,7 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, |
10410 |
+ /* Update CSA counters */ |
10411 |
+ if (sdata->vif.csa_active && |
10412 |
+ (sdata->vif.type == NL80211_IFTYPE_AP || |
10413 |
++ sdata->vif.type == NL80211_IFTYPE_MESH_POINT || |
10414 |
+ sdata->vif.type == NL80211_IFTYPE_ADHOC) && |
10415 |
+ params->n_csa_offsets) { |
10416 |
+ int i; |
10417 |
+diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c |
10418 |
+index bfef1b215050..a9c9d961f039 100644 |
10419 |
+--- a/net/mac80211/ibss.c |
10420 |
++++ b/net/mac80211/ibss.c |
10421 |
+@@ -146,6 +146,7 @@ ieee80211_ibss_build_presp(struct ieee80211_sub_if_data *sdata, |
10422 |
+ csa_settings->chandef.chan->center_freq); |
10423 |
+ presp->csa_counter_offsets[0] = (pos - presp->head); |
10424 |
+ *pos++ = csa_settings->count; |
10425 |
++ presp->csa_current_counter = csa_settings->count; |
10426 |
+ } |
10427 |
+ |
10428 |
+ /* put the remaining rates in WLAN_EID_EXT_SUPP_RATES */ |
10429 |
+diff --git a/net/mac80211/main.c b/net/mac80211/main.c |
10430 |
+index df3051d96aff..e86daed83c6f 100644 |
10431 |
+--- a/net/mac80211/main.c |
10432 |
++++ b/net/mac80211/main.c |
10433 |
+@@ -249,6 +249,7 @@ static void ieee80211_restart_work(struct work_struct *work) |
10434 |
+ { |
10435 |
+ struct ieee80211_local *local = |
10436 |
+ container_of(work, struct ieee80211_local, restart_work); |
10437 |
++ struct ieee80211_sub_if_data *sdata; |
10438 |
+ |
10439 |
+ /* wait for scan work complete */ |
10440 |
+ flush_workqueue(local->workqueue); |
10441 |
+@@ -257,6 +258,8 @@ static void ieee80211_restart_work(struct work_struct *work) |
10442 |
+ "%s called with hardware scan in progress\n", __func__); |
10443 |
+ |
10444 |
+ rtnl_lock(); |
10445 |
++ list_for_each_entry(sdata, &local->interfaces, list) |
10446 |
++ flush_delayed_work(&sdata->dec_tailroom_needed_wk); |
10447 |
+ ieee80211_scan_cancel(local); |
10448 |
+ ieee80211_reconfig(local); |
10449 |
+ rtnl_unlock(); |
10450 |
+diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c |
10451 |
+index d4684242e78b..817098add1d6 100644 |
10452 |
+--- a/net/mac80211/mesh.c |
10453 |
++++ b/net/mac80211/mesh.c |
10454 |
+@@ -680,6 +680,7 @@ ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh) |
10455 |
+ *pos++ = 0x0; |
10456 |
+ *pos++ = ieee80211_frequency_to_channel( |
10457 |
+ csa->settings.chandef.chan->center_freq); |
10458 |
++ bcn->csa_current_counter = csa->settings.count; |
10459 |
+ bcn->csa_counter_offsets[0] = hdr_len + 6; |
10460 |
+ *pos++ = csa->settings.count; |
10461 |
+ *pos++ = WLAN_EID_CHAN_SWITCH_PARAM; |
10462 |
+diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c |
10463 |
+index 9dd0ea8db463..28504dfd3dad 100644 |
10464 |
+--- a/net/sunrpc/backchannel_rqst.c |
10465 |
++++ b/net/sunrpc/backchannel_rqst.c |
10466 |
+@@ -60,7 +60,7 @@ static void xprt_free_allocation(struct rpc_rqst *req) |
10467 |
+ |
10468 |
+ dprintk("RPC: free allocations for req= %p\n", req); |
10469 |
+ WARN_ON_ONCE(test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state)); |
10470 |
+- xbufp = &req->rq_private_buf; |
10471 |
++ xbufp = &req->rq_rcv_buf; |
10472 |
+ free_page((unsigned long)xbufp->head[0].iov_base); |
10473 |
+ xbufp = &req->rq_snd_buf; |
10474 |
+ free_page((unsigned long)xbufp->head[0].iov_base); |
10475 |
+diff --git a/net/wireless/util.c b/net/wireless/util.c |
10476 |
+index 70051ab52f4f..7e4e3fffe7ce 100644 |
10477 |
+--- a/net/wireless/util.c |
10478 |
++++ b/net/wireless/util.c |
10479 |
+@@ -944,7 +944,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev, |
10480 |
+ ntype == NL80211_IFTYPE_P2P_CLIENT)) |
10481 |
+ return -EBUSY; |
10482 |
+ |
10483 |
+- if (ntype != otype && netif_running(dev)) { |
10484 |
++ if (ntype != otype) { |
10485 |
+ dev->ieee80211_ptr->use_4addr = false; |
10486 |
+ dev->ieee80211_ptr->mesh_id_up_len = 0; |
10487 |
+ wdev_lock(dev->ieee80211_ptr); |
10488 |
+diff --git a/samples/trace_events/trace-events-sample.h b/samples/trace_events/trace-events-sample.h |
10489 |
+index 8965d1bb8811..125d6402f64f 100644 |
10490 |
+--- a/samples/trace_events/trace-events-sample.h |
10491 |
++++ b/samples/trace_events/trace-events-sample.h |
10492 |
+@@ -168,7 +168,10 @@ |
10493 |
+ * |
10494 |
+ * For __dynamic_array(int, foo, bar) use __get_dynamic_array(foo) |
10495 |
+ * Use __get_dynamic_array_len(foo) to get the length of the array |
10496 |
+- * saved. |
10497 |
++ * saved. Note, __get_dynamic_array_len() returns the total allocated |
10498 |
++ * length of the dynamic array; __print_array() expects the second |
10499 |
++ * parameter to be the number of elements. To get that, the array length |
10500 |
++ * needs to be divided by the element size. |
10501 |
+ * |
10502 |
+ * For __string(foo, bar) use __get_str(foo) |
10503 |
+ * |
10504 |
+@@ -288,7 +291,7 @@ TRACE_EVENT(foo_bar, |
10505 |
+ * This prints out the array that is defined by __array in a nice format. |
10506 |
+ */ |
10507 |
+ __print_array(__get_dynamic_array(list), |
10508 |
+- __get_dynamic_array_len(list), |
10509 |
++ __get_dynamic_array_len(list) / sizeof(int), |
10510 |
+ sizeof(int)), |
10511 |
+ __get_str(str), __get_bitmask(cpus)) |
10512 |
+ ); |
10513 |
+diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c |
10514 |
+index 10f994307a04..582091498819 100644 |
10515 |
+--- a/security/integrity/evm/evm_main.c |
10516 |
++++ b/security/integrity/evm/evm_main.c |
10517 |
+@@ -296,6 +296,17 @@ static int evm_protect_xattr(struct dentry *dentry, const char *xattr_name, |
10518 |
+ iint = integrity_iint_find(d_backing_inode(dentry)); |
10519 |
+ if (iint && (iint->flags & IMA_NEW_FILE)) |
10520 |
+ return 0; |
10521 |
++ |
10522 |
++ /* exception for pseudo filesystems */ |
10523 |
++ if (dentry->d_inode->i_sb->s_magic == TMPFS_MAGIC |
10524 |
++ || dentry->d_inode->i_sb->s_magic == SYSFS_MAGIC) |
10525 |
++ return 0; |
10526 |
++ |
10527 |
++ integrity_audit_msg(AUDIT_INTEGRITY_METADATA, |
10528 |
++ dentry->d_inode, dentry->d_name.name, |
10529 |
++ "update_metadata", |
10530 |
++ integrity_status_msg[evm_status], |
10531 |
++ -EPERM, 0); |
10532 |
+ } |
10533 |
+ out: |
10534 |
+ if (evm_status != INTEGRITY_PASS) |
10535 |
+diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h |
10536 |
+index 8ee997dff139..fc56d4dfa954 100644 |
10537 |
+--- a/security/integrity/ima/ima.h |
10538 |
++++ b/security/integrity/ima/ima.h |
10539 |
+@@ -106,7 +106,7 @@ void ima_add_violation(struct file *file, const unsigned char *filename, |
10540 |
+ const char *op, const char *cause); |
10541 |
+ int ima_init_crypto(void); |
10542 |
+ void ima_putc(struct seq_file *m, void *data, int datalen); |
10543 |
+-void ima_print_digest(struct seq_file *m, u8 *digest, int size); |
10544 |
++void ima_print_digest(struct seq_file *m, u8 *digest, u32 size); |
10545 |
+ struct ima_template_desc *ima_template_desc_current(void); |
10546 |
+ int ima_init_template(void); |
10547 |
+ |
10548 |
+diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c |
10549 |
+index 461215e5fd31..816d175da79a 100644 |
10550 |
+--- a/security/integrity/ima/ima_fs.c |
10551 |
++++ b/security/integrity/ima/ima_fs.c |
10552 |
+@@ -190,9 +190,9 @@ static const struct file_operations ima_measurements_ops = { |
10553 |
+ .release = seq_release, |
10554 |
+ }; |
10555 |
+ |
10556 |
+-void ima_print_digest(struct seq_file *m, u8 *digest, int size) |
10557 |
++void ima_print_digest(struct seq_file *m, u8 *digest, u32 size) |
10558 |
+ { |
10559 |
+- int i; |
10560 |
++ u32 i; |
10561 |
+ |
10562 |
+ for (i = 0; i < size; i++) |
10563 |
+ seq_printf(m, "%02x", *(digest + i)); |
10564 |
+diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c |
10565 |
+index d1eefb9d65fb..3997e206f82d 100644 |
10566 |
+--- a/security/integrity/ima/ima_policy.c |
10567 |
++++ b/security/integrity/ima/ima_policy.c |
10568 |
+@@ -27,6 +27,8 @@ |
10569 |
+ #define IMA_UID 0x0008 |
10570 |
+ #define IMA_FOWNER 0x0010 |
10571 |
+ #define IMA_FSUUID 0x0020 |
10572 |
++#define IMA_INMASK 0x0040 |
10573 |
++#define IMA_EUID 0x0080 |
10574 |
+ |
10575 |
+ #define UNKNOWN 0 |
10576 |
+ #define MEASURE 0x0001 /* same as IMA_MEASURE */ |
10577 |
+@@ -42,6 +44,8 @@ enum lsm_rule_types { LSM_OBJ_USER, LSM_OBJ_ROLE, LSM_OBJ_TYPE, |
10578 |
+ LSM_SUBJ_USER, LSM_SUBJ_ROLE, LSM_SUBJ_TYPE |
10579 |
+ }; |
10580 |
+ |
10581 |
++enum policy_types { ORIGINAL_TCB = 1, DEFAULT_TCB }; |
10582 |
++ |
10583 |
+ struct ima_rule_entry { |
10584 |
+ struct list_head list; |
10585 |
+ int action; |
10586 |
+@@ -70,7 +74,7 @@ struct ima_rule_entry { |
10587 |
+ * normal users can easily run the machine out of memory simply building |
10588 |
+ * and running executables. |
10589 |
+ */ |
10590 |
+-static struct ima_rule_entry default_rules[] = { |
10591 |
++static struct ima_rule_entry dont_measure_rules[] = { |
10592 |
+ {.action = DONT_MEASURE, .fsmagic = PROC_SUPER_MAGIC, .flags = IMA_FSMAGIC}, |
10593 |
+ {.action = DONT_MEASURE, .fsmagic = SYSFS_MAGIC, .flags = IMA_FSMAGIC}, |
10594 |
+ {.action = DONT_MEASURE, .fsmagic = DEBUGFS_MAGIC, .flags = IMA_FSMAGIC}, |
10595 |
+@@ -79,12 +83,31 @@ static struct ima_rule_entry default_rules[] = { |
10596 |
+ {.action = DONT_MEASURE, .fsmagic = BINFMTFS_MAGIC, .flags = IMA_FSMAGIC}, |
10597 |
+ {.action = DONT_MEASURE, .fsmagic = SECURITYFS_MAGIC, .flags = IMA_FSMAGIC}, |
10598 |
+ {.action = DONT_MEASURE, .fsmagic = SELINUX_MAGIC, .flags = IMA_FSMAGIC}, |
10599 |
++ {.action = DONT_MEASURE, .fsmagic = CGROUP_SUPER_MAGIC, |
10600 |
++ .flags = IMA_FSMAGIC}, |
10601 |
++ {.action = DONT_MEASURE, .fsmagic = NSFS_MAGIC, .flags = IMA_FSMAGIC} |
10602 |
++}; |
10603 |
++ |
10604 |
++static struct ima_rule_entry original_measurement_rules[] = { |
10605 |
+ {.action = MEASURE, .func = MMAP_CHECK, .mask = MAY_EXEC, |
10606 |
+ .flags = IMA_FUNC | IMA_MASK}, |
10607 |
+ {.action = MEASURE, .func = BPRM_CHECK, .mask = MAY_EXEC, |
10608 |
+ .flags = IMA_FUNC | IMA_MASK}, |
10609 |
+- {.action = MEASURE, .func = FILE_CHECK, .mask = MAY_READ, .uid = GLOBAL_ROOT_UID, |
10610 |
+- .flags = IMA_FUNC | IMA_MASK | IMA_UID}, |
10611 |
++ {.action = MEASURE, .func = FILE_CHECK, .mask = MAY_READ, |
10612 |
++ .uid = GLOBAL_ROOT_UID, .flags = IMA_FUNC | IMA_MASK | IMA_UID}, |
10613 |
++ {.action = MEASURE, .func = MODULE_CHECK, .flags = IMA_FUNC}, |
10614 |
++ {.action = MEASURE, .func = FIRMWARE_CHECK, .flags = IMA_FUNC}, |
10615 |
++}; |
10616 |
++ |
10617 |
++static struct ima_rule_entry default_measurement_rules[] = { |
10618 |
++ {.action = MEASURE, .func = MMAP_CHECK, .mask = MAY_EXEC, |
10619 |
++ .flags = IMA_FUNC | IMA_MASK}, |
10620 |
++ {.action = MEASURE, .func = BPRM_CHECK, .mask = MAY_EXEC, |
10621 |
++ .flags = IMA_FUNC | IMA_MASK}, |
10622 |
++ {.action = MEASURE, .func = FILE_CHECK, .mask = MAY_READ, |
10623 |
++ .uid = GLOBAL_ROOT_UID, .flags = IMA_FUNC | IMA_INMASK | IMA_EUID}, |
10624 |
++ {.action = MEASURE, .func = FILE_CHECK, .mask = MAY_READ, |
10625 |
++ .uid = GLOBAL_ROOT_UID, .flags = IMA_FUNC | IMA_INMASK | IMA_UID}, |
10626 |
+ {.action = MEASURE, .func = MODULE_CHECK, .flags = IMA_FUNC}, |
10627 |
+ {.action = MEASURE, .func = FIRMWARE_CHECK, .flags = IMA_FUNC}, |
10628 |
+ }; |
10629 |
+@@ -99,6 +122,7 @@ static struct ima_rule_entry default_appraise_rules[] = { |
10630 |
+ {.action = DONT_APPRAISE, .fsmagic = BINFMTFS_MAGIC, .flags = IMA_FSMAGIC}, |
10631 |
+ {.action = DONT_APPRAISE, .fsmagic = SECURITYFS_MAGIC, .flags = IMA_FSMAGIC}, |
10632 |
+ {.action = DONT_APPRAISE, .fsmagic = SELINUX_MAGIC, .flags = IMA_FSMAGIC}, |
10633 |
++ {.action = DONT_APPRAISE, .fsmagic = NSFS_MAGIC, .flags = IMA_FSMAGIC}, |
10634 |
+ {.action = DONT_APPRAISE, .fsmagic = CGROUP_SUPER_MAGIC, .flags = IMA_FSMAGIC}, |
10635 |
+ #ifndef CONFIG_IMA_APPRAISE_SIGNED_INIT |
10636 |
+ {.action = APPRAISE, .fowner = GLOBAL_ROOT_UID, .flags = IMA_FOWNER}, |
10637 |
+@@ -115,14 +139,29 @@ static struct list_head *ima_rules; |
10638 |
+ |
10639 |
+ static DEFINE_MUTEX(ima_rules_mutex); |
10640 |
+ |
10641 |
+-static bool ima_use_tcb __initdata; |
10642 |
++static int ima_policy __initdata; |
10643 |
+ static int __init default_measure_policy_setup(char *str) |
10644 |
+ { |
10645 |
+- ima_use_tcb = 1; |
10646 |
++ if (ima_policy) |
10647 |
++ return 1; |
10648 |
++ |
10649 |
++ ima_policy = ORIGINAL_TCB; |
10650 |
+ return 1; |
10651 |
+ } |
10652 |
+ __setup("ima_tcb", default_measure_policy_setup); |
10653 |
+ |
10654 |
++static int __init policy_setup(char *str) |
10655 |
++{ |
10656 |
++ if (ima_policy) |
10657 |
++ return 1; |
10658 |
++ |
10659 |
++ if (strcmp(str, "tcb") == 0) |
10660 |
++ ima_policy = DEFAULT_TCB; |
10661 |
++ |
10662 |
++ return 1; |
10663 |
++} |
10664 |
++__setup("ima_policy=", policy_setup); |
10665 |
++ |
10666 |
+ static bool ima_use_appraise_tcb __initdata; |
10667 |
+ static int __init default_appraise_policy_setup(char *str) |
10668 |
+ { |
10669 |
+@@ -182,6 +221,9 @@ static bool ima_match_rules(struct ima_rule_entry *rule, |
10670 |
+ if ((rule->flags & IMA_MASK) && |
10671 |
+ (rule->mask != mask && func != POST_SETATTR)) |
10672 |
+ return false; |
10673 |
++ if ((rule->flags & IMA_INMASK) && |
10674 |
++ (!(rule->mask & mask) && func != POST_SETATTR)) |
10675 |
++ return false; |
10676 |
+ if ((rule->flags & IMA_FSMAGIC) |
10677 |
+ && rule->fsmagic != inode->i_sb->s_magic) |
10678 |
+ return false; |
10679 |
+@@ -190,6 +232,16 @@ static bool ima_match_rules(struct ima_rule_entry *rule, |
10680 |
+ return false; |
10681 |
+ if ((rule->flags & IMA_UID) && !uid_eq(rule->uid, cred->uid)) |
10682 |
+ return false; |
10683 |
++ if (rule->flags & IMA_EUID) { |
10684 |
++ if (has_capability_noaudit(current, CAP_SETUID)) { |
10685 |
++ if (!uid_eq(rule->uid, cred->euid) |
10686 |
++ && !uid_eq(rule->uid, cred->suid) |
10687 |
++ && !uid_eq(rule->uid, cred->uid)) |
10688 |
++ return false; |
10689 |
++ } else if (!uid_eq(rule->uid, cred->euid)) |
10690 |
++ return false; |
10691 |
++ } |
10692 |
++ |
10693 |
+ if ((rule->flags & IMA_FOWNER) && !uid_eq(rule->fowner, inode->i_uid)) |
10694 |
+ return false; |
10695 |
+ for (i = 0; i < MAX_LSM_RULES; i++) { |
10696 |
+@@ -333,21 +385,31 @@ void __init ima_init_policy(void) |
10697 |
+ { |
10698 |
+ int i, measure_entries, appraise_entries; |
10699 |
+ |
10700 |
+- /* if !ima_use_tcb set entries = 0 so we load NO default rules */ |
10701 |
+- measure_entries = ima_use_tcb ? ARRAY_SIZE(default_rules) : 0; |
10702 |
++ /* if !ima_policy set entries = 0 so we load NO default rules */ |
10703 |
++ measure_entries = ima_policy ? ARRAY_SIZE(dont_measure_rules) : 0; |
10704 |
+ appraise_entries = ima_use_appraise_tcb ? |
10705 |
+ ARRAY_SIZE(default_appraise_rules) : 0; |
10706 |
+ |
10707 |
+- for (i = 0; i < measure_entries + appraise_entries; i++) { |
10708 |
+- if (i < measure_entries) |
10709 |
+- list_add_tail(&default_rules[i].list, |
10710 |
+- &ima_default_rules); |
10711 |
+- else { |
10712 |
+- int j = i - measure_entries; |
10713 |
++ for (i = 0; i < measure_entries; i++) |
10714 |
++ list_add_tail(&dont_measure_rules[i].list, &ima_default_rules); |
10715 |
+ |
10716 |
+- list_add_tail(&default_appraise_rules[j].list, |
10717 |
++ switch (ima_policy) { |
10718 |
++ case ORIGINAL_TCB: |
10719 |
++ for (i = 0; i < ARRAY_SIZE(original_measurement_rules); i++) |
10720 |
++ list_add_tail(&original_measurement_rules[i].list, |
10721 |
+ &ima_default_rules); |
10722 |
+- } |
10723 |
++ break; |
10724 |
++ case DEFAULT_TCB: |
10725 |
++ for (i = 0; i < ARRAY_SIZE(default_measurement_rules); i++) |
10726 |
++ list_add_tail(&default_measurement_rules[i].list, |
10727 |
++ &ima_default_rules); |
10728 |
++ default: |
10729 |
++ break; |
10730 |
++ } |
10731 |
++ |
10732 |
++ for (i = 0; i < appraise_entries; i++) { |
10733 |
++ list_add_tail(&default_appraise_rules[i].list, |
10734 |
++ &ima_default_rules); |
10735 |
+ } |
10736 |
+ |
10737 |
+ ima_rules = &ima_default_rules; |
10738 |
+@@ -373,7 +435,8 @@ enum { |
10739 |
+ Opt_audit, |
10740 |
+ Opt_obj_user, Opt_obj_role, Opt_obj_type, |
10741 |
+ Opt_subj_user, Opt_subj_role, Opt_subj_type, |
10742 |
+- Opt_func, Opt_mask, Opt_fsmagic, Opt_uid, Opt_fowner, |
10743 |
++ Opt_func, Opt_mask, Opt_fsmagic, |
10744 |
++ Opt_uid, Opt_euid, Opt_fowner, |
10745 |
+ Opt_appraise_type, Opt_fsuuid, Opt_permit_directio |
10746 |
+ }; |
10747 |
+ |
10748 |
+@@ -394,6 +457,7 @@ static match_table_t policy_tokens = { |
10749 |
+ {Opt_fsmagic, "fsmagic=%s"}, |
10750 |
+ {Opt_fsuuid, "fsuuid=%s"}, |
10751 |
+ {Opt_uid, "uid=%s"}, |
10752 |
++ {Opt_euid, "euid=%s"}, |
10753 |
+ {Opt_fowner, "fowner=%s"}, |
10754 |
+ {Opt_appraise_type, "appraise_type=%s"}, |
10755 |
+ {Opt_permit_directio, "permit_directio"}, |
10756 |
+@@ -435,6 +499,7 @@ static void ima_log_string(struct audit_buffer *ab, char *key, char *value) |
10757 |
+ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) |
10758 |
+ { |
10759 |
+ struct audit_buffer *ab; |
10760 |
++ char *from; |
10761 |
+ char *p; |
10762 |
+ int result = 0; |
10763 |
+ |
10764 |
+@@ -525,18 +590,23 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) |
10765 |
+ if (entry->mask) |
10766 |
+ result = -EINVAL; |
10767 |
+ |
10768 |
+- if ((strcmp(args[0].from, "MAY_EXEC")) == 0) |
10769 |
++ from = args[0].from; |
10770 |
++ if (*from == '^') |
10771 |
++ from++; |
10772 |
++ |
10773 |
++ if ((strcmp(from, "MAY_EXEC")) == 0) |
10774 |
+ entry->mask = MAY_EXEC; |
10775 |
+- else if (strcmp(args[0].from, "MAY_WRITE") == 0) |
10776 |
++ else if (strcmp(from, "MAY_WRITE") == 0) |
10777 |
+ entry->mask = MAY_WRITE; |
10778 |
+- else if (strcmp(args[0].from, "MAY_READ") == 0) |
10779 |
++ else if (strcmp(from, "MAY_READ") == 0) |
10780 |
+ entry->mask = MAY_READ; |
10781 |
+- else if (strcmp(args[0].from, "MAY_APPEND") == 0) |
10782 |
++ else if (strcmp(from, "MAY_APPEND") == 0) |
10783 |
+ entry->mask = MAY_APPEND; |
10784 |
+ else |
10785 |
+ result = -EINVAL; |
10786 |
+ if (!result) |
10787 |
+- entry->flags |= IMA_MASK; |
10788 |
++ entry->flags |= (*args[0].from == '^') |
10789 |
++ ? IMA_INMASK : IMA_MASK; |
10790 |
+ break; |
10791 |
+ case Opt_fsmagic: |
10792 |
+ ima_log_string(ab, "fsmagic", args[0].from); |
10793 |
+@@ -566,6 +636,9 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) |
10794 |
+ break; |
10795 |
+ case Opt_uid: |
10796 |
+ ima_log_string(ab, "uid", args[0].from); |
10797 |
++ case Opt_euid: |
10798 |
++ if (token == Opt_euid) |
10799 |
++ ima_log_string(ab, "euid", args[0].from); |
10800 |
+ |
10801 |
+ if (uid_valid(entry->uid)) { |
10802 |
+ result = -EINVAL; |
10803 |
+@@ -574,11 +647,14 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) |
10804 |
+ |
10805 |
+ result = kstrtoul(args[0].from, 10, &lnum); |
10806 |
+ if (!result) { |
10807 |
+- entry->uid = make_kuid(current_user_ns(), (uid_t)lnum); |
10808 |
+- if (!uid_valid(entry->uid) || (((uid_t)lnum) != lnum)) |
10809 |
++ entry->uid = make_kuid(current_user_ns(), |
10810 |
++ (uid_t) lnum); |
10811 |
++ if (!uid_valid(entry->uid) || |
10812 |
++ (uid_t)lnum != lnum) |
10813 |
+ result = -EINVAL; |
10814 |
+ else |
10815 |
+- entry->flags |= IMA_UID; |
10816 |
++ entry->flags |= (token == Opt_uid) |
10817 |
++ ? IMA_UID : IMA_EUID; |
10818 |
+ } |
10819 |
+ break; |
10820 |
+ case Opt_fowner: |
10821 |
+diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c |
10822 |
+index bcfc36cbde6a..61fbd0c0d95c 100644 |
10823 |
+--- a/security/integrity/ima/ima_template_lib.c |
10824 |
++++ b/security/integrity/ima/ima_template_lib.c |
10825 |
+@@ -70,7 +70,8 @@ static void ima_show_template_data_ascii(struct seq_file *m, |
10826 |
+ enum data_formats datafmt, |
10827 |
+ struct ima_field_data *field_data) |
10828 |
+ { |
10829 |
+- u8 *buf_ptr = field_data->data, buflen = field_data->len; |
10830 |
++ u8 *buf_ptr = field_data->data; |
10831 |
++ u32 buflen = field_data->len; |
10832 |
+ |
10833 |
+ switch (datafmt) { |
10834 |
+ case DATA_FMT_DIGEST_WITH_ALGO: |
10835 |
+diff --git a/security/keys/keyring.c b/security/keys/keyring.c |
10836 |
+index e72548b5897e..d33437007ad2 100644 |
10837 |
+--- a/security/keys/keyring.c |
10838 |
++++ b/security/keys/keyring.c |
10839 |
+@@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring, |
10840 |
+ if (index_key->type == &key_type_keyring) |
10841 |
+ up_write(&keyring_serialise_link_sem); |
10842 |
+ |
10843 |
+- if (edit && !edit->dead_leaf) { |
10844 |
+- key_payload_reserve(keyring, |
10845 |
+- keyring->datalen - KEYQUOTA_LINK_BYTES); |
10846 |
++ if (edit) { |
10847 |
++ if (!edit->dead_leaf) { |
10848 |
++ key_payload_reserve(keyring, |
10849 |
++ keyring->datalen - KEYQUOTA_LINK_BYTES); |
10850 |
++ } |
10851 |
+ assoc_array_cancel_edit(edit); |
10852 |
+ } |
10853 |
+ up_write(&keyring->sem); |
10854 |
+diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
10855 |
+index 212070e1de1a..7f8d7f19e044 100644 |
10856 |
+--- a/security/selinux/hooks.c |
10857 |
++++ b/security/selinux/hooks.c |
10858 |
+@@ -3288,7 +3288,8 @@ static int file_map_prot_check(struct file *file, unsigned long prot, int shared |
10859 |
+ int rc = 0; |
10860 |
+ |
10861 |
+ if (default_noexec && |
10862 |
+- (prot & PROT_EXEC) && (!file || (!shared && (prot & PROT_WRITE)))) { |
10863 |
++ (prot & PROT_EXEC) && (!file || IS_PRIVATE(file_inode(file)) || |
10864 |
++ (!shared && (prot & PROT_WRITE)))) { |
10865 |
+ /* |
10866 |
+ * We are making executable an anonymous mapping or a |
10867 |
+ * private file mapping that will also be writable. |
10868 |
+diff --git a/security/selinux/ss/ebitmap.c b/security/selinux/ss/ebitmap.c |
10869 |
+index afe6a269ec17..57644b1dc42e 100644 |
10870 |
+--- a/security/selinux/ss/ebitmap.c |
10871 |
++++ b/security/selinux/ss/ebitmap.c |
10872 |
+@@ -153,6 +153,12 @@ int ebitmap_netlbl_import(struct ebitmap *ebmap, |
10873 |
+ if (offset == (u32)-1) |
10874 |
+ return 0; |
10875 |
+ |
10876 |
++ /* don't waste ebitmap space if the netlabel bitmap is empty */ |
10877 |
++ if (bitmap == 0) { |
10878 |
++ offset += EBITMAP_UNIT_SIZE; |
10879 |
++ continue; |
10880 |
++ } |
10881 |
++ |
10882 |
+ if (e_iter == NULL || |
10883 |
+ offset >= e_iter->startbit + EBITMAP_SIZE) { |
10884 |
+ e_prev = e_iter; |
10885 |
+diff --git a/sound/soc/codecs/max98925.c b/sound/soc/codecs/max98925.c |
10886 |
+index 9b5a17de4690..aad664225dc3 100644 |
10887 |
+--- a/sound/soc/codecs/max98925.c |
10888 |
++++ b/sound/soc/codecs/max98925.c |
10889 |
+@@ -346,7 +346,7 @@ static int max98925_dai_set_fmt(struct snd_soc_dai *codec_dai, |
10890 |
+ } |
10891 |
+ |
10892 |
+ regmap_update_bits(max98925->regmap, MAX98925_FORMAT, |
10893 |
+- M98925_DAI_BCI_MASK, invert); |
10894 |
++ M98925_DAI_BCI_MASK | M98925_DAI_WCI_MASK, invert); |
10895 |
+ return 0; |
10896 |
+ } |
10897 |
+ |
10898 |
+diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c |
10899 |
+index be4d741c45ba..2ee44abd56a6 100644 |
10900 |
+--- a/sound/soc/codecs/rt5645.c |
10901 |
++++ b/sound/soc/codecs/rt5645.c |
10902 |
+@@ -2837,6 +2837,8 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, |
10903 |
+ } |
10904 |
+ } |
10905 |
+ |
10906 |
++ INIT_DELAYED_WORK(&rt5645->jack_detect_work, rt5645_jack_detect_work); |
10907 |
++ |
10908 |
+ if (rt5645->i2c->irq) { |
10909 |
+ ret = request_threaded_irq(rt5645->i2c->irq, NULL, rt5645_irq, |
10910 |
+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
10911 |
+@@ -2855,8 +2857,6 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, |
10912 |
+ dev_err(&i2c->dev, "Fail gpio_direction hp_det_gpio\n"); |
10913 |
+ } |
10914 |
+ |
10915 |
+- INIT_DELAYED_WORK(&rt5645->jack_detect_work, rt5645_jack_detect_work); |
10916 |
+- |
10917 |
+ return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5645, |
10918 |
+ rt5645_dai, ARRAY_SIZE(rt5645_dai)); |
10919 |
+ } |
10920 |
+diff --git a/sound/soc/codecs/tas2552.c b/sound/soc/codecs/tas2552.c |
10921 |
+index dfb4ff5cc9ea..18558595ba72 100644 |
10922 |
+--- a/sound/soc/codecs/tas2552.c |
10923 |
++++ b/sound/soc/codecs/tas2552.c |
10924 |
+@@ -120,6 +120,9 @@ static void tas2552_sw_shutdown(struct tas2552_data *tas_data, int sw_shutdown) |
10925 |
+ { |
10926 |
+ u8 cfg1_reg; |
10927 |
+ |
10928 |
++ if (!tas_data->codec) |
10929 |
++ return; |
10930 |
++ |
10931 |
+ if (sw_shutdown) |
10932 |
+ cfg1_reg = 0; |
10933 |
+ else |
10934 |
+@@ -335,7 +338,6 @@ static DECLARE_TLV_DB_SCALE(dac_tlv, -7, 100, 24); |
10935 |
+ static const struct snd_kcontrol_new tas2552_snd_controls[] = { |
10936 |
+ SOC_SINGLE_TLV("Speaker Driver Playback Volume", |
10937 |
+ TAS2552_PGA_GAIN, 0, 0x1f, 1, dac_tlv), |
10938 |
+- SOC_DAPM_SINGLE("Playback AMP", SND_SOC_NOPM, 0, 1, 0), |
10939 |
+ }; |
10940 |
+ |
10941 |
+ static const struct reg_default tas2552_init_regs[] = { |
10942 |
+diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c |
10943 |
+index 0c6d1bc0526e..d476221dba51 100644 |
10944 |
+--- a/sound/soc/codecs/wm5102.c |
10945 |
++++ b/sound/soc/codecs/wm5102.c |
10946 |
+@@ -42,7 +42,7 @@ struct wm5102_priv { |
10947 |
+ static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); |
10948 |
+ static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); |
10949 |
+ static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); |
10950 |
+-static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0); |
10951 |
++static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0); |
10952 |
+ static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0); |
10953 |
+ |
10954 |
+ static const struct wm_adsp_region wm5102_dsp1_regions[] = { |
10955 |
+diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c |
10956 |
+index fbaeddb3e903..3ee6cfd0578b 100644 |
10957 |
+--- a/sound/soc/codecs/wm5110.c |
10958 |
++++ b/sound/soc/codecs/wm5110.c |
10959 |
+@@ -167,7 +167,7 @@ static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w, |
10960 |
+ static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); |
10961 |
+ static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); |
10962 |
+ static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); |
10963 |
+-static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0); |
10964 |
++static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0); |
10965 |
+ static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0); |
10966 |
+ |
10967 |
+ #define WM5110_NG_SRC(name, base) \ |
10968 |
+diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c |
10969 |
+index ada9ac1ba2c6..51171e457fa4 100644 |
10970 |
+--- a/sound/soc/codecs/wm8737.c |
10971 |
++++ b/sound/soc/codecs/wm8737.c |
10972 |
+@@ -483,7 +483,8 @@ static int wm8737_set_bias_level(struct snd_soc_codec *codec, |
10973 |
+ |
10974 |
+ /* Fast VMID ramp at 2*2.5k */ |
10975 |
+ snd_soc_update_bits(codec, WM8737_MISC_BIAS_CONTROL, |
10976 |
+- WM8737_VMIDSEL_MASK, 0x4); |
10977 |
++ WM8737_VMIDSEL_MASK, |
10978 |
++ 2 << WM8737_VMIDSEL_SHIFT); |
10979 |
+ |
10980 |
+ /* Bring VMID up */ |
10981 |
+ snd_soc_update_bits(codec, WM8737_POWER_MANAGEMENT, |
10982 |
+@@ -497,7 +498,8 @@ static int wm8737_set_bias_level(struct snd_soc_codec *codec, |
10983 |
+ |
10984 |
+ /* VMID at 2*300k */ |
10985 |
+ snd_soc_update_bits(codec, WM8737_MISC_BIAS_CONTROL, |
10986 |
+- WM8737_VMIDSEL_MASK, 2); |
10987 |
++ WM8737_VMIDSEL_MASK, |
10988 |
++ 1 << WM8737_VMIDSEL_SHIFT); |
10989 |
+ |
10990 |
+ break; |
10991 |
+ |
10992 |
+diff --git a/sound/soc/codecs/wm8903.h b/sound/soc/codecs/wm8903.h |
10993 |
+index db949311c0f2..0bb4a647755d 100644 |
10994 |
+--- a/sound/soc/codecs/wm8903.h |
10995 |
++++ b/sound/soc/codecs/wm8903.h |
10996 |
+@@ -172,7 +172,7 @@ extern int wm8903_mic_detect(struct snd_soc_codec *codec, |
10997 |
+ #define WM8903_VMID_BUF_ENA_WIDTH 1 /* VMID_BUF_ENA */ |
10998 |
+ |
10999 |
+ #define WM8903_VMID_RES_50K 2 |
11000 |
+-#define WM8903_VMID_RES_250K 3 |
11001 |
++#define WM8903_VMID_RES_250K 4 |
11002 |
+ #define WM8903_VMID_RES_5K 6 |
11003 |
+ |
11004 |
+ /* |
11005 |
+diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c |
11006 |
+index 00bec915d652..03e04bf6c5ba 100644 |
11007 |
+--- a/sound/soc/codecs/wm8955.c |
11008 |
++++ b/sound/soc/codecs/wm8955.c |
11009 |
+@@ -298,7 +298,7 @@ static int wm8955_configure_clocking(struct snd_soc_codec *codec) |
11010 |
+ snd_soc_update_bits(codec, WM8955_PLL_CONTROL_2, |
11011 |
+ WM8955_K_17_9_MASK, |
11012 |
+ (pll.k >> 9) & WM8955_K_17_9_MASK); |
11013 |
+- snd_soc_update_bits(codec, WM8955_PLL_CONTROL_2, |
11014 |
++ snd_soc_update_bits(codec, WM8955_PLL_CONTROL_3, |
11015 |
+ WM8955_K_8_0_MASK, |
11016 |
+ pll.k & WM8955_K_8_0_MASK); |
11017 |
+ if (pll.k) |
11018 |
+diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c |
11019 |
+index e97a7615df85..8d7f63253440 100644 |
11020 |
+--- a/sound/soc/codecs/wm8960.c |
11021 |
++++ b/sound/soc/codecs/wm8960.c |
11022 |
+@@ -245,7 +245,7 @@ SOC_SINGLE("PCM Playback -6dB Switch", WM8960_DACCTL1, 7, 1, 0), |
11023 |
+ SOC_ENUM("ADC Polarity", wm8960_enum[0]), |
11024 |
+ SOC_SINGLE("ADC High Pass Filter Switch", WM8960_DACCTL1, 0, 1, 0), |
11025 |
+ |
11026 |
+-SOC_ENUM("DAC Polarity", wm8960_enum[2]), |
11027 |
++SOC_ENUM("DAC Polarity", wm8960_enum[1]), |
11028 |
+ SOC_SINGLE_BOOL_EXT("DAC Deemphasis Switch", 0, |
11029 |
+ wm8960_get_deemph, wm8960_put_deemph), |
11030 |
+ |
11031 |
+diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c |
11032 |
+index a4d11770630c..e7c81baefe66 100644 |
11033 |
+--- a/sound/soc/codecs/wm8997.c |
11034 |
++++ b/sound/soc/codecs/wm8997.c |
11035 |
+@@ -40,7 +40,7 @@ struct wm8997_priv { |
11036 |
+ static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); |
11037 |
+ static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); |
11038 |
+ static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); |
11039 |
+-static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0); |
11040 |
++static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0); |
11041 |
+ static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0); |
11042 |
+ |
11043 |
+ static const struct reg_default wm8997_sysclk_reva_patch[] = { |
11044 |
+diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c |
11045 |
+index cd146d4fa805..b38b98cae855 100644 |
11046 |
+--- a/sound/soc/fsl/imx-wm8962.c |
11047 |
++++ b/sound/soc/fsl/imx-wm8962.c |
11048 |
+@@ -190,7 +190,7 @@ static int imx_wm8962_probe(struct platform_device *pdev) |
11049 |
+ dev_err(&pdev->dev, "audmux internal port setup failed\n"); |
11050 |
+ return ret; |
11051 |
+ } |
11052 |
+- imx_audmux_v2_configure_port(ext_port, |
11053 |
++ ret = imx_audmux_v2_configure_port(ext_port, |
11054 |
+ IMX_AUDMUX_V2_PTCR_SYN, |
11055 |
+ IMX_AUDMUX_V2_PDCR_RXDSEL(int_port)); |
11056 |
+ if (ret) { |
11057 |
+diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig |
11058 |
+index 6768e4f7d7d0..30d0109703a9 100644 |
11059 |
+--- a/sound/soc/omap/Kconfig |
11060 |
++++ b/sound/soc/omap/Kconfig |
11061 |
+@@ -100,12 +100,13 @@ config SND_OMAP_SOC_OMAP_TWL4030 |
11062 |
+ |
11063 |
+ config SND_OMAP_SOC_OMAP_ABE_TWL6040 |
11064 |
+ tristate "SoC Audio support for OMAP boards using ABE and twl6040 codec" |
11065 |
+- depends on TWL6040_CORE && SND_OMAP_SOC && (ARCH_OMAP4 || SOC_OMAP5 || COMPILE_TEST) |
11066 |
++ depends on TWL6040_CORE && SND_OMAP_SOC |
11067 |
++ depends on ARCH_OMAP4 || (SOC_OMAP5 && MFD_PALMAS) || COMPILE_TEST |
11068 |
+ select SND_OMAP_SOC_DMIC |
11069 |
+ select SND_OMAP_SOC_MCPDM |
11070 |
+ select SND_SOC_TWL6040 |
11071 |
+ select SND_SOC_DMIC |
11072 |
+- select COMMON_CLK_PALMAS if MFD_PALMAS |
11073 |
++ select COMMON_CLK_PALMAS if (SOC_OMAP5 && MFD_PALMAS) |
11074 |
+ help |
11075 |
+ Say Y if you want to add support for SoC audio on OMAP boards using |
11076 |
+ ABE and twl6040 codec. This driver currently supports: |
11077 |
+diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig |
11078 |
+index 5f58e4f1bca9..b07f183fc47f 100644 |
11079 |
+--- a/sound/soc/qcom/Kconfig |
11080 |
++++ b/sound/soc/qcom/Kconfig |
11081 |
+@@ -6,12 +6,10 @@ config SND_SOC_QCOM |
11082 |
+ |
11083 |
+ config SND_SOC_LPASS_CPU |
11084 |
+ tristate |
11085 |
+- depends on SND_SOC_QCOM |
11086 |
+ select REGMAP_MMIO |
11087 |
+ |
11088 |
+ config SND_SOC_LPASS_PLATFORM |
11089 |
+ tristate |
11090 |
+- depends on SND_SOC_QCOM |
11091 |
+ select REGMAP_MMIO |
11092 |
+ |
11093 |
+ config SND_SOC_STORM |
11094 |
+diff --git a/tools/perf/util/cloexec.c b/tools/perf/util/cloexec.c |
11095 |
+index 85b523885f9d..2babddaa2481 100644 |
11096 |
+--- a/tools/perf/util/cloexec.c |
11097 |
++++ b/tools/perf/util/cloexec.c |
11098 |
+@@ -7,11 +7,15 @@ |
11099 |
+ |
11100 |
+ static unsigned long flag = PERF_FLAG_FD_CLOEXEC; |
11101 |
+ |
11102 |
++#ifdef __GLIBC_PREREQ |
11103 |
++#if !__GLIBC_PREREQ(2, 6) |
11104 |
+ int __weak sched_getcpu(void) |
11105 |
+ { |
11106 |
+ errno = ENOSYS; |
11107 |
+ return -1; |
11108 |
+ } |
11109 |
++#endif |
11110 |
++#endif |
11111 |
+ |
11112 |
+ static int perf_flag_probe(void) |
11113 |
+ { |