Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:master commit in: /
Date: Tue, 23 Jun 2015 12:48:32
Message-Id: 1431027431.6896bc5b6d9e445f5cdb7f401ba0391bb32ad436.mpagano@gentoo
1 commit: 6896bc5b6d9e445f5cdb7f401ba0391bb32ad436
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 7 19:37:11 2015 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Thu May 7 19:37:11 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=6896bc5b
7
8 Fix linux patch 4.0.2
9
10 1001_linux-4.0.2.patch | 23654 +++++++++++++++--------------------------------
11 1 file changed, 7692 insertions(+), 15962 deletions(-)
12
13 diff --git a/1001_linux-4.0.2.patch b/1001_linux-4.0.2.patch
14 index 5650c4e..38a75b2 100644
15 --- a/1001_linux-4.0.2.patch
16 +++ b/1001_linux-4.0.2.patch
17 @@ -1,2977 +1,1474 @@
18 -From 7bebf970047f59c16ddd5660b54562c8bcd40074 Mon Sep 17 00:00:00 2001
19 -From: =?UTF-8?q?Sebastian=20P=C3=B6hn?= <sebastian.poehn@×××××.com>
20 -Date: Mon, 20 Apr 2015 09:19:20 +0200
21 -Subject: [PATCH 001/219] ip_forward: Drop frames with attached skb->sk
22 -Cc: mpagano@g.o
23 -
24 -[ Upstream commit 2ab957492d13bb819400ac29ae55911d50a82a13 ]
25 -
26 -Initial discussion was:
27 -[FYI] xfrm: Don't lookup sk_policy for timewait sockets
28 -
29 -Forwarded frames should not have a socket attached. Especially
30 -tw sockets will lead to panics later-on in the stack.
31 -
32 -This was observed with TPROXY assigning a tw socket and broken
33 -policy routing (misconfigured). As a result frame enters
34 -forwarding path instead of input. We cannot solve this in
35 -TPROXY as it cannot know that policy routing is broken.
36 -
37 -v2:
38 -Remove useless comment
39 -
40 -Signed-off-by: Sebastian Poehn <sebastian.poehn@×××××.com>
41 -Signed-off-by: David S. Miller <davem@×××××××××.net>
42 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
43 -Signed-off-by: Mike Pagano <mpagano@g.o>
44 ----
45 - net/ipv4/ip_forward.c | 3 +++
46 - 1 file changed, 3 insertions(+)
47 -
48 -diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
49 -index d9bc28a..53bd53f 100644
50 ---- a/net/ipv4/ip_forward.c
51 -+++ b/net/ipv4/ip_forward.c
52 -@@ -82,6 +82,9 @@ int ip_forward(struct sk_buff *skb)
53 - if (skb->pkt_type != PACKET_HOST)
54 - goto drop;
55 +diff --git a/Documentation/networking/scaling.txt b/Documentation/networking/scaling.txt
56 +index 99ca40e..5c204df 100644
57 +--- a/Documentation/networking/scaling.txt
58 ++++ b/Documentation/networking/scaling.txt
59 +@@ -282,7 +282,7 @@ following is true:
60
61 -+ if (unlikely(skb->sk))
62 -+ goto drop;
63 -+
64 - if (skb_warn_if_lro(skb))
65 - goto drop;
66 + - The current CPU's queue head counter >= the recorded tail counter
67 + value in rps_dev_flow[i]
68 +-- The current CPU is unset (equal to RPS_NO_CPU)
69 ++- The current CPU is unset (>= nr_cpu_ids)
70 + - The current CPU is offline
71
72 ---
73 -2.3.6
74 -
75 -
76 -From 8a6846e3226bb475db9686590da85bcc609c75a9 Mon Sep 17 00:00:00 2001
77 -From: Tom Herbert <tom@×××××××××××.com>
78 -Date: Mon, 20 Apr 2015 14:10:04 -0700
79 -Subject: [PATCH 002/219] net: add skb_checksum_complete_unset
80 -Cc: mpagano@g.o
81 -
82 -[ Upstream commit 4e18b9adf2f910ec4d30b811a74a5b626e6c6125 ]
83 -
84 -This function changes ip_summed to CHECKSUM_NONE if CHECKSUM_COMPLETE
85 -is set. This is called to discard checksum-complete when packet
86 -is being modified and checksum is not pulled for headers in a layer.
87 -
88 -Signed-off-by: Tom Herbert <tom@×××××××××××.com>
89 -Signed-off-by: David S. Miller <davem@×××××××××.net>
90 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
91 -Signed-off-by: Mike Pagano <mpagano@g.o>
92 ----
93 - include/linux/skbuff.h | 12 ++++++++++++
94 - 1 file changed, 12 insertions(+)
95 -
96 -diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
97 -index f54d665..b5c204c 100644
98 ---- a/include/linux/skbuff.h
99 -+++ b/include/linux/skbuff.h
100 -@@ -3013,6 +3013,18 @@ static inline bool __skb_checksum_validate_needed(struct sk_buff *skb,
101 - */
102 - #define CHECKSUM_BREAK 76
103 + After this check, the packet is sent to the (possibly updated) current
104 +diff --git a/Documentation/virtual/kvm/devices/s390_flic.txt b/Documentation/virtual/kvm/devices/s390_flic.txt
105 +index 4ceef53..d1ad9d5 100644
106 +--- a/Documentation/virtual/kvm/devices/s390_flic.txt
107 ++++ b/Documentation/virtual/kvm/devices/s390_flic.txt
108 +@@ -27,6 +27,9 @@ Groups:
109 + Copies all floating interrupts into a buffer provided by userspace.
110 + When the buffer is too small it returns -ENOMEM, which is the indication
111 + for userspace to try again with a bigger buffer.
112 ++ -ENOBUFS is returned when the allocation of a kernelspace buffer has
113 ++ failed.
114 ++ -EFAULT is returned when copying data to userspace failed.
115 + All interrupts remain pending, i.e. are not deleted from the list of
116 + currently pending interrupts.
117 + attr->addr contains the userspace address of the buffer into which all
118 +diff --git a/Makefile b/Makefile
119 +index f499cd2..0649a60 100644
120 +--- a/Makefile
121 ++++ b/Makefile
122 +@@ -1,6 +1,6 @@
123 + VERSION = 4
124 + PATCHLEVEL = 0
125 +-SUBLEVEL = 1
126 ++SUBLEVEL = 2
127 + EXTRAVERSION =
128 + NAME = Hurr durr I'ma sheep
129
130 -+/* Unset checksum-complete
131 -+ *
132 -+ * Unset checksum complete can be done when packet is being modified
133 -+ * (uncompressed for instance) and checksum-complete value is
134 -+ * invalidated.
135 -+ */
136 -+static inline void skb_checksum_complete_unset(struct sk_buff *skb)
137 -+{
138 -+ if (skb->ip_summed == CHECKSUM_COMPLETE)
139 -+ skb->ip_summed = CHECKSUM_NONE;
140 -+}
141 -+
142 - /* Validate (init) checksum based on checksum complete.
143 - *
144 - * Return values:
145 ---
146 -2.3.6
147 -
148 -
149 -From 5a248fca60021d0e35a9de9bd0620eff840365ca Mon Sep 17 00:00:00 2001
150 -From: Tom Herbert <tom@×××××××××××.com>
151 -Date: Mon, 20 Apr 2015 14:10:05 -0700
152 -Subject: [PATCH 003/219] ppp: call skb_checksum_complete_unset in
153 - ppp_receive_frame
154 -Cc: mpagano@g.o
155 -
156 -[ Upstream commit 3dfb05340ec6676e6fc71a9ae87bbbe66d3c2998 ]
157 -
158 -Call checksum_complete_unset in PPP receive to discard checksum-complete
159 -value. PPP does not pull checksum for headers and also modifies packet
160 -as in VJ compression.
161 -
162 -Signed-off-by: Tom Herbert <tom@×××××××××××.com>
163 -Signed-off-by: David S. Miller <davem@×××××××××.net>
164 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
165 -Signed-off-by: Mike Pagano <mpagano@g.o>
166 ----
167 - drivers/net/ppp/ppp_generic.c | 1 +
168 - 1 file changed, 1 insertion(+)
169 -
170 -diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
171 -index af034db..9d15566 100644
172 ---- a/drivers/net/ppp/ppp_generic.c
173 -+++ b/drivers/net/ppp/ppp_generic.c
174 -@@ -1716,6 +1716,7 @@ ppp_receive_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
175 - {
176 - /* note: a 0-length skb is used as an error indication */
177 - if (skb->len > 0) {
178 -+ skb_checksum_complete_unset(skb);
179 - #ifdef CONFIG_PPP_MULTILINK
180 - /* XXX do channel-level decompression here */
181 - if (PPP_PROTO(skb) == PPP_MP)
182 ---
183 -2.3.6
184 -
185 -
186 -From e1b095eb7de9dc2235c86e15be6b9d0bff56a6ab Mon Sep 17 00:00:00 2001
187 -From: Eric Dumazet <edumazet@××××××.com>
188 -Date: Tue, 21 Apr 2015 18:32:24 -0700
189 -Subject: [PATCH 004/219] tcp: fix possible deadlock in tcp_send_fin()
190 -Cc: mpagano@g.o
191 -
192 -[ Upstream commit d83769a580f1132ac26439f50068a29b02be535e ]
193 -
194 -Using sk_stream_alloc_skb() in tcp_send_fin() is dangerous in
195 -case a huge process is killed by OOM, and tcp_mem[2] is hit.
196 -
197 -To be able to free memory we need to make progress, so this
198 -patch allows FIN packets to not care about tcp_mem[2], if
199 -skb allocation succeeded.
200 -
201 -In a follow-up patch, we might abort tcp_send_fin() infinite loop
202 -in case TIF_MEMDIE is set on this thread, as memory allocator
203 -did its best getting extra memory already.
204 -
205 -This patch reverts d22e15371811 ("tcp: fix tcp fin memory accounting")
206 -
207 -Fixes: d22e15371811 ("tcp: fix tcp fin memory accounting")
208 -Signed-off-by: Eric Dumazet <edumazet@××××××.com>
209 -Signed-off-by: David S. Miller <davem@×××××××××.net>
210 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
211 -Signed-off-by: Mike Pagano <mpagano@g.o>
212 ----
213 - net/ipv4/tcp_output.c | 20 +++++++++++++++++++-
214 - 1 file changed, 19 insertions(+), 1 deletion(-)
215 -
216 -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
217 -index d520492..f911dc2 100644
218 ---- a/net/ipv4/tcp_output.c
219 -+++ b/net/ipv4/tcp_output.c
220 -@@ -2751,6 +2751,21 @@ begin_fwd:
221 - }
222 - }
223 +diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
224 +index fec1fca..6c4bc53 100644
225 +--- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts
226 ++++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
227 +@@ -167,7 +167,13 @@
228
229 -+/* We allow to exceed memory limits for FIN packets to expedite
230 -+ * connection tear down and (memory) recovery.
231 -+ * Otherwise tcp_send_fin() could loop forever.
232 -+ */
233 -+static void sk_forced_wmem_schedule(struct sock *sk, int size)
234 -+{
235 -+ int amt, status;
236 -+
237 -+ if (size <= sk->sk_forward_alloc)
238 -+ return;
239 -+ amt = sk_mem_pages(size);
240 -+ sk->sk_forward_alloc += amt * SK_MEM_QUANTUM;
241 -+ sk_memory_allocated_add(sk, amt, &status);
242 -+}
243 + macb1: ethernet@f802c000 {
244 + phy-mode = "rmii";
245 ++ #address-cells = <1>;
246 ++ #size-cells = <0>;
247 + status = "okay";
248 +
249 - /* Send a fin. The caller locks the socket for us. This cannot be
250 - * allowed to fail queueing a FIN frame under any circumstances.
251 - */
252 -@@ -2773,11 +2788,14 @@ void tcp_send_fin(struct sock *sk)
253 - } else {
254 - /* Socket is locked, keep trying until memory is available. */
255 - for (;;) {
256 -- skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation);
257 -+ skb = alloc_skb_fclone(MAX_TCP_HEADER,
258 -+ sk->sk_allocation);
259 - if (skb)
260 - break;
261 - yield();
262 - }
263 -+ skb_reserve(skb, MAX_TCP_HEADER);
264 -+ sk_forced_wmem_schedule(sk, skb->truesize);
265 - /* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */
266 - tcp_init_nondata_skb(skb, tp->write_seq,
267 - TCPHDR_ACK | TCPHDR_FIN);
268 ---
269 -2.3.6
270 -
271 -
272 -From 7e72469760dd73a44e8cfd6105bf695b7572e246 Mon Sep 17 00:00:00 2001
273 -From: Eric Dumazet <edumazet@××××××.com>
274 -Date: Thu, 23 Apr 2015 10:42:39 -0700
275 -Subject: [PATCH 005/219] tcp: avoid looping in tcp_send_fin()
276 -Cc: mpagano@g.o
277 -
278 -[ Upstream commit 845704a535e9b3c76448f52af1b70e4422ea03fd ]
279 -
280 -Presence of an unbound loop in tcp_send_fin() had always been hard
281 -to explain when analyzing crash dumps involving gigantic dying processes
282 -with millions of sockets.
283 -
284 -Lets try a different strategy :
285 -
286 -In case of memory pressure, try to add the FIN flag to last packet
287 -in write queue, even if packet was already sent. TCP stack will
288 -be able to deliver this FIN after a timeout event. Note that this
289 -FIN being delivered by a retransmit, it also carries a Push flag
290 -given our current implementation.
291 -
292 -By checking sk_under_memory_pressure(), we anticipate that cooking
293 -many FIN packets might deplete tcp memory.
294 -
295 -In the case we could not allocate a packet, even with __GFP_WAIT
296 -allocation, then not sending a FIN seems quite reasonable if it allows
297 -to get rid of this socket, free memory, and not block the process from
298 -eventually doing other useful work.
299 -
300 -Signed-off-by: Eric Dumazet <edumazet@××××××.com>
301 -Signed-off-by: David S. Miller <davem@×××××××××.net>
302 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
303 -Signed-off-by: Mike Pagano <mpagano@g.o>
304 ----
305 - net/ipv4/tcp_output.c | 50 +++++++++++++++++++++++++++++---------------------
306 - 1 file changed, 29 insertions(+), 21 deletions(-)
307 -
308 -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
309 -index f911dc2..9d48dc4 100644
310 ---- a/net/ipv4/tcp_output.c
311 -+++ b/net/ipv4/tcp_output.c
312 -@@ -2753,7 +2753,8 @@ begin_fwd:
313 ++ ethernet-phy@1 {
314 ++ reg = <0x1>;
315 ++ };
316 + };
317
318 - /* We allow to exceed memory limits for FIN packets to expedite
319 - * connection tear down and (memory) recovery.
320 -- * Otherwise tcp_send_fin() could loop forever.
321 -+ * Otherwise tcp_send_fin() could be tempted to either delay FIN
322 -+ * or even be forced to close flow without any FIN.
323 - */
324 - static void sk_forced_wmem_schedule(struct sock *sk, int size)
325 - {
326 -@@ -2766,33 +2767,40 @@ static void sk_forced_wmem_schedule(struct sock *sk, int size)
327 - sk_memory_allocated_add(sk, amt, &status);
328 - }
329 + dbgu: serial@ffffee00 {
330 +diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
331 +index a5441d5..3cc8b83 100644
332 +--- a/arch/arm/boot/dts/dove.dtsi
333 ++++ b/arch/arm/boot/dts/dove.dtsi
334 +@@ -154,7 +154,7 @@
335
336 --/* Send a fin. The caller locks the socket for us. This cannot be
337 -- * allowed to fail queueing a FIN frame under any circumstances.
338 -+/* Send a FIN. The caller locks the socket for us.
339 -+ * We should try to send a FIN packet really hard, but eventually give up.
340 - */
341 - void tcp_send_fin(struct sock *sk)
342 - {
343 -+ struct sk_buff *skb, *tskb = tcp_write_queue_tail(sk);
344 - struct tcp_sock *tp = tcp_sk(sk);
345 -- struct sk_buff *skb = tcp_write_queue_tail(sk);
346 -- int mss_now;
347 + uart2: serial@12200 {
348 + compatible = "ns16550a";
349 +- reg = <0x12000 0x100>;
350 ++ reg = <0x12200 0x100>;
351 + reg-shift = <2>;
352 + interrupts = <9>;
353 + clocks = <&core_clk 0>;
354 +@@ -163,7 +163,7 @@
355
356 -- /* Optimization, tack on the FIN if we have a queue of
357 -- * unsent frames. But be careful about outgoing SACKS
358 -- * and IP options.
359 -+ /* Optimization, tack on the FIN if we have one skb in write queue and
360 -+ * this skb was not yet sent, or we are under memory pressure.
361 -+ * Note: in the latter case, FIN packet will be sent after a timeout,
362 -+ * as TCP stack thinks it has already been transmitted.
363 - */
364 -- mss_now = tcp_current_mss(sk);
365 + uart3: serial@12300 {
366 + compatible = "ns16550a";
367 +- reg = <0x12100 0x100>;
368 ++ reg = <0x12300 0x100>;
369 + reg-shift = <2>;
370 + interrupts = <10>;
371 + clocks = <&core_clk 0>;
372 +diff --git a/arch/arm/boot/dts/exynos5250-spring.dts b/arch/arm/boot/dts/exynos5250-spring.dts
373 +index f027754..c41600e 100644
374 +--- a/arch/arm/boot/dts/exynos5250-spring.dts
375 ++++ b/arch/arm/boot/dts/exynos5250-spring.dts
376 +@@ -429,7 +429,6 @@
377 + &mmc_0 {
378 + status = "okay";
379 + num-slots = <1>;
380 +- supports-highspeed;
381 + broken-cd;
382 + card-detect-delay = <200>;
383 + samsung,dw-mshc-ciu-div = <3>;
384 +@@ -437,11 +436,8 @@
385 + samsung,dw-mshc-ddr-timing = <1 2>;
386 + pinctrl-names = "default";
387 + pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_cd &sd0_bus4 &sd0_bus8>;
388 -
389 -- if (tcp_send_head(sk) != NULL) {
390 -- TCP_SKB_CB(skb)->tcp_flags |= TCPHDR_FIN;
391 -- TCP_SKB_CB(skb)->end_seq++;
392 -+ if (tskb && (tcp_send_head(sk) || sk_under_memory_pressure(sk))) {
393 -+coalesce:
394 -+ TCP_SKB_CB(tskb)->tcp_flags |= TCPHDR_FIN;
395 -+ TCP_SKB_CB(tskb)->end_seq++;
396 - tp->write_seq++;
397 -+ if (!tcp_send_head(sk)) {
398 -+ /* This means tskb was already sent.
399 -+ * Pretend we included the FIN on previous transmit.
400 -+ * We need to set tp->snd_nxt to the value it would have
401 -+ * if FIN had been sent. This is because retransmit path
402 -+ * does not change tp->snd_nxt.
403 -+ */
404 -+ tp->snd_nxt++;
405 -+ return;
406 -+ }
407 - } else {
408 -- /* Socket is locked, keep trying until memory is available. */
409 -- for (;;) {
410 -- skb = alloc_skb_fclone(MAX_TCP_HEADER,
411 -- sk->sk_allocation);
412 -- if (skb)
413 -- break;
414 -- yield();
415 -+ skb = alloc_skb_fclone(MAX_TCP_HEADER, sk->sk_allocation);
416 -+ if (unlikely(!skb)) {
417 -+ if (tskb)
418 -+ goto coalesce;
419 -+ return;
420 - }
421 - skb_reserve(skb, MAX_TCP_HEADER);
422 - sk_forced_wmem_schedule(sk, skb->truesize);
423 -@@ -2801,7 +2809,7 @@ void tcp_send_fin(struct sock *sk)
424 - TCPHDR_ACK | TCPHDR_FIN);
425 - tcp_queue_skb(sk, skb);
426 - }
427 -- __tcp_push_pending_frames(sk, mss_now, TCP_NAGLE_OFF);
428 -+ __tcp_push_pending_frames(sk, tcp_current_mss(sk), TCP_NAGLE_OFF);
429 - }
430 +- slot@0 {
431 +- reg = <0>;
432 +- bus-width = <8>;
433 +- };
434 ++ bus-width = <8>;
435 ++ cap-mmc-highspeed;
436 + };
437
438 - /* We get here when a process closes a file descriptor (either due to
439 ---
440 -2.3.6
441 -
442 -
443 -From e591662c1a5fb0e9ee486bf8edbed14d0507cfb4 Mon Sep 17 00:00:00 2001
444 -From: Eric Dumazet <edumazet@××××××.com>
445 -Date: Wed, 22 Apr 2015 07:33:36 -0700
446 -Subject: [PATCH 006/219] net: do not deplete pfmemalloc reserve
447 -Cc: mpagano@g.o
448 -
449 -[ Upstream commit 79930f5892e134c6da1254389577fffb8bd72c66 ]
450 -
451 -build_skb() should look at the page pfmemalloc status.
452 -If set, this means page allocator allocated this page in the
453 -expectation it would help to free other pages. Networking
454 -stack can do that only if skb->pfmemalloc is also set.
455 -
456 -Also, we must refrain using high order pages from the pfmemalloc
457 -reserve, so __page_frag_refill() must also use __GFP_NOMEMALLOC for
458 -them. Under memory pressure, using order-0 pages is probably the best
459 -strategy.
460 -
461 -Signed-off-by: Eric Dumazet <edumazet@××××××.com>
462 -Signed-off-by: David S. Miller <davem@×××××××××.net>
463 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
464 -Signed-off-by: Mike Pagano <mpagano@g.o>
465 ----
466 - net/core/skbuff.c | 9 +++++++--
467 - 1 file changed, 7 insertions(+), 2 deletions(-)
468 -
469 -diff --git a/net/core/skbuff.c b/net/core/skbuff.c
470 -index 98d45fe..5ec3742 100644
471 ---- a/net/core/skbuff.c
472 -+++ b/net/core/skbuff.c
473 -@@ -311,7 +311,11 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
474 + /*
475 +@@ -451,7 +447,6 @@
476 + &mmc_1 {
477 + status = "okay";
478 + num-slots = <1>;
479 +- supports-highspeed;
480 + broken-cd;
481 + card-detect-delay = <200>;
482 + samsung,dw-mshc-ciu-div = <3>;
483 +@@ -459,11 +454,8 @@
484 + samsung,dw-mshc-ddr-timing = <1 2>;
485 + pinctrl-names = "default";
486 + pinctrl-0 = <&sd1_clk &sd1_cmd &sd1_cd &sd1_bus4>;
487 +-
488 +- slot@0 {
489 +- reg = <0>;
490 +- bus-width = <4>;
491 +- };
492 ++ bus-width = <4>;
493 ++ cap-sd-highspeed;
494 + };
495
496 - memset(skb, 0, offsetof(struct sk_buff, tail));
497 - skb->truesize = SKB_TRUESIZE(size);
498 -- skb->head_frag = frag_size != 0;
499 -+ if (frag_size) {
500 -+ skb->head_frag = 1;
501 -+ if (virt_to_head_page(data)->pfmemalloc)
502 -+ skb->pfmemalloc = 1;
503 -+ }
504 - atomic_set(&skb->users, 1);
505 - skb->head = data;
506 - skb->data = data;
507 -@@ -348,7 +352,8 @@ static struct page *__page_frag_refill(struct netdev_alloc_cache *nc,
508 - gfp_t gfp = gfp_mask;
509 + &pinctrl_0 {
510 +diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
511 +index afb9caf..674d03f 100644
512 +--- a/arch/arm/include/asm/elf.h
513 ++++ b/arch/arm/include/asm/elf.h
514 +@@ -115,7 +115,7 @@ int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs);
515 + the loader. We need to make sure that it is out of the way of the program
516 + that it will "exec", and that there is sufficient room for the brk. */
517
518 - if (order) {
519 -- gfp_mask |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY;
520 -+ gfp_mask |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY |
521 -+ __GFP_NOMEMALLOC;
522 - page = alloc_pages_node(NUMA_NO_NODE, gfp_mask, order);
523 - nc->frag.size = PAGE_SIZE << (page ? order : 0);
524 - }
525 ---
526 -2.3.6
527 -
528 -
529 -From f009181dcccd55398f872d090fa2e1780b4ca270 Mon Sep 17 00:00:00 2001
530 -From: Eric Dumazet <edumazet@××××××.com>
531 -Date: Fri, 24 Apr 2015 16:05:01 -0700
532 -Subject: [PATCH 007/219] net: fix crash in build_skb()
533 -Cc: mpagano@g.o
534 -
535 -[ Upstream commit 2ea2f62c8bda242433809c7f4e9eae1c52c40bbe ]
536 -
537 -When I added pfmemalloc support in build_skb(), I forgot netlink
538 -was using build_skb() with a vmalloc() area.
539 -
540 -In this patch I introduce __build_skb() for netlink use,
541 -and build_skb() is a wrapper handling both skb->head_frag and
542 -skb->pfmemalloc
543 -
544 -This means netlink no longer has to hack skb->head_frag
545 -
546 -[ 1567.700067] kernel BUG at arch/x86/mm/physaddr.c:26!
547 -[ 1567.700067] invalid opcode: 0000 [#1] PREEMPT SMP KASAN
548 -[ 1567.700067] Dumping ftrace buffer:
549 -[ 1567.700067] (ftrace buffer empty)
550 -[ 1567.700067] Modules linked in:
551 -[ 1567.700067] CPU: 9 PID: 16186 Comm: trinity-c182 Not tainted 4.0.0-next-20150424-sasha-00037-g4796e21 #2167
552 -[ 1567.700067] task: ffff880127efb000 ti: ffff880246770000 task.ti: ffff880246770000
553 -[ 1567.700067] RIP: __phys_addr (arch/x86/mm/physaddr.c:26 (discriminator 3))
554 -[ 1567.700067] RSP: 0018:ffff8802467779d8 EFLAGS: 00010202
555 -[ 1567.700067] RAX: 000041000ed8e000 RBX: ffffc9008ed8e000 RCX: 000000000000002c
556 -[ 1567.700067] RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffffffffb3fd6049
557 -[ 1567.700067] RBP: ffff8802467779f8 R08: 0000000000000019 R09: ffff8801d0168000
558 -[ 1567.700067] R10: ffff8801d01680c7 R11: ffffed003a02d019 R12: ffffc9000ed8e000
559 -[ 1567.700067] R13: 0000000000000f40 R14: 0000000000001180 R15: ffffc9000ed8e000
560 -[ 1567.700067] FS: 00007f2a7da3f700(0000) GS:ffff8801d1000000(0000) knlGS:0000000000000000
561 -[ 1567.700067] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
562 -[ 1567.700067] CR2: 0000000000738308 CR3: 000000022e329000 CR4: 00000000000007e0
563 -[ 1567.700067] Stack:
564 -[ 1567.700067] ffffc9000ed8e000 ffff8801d0168000 ffffc9000ed8e000 ffff8801d0168000
565 -[ 1567.700067] ffff880246777a28 ffffffffad7c0a21 0000000000001080 ffff880246777c08
566 -[ 1567.700067] ffff88060d302e68 ffff880246777b58 ffff880246777b88 ffffffffad9a6821
567 -[ 1567.700067] Call Trace:
568 -[ 1567.700067] build_skb (include/linux/mm.h:508 net/core/skbuff.c:316)
569 -[ 1567.700067] netlink_sendmsg (net/netlink/af_netlink.c:1633 net/netlink/af_netlink.c:2329)
570 -[ 1567.774369] ? sched_clock_cpu (kernel/sched/clock.c:311)
571 -[ 1567.774369] ? netlink_unicast (net/netlink/af_netlink.c:2273)
572 -[ 1567.774369] ? netlink_unicast (net/netlink/af_netlink.c:2273)
573 -[ 1567.774369] sock_sendmsg (net/socket.c:614 net/socket.c:623)
574 -[ 1567.774369] sock_write_iter (net/socket.c:823)
575 -[ 1567.774369] ? sock_sendmsg (net/socket.c:806)
576 -[ 1567.774369] __vfs_write (fs/read_write.c:479 fs/read_write.c:491)
577 -[ 1567.774369] ? get_lock_stats (kernel/locking/lockdep.c:249)
578 -[ 1567.774369] ? default_llseek (fs/read_write.c:487)
579 -[ 1567.774369] ? vtime_account_user (kernel/sched/cputime.c:701)
580 -[ 1567.774369] ? rw_verify_area (fs/read_write.c:406 (discriminator 4))
581 -[ 1567.774369] vfs_write (fs/read_write.c:539)
582 -[ 1567.774369] SyS_write (fs/read_write.c:586 fs/read_write.c:577)
583 -[ 1567.774369] ? SyS_read (fs/read_write.c:577)
584 -[ 1567.774369] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
585 -[ 1567.774369] ? trace_hardirqs_on_caller (kernel/locking/lockdep.c:2594 kernel/locking/lockdep.c:2636)
586 -[ 1567.774369] ? trace_hardirqs_on_thunk (arch/x86/lib/thunk_64.S:42)
587 -[ 1567.774369] system_call_fastpath (arch/x86/kernel/entry_64.S:261)
588 -
589 -Fixes: 79930f5892e ("net: do not deplete pfmemalloc reserve")
590 -Signed-off-by: Eric Dumazet <edumazet@××××××.com>
591 -Reported-by: Sasha Levin <sasha.levin@××××××.com>
592 -Signed-off-by: David S. Miller <davem@×××××××××.net>
593 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
594 -Signed-off-by: Mike Pagano <mpagano@g.o>
595 ----
596 - include/linux/skbuff.h | 1 +
597 - net/core/skbuff.c | 31 ++++++++++++++++++++++---------
598 - net/netlink/af_netlink.c | 6 ++----
599 - 3 files changed, 25 insertions(+), 13 deletions(-)
600 -
601 -diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
602 -index b5c204c..bdccc4b 100644
603 ---- a/include/linux/skbuff.h
604 -+++ b/include/linux/skbuff.h
605 -@@ -769,6 +769,7 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from,
606 +-#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
607 ++#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
608
609 - struct sk_buff *__alloc_skb(unsigned int size, gfp_t priority, int flags,
610 - int node);
611 -+struct sk_buff *__build_skb(void *data, unsigned int frag_size);
612 - struct sk_buff *build_skb(void *data, unsigned int frag_size);
613 - static inline struct sk_buff *alloc_skb(unsigned int size,
614 - gfp_t priority)
615 -diff --git a/net/core/skbuff.c b/net/core/skbuff.c
616 -index 5ec3742..e9f9a15 100644
617 ---- a/net/core/skbuff.c
618 -+++ b/net/core/skbuff.c
619 -@@ -280,13 +280,14 @@ nodata:
620 - EXPORT_SYMBOL(__alloc_skb);
621 + /* When the program starts, a1 contains a pointer to a function to be
622 + registered with atexit, as per the SVR4 ABI. A value of 0 means we
623 +diff --git a/arch/arm/include/uapi/asm/kvm.h b/arch/arm/include/uapi/asm/kvm.h
624 +index 0db25bc..3a42ac6 100644
625 +--- a/arch/arm/include/uapi/asm/kvm.h
626 ++++ b/arch/arm/include/uapi/asm/kvm.h
627 +@@ -195,8 +195,14 @@ struct kvm_arch_memory_slot {
628 + #define KVM_ARM_IRQ_CPU_IRQ 0
629 + #define KVM_ARM_IRQ_CPU_FIQ 1
630
631 - /**
632 -- * build_skb - build a network buffer
633 -+ * __build_skb - build a network buffer
634 - * @data: data buffer provided by caller
635 -- * @frag_size: size of fragment, or 0 if head was kmalloced
636 -+ * @frag_size: size of data, or 0 if head was kmalloced
637 - *
638 - * Allocate a new &sk_buff. Caller provides space holding head and
639 - * skb_shared_info. @data must have been allocated by kmalloc() only if
640 -- * @frag_size is 0, otherwise data should come from the page allocator.
641 -+ * @frag_size is 0, otherwise data should come from the page allocator
642 -+ * or vmalloc()
643 - * The return is the new skb buffer.
644 - * On a failure the return is %NULL, and @data is not freed.
645 - * Notes :
646 -@@ -297,7 +298,7 @@ EXPORT_SYMBOL(__alloc_skb);
647 - * before giving packet to stack.
648 - * RX rings only contains data buffers, not full skbs.
649 - */
650 --struct sk_buff *build_skb(void *data, unsigned int frag_size)
651 -+struct sk_buff *__build_skb(void *data, unsigned int frag_size)
652 - {
653 - struct skb_shared_info *shinfo;
654 - struct sk_buff *skb;
655 -@@ -311,11 +312,6 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
656 +-/* Highest supported SPI, from VGIC_NR_IRQS */
657 ++/*
658 ++ * This used to hold the highest supported SPI, but it is now obsolete
659 ++ * and only here to provide source code level compatibility with older
660 ++ * userland. The highest SPI number can be set via KVM_DEV_ARM_VGIC_GRP_NR_IRQS.
661 ++ */
662 ++#ifndef __KERNEL__
663 + #define KVM_ARM_IRQ_GIC_MAX 127
664 ++#endif
665
666 - memset(skb, 0, offsetof(struct sk_buff, tail));
667 - skb->truesize = SKB_TRUESIZE(size);
668 -- if (frag_size) {
669 -- skb->head_frag = 1;
670 -- if (virt_to_head_page(data)->pfmemalloc)
671 -- skb->pfmemalloc = 1;
672 -- }
673 - atomic_set(&skb->users, 1);
674 - skb->head = data;
675 - skb->data = data;
676 -@@ -332,6 +328,23 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
677 + /* PSCI interface */
678 + #define KVM_PSCI_FN_BASE 0x95c1ba5e
679 +diff --git a/arch/arm/kernel/hibernate.c b/arch/arm/kernel/hibernate.c
680 +index c4cc50e..cfb354f 100644
681 +--- a/arch/arm/kernel/hibernate.c
682 ++++ b/arch/arm/kernel/hibernate.c
683 +@@ -22,6 +22,7 @@
684 + #include <asm/suspend.h>
685 + #include <asm/memory.h>
686 + #include <asm/sections.h>
687 ++#include "reboot.h"
688
689 - return skb;
690 - }
691 -+
692 -+/* build_skb() is wrapper over __build_skb(), that specifically
693 -+ * takes care of skb->head and skb->pfmemalloc
694 -+ * This means that if @frag_size is not zero, then @data must be backed
695 -+ * by a page fragment, not kmalloc() or vmalloc()
696 -+ */
697 -+struct sk_buff *build_skb(void *data, unsigned int frag_size)
698 -+{
699 -+ struct sk_buff *skb = __build_skb(data, frag_size);
700 -+
701 -+ if (skb && frag_size) {
702 -+ skb->head_frag = 1;
703 -+ if (virt_to_head_page(data)->pfmemalloc)
704 -+ skb->pfmemalloc = 1;
705 -+ }
706 -+ return skb;
707 -+}
708 - EXPORT_SYMBOL(build_skb);
709 + int pfn_is_nosave(unsigned long pfn)
710 + {
711 +@@ -61,7 +62,7 @@ static int notrace arch_save_image(unsigned long unused)
712
713 - struct netdev_alloc_cache {
714 -diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
715 -index 05919bf..d1d7a81 100644
716 ---- a/net/netlink/af_netlink.c
717 -+++ b/net/netlink/af_netlink.c
718 -@@ -1616,13 +1616,11 @@ static struct sk_buff *netlink_alloc_large_skb(unsigned int size,
719 - if (data == NULL)
720 - return NULL;
721 + ret = swsusp_save();
722 + if (ret == 0)
723 +- soft_restart(virt_to_phys(cpu_resume));
724 ++ _soft_restart(virt_to_phys(cpu_resume), false);
725 + return ret;
726 + }
727
728 -- skb = build_skb(data, size);
729 -+ skb = __build_skb(data, size);
730 - if (skb == NULL)
731 - vfree(data);
732 -- else {
733 -- skb->head_frag = 0;
734 -+ else
735 - skb->destructor = netlink_skb_destructor;
736 -- }
737 +@@ -86,7 +87,7 @@ static void notrace arch_restore_image(void *unused)
738 + for (pbe = restore_pblist; pbe; pbe = pbe->next)
739 + copy_page(pbe->orig_address, pbe->address);
740
741 - return skb;
742 +- soft_restart(virt_to_phys(cpu_resume));
743 ++ _soft_restart(virt_to_phys(cpu_resume), false);
744 }
745 ---
746 -2.3.6
747 -
748 -
749 -From f80e3eb94b7d4b5b9ebf999da1f50cd5b263a23d Mon Sep 17 00:00:00 2001
750 -From: Alexey Khoroshilov <khoroshilov@××××××.ru>
751 -Date: Sat, 25 Apr 2015 04:07:03 +0300
752 -Subject: [PATCH 008/219] pxa168: fix double deallocation of managed resources
753 -Cc: mpagano@g.o
754 -
755 -[ Upstream commit 0e03fd3e335d272bee88fe733d5fd13f5c5b7140 ]
756 -
757 -Commit 43d3ddf87a57 ("net: pxa168_eth: add device tree support") starts
758 -to use managed resources by adding devm_clk_get() and
759 -devm_ioremap_resource(), but it leaves explicit iounmap() and clock_put()
760 -in pxa168_eth_remove() and in failure handling code of pxa168_eth_probe().
761 -As a result double free can happen.
762 -
763 -The patch removes explicit resource deallocation. Also it converts
764 -clk_disable() to clk_disable_unprepare() to make it symmetrical with
765 -clk_prepare_enable().
766 -
767 -Found by Linux Driver Verification project (linuxtesting.org).
768 -
769 -Signed-off-by: Alexey Khoroshilov <khoroshilov@××××××.ru>
770 -Signed-off-by: David S. Miller <davem@×××××××××.net>
771 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
772 -Signed-off-by: Mike Pagano <mpagano@g.o>
773 ----
774 - drivers/net/ethernet/marvell/pxa168_eth.c | 16 +++++-----------
775 - 1 file changed, 5 insertions(+), 11 deletions(-)
776 -
777 -diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
778 -index af829c5..7ace07d 100644
779 ---- a/drivers/net/ethernet/marvell/pxa168_eth.c
780 -+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
781 -@@ -1508,7 +1508,8 @@ static int pxa168_eth_probe(struct platform_device *pdev)
782 - np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0);
783 - if (!np) {
784 - dev_err(&pdev->dev, "missing phy-handle\n");
785 -- return -EINVAL;
786 -+ err = -EINVAL;
787 -+ goto err_netdev;
788 - }
789 - of_property_read_u32(np, "reg", &pep->phy_addr);
790 - pep->phy_intf = of_get_phy_mode(pdev->dev.of_node);
791 -@@ -1526,7 +1527,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
792 - pep->smi_bus = mdiobus_alloc();
793 - if (pep->smi_bus == NULL) {
794 - err = -ENOMEM;
795 -- goto err_base;
796 -+ goto err_netdev;
797 - }
798 - pep->smi_bus->priv = pep;
799 - pep->smi_bus->name = "pxa168_eth smi";
800 -@@ -1551,13 +1552,10 @@ err_mdiobus:
801 - mdiobus_unregister(pep->smi_bus);
802 - err_free_mdio:
803 - mdiobus_free(pep->smi_bus);
804 --err_base:
805 -- iounmap(pep->base);
806 - err_netdev:
807 - free_netdev(dev);
808 - err_clk:
809 -- clk_disable(clk);
810 -- clk_put(clk);
811 -+ clk_disable_unprepare(clk);
812 - return err;
813 +
814 + static u64 resume_stack[PAGE_SIZE/2/sizeof(u64)] __nosavedata;
815 +diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
816 +index fdfa3a7..2bf1a16 100644
817 +--- a/arch/arm/kernel/process.c
818 ++++ b/arch/arm/kernel/process.c
819 +@@ -41,6 +41,7 @@
820 + #include <asm/system_misc.h>
821 + #include <asm/mach/time.h>
822 + #include <asm/tls.h>
823 ++#include "reboot.h"
824 +
825 + #ifdef CONFIG_CC_STACKPROTECTOR
826 + #include <linux/stackprotector.h>
827 +@@ -95,7 +96,7 @@ static void __soft_restart(void *addr)
828 + BUG();
829 }
830
831 -@@ -1574,13 +1572,9 @@ static int pxa168_eth_remove(struct platform_device *pdev)
832 - if (pep->phy)
833 - phy_disconnect(pep->phy);
834 - if (pep->clk) {
835 -- clk_disable(pep->clk);
836 -- clk_put(pep->clk);
837 -- pep->clk = NULL;
838 -+ clk_disable_unprepare(pep->clk);
839 - }
840 +-void soft_restart(unsigned long addr)
841 ++void _soft_restart(unsigned long addr, bool disable_l2)
842 + {
843 + u64 *stack = soft_restart_stack + ARRAY_SIZE(soft_restart_stack);
844
845 -- iounmap(pep->base);
846 -- pep->base = NULL;
847 - mdiobus_unregister(pep->smi_bus);
848 - mdiobus_free(pep->smi_bus);
849 - unregister_netdev(dev);
850 ---
851 -2.3.6
852 -
853 -
854 -From b32dec8a9f5834b14daaa75bd3e49f3b54272d65 Mon Sep 17 00:00:00 2001
855 -From: Eric Dumazet <edumazet@××××××.com>
856 -Date: Sat, 25 Apr 2015 09:35:24 -0700
857 -Subject: [PATCH 009/219] net: rfs: fix crash in get_rps_cpus()
858 -Cc: mpagano@g.o
859 -
860 -[ Upstream commit a31196b07f8034eba6a3487a1ad1bb5ec5cd58a5 ]
861 -
862 -Commit 567e4b79731c ("net: rfs: add hash collision detection") had one
863 -mistake :
864 -
865 -RPS_NO_CPU is no longer the marker for invalid cpu in set_rps_cpu()
866 -and get_rps_cpu(), as @next_cpu was the result of an AND with
867 -rps_cpu_mask
868 -
869 -This bug showed up on a host with 72 cpus :
870 -next_cpu was 0x7f, and the code was trying to access percpu data of an
871 -non existent cpu.
872 -
873 -In a follow up patch, we might get rid of compares against nr_cpu_ids,
874 -if we init the tables with 0. This is silly to test for a very unlikely
875 -condition that exists only shortly after table initialization, as
876 -we got rid of rps_reset_sock_flow() and similar functions that were
877 -writing this RPS_NO_CPU magic value at flow dismantle : When table is
878 -old enough, it never contains this value anymore.
879 -
880 -Fixes: 567e4b79731c ("net: rfs: add hash collision detection")
881 -Signed-off-by: Eric Dumazet <edumazet@××××××.com>
882 -Cc: Tom Herbert <tom@×××××××××××.com>
883 -Cc: Ben Hutchings <ben@××××××××××××.uk>
884 -Signed-off-by: David S. Miller <davem@×××××××××.net>
885 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
886 -Signed-off-by: Mike Pagano <mpagano@g.o>
887 ----
888 - Documentation/networking/scaling.txt | 2 +-
889 - net/core/dev.c | 12 ++++++------
890 - 2 files changed, 7 insertions(+), 7 deletions(-)
891 -
892 -diff --git a/Documentation/networking/scaling.txt b/Documentation/networking/scaling.txt
893 -index 99ca40e..5c204df 100644
894 ---- a/Documentation/networking/scaling.txt
895 -+++ b/Documentation/networking/scaling.txt
896 -@@ -282,7 +282,7 @@ following is true:
897 +@@ -104,7 +105,7 @@ void soft_restart(unsigned long addr)
898 + local_fiq_disable();
899
900 - - The current CPU's queue head counter >= the recorded tail counter
901 - value in rps_dev_flow[i]
902 --- The current CPU is unset (equal to RPS_NO_CPU)
903 -+- The current CPU is unset (>= nr_cpu_ids)
904 - - The current CPU is offline
905 + /* Disable the L2 if we're the last man standing. */
906 +- if (num_online_cpus() == 1)
907 ++ if (disable_l2)
908 + outer_disable();
909
910 - After this check, the packet is sent to the (possibly updated) current
911 -diff --git a/net/core/dev.c b/net/core/dev.c
912 -index 45109b7..22a53ac 100644
913 ---- a/net/core/dev.c
914 -+++ b/net/core/dev.c
915 -@@ -3041,7 +3041,7 @@ static struct rps_dev_flow *
916 - set_rps_cpu(struct net_device *dev, struct sk_buff *skb,
917 - struct rps_dev_flow *rflow, u16 next_cpu)
918 - {
919 -- if (next_cpu != RPS_NO_CPU) {
920 -+ if (next_cpu < nr_cpu_ids) {
921 - #ifdef CONFIG_RFS_ACCEL
922 - struct netdev_rx_queue *rxqueue;
923 - struct rps_dev_flow_table *flow_table;
924 -@@ -3146,7 +3146,7 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
925 - * If the desired CPU (where last recvmsg was done) is
926 - * different from current CPU (one in the rx-queue flow
927 - * table entry), switch if one of the following holds:
928 -- * - Current CPU is unset (equal to RPS_NO_CPU).
929 -+ * - Current CPU is unset (>= nr_cpu_ids).
930 - * - Current CPU is offline.
931 - * - The current CPU's queue tail has advanced beyond the
932 - * last packet that was enqueued using this table entry.
933 -@@ -3154,14 +3154,14 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
934 - * have been dequeued, thus preserving in order delivery.
935 - */
936 - if (unlikely(tcpu != next_cpu) &&
937 -- (tcpu == RPS_NO_CPU || !cpu_online(tcpu) ||
938 -+ (tcpu >= nr_cpu_ids || !cpu_online(tcpu) ||
939 - ((int)(per_cpu(softnet_data, tcpu).input_queue_head -
940 - rflow->last_qtail)) >= 0)) {
941 - tcpu = next_cpu;
942 - rflow = set_rps_cpu(dev, skb, rflow, next_cpu);
943 - }
944 -
945 -- if (tcpu != RPS_NO_CPU && cpu_online(tcpu)) {
946 -+ if (tcpu < nr_cpu_ids && cpu_online(tcpu)) {
947 - *rflowp = rflow;
948 - cpu = tcpu;
949 - goto done;
950 -@@ -3202,14 +3202,14 @@ bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index,
951 - struct rps_dev_flow_table *flow_table;
952 - struct rps_dev_flow *rflow;
953 - bool expire = true;
954 -- int cpu;
955 -+ unsigned int cpu;
956 + /* Change to the new stack and continue with the reset. */
957 +@@ -114,6 +115,11 @@ void soft_restart(unsigned long addr)
958 + BUG();
959 + }
960
961 - rcu_read_lock();
962 - flow_table = rcu_dereference(rxqueue->rps_flow_table);
963 - if (flow_table && flow_id <= flow_table->mask) {
964 - rflow = &flow_table->flows[flow_id];
965 - cpu = ACCESS_ONCE(rflow->cpu);
966 -- if (rflow->filter == filter_id && cpu != RPS_NO_CPU &&
967 -+ if (rflow->filter == filter_id && cpu < nr_cpu_ids &&
968 - ((int)(per_cpu(softnet_data, cpu).input_queue_head -
969 - rflow->last_qtail) <
970 - (int)(10 * flow_table->mask)))
971 ---
972 -2.3.6
973 -
974 -
975 -From 36fb8ea94764c1435bc5357057373c73f1055be9 Mon Sep 17 00:00:00 2001
976 -From: Amir Vadai <amirv@××××××××.com>
977 -Date: Mon, 27 Apr 2015 13:40:56 +0300
978 -Subject: [PATCH 010/219] net/mlx4_en: Prevent setting invalid RSS hash
979 - function
980 -Cc: mpagano@g.o
981 -
982 -[ Upstream commit b37069090b7c5615610a8aa6b36533d67b364d38 ]
983 -
984 -mlx4_en_check_rxfh_func() was checking for hardware support before
985 -setting a known RSS hash function, but didn't do any check before
986 -setting unknown RSS hash function. Need to make it fail on such values.
987 -In this occasion, moved the actual setting of the new value from the
988 -check function into mlx4_en_set_rxfh().
989 -
990 -Fixes: 947cbb0 ("net/mlx4_en: Support for configurable RSS hash function")
991 -Signed-off-by: Amir Vadai <amirv@××××××××.com>
992 -Signed-off-by: David S. Miller <davem@×××××××××.net>
993 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
994 -Signed-off-by: Mike Pagano <mpagano@g.o>
995 ----
996 - drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 29 ++++++++++++++-----------
997 - 1 file changed, 16 insertions(+), 13 deletions(-)
998 -
999 -diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
1000 -index a7b58ba..3dccf01 100644
1001 ---- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
1002 -+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
1003 -@@ -981,20 +981,21 @@ static int mlx4_en_check_rxfh_func(struct net_device *dev, u8 hfunc)
1004 - struct mlx4_en_priv *priv = netdev_priv(dev);
1005 ++void soft_restart(unsigned long addr)
1006 ++{
1007 ++ _soft_restart(addr, num_online_cpus() == 1);
1008 ++}
1009 ++
1010 + /*
1011 + * Function pointers to optional machine specific functions
1012 + */
1013 +diff --git a/arch/arm/kernel/reboot.h b/arch/arm/kernel/reboot.h
1014 +new file mode 100644
1015 +index 0000000..c87f058
1016 +--- /dev/null
1017 ++++ b/arch/arm/kernel/reboot.h
1018 +@@ -0,0 +1,6 @@
1019 ++#ifndef REBOOT_H
1020 ++#define REBOOT_H
1021 ++
1022 ++extern void _soft_restart(unsigned long addr, bool disable_l2);
1023 ++
1024 ++#endif
1025 +diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
1026 +index 5560f74..b652af5 100644
1027 +--- a/arch/arm/kvm/arm.c
1028 ++++ b/arch/arm/kvm/arm.c
1029 +@@ -651,8 +651,7 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,
1030 + if (!irqchip_in_kernel(kvm))
1031 + return -ENXIO;
1032
1033 - /* check if requested function is supported by the device */
1034 -- if ((hfunc == ETH_RSS_HASH_TOP &&
1035 -- !(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_TOP)) ||
1036 -- (hfunc == ETH_RSS_HASH_XOR &&
1037 -- !(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_XOR)))
1038 -- return -EINVAL;
1039 -+ if (hfunc == ETH_RSS_HASH_TOP) {
1040 -+ if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_TOP))
1041 -+ return -EINVAL;
1042 -+ if (!(dev->features & NETIF_F_RXHASH))
1043 -+ en_warn(priv, "Toeplitz hash function should be used in conjunction with RX hashing for optimal performance\n");
1044 -+ return 0;
1045 -+ } else if (hfunc == ETH_RSS_HASH_XOR) {
1046 -+ if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_XOR))
1047 -+ return -EINVAL;
1048 -+ if (dev->features & NETIF_F_RXHASH)
1049 -+ en_warn(priv, "Enabling both XOR Hash function and RX Hashing can limit RPS functionality\n");
1050 -+ return 0;
1051 -+ }
1052 +- if (irq_num < VGIC_NR_PRIVATE_IRQS ||
1053 +- irq_num > KVM_ARM_IRQ_GIC_MAX)
1054 ++ if (irq_num < VGIC_NR_PRIVATE_IRQS)
1055 + return -EINVAL;
1056
1057 -- priv->rss_hash_fn = hfunc;
1058 -- if (hfunc == ETH_RSS_HASH_TOP && !(dev->features & NETIF_F_RXHASH))
1059 -- en_warn(priv,
1060 -- "Toeplitz hash function should be used in conjunction with RX hashing for optimal performance\n");
1061 -- if (hfunc == ETH_RSS_HASH_XOR && (dev->features & NETIF_F_RXHASH))
1062 -- en_warn(priv,
1063 -- "Enabling both XOR Hash function and RX Hashing can limit RPS functionality\n");
1064 -- return 0;
1065 -+ return -EINVAL;
1066 - }
1067 + return kvm_vgic_inject_irq(kvm, 0, irq_num, level);
1068 +diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
1069 +index 8b9f5e2..4f4e222 100644
1070 +--- a/arch/arm/mach-mvebu/pmsu.c
1071 ++++ b/arch/arm/mach-mvebu/pmsu.c
1072 +@@ -415,6 +415,9 @@ static __init int armada_38x_cpuidle_init(void)
1073 + void __iomem *mpsoc_base;
1074 + u32 reg;
1075
1076 - static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key,
1077 -@@ -1068,6 +1069,8 @@ static int mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index,
1078 - priv->prof->rss_rings = rss_rings;
1079 - if (key)
1080 - memcpy(priv->rss_key, key, MLX4_EN_RSS_KEY_SIZE);
1081 -+ if (hfunc != ETH_RSS_HASH_NO_CHANGE)
1082 -+ priv->rss_hash_fn = hfunc;
1083 ++ pr_warn("CPU idle is currently broken on Armada 38x: disabling");
1084 ++ return 0;
1085 ++
1086 + np = of_find_compatible_node(NULL, NULL,
1087 + "marvell,armada-380-coherency-fabric");
1088 + if (!np)
1089 +@@ -476,6 +479,16 @@ static int __init mvebu_v7_cpu_pm_init(void)
1090 + return 0;
1091 + of_node_put(np);
1092
1093 - if (port_up) {
1094 - err = mlx4_en_start_port(dev);
1095 ---
1096 -2.3.6
1097 -
1098 -
1099 -From 8336ee9076303fbdb38e89f18e921ec238d9c48c Mon Sep 17 00:00:00 2001
1100 -From: Gu Zheng <guz.fnst@××××××××××.com>
1101 -Date: Fri, 3 Apr 2015 08:44:47 +0800
1102 -Subject: [PATCH 011/219] md: fix md io stats accounting broken
1103 -Cc: mpagano@g.o
1104 -
1105 -commit 74672d069b298b03e9f657fd70915e055739882e upstream.
1106 -
1107 -Simon reported the md io stats accounting issue:
1108 -"
1109 -I'm seeing "iostat -x -k 1" print this after a RAID1 rebuild on 4.0-rc5.
1110 -It's not abnormal other than it's 3-disk, with one being SSD (sdc) and
1111 -the other two being write-mostly:
1112 -
1113 -Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
1114 -sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
1115 -sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
1116 -sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
1117 -md0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 345.00 0.00 0.00 0.00 0.00 100.00
1118 -md2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 58779.00 0.00 0.00 0.00 0.00 100.00
1119 -md1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 12.00 0.00 0.00 0.00 0.00 100.00
1120 -"
1121 -The cause is commit "18c0b223cf9901727ef3b02da6711ac930b4e5d4" uses the
1122 -generic_start_io_acct to account the disk stats rather than the open code,
1123 -but it also introduced the increase to .in_flight[rw] which is needless to
1124 -md. So we re-use the open code here to fix it.
1125 -
1126 -Reported-by: Simon Kirby <sim@×××××××.ca>
1127 -Signed-off-by: Gu Zheng <guz.fnst@××××××××××.com>
1128 -Signed-off-by: NeilBrown <neilb@××××.de>
1129 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
1130 -Signed-off-by: Mike Pagano <mpagano@g.o>
1131 ----
1132 - drivers/md/md.c | 6 +++++-
1133 - 1 file changed, 5 insertions(+), 1 deletion(-)
1134 -
1135 -diff --git a/drivers/md/md.c b/drivers/md/md.c
1136 -index 717daad..e617878 100644
1137 ---- a/drivers/md/md.c
1138 -+++ b/drivers/md/md.c
1139 -@@ -249,6 +249,7 @@ static void md_make_request(struct request_queue *q, struct bio *bio)
1140 - const int rw = bio_data_dir(bio);
1141 - struct mddev *mddev = q->queuedata;
1142 - unsigned int sectors;
1143 -+ int cpu;
1144 ++ /*
1145 ++ * Currently the CPU idle support for Armada 38x is broken, as
1146 ++ * the CPU hotplug uses some of the CPU idle functions it is
1147 ++ * broken too, so let's disable it
1148 ++ */
1149 ++ if (of_machine_is_compatible("marvell,armada380")) {
1150 ++ cpu_hotplug_disable();
1151 ++ pr_warn("CPU hotplug support is currently broken on Armada 38x: disabling");
1152 ++ }
1153 ++
1154 + if (of_machine_is_compatible("marvell,armadaxp"))
1155 + ret = armada_xp_cpuidle_init();
1156 + else if (of_machine_is_compatible("marvell,armada370"))
1157 +@@ -489,7 +502,8 @@ static int __init mvebu_v7_cpu_pm_init(void)
1158 + return ret;
1159
1160 - if (mddev == NULL || mddev->pers == NULL
1161 - || !mddev->ready) {
1162 -@@ -284,7 +285,10 @@ static void md_make_request(struct request_queue *q, struct bio *bio)
1163 - sectors = bio_sectors(bio);
1164 - mddev->pers->make_request(mddev, bio);
1165 + mvebu_v7_pmsu_enable_l2_powerdown_onidle();
1166 +- platform_device_register(&mvebu_v7_cpuidle_device);
1167 ++ if (mvebu_v7_cpuidle_device.name)
1168 ++ platform_device_register(&mvebu_v7_cpuidle_device);
1169 + cpu_pm_register_notifier(&mvebu_v7_cpu_pm_notifier);
1170
1171 -- generic_start_io_acct(rw, sectors, &mddev->gendisk->part0);
1172 -+ cpu = part_stat_lock();
1173 -+ part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]);
1174 -+ part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw], sectors);
1175 -+ part_stat_unlock();
1176 + return 0;
1177 +diff --git a/arch/arm/mach-s3c64xx/crag6410.h b/arch/arm/mach-s3c64xx/crag6410.h
1178 +index 7bc6668..dcbe17f 100644
1179 +--- a/arch/arm/mach-s3c64xx/crag6410.h
1180 ++++ b/arch/arm/mach-s3c64xx/crag6410.h
1181 +@@ -14,6 +14,7 @@
1182 + #include <mach/gpio-samsung.h>
1183
1184 - if (atomic_dec_and_test(&mddev->active_io) && mddev->suspended)
1185 - wake_up(&mddev->sb_wait);
1186 ---
1187 -2.3.6
1188 -
1189 -
1190 -From bbe33d7992b2dd4a79499aeb384a4597b73451eb Mon Sep 17 00:00:00 2001
1191 -From: Andy Lutomirski <luto@××××××××××.net>
1192 -Date: Tue, 27 Jan 2015 16:06:02 -0800
1193 -Subject: [PATCH 012/219] x86/asm/decoder: Fix and enforce max instruction size
1194 - in the insn decoder
1195 -Cc: mpagano@g.o
1196 -
1197 -commit 91e5ed49fca09c2b83b262b9757d1376ee2b46c3 upstream.
1198 -
1199 -x86 instructions cannot exceed 15 bytes, and the instruction
1200 -decoder should enforce that. Prior to 6ba48ff46f76, the
1201 -instruction length limit was implicitly set to 16, which was an
1202 -approximation of 15, but there is currently no limit at all.
1203 -
1204 -Fix MAX_INSN_SIZE (it should be 15, not 16), and fix the decoder
1205 -to reject instructions that exceed MAX_INSN_SIZE.
1206 -
1207 -Other than potentially confusing some of the decoder sanity
1208 -checks, I'm not aware of any actual problems that omitting this
1209 -check would cause, nor am I aware of any practical problems
1210 -caused by the MAX_INSN_SIZE error.
1211 -
1212 -Signed-off-by: Andy Lutomirski <luto@××××××××××.net>
1213 -Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@×××××××.com>
1214 -Cc: Dave Hansen <dave.hansen@×××××××××××.com>
1215 -Fixes: 6ba48ff46f76 ("x86: Remove arbitrary instruction size limit ...
1216 -Link: http://lkml.kernel.org/r/f8f0bc9b8c58cfd6830f7d88400bf1396cbdcd0f.1422403511.git.luto@××××××××××.net
1217 -Signed-off-by: Ingo Molnar <mingo@××××××.org>
1218 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
1219 -Signed-off-by: Mike Pagano <mpagano@g.o>
1220 ----
1221 - arch/x86/include/asm/insn.h | 2 +-
1222 - arch/x86/lib/insn.c | 7 +++++++
1223 - 2 files changed, 8 insertions(+), 1 deletion(-)
1224 -
1225 -diff --git a/arch/x86/include/asm/insn.h b/arch/x86/include/asm/insn.h
1226 -index 47f29b1..e7814b7 100644
1227 ---- a/arch/x86/include/asm/insn.h
1228 -+++ b/arch/x86/include/asm/insn.h
1229 -@@ -69,7 +69,7 @@ struct insn {
1230 - const insn_byte_t *next_byte;
1231 - };
1232 + #define GLENFARCLAS_PMIC_IRQ_BASE IRQ_BOARD_START
1233 ++#define BANFF_PMIC_IRQ_BASE (IRQ_BOARD_START + 64)
1234
1235 --#define MAX_INSN_SIZE 16
1236 -+#define MAX_INSN_SIZE 15
1237 + #define PCA935X_GPIO_BASE GPIO_BOARD_START
1238 + #define CODEC_GPIO_BASE (GPIO_BOARD_START + 8)
1239 +diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
1240 +index 10b913b..65c426b 100644
1241 +--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
1242 ++++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
1243 +@@ -554,6 +554,7 @@ static struct wm831x_touch_pdata touch_pdata = {
1244
1245 - #define X86_MODRM_MOD(modrm) (((modrm) & 0xc0) >> 6)
1246 - #define X86_MODRM_REG(modrm) (((modrm) & 0x38) >> 3)
1247 -diff --git a/arch/x86/lib/insn.c b/arch/x86/lib/insn.c
1248 -index 1313ae6..85994f5 100644
1249 ---- a/arch/x86/lib/insn.c
1250 -+++ b/arch/x86/lib/insn.c
1251 -@@ -52,6 +52,13 @@
1252 - */
1253 - void insn_init(struct insn *insn, const void *kaddr, int buf_len, int x86_64)
1254 - {
1255 -+ /*
1256 -+ * Instructions longer than MAX_INSN_SIZE (15 bytes) are invalid
1257 -+ * even if the input buffer is long enough to hold them.
1258 -+ */
1259 -+ if (buf_len > MAX_INSN_SIZE)
1260 -+ buf_len = MAX_INSN_SIZE;
1261 -+
1262 - memset(insn, 0, sizeof(*insn));
1263 - insn->kaddr = kaddr;
1264 - insn->end_kaddr = kaddr + buf_len;
1265 ---
1266 -2.3.6
1267 -
1268 -
1269 -From 3fbb83fdcd2be33c3091f2c1094c37b5054da9f8 Mon Sep 17 00:00:00 2001
1270 -From: Marcelo Tosatti <mtosatti@××××××.com>
1271 -Date: Mon, 23 Mar 2015 20:21:51 -0300
1272 -Subject: [PATCH 013/219] x86: kvm: Revert "remove sched notifier for cross-cpu
1273 - migrations"
1274 -Cc: mpagano@g.o
1275 -
1276 -commit 0a4e6be9ca17c54817cf814b4b5aa60478c6df27 upstream.
1277 -
1278 -The following point:
1279 -
1280 - 2. per-CPU pvclock time info is updated if the
1281 - underlying CPU changes.
1282 -
1283 -Is not true anymore since "KVM: x86: update pvclock area conditionally,
1284 -on cpu migration".
1285 -
1286 -Add task migration notification back.
1287 -
1288 -Problem noticed by Andy Lutomirski.
1289 -
1290 -Signed-off-by: Marcelo Tosatti <mtosatti@××××××.com>
1291 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
1292 -Signed-off-by: Mike Pagano <mpagano@g.o>
1293 ----
1294 - arch/x86/include/asm/pvclock.h | 1 +
1295 - arch/x86/kernel/pvclock.c | 44 ++++++++++++++++++++++++++++++++++++++++++
1296 - arch/x86/vdso/vclock_gettime.c | 16 +++++++--------
1297 - include/linux/sched.h | 8 ++++++++
1298 - kernel/sched/core.c | 15 ++++++++++++++
1299 - 5 files changed, 76 insertions(+), 8 deletions(-)
1300 -
1301 -diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
1302 -index d6b078e..25b1cc0 100644
1303 ---- a/arch/x86/include/asm/pvclock.h
1304 -+++ b/arch/x86/include/asm/pvclock.h
1305 -@@ -95,6 +95,7 @@ unsigned __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src,
1306 + static struct wm831x_pdata crag_pmic_pdata = {
1307 + .wm831x_num = 1,
1308 ++ .irq_base = BANFF_PMIC_IRQ_BASE,
1309 + .gpio_base = BANFF_PMIC_GPIO_BASE,
1310 + .soft_shutdown = true,
1311
1312 - struct pvclock_vsyscall_time_info {
1313 - struct pvclock_vcpu_time_info pvti;
1314 -+ u32 migrate_count;
1315 - } __attribute__((__aligned__(SMP_CACHE_BYTES)));
1316 +diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
1317 +index 1b8e973..a6186c2 100644
1318 +--- a/arch/arm64/Kconfig
1319 ++++ b/arch/arm64/Kconfig
1320 +@@ -361,6 +361,27 @@ config ARM64_ERRATUM_832075
1321
1322 - #define PVTI_SIZE sizeof(struct pvclock_vsyscall_time_info)
1323 -diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
1324 -index 2f355d2..e5ecd20 100644
1325 ---- a/arch/x86/kernel/pvclock.c
1326 -+++ b/arch/x86/kernel/pvclock.c
1327 -@@ -141,7 +141,46 @@ void pvclock_read_wallclock(struct pvclock_wall_clock *wall_clock,
1328 - set_normalized_timespec(ts, now.tv_sec, now.tv_nsec);
1329 - }
1330 + If unsure, say Y.
1331
1332 -+static struct pvclock_vsyscall_time_info *pvclock_vdso_info;
1333 ++config ARM64_ERRATUM_845719
1334 ++ bool "Cortex-A53: 845719: a load might read incorrect data"
1335 ++ depends on COMPAT
1336 ++ default y
1337 ++ help
1338 ++ This option adds an alternative code sequence to work around ARM
1339 ++ erratum 845719 on Cortex-A53 parts up to r0p4.
1340 +
1341 -+static struct pvclock_vsyscall_time_info *
1342 -+pvclock_get_vsyscall_user_time_info(int cpu)
1343 -+{
1344 -+ if (!pvclock_vdso_info) {
1345 -+ BUG();
1346 -+ return NULL;
1347 -+ }
1348 -+
1349 -+ return &pvclock_vdso_info[cpu];
1350 -+}
1351 -+
1352 -+struct pvclock_vcpu_time_info *pvclock_get_vsyscall_time_info(int cpu)
1353 -+{
1354 -+ return &pvclock_get_vsyscall_user_time_info(cpu)->pvti;
1355 -+}
1356 -+
1357 - #ifdef CONFIG_X86_64
1358 -+static int pvclock_task_migrate(struct notifier_block *nb, unsigned long l,
1359 -+ void *v)
1360 -+{
1361 -+ struct task_migration_notifier *mn = v;
1362 -+ struct pvclock_vsyscall_time_info *pvti;
1363 -+
1364 -+ pvti = pvclock_get_vsyscall_user_time_info(mn->from_cpu);
1365 -+
1366 -+ /* this is NULL when pvclock vsyscall is not initialized */
1367 -+ if (unlikely(pvti == NULL))
1368 -+ return NOTIFY_DONE;
1369 -+
1370 -+ pvti->migrate_count++;
1371 ++ When running a compat (AArch32) userspace on an affected Cortex-A53
1372 ++ part, a load at EL0 from a virtual address that matches the bottom 32
1373 ++ bits of the virtual address used by a recent load at (AArch64) EL1
1374 ++ might return incorrect data.
1375 +
1376 -+ return NOTIFY_DONE;
1377 -+}
1378 ++ The workaround is to write the contextidr_el1 register on exception
1379 ++ return to a 32-bit task.
1380 ++ Please note that this does not necessarily enable the workaround,
1381 ++ as it depends on the alternative framework, which will only patch
1382 ++ the kernel if an affected CPU is detected.
1383 +
1384 -+static struct notifier_block pvclock_migrate = {
1385 -+ .notifier_call = pvclock_task_migrate,
1386 -+};
1387 ++ If unsure, say Y.
1388 +
1389 - /*
1390 - * Initialize the generic pvclock vsyscall state. This will allocate
1391 - * a/some page(s) for the per-vcpu pvclock information, set up a
1392 -@@ -155,12 +194,17 @@ int __init pvclock_init_vsyscall(struct pvclock_vsyscall_time_info *i,
1393 + endmenu
1394
1395 - WARN_ON (size != PVCLOCK_VSYSCALL_NR_PAGES*PAGE_SIZE);
1396
1397 -+ pvclock_vdso_info = i;
1398 -+
1399 - for (idx = 0; idx <= (PVCLOCK_FIXMAP_END-PVCLOCK_FIXMAP_BEGIN); idx++) {
1400 - __set_fixmap(PVCLOCK_FIXMAP_BEGIN + idx,
1401 - __pa(i) + (idx*PAGE_SIZE),
1402 - PAGE_KERNEL_VVAR);
1403 - }
1404 +@@ -470,6 +491,10 @@ config HOTPLUG_CPU
1405
1406 + source kernel/Kconfig.preempt
1407 +
1408 ++config UP_LATE_INIT
1409 ++ def_bool y
1410 ++ depends on !SMP
1411 +
1412 -+ register_task_migration_notifier(&pvclock_migrate);
1413 -+
1414 - return 0;
1415 - }
1416 - #endif
1417 -diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
1418 -index 9793322..3093376 100644
1419 ---- a/arch/x86/vdso/vclock_gettime.c
1420 -+++ b/arch/x86/vdso/vclock_gettime.c
1421 -@@ -82,18 +82,15 @@ static notrace cycle_t vread_pvclock(int *mode)
1422 - cycle_t ret;
1423 - u64 last;
1424 - u32 version;
1425 -+ u32 migrate_count;
1426 - u8 flags;
1427 - unsigned cpu, cpu1;
1428 + config HZ
1429 + int
1430 + default 100
1431 +diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
1432 +index 69ceedc..4d2a925 100644
1433 +--- a/arch/arm64/Makefile
1434 ++++ b/arch/arm64/Makefile
1435 +@@ -48,7 +48,7 @@ core-$(CONFIG_KVM) += arch/arm64/kvm/
1436 + core-$(CONFIG_XEN) += arch/arm64/xen/
1437 + core-$(CONFIG_CRYPTO) += arch/arm64/crypto/
1438 + libs-y := arch/arm64/lib/ $(libs-y)
1439 +-libs-$(CONFIG_EFI_STUB) += drivers/firmware/efi/libstub/
1440 ++core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
1441 +
1442 + # Default target when executing plain make
1443 + KBUILD_IMAGE := Image.gz
1444 +diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
1445 +index b6c16d5..3f0c53c 100644
1446 +--- a/arch/arm64/include/asm/cpufeature.h
1447 ++++ b/arch/arm64/include/asm/cpufeature.h
1448 +@@ -23,8 +23,9 @@
1449
1450 + #define ARM64_WORKAROUND_CLEAN_CACHE 0
1451 + #define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE 1
1452 ++#define ARM64_WORKAROUND_845719 2
1453
1454 - /*
1455 -- * Note: hypervisor must guarantee that:
1456 -- * 1. cpu ID number maps 1:1 to per-CPU pvclock time info.
1457 -- * 2. that per-CPU pvclock time info is updated if the
1458 -- * underlying CPU changes.
1459 -- * 3. that version is increased whenever underlying CPU
1460 -- * changes.
1461 -- *
1462 -+ * When looping to get a consistent (time-info, tsc) pair, we
1463 -+ * also need to deal with the possibility we can switch vcpus,
1464 -+ * so make sure we always re-fetch time-info for the current vcpu.
1465 - */
1466 - do {
1467 - cpu = __getcpu() & VGETCPU_CPU_MASK;
1468 -@@ -104,6 +101,8 @@ static notrace cycle_t vread_pvclock(int *mode)
1469 +-#define ARM64_NCAPS 2
1470 ++#define ARM64_NCAPS 3
1471 +
1472 + #ifndef __ASSEMBLY__
1473
1474 - pvti = get_pvti(cpu);
1475 +diff --git a/arch/arm64/include/asm/smp_plat.h b/arch/arm64/include/asm/smp_plat.h
1476 +index 59e2823..8dcd61e 100644
1477 +--- a/arch/arm64/include/asm/smp_plat.h
1478 ++++ b/arch/arm64/include/asm/smp_plat.h
1479 +@@ -40,4 +40,6 @@ static inline u32 mpidr_hash_size(void)
1480 + extern u64 __cpu_logical_map[NR_CPUS];
1481 + #define cpu_logical_map(cpu) __cpu_logical_map[cpu]
1482
1483 -+ migrate_count = pvti->migrate_count;
1484 ++void __init do_post_cpus_up_work(void);
1485 +
1486 - version = __pvclock_read_cycles(&pvti->pvti, &ret, &flags);
1487 + #endif /* __ASM_SMP_PLAT_H */
1488 +diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
1489 +index 3ef77a4..bc49a18 100644
1490 +--- a/arch/arm64/include/uapi/asm/kvm.h
1491 ++++ b/arch/arm64/include/uapi/asm/kvm.h
1492 +@@ -188,8 +188,14 @@ struct kvm_arch_memory_slot {
1493 + #define KVM_ARM_IRQ_CPU_IRQ 0
1494 + #define KVM_ARM_IRQ_CPU_FIQ 1
1495
1496 - /*
1497 -@@ -115,7 +114,8 @@ static notrace cycle_t vread_pvclock(int *mode)
1498 - cpu1 = __getcpu() & VGETCPU_CPU_MASK;
1499 - } while (unlikely(cpu != cpu1 ||
1500 - (pvti->pvti.version & 1) ||
1501 -- pvti->pvti.version != version));
1502 -+ pvti->pvti.version != version ||
1503 -+ pvti->migrate_count != migrate_count));
1504 +-/* Highest supported SPI, from VGIC_NR_IRQS */
1505 ++/*
1506 ++ * This used to hold the highest supported SPI, but it is now obsolete
1507 ++ * and only here to provide source code level compatibility with older
1508 ++ * userland. The highest SPI number can be set via KVM_DEV_ARM_VGIC_GRP_NR_IRQS.
1509 ++ */
1510 ++#ifndef __KERNEL__
1511 + #define KVM_ARM_IRQ_GIC_MAX 127
1512 ++#endif
1513
1514 - if (unlikely(!(flags & PVCLOCK_TSC_STABLE_BIT)))
1515 - *mode = VCLOCK_NONE;
1516 -diff --git a/include/linux/sched.h b/include/linux/sched.h
1517 -index a419b65..51348f7 100644
1518 ---- a/include/linux/sched.h
1519 -+++ b/include/linux/sched.h
1520 -@@ -176,6 +176,14 @@ extern void get_iowait_load(unsigned long *nr_waiters, unsigned long *load);
1521 - extern void calc_global_load(unsigned long ticks);
1522 - extern void update_cpu_load_nohz(void);
1523 + /* PSCI interface */
1524 + #define KVM_PSCI_FN_BASE 0x95c1ba5e
1525 +diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
1526 +index fa62637..ad6d523 100644
1527 +--- a/arch/arm64/kernel/cpu_errata.c
1528 ++++ b/arch/arm64/kernel/cpu_errata.c
1529 +@@ -88,7 +88,16 @@ struct arm64_cpu_capabilities arm64_errata[] = {
1530 + /* Cortex-A57 r0p0 - r1p2 */
1531 + .desc = "ARM erratum 832075",
1532 + .capability = ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE,
1533 +- MIDR_RANGE(MIDR_CORTEX_A57, 0x00, 0x12),
1534 ++ MIDR_RANGE(MIDR_CORTEX_A57, 0x00,
1535 ++ (1 << MIDR_VARIANT_SHIFT) | 2),
1536 ++ },
1537 ++#endif
1538 ++#ifdef CONFIG_ARM64_ERRATUM_845719
1539 ++ {
1540 ++ /* Cortex-A53 r0p[01234] */
1541 ++ .desc = "ARM erratum 845719",
1542 ++ .capability = ARM64_WORKAROUND_845719,
1543 ++ MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x04),
1544 + },
1545 + #endif
1546 + {
1547 +diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
1548 +index cf21bb3..959fe87 100644
1549 +--- a/arch/arm64/kernel/entry.S
1550 ++++ b/arch/arm64/kernel/entry.S
1551 +@@ -21,8 +21,10 @@
1552 + #include <linux/init.h>
1553 + #include <linux/linkage.h>
1554
1555 -+/* Notifier for when a task gets migrated to a new CPU */
1556 -+struct task_migration_notifier {
1557 -+ struct task_struct *task;
1558 -+ int from_cpu;
1559 -+ int to_cpu;
1560 -+};
1561 -+extern void register_task_migration_notifier(struct notifier_block *n);
1562 ++#include <asm/alternative-asm.h>
1563 + #include <asm/assembler.h>
1564 + #include <asm/asm-offsets.h>
1565 ++#include <asm/cpufeature.h>
1566 + #include <asm/errno.h>
1567 + #include <asm/esr.h>
1568 + #include <asm/thread_info.h>
1569 +@@ -120,6 +122,24 @@
1570 + ct_user_enter
1571 + ldr x23, [sp, #S_SP] // load return stack pointer
1572 + msr sp_el0, x23
1573 +
1574 - extern unsigned long get_parent_ip(unsigned long addr);
1575 ++#ifdef CONFIG_ARM64_ERRATUM_845719
1576 ++ alternative_insn \
1577 ++ "nop", \
1578 ++ "tbz x22, #4, 1f", \
1579 ++ ARM64_WORKAROUND_845719
1580 ++#ifdef CONFIG_PID_IN_CONTEXTIDR
1581 ++ alternative_insn \
1582 ++ "nop; nop", \
1583 ++ "mrs x29, contextidr_el1; msr contextidr_el1, x29; 1:", \
1584 ++ ARM64_WORKAROUND_845719
1585 ++#else
1586 ++ alternative_insn \
1587 ++ "nop", \
1588 ++ "msr contextidr_el1, xzr; 1:", \
1589 ++ ARM64_WORKAROUND_845719
1590 ++#endif
1591 ++#endif
1592 + .endif
1593 + msr elr_el1, x21 // set up the return data
1594 + msr spsr_el1, x22
1595 +diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
1596 +index 07f9305..c237ffb 100644
1597 +--- a/arch/arm64/kernel/head.S
1598 ++++ b/arch/arm64/kernel/head.S
1599 +@@ -426,6 +426,7 @@ __create_page_tables:
1600 + */
1601 + mov x0, x25
1602 + add x1, x26, #SWAPPER_DIR_SIZE
1603 ++ dmb sy
1604 + bl __inval_cache_range
1605
1606 - extern void dump_cpu_task(int cpu);
1607 -diff --git a/kernel/sched/core.c b/kernel/sched/core.c
1608 -index 62671f5..3d5f6f6 100644
1609 ---- a/kernel/sched/core.c
1610 -+++ b/kernel/sched/core.c
1611 -@@ -996,6 +996,13 @@ void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags)
1612 - rq_clock_skip_update(rq, true);
1613 + mov lr, x27
1614 +diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
1615 +index e8420f6..781f469 100644
1616 +--- a/arch/arm64/kernel/setup.c
1617 ++++ b/arch/arm64/kernel/setup.c
1618 +@@ -207,6 +207,18 @@ static void __init smp_build_mpidr_hash(void)
1619 }
1620 + #endif
1621
1622 -+static ATOMIC_NOTIFIER_HEAD(task_migration_notifier);
1623 -+
1624 -+void register_task_migration_notifier(struct notifier_block *n)
1625 ++void __init do_post_cpus_up_work(void)
1626 +{
1627 -+ atomic_notifier_chain_register(&task_migration_notifier, n);
1628 ++ apply_alternatives_all();
1629 +}
1630 +
1631 - #ifdef CONFIG_SMP
1632 - void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
1633 ++#ifdef CONFIG_UP_LATE_INIT
1634 ++void __init up_late_init(void)
1635 ++{
1636 ++ do_post_cpus_up_work();
1637 ++}
1638 ++#endif /* CONFIG_UP_LATE_INIT */
1639 ++
1640 + static void __init setup_processor(void)
1641 {
1642 -@@ -1026,10 +1033,18 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
1643 - trace_sched_migrate_task(p, new_cpu);
1644 + struct cpu_info *cpu_info;
1645 +diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
1646 +index 328b8ce..4257369 100644
1647 +--- a/arch/arm64/kernel/smp.c
1648 ++++ b/arch/arm64/kernel/smp.c
1649 +@@ -309,7 +309,7 @@ void cpu_die(void)
1650 + void __init smp_cpus_done(unsigned int max_cpus)
1651 + {
1652 + pr_info("SMP: Total of %d processors activated.\n", num_online_cpus());
1653 +- apply_alternatives_all();
1654 ++ do_post_cpus_up_work();
1655 + }
1656
1657 - if (task_cpu(p) != new_cpu) {
1658 -+ struct task_migration_notifier tmn;
1659 + void __init smp_prepare_boot_cpu(void)
1660 +diff --git a/arch/c6x/kernel/time.c b/arch/c6x/kernel/time.c
1661 +index 356ee84..04845aa 100644
1662 +--- a/arch/c6x/kernel/time.c
1663 ++++ b/arch/c6x/kernel/time.c
1664 +@@ -49,7 +49,7 @@ u64 sched_clock(void)
1665 + return (tsc * sched_clock_multiplier) >> SCHED_CLOCK_SHIFT;
1666 + }
1667 +
1668 +-void time_init(void)
1669 ++void __init time_init(void)
1670 + {
1671 + u64 tmp = (u64)NSEC_PER_SEC << SCHED_CLOCK_SHIFT;
1672 +
1673 +diff --git a/arch/mips/include/asm/asm-eva.h b/arch/mips/include/asm/asm-eva.h
1674 +index e41c56e..1e38f0e 100644
1675 +--- a/arch/mips/include/asm/asm-eva.h
1676 ++++ b/arch/mips/include/asm/asm-eva.h
1677 +@@ -11,6 +11,36 @@
1678 + #define __ASM_ASM_EVA_H
1679 +
1680 + #ifndef __ASSEMBLY__
1681 +
1682 - if (p->sched_class->migrate_task_rq)
1683 - p->sched_class->migrate_task_rq(p, new_cpu);
1684 - p->se.nr_migrations++;
1685 - perf_sw_event_sched(PERF_COUNT_SW_CPU_MIGRATIONS, 1, 0);
1686 ++/* Kernel variants */
1687 +
1688 -+ tmn.task = p;
1689 -+ tmn.from_cpu = task_cpu(p);
1690 -+ tmn.to_cpu = new_cpu;
1691 ++#define kernel_cache(op, base) "cache " op ", " base "\n"
1692 ++#define kernel_ll(reg, addr) "ll " reg ", " addr "\n"
1693 ++#define kernel_sc(reg, addr) "sc " reg ", " addr "\n"
1694 ++#define kernel_lw(reg, addr) "lw " reg ", " addr "\n"
1695 ++#define kernel_lwl(reg, addr) "lwl " reg ", " addr "\n"
1696 ++#define kernel_lwr(reg, addr) "lwr " reg ", " addr "\n"
1697 ++#define kernel_lh(reg, addr) "lh " reg ", " addr "\n"
1698 ++#define kernel_lb(reg, addr) "lb " reg ", " addr "\n"
1699 ++#define kernel_lbu(reg, addr) "lbu " reg ", " addr "\n"
1700 ++#define kernel_sw(reg, addr) "sw " reg ", " addr "\n"
1701 ++#define kernel_swl(reg, addr) "swl " reg ", " addr "\n"
1702 ++#define kernel_swr(reg, addr) "swr " reg ", " addr "\n"
1703 ++#define kernel_sh(reg, addr) "sh " reg ", " addr "\n"
1704 ++#define kernel_sb(reg, addr) "sb " reg ", " addr "\n"
1705 +
1706 -+ atomic_notifier_call_chain(&task_migration_notifier, 0, &tmn);
1707 - }
1708 ++#ifdef CONFIG_32BIT
1709 ++/*
1710 ++ * No 'sd' or 'ld' instructions in 32-bit but the code will
1711 ++ * do the correct thing
1712 ++ */
1713 ++#define kernel_sd(reg, addr) user_sw(reg, addr)
1714 ++#define kernel_ld(reg, addr) user_lw(reg, addr)
1715 ++#else
1716 ++#define kernel_sd(reg, addr) "sd " reg", " addr "\n"
1717 ++#define kernel_ld(reg, addr) "ld " reg", " addr "\n"
1718 ++#endif /* CONFIG_32BIT */
1719 ++
1720 + #ifdef CONFIG_EVA
1721
1722 - __set_task_cpu(p, new_cpu);
1723 ---
1724 -2.3.6
1725 -
1726 -
1727 -From 82a7e6737ca5b18841f7130821dbec007d736b0b Mon Sep 17 00:00:00 2001
1728 -From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= <rkrcmar@××××××.com>
1729 -Date: Thu, 2 Apr 2015 20:44:23 +0200
1730 -Subject: [PATCH 014/219] x86: vdso: fix pvclock races with task migration
1731 -MIME-Version: 1.0
1732 -Content-Type: text/plain; charset=UTF-8
1733 -Content-Transfer-Encoding: 8bit
1734 -Cc: mpagano@g.o
1735 -
1736 -commit 80f7fdb1c7f0f9266421f823964fd1962681f6ce upstream.
1737 -
1738 -If we were migrated right after __getcpu, but before reading the
1739 -migration_count, we wouldn't notice that we read TSC of a different
1740 -VCPU, nor that KVM's bug made pvti invalid, as only migration_count
1741 -on source VCPU is increased.
1742 -
1743 -Change vdso instead of updating migration_count on destination.
1744 -
1745 -Signed-off-by: Radim Krčmář <rkrcmar@××××××.com>
1746 -Fixes: 0a4e6be9ca17 ("x86: kvm: Revert "remove sched notifier for cross-cpu migrations"")
1747 -Message-Id: <1428000263-11892-1-git-send-email-rkrcmar@××××××.com>
1748 -Signed-off-by: Paolo Bonzini <pbonzini@××××××.com>
1749 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
1750 -Signed-off-by: Mike Pagano <mpagano@g.o>
1751 ----
1752 - arch/x86/vdso/vclock_gettime.c | 20 ++++++++++++--------
1753 - 1 file changed, 12 insertions(+), 8 deletions(-)
1754 -
1755 -diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
1756 -index 3093376..40d2473 100644
1757 ---- a/arch/x86/vdso/vclock_gettime.c
1758 -+++ b/arch/x86/vdso/vclock_gettime.c
1759 -@@ -99,21 +99,25 @@ static notrace cycle_t vread_pvclock(int *mode)
1760 - * __getcpu() calls (Gleb).
1761 - */
1762 + #define __BUILD_EVA_INSN(insn, reg, addr) \
1763 +@@ -41,37 +71,60 @@
1764
1765 -- pvti = get_pvti(cpu);
1766 -+ /* Make sure migrate_count will change if we leave the VCPU. */
1767 -+ do {
1768 -+ pvti = get_pvti(cpu);
1769 -+ migrate_count = pvti->migrate_count;
1770 + #else
1771
1772 -- migrate_count = pvti->migrate_count;
1773 -+ cpu1 = cpu;
1774 -+ cpu = __getcpu() & VGETCPU_CPU_MASK;
1775 -+ } while (unlikely(cpu != cpu1));
1776 +-#define user_cache(op, base) "cache " op ", " base "\n"
1777 +-#define user_ll(reg, addr) "ll " reg ", " addr "\n"
1778 +-#define user_sc(reg, addr) "sc " reg ", " addr "\n"
1779 +-#define user_lw(reg, addr) "lw " reg ", " addr "\n"
1780 +-#define user_lwl(reg, addr) "lwl " reg ", " addr "\n"
1781 +-#define user_lwr(reg, addr) "lwr " reg ", " addr "\n"
1782 +-#define user_lh(reg, addr) "lh " reg ", " addr "\n"
1783 +-#define user_lb(reg, addr) "lb " reg ", " addr "\n"
1784 +-#define user_lbu(reg, addr) "lbu " reg ", " addr "\n"
1785 +-#define user_sw(reg, addr) "sw " reg ", " addr "\n"
1786 +-#define user_swl(reg, addr) "swl " reg ", " addr "\n"
1787 +-#define user_swr(reg, addr) "swr " reg ", " addr "\n"
1788 +-#define user_sh(reg, addr) "sh " reg ", " addr "\n"
1789 +-#define user_sb(reg, addr) "sb " reg ", " addr "\n"
1790 ++#define user_cache(op, base) kernel_cache(op, base)
1791 ++#define user_ll(reg, addr) kernel_ll(reg, addr)
1792 ++#define user_sc(reg, addr) kernel_sc(reg, addr)
1793 ++#define user_lw(reg, addr) kernel_lw(reg, addr)
1794 ++#define user_lwl(reg, addr) kernel_lwl(reg, addr)
1795 ++#define user_lwr(reg, addr) kernel_lwr(reg, addr)
1796 ++#define user_lh(reg, addr) kernel_lh(reg, addr)
1797 ++#define user_lb(reg, addr) kernel_lb(reg, addr)
1798 ++#define user_lbu(reg, addr) kernel_lbu(reg, addr)
1799 ++#define user_sw(reg, addr) kernel_sw(reg, addr)
1800 ++#define user_swl(reg, addr) kernel_swl(reg, addr)
1801 ++#define user_swr(reg, addr) kernel_swr(reg, addr)
1802 ++#define user_sh(reg, addr) kernel_sh(reg, addr)
1803 ++#define user_sb(reg, addr) kernel_sb(reg, addr)
1804
1805 - version = __pvclock_read_cycles(&pvti->pvti, &ret, &flags);
1806 + #ifdef CONFIG_32BIT
1807 +-/*
1808 +- * No 'sd' or 'ld' instructions in 32-bit but the code will
1809 +- * do the correct thing
1810 +- */
1811 +-#define user_sd(reg, addr) user_sw(reg, addr)
1812 +-#define user_ld(reg, addr) user_lw(reg, addr)
1813 ++#define user_sd(reg, addr) kernel_sw(reg, addr)
1814 ++#define user_ld(reg, addr) kernel_lw(reg, addr)
1815 + #else
1816 +-#define user_sd(reg, addr) "sd " reg", " addr "\n"
1817 +-#define user_ld(reg, addr) "ld " reg", " addr "\n"
1818 ++#define user_sd(reg, addr) kernel_sd(reg, addr)
1819 ++#define user_ld(reg, addr) kernel_ld(reg, addr)
1820 + #endif /* CONFIG_32BIT */
1821
1822 - /*
1823 - * Test we're still on the cpu as well as the version.
1824 -- * We could have been migrated just after the first
1825 -- * vgetcpu but before fetching the version, so we
1826 -- * wouldn't notice a version change.
1827 -+ * - We must read TSC of pvti's VCPU.
1828 -+ * - KVM doesn't follow the versioning protocol, so data could
1829 -+ * change before version if we left the VCPU.
1830 - */
1831 -- cpu1 = __getcpu() & VGETCPU_CPU_MASK;
1832 -- } while (unlikely(cpu != cpu1 ||
1833 -- (pvti->pvti.version & 1) ||
1834 -+ smp_rmb();
1835 -+ } while (unlikely((pvti->pvti.version & 1) ||
1836 - pvti->pvti.version != version ||
1837 - pvti->migrate_count != migrate_count));
1838 -
1839 ---
1840 -2.3.6
1841 -
1842 -
1843 -From 0e625b6df5ac57968c7ab197e916ea03f70e4a24 Mon Sep 17 00:00:00 2001
1844 -From: Len Brown <len.brown@×××××.com>
1845 -Date: Wed, 15 Jan 2014 00:37:34 -0500
1846 -Subject: [PATCH 015/219] sched/idle/x86: Restore mwait_idle() to fix boot
1847 - hangs, to improve power savings and to improve performance
1848 -Cc: mpagano@g.o
1849 -
1850 -commit b253149b843f89cd300cbdbea27ce1f847506f99 upstream.
1851 -
1852 -In Linux-3.9 we removed the mwait_idle() loop:
1853 -
1854 - 69fb3676df33 ("x86 idle: remove mwait_idle() and "idle=mwait" cmdline param")
1855 -
1856 -The reasoning was that modern machines should be sufficiently
1857 -happy during the boot process using the default_idle() HALT
1858 -loop, until cpuidle loads and either acpi_idle or intel_idle
1859 -invoke the newer MWAIT-with-hints idle loop.
1860 -
1861 -But two machines reported problems:
1862 -
1863 - 1. Certain Core2-era machines support MWAIT-C1 and HALT only.
1864 - MWAIT-C1 is preferred for optimal power and performance.
1865 - But if they support just C1, cpuidle never loads and
1866 - so they use the boot-time default idle loop forever.
1867 -
1868 - 2. Some laptops will boot-hang if HALT is used,
1869 - but will boot successfully if MWAIT is used.
1870 - This appears to be a hidden assumption in BIOS SMI,
1871 - that is presumably valid on the proprietary OS
1872 - where the BIOS was validated.
1873 -
1874 - https://bugzilla.kernel.org/show_bug.cgi?id=60770
1875 -
1876 -So here we effectively revert the patch above, restoring
1877 -the mwait_idle() loop. However, we don't bother restoring
1878 -the idle=mwait cmdline parameter, since it appears to add
1879 -no value.
1880 -
1881 -Maintainer notes:
1882 -
1883 - For 3.9, simply revert 69fb3676df
1884 - for 3.10, patch -F3 applies, fuzz needed due to __cpuinit use in
1885 - context For 3.11, 3.12, 3.13, this patch applies cleanly
1886 -
1887 -Tested-by: Mike Galbraith <bitbucket@××××××.de>
1888 -Signed-off-by: Len Brown <len.brown@×××××.com>
1889 -Acked-by: Mike Galbraith <bitbucket@××××××.de>
1890 -Cc: Borislav Petkov <bp@××××××.de>
1891 -Cc: H. Peter Anvin <hpa@×××××.com>
1892 -Cc: Ian Malone <ibmalone@×××××.com>
1893 -Cc: Josh Boyer <jwboyer@××××××.com>
1894 -Cc: Linus Torvalds <torvalds@××××××××××××××××.org>
1895 -Cc: Mike Galbraith <efault@×××.de>
1896 -Cc: Peter Zijlstra <peterz@×××××××××.org>
1897 -Cc: Thomas Gleixner <tglx@××××××××××.de>
1898 -Link: http://lkml.kernel.org/r/345254a551eb5a6a866e048d7ab570fd2193aca4.1389763084.git.len.brown@×××××.com
1899 -[ Ported to recent kernels. ]
1900 -Signed-off-by: Ingo Molnar <mingo@××××××.org>
1901 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
1902 -
1903 -Signed-off-by: Mike Pagano <mpagano@g.o>
1904 ----
1905 - arch/x86/include/asm/mwait.h | 8 ++++++++
1906 - arch/x86/kernel/process.c | 47 ++++++++++++++++++++++++++++++++++++++++++++
1907 - 2 files changed, 55 insertions(+)
1908 -
1909 -diff --git a/arch/x86/include/asm/mwait.h b/arch/x86/include/asm/mwait.h
1910 -index a1410db..653dfa7 100644
1911 ---- a/arch/x86/include/asm/mwait.h
1912 -+++ b/arch/x86/include/asm/mwait.h
1913 -@@ -30,6 +30,14 @@ static inline void __mwait(unsigned long eax, unsigned long ecx)
1914 - :: "a" (eax), "c" (ecx));
1915 - }
1916 + #endif /* CONFIG_EVA */
1917
1918 -+static inline void __sti_mwait(unsigned long eax, unsigned long ecx)
1919 -+{
1920 -+ trace_hardirqs_on();
1921 -+ /* "mwait %eax, %ecx;" */
1922 -+ asm volatile("sti; .byte 0x0f, 0x01, 0xc9;"
1923 -+ :: "a" (eax), "c" (ecx));
1924 -+}
1925 -+
1926 - /*
1927 - * This uses new MONITOR/MWAIT instructions on P4 processors with PNI,
1928 - * which can obviate IPI to trigger checking of need_resched.
1929 -diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
1930 -index 046e2d6..65e1a90 100644
1931 ---- a/arch/x86/kernel/process.c
1932 -+++ b/arch/x86/kernel/process.c
1933 -@@ -24,6 +24,7 @@
1934 - #include <asm/syscalls.h>
1935 - #include <asm/idle.h>
1936 - #include <asm/uaccess.h>
1937 -+#include <asm/mwait.h>
1938 - #include <asm/i387.h>
1939 - #include <asm/fpu-internal.h>
1940 - #include <asm/debugreg.h>
1941 -@@ -399,6 +400,49 @@ static void amd_e400_idle(void)
1942 - default_idle();
1943 - }
1944 + #else /* __ASSEMBLY__ */
1945
1946 -+/*
1947 -+ * Intel Core2 and older machines prefer MWAIT over HALT for C1.
1948 -+ * We can't rely on cpuidle installing MWAIT, because it will not load
1949 -+ * on systems that support only C1 -- so the boot default must be MWAIT.
1950 -+ *
1951 -+ * Some AMD machines are the opposite, they depend on using HALT.
1952 -+ *
1953 -+ * So for default C1, which is used during boot until cpuidle loads,
1954 -+ * use MWAIT-C1 on Intel HW that has it, else use HALT.
1955 -+ */
1956 -+static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
1957 -+{
1958 -+ if (c->x86_vendor != X86_VENDOR_INTEL)
1959 -+ return 0;
1960 -+
1961 -+ if (!cpu_has(c, X86_FEATURE_MWAIT))
1962 -+ return 0;
1963 -+
1964 -+ return 1;
1965 -+}
1966 ++#define kernel_cache(op, base) cache op, base
1967 ++#define kernel_ll(reg, addr) ll reg, addr
1968 ++#define kernel_sc(reg, addr) sc reg, addr
1969 ++#define kernel_lw(reg, addr) lw reg, addr
1970 ++#define kernel_lwl(reg, addr) lwl reg, addr
1971 ++#define kernel_lwr(reg, addr) lwr reg, addr
1972 ++#define kernel_lh(reg, addr) lh reg, addr
1973 ++#define kernel_lb(reg, addr) lb reg, addr
1974 ++#define kernel_lbu(reg, addr) lbu reg, addr
1975 ++#define kernel_sw(reg, addr) sw reg, addr
1976 ++#define kernel_swl(reg, addr) swl reg, addr
1977 ++#define kernel_swr(reg, addr) swr reg, addr
1978 ++#define kernel_sh(reg, addr) sh reg, addr
1979 ++#define kernel_sb(reg, addr) sb reg, addr
1980 +
1981 ++#ifdef CONFIG_32BIT
1982 +/*
1983 -+ * MONITOR/MWAIT with no hints, used for default default C1 state.
1984 -+ * This invokes MWAIT with interrutps enabled and no flags,
1985 -+ * which is backwards compatible with the original MWAIT implementation.
1986 ++ * No 'sd' or 'ld' instructions in 32-bit but the code will
1987 ++ * do the correct thing
1988 + */
1989 ++#define kernel_sd(reg, addr) user_sw(reg, addr)
1990 ++#define kernel_ld(reg, addr) user_lw(reg, addr)
1991 ++#else
1992 ++#define kernel_sd(reg, addr) sd reg, addr
1993 ++#define kernel_ld(reg, addr) ld reg, addr
1994 ++#endif /* CONFIG_32BIT */
1995 +
1996 -+static void mwait_idle(void)
1997 -+{
1998 -+ if (!need_resched()) {
1999 -+ if (this_cpu_has(X86_BUG_CLFLUSH_MONITOR))
2000 -+ clflush((void *)&current_thread_info()->flags);
2001 -+
2002 -+ __monitor((void *)&current_thread_info()->flags, 0, 0);
2003 -+ smp_mb();
2004 -+ if (!need_resched())
2005 -+ __sti_mwait(0, 0);
2006 -+ else
2007 -+ local_irq_enable();
2008 -+ } else
2009 -+ local_irq_enable();
2010 -+}
2011 -+
2012 - void select_idle_routine(const struct cpuinfo_x86 *c)
2013 - {
2014 - #ifdef CONFIG_SMP
2015 -@@ -412,6 +456,9 @@ void select_idle_routine(const struct cpuinfo_x86 *c)
2016 - /* E400: APIC timer interrupt does not wake up CPU from C1e */
2017 - pr_info("using AMD E400 aware idle routine\n");
2018 - x86_idle = amd_e400_idle;
2019 -+ } else if (prefer_mwait_c1_over_halt(c)) {
2020 -+ pr_info("using mwait in idle threads\n");
2021 -+ x86_idle = mwait_idle;
2022 - } else
2023 - x86_idle = default_idle;
2024 - }
2025 ---
2026 -2.3.6
2027 -
2028 -
2029 -From aaa51337c5819599af0d1f6aba6a31639dd1c0a6 Mon Sep 17 00:00:00 2001
2030 -From: Mike Galbraith <bitbucket@××××××.de>
2031 -Date: Sat, 18 Jan 2014 17:14:44 +0100
2032 -Subject: [PATCH 016/219] sched/idle/x86: Optimize unnecessary mwait_idle()
2033 - resched IPIs
2034 -Cc: mpagano@g.o
2035 -
2036 -commit f8e617f4582995f7c25ef25b4167213120ad122b upstream.
2037 -
2038 -To fully take advantage of MWAIT, apparently the CLFLUSH instruction needs
2039 -another quirk on certain CPUs: proper barriers around it on certain machines.
2040 -
2041 -On a Q6600 SMP system, pipe-test scheduling performance, cross core,
2042 -improves significantly:
2043 -
2044 - 3.8.13 487.2 KHz 1.000
2045 - 3.13.0-master 415.5 KHz .852
2046 - 3.13.0-master+ 415.2 KHz .852 + restore mwait_idle
2047 - 3.13.0-master++ 488.5 KHz 1.002 + restore mwait_idle + IPI fix
2048 -
2049 -Since X86_BUG_CLFLUSH_MONITOR is already a quirk, don't create a separate
2050 -quirk for the extra smp_mb()s.
2051 -
2052 -Signed-off-by: Mike Galbraith <bitbucket@××××××.de>
2053 -Cc: Borislav Petkov <bp@××××××.de>
2054 -Cc: H. Peter Anvin <hpa@×××××.com>
2055 -Cc: Ian Malone <ibmalone@×××××.com>
2056 -Cc: Josh Boyer <jwboyer@××××××.com>
2057 -Cc: Len Brown <len.brown@×××××.com>
2058 -Cc: Len Brown <lenb@××××××.org>
2059 -Cc: Linus Torvalds <torvalds@××××××××××××××××.org>
2060 -Cc: Mike Galbraith <efault@×××.de>
2061 -Cc: Peter Zijlstra <peterz@×××××××××.org>
2062 -Cc: Thomas Gleixner <tglx@××××××××××.de>
2063 -Link: http://lkml.kernel.org/r/1390061684.5566.4.camel@×××××××××××××.net
2064 -[ Ported to recent kernel, added comments about the quirk. ]
2065 -Signed-off-by: Ingo Molnar <mingo@××××××.org>
2066 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
2067 -
2068 -Signed-off-by: Mike Pagano <mpagano@g.o>
2069 ----
2070 - arch/x86/kernel/process.c | 12 ++++++++----
2071 - 1 file changed, 8 insertions(+), 4 deletions(-)
2072 -
2073 -diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
2074 -index 65e1a90..a388bb8 100644
2075 ---- a/arch/x86/kernel/process.c
2076 -+++ b/arch/x86/kernel/process.c
2077 -@@ -429,18 +429,22 @@ static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
2078 -
2079 - static void mwait_idle(void)
2080 - {
2081 -- if (!need_resched()) {
2082 -- if (this_cpu_has(X86_BUG_CLFLUSH_MONITOR))
2083 -+ if (!current_set_polling_and_test()) {
2084 -+ if (this_cpu_has(X86_BUG_CLFLUSH_MONITOR)) {
2085 -+ smp_mb(); /* quirk */
2086 - clflush((void *)&current_thread_info()->flags);
2087 -+ smp_mb(); /* quirk */
2088 -+ }
2089 -
2090 - __monitor((void *)&current_thread_info()->flags, 0, 0);
2091 -- smp_mb();
2092 - if (!need_resched())
2093 - __sti_mwait(0, 0);
2094 - else
2095 - local_irq_enable();
2096 -- } else
2097 -+ } else {
2098 - local_irq_enable();
2099 -+ }
2100 -+ __current_clr_polling();
2101 - }
2102 -
2103 - void select_idle_routine(const struct cpuinfo_x86 *c)
2104 ---
2105 -2.3.6
2106 -
2107 -
2108 -From 6e4dd840cca3053125c3f55650df1a9313b91615 Mon Sep 17 00:00:00 2001
2109 -From: Peter Zijlstra <peterz@×××××××××.org>
2110 -Date: Sat, 11 Apr 2015 12:16:22 +0200
2111 -Subject: [PATCH 017/219] perf/x86/intel: Fix Core2,Atom,NHM,WSM cycles:pp
2112 - events
2113 -Cc: mpagano@g.o
2114 -
2115 -commit 517e6341fa123ec3a2f9ea78ad547be910529881 upstream.
2116 -
2117 -Ingo reported that cycles:pp didn't work for him on some machines.
2118 -
2119 -It turns out that in this commit:
2120 -
2121 - af4bdcf675cf perf/x86/intel: Disallow flags for most Core2/Atom/Nehalem/Westmere events
2122 -
2123 -Andi forgot to explicitly allow that event when he
2124 -disabled event flags for PEBS on those uarchs.
2125 -
2126 -Reported-by: Ingo Molnar <mingo@××××××.org>
2127 -Signed-off-by: Peter Zijlstra (Intel) <peterz@×××××××××.org>
2128 -Cc: Arnaldo Carvalho de Melo <acme@××××××.com>
2129 -Cc: Jiri Olsa <jolsa@××××××.com>
2130 -Cc: Linus Torvalds <torvalds@××××××××××××××××.org>
2131 -Cc: Peter Zijlstra <peterz@×××××××××.org>
2132 -Fixes: af4bdcf675cf ("perf/x86/intel: Disallow flags for most Core2/Atom/Nehalem/Westmere events")
2133 -Signed-off-by: Ingo Molnar <mingo@××××××.org>
2134 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
2135 -Signed-off-by: Mike Pagano <mpagano@g.o>
2136 ----
2137 - arch/x86/kernel/cpu/perf_event_intel_ds.c | 8 ++++++++
2138 - 1 file changed, 8 insertions(+)
2139 -
2140 -diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
2141 -index 0739833..666bcf1 100644
2142 ---- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
2143 -+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
2144 -@@ -557,6 +557,8 @@ struct event_constraint intel_core2_pebs_event_constraints[] = {
2145 - INTEL_FLAGS_UEVENT_CONSTRAINT(0x00c5, 0x1), /* BR_INST_RETIRED.MISPRED */
2146 - INTEL_FLAGS_UEVENT_CONSTRAINT(0x1fc7, 0x1), /* SIMD_INST_RETURED.ANY */
2147 - INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */
2148 -+ /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */
2149 -+ INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x01),
2150 - EVENT_CONSTRAINT_END
2151 - };
2152 -
2153 -@@ -564,6 +566,8 @@ struct event_constraint intel_atom_pebs_event_constraints[] = {
2154 - INTEL_FLAGS_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */
2155 - INTEL_FLAGS_UEVENT_CONSTRAINT(0x00c5, 0x1), /* MISPREDICTED_BRANCH_RETIRED */
2156 - INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */
2157 -+ /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */
2158 -+ INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x01),
2159 - EVENT_CONSTRAINT_END
2160 - };
2161 + #ifdef CONFIG_EVA
2162
2163 -@@ -587,6 +591,8 @@ struct event_constraint intel_nehalem_pebs_event_constraints[] = {
2164 - INTEL_FLAGS_UEVENT_CONSTRAINT(0x20c8, 0xf), /* ITLB_MISS_RETIRED */
2165 - INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */
2166 - INTEL_FLAGS_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */
2167 -+ /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */
2168 -+ INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x0f),
2169 - EVENT_CONSTRAINT_END
2170 - };
2171 + #define __BUILD_EVA_INSN(insn, reg, addr) \
2172 +@@ -101,31 +154,27 @@
2173 + #define user_sd(reg, addr) user_sw(reg, addr)
2174 + #else
2175
2176 -@@ -602,6 +608,8 @@ struct event_constraint intel_westmere_pebs_event_constraints[] = {
2177 - INTEL_FLAGS_UEVENT_CONSTRAINT(0x20c8, 0xf), /* ITLB_MISS_RETIRED */
2178 - INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */
2179 - INTEL_FLAGS_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */
2180 -+ /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */
2181 -+ INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x0f),
2182 - EVENT_CONSTRAINT_END
2183 - };
2184 +-#define user_cache(op, base) cache op, base
2185 +-#define user_ll(reg, addr) ll reg, addr
2186 +-#define user_sc(reg, addr) sc reg, addr
2187 +-#define user_lw(reg, addr) lw reg, addr
2188 +-#define user_lwl(reg, addr) lwl reg, addr
2189 +-#define user_lwr(reg, addr) lwr reg, addr
2190 +-#define user_lh(reg, addr) lh reg, addr
2191 +-#define user_lb(reg, addr) lb reg, addr
2192 +-#define user_lbu(reg, addr) lbu reg, addr
2193 +-#define user_sw(reg, addr) sw reg, addr
2194 +-#define user_swl(reg, addr) swl reg, addr
2195 +-#define user_swr(reg, addr) swr reg, addr
2196 +-#define user_sh(reg, addr) sh reg, addr
2197 +-#define user_sb(reg, addr) sb reg, addr
2198 ++#define user_cache(op, base) kernel_cache(op, base)
2199 ++#define user_ll(reg, addr) kernel_ll(reg, addr)
2200 ++#define user_sc(reg, addr) kernel_sc(reg, addr)
2201 ++#define user_lw(reg, addr) kernel_lw(reg, addr)
2202 ++#define user_lwl(reg, addr) kernel_lwl(reg, addr)
2203 ++#define user_lwr(reg, addr) kernel_lwr(reg, addr)
2204 ++#define user_lh(reg, addr) kernel_lh(reg, addr)
2205 ++#define user_lb(reg, addr) kernel_lb(reg, addr)
2206 ++#define user_lbu(reg, addr) kernel_lbu(reg, addr)
2207 ++#define user_sw(reg, addr) kernel_sw(reg, addr)
2208 ++#define user_swl(reg, addr) kernel_swl(reg, addr)
2209 ++#define user_swr(reg, addr) kernel_swr(reg, addr)
2210 ++#define user_sh(reg, addr) kernel_sh(reg, addr)
2211 ++#define user_sb(reg, addr) kernel_sb(reg, addr)
2212
2213 ---
2214 -2.3.6
2215 -
2216 -
2217 -From 5c966c4f563f8b10e276e43579c0f27ea2a3cef2 Mon Sep 17 00:00:00 2001
2218 -From: Linus Torvalds <torvalds@××××××××××××××××.org>
2219 -Date: Thu, 23 Apr 2015 08:33:59 -0700
2220 -Subject: [PATCH 018/219] x86: fix special __probe_kernel_write() tail zeroing
2221 - case
2222 -Cc: mpagano@g.o
2223 -
2224 -commit d869844bd081081bf537e806a44811884230643e upstream.
2225 -
2226 -Commit cae2a173fe94 ("x86: clean up/fix 'copy_in_user()' tail zeroing")
2227 -fixed the failure case tail zeroing of one special case of the x86-64
2228 -generic user-copy routine, namely when used for the user-to-user case
2229 -("copy_in_user()").
2230 -
2231 -But in the process it broke an even more unusual case: using the user
2232 -copy routine for kernel-to-kernel copying.
2233 -
2234 -Now, normally kernel-kernel copies are obviously done using memcpy(),
2235 -but we have a couple of special cases when we use the user-copy
2236 -functions. One is when we pass a kernel buffer to a regular user-buffer
2237 -routine, using set_fs(KERNEL_DS). That's a "normal" case, and continued
2238 -to work fine, because it never takes any faults (with the possible
2239 -exception of a silent and successful vmalloc fault).
2240 -
2241 -But Jan Beulich pointed out another, very unusual, special case: when we
2242 -use the user-copy routines not because it's a path that expects a user
2243 -pointer, but for a couple of ftrace/kgdb cases that want to do a kernel
2244 -copy, but do so using "unsafe" buffers, and use the user-copy routine to
2245 -gracefully handle faults. IOW, for probe_kernel_write().
2246 -
2247 -And that broke for the case of a faulting kernel destination, because we
2248 -saw the kernel destination and wanted to try to clear the tail of the
2249 -buffer. Which doesn't work, since that's what faults.
2250 -
2251 -This only triggers for things like kgdb and ftrace users (eg trying
2252 -setting a breakpoint on read-only memory), but it's definitely a bug.
2253 -The fix is to not compare against the kernel address start (TASK_SIZE),
2254 -but instead use the same limits "access_ok()" uses.
2255 -
2256 -Reported-and-tested-by: Jan Beulich <jbeulich@××××.com>
2257 -Signed-off-by: Linus Torvalds <torvalds@××××××××××××××××.org>
2258 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
2259 -Signed-off-by: Mike Pagano <mpagano@g.o>
2260 ----
2261 - arch/x86/lib/usercopy_64.c | 2 +-
2262 - 1 file changed, 1 insertion(+), 1 deletion(-)
2263 -
2264 -diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
2265 -index 1f33b3d..0a42327 100644
2266 ---- a/arch/x86/lib/usercopy_64.c
2267 -+++ b/arch/x86/lib/usercopy_64.c
2268 -@@ -82,7 +82,7 @@ copy_user_handle_tail(char *to, char *from, unsigned len)
2269 - clac();
2270 + #ifdef CONFIG_32BIT
2271 +-/*
2272 +- * No 'sd' or 'ld' instructions in 32-bit but the code will
2273 +- * do the correct thing
2274 +- */
2275 +-#define user_sd(reg, addr) user_sw(reg, addr)
2276 +-#define user_ld(reg, addr) user_lw(reg, addr)
2277 ++#define user_sd(reg, addr) kernel_sw(reg, addr)
2278 ++#define user_ld(reg, addr) kernel_lw(reg, addr)
2279 + #else
2280 +-#define user_sd(reg, addr) sd reg, addr
2281 +-#define user_ld(reg, addr) ld reg, addr
2282 ++#define user_sd(reg, addr) kernel_sd(reg, addr)
2283 ++#define user_ld(reg, addr) kernel_sd(reg, addr)
2284 + #endif /* CONFIG_32BIT */
2285
2286 - /* If the destination is a kernel buffer, we always clear the end */
2287 -- if ((unsigned long)to >= TASK_SIZE_MAX)
2288 -+ if (!__addr_ok(to))
2289 - memset(to, 0, len);
2290 - return len;
2291 - }
2292 ---
2293 -2.3.6
2294 -
2295 -
2296 -From 47b34f8519e8a009d3ba8506ea8c5e7fe4314a6d Mon Sep 17 00:00:00 2001
2297 -From: Nadav Amit <namit@××××××××××××××.il>
2298 -Date: Sun, 12 Apr 2015 21:47:15 +0300
2299 -Subject: [PATCH 019/219] KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save
2300 -Cc: mpagano@g.o
2301 -
2302 -commit 9e9c3fe40bcd28e3f98f0ad8408435f4503f2781 upstream.
2303 -
2304 -kvm_init_msr_list is currently called before hardware_setup. As a result,
2305 -vmx_mpx_supported always returns false when kvm_init_msr_list checks whether to
2306 -save MSR_IA32_BNDCFGS.
2307 -
2308 -Move kvm_init_msr_list after vmx_hardware_setup is called to fix this issue.
2309 -
2310 -Signed-off-by: Nadav Amit <namit@××××××××××××××.il>
2311 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
2312 -
2313 -Message-Id: <1428864435-4732-1-git-send-email-namit@××××××××××××××.il>
2314 -Signed-off-by: Paolo Bonzini <pbonzini@××××××.com>
2315 -Signed-off-by: Mike Pagano <mpagano@g.o>
2316 ----
2317 - arch/x86/kvm/x86.c | 10 ++++++++--
2318 - 1 file changed, 8 insertions(+), 2 deletions(-)
2319 -
2320 -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
2321 -index 32bf19e..e222ba5 100644
2322 ---- a/arch/x86/kvm/x86.c
2323 -+++ b/arch/x86/kvm/x86.c
2324 -@@ -5775,7 +5775,6 @@ int kvm_arch_init(void *opaque)
2325 - kvm_set_mmio_spte_mask();
2326 + #endif /* CONFIG_EVA */
2327 +diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
2328 +index dd083e9..9f26b07 100644
2329 +--- a/arch/mips/include/asm/fpu.h
2330 ++++ b/arch/mips/include/asm/fpu.h
2331 +@@ -170,6 +170,7 @@ static inline void lose_fpu(int save)
2332 + }
2333 + disable_msa();
2334 + clear_thread_flag(TIF_USEDMSA);
2335 ++ __disable_fpu();
2336 + } else if (is_fpu_owner()) {
2337 + if (save)
2338 + _save_fp(current);
2339 +diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
2340 +index ac4fc71..f722b05 100644
2341 +--- a/arch/mips/include/asm/kvm_host.h
2342 ++++ b/arch/mips/include/asm/kvm_host.h
2343 +@@ -322,6 +322,7 @@ enum mips_mmu_types {
2344 + #define T_TRAP 13 /* Trap instruction */
2345 + #define T_VCEI 14 /* Virtual coherency exception */
2346 + #define T_FPE 15 /* Floating point exception */
2347 ++#define T_MSADIS 21 /* MSA disabled exception */
2348 + #define T_WATCH 23 /* Watch address reference */
2349 + #define T_VCED 31 /* Virtual coherency data */
2350
2351 - kvm_x86_ops = ops;
2352 -- kvm_init_msr_list();
2353 +@@ -578,6 +579,7 @@ struct kvm_mips_callbacks {
2354 + int (*handle_syscall)(struct kvm_vcpu *vcpu);
2355 + int (*handle_res_inst)(struct kvm_vcpu *vcpu);
2356 + int (*handle_break)(struct kvm_vcpu *vcpu);
2357 ++ int (*handle_msa_disabled)(struct kvm_vcpu *vcpu);
2358 + int (*vm_init)(struct kvm *kvm);
2359 + int (*vcpu_init)(struct kvm_vcpu *vcpu);
2360 + int (*vcpu_setup)(struct kvm_vcpu *vcpu);
2361 +diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
2362 +index bbb6969..7659da2 100644
2363 +--- a/arch/mips/kernel/unaligned.c
2364 ++++ b/arch/mips/kernel/unaligned.c
2365 +@@ -109,10 +109,11 @@ static u32 unaligned_action;
2366 + extern void show_registers(struct pt_regs *regs);
2367
2368 - kvm_mmu_set_mask_ptes(PT_USER_MASK, PT_ACCESSED_MASK,
2369 - PT_DIRTY_MASK, PT64_NX_MASK, 0);
2370 -@@ -7209,7 +7208,14 @@ void kvm_arch_hardware_disable(void)
2371 + #ifdef __BIG_ENDIAN
2372 +-#define LoadHW(addr, value, res) \
2373 ++#define _LoadHW(addr, value, res, type) \
2374 ++do { \
2375 + __asm__ __volatile__ (".set\tnoat\n" \
2376 +- "1:\t"user_lb("%0", "0(%2)")"\n" \
2377 +- "2:\t"user_lbu("$1", "1(%2)")"\n\t" \
2378 ++ "1:\t"type##_lb("%0", "0(%2)")"\n" \
2379 ++ "2:\t"type##_lbu("$1", "1(%2)")"\n\t"\
2380 + "sll\t%0, 0x8\n\t" \
2381 + "or\t%0, $1\n\t" \
2382 + "li\t%1, 0\n" \
2383 +@@ -127,13 +128,15 @@ extern void show_registers(struct pt_regs *regs);
2384 + STR(PTR)"\t2b, 4b\n\t" \
2385 + ".previous" \
2386 + : "=&r" (value), "=r" (res) \
2387 +- : "r" (addr), "i" (-EFAULT));
2388 ++ : "r" (addr), "i" (-EFAULT)); \
2389 ++} while(0)
2390
2391 - int kvm_arch_hardware_setup(void)
2392 - {
2393 -- return kvm_x86_ops->hardware_setup();
2394 -+ int r;
2395 + #ifndef CONFIG_CPU_MIPSR6
2396 +-#define LoadW(addr, value, res) \
2397 ++#define _LoadW(addr, value, res, type) \
2398 ++do { \
2399 + __asm__ __volatile__ ( \
2400 +- "1:\t"user_lwl("%0", "(%2)")"\n" \
2401 +- "2:\t"user_lwr("%0", "3(%2)")"\n\t" \
2402 ++ "1:\t"type##_lwl("%0", "(%2)")"\n" \
2403 ++ "2:\t"type##_lwr("%0", "3(%2)")"\n\t"\
2404 + "li\t%1, 0\n" \
2405 + "3:\n\t" \
2406 + ".insn\n\t" \
2407 +@@ -146,21 +149,24 @@ extern void show_registers(struct pt_regs *regs);
2408 + STR(PTR)"\t2b, 4b\n\t" \
2409 + ".previous" \
2410 + : "=&r" (value), "=r" (res) \
2411 +- : "r" (addr), "i" (-EFAULT));
2412 ++ : "r" (addr), "i" (-EFAULT)); \
2413 ++} while(0)
2414 +
2415 -+ r = kvm_x86_ops->hardware_setup();
2416 -+ if (r != 0)
2417 -+ return r;
2418 + #else
2419 + /* MIPSR6 has no lwl instruction */
2420 +-#define LoadW(addr, value, res) \
2421 ++#define _LoadW(addr, value, res, type) \
2422 ++do { \
2423 + __asm__ __volatile__ ( \
2424 + ".set\tpush\n" \
2425 + ".set\tnoat\n\t" \
2426 +- "1:"user_lb("%0", "0(%2)")"\n\t" \
2427 +- "2:"user_lbu("$1", "1(%2)")"\n\t" \
2428 ++ "1:"type##_lb("%0", "0(%2)")"\n\t" \
2429 ++ "2:"type##_lbu("$1", "1(%2)")"\n\t" \
2430 + "sll\t%0, 0x8\n\t" \
2431 + "or\t%0, $1\n\t" \
2432 +- "3:"user_lbu("$1", "2(%2)")"\n\t" \
2433 ++ "3:"type##_lbu("$1", "2(%2)")"\n\t" \
2434 + "sll\t%0, 0x8\n\t" \
2435 + "or\t%0, $1\n\t" \
2436 +- "4:"user_lbu("$1", "3(%2)")"\n\t" \
2437 ++ "4:"type##_lbu("$1", "3(%2)")"\n\t" \
2438 + "sll\t%0, 0x8\n\t" \
2439 + "or\t%0, $1\n\t" \
2440 + "li\t%1, 0\n" \
2441 +@@ -178,14 +184,17 @@ extern void show_registers(struct pt_regs *regs);
2442 + STR(PTR)"\t4b, 11b\n\t" \
2443 + ".previous" \
2444 + : "=&r" (value), "=r" (res) \
2445 +- : "r" (addr), "i" (-EFAULT));
2446 ++ : "r" (addr), "i" (-EFAULT)); \
2447 ++} while(0)
2448 +
2449 -+ kvm_init_msr_list();
2450 -+ return 0;
2451 - }
2452 -
2453 - void kvm_arch_hardware_unsetup(void)
2454 ---
2455 -2.3.6
2456 -
2457 -
2458 -From 7362dcdba904cf6a1c3791c253f25f85390d45c0 Mon Sep 17 00:00:00 2001
2459 -From: Filipe Manana <fdmanana@××××.com>
2460 -Date: Mon, 23 Mar 2015 14:07:40 +0000
2461 -Subject: [PATCH 020/219] Btrfs: fix log tree corruption when fs mounted with
2462 - -o discard
2463 -Cc: mpagano@g.o
2464 -
2465 -commit dcc82f4783ad91d4ab654f89f37ae9291cdc846a upstream.
2466 -
2467 -While committing a transaction we free the log roots before we write the
2468 -new super block. Freeing the log roots implies marking the disk location
2469 -of every node/leaf (metadata extent) as pinned before the new super block
2470 -is written. This is to prevent the disk location of log metadata extents
2471 -from being reused before the new super block is written, otherwise we
2472 -would have a corrupted log tree if before the new super block is written
2473 -a crash/reboot happens and the location of any log tree metadata extent
2474 -ended up being reused and rewritten.
2475 -
2476 -Even though we pinned the log tree's metadata extents, we were issuing a
2477 -discard against them if the fs was mounted with the -o discard option,
2478 -resulting in corruption of the log tree if a crash/reboot happened before
2479 -writing the new super block - the next time the fs was mounted, during
2480 -the log replay process we would find nodes/leafs of the log btree with
2481 -a content full of zeroes, causing the process to fail and require the
2482 -use of the tool btrfs-zero-log to wipeout the log tree (and all data
2483 -previously fsynced becoming lost forever).
2484 -
2485 -Fix this by not doing a discard when pinning an extent. The discard will
2486 -be done later when it's safe (after the new super block is committed) at
2487 -extent-tree.c:btrfs_finish_extent_commit().
2488 -
2489 -Fixes: e688b7252f78 (Btrfs: fix extent pinning bugs in the tree log)
2490 -Signed-off-by: Filipe Manana <fdmanana@××××.com>
2491 -Signed-off-by: Chris Mason <clm@××.com>
2492 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
2493 -Signed-off-by: Mike Pagano <mpagano@g.o>
2494 ----
2495 - fs/btrfs/extent-tree.c | 5 ++---
2496 - 1 file changed, 2 insertions(+), 3 deletions(-)
2497 -
2498 -diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
2499 -index 8b353ad..0a795c9 100644
2500 ---- a/fs/btrfs/extent-tree.c
2501 -+++ b/fs/btrfs/extent-tree.c
2502 -@@ -6956,12 +6956,11 @@ static int __btrfs_free_reserved_extent(struct btrfs_root *root,
2503 - return -ENOSPC;
2504 - }
2505 + #endif /* CONFIG_CPU_MIPSR6 */
2506
2507 -- if (btrfs_test_opt(root, DISCARD))
2508 -- ret = btrfs_discard_extent(root, start, len, NULL);
2509 --
2510 - if (pin)
2511 - pin_down_extent(root, cache, start, len, 1);
2512 - else {
2513 -+ if (btrfs_test_opt(root, DISCARD))
2514 -+ ret = btrfs_discard_extent(root, start, len, NULL);
2515 - btrfs_add_free_space(cache, start, len);
2516 - btrfs_update_reserved_bytes(cache, len, RESERVE_FREE, delalloc);
2517 - }
2518 ---
2519 -2.3.6
2520 -
2521 -
2522 -From 1f6719c298def2c3440dc5e9ca9532053877fff7 Mon Sep 17 00:00:00 2001
2523 -From: David Sterba <dsterba@××××.cz>
2524 -Date: Wed, 25 Mar 2015 19:26:41 +0100
2525 -Subject: [PATCH 021/219] btrfs: don't accept bare namespace as a valid xattr
2526 -Cc: mpagano@g.o
2527 -
2528 -commit 3c3b04d10ff1811a27f86684ccd2f5ba6983211d upstream.
2529 -
2530 -Due to insufficient check in btrfs_is_valid_xattr, this unexpectedly
2531 -works:
2532 -
2533 - $ touch file
2534 - $ setfattr -n user. -v 1 file
2535 - $ getfattr -d file
2536 -user.="1"
2537 -
2538 -ie. the missing attribute name after the namespace.
2539 -
2540 -Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94291
2541 -Reported-by: William Douglas <william.douglas@×××××.com>
2542 -Signed-off-by: David Sterba <dsterba@××××.cz>
2543 -Signed-off-by: Chris Mason <clm@××.com>
2544 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
2545 -Signed-off-by: Mike Pagano <mpagano@g.o>
2546 ----
2547 - fs/btrfs/xattr.c | 53 +++++++++++++++++++++++++++++++++++++++--------------
2548 - 1 file changed, 39 insertions(+), 14 deletions(-)
2549 -
2550 -diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
2551 -index 883b936..45ea704 100644
2552 ---- a/fs/btrfs/xattr.c
2553 -+++ b/fs/btrfs/xattr.c
2554 -@@ -364,22 +364,42 @@ const struct xattr_handler *btrfs_xattr_handlers[] = {
2555 - /*
2556 - * Check if the attribute is in a supported namespace.
2557 - *
2558 -- * This applied after the check for the synthetic attributes in the system
2559 -+ * This is applied after the check for the synthetic attributes in the system
2560 - * namespace.
2561 - */
2562 --static bool btrfs_is_valid_xattr(const char *name)
2563 -+static int btrfs_is_valid_xattr(const char *name)
2564 - {
2565 -- return !strncmp(name, XATTR_SECURITY_PREFIX,
2566 -- XATTR_SECURITY_PREFIX_LEN) ||
2567 -- !strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) ||
2568 -- !strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) ||
2569 -- !strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) ||
2570 -- !strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN);
2571 -+ int len = strlen(name);
2572 -+ int prefixlen = 0;
2573 -+
2574 -+ if (!strncmp(name, XATTR_SECURITY_PREFIX,
2575 -+ XATTR_SECURITY_PREFIX_LEN))
2576 -+ prefixlen = XATTR_SECURITY_PREFIX_LEN;
2577 -+ else if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
2578 -+ prefixlen = XATTR_SYSTEM_PREFIX_LEN;
2579 -+ else if (!strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN))
2580 -+ prefixlen = XATTR_TRUSTED_PREFIX_LEN;
2581 -+ else if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN))
2582 -+ prefixlen = XATTR_USER_PREFIX_LEN;
2583 -+ else if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN))
2584 -+ prefixlen = XATTR_BTRFS_PREFIX_LEN;
2585 -+ else
2586 -+ return -EOPNOTSUPP;
2587 -+
2588 -+ /*
2589 -+ * The name cannot consist of just prefix
2590 -+ */
2591 -+ if (len <= prefixlen)
2592 -+ return -EINVAL;
2593 -+
2594 -+ return 0;
2595 - }
2596 -
2597 - ssize_t btrfs_getxattr(struct dentry *dentry, const char *name,
2598 - void *buffer, size_t size)
2599 - {
2600 -+ int ret;
2601 -+
2602 - /*
2603 - * If this is a request for a synthetic attribute in the system.*
2604 - * namespace use the generic infrastructure to resolve a handler
2605 -@@ -388,8 +408,9 @@ ssize_t btrfs_getxattr(struct dentry *dentry, const char *name,
2606 - if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
2607 - return generic_getxattr(dentry, name, buffer, size);
2608 -
2609 -- if (!btrfs_is_valid_xattr(name))
2610 -- return -EOPNOTSUPP;
2611 -+ ret = btrfs_is_valid_xattr(name);
2612 -+ if (ret)
2613 -+ return ret;
2614 - return __btrfs_getxattr(dentry->d_inode, name, buffer, size);
2615 - }
2616 -
2617 -@@ -397,6 +418,7 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
2618 - size_t size, int flags)
2619 - {
2620 - struct btrfs_root *root = BTRFS_I(dentry->d_inode)->root;
2621 -+ int ret;
2622 -
2623 - /*
2624 - * The permission on security.* and system.* is not checked
2625 -@@ -413,8 +435,9 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
2626 - if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
2627 - return generic_setxattr(dentry, name, value, size, flags);
2628 -
2629 -- if (!btrfs_is_valid_xattr(name))
2630 -- return -EOPNOTSUPP;
2631 -+ ret = btrfs_is_valid_xattr(name);
2632 -+ if (ret)
2633 -+ return ret;
2634 -
2635 - if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN))
2636 - return btrfs_set_prop(dentry->d_inode, name,
2637 -@@ -430,6 +453,7 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
2638 - int btrfs_removexattr(struct dentry *dentry, const char *name)
2639 - {
2640 - struct btrfs_root *root = BTRFS_I(dentry->d_inode)->root;
2641 -+ int ret;
2642 -
2643 - /*
2644 - * The permission on security.* and system.* is not checked
2645 -@@ -446,8 +470,9 @@ int btrfs_removexattr(struct dentry *dentry, const char *name)
2646 - if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
2647 - return generic_removexattr(dentry, name);
2648 -
2649 -- if (!btrfs_is_valid_xattr(name))
2650 -- return -EOPNOTSUPP;
2651 -+ ret = btrfs_is_valid_xattr(name);
2652 -+ if (ret)
2653 -+ return ret;
2654 +-#define LoadHWU(addr, value, res) \
2655 ++#define _LoadHWU(addr, value, res, type) \
2656 ++do { \
2657 + __asm__ __volatile__ ( \
2658 + ".set\tnoat\n" \
2659 +- "1:\t"user_lbu("%0", "0(%2)")"\n" \
2660 +- "2:\t"user_lbu("$1", "1(%2)")"\n\t" \
2661 ++ "1:\t"type##_lbu("%0", "0(%2)")"\n" \
2662 ++ "2:\t"type##_lbu("$1", "1(%2)")"\n\t"\
2663 + "sll\t%0, 0x8\n\t" \
2664 + "or\t%0, $1\n\t" \
2665 + "li\t%1, 0\n" \
2666 +@@ -201,13 +210,15 @@ extern void show_registers(struct pt_regs *regs);
2667 + STR(PTR)"\t2b, 4b\n\t" \
2668 + ".previous" \
2669 + : "=&r" (value), "=r" (res) \
2670 +- : "r" (addr), "i" (-EFAULT));
2671 ++ : "r" (addr), "i" (-EFAULT)); \
2672 ++} while(0)
2673
2674 - if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN))
2675 - return btrfs_set_prop(dentry->d_inode, name,
2676 ---
2677 -2.3.6
2678 -
2679 -
2680 -From 9301d5068d8732a0f2d787240270a1426d09ecf5 Mon Sep 17 00:00:00 2001
2681 -From: Filipe Manana <fdmanana@××××.com>
2682 -Date: Mon, 30 Mar 2015 18:23:59 +0100
2683 -Subject: [PATCH 022/219] Btrfs: fix inode eviction infinite loop after cloning
2684 - into it
2685 -Cc: mpagano@g.o
2686 -
2687 -commit ccccf3d67294714af2d72a6fd6fd7d73b01c9329 upstream.
2688 -
2689 -If we attempt to clone a 0 length region into a file we can end up
2690 -inserting a range in the inode's extent_io tree with a start offset
2691 -that is greater then the end offset, which triggers immediately the
2692 -following warning:
2693 -
2694 -[ 3914.619057] WARNING: CPU: 17 PID: 4199 at fs/btrfs/extent_io.c:435 insert_state+0x4b/0x10b [btrfs]()
2695 -[ 3914.620886] BTRFS: end < start 4095 4096
2696 -(...)
2697 -[ 3914.638093] Call Trace:
2698 -[ 3914.638636] [<ffffffff81425fd9>] dump_stack+0x4c/0x65
2699 -[ 3914.639620] [<ffffffff81045390>] warn_slowpath_common+0xa1/0xbb
2700 -[ 3914.640789] [<ffffffffa03ca44f>] ? insert_state+0x4b/0x10b [btrfs]
2701 -[ 3914.642041] [<ffffffff810453f0>] warn_slowpath_fmt+0x46/0x48
2702 -[ 3914.643236] [<ffffffffa03ca44f>] insert_state+0x4b/0x10b [btrfs]
2703 -[ 3914.644441] [<ffffffffa03ca729>] __set_extent_bit+0x107/0x3f4 [btrfs]
2704 -[ 3914.645711] [<ffffffffa03cb256>] lock_extent_bits+0x65/0x1bf [btrfs]
2705 -[ 3914.646914] [<ffffffff8142b2fb>] ? _raw_spin_unlock+0x28/0x33
2706 -[ 3914.648058] [<ffffffffa03cbac4>] ? test_range_bit+0xcc/0xde [btrfs]
2707 -[ 3914.650105] [<ffffffffa03cb3c3>] lock_extent+0x13/0x15 [btrfs]
2708 -[ 3914.651361] [<ffffffffa03db39e>] lock_extent_range+0x3d/0xcd [btrfs]
2709 -[ 3914.652761] [<ffffffffa03de1fe>] btrfs_ioctl_clone+0x278/0x388 [btrfs]
2710 -[ 3914.654128] [<ffffffff811226dd>] ? might_fault+0x58/0xb5
2711 -[ 3914.655320] [<ffffffffa03e0909>] btrfs_ioctl+0xb51/0x2195 [btrfs]
2712 -(...)
2713 -[ 3914.669271] ---[ end trace 14843d3e2e622fc1 ]---
2714 -
2715 -This later makes the inode eviction handler enter an infinite loop that
2716 -keeps dumping the following warning over and over:
2717 -
2718 -[ 3915.117629] WARNING: CPU: 22 PID: 4228 at fs/btrfs/extent_io.c:435 insert_state+0x4b/0x10b [btrfs]()
2719 -[ 3915.119913] BTRFS: end < start 4095 4096
2720 -(...)
2721 -[ 3915.137394] Call Trace:
2722 -[ 3915.137913] [<ffffffff81425fd9>] dump_stack+0x4c/0x65
2723 -[ 3915.139154] [<ffffffff81045390>] warn_slowpath_common+0xa1/0xbb
2724 -[ 3915.140316] [<ffffffffa03ca44f>] ? insert_state+0x4b/0x10b [btrfs]
2725 -[ 3915.141505] [<ffffffff810453f0>] warn_slowpath_fmt+0x46/0x48
2726 -[ 3915.142709] [<ffffffffa03ca44f>] insert_state+0x4b/0x10b [btrfs]
2727 -[ 3915.143849] [<ffffffffa03ca729>] __set_extent_bit+0x107/0x3f4 [btrfs]
2728 -[ 3915.145120] [<ffffffffa038c1e3>] ? btrfs_kill_super+0x17/0x23 [btrfs]
2729 -[ 3915.146352] [<ffffffff811548f6>] ? deactivate_locked_super+0x3b/0x50
2730 -[ 3915.147565] [<ffffffffa03cb256>] lock_extent_bits+0x65/0x1bf [btrfs]
2731 -[ 3915.148785] [<ffffffff8142b7e2>] ? _raw_write_unlock+0x28/0x33
2732 -[ 3915.149931] [<ffffffffa03bc325>] btrfs_evict_inode+0x196/0x482 [btrfs]
2733 -[ 3915.151154] [<ffffffff81168904>] evict+0xa0/0x148
2734 -[ 3915.152094] [<ffffffff811689e5>] dispose_list+0x39/0x43
2735 -[ 3915.153081] [<ffffffff81169564>] evict_inodes+0xdc/0xeb
2736 -[ 3915.154062] [<ffffffff81154418>] generic_shutdown_super+0x49/0xef
2737 -[ 3915.155193] [<ffffffff811546d1>] kill_anon_super+0x13/0x1e
2738 -[ 3915.156274] [<ffffffffa038c1e3>] btrfs_kill_super+0x17/0x23 [btrfs]
2739 -(...)
2740 -[ 3915.167404] ---[ end trace 14843d3e2e622fc2 ]---
2741 -
2742 -So just bail out of the clone ioctl if the length of the region to clone
2743 -is zero, without locking any extent range, in order to prevent this issue
2744 -(same behaviour as a pwrite with a 0 length for example).
2745 -
2746 -This is trivial to reproduce. For example, the steps for the test I just
2747 -made for fstests:
2748 -
2749 - mkfs.btrfs -f SCRATCH_DEV
2750 - mount SCRATCH_DEV $SCRATCH_MNT
2751 -
2752 - touch $SCRATCH_MNT/foo
2753 - touch $SCRATCH_MNT/bar
2754 -
2755 - $CLONER_PROG -s 0 -d 4096 -l 0 $SCRATCH_MNT/foo $SCRATCH_MNT/bar
2756 - umount $SCRATCH_MNT
2757 -
2758 -A test case for fstests follows soon.
2759 -
2760 -Signed-off-by: Filipe Manana <fdmanana@××××.com>
2761 -Reviewed-by: Omar Sandoval <osandov@×××××××.com>
2762 -Signed-off-by: Chris Mason <clm@××.com>
2763 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
2764 -Signed-off-by: Mike Pagano <mpagano@g.o>
2765 ----
2766 - fs/btrfs/ioctl.c | 5 +++++
2767 - 1 file changed, 5 insertions(+)
2768 -
2769 -diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
2770 -index 74609b9..a09d3b8 100644
2771 ---- a/fs/btrfs/ioctl.c
2772 -+++ b/fs/btrfs/ioctl.c
2773 -@@ -3626,6 +3626,11 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
2774 - if (off + len == src->i_size)
2775 - len = ALIGN(src->i_size, bs) - off;
2776 + #ifndef CONFIG_CPU_MIPSR6
2777 +-#define LoadWU(addr, value, res) \
2778 ++#define _LoadWU(addr, value, res, type) \
2779 ++do { \
2780 + __asm__ __volatile__ ( \
2781 +- "1:\t"user_lwl("%0", "(%2)")"\n" \
2782 +- "2:\t"user_lwr("%0", "3(%2)")"\n\t" \
2783 ++ "1:\t"type##_lwl("%0", "(%2)")"\n" \
2784 ++ "2:\t"type##_lwr("%0", "3(%2)")"\n\t"\
2785 + "dsll\t%0, %0, 32\n\t" \
2786 + "dsrl\t%0, %0, 32\n\t" \
2787 + "li\t%1, 0\n" \
2788 +@@ -222,9 +233,11 @@ extern void show_registers(struct pt_regs *regs);
2789 + STR(PTR)"\t2b, 4b\n\t" \
2790 + ".previous" \
2791 + : "=&r" (value), "=r" (res) \
2792 +- : "r" (addr), "i" (-EFAULT));
2793 ++ : "r" (addr), "i" (-EFAULT)); \
2794 ++} while(0)
2795
2796 -+ if (len == 0) {
2797 -+ ret = 0;
2798 -+ goto out_unlock;
2799 -+ }
2800 +-#define LoadDW(addr, value, res) \
2801 ++#define _LoadDW(addr, value, res) \
2802 ++do { \
2803 + __asm__ __volatile__ ( \
2804 + "1:\tldl\t%0, (%2)\n" \
2805 + "2:\tldr\t%0, 7(%2)\n\t" \
2806 +@@ -240,21 +253,24 @@ extern void show_registers(struct pt_regs *regs);
2807 + STR(PTR)"\t2b, 4b\n\t" \
2808 + ".previous" \
2809 + : "=&r" (value), "=r" (res) \
2810 +- : "r" (addr), "i" (-EFAULT));
2811 ++ : "r" (addr), "i" (-EFAULT)); \
2812 ++} while(0)
2813 +
2814 - /* verify the end result is block aligned */
2815 - if (!IS_ALIGNED(off, bs) || !IS_ALIGNED(off + len, bs) ||
2816 - !IS_ALIGNED(destoff, bs))
2817 ---
2818 -2.3.6
2819 -
2820 -
2821 -From 68ea2629745f61ddf8a603970e74b294737bc5d7 Mon Sep 17 00:00:00 2001
2822 -From: Filipe Manana <fdmanana@××××.com>
2823 -Date: Mon, 30 Mar 2015 18:26:47 +0100
2824 -Subject: [PATCH 023/219] Btrfs: fix inode eviction infinite loop after
2825 - extent_same ioctl
2826 -Cc: mpagano@g.o
2827 -
2828 -commit 113e8283869b9855c8b999796aadd506bbac155f upstream.
2829 -
2830 -If we pass a length of 0 to the extent_same ioctl, we end up locking an
2831 -extent range with a start offset greater then its end offset (if the
2832 -destination file's offset is greater than zero). This results in a warning
2833 -from extent_io.c:insert_state through the following call chain:
2834 -
2835 - btrfs_extent_same()
2836 - btrfs_double_lock()
2837 - lock_extent_range()
2838 - lock_extent(inode->io_tree, offset, offset + len - 1)
2839 - lock_extent_bits()
2840 - __set_extent_bit()
2841 - insert_state()
2842 - --> WARN_ON(end < start)
2843 -
2844 -This leads to an infinite loop when evicting the inode. This is the same
2845 -problem that my previous patch titled
2846 -"Btrfs: fix inode eviction infinite loop after cloning into it" addressed
2847 -but for the extent_same ioctl instead of the clone ioctl.
2848 -
2849 -Signed-off-by: Filipe Manana <fdmanana@××××.com>
2850 -Reviewed-by: Omar Sandoval <osandov@×××××××.com>
2851 -Signed-off-by: Chris Mason <clm@××.com>
2852 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
2853 -Signed-off-by: Mike Pagano <mpagano@g.o>
2854 ----
2855 - fs/btrfs/ioctl.c | 3 +++
2856 - 1 file changed, 3 insertions(+)
2857 -
2858 -diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
2859 -index a09d3b8..f23d4be 100644
2860 ---- a/fs/btrfs/ioctl.c
2861 -+++ b/fs/btrfs/ioctl.c
2862 -@@ -2897,6 +2897,9 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 len,
2863 - if (src == dst)
2864 - return -EINVAL;
2865 + #else
2866 + /* MIPSR6 has not lwl and ldl instructions */
2867 +-#define LoadWU(addr, value, res) \
2868 ++#define _LoadWU(addr, value, res, type) \
2869 ++do { \
2870 + __asm__ __volatile__ ( \
2871 + ".set\tpush\n\t" \
2872 + ".set\tnoat\n\t" \
2873 +- "1:"user_lbu("%0", "0(%2)")"\n\t" \
2874 +- "2:"user_lbu("$1", "1(%2)")"\n\t" \
2875 ++ "1:"type##_lbu("%0", "0(%2)")"\n\t" \
2876 ++ "2:"type##_lbu("$1", "1(%2)")"\n\t" \
2877 + "sll\t%0, 0x8\n\t" \
2878 + "or\t%0, $1\n\t" \
2879 +- "3:"user_lbu("$1", "2(%2)")"\n\t" \
2880 ++ "3:"type##_lbu("$1", "2(%2)")"\n\t" \
2881 + "sll\t%0, 0x8\n\t" \
2882 + "or\t%0, $1\n\t" \
2883 +- "4:"user_lbu("$1", "3(%2)")"\n\t" \
2884 ++ "4:"type##_lbu("$1", "3(%2)")"\n\t" \
2885 + "sll\t%0, 0x8\n\t" \
2886 + "or\t%0, $1\n\t" \
2887 + "li\t%1, 0\n" \
2888 +@@ -272,9 +288,11 @@ extern void show_registers(struct pt_regs *regs);
2889 + STR(PTR)"\t4b, 11b\n\t" \
2890 + ".previous" \
2891 + : "=&r" (value), "=r" (res) \
2892 +- : "r" (addr), "i" (-EFAULT));
2893 ++ : "r" (addr), "i" (-EFAULT)); \
2894 ++} while(0)
2895
2896 -+ if (len == 0)
2897 -+ return 0;
2898 +-#define LoadDW(addr, value, res) \
2899 ++#define _LoadDW(addr, value, res) \
2900 ++do { \
2901 + __asm__ __volatile__ ( \
2902 + ".set\tpush\n\t" \
2903 + ".set\tnoat\n\t" \
2904 +@@ -319,16 +337,19 @@ extern void show_registers(struct pt_regs *regs);
2905 + STR(PTR)"\t8b, 11b\n\t" \
2906 + ".previous" \
2907 + : "=&r" (value), "=r" (res) \
2908 +- : "r" (addr), "i" (-EFAULT));
2909 ++ : "r" (addr), "i" (-EFAULT)); \
2910 ++} while(0)
2911 +
2912 - btrfs_double_lock(src, loff, dst, dst_loff, len);
2913 + #endif /* CONFIG_CPU_MIPSR6 */
2914
2915 - ret = extent_same_check_offsets(src, loff, len);
2916 ---
2917 -2.3.6
2918 -
2919 -
2920 -From 5683056e4853891106ae0a99938c96dfdc8fa881 Mon Sep 17 00:00:00 2001
2921 -From: Gerald Schaefer <gerald.schaefer@××××××.com>
2922 -Date: Tue, 14 Apr 2015 15:42:30 -0700
2923 -Subject: [PATCH 024/219] mm/hugetlb: use pmd_page() in follow_huge_pmd()
2924 -Cc: mpagano@g.o
2925 -
2926 -commit 97534127012f0e396eddea4691f4c9b170aed74b upstream.
2927 -
2928 -Commit 61f77eda9bbf ("mm/hugetlb: reduce arch dependent code around
2929 -follow_huge_*") broke follow_huge_pmd() on s390, where pmd and pte
2930 -layout differ and using pte_page() on a huge pmd will return wrong
2931 -results. Using pmd_page() instead fixes this.
2932 -
2933 -All architectures that were touched by that commit have pmd_page()
2934 -defined, so this should not break anything on other architectures.
2935 -
2936 -Fixes: 61f77eda "mm/hugetlb: reduce arch dependent code around follow_huge_*"
2937 -Signed-off-by: Gerald Schaefer <gerald.schaefer@××××××.com>
2938 -Acked-by: Naoya Horiguchi <n-horiguchi@×××××××××.com>
2939 -Cc: Hugh Dickins <hughd@××××××.com>
2940 -Cc: Michal Hocko <mhocko@××××.cz>
2941 -Cc: Andrea Arcangeli <aarcange@××××××.com>
2942 -Cc: Martin Schwidefsky <schwidefsky@××××××.com>
2943 -Acked-by: David Rientjes <rientjes@××××××.com>
2944 -Signed-off-by: Andrew Morton <akpm@××××××××××××××××.org>
2945 -Signed-off-by: Linus Torvalds <torvalds@××××××××××××××××.org>
2946 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
2947 -Signed-off-by: Mike Pagano <mpagano@g.o>
2948 ----
2949 - mm/hugetlb.c | 3 +--
2950 - 1 file changed, 1 insertion(+), 2 deletions(-)
2951 -
2952 -diff --git a/mm/hugetlb.c b/mm/hugetlb.c
2953 -index c41b2a0..caad3c5 100644
2954 ---- a/mm/hugetlb.c
2955 -+++ b/mm/hugetlb.c
2956 -@@ -3735,8 +3735,7 @@ retry:
2957 - if (!pmd_huge(*pmd))
2958 - goto out;
2959 - if (pmd_present(*pmd)) {
2960 -- page = pte_page(*(pte_t *)pmd) +
2961 -- ((address & ~PMD_MASK) >> PAGE_SHIFT);
2962 -+ page = pmd_page(*pmd) + ((address & ~PMD_MASK) >> PAGE_SHIFT);
2963 - if (flags & FOLL_GET)
2964 - get_page(page);
2965 - } else {
2966 ---
2967 -2.3.6
2968 -
2969 -
2970 -From 5cb46afa0f6d4c48714951dc856c404d79315a39 Mon Sep 17 00:00:00 2001
2971 -From: Scott Wood <scottwood@×××××××××.com>
2972 -Date: Fri, 10 Apr 2015 19:37:34 -0500
2973 -Subject: [PATCH 025/219] powerpc/hugetlb: Call mm_dec_nr_pmds() in
2974 - hugetlb_free_pmd_range()
2975 -Cc: mpagano@g.o
2976 -
2977 -commit 50c6a665b383cb5839e45d04e36faeeefaffa052 upstream.
2978 -
2979 -Commit dc6c9a35b66b5 ("mm: account pmd page tables to the process")
2980 -added a counter that is incremented whenever a PMD is allocated and
2981 -decremented whenever a PMD is freed. For hugepages on PPC, common code
2982 -is used to allocated PMDs, but arch-specific code is used to free PMDs.
2983 -
2984 -This results in kernel output such as "BUG: non-zero nr_pmds on freeing
2985 -mm: 1" when using hugepages.
2986 -
2987 -Update the PPC hugepage PMD freeing code to decrement the count, just
2988 -as the above commit did for free_pmd_range().
2989 -
2990 -Fixes: dc6c9a35b66b5 ("mm: account pmd page tables to the process")
2991 -Signed-off-by: Scott Wood <scottwood@×××××××××.com>
2992 -Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@××××××××××××××.com>
2993 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
2994 -Signed-off-by: Mike Pagano <mpagano@g.o>
2995 ----
2996 - arch/powerpc/mm/hugetlbpage.c | 1 +
2997 - 1 file changed, 1 insertion(+)
2998 -
2999 -diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
3000 -index 7e408bf..cecbe00 100644
3001 ---- a/arch/powerpc/mm/hugetlbpage.c
3002 -+++ b/arch/powerpc/mm/hugetlbpage.c
3003 -@@ -581,6 +581,7 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud,
3004 - pmd = pmd_offset(pud, start);
3005 - pud_clear(pud);
3006 - pmd_free_tlb(tlb, pmd, start);
3007 -+ mm_dec_nr_pmds(tlb->mm);
3008 - }
3009
3010 - static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
3011 ---
3012 -2.3.6
3013 -
3014 -
3015 -From 9297ed24421df19f5c5085d65ee2575a63524447 Mon Sep 17 00:00:00 2001
3016 -From: Andrzej Pietrasiewicz <andrzej.p@×××××××.com>
3017 -Date: Tue, 3 Mar 2015 10:52:05 +0100
3018 -Subject: [PATCH 026/219] usb: gadget: printer: enqueue printer's response for
3019 - setup request
3020 -Cc: mpagano@g.o
3021 -
3022 -commit eb132ccbdec5df46e29c9814adf76075ce83576b upstream.
3023 -
3024 -Function-specific setup requests should be handled in such a way, that
3025 -apart from filling in the data buffer, the requests are also actually
3026 -enqueued: if function-specific setup is called from composte_setup(),
3027 -the "usb_ep_queue()" block of code in composite_setup() is skipped.
3028 -
3029 -The printer function lacks this part and it results in e.g. get device id
3030 -requests failing: the host expects some response, the device prepares it
3031 -but does not equeue it for sending to the host, so the host finally asserts
3032 -timeout.
3033 -
3034 -This patch adds enqueueing the prepared responses.
3035 -
3036 -Fixes: 2e87edf49227: "usb: gadget: make g_printer use composite"
3037 -Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@×××××××.com>
3038 -Signed-off-by: Felipe Balbi <balbi@××.com>
3039 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
3040 -Signed-off-by: Mike Pagano <mpagano@g.o>
3041 ----
3042 - drivers/usb/gadget/legacy/printer.c | 9 +++++++++
3043 - 1 file changed, 9 insertions(+)
3044 -
3045 -diff --git a/drivers/usb/gadget/legacy/printer.c b/drivers/usb/gadget/legacy/printer.c
3046 -index 9054598..6385c19 100644
3047 ---- a/drivers/usb/gadget/legacy/printer.c
3048 -+++ b/drivers/usb/gadget/legacy/printer.c
3049 -@@ -1031,6 +1031,15 @@ unknown:
3050 - break;
3051 - }
3052 - /* host either stalls (value < 0) or reports success */
3053 -+ if (value >= 0) {
3054 -+ req->length = value;
3055 -+ req->zero = value < wLength;
3056 -+ value = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
3057 -+ if (value < 0) {
3058 -+ ERROR(dev, "%s:%d Error!\n", __func__, __LINE__);
3059 -+ req->status = 0;
3060 -+ }
3061 -+ }
3062 - return value;
3063 - }
3064 +-#define StoreHW(addr, value, res) \
3065 ++#define _StoreHW(addr, value, res, type) \
3066 ++do { \
3067 + __asm__ __volatile__ ( \
3068 + ".set\tnoat\n" \
3069 +- "1:\t"user_sb("%1", "1(%2)")"\n" \
3070 ++ "1:\t"type##_sb("%1", "1(%2)")"\n" \
3071 + "srl\t$1, %1, 0x8\n" \
3072 +- "2:\t"user_sb("$1", "0(%2)")"\n" \
3073 ++ "2:\t"type##_sb("$1", "0(%2)")"\n" \
3074 + ".set\tat\n\t" \
3075 + "li\t%0, 0\n" \
3076 + "3:\n\t" \
3077 +@@ -342,13 +363,15 @@ extern void show_registers(struct pt_regs *regs);
3078 + STR(PTR)"\t2b, 4b\n\t" \
3079 + ".previous" \
3080 + : "=r" (res) \
3081 +- : "r" (value), "r" (addr), "i" (-EFAULT));
3082 ++ : "r" (value), "r" (addr), "i" (-EFAULT));\
3083 ++} while(0)
3084
3085 ---
3086 -2.3.6
3087 -
3088 -
3089 -From bcdd54ffac32205938fa2cdd656604973275214b Mon Sep 17 00:00:00 2001
3090 -From: David Hildenbrand <dahi@××××××××××××××.com>
3091 -Date: Wed, 4 Feb 2015 15:53:42 +0100
3092 -Subject: [PATCH 027/219] KVM: s390: fix handling of write errors in the tpi
3093 - handler
3094 -Cc: mpagano@g.o
3095 -
3096 -commit 261520dcfcba93ca5dfe671b88ffab038cd940c8 upstream.
3097 -
3098 -If the I/O interrupt could not be written to the guest provided
3099 -area (e.g. access exception), a program exception was injected into the
3100 -guest but "inti" wasn't freed, therefore resulting in a memory leak.
3101 -
3102 -In addition, the I/O interrupt wasn't reinjected. Therefore the dequeued
3103 -interrupt is lost.
3104 -
3105 -This patch fixes the problem while cleaning up the function and making the
3106 -cc and rc logic easier to handle.
3107 -
3108 -Signed-off-by: David Hildenbrand <dahi@××××××××××××××.com>
3109 -Signed-off-by: Christian Borntraeger <borntraeger@××××××.com>
3110 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
3111 -Signed-off-by: Mike Pagano <mpagano@g.o>
3112 ----
3113 - arch/s390/kvm/priv.c | 40 +++++++++++++++++++++++-----------------
3114 - 1 file changed, 23 insertions(+), 17 deletions(-)
3115 -
3116 -diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
3117 -index 3511169..767149a 100644
3118 ---- a/arch/s390/kvm/priv.c
3119 -+++ b/arch/s390/kvm/priv.c
3120 -@@ -229,18 +229,19 @@ static int handle_tpi(struct kvm_vcpu *vcpu)
3121 - struct kvm_s390_interrupt_info *inti;
3122 - unsigned long len;
3123 - u32 tpi_data[3];
3124 -- int cc, rc;
3125 -+ int rc;
3126 - u64 addr;
3127 + #ifndef CONFIG_CPU_MIPSR6
3128 +-#define StoreW(addr, value, res) \
3129 ++#define _StoreW(addr, value, res, type) \
3130 ++do { \
3131 + __asm__ __volatile__ ( \
3132 +- "1:\t"user_swl("%1", "(%2)")"\n" \
3133 +- "2:\t"user_swr("%1", "3(%2)")"\n\t" \
3134 ++ "1:\t"type##_swl("%1", "(%2)")"\n" \
3135 ++ "2:\t"type##_swr("%1", "3(%2)")"\n\t"\
3136 + "li\t%0, 0\n" \
3137 + "3:\n\t" \
3138 + ".insn\n\t" \
3139 +@@ -361,9 +384,11 @@ extern void show_registers(struct pt_regs *regs);
3140 + STR(PTR)"\t2b, 4b\n\t" \
3141 + ".previous" \
3142 + : "=r" (res) \
3143 +- : "r" (value), "r" (addr), "i" (-EFAULT));
3144 ++ : "r" (value), "r" (addr), "i" (-EFAULT)); \
3145 ++} while(0)
3146
3147 -- rc = 0;
3148 - addr = kvm_s390_get_base_disp_s(vcpu);
3149 - if (addr & 3)
3150 - return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
3151 -- cc = 0;
3152 -+
3153 - inti = kvm_s390_get_io_int(vcpu->kvm, vcpu->arch.sie_block->gcr[6], 0);
3154 -- if (!inti)
3155 -- goto no_interrupt;
3156 -- cc = 1;
3157 -+ if (!inti) {
3158 -+ kvm_s390_set_psw_cc(vcpu, 0);
3159 -+ return 0;
3160 -+ }
3161 -+
3162 - tpi_data[0] = inti->io.subchannel_id << 16 | inti->io.subchannel_nr;
3163 - tpi_data[1] = inti->io.io_int_parm;
3164 - tpi_data[2] = inti->io.io_int_word;
3165 -@@ -251,30 +252,35 @@ static int handle_tpi(struct kvm_vcpu *vcpu)
3166 - */
3167 - len = sizeof(tpi_data) - 4;
3168 - rc = write_guest(vcpu, addr, &tpi_data, len);
3169 -- if (rc)
3170 -- return kvm_s390_inject_prog_cond(vcpu, rc);
3171 -+ if (rc) {
3172 -+ rc = kvm_s390_inject_prog_cond(vcpu, rc);
3173 -+ goto reinject_interrupt;
3174 -+ }
3175 - } else {
3176 - /*
3177 - * Store the three-word I/O interruption code into
3178 - * the appropriate lowcore area.
3179 - */
3180 - len = sizeof(tpi_data);
3181 -- if (write_guest_lc(vcpu, __LC_SUBCHANNEL_ID, &tpi_data, len))
3182 -+ if (write_guest_lc(vcpu, __LC_SUBCHANNEL_ID, &tpi_data, len)) {
3183 -+ /* failed writes to the low core are not recoverable */
3184 - rc = -EFAULT;
3185 -+ goto reinject_interrupt;
3186 -+ }
3187 - }
3188 +-#define StoreDW(addr, value, res) \
3189 ++#define _StoreDW(addr, value, res) \
3190 ++do { \
3191 + __asm__ __volatile__ ( \
3192 + "1:\tsdl\t%1,(%2)\n" \
3193 + "2:\tsdr\t%1, 7(%2)\n\t" \
3194 +@@ -379,20 +404,23 @@ extern void show_registers(struct pt_regs *regs);
3195 + STR(PTR)"\t2b, 4b\n\t" \
3196 + ".previous" \
3197 + : "=r" (res) \
3198 +- : "r" (value), "r" (addr), "i" (-EFAULT));
3199 ++ : "r" (value), "r" (addr), "i" (-EFAULT)); \
3200 ++} while(0)
3201 +
3202 -+ /* irq was successfully handed to the guest */
3203 -+ kfree(inti);
3204 -+ kvm_s390_set_psw_cc(vcpu, 1);
3205 -+ return 0;
3206 -+reinject_interrupt:
3207 - /*
3208 - * If we encounter a problem storing the interruption code, the
3209 - * instruction is suppressed from the guest's view: reinject the
3210 - * interrupt.
3211 - */
3212 -- if (!rc)
3213 -- kfree(inti);
3214 -- else
3215 -- kvm_s390_reinject_io_int(vcpu->kvm, inti);
3216 --no_interrupt:
3217 -- /* Set condition code and we're done. */
3218 -- if (!rc)
3219 -- kvm_s390_set_psw_cc(vcpu, cc);
3220 -+ kvm_s390_reinject_io_int(vcpu->kvm, inti);
3221 -+ /* don't set the cc, a pgm irq was injected or we drop to user space */
3222 - return rc ? -EFAULT : 0;
3223 - }
3224 -
3225 ---
3226 -2.3.6
3227 -
3228 -
3229 -From 98529eff3f93a3179a35f9ae459e21f64e8be813 Mon Sep 17 00:00:00 2001
3230 -From: David Hildenbrand <dahi@××××××××××××××.com>
3231 -Date: Wed, 4 Feb 2015 15:59:11 +0100
3232 -Subject: [PATCH 028/219] KVM: s390: reinjection of irqs can fail in the tpi
3233 - handler
3234 -Cc: mpagano@g.o
3235 -
3236 -commit 15462e37ca848abac7477dece65f8af25febd744 upstream.
3237 -
3238 -The reinjection of an I/O interrupt can fail if the list is at the limit
3239 -and between the dequeue and the reinjection, another I/O interrupt is
3240 -injected (e.g. if user space floods kvm with I/O interrupts).
3241 -
3242 -This patch avoids this memory leak and returns -EFAULT in this special
3243 -case. This error is not recoverable, so let's fail hard. This can later
3244 -be avoided by not dequeuing the interrupt but working directly on the
3245 -locked list.
3246 -
3247 -Signed-off-by: David Hildenbrand <dahi@××××××××××××××.com>
3248 -Signed-off-by: Christian Borntraeger <borntraeger@××××××.com>
3249 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
3250 -Signed-off-by: Mike Pagano <mpagano@g.o>
3251 ----
3252 - arch/s390/kvm/interrupt.c | 4 ++--
3253 - arch/s390/kvm/kvm-s390.h | 4 ++--
3254 - arch/s390/kvm/priv.c | 5 ++++-
3255 - 3 files changed, 8 insertions(+), 5 deletions(-)
3256 -
3257 -diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
3258 -index 073b5f3..e7a46e8 100644
3259 ---- a/arch/s390/kvm/interrupt.c
3260 -+++ b/arch/s390/kvm/interrupt.c
3261 -@@ -1332,10 +1332,10 @@ int kvm_s390_inject_vm(struct kvm *kvm,
3262 - return rc;
3263 - }
3264 + #else
3265 + /* MIPSR6 has no swl and sdl instructions */
3266 +-#define StoreW(addr, value, res) \
3267 ++#define _StoreW(addr, value, res, type) \
3268 ++do { \
3269 + __asm__ __volatile__ ( \
3270 + ".set\tpush\n\t" \
3271 + ".set\tnoat\n\t" \
3272 +- "1:"user_sb("%1", "3(%2)")"\n\t" \
3273 ++ "1:"type##_sb("%1", "3(%2)")"\n\t" \
3274 + "srl\t$1, %1, 0x8\n\t" \
3275 +- "2:"user_sb("$1", "2(%2)")"\n\t" \
3276 ++ "2:"type##_sb("$1", "2(%2)")"\n\t" \
3277 + "srl\t$1, $1, 0x8\n\t" \
3278 +- "3:"user_sb("$1", "1(%2)")"\n\t" \
3279 ++ "3:"type##_sb("$1", "1(%2)")"\n\t" \
3280 + "srl\t$1, $1, 0x8\n\t" \
3281 +- "4:"user_sb("$1", "0(%2)")"\n\t" \
3282 ++ "4:"type##_sb("$1", "0(%2)")"\n\t" \
3283 + ".set\tpop\n\t" \
3284 + "li\t%0, 0\n" \
3285 + "10:\n\t" \
3286 +@@ -409,9 +437,11 @@ extern void show_registers(struct pt_regs *regs);
3287 + ".previous" \
3288 + : "=&r" (res) \
3289 + : "r" (value), "r" (addr), "i" (-EFAULT) \
3290 +- : "memory");
3291 ++ : "memory"); \
3292 ++} while(0)
3293
3294 --void kvm_s390_reinject_io_int(struct kvm *kvm,
3295 -+int kvm_s390_reinject_io_int(struct kvm *kvm,
3296 - struct kvm_s390_interrupt_info *inti)
3297 - {
3298 -- __inject_vm(kvm, inti);
3299 -+ return __inject_vm(kvm, inti);
3300 - }
3301 + #define StoreDW(addr, value, res) \
3302 ++do { \
3303 + __asm__ __volatile__ ( \
3304 + ".set\tpush\n\t" \
3305 + ".set\tnoat\n\t" \
3306 +@@ -451,15 +481,18 @@ extern void show_registers(struct pt_regs *regs);
3307 + ".previous" \
3308 + : "=&r" (res) \
3309 + : "r" (value), "r" (addr), "i" (-EFAULT) \
3310 +- : "memory");
3311 ++ : "memory"); \
3312 ++} while(0)
3313 ++
3314 + #endif /* CONFIG_CPU_MIPSR6 */
3315
3316 - int s390int_to_s390irq(struct kvm_s390_interrupt *s390int,
3317 -diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
3318 -index c34109a..6995a30 100644
3319 ---- a/arch/s390/kvm/kvm-s390.h
3320 -+++ b/arch/s390/kvm/kvm-s390.h
3321 -@@ -151,8 +151,8 @@ int __must_check kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu,
3322 - int __must_check kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code);
3323 - struct kvm_s390_interrupt_info *kvm_s390_get_io_int(struct kvm *kvm,
3324 - u64 cr6, u64 schid);
3325 --void kvm_s390_reinject_io_int(struct kvm *kvm,
3326 -- struct kvm_s390_interrupt_info *inti);
3327 -+int kvm_s390_reinject_io_int(struct kvm *kvm,
3328 -+ struct kvm_s390_interrupt_info *inti);
3329 - int kvm_s390_mask_adapter(struct kvm *kvm, unsigned int id, bool masked);
3330 + #else /* __BIG_ENDIAN */
3331
3332 - /* implemented in intercept.c */
3333 -diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
3334 -index 767149a..613e9f0 100644
3335 ---- a/arch/s390/kvm/priv.c
3336 -+++ b/arch/s390/kvm/priv.c
3337 -@@ -279,7 +279,10 @@ reinject_interrupt:
3338 - * instruction is suppressed from the guest's view: reinject the
3339 - * interrupt.
3340 - */
3341 -- kvm_s390_reinject_io_int(vcpu->kvm, inti);
3342 -+ if (kvm_s390_reinject_io_int(vcpu->kvm, inti)) {
3343 -+ kfree(inti);
3344 -+ rc = -EFAULT;
3345 -+ }
3346 - /* don't set the cc, a pgm irq was injected or we drop to user space */
3347 - return rc ? -EFAULT : 0;
3348 - }
3349 ---
3350 -2.3.6
3351 -
3352 -
3353 -From 7f1a4ebee923455bb5f50ab4ce832194dff859a7 Mon Sep 17 00:00:00 2001
3354 -From: Ekaterina Tumanova <tumanova@××××××××××××××.com>
3355 -Date: Tue, 3 Mar 2015 09:54:41 +0100
3356 -Subject: [PATCH 029/219] KVM: s390: Zero out current VMDB of STSI before
3357 - including level3 data.
3358 -Cc: mpagano@g.o
3359 -
3360 -commit b75f4c9afac2604feb971441116c07a24ecca1ec upstream.
3361 -
3362 -s390 documentation requires words 0 and 10-15 to be reserved and stored as
3363 -zeros. As we fill out all other fields, we can memset the full structure.
3364 -
3365 -Signed-off-by: Ekaterina Tumanova <tumanova@××××××××××××××.com>
3366 -Reviewed-by: David Hildenbrand <dahi@××××××××××××××.com>
3367 -Signed-off-by: Christian Borntraeger <borntraeger@××××××.com>
3368 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
3369 -Signed-off-by: Mike Pagano <mpagano@g.o>
3370 ----
3371 - arch/s390/kvm/priv.c | 1 +
3372 - 1 file changed, 1 insertion(+)
3373 -
3374 -diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
3375 -index 613e9f0..b982fbc 100644
3376 ---- a/arch/s390/kvm/priv.c
3377 -+++ b/arch/s390/kvm/priv.c
3378 -@@ -476,6 +476,7 @@ static void handle_stsi_3_2_2(struct kvm_vcpu *vcpu, struct sysinfo_3_2_2 *mem)
3379 - for (n = mem->count - 1; n > 0 ; n--)
3380 - memcpy(&mem->vm[n], &mem->vm[n - 1], sizeof(mem->vm[0]));
3381 +-#define LoadHW(addr, value, res) \
3382 ++#define _LoadHW(addr, value, res, type) \
3383 ++do { \
3384 + __asm__ __volatile__ (".set\tnoat\n" \
3385 +- "1:\t"user_lb("%0", "1(%2)")"\n" \
3386 +- "2:\t"user_lbu("$1", "0(%2)")"\n\t" \
3387 ++ "1:\t"type##_lb("%0", "1(%2)")"\n" \
3388 ++ "2:\t"type##_lbu("$1", "0(%2)")"\n\t"\
3389 + "sll\t%0, 0x8\n\t" \
3390 + "or\t%0, $1\n\t" \
3391 + "li\t%1, 0\n" \
3392 +@@ -474,13 +507,15 @@ extern void show_registers(struct pt_regs *regs);
3393 + STR(PTR)"\t2b, 4b\n\t" \
3394 + ".previous" \
3395 + : "=&r" (value), "=r" (res) \
3396 +- : "r" (addr), "i" (-EFAULT));
3397 ++ : "r" (addr), "i" (-EFAULT)); \
3398 ++} while(0)
3399
3400 -+ memset(&mem->vm[0], 0, sizeof(mem->vm[0]));
3401 - mem->vm[0].cpus_total = cpus;
3402 - mem->vm[0].cpus_configured = cpus;
3403 - mem->vm[0].cpus_standby = 0;
3404 ---
3405 -2.3.6
3406 -
3407 -
3408 -From 4756129f7d1bf8fa4ff6011a39f729f5d3bc64c4 Mon Sep 17 00:00:00 2001
3409 -From: Jens Freimann <jfrei@××××××××××××××.com>
3410 -Date: Mon, 16 Mar 2015 12:17:13 +0100
3411 -Subject: [PATCH 030/219] KVM: s390: fix get_all_floating_irqs
3412 -Cc: mpagano@g.o
3413 -
3414 -commit 94aa033efcac47b09db22cb561e135baf37b7887 upstream.
3415 -
3416 -This fixes a bug introduced with commit c05c4186bbe4 ("KVM: s390:
3417 -add floating irq controller").
3418 -
3419 -get_all_floating_irqs() does copy_to_user() while holding
3420 -a spin lock. Let's fix this by filling a temporary buffer
3421 -first and copy it to userspace after giving up the lock.
3422 -
3423 -Reviewed-by: David Hildenbrand <dahi@××××××××××××××.com>
3424 -Signed-off-by: Jens Freimann <jfrei@××××××××××××××.com>
3425 -Signed-off-by: Christian Borntraeger <borntraeger@××××××.com>
3426 -Acked-by: Cornelia Huck <cornelia.huck@××××××.com>
3427 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
3428 -Signed-off-by: Mike Pagano <mpagano@g.o>
3429 ----
3430 - Documentation/virtual/kvm/devices/s390_flic.txt | 3 ++
3431 - arch/s390/kvm/interrupt.c | 58 ++++++++++++++-----------
3432 - 2 files changed, 35 insertions(+), 26 deletions(-)
3433 -
3434 -diff --git a/Documentation/virtual/kvm/devices/s390_flic.txt b/Documentation/virtual/kvm/devices/s390_flic.txt
3435 -index 4ceef53..d1ad9d5 100644
3436 ---- a/Documentation/virtual/kvm/devices/s390_flic.txt
3437 -+++ b/Documentation/virtual/kvm/devices/s390_flic.txt
3438 -@@ -27,6 +27,9 @@ Groups:
3439 - Copies all floating interrupts into a buffer provided by userspace.
3440 - When the buffer is too small it returns -ENOMEM, which is the indication
3441 - for userspace to try again with a bigger buffer.
3442 -+ -ENOBUFS is returned when the allocation of a kernelspace buffer has
3443 -+ failed.
3444 -+ -EFAULT is returned when copying data to userspace failed.
3445 - All interrupts remain pending, i.e. are not deleted from the list of
3446 - currently pending interrupts.
3447 - attr->addr contains the userspace address of the buffer into which all
3448 -diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
3449 -index e7a46e8..e7bc2fd 100644
3450 ---- a/arch/s390/kvm/interrupt.c
3451 -+++ b/arch/s390/kvm/interrupt.c
3452 -@@ -17,6 +17,7 @@
3453 - #include <linux/signal.h>
3454 - #include <linux/slab.h>
3455 - #include <linux/bitmap.h>
3456 -+#include <linux/vmalloc.h>
3457 - #include <asm/asm-offsets.h>
3458 - #include <asm/uaccess.h>
3459 - #include <asm/sclp.h>
3460 -@@ -1455,61 +1456,66 @@ void kvm_s390_clear_float_irqs(struct kvm *kvm)
3461 - spin_unlock(&fi->lock);
3462 - }
3463 -
3464 --static inline int copy_irq_to_user(struct kvm_s390_interrupt_info *inti,
3465 -- u8 *addr)
3466 -+static void inti_to_irq(struct kvm_s390_interrupt_info *inti,
3467 -+ struct kvm_s390_irq *irq)
3468 - {
3469 -- struct kvm_s390_irq __user *uptr = (struct kvm_s390_irq __user *) addr;
3470 -- struct kvm_s390_irq irq = {0};
3471 --
3472 -- irq.type = inti->type;
3473 -+ irq->type = inti->type;
3474 - switch (inti->type) {
3475 - case KVM_S390_INT_PFAULT_INIT:
3476 - case KVM_S390_INT_PFAULT_DONE:
3477 - case KVM_S390_INT_VIRTIO:
3478 - case KVM_S390_INT_SERVICE:
3479 -- irq.u.ext = inti->ext;
3480 -+ irq->u.ext = inti->ext;
3481 - break;
3482 - case KVM_S390_INT_IO_MIN...KVM_S390_INT_IO_MAX:
3483 -- irq.u.io = inti->io;
3484 -+ irq->u.io = inti->io;
3485 - break;
3486 - case KVM_S390_MCHK:
3487 -- irq.u.mchk = inti->mchk;
3488 -+ irq->u.mchk = inti->mchk;
3489 - break;
3490 -- default:
3491 -- return -EINVAL;
3492 - }
3493 --
3494 -- if (copy_to_user(uptr, &irq, sizeof(irq)))
3495 -- return -EFAULT;
3496 --
3497 -- return 0;
3498 - }
3499 -
3500 --static int get_all_floating_irqs(struct kvm *kvm, __u8 *buf, __u64 len)
3501 -+static int get_all_floating_irqs(struct kvm *kvm, u8 __user *usrbuf, u64 len)
3502 - {
3503 - struct kvm_s390_interrupt_info *inti;
3504 - struct kvm_s390_float_interrupt *fi;
3505 -+ struct kvm_s390_irq *buf;
3506 -+ int max_irqs;
3507 - int ret = 0;
3508 - int n = 0;
3509 -
3510 -+ if (len > KVM_S390_FLIC_MAX_BUFFER || len == 0)
3511 -+ return -EINVAL;
3512 -+
3513 -+ /*
3514 -+ * We are already using -ENOMEM to signal
3515 -+ * userspace it may retry with a bigger buffer,
3516 -+ * so we need to use something else for this case
3517 -+ */
3518 -+ buf = vzalloc(len);
3519 -+ if (!buf)
3520 -+ return -ENOBUFS;
3521 + #ifndef CONFIG_CPU_MIPSR6
3522 +-#define LoadW(addr, value, res) \
3523 ++#define _LoadW(addr, value, res, type) \
3524 ++do { \
3525 + __asm__ __volatile__ ( \
3526 +- "1:\t"user_lwl("%0", "3(%2)")"\n" \
3527 +- "2:\t"user_lwr("%0", "(%2)")"\n\t" \
3528 ++ "1:\t"type##_lwl("%0", "3(%2)")"\n" \
3529 ++ "2:\t"type##_lwr("%0", "(%2)")"\n\t"\
3530 + "li\t%1, 0\n" \
3531 + "3:\n\t" \
3532 + ".insn\n\t" \
3533 +@@ -493,21 +528,24 @@ extern void show_registers(struct pt_regs *regs);
3534 + STR(PTR)"\t2b, 4b\n\t" \
3535 + ".previous" \
3536 + : "=&r" (value), "=r" (res) \
3537 +- : "r" (addr), "i" (-EFAULT));
3538 ++ : "r" (addr), "i" (-EFAULT)); \
3539 ++} while(0)
3540 +
3541 -+ max_irqs = len / sizeof(struct kvm_s390_irq);
3542 + #else
3543 + /* MIPSR6 has no lwl instruction */
3544 +-#define LoadW(addr, value, res) \
3545 ++#define _LoadW(addr, value, res, type) \
3546 ++do { \
3547 + __asm__ __volatile__ ( \
3548 + ".set\tpush\n" \
3549 + ".set\tnoat\n\t" \
3550 +- "1:"user_lb("%0", "3(%2)")"\n\t" \
3551 +- "2:"user_lbu("$1", "2(%2)")"\n\t" \
3552 ++ "1:"type##_lb("%0", "3(%2)")"\n\t" \
3553 ++ "2:"type##_lbu("$1", "2(%2)")"\n\t" \
3554 + "sll\t%0, 0x8\n\t" \
3555 + "or\t%0, $1\n\t" \
3556 +- "3:"user_lbu("$1", "1(%2)")"\n\t" \
3557 ++ "3:"type##_lbu("$1", "1(%2)")"\n\t" \
3558 + "sll\t%0, 0x8\n\t" \
3559 + "or\t%0, $1\n\t" \
3560 +- "4:"user_lbu("$1", "0(%2)")"\n\t" \
3561 ++ "4:"type##_lbu("$1", "0(%2)")"\n\t" \
3562 + "sll\t%0, 0x8\n\t" \
3563 + "or\t%0, $1\n\t" \
3564 + "li\t%1, 0\n" \
3565 +@@ -525,15 +563,18 @@ extern void show_registers(struct pt_regs *regs);
3566 + STR(PTR)"\t4b, 11b\n\t" \
3567 + ".previous" \
3568 + : "=&r" (value), "=r" (res) \
3569 +- : "r" (addr), "i" (-EFAULT));
3570 ++ : "r" (addr), "i" (-EFAULT)); \
3571 ++} while(0)
3572 +
3573 - fi = &kvm->arch.float_int;
3574 - spin_lock(&fi->lock);
3575 --
3576 - list_for_each_entry(inti, &fi->list, list) {
3577 -- if (len < sizeof(struct kvm_s390_irq)) {
3578 -+ if (n == max_irqs) {
3579 - /* signal userspace to try again */
3580 - ret = -ENOMEM;
3581 - break;
3582 - }
3583 -- ret = copy_irq_to_user(inti, buf);
3584 -- if (ret)
3585 -- break;
3586 -- buf += sizeof(struct kvm_s390_irq);
3587 -- len -= sizeof(struct kvm_s390_irq);
3588 -+ inti_to_irq(inti, &buf[n]);
3589 - n++;
3590 - }
3591 --
3592 - spin_unlock(&fi->lock);
3593 -+ if (!ret && n > 0) {
3594 -+ if (copy_to_user(usrbuf, buf, sizeof(struct kvm_s390_irq) * n))
3595 -+ ret = -EFAULT;
3596 -+ }
3597 -+ vfree(buf);
3598 -
3599 - return ret < 0 ? ret : n;
3600 - }
3601 -@@ -1520,7 +1526,7 @@ static int flic_get_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
3602 + #endif /* CONFIG_CPU_MIPSR6 */
3603
3604 - switch (attr->group) {
3605 - case KVM_DEV_FLIC_GET_ALL_IRQS:
3606 -- r = get_all_floating_irqs(dev->kvm, (u8 *) attr->addr,
3607 -+ r = get_all_floating_irqs(dev->kvm, (u8 __user *) attr->addr,
3608 - attr->attr);
3609 - break;
3610 - default:
3611 ---
3612 -2.3.6
3613 -
3614 -
3615 -From 654de1f9fd289e10a3de1daf0806051f05f57d92 Mon Sep 17 00:00:00 2001
3616 -From: Heiko Carstens <heiko.carstens@××××××.com>
3617 -Date: Wed, 25 Mar 2015 10:13:33 +0100
3618 -Subject: [PATCH 031/219] s390/hibernate: fix save and restore of kernel text
3619 - section
3620 -Cc: mpagano@g.o
3621 -
3622 -commit d74419495633493c9cd3f2bbeb7f3529d0edded6 upstream.
3623 -
3624 -Sebastian reported a crash caused by a jump label mismatch after resume.
3625 -This happens because we do not save the kernel text section during suspend
3626 -and therefore also do not restore it during resume, but use the kernel image
3627 -that restores the old system.
3628 -
3629 -This means that after a suspend/resume cycle we lost all modifications done
3630 -to the kernel text section.
3631 -The reason for this is the pfn_is_nosave() function, which incorrectly
3632 -returns that read-only pages don't need to be saved. This is incorrect since
3633 -we mark the kernel text section read-only.
3634 -We still need to make sure to not save and restore pages contained within
3635 -NSS and DCSS segment.
3636 -To fix this add an extra case for the kernel text section and only save
3637 -those pages if they are not contained within an NSS segment.
3638 -
3639 -Fixes the following crash (and the above bugs as well):
3640 -
3641 -Jump label code mismatch at netif_receive_skb_internal+0x28/0xd0
3642 -Found: c0 04 00 00 00 00
3643 -Expected: c0 f4 00 00 00 11
3644 -New: c0 04 00 00 00 00
3645 -Kernel panic - not syncing: Corrupted kernel text
3646 -CPU: 0 PID: 9 Comm: migration/0 Not tainted 3.19.0-01975-gb1b096e70f23 #4
3647 -Call Trace:
3648 - [<0000000000113972>] show_stack+0x72/0xf0
3649 - [<000000000081f15e>] dump_stack+0x6e/0x90
3650 - [<000000000081c4e8>] panic+0x108/0x2b0
3651 - [<000000000081be64>] jump_label_bug.isra.2+0x104/0x108
3652 - [<0000000000112176>] __jump_label_transform+0x9e/0xd0
3653 - [<00000000001121e6>] __sm_arch_jump_label_transform+0x3e/0x50
3654 - [<00000000001d1136>] multi_cpu_stop+0x12e/0x170
3655 - [<00000000001d1472>] cpu_stopper_thread+0xb2/0x168
3656 - [<000000000015d2ac>] smpboot_thread_fn+0x134/0x1b0
3657 - [<0000000000158baa>] kthread+0x10a/0x110
3658 - [<0000000000824a86>] kernel_thread_starter+0x6/0xc
3659 -
3660 -Reported-and-tested-by: Sebastian Ott <sebott@××××××××××××××.com>
3661 -Signed-off-by: Heiko Carstens <heiko.carstens@××××××.com>
3662 -Signed-off-by: Martin Schwidefsky <schwidefsky@××××××.com>
3663 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
3664 -Signed-off-by: Mike Pagano <mpagano@g.o>
3665 ----
3666 - arch/s390/kernel/suspend.c | 4 ++++
3667 - 1 file changed, 4 insertions(+)
3668 -
3669 -diff --git a/arch/s390/kernel/suspend.c b/arch/s390/kernel/suspend.c
3670 -index 1c4c5ac..d3236c9 100644
3671 ---- a/arch/s390/kernel/suspend.c
3672 -+++ b/arch/s390/kernel/suspend.c
3673 -@@ -138,6 +138,8 @@ int pfn_is_nosave(unsigned long pfn)
3674 - {
3675 - unsigned long nosave_begin_pfn = PFN_DOWN(__pa(&__nosave_begin));
3676 - unsigned long nosave_end_pfn = PFN_DOWN(__pa(&__nosave_end));
3677 -+ unsigned long eshared_pfn = PFN_DOWN(__pa(&_eshared)) - 1;
3678 -+ unsigned long stext_pfn = PFN_DOWN(__pa(&_stext));
3679
3680 - /* Always save lowcore pages (LC protection might be enabled). */
3681 - if (pfn <= LC_PAGES)
3682 -@@ -145,6 +147,8 @@ int pfn_is_nosave(unsigned long pfn)
3683 - if (pfn >= nosave_begin_pfn && pfn < nosave_end_pfn)
3684 - return 1;
3685 - /* Skip memory holes and read-only pages (NSS, DCSS, ...). */
3686 -+ if (pfn >= stext_pfn && pfn <= eshared_pfn)
3687 -+ return ipl_info.type == IPL_TYPE_NSS ? 1 : 0;
3688 - if (tprot(PFN_PHYS(pfn)))
3689 - return 1;
3690 - return 0;
3691 ---
3692 -2.3.6
3693 -
3694 -
3695 -From 15254fde3f5d723bd591a73d88296e9aecdd6bb7 Mon Sep 17 00:00:00 2001
3696 -From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= <rkrcmar@××××××.com>
3697 -Date: Wed, 8 Apr 2015 14:16:48 +0200
3698 -Subject: [PATCH 032/219] KVM: use slowpath for cross page cached accesses
3699 -MIME-Version: 1.0
3700 -Content-Type: text/plain; charset=UTF-8
3701 -Content-Transfer-Encoding: 8bit
3702 -Cc: mpagano@g.o
3703 -
3704 -commit ca3f0874723fad81d0c701b63ae3a17a408d5f25 upstream.
3705 -
3706 -kvm_write_guest_cached() does not mark all written pages as dirty and
3707 -code comments in kvm_gfn_to_hva_cache_init() talk about NULL memslot
3708 -with cross page accesses. Fix all the easy way.
3709 -
3710 -The check is '<= 1' to have the same result for 'len = 0' cache anywhere
3711 -in the page. (nr_pages_needed is 0 on page boundary.)
3712 -
3713 -Fixes: 8f964525a121 ("KVM: Allow cross page reads and writes from cached translations.")
3714 -Signed-off-by: Radim Krčmář <rkrcmar@××××××.com>
3715 -Message-Id: <20150408121648.GA3519@×××××××××××××××××.com>
3716 -Reviewed-by: Wanpeng Li <wanpeng.li@×××××××××××.com>
3717 -Signed-off-by: Paolo Bonzini <pbonzini@××××××.com>
3718 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
3719 -Signed-off-by: Mike Pagano <mpagano@g.o>
3720 ----
3721 - virt/kvm/kvm_main.c | 4 ++--
3722 - 1 file changed, 2 insertions(+), 2 deletions(-)
3723 -
3724 -diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
3725 -index cc6a25d..f8f3f5f 100644
3726 ---- a/virt/kvm/kvm_main.c
3727 -+++ b/virt/kvm/kvm_main.c
3728 -@@ -1653,8 +1653,8 @@ int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
3729 - ghc->generation = slots->generation;
3730 - ghc->len = len;
3731 - ghc->memslot = gfn_to_memslot(kvm, start_gfn);
3732 -- ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, &nr_pages_avail);
3733 -- if (!kvm_is_error_hva(ghc->hva) && nr_pages_avail >= nr_pages_needed) {
3734 -+ ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, NULL);
3735 -+ if (!kvm_is_error_hva(ghc->hva) && nr_pages_needed <= 1) {
3736 - ghc->hva += offset;
3737 - } else {
3738 - /*
3739 ---
3740 -2.3.6
3741 -
3742 -
3743 -From fb124f8c695ec8ddc72f19a8b3247b5ee872422f Mon Sep 17 00:00:00 2001
3744 -From: Andre Przywara <andre.przywara@×××.com>
3745 -Date: Fri, 10 Apr 2015 16:17:59 +0100
3746 -Subject: [PATCH 033/219] KVM: arm/arm64: check IRQ number on userland
3747 - injection
3748 -Cc: mpagano@g.o
3749 -
3750 -commit fd1d0ddf2ae92fb3df42ed476939861806c5d785 upstream.
3751 -
3752 -When userland injects a SPI via the KVM_IRQ_LINE ioctl we currently
3753 -only check it against a fixed limit, which historically is set
3754 -to 127. With the new dynamic IRQ allocation the effective limit may
3755 -actually be smaller (64).
3756 -So when now a malicious or buggy userland injects a SPI in that
3757 -range, we spill over on our VGIC bitmaps and bytemaps memory.
3758 -I could trigger a host kernel NULL pointer dereference with current
3759 -mainline by injecting some bogus IRQ number from a hacked kvmtool:
3760 ------------------
3761 -....
3762 -DEBUG: kvm_vgic_inject_irq(kvm, cpu=0, irq=114, level=1)
3763 -DEBUG: vgic_update_irq_pending(kvm, cpu=0, irq=114, level=1)
3764 -DEBUG: IRQ #114 still in the game, writing to bytemap now...
3765 -Unable to handle kernel NULL pointer dereference at virtual address 00000000
3766 -pgd = ffffffc07652e000
3767 -[00000000] *pgd=00000000f658b003, *pud=00000000f658b003, *pmd=0000000000000000
3768 -Internal error: Oops: 96000006 [#1] PREEMPT SMP
3769 -Modules linked in:
3770 -CPU: 1 PID: 1053 Comm: lkvm-msi-irqinj Not tainted 4.0.0-rc7+ #3027
3771 -Hardware name: FVP Base (DT)
3772 -task: ffffffc0774e9680 ti: ffffffc0765a8000 task.ti: ffffffc0765a8000
3773 -PC is at kvm_vgic_inject_irq+0x234/0x310
3774 -LR is at kvm_vgic_inject_irq+0x30c/0x310
3775 -pc : [<ffffffc0000ae0a8>] lr : [<ffffffc0000ae180>] pstate: 80000145
3776 -.....
3777 -
3778 -So this patch fixes this by checking the SPI number against the
3779 -actual limit. Also we remove the former legacy hard limit of
3780 -127 in the ioctl code.
3781 -
3782 -Signed-off-by: Andre Przywara <andre.przywara@×××.com>
3783 -Reviewed-by: Christoffer Dall <christoffer.dall@××××××.org>
3784 -[maz: wrap KVM_ARM_IRQ_GIC_MAX with #ifndef __KERNEL__,
3785 -as suggested by Christopher Covington]
3786 -Signed-off-by: Marc Zyngier <marc.zyngier@×××.com>
3787 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
3788 -
3789 -Signed-off-by: Mike Pagano <mpagano@g.o>
3790 ----
3791 - arch/arm/include/uapi/asm/kvm.h | 8 +++++++-
3792 - arch/arm/kvm/arm.c | 3 +--
3793 - arch/arm64/include/uapi/asm/kvm.h | 8 +++++++-
3794 - virt/kvm/arm/vgic.c | 3 +++
3795 - 4 files changed, 18 insertions(+), 4 deletions(-)
3796 -
3797 -diff --git a/arch/arm/include/uapi/asm/kvm.h b/arch/arm/include/uapi/asm/kvm.h
3798 -index 0db25bc..3a42ac6 100644
3799 ---- a/arch/arm/include/uapi/asm/kvm.h
3800 -+++ b/arch/arm/include/uapi/asm/kvm.h
3801 -@@ -195,8 +195,14 @@ struct kvm_arch_memory_slot {
3802 - #define KVM_ARM_IRQ_CPU_IRQ 0
3803 - #define KVM_ARM_IRQ_CPU_FIQ 1
3804 +-#define LoadHWU(addr, value, res) \
3805 ++#define _LoadHWU(addr, value, res, type) \
3806 ++do { \
3807 + __asm__ __volatile__ ( \
3808 + ".set\tnoat\n" \
3809 +- "1:\t"user_lbu("%0", "1(%2)")"\n" \
3810 +- "2:\t"user_lbu("$1", "0(%2)")"\n\t" \
3811 ++ "1:\t"type##_lbu("%0", "1(%2)")"\n" \
3812 ++ "2:\t"type##_lbu("$1", "0(%2)")"\n\t"\
3813 + "sll\t%0, 0x8\n\t" \
3814 + "or\t%0, $1\n\t" \
3815 + "li\t%1, 0\n" \
3816 +@@ -549,13 +590,15 @@ extern void show_registers(struct pt_regs *regs);
3817 + STR(PTR)"\t2b, 4b\n\t" \
3818 + ".previous" \
3819 + : "=&r" (value), "=r" (res) \
3820 +- : "r" (addr), "i" (-EFAULT));
3821 ++ : "r" (addr), "i" (-EFAULT)); \
3822 ++} while(0)
3823
3824 --/* Highest supported SPI, from VGIC_NR_IRQS */
3825 -+/*
3826 -+ * This used to hold the highest supported SPI, but it is now obsolete
3827 -+ * and only here to provide source code level compatibility with older
3828 -+ * userland. The highest SPI number can be set via KVM_DEV_ARM_VGIC_GRP_NR_IRQS.
3829 -+ */
3830 -+#ifndef __KERNEL__
3831 - #define KVM_ARM_IRQ_GIC_MAX 127
3832 -+#endif
3833 + #ifndef CONFIG_CPU_MIPSR6
3834 +-#define LoadWU(addr, value, res) \
3835 ++#define _LoadWU(addr, value, res, type) \
3836 ++do { \
3837 + __asm__ __volatile__ ( \
3838 +- "1:\t"user_lwl("%0", "3(%2)")"\n" \
3839 +- "2:\t"user_lwr("%0", "(%2)")"\n\t" \
3840 ++ "1:\t"type##_lwl("%0", "3(%2)")"\n" \
3841 ++ "2:\t"type##_lwr("%0", "(%2)")"\n\t"\
3842 + "dsll\t%0, %0, 32\n\t" \
3843 + "dsrl\t%0, %0, 32\n\t" \
3844 + "li\t%1, 0\n" \
3845 +@@ -570,9 +613,11 @@ extern void show_registers(struct pt_regs *regs);
3846 + STR(PTR)"\t2b, 4b\n\t" \
3847 + ".previous" \
3848 + : "=&r" (value), "=r" (res) \
3849 +- : "r" (addr), "i" (-EFAULT));
3850 ++ : "r" (addr), "i" (-EFAULT)); \
3851 ++} while(0)
3852
3853 - /* PSCI interface */
3854 - #define KVM_PSCI_FN_BASE 0x95c1ba5e
3855 -diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
3856 -index 5560f74..b652af5 100644
3857 ---- a/arch/arm/kvm/arm.c
3858 -+++ b/arch/arm/kvm/arm.c
3859 -@@ -651,8 +651,7 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,
3860 - if (!irqchip_in_kernel(kvm))
3861 - return -ENXIO;
3862 -
3863 -- if (irq_num < VGIC_NR_PRIVATE_IRQS ||
3864 -- irq_num > KVM_ARM_IRQ_GIC_MAX)
3865 -+ if (irq_num < VGIC_NR_PRIVATE_IRQS)
3866 - return -EINVAL;
3867 +-#define LoadDW(addr, value, res) \
3868 ++#define _LoadDW(addr, value, res) \
3869 ++do { \
3870 + __asm__ __volatile__ ( \
3871 + "1:\tldl\t%0, 7(%2)\n" \
3872 + "2:\tldr\t%0, (%2)\n\t" \
3873 +@@ -588,21 +633,24 @@ extern void show_registers(struct pt_regs *regs);
3874 + STR(PTR)"\t2b, 4b\n\t" \
3875 + ".previous" \
3876 + : "=&r" (value), "=r" (res) \
3877 +- : "r" (addr), "i" (-EFAULT));
3878 ++ : "r" (addr), "i" (-EFAULT)); \
3879 ++} while(0)
3880 ++
3881 + #else
3882 + /* MIPSR6 has not lwl and ldl instructions */
3883 +-#define LoadWU(addr, value, res) \
3884 ++#define _LoadWU(addr, value, res, type) \
3885 ++do { \
3886 + __asm__ __volatile__ ( \
3887 + ".set\tpush\n\t" \
3888 + ".set\tnoat\n\t" \
3889 +- "1:"user_lbu("%0", "3(%2)")"\n\t" \
3890 +- "2:"user_lbu("$1", "2(%2)")"\n\t" \
3891 ++ "1:"type##_lbu("%0", "3(%2)")"\n\t" \
3892 ++ "2:"type##_lbu("$1", "2(%2)")"\n\t" \
3893 + "sll\t%0, 0x8\n\t" \
3894 + "or\t%0, $1\n\t" \
3895 +- "3:"user_lbu("$1", "1(%2)")"\n\t" \
3896 ++ "3:"type##_lbu("$1", "1(%2)")"\n\t" \
3897 + "sll\t%0, 0x8\n\t" \
3898 + "or\t%0, $1\n\t" \
3899 +- "4:"user_lbu("$1", "0(%2)")"\n\t" \
3900 ++ "4:"type##_lbu("$1", "0(%2)")"\n\t" \
3901 + "sll\t%0, 0x8\n\t" \
3902 + "or\t%0, $1\n\t" \
3903 + "li\t%1, 0\n" \
3904 +@@ -620,9 +668,11 @@ extern void show_registers(struct pt_regs *regs);
3905 + STR(PTR)"\t4b, 11b\n\t" \
3906 + ".previous" \
3907 + : "=&r" (value), "=r" (res) \
3908 +- : "r" (addr), "i" (-EFAULT));
3909 ++ : "r" (addr), "i" (-EFAULT)); \
3910 ++} while(0)
3911
3912 - return kvm_vgic_inject_irq(kvm, 0, irq_num, level);
3913 -diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
3914 -index 3ef77a4..bc49a18 100644
3915 ---- a/arch/arm64/include/uapi/asm/kvm.h
3916 -+++ b/arch/arm64/include/uapi/asm/kvm.h
3917 -@@ -188,8 +188,14 @@ struct kvm_arch_memory_slot {
3918 - #define KVM_ARM_IRQ_CPU_IRQ 0
3919 - #define KVM_ARM_IRQ_CPU_FIQ 1
3920 +-#define LoadDW(addr, value, res) \
3921 ++#define _LoadDW(addr, value, res) \
3922 ++do { \
3923 + __asm__ __volatile__ ( \
3924 + ".set\tpush\n\t" \
3925 + ".set\tnoat\n\t" \
3926 +@@ -667,15 +717,17 @@ extern void show_registers(struct pt_regs *regs);
3927 + STR(PTR)"\t8b, 11b\n\t" \
3928 + ".previous" \
3929 + : "=&r" (value), "=r" (res) \
3930 +- : "r" (addr), "i" (-EFAULT));
3931 ++ : "r" (addr), "i" (-EFAULT)); \
3932 ++} while(0)
3933 + #endif /* CONFIG_CPU_MIPSR6 */
3934
3935 --/* Highest supported SPI, from VGIC_NR_IRQS */
3936 -+/*
3937 -+ * This used to hold the highest supported SPI, but it is now obsolete
3938 -+ * and only here to provide source code level compatibility with older
3939 -+ * userland. The highest SPI number can be set via KVM_DEV_ARM_VGIC_GRP_NR_IRQS.
3940 -+ */
3941 -+#ifndef __KERNEL__
3942 - #define KVM_ARM_IRQ_GIC_MAX 127
3943 -+#endif
3944 +-#define StoreHW(addr, value, res) \
3945 ++#define _StoreHW(addr, value, res, type) \
3946 ++do { \
3947 + __asm__ __volatile__ ( \
3948 + ".set\tnoat\n" \
3949 +- "1:\t"user_sb("%1", "0(%2)")"\n" \
3950 ++ "1:\t"type##_sb("%1", "0(%2)")"\n" \
3951 + "srl\t$1,%1, 0x8\n" \
3952 +- "2:\t"user_sb("$1", "1(%2)")"\n" \
3953 ++ "2:\t"type##_sb("$1", "1(%2)")"\n" \
3954 + ".set\tat\n\t" \
3955 + "li\t%0, 0\n" \
3956 + "3:\n\t" \
3957 +@@ -689,12 +741,15 @@ extern void show_registers(struct pt_regs *regs);
3958 + STR(PTR)"\t2b, 4b\n\t" \
3959 + ".previous" \
3960 + : "=r" (res) \
3961 +- : "r" (value), "r" (addr), "i" (-EFAULT));
3962 ++ : "r" (value), "r" (addr), "i" (-EFAULT));\
3963 ++} while(0)
3964 ++
3965 + #ifndef CONFIG_CPU_MIPSR6
3966 +-#define StoreW(addr, value, res) \
3967 ++#define _StoreW(addr, value, res, type) \
3968 ++do { \
3969 + __asm__ __volatile__ ( \
3970 +- "1:\t"user_swl("%1", "3(%2)")"\n" \
3971 +- "2:\t"user_swr("%1", "(%2)")"\n\t" \
3972 ++ "1:\t"type##_swl("%1", "3(%2)")"\n" \
3973 ++ "2:\t"type##_swr("%1", "(%2)")"\n\t"\
3974 + "li\t%0, 0\n" \
3975 + "3:\n\t" \
3976 + ".insn\n\t" \
3977 +@@ -707,9 +762,11 @@ extern void show_registers(struct pt_regs *regs);
3978 + STR(PTR)"\t2b, 4b\n\t" \
3979 + ".previous" \
3980 + : "=r" (res) \
3981 +- : "r" (value), "r" (addr), "i" (-EFAULT));
3982 ++ : "r" (value), "r" (addr), "i" (-EFAULT)); \
3983 ++} while(0)
3984
3985 - /* PSCI interface */
3986 - #define KVM_PSCI_FN_BASE 0x95c1ba5e
3987 -diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
3988 -index c9f60f5..e5abe7c 100644
3989 ---- a/virt/kvm/arm/vgic.c
3990 -+++ b/virt/kvm/arm/vgic.c
3991 -@@ -1371,6 +1371,9 @@ int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num,
3992 - goto out;
3993 - }
3994 +-#define StoreDW(addr, value, res) \
3995 ++#define _StoreDW(addr, value, res) \
3996 ++do { \
3997 + __asm__ __volatile__ ( \
3998 + "1:\tsdl\t%1, 7(%2)\n" \
3999 + "2:\tsdr\t%1, (%2)\n\t" \
4000 +@@ -725,20 +782,23 @@ extern void show_registers(struct pt_regs *regs);
4001 + STR(PTR)"\t2b, 4b\n\t" \
4002 + ".previous" \
4003 + : "=r" (res) \
4004 +- : "r" (value), "r" (addr), "i" (-EFAULT));
4005 ++ : "r" (value), "r" (addr), "i" (-EFAULT)); \
4006 ++} while(0)
4007 ++
4008 + #else
4009 + /* MIPSR6 has no swl and sdl instructions */
4010 +-#define StoreW(addr, value, res) \
4011 ++#define _StoreW(addr, value, res, type) \
4012 ++do { \
4013 + __asm__ __volatile__ ( \
4014 + ".set\tpush\n\t" \
4015 + ".set\tnoat\n\t" \
4016 +- "1:"user_sb("%1", "0(%2)")"\n\t" \
4017 ++ "1:"type##_sb("%1", "0(%2)")"\n\t" \
4018 + "srl\t$1, %1, 0x8\n\t" \
4019 +- "2:"user_sb("$1", "1(%2)")"\n\t" \
4020 ++ "2:"type##_sb("$1", "1(%2)")"\n\t" \
4021 + "srl\t$1, $1, 0x8\n\t" \
4022 +- "3:"user_sb("$1", "2(%2)")"\n\t" \
4023 ++ "3:"type##_sb("$1", "2(%2)")"\n\t" \
4024 + "srl\t$1, $1, 0x8\n\t" \
4025 +- "4:"user_sb("$1", "3(%2)")"\n\t" \
4026 ++ "4:"type##_sb("$1", "3(%2)")"\n\t" \
4027 + ".set\tpop\n\t" \
4028 + "li\t%0, 0\n" \
4029 + "10:\n\t" \
4030 +@@ -755,9 +815,11 @@ extern void show_registers(struct pt_regs *regs);
4031 + ".previous" \
4032 + : "=&r" (res) \
4033 + : "r" (value), "r" (addr), "i" (-EFAULT) \
4034 +- : "memory");
4035 ++ : "memory"); \
4036 ++} while(0)
4037
4038 -+ if (irq_num >= kvm->arch.vgic.nr_irqs)
4039 -+ return -EINVAL;
4040 +-#define StoreDW(addr, value, res) \
4041 ++#define _StoreDW(addr, value, res) \
4042 ++do { \
4043 + __asm__ __volatile__ ( \
4044 + ".set\tpush\n\t" \
4045 + ".set\tnoat\n\t" \
4046 +@@ -797,10 +859,28 @@ extern void show_registers(struct pt_regs *regs);
4047 + ".previous" \
4048 + : "=&r" (res) \
4049 + : "r" (value), "r" (addr), "i" (-EFAULT) \
4050 +- : "memory");
4051 ++ : "memory"); \
4052 ++} while(0)
4053 +
4054 - vcpu_id = vgic_update_irq_pending(kvm, cpuid, irq_num, level);
4055 - if (vcpu_id >= 0) {
4056 - /* kick the specified vcpu */
4057 ---
4058 -2.3.6
4059 -
4060 -
4061 -From 9656af0b6cee1496640cfd6dc321e216ff650d37 Mon Sep 17 00:00:00 2001
4062 -From: Ben Serebrin <serebrin@××××××.com>
4063 -Date: Thu, 16 Apr 2015 11:58:05 -0700
4064 -Subject: [PATCH 034/219] KVM: VMX: Preserve host CR4.MCE value while in guest
4065 - mode.
4066 -Cc: mpagano@g.o
4067 -
4068 -commit 085e68eeafbf76e21848ad5bafaecec88a11dd64 upstream.
4069 -
4070 -The host's decision to enable machine check exceptions should remain
4071 -in force during non-root mode. KVM was writing 0 to cr4 on VCPU reset
4072 -and passed a slightly-modified 0 to the vmcs.guest_cr4 value.
4073 -
4074 -Tested: Built.
4075 -On earlier version, tested by injecting machine check
4076 -while a guest is spinning.
4077 -
4078 -Before the change, if guest CR4.MCE==0, then the machine check is
4079 -escalated to Catastrophic Error (CATERR) and the machine dies.
4080 -If guest CR4.MCE==1, then the machine check causes VMEXIT and is
4081 -handled normally by host Linux. After the change, injecting a machine
4082 -check causes normal Linux machine check handling.
4083 -
4084 -Signed-off-by: Ben Serebrin <serebrin@××××××.com>
4085 -Reviewed-by: Venkatesh Srinivas <venkateshs@××××××.com>
4086 -Signed-off-by: Paolo Bonzini <pbonzini@××××××.com>
4087 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
4088 -Signed-off-by: Mike Pagano <mpagano@g.o>
4089 ----
4090 - arch/x86/kvm/vmx.c | 12 ++++++++++--
4091 - 1 file changed, 10 insertions(+), 2 deletions(-)
4092 -
4093 -diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
4094 -index ae4f6d3..a60bd3a 100644
4095 ---- a/arch/x86/kvm/vmx.c
4096 -+++ b/arch/x86/kvm/vmx.c
4097 -@@ -3621,8 +3621,16 @@ static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
4098 + #endif /* CONFIG_CPU_MIPSR6 */
4099 + #endif
4100
4101 - static int vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
4102 ++#define LoadHWU(addr, value, res) _LoadHWU(addr, value, res, kernel)
4103 ++#define LoadHWUE(addr, value, res) _LoadHWU(addr, value, res, user)
4104 ++#define LoadWU(addr, value, res) _LoadWU(addr, value, res, kernel)
4105 ++#define LoadWUE(addr, value, res) _LoadWU(addr, value, res, user)
4106 ++#define LoadHW(addr, value, res) _LoadHW(addr, value, res, kernel)
4107 ++#define LoadHWE(addr, value, res) _LoadHW(addr, value, res, user)
4108 ++#define LoadW(addr, value, res) _LoadW(addr, value, res, kernel)
4109 ++#define LoadWE(addr, value, res) _LoadW(addr, value, res, user)
4110 ++#define LoadDW(addr, value, res) _LoadDW(addr, value, res)
4111 ++
4112 ++#define StoreHW(addr, value, res) _StoreHW(addr, value, res, kernel)
4113 ++#define StoreHWE(addr, value, res) _StoreHW(addr, value, res, user)
4114 ++#define StoreW(addr, value, res) _StoreW(addr, value, res, kernel)
4115 ++#define StoreWE(addr, value, res) _StoreW(addr, value, res, user)
4116 ++#define StoreDW(addr, value, res) _StoreDW(addr, value, res)
4117 ++
4118 + static void emulate_load_store_insn(struct pt_regs *regs,
4119 + void __user *addr, unsigned int __user *pc)
4120 {
4121 -- unsigned long hw_cr4 = cr4 | (to_vmx(vcpu)->rmode.vm86_active ?
4122 -- KVM_RMODE_VM_CR4_ALWAYS_ON : KVM_PMODE_VM_CR4_ALWAYS_ON);
4123 -+ /*
4124 -+ * Pass through host's Machine Check Enable value to hw_cr4, which
4125 -+ * is in force while we are in guest mode. Do not let guests control
4126 -+ * this bit, even if host CR4.MCE == 0.
4127 -+ */
4128 -+ unsigned long hw_cr4 =
4129 -+ (cr4_read_shadow() & X86_CR4_MCE) |
4130 -+ (cr4 & ~X86_CR4_MCE) |
4131 -+ (to_vmx(vcpu)->rmode.vm86_active ?
4132 -+ KVM_RMODE_VM_CR4_ALWAYS_ON : KVM_PMODE_VM_CR4_ALWAYS_ON);
4133 -
4134 - if (cr4 & X86_CR4_VMXE) {
4135 - /*
4136 ---
4137 -2.3.6
4138 -
4139 -
4140 -From 7e5ed3d726c9333bdb3f23c3de7ff2f9e9902508 Mon Sep 17 00:00:00 2001
4141 -From: James Hogan <james.hogan@××××××.com>
4142 -Date: Fri, 6 Feb 2015 11:11:56 +0000
4143 -Subject: [PATCH 035/219] MIPS: KVM: Handle MSA Disabled exceptions from guest
4144 -Cc: mpagano@g.o
4145 -
4146 -commit 98119ad53376885819d93dfb8737b6a9a61ca0ba upstream.
4147 -
4148 -Guest user mode can generate a guest MSA Disabled exception on an MSA
4149 -capable core by simply trying to execute an MSA instruction. Since this
4150 -exception is unknown to KVM it will be passed on to the guest kernel.
4151 -However guest Linux kernels prior to v3.15 do not set up an exception
4152 -handler for the MSA Disabled exception as they don't support any MSA
4153 -capable cores. This results in a guest OS panic.
4154 -
4155 -Since an older processor ID may be being emulated, and MSA support is
4156 -not advertised to the guest, the correct behaviour is to generate a
4157 -Reserved Instruction exception in the guest kernel so it can send the
4158 -guest process an illegal instruction signal (SIGILL), as would happen
4159 -with a non-MSA-capable core.
4160 -
4161 -Fix this as minimally as reasonably possible by preventing
4162 -kvm_mips_check_privilege() from relaying MSA Disabled exceptions from
4163 -guest user mode to the guest kernel, and handling the MSA Disabled
4164 -exception by emulating a Reserved Instruction exception in the guest,
4165 -via a new handle_msa_disabled() KVM callback.
4166 -
4167 -Signed-off-by: James Hogan <james.hogan@××××××.com>
4168 -Cc: Paolo Bonzini <pbonzini@××××××.com>
4169 -Cc: Paul Burton <paul.burton@××××××.com>
4170 -Cc: Ralf Baechle <ralf@××××××××××.org>
4171 -Cc: Gleb Natapov <gleb@××××××.org>
4172 -Cc: linux-mips@××××××××××.org
4173 -Cc: kvm@×××××××××××.org
4174 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
4175 -Signed-off-by: Mike Pagano <mpagano@g.o>
4176 ----
4177 - arch/mips/include/asm/kvm_host.h | 2 ++
4178 - arch/mips/kvm/emulate.c | 1 +
4179 - arch/mips/kvm/mips.c | 4 ++++
4180 - arch/mips/kvm/trap_emul.c | 28 ++++++++++++++++++++++++++++
4181 - 4 files changed, 35 insertions(+)
4182 -
4183 -diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
4184 -index ac4fc71..f722b05 100644
4185 ---- a/arch/mips/include/asm/kvm_host.h
4186 -+++ b/arch/mips/include/asm/kvm_host.h
4187 -@@ -322,6 +322,7 @@ enum mips_mmu_types {
4188 - #define T_TRAP 13 /* Trap instruction */
4189 - #define T_VCEI 14 /* Virtual coherency exception */
4190 - #define T_FPE 15 /* Floating point exception */
4191 -+#define T_MSADIS 21 /* MSA disabled exception */
4192 - #define T_WATCH 23 /* Watch address reference */
4193 - #define T_VCED 31 /* Virtual coherency data */
4194 -
4195 -@@ -578,6 +579,7 @@ struct kvm_mips_callbacks {
4196 - int (*handle_syscall)(struct kvm_vcpu *vcpu);
4197 - int (*handle_res_inst)(struct kvm_vcpu *vcpu);
4198 - int (*handle_break)(struct kvm_vcpu *vcpu);
4199 -+ int (*handle_msa_disabled)(struct kvm_vcpu *vcpu);
4200 - int (*vm_init)(struct kvm *kvm);
4201 - int (*vcpu_init)(struct kvm_vcpu *vcpu);
4202 - int (*vcpu_setup)(struct kvm_vcpu *vcpu);
4203 -diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c
4204 -index fb3e8df..838d3a6 100644
4205 ---- a/arch/mips/kvm/emulate.c
4206 -+++ b/arch/mips/kvm/emulate.c
4207 -@@ -2176,6 +2176,7 @@ enum emulation_result kvm_mips_check_privilege(unsigned long cause,
4208 - case T_SYSCALL:
4209 - case T_BREAK:
4210 +@@ -872,7 +952,7 @@ static void emulate_load_store_insn(struct pt_regs *regs,
4211 + set_fs(seg);
4212 + goto sigbus;
4213 + }
4214 +- LoadHW(addr, value, res);
4215 ++ LoadHWE(addr, value, res);
4216 + if (res) {
4217 + set_fs(seg);
4218 + goto fault;
4219 +@@ -885,7 +965,7 @@ static void emulate_load_store_insn(struct pt_regs *regs,
4220 + set_fs(seg);
4221 + goto sigbus;
4222 + }
4223 +- LoadW(addr, value, res);
4224 ++ LoadWE(addr, value, res);
4225 + if (res) {
4226 + set_fs(seg);
4227 + goto fault;
4228 +@@ -898,7 +978,7 @@ static void emulate_load_store_insn(struct pt_regs *regs,
4229 + set_fs(seg);
4230 + goto sigbus;
4231 + }
4232 +- LoadHWU(addr, value, res);
4233 ++ LoadHWUE(addr, value, res);
4234 + if (res) {
4235 + set_fs(seg);
4236 + goto fault;
4237 +@@ -913,7 +993,7 @@ static void emulate_load_store_insn(struct pt_regs *regs,
4238 + }
4239 + compute_return_epc(regs);
4240 + value = regs->regs[insn.spec3_format.rt];
4241 +- StoreHW(addr, value, res);
4242 ++ StoreHWE(addr, value, res);
4243 + if (res) {
4244 + set_fs(seg);
4245 + goto fault;
4246 +@@ -926,7 +1006,7 @@ static void emulate_load_store_insn(struct pt_regs *regs,
4247 + }
4248 + compute_return_epc(regs);
4249 + value = regs->regs[insn.spec3_format.rt];
4250 +- StoreW(addr, value, res);
4251 ++ StoreWE(addr, value, res);
4252 + if (res) {
4253 + set_fs(seg);
4254 + goto fault;
4255 +@@ -943,7 +1023,15 @@ static void emulate_load_store_insn(struct pt_regs *regs,
4256 + if (!access_ok(VERIFY_READ, addr, 2))
4257 + goto sigbus;
4258 +
4259 +- LoadHW(addr, value, res);
4260 ++ if (config_enabled(CONFIG_EVA)) {
4261 ++ if (segment_eq(get_fs(), get_ds()))
4262 ++ LoadHW(addr, value, res);
4263 ++ else
4264 ++ LoadHWE(addr, value, res);
4265 ++ } else {
4266 ++ LoadHW(addr, value, res);
4267 ++ }
4268 ++
4269 + if (res)
4270 + goto fault;
4271 + compute_return_epc(regs);
4272 +@@ -954,7 +1042,15 @@ static void emulate_load_store_insn(struct pt_regs *regs,
4273 + if (!access_ok(VERIFY_READ, addr, 4))
4274 + goto sigbus;
4275 +
4276 +- LoadW(addr, value, res);
4277 ++ if (config_enabled(CONFIG_EVA)) {
4278 ++ if (segment_eq(get_fs(), get_ds()))
4279 ++ LoadW(addr, value, res);
4280 ++ else
4281 ++ LoadWE(addr, value, res);
4282 ++ } else {
4283 ++ LoadW(addr, value, res);
4284 ++ }
4285 ++
4286 + if (res)
4287 + goto fault;
4288 + compute_return_epc(regs);
4289 +@@ -965,7 +1061,15 @@ static void emulate_load_store_insn(struct pt_regs *regs,
4290 + if (!access_ok(VERIFY_READ, addr, 2))
4291 + goto sigbus;
4292 +
4293 +- LoadHWU(addr, value, res);
4294 ++ if (config_enabled(CONFIG_EVA)) {
4295 ++ if (segment_eq(get_fs(), get_ds()))
4296 ++ LoadHWU(addr, value, res);
4297 ++ else
4298 ++ LoadHWUE(addr, value, res);
4299 ++ } else {
4300 ++ LoadHWU(addr, value, res);
4301 ++ }
4302 ++
4303 + if (res)
4304 + goto fault;
4305 + compute_return_epc(regs);
4306 +@@ -1024,7 +1128,16 @@ static void emulate_load_store_insn(struct pt_regs *regs,
4307 +
4308 + compute_return_epc(regs);
4309 + value = regs->regs[insn.i_format.rt];
4310 +- StoreHW(addr, value, res);
4311 ++
4312 ++ if (config_enabled(CONFIG_EVA)) {
4313 ++ if (segment_eq(get_fs(), get_ds()))
4314 ++ StoreHW(addr, value, res);
4315 ++ else
4316 ++ StoreHWE(addr, value, res);
4317 ++ } else {
4318 ++ StoreHW(addr, value, res);
4319 ++ }
4320 ++
4321 + if (res)
4322 + goto fault;
4323 + break;
4324 +@@ -1035,7 +1148,16 @@ static void emulate_load_store_insn(struct pt_regs *regs,
4325 +
4326 + compute_return_epc(regs);
4327 + value = regs->regs[insn.i_format.rt];
4328 +- StoreW(addr, value, res);
4329 ++
4330 ++ if (config_enabled(CONFIG_EVA)) {
4331 ++ if (segment_eq(get_fs(), get_ds()))
4332 ++ StoreW(addr, value, res);
4333 ++ else
4334 ++ StoreWE(addr, value, res);
4335 ++ } else {
4336 ++ StoreW(addr, value, res);
4337 ++ }
4338 ++
4339 + if (res)
4340 + goto fault;
4341 + break;
4342 +diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c
4343 +index fb3e8df..838d3a6 100644
4344 +--- a/arch/mips/kvm/emulate.c
4345 ++++ b/arch/mips/kvm/emulate.c
4346 +@@ -2176,6 +2176,7 @@ enum emulation_result kvm_mips_check_privilege(unsigned long cause,
4347 + case T_SYSCALL:
4348 + case T_BREAK:
4349 case T_RES_INST:
4350 + case T_MSADIS:
4351 break;
4352 @@ -3038,87 +1535,18 @@ index fd7257b..4372cc8 100644
4353
4354 .vm_init = kvm_trap_emul_vm_init,
4355 .vcpu_init = kvm_trap_emul_vcpu_init,
4356 ---
4357 -2.3.6
4358 -
4359 -
4360 -From facbd0f25d07e3448d472d679aafefe7580990b2 Mon Sep 17 00:00:00 2001
4361 -From: James Hogan <james.hogan@××××××.com>
4362 -Date: Wed, 25 Feb 2015 13:08:05 +0000
4363 -Subject: [PATCH 036/219] MIPS: lose_fpu(): Disable FPU when MSA enabled
4364 -Cc: mpagano@g.o
4365 -
4366 -commit acaf6a97d623af123314c2f8ce4cf7254f6b2fc1 upstream.
4367 -
4368 -The lose_fpu() function only disables the FPU in CP0_Status.CU1 if the
4369 -FPU is in use and MSA isn't enabled.
4370 -
4371 -This isn't necessarily a problem because KSTK_STATUS(current), the
4372 -version of CP0_Status stored on the kernel stack on entry from user
4373 -mode, does always get updated and gets restored when returning to user
4374 -mode, but I don't think it was intended, and it is inconsistent with the
4375 -case of only the FPU being in use. Sometimes leaving the FPU enabled may
4376 -also mask kernel bugs where FPU operations are executed when the FPU
4377 -might not be enabled.
4378 -
4379 -So lets disable the FPU in the MSA case too.
4380 -
4381 -Fixes: 33c771ba5c5d ("MIPS: save/disable MSA in lose_fpu")
4382 -Signed-off-by: James Hogan <james.hogan@××××××.com>
4383 -Cc: Ralf Baechle <ralf@××××××××××.org>
4384 -Cc: Paul Burton <paul.burton@××××××.com>
4385 -Cc: linux-mips@××××××××××.org
4386 -Patchwork: https://patchwork.linux-mips.org/patch/9323/
4387 -Signed-off-by: Ralf Baechle <ralf@××××××××××.org>
4388 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
4389 -Signed-off-by: Mike Pagano <mpagano@g.o>
4390 ----
4391 - arch/mips/include/asm/fpu.h | 1 +
4392 - 1 file changed, 1 insertion(+)
4393 -
4394 -diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
4395 -index dd083e9..9f26b07 100644
4396 ---- a/arch/mips/include/asm/fpu.h
4397 -+++ b/arch/mips/include/asm/fpu.h
4398 -@@ -170,6 +170,7 @@ static inline void lose_fpu(int save)
4399 - }
4400 - disable_msa();
4401 - clear_thread_flag(TIF_USEDMSA);
4402 -+ __disable_fpu();
4403 - } else if (is_fpu_owner()) {
4404 - if (save)
4405 - _save_fp(current);
4406 ---
4407 -2.3.6
4408 -
4409 -
4410 -From 0668432d35a9e96ee500cbe1b3f7df6c4fe29b09 Mon Sep 17 00:00:00 2001
4411 -From: Markos Chandras <markos.chandras@××××××.com>
4412 -Date: Fri, 27 Feb 2015 07:51:32 +0000
4413 -Subject: [PATCH 037/219] MIPS: Malta: Detect and fix bad memsize values
4414 -Cc: mpagano@g.o
4415 -
4416 -commit f7f8aea4b97c4d48e42f02cb37026bee445f239f upstream.
4417 -
4418 -memsize denotes the amount of RAM we can access from kseg{0,1} and
4419 -that should be up to 256M. In case the bootloader reports a value
4420 -higher than that (perhaps reporting all the available RAM) it's best
4421 -if we fix it ourselves and just warn the user about that. This is
4422 -usually a problem with the bootloader and/or its environment.
4423 -
4424 -[ralf@××××××××××.org: Remove useless parens as suggested bei Sergei.
4425 -Reformat long pr_warn statement to fit into 80 column limit.]
4426 -
4427 -Signed-off-by: Markos Chandras <markos.chandras@××××××.com>
4428 -Cc: linux-mips@××××××××××.org
4429 -Patchwork: https://patchwork.linux-mips.org/patch/9362/
4430 -Signed-off-by: Ralf Baechle <ralf@××××××××××.org>
4431 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
4432 -Signed-off-by: Mike Pagano <mpagano@g.o>
4433 ----
4434 - arch/mips/mti-malta/malta-memory.c | 6 ++++++
4435 - 1 file changed, 6 insertions(+)
4436 -
4437 +diff --git a/arch/mips/loongson/loongson-3/irq.c b/arch/mips/loongson/loongson-3/irq.c
4438 +index 21221ed..0f75b6b 100644
4439 +--- a/arch/mips/loongson/loongson-3/irq.c
4440 ++++ b/arch/mips/loongson/loongson-3/irq.c
4441 +@@ -44,6 +44,7 @@ void mach_irq_dispatch(unsigned int pending)
4442 +
4443 + static struct irqaction cascade_irqaction = {
4444 + .handler = no_action,
4445 ++ .flags = IRQF_NO_SUSPEND,
4446 + .name = "cascade",
4447 + };
4448 +
4449 diff --git a/arch/mips/mti-malta/malta-memory.c b/arch/mips/mti-malta/malta-memory.c
4450 index 8fddd2cd..efe366d 100644
4451 --- a/arch/mips/mti-malta/malta-memory.c
4452 @@ -3136,12971 +1564,6606 @@ index 8fddd2cd..efe366d 100644
4453 /* If ememsize is set, then set physical_memsize to that */
4454 physical_memsize = ememsize ? : memsize;
4455 }
4456 ---
4457 -2.3.6
4458 -
4459 -
4460 -From e52a20fcbf2ae06dc538b953c065bd6ae0b5f4ad Mon Sep 17 00:00:00 2001
4461 -From: Markos Chandras <markos.chandras@××××××.com>
4462 -Date: Mon, 9 Mar 2015 14:54:49 +0000
4463 -Subject: [PATCH 038/219] MIPS: asm: asm-eva: Introduce kernel load/store
4464 - variants
4465 -Cc: mpagano@g.o
4466 -
4467 -commit 60cd7e08e453bc6828ac4b539f949e4acd80f143 upstream.
4468 -
4469 -Introduce new macros for kernel load/store variants which will be
4470 -used to perform regular kernel space load/store operations in EVA
4471 -mode.
4472 -
4473 -Signed-off-by: Markos Chandras <markos.chandras@××××××.com>
4474 -Cc: linux-mips@××××××××××.org
4475 -Patchwork: https://patchwork.linux-mips.org/patch/9500/
4476 -Signed-off-by: Ralf Baechle <ralf@××××××××××.org>
4477 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
4478 -Signed-off-by: Mike Pagano <mpagano@g.o>
4479 ----
4480 - arch/mips/include/asm/asm-eva.h | 137 +++++++++++++++++++++++++++-------------
4481 - 1 file changed, 93 insertions(+), 44 deletions(-)
4482 -
4483 -diff --git a/arch/mips/include/asm/asm-eva.h b/arch/mips/include/asm/asm-eva.h
4484 -index e41c56e..1e38f0e 100644
4485 ---- a/arch/mips/include/asm/asm-eva.h
4486 -+++ b/arch/mips/include/asm/asm-eva.h
4487 -@@ -11,6 +11,36 @@
4488 - #define __ASM_ASM_EVA_H
4489 +diff --git a/arch/mips/power/hibernate.S b/arch/mips/power/hibernate.S
4490 +index 32a7c82..e7567c8 100644
4491 +--- a/arch/mips/power/hibernate.S
4492 ++++ b/arch/mips/power/hibernate.S
4493 +@@ -30,6 +30,8 @@ LEAF(swsusp_arch_suspend)
4494 + END(swsusp_arch_suspend)
4495
4496 - #ifndef __ASSEMBLY__
4497 -+
4498 -+/* Kernel variants */
4499 -+
4500 -+#define kernel_cache(op, base) "cache " op ", " base "\n"
4501 -+#define kernel_ll(reg, addr) "ll " reg ", " addr "\n"
4502 -+#define kernel_sc(reg, addr) "sc " reg ", " addr "\n"
4503 -+#define kernel_lw(reg, addr) "lw " reg ", " addr "\n"
4504 -+#define kernel_lwl(reg, addr) "lwl " reg ", " addr "\n"
4505 -+#define kernel_lwr(reg, addr) "lwr " reg ", " addr "\n"
4506 -+#define kernel_lh(reg, addr) "lh " reg ", " addr "\n"
4507 -+#define kernel_lb(reg, addr) "lb " reg ", " addr "\n"
4508 -+#define kernel_lbu(reg, addr) "lbu " reg ", " addr "\n"
4509 -+#define kernel_sw(reg, addr) "sw " reg ", " addr "\n"
4510 -+#define kernel_swl(reg, addr) "swl " reg ", " addr "\n"
4511 -+#define kernel_swr(reg, addr) "swr " reg ", " addr "\n"
4512 -+#define kernel_sh(reg, addr) "sh " reg ", " addr "\n"
4513 -+#define kernel_sb(reg, addr) "sb " reg ", " addr "\n"
4514 -+
4515 -+#ifdef CONFIG_32BIT
4516 -+/*
4517 -+ * No 'sd' or 'ld' instructions in 32-bit but the code will
4518 -+ * do the correct thing
4519 -+ */
4520 -+#define kernel_sd(reg, addr) user_sw(reg, addr)
4521 -+#define kernel_ld(reg, addr) user_lw(reg, addr)
4522 -+#else
4523 -+#define kernel_sd(reg, addr) "sd " reg", " addr "\n"
4524 -+#define kernel_ld(reg, addr) "ld " reg", " addr "\n"
4525 -+#endif /* CONFIG_32BIT */
4526 -+
4527 - #ifdef CONFIG_EVA
4528 + LEAF(swsusp_arch_resume)
4529 ++ /* Avoid TLB mismatch during and after kernel resume */
4530 ++ jal local_flush_tlb_all
4531 + PTR_L t0, restore_pblist
4532 + 0:
4533 + PTR_L t1, PBE_ADDRESS(t0) /* source */
4534 +@@ -43,7 +45,6 @@ LEAF(swsusp_arch_resume)
4535 + bne t1, t3, 1b
4536 + PTR_L t0, PBE_NEXT(t0)
4537 + bnez t0, 0b
4538 +- jal local_flush_tlb_all /* Avoid TLB mismatch after kernel resume */
4539 + PTR_LA t0, saved_regs
4540 + PTR_L ra, PT_R31(t0)
4541 + PTR_L sp, PT_R29(t0)
4542 +diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
4543 +index ae77b7e..c641983 100644
4544 +--- a/arch/powerpc/kernel/cacheinfo.c
4545 ++++ b/arch/powerpc/kernel/cacheinfo.c
4546 +@@ -61,12 +61,22 @@ struct cache_type_info {
4547 + };
4548
4549 - #define __BUILD_EVA_INSN(insn, reg, addr) \
4550 -@@ -41,37 +71,60 @@
4551 + /* These are used to index the cache_type_info array. */
4552 +-#define CACHE_TYPE_UNIFIED 0
4553 +-#define CACHE_TYPE_INSTRUCTION 1
4554 +-#define CACHE_TYPE_DATA 2
4555 ++#define CACHE_TYPE_UNIFIED 0 /* cache-size, cache-block-size, etc. */
4556 ++#define CACHE_TYPE_UNIFIED_D 1 /* d-cache-size, d-cache-block-size, etc */
4557 ++#define CACHE_TYPE_INSTRUCTION 2
4558 ++#define CACHE_TYPE_DATA 3
4559
4560 - #else
4561 + static const struct cache_type_info cache_type_info[] = {
4562 + {
4563 ++ /* Embedded systems that use cache-size, cache-block-size,
4564 ++ * etc. for the Unified (typically L2) cache. */
4565 ++ .name = "Unified",
4566 ++ .size_prop = "cache-size",
4567 ++ .line_size_props = { "cache-line-size",
4568 ++ "cache-block-size", },
4569 ++ .nr_sets_prop = "cache-sets",
4570 ++ },
4571 ++ {
4572 + /* PowerPC Processor binding says the [di]-cache-*
4573 + * must be equal on unified caches, so just use
4574 + * d-cache properties. */
4575 +@@ -293,7 +303,8 @@ static struct cache *cache_find_first_sibling(struct cache *cache)
4576 + {
4577 + struct cache *iter;
4578
4579 --#define user_cache(op, base) "cache " op ", " base "\n"
4580 --#define user_ll(reg, addr) "ll " reg ", " addr "\n"
4581 --#define user_sc(reg, addr) "sc " reg ", " addr "\n"
4582 --#define user_lw(reg, addr) "lw " reg ", " addr "\n"
4583 --#define user_lwl(reg, addr) "lwl " reg ", " addr "\n"
4584 --#define user_lwr(reg, addr) "lwr " reg ", " addr "\n"
4585 --#define user_lh(reg, addr) "lh " reg ", " addr "\n"
4586 --#define user_lb(reg, addr) "lb " reg ", " addr "\n"
4587 --#define user_lbu(reg, addr) "lbu " reg ", " addr "\n"
4588 --#define user_sw(reg, addr) "sw " reg ", " addr "\n"
4589 --#define user_swl(reg, addr) "swl " reg ", " addr "\n"
4590 --#define user_swr(reg, addr) "swr " reg ", " addr "\n"
4591 --#define user_sh(reg, addr) "sh " reg ", " addr "\n"
4592 --#define user_sb(reg, addr) "sb " reg ", " addr "\n"
4593 -+#define user_cache(op, base) kernel_cache(op, base)
4594 -+#define user_ll(reg, addr) kernel_ll(reg, addr)
4595 -+#define user_sc(reg, addr) kernel_sc(reg, addr)
4596 -+#define user_lw(reg, addr) kernel_lw(reg, addr)
4597 -+#define user_lwl(reg, addr) kernel_lwl(reg, addr)
4598 -+#define user_lwr(reg, addr) kernel_lwr(reg, addr)
4599 -+#define user_lh(reg, addr) kernel_lh(reg, addr)
4600 -+#define user_lb(reg, addr) kernel_lb(reg, addr)
4601 -+#define user_lbu(reg, addr) kernel_lbu(reg, addr)
4602 -+#define user_sw(reg, addr) kernel_sw(reg, addr)
4603 -+#define user_swl(reg, addr) kernel_swl(reg, addr)
4604 -+#define user_swr(reg, addr) kernel_swr(reg, addr)
4605 -+#define user_sh(reg, addr) kernel_sh(reg, addr)
4606 -+#define user_sb(reg, addr) kernel_sb(reg, addr)
4607 -
4608 - #ifdef CONFIG_32BIT
4609 --/*
4610 -- * No 'sd' or 'ld' instructions in 32-bit but the code will
4611 -- * do the correct thing
4612 -- */
4613 --#define user_sd(reg, addr) user_sw(reg, addr)
4614 --#define user_ld(reg, addr) user_lw(reg, addr)
4615 -+#define user_sd(reg, addr) kernel_sw(reg, addr)
4616 -+#define user_ld(reg, addr) kernel_lw(reg, addr)
4617 - #else
4618 --#define user_sd(reg, addr) "sd " reg", " addr "\n"
4619 --#define user_ld(reg, addr) "ld " reg", " addr "\n"
4620 -+#define user_sd(reg, addr) kernel_sd(reg, addr)
4621 -+#define user_ld(reg, addr) kernel_ld(reg, addr)
4622 - #endif /* CONFIG_32BIT */
4623 +- if (cache->type == CACHE_TYPE_UNIFIED)
4624 ++ if (cache->type == CACHE_TYPE_UNIFIED ||
4625 ++ cache->type == CACHE_TYPE_UNIFIED_D)
4626 + return cache;
4627
4628 - #endif /* CONFIG_EVA */
4629 + list_for_each_entry(iter, &cache_list, list)
4630 +@@ -324,16 +335,29 @@ static bool cache_node_is_unified(const struct device_node *np)
4631 + return of_get_property(np, "cache-unified", NULL);
4632 + }
4633
4634 - #else /* __ASSEMBLY__ */
4635 +-static struct cache *cache_do_one_devnode_unified(struct device_node *node,
4636 +- int level)
4637 ++/*
4638 ++ * Unified caches can have two different sets of tags. Most embedded
4639 ++ * use cache-size, etc. for the unified cache size, but open firmware systems
4640 ++ * use d-cache-size, etc. Check on initialization for which type we have, and
4641 ++ * return the appropriate structure type. Assume it's embedded if it isn't
4642 ++ * open firmware. If it's yet a 3rd type, then there will be missing entries
4643 ++ * in /sys/devices/system/cpu/cpu0/cache/index2/, and this code will need
4644 ++ * to be extended further.
4645 ++ */
4646 ++static int cache_is_unified_d(const struct device_node *np)
4647 + {
4648 +- struct cache *cache;
4649 ++ return of_get_property(np,
4650 ++ cache_type_info[CACHE_TYPE_UNIFIED_D].size_prop, NULL) ?
4651 ++ CACHE_TYPE_UNIFIED_D : CACHE_TYPE_UNIFIED;
4652 ++}
4653
4654 -+#define kernel_cache(op, base) cache op, base
4655 -+#define kernel_ll(reg, addr) ll reg, addr
4656 -+#define kernel_sc(reg, addr) sc reg, addr
4657 -+#define kernel_lw(reg, addr) lw reg, addr
4658 -+#define kernel_lwl(reg, addr) lwl reg, addr
4659 -+#define kernel_lwr(reg, addr) lwr reg, addr
4660 -+#define kernel_lh(reg, addr) lh reg, addr
4661 -+#define kernel_lb(reg, addr) lb reg, addr
4662 -+#define kernel_lbu(reg, addr) lbu reg, addr
4663 -+#define kernel_sw(reg, addr) sw reg, addr
4664 -+#define kernel_swl(reg, addr) swl reg, addr
4665 -+#define kernel_swr(reg, addr) swr reg, addr
4666 -+#define kernel_sh(reg, addr) sh reg, addr
4667 -+#define kernel_sb(reg, addr) sb reg, addr
4668 -+
4669 -+#ifdef CONFIG_32BIT
4670 +/*
4671 -+ * No 'sd' or 'ld' instructions in 32-bit but the code will
4672 -+ * do the correct thing
4673 + */
4674 -+#define kernel_sd(reg, addr) user_sw(reg, addr)
4675 -+#define kernel_ld(reg, addr) user_lw(reg, addr)
4676 -+#else
4677 -+#define kernel_sd(reg, addr) sd reg, addr
4678 -+#define kernel_ld(reg, addr) ld reg, addr
4679 -+#endif /* CONFIG_32BIT */
4680 -+
4681 - #ifdef CONFIG_EVA
4682 ++static struct cache *cache_do_one_devnode_unified(struct device_node *node, int level)
4683 ++{
4684 + pr_debug("creating L%d ucache for %s\n", level, node->full_name);
4685
4686 - #define __BUILD_EVA_INSN(insn, reg, addr) \
4687 -@@ -101,31 +154,27 @@
4688 - #define user_sd(reg, addr) user_sw(reg, addr)
4689 - #else
4690 +- cache = new_cache(CACHE_TYPE_UNIFIED, level, node);
4691 +-
4692 +- return cache;
4693 ++ return new_cache(cache_is_unified_d(node), level, node);
4694 + }
4695
4696 --#define user_cache(op, base) cache op, base
4697 --#define user_ll(reg, addr) ll reg, addr
4698 --#define user_sc(reg, addr) sc reg, addr
4699 --#define user_lw(reg, addr) lw reg, addr
4700 --#define user_lwl(reg, addr) lwl reg, addr
4701 --#define user_lwr(reg, addr) lwr reg, addr
4702 --#define user_lh(reg, addr) lh reg, addr
4703 --#define user_lb(reg, addr) lb reg, addr
4704 --#define user_lbu(reg, addr) lbu reg, addr
4705 --#define user_sw(reg, addr) sw reg, addr
4706 --#define user_swl(reg, addr) swl reg, addr
4707 --#define user_swr(reg, addr) swr reg, addr
4708 --#define user_sh(reg, addr) sh reg, addr
4709 --#define user_sb(reg, addr) sb reg, addr
4710 -+#define user_cache(op, base) kernel_cache(op, base)
4711 -+#define user_ll(reg, addr) kernel_ll(reg, addr)
4712 -+#define user_sc(reg, addr) kernel_sc(reg, addr)
4713 -+#define user_lw(reg, addr) kernel_lw(reg, addr)
4714 -+#define user_lwl(reg, addr) kernel_lwl(reg, addr)
4715 -+#define user_lwr(reg, addr) kernel_lwr(reg, addr)
4716 -+#define user_lh(reg, addr) kernel_lh(reg, addr)
4717 -+#define user_lb(reg, addr) kernel_lb(reg, addr)
4718 -+#define user_lbu(reg, addr) kernel_lbu(reg, addr)
4719 -+#define user_sw(reg, addr) kernel_sw(reg, addr)
4720 -+#define user_swl(reg, addr) kernel_swl(reg, addr)
4721 -+#define user_swr(reg, addr) kernel_swr(reg, addr)
4722 -+#define user_sh(reg, addr) kernel_sh(reg, addr)
4723 -+#define user_sb(reg, addr) kernel_sb(reg, addr)
4724 + static struct cache *cache_do_one_devnode_split(struct device_node *node,
4725 +diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
4726 +index 7e408bf..cecbe00 100644
4727 +--- a/arch/powerpc/mm/hugetlbpage.c
4728 ++++ b/arch/powerpc/mm/hugetlbpage.c
4729 +@@ -581,6 +581,7 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud,
4730 + pmd = pmd_offset(pud, start);
4731 + pud_clear(pud);
4732 + pmd_free_tlb(tlb, pmd, start);
4733 ++ mm_dec_nr_pmds(tlb->mm);
4734 + }
4735
4736 - #ifdef CONFIG_32BIT
4737 --/*
4738 -- * No 'sd' or 'ld' instructions in 32-bit but the code will
4739 -- * do the correct thing
4740 -- */
4741 --#define user_sd(reg, addr) user_sw(reg, addr)
4742 --#define user_ld(reg, addr) user_lw(reg, addr)
4743 -+#define user_sd(reg, addr) kernel_sw(reg, addr)
4744 -+#define user_ld(reg, addr) kernel_lw(reg, addr)
4745 - #else
4746 --#define user_sd(reg, addr) sd reg, addr
4747 --#define user_ld(reg, addr) ld reg, addr
4748 -+#define user_sd(reg, addr) kernel_sd(reg, addr)
4749 -+#define user_ld(reg, addr) kernel_sd(reg, addr)
4750 - #endif /* CONFIG_32BIT */
4751 + static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
4752 +diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c
4753 +index 2396dda..ead5535 100644
4754 +--- a/arch/powerpc/perf/callchain.c
4755 ++++ b/arch/powerpc/perf/callchain.c
4756 +@@ -243,7 +243,7 @@ static void perf_callchain_user_64(struct perf_callchain_entry *entry,
4757 + sp = regs->gpr[1];
4758 + perf_callchain_store(entry, next_ip);
4759
4760 - #endif /* CONFIG_EVA */
4761 ---
4762 -2.3.6
4763 -
4764 -
4765 -From 88a82d60a26013483a22b19035517fec54b7dee5 Mon Sep 17 00:00:00 2001
4766 -From: Markos Chandras <markos.chandras@××××××.com>
4767 -Date: Mon, 9 Mar 2015 14:54:50 +0000
4768 -Subject: [PATCH 039/219] MIPS: unaligned: Prevent EVA instructions on kernel
4769 - unaligned accesses
4770 -Cc: mpagano@g.o
4771 -
4772 -commit eeb538950367e3966cbf0237ab1a1dc30e059818 upstream.
4773 -
4774 -Commit c1771216ab48 ("MIPS: kernel: unaligned: Handle unaligned
4775 -accesses for EVA") allowed unaligned accesses to be emulated for
4776 -EVA. However, when emulating regular load/store unaligned accesses,
4777 -we need to use the appropriate "address space" instructions for that.
4778 -Previously, an unaligned load/store instruction in kernel space would
4779 -have used the corresponding EVA instructions to emulate it which led to
4780 -segmentation faults because of the address translation that happens
4781 -with EVA instructions. This is now fixed by using the EVA instruction
4782 -only when emulating EVA unaligned accesses.
4783 -
4784 -Signed-off-by: Markos Chandras <markos.chandras@××××××.com>
4785 -Fixes: c1771216ab48 ("MIPS: kernel: unaligned: Handle unaligned accesses for EVA")
4786 -Cc: linux-mips@××××××××××.org
4787 -Patchwork: https://patchwork.linux-mips.org/patch/9501/
4788 -Signed-off-by: Ralf Baechle <ralf@××××××××××.org>
4789 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
4790 -Signed-off-by: Mike Pagano <mpagano@g.o>
4791 ----
4792 - arch/mips/kernel/unaligned.c | 172 +++++++++++++++++++++++--------------------
4793 - 1 file changed, 94 insertions(+), 78 deletions(-)
4794 -
4795 -diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
4796 -index bbb6969..7a5707e 100644
4797 ---- a/arch/mips/kernel/unaligned.c
4798 -+++ b/arch/mips/kernel/unaligned.c
4799 -@@ -109,10 +109,10 @@ static u32 unaligned_action;
4800 - extern void show_registers(struct pt_regs *regs);
4801 +- for (;;) {
4802 ++ while (entry->nr < PERF_MAX_STACK_DEPTH) {
4803 + fp = (unsigned long __user *) sp;
4804 + if (!valid_user_sp(sp, 1) || read_user_stack_64(fp, &next_sp))
4805 + return;
4806 +diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c
4807 +index 4c11421..3af8324 100644
4808 +--- a/arch/powerpc/platforms/cell/interrupt.c
4809 ++++ b/arch/powerpc/platforms/cell/interrupt.c
4810 +@@ -163,7 +163,7 @@ static unsigned int iic_get_irq(void)
4811
4812 - #ifdef __BIG_ENDIAN
4813 --#define LoadHW(addr, value, res) \
4814 -+#define _LoadHW(addr, value, res, type) \
4815 - __asm__ __volatile__ (".set\tnoat\n" \
4816 -- "1:\t"user_lb("%0", "0(%2)")"\n" \
4817 -- "2:\t"user_lbu("$1", "1(%2)")"\n\t" \
4818 -+ "1:\t"type##_lb("%0", "0(%2)")"\n" \
4819 -+ "2:\t"type##_lbu("$1", "1(%2)")"\n\t"\
4820 - "sll\t%0, 0x8\n\t" \
4821 - "or\t%0, $1\n\t" \
4822 - "li\t%1, 0\n" \
4823 -@@ -130,10 +130,10 @@ extern void show_registers(struct pt_regs *regs);
4824 - : "r" (addr), "i" (-EFAULT));
4825 + void iic_setup_cpu(void)
4826 + {
4827 +- out_be64(this_cpu_ptr(&cpu_iic.regs->prio), 0xff);
4828 ++ out_be64(&this_cpu_ptr(&cpu_iic)->regs->prio, 0xff);
4829 + }
4830
4831 - #ifndef CONFIG_CPU_MIPSR6
4832 --#define LoadW(addr, value, res) \
4833 -+#define _LoadW(addr, value, res, type) \
4834 - __asm__ __volatile__ ( \
4835 -- "1:\t"user_lwl("%0", "(%2)")"\n" \
4836 -- "2:\t"user_lwr("%0", "3(%2)")"\n\t" \
4837 -+ "1:\t"type##_lwl("%0", "(%2)")"\n" \
4838 -+ "2:\t"type##_lwr("%0", "3(%2)")"\n\t"\
4839 - "li\t%1, 0\n" \
4840 - "3:\n\t" \
4841 - ".insn\n\t" \
4842 -@@ -149,18 +149,18 @@ extern void show_registers(struct pt_regs *regs);
4843 - : "r" (addr), "i" (-EFAULT));
4844 - #else
4845 - /* MIPSR6 has no lwl instruction */
4846 --#define LoadW(addr, value, res) \
4847 -+#define _LoadW(addr, value, res, type) \
4848 - __asm__ __volatile__ ( \
4849 - ".set\tpush\n" \
4850 - ".set\tnoat\n\t" \
4851 -- "1:"user_lb("%0", "0(%2)")"\n\t" \
4852 -- "2:"user_lbu("$1", "1(%2)")"\n\t" \
4853 -+ "1:"type##_lb("%0", "0(%2)")"\n\t" \
4854 -+ "2:"type##_lbu("$1", "1(%2)")"\n\t" \
4855 - "sll\t%0, 0x8\n\t" \
4856 - "or\t%0, $1\n\t" \
4857 -- "3:"user_lbu("$1", "2(%2)")"\n\t" \
4858 -+ "3:"type##_lbu("$1", "2(%2)")"\n\t" \
4859 - "sll\t%0, 0x8\n\t" \
4860 - "or\t%0, $1\n\t" \
4861 -- "4:"user_lbu("$1", "3(%2)")"\n\t" \
4862 -+ "4:"type##_lbu("$1", "3(%2)")"\n\t" \
4863 - "sll\t%0, 0x8\n\t" \
4864 - "or\t%0, $1\n\t" \
4865 - "li\t%1, 0\n" \
4866 -@@ -181,11 +181,11 @@ extern void show_registers(struct pt_regs *regs);
4867 - : "r" (addr), "i" (-EFAULT));
4868 - #endif /* CONFIG_CPU_MIPSR6 */
4869 + u8 iic_get_target_id(int cpu)
4870 +diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
4871 +index c7c8720..63db1b0 100644
4872 +--- a/arch/powerpc/platforms/cell/iommu.c
4873 ++++ b/arch/powerpc/platforms/cell/iommu.c
4874 +@@ -197,7 +197,7 @@ static int tce_build_cell(struct iommu_table *tbl, long index, long npages,
4875
4876 --#define LoadHWU(addr, value, res) \
4877 -+#define _LoadHWU(addr, value, res, type) \
4878 - __asm__ __volatile__ ( \
4879 - ".set\tnoat\n" \
4880 -- "1:\t"user_lbu("%0", "0(%2)")"\n" \
4881 -- "2:\t"user_lbu("$1", "1(%2)")"\n\t" \
4882 -+ "1:\t"type##_lbu("%0", "0(%2)")"\n" \
4883 -+ "2:\t"type##_lbu("$1", "1(%2)")"\n\t"\
4884 - "sll\t%0, 0x8\n\t" \
4885 - "or\t%0, $1\n\t" \
4886 - "li\t%1, 0\n" \
4887 -@@ -204,10 +204,10 @@ extern void show_registers(struct pt_regs *regs);
4888 - : "r" (addr), "i" (-EFAULT));
4889 + io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset);
4890
4891 - #ifndef CONFIG_CPU_MIPSR6
4892 --#define LoadWU(addr, value, res) \
4893 -+#define _LoadWU(addr, value, res, type) \
4894 - __asm__ __volatile__ ( \
4895 -- "1:\t"user_lwl("%0", "(%2)")"\n" \
4896 -- "2:\t"user_lwr("%0", "3(%2)")"\n\t" \
4897 -+ "1:\t"type##_lwl("%0", "(%2)")"\n" \
4898 -+ "2:\t"type##_lwr("%0", "3(%2)")"\n\t"\
4899 - "dsll\t%0, %0, 32\n\t" \
4900 - "dsrl\t%0, %0, 32\n\t" \
4901 - "li\t%1, 0\n" \
4902 -@@ -224,7 +224,7 @@ extern void show_registers(struct pt_regs *regs);
4903 - : "=&r" (value), "=r" (res) \
4904 - : "r" (addr), "i" (-EFAULT));
4905 +- for (i = 0; i < npages; i++, uaddr += tbl->it_page_shift)
4906 ++ for (i = 0; i < npages; i++, uaddr += (1 << tbl->it_page_shift))
4907 + io_pte[i] = base_pte | (__pa(uaddr) & CBE_IOPTE_RPN_Mask);
4908
4909 --#define LoadDW(addr, value, res) \
4910 -+#define _LoadDW(addr, value, res) \
4911 - __asm__ __volatile__ ( \
4912 - "1:\tldl\t%0, (%2)\n" \
4913 - "2:\tldr\t%0, 7(%2)\n\t" \
4914 -@@ -243,18 +243,18 @@ extern void show_registers(struct pt_regs *regs);
4915 - : "r" (addr), "i" (-EFAULT));
4916 - #else
4917 - /* MIPSR6 has not lwl and ldl instructions */
4918 --#define LoadWU(addr, value, res) \
4919 -+#define _LoadWU(addr, value, res, type) \
4920 - __asm__ __volatile__ ( \
4921 - ".set\tpush\n\t" \
4922 - ".set\tnoat\n\t" \
4923 -- "1:"user_lbu("%0", "0(%2)")"\n\t" \
4924 -- "2:"user_lbu("$1", "1(%2)")"\n\t" \
4925 -+ "1:"type##_lbu("%0", "0(%2)")"\n\t" \
4926 -+ "2:"type##_lbu("$1", "1(%2)")"\n\t" \
4927 - "sll\t%0, 0x8\n\t" \
4928 - "or\t%0, $1\n\t" \
4929 -- "3:"user_lbu("$1", "2(%2)")"\n\t" \
4930 -+ "3:"type##_lbu("$1", "2(%2)")"\n\t" \
4931 - "sll\t%0, 0x8\n\t" \
4932 - "or\t%0, $1\n\t" \
4933 -- "4:"user_lbu("$1", "3(%2)")"\n\t" \
4934 -+ "4:"type##_lbu("$1", "3(%2)")"\n\t" \
4935 - "sll\t%0, 0x8\n\t" \
4936 - "or\t%0, $1\n\t" \
4937 - "li\t%1, 0\n" \
4938 -@@ -274,7 +274,7 @@ extern void show_registers(struct pt_regs *regs);
4939 - : "=&r" (value), "=r" (res) \
4940 - : "r" (addr), "i" (-EFAULT));
4941 + mb();
4942 +diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
4943 +index 6c9ff2b..1d9369e 100644
4944 +--- a/arch/powerpc/platforms/powernv/pci-ioda.c
4945 ++++ b/arch/powerpc/platforms/powernv/pci-ioda.c
4946 +@@ -1777,7 +1777,8 @@ static void pnv_ioda_setup_pe_seg(struct pci_controller *hose,
4947 + region.start += phb->ioda.io_segsize;
4948 + index++;
4949 + }
4950 +- } else if (res->flags & IORESOURCE_MEM) {
4951 ++ } else if ((res->flags & IORESOURCE_MEM) &&
4952 ++ !pnv_pci_is_mem_pref_64(res->flags)) {
4953 + region.start = res->start -
4954 + hose->mem_offset[0] -
4955 + phb->ioda.m32_pci_base;
4956 +diff --git a/arch/s390/kernel/suspend.c b/arch/s390/kernel/suspend.c
4957 +index 1c4c5ac..d3236c9 100644
4958 +--- a/arch/s390/kernel/suspend.c
4959 ++++ b/arch/s390/kernel/suspend.c
4960 +@@ -138,6 +138,8 @@ int pfn_is_nosave(unsigned long pfn)
4961 + {
4962 + unsigned long nosave_begin_pfn = PFN_DOWN(__pa(&__nosave_begin));
4963 + unsigned long nosave_end_pfn = PFN_DOWN(__pa(&__nosave_end));
4964 ++ unsigned long eshared_pfn = PFN_DOWN(__pa(&_eshared)) - 1;
4965 ++ unsigned long stext_pfn = PFN_DOWN(__pa(&_stext));
4966
4967 --#define LoadDW(addr, value, res) \
4968 -+#define _LoadDW(addr, value, res) \
4969 - __asm__ __volatile__ ( \
4970 - ".set\tpush\n\t" \
4971 - ".set\tnoat\n\t" \
4972 -@@ -323,12 +323,12 @@ extern void show_registers(struct pt_regs *regs);
4973 - #endif /* CONFIG_CPU_MIPSR6 */
4974 + /* Always save lowcore pages (LC protection might be enabled). */
4975 + if (pfn <= LC_PAGES)
4976 +@@ -145,6 +147,8 @@ int pfn_is_nosave(unsigned long pfn)
4977 + if (pfn >= nosave_begin_pfn && pfn < nosave_end_pfn)
4978 + return 1;
4979 + /* Skip memory holes and read-only pages (NSS, DCSS, ...). */
4980 ++ if (pfn >= stext_pfn && pfn <= eshared_pfn)
4981 ++ return ipl_info.type == IPL_TYPE_NSS ? 1 : 0;
4982 + if (tprot(PFN_PHYS(pfn)))
4983 + return 1;
4984 + return 0;
4985 +diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
4986 +index 073b5f3..e7bc2fd 100644
4987 +--- a/arch/s390/kvm/interrupt.c
4988 ++++ b/arch/s390/kvm/interrupt.c
4989 +@@ -17,6 +17,7 @@
4990 + #include <linux/signal.h>
4991 + #include <linux/slab.h>
4992 + #include <linux/bitmap.h>
4993 ++#include <linux/vmalloc.h>
4994 + #include <asm/asm-offsets.h>
4995 + #include <asm/uaccess.h>
4996 + #include <asm/sclp.h>
4997 +@@ -1332,10 +1333,10 @@ int kvm_s390_inject_vm(struct kvm *kvm,
4998 + return rc;
4999 + }
5000
5001 +-void kvm_s390_reinject_io_int(struct kvm *kvm,
5002 ++int kvm_s390_reinject_io_int(struct kvm *kvm,
5003 + struct kvm_s390_interrupt_info *inti)
5004 + {
5005 +- __inject_vm(kvm, inti);
5006 ++ return __inject_vm(kvm, inti);
5007 + }
5008
5009 --#define StoreHW(addr, value, res) \
5010 -+#define _StoreHW(addr, value, res, type) \
5011 - __asm__ __volatile__ ( \
5012 - ".set\tnoat\n" \
5013 -- "1:\t"user_sb("%1", "1(%2)")"\n" \
5014 -+ "1:\t"type##_sb("%1", "1(%2)")"\n" \
5015 - "srl\t$1, %1, 0x8\n" \
5016 -- "2:\t"user_sb("$1", "0(%2)")"\n" \
5017 -+ "2:\t"type##_sb("$1", "0(%2)")"\n" \
5018 - ".set\tat\n\t" \
5019 - "li\t%0, 0\n" \
5020 - "3:\n\t" \
5021 -@@ -345,10 +345,10 @@ extern void show_registers(struct pt_regs *regs);
5022 - : "r" (value), "r" (addr), "i" (-EFAULT));
5023 + int s390int_to_s390irq(struct kvm_s390_interrupt *s390int,
5024 +@@ -1455,61 +1456,66 @@ void kvm_s390_clear_float_irqs(struct kvm *kvm)
5025 + spin_unlock(&fi->lock);
5026 + }
5027
5028 - #ifndef CONFIG_CPU_MIPSR6
5029 --#define StoreW(addr, value, res) \
5030 -+#define _StoreW(addr, value, res, type) \
5031 - __asm__ __volatile__ ( \
5032 -- "1:\t"user_swl("%1", "(%2)")"\n" \
5033 -- "2:\t"user_swr("%1", "3(%2)")"\n\t" \
5034 -+ "1:\t"type##_swl("%1", "(%2)")"\n" \
5035 -+ "2:\t"type##_swr("%1", "3(%2)")"\n\t"\
5036 - "li\t%0, 0\n" \
5037 - "3:\n\t" \
5038 - ".insn\n\t" \
5039 -@@ -363,7 +363,7 @@ extern void show_registers(struct pt_regs *regs);
5040 - : "=r" (res) \
5041 - : "r" (value), "r" (addr), "i" (-EFAULT));
5042 +-static inline int copy_irq_to_user(struct kvm_s390_interrupt_info *inti,
5043 +- u8 *addr)
5044 ++static void inti_to_irq(struct kvm_s390_interrupt_info *inti,
5045 ++ struct kvm_s390_irq *irq)
5046 + {
5047 +- struct kvm_s390_irq __user *uptr = (struct kvm_s390_irq __user *) addr;
5048 +- struct kvm_s390_irq irq = {0};
5049 +-
5050 +- irq.type = inti->type;
5051 ++ irq->type = inti->type;
5052 + switch (inti->type) {
5053 + case KVM_S390_INT_PFAULT_INIT:
5054 + case KVM_S390_INT_PFAULT_DONE:
5055 + case KVM_S390_INT_VIRTIO:
5056 + case KVM_S390_INT_SERVICE:
5057 +- irq.u.ext = inti->ext;
5058 ++ irq->u.ext = inti->ext;
5059 + break;
5060 + case KVM_S390_INT_IO_MIN...KVM_S390_INT_IO_MAX:
5061 +- irq.u.io = inti->io;
5062 ++ irq->u.io = inti->io;
5063 + break;
5064 + case KVM_S390_MCHK:
5065 +- irq.u.mchk = inti->mchk;
5066 ++ irq->u.mchk = inti->mchk;
5067 + break;
5068 +- default:
5069 +- return -EINVAL;
5070 + }
5071 +-
5072 +- if (copy_to_user(uptr, &irq, sizeof(irq)))
5073 +- return -EFAULT;
5074 +-
5075 +- return 0;
5076 + }
5077
5078 --#define StoreDW(addr, value, res) \
5079 -+#define _StoreDW(addr, value, res) \
5080 - __asm__ __volatile__ ( \
5081 - "1:\tsdl\t%1,(%2)\n" \
5082 - "2:\tsdr\t%1, 7(%2)\n\t" \
5083 -@@ -382,17 +382,17 @@ extern void show_registers(struct pt_regs *regs);
5084 - : "r" (value), "r" (addr), "i" (-EFAULT));
5085 - #else
5086 - /* MIPSR6 has no swl and sdl instructions */
5087 --#define StoreW(addr, value, res) \
5088 -+#define _StoreW(addr, value, res, type) \
5089 - __asm__ __volatile__ ( \
5090 - ".set\tpush\n\t" \
5091 - ".set\tnoat\n\t" \
5092 -- "1:"user_sb("%1", "3(%2)")"\n\t" \
5093 -+ "1:"type##_sb("%1", "3(%2)")"\n\t" \
5094 - "srl\t$1, %1, 0x8\n\t" \
5095 -- "2:"user_sb("$1", "2(%2)")"\n\t" \
5096 -+ "2:"type##_sb("$1", "2(%2)")"\n\t" \
5097 - "srl\t$1, $1, 0x8\n\t" \
5098 -- "3:"user_sb("$1", "1(%2)")"\n\t" \
5099 -+ "3:"type##_sb("$1", "1(%2)")"\n\t" \
5100 - "srl\t$1, $1, 0x8\n\t" \
5101 -- "4:"user_sb("$1", "0(%2)")"\n\t" \
5102 -+ "4:"type##_sb("$1", "0(%2)")"\n\t" \
5103 - ".set\tpop\n\t" \
5104 - "li\t%0, 0\n" \
5105 - "10:\n\t" \
5106 -@@ -456,10 +456,10 @@ extern void show_registers(struct pt_regs *regs);
5107 +-static int get_all_floating_irqs(struct kvm *kvm, __u8 *buf, __u64 len)
5108 ++static int get_all_floating_irqs(struct kvm *kvm, u8 __user *usrbuf, u64 len)
5109 + {
5110 + struct kvm_s390_interrupt_info *inti;
5111 + struct kvm_s390_float_interrupt *fi;
5112 ++ struct kvm_s390_irq *buf;
5113 ++ int max_irqs;
5114 + int ret = 0;
5115 + int n = 0;
5116
5117 - #else /* __BIG_ENDIAN */
5118 ++ if (len > KVM_S390_FLIC_MAX_BUFFER || len == 0)
5119 ++ return -EINVAL;
5120 ++
5121 ++ /*
5122 ++ * We are already using -ENOMEM to signal
5123 ++ * userspace it may retry with a bigger buffer,
5124 ++ * so we need to use something else for this case
5125 ++ */
5126 ++ buf = vzalloc(len);
5127 ++ if (!buf)
5128 ++ return -ENOBUFS;
5129 ++
5130 ++ max_irqs = len / sizeof(struct kvm_s390_irq);
5131 ++
5132 + fi = &kvm->arch.float_int;
5133 + spin_lock(&fi->lock);
5134 +-
5135 + list_for_each_entry(inti, &fi->list, list) {
5136 +- if (len < sizeof(struct kvm_s390_irq)) {
5137 ++ if (n == max_irqs) {
5138 + /* signal userspace to try again */
5139 + ret = -ENOMEM;
5140 + break;
5141 + }
5142 +- ret = copy_irq_to_user(inti, buf);
5143 +- if (ret)
5144 +- break;
5145 +- buf += sizeof(struct kvm_s390_irq);
5146 +- len -= sizeof(struct kvm_s390_irq);
5147 ++ inti_to_irq(inti, &buf[n]);
5148 + n++;
5149 + }
5150 +-
5151 + spin_unlock(&fi->lock);
5152 ++ if (!ret && n > 0) {
5153 ++ if (copy_to_user(usrbuf, buf, sizeof(struct kvm_s390_irq) * n))
5154 ++ ret = -EFAULT;
5155 ++ }
5156 ++ vfree(buf);
5157
5158 --#define LoadHW(addr, value, res) \
5159 -+#define _LoadHW(addr, value, res, type) \
5160 - __asm__ __volatile__ (".set\tnoat\n" \
5161 -- "1:\t"user_lb("%0", "1(%2)")"\n" \
5162 -- "2:\t"user_lbu("$1", "0(%2)")"\n\t" \
5163 -+ "1:\t"type##_lb("%0", "1(%2)")"\n" \
5164 -+ "2:\t"type##_lbu("$1", "0(%2)")"\n\t"\
5165 - "sll\t%0, 0x8\n\t" \
5166 - "or\t%0, $1\n\t" \
5167 - "li\t%1, 0\n" \
5168 -@@ -477,10 +477,10 @@ extern void show_registers(struct pt_regs *regs);
5169 - : "r" (addr), "i" (-EFAULT));
5170 -
5171 - #ifndef CONFIG_CPU_MIPSR6
5172 --#define LoadW(addr, value, res) \
5173 -+#define _LoadW(addr, value, res, type) \
5174 - __asm__ __volatile__ ( \
5175 -- "1:\t"user_lwl("%0", "3(%2)")"\n" \
5176 -- "2:\t"user_lwr("%0", "(%2)")"\n\t" \
5177 -+ "1:\t"type##_lwl("%0", "3(%2)")"\n" \
5178 -+ "2:\t"type##_lwr("%0", "(%2)")"\n\t"\
5179 - "li\t%1, 0\n" \
5180 - "3:\n\t" \
5181 - ".insn\n\t" \
5182 -@@ -496,18 +496,18 @@ extern void show_registers(struct pt_regs *regs);
5183 - : "r" (addr), "i" (-EFAULT));
5184 - #else
5185 - /* MIPSR6 has no lwl instruction */
5186 --#define LoadW(addr, value, res) \
5187 -+#define _LoadW(addr, value, res, type) \
5188 - __asm__ __volatile__ ( \
5189 - ".set\tpush\n" \
5190 - ".set\tnoat\n\t" \
5191 -- "1:"user_lb("%0", "3(%2)")"\n\t" \
5192 -- "2:"user_lbu("$1", "2(%2)")"\n\t" \
5193 -+ "1:"type##_lb("%0", "3(%2)")"\n\t" \
5194 -+ "2:"type##_lbu("$1", "2(%2)")"\n\t" \
5195 - "sll\t%0, 0x8\n\t" \
5196 - "or\t%0, $1\n\t" \
5197 -- "3:"user_lbu("$1", "1(%2)")"\n\t" \
5198 -+ "3:"type##_lbu("$1", "1(%2)")"\n\t" \
5199 - "sll\t%0, 0x8\n\t" \
5200 - "or\t%0, $1\n\t" \
5201 -- "4:"user_lbu("$1", "0(%2)")"\n\t" \
5202 -+ "4:"type##_lbu("$1", "0(%2)")"\n\t" \
5203 - "sll\t%0, 0x8\n\t" \
5204 - "or\t%0, $1\n\t" \
5205 - "li\t%1, 0\n" \
5206 -@@ -529,11 +529,11 @@ extern void show_registers(struct pt_regs *regs);
5207 - #endif /* CONFIG_CPU_MIPSR6 */
5208 + return ret < 0 ? ret : n;
5209 + }
5210 +@@ -1520,7 +1526,7 @@ static int flic_get_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
5211
5212 + switch (attr->group) {
5213 + case KVM_DEV_FLIC_GET_ALL_IRQS:
5214 +- r = get_all_floating_irqs(dev->kvm, (u8 *) attr->addr,
5215 ++ r = get_all_floating_irqs(dev->kvm, (u8 __user *) attr->addr,
5216 + attr->attr);
5217 + break;
5218 + default:
5219 +diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
5220 +index c34109a..6995a30 100644
5221 +--- a/arch/s390/kvm/kvm-s390.h
5222 ++++ b/arch/s390/kvm/kvm-s390.h
5223 +@@ -151,8 +151,8 @@ int __must_check kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu,
5224 + int __must_check kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code);
5225 + struct kvm_s390_interrupt_info *kvm_s390_get_io_int(struct kvm *kvm,
5226 + u64 cr6, u64 schid);
5227 +-void kvm_s390_reinject_io_int(struct kvm *kvm,
5228 +- struct kvm_s390_interrupt_info *inti);
5229 ++int kvm_s390_reinject_io_int(struct kvm *kvm,
5230 ++ struct kvm_s390_interrupt_info *inti);
5231 + int kvm_s390_mask_adapter(struct kvm *kvm, unsigned int id, bool masked);
5232
5233 --#define LoadHWU(addr, value, res) \
5234 -+#define _LoadHWU(addr, value, res, type) \
5235 - __asm__ __volatile__ ( \
5236 - ".set\tnoat\n" \
5237 -- "1:\t"user_lbu("%0", "1(%2)")"\n" \
5238 -- "2:\t"user_lbu("$1", "0(%2)")"\n\t" \
5239 -+ "1:\t"type##_lbu("%0", "1(%2)")"\n" \
5240 -+ "2:\t"type##_lbu("$1", "0(%2)")"\n\t"\
5241 - "sll\t%0, 0x8\n\t" \
5242 - "or\t%0, $1\n\t" \
5243 - "li\t%1, 0\n" \
5244 -@@ -552,10 +552,10 @@ extern void show_registers(struct pt_regs *regs);
5245 - : "r" (addr), "i" (-EFAULT));
5246 + /* implemented in intercept.c */
5247 +diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
5248 +index 3511169..b982fbc 100644
5249 +--- a/arch/s390/kvm/priv.c
5250 ++++ b/arch/s390/kvm/priv.c
5251 +@@ -229,18 +229,19 @@ static int handle_tpi(struct kvm_vcpu *vcpu)
5252 + struct kvm_s390_interrupt_info *inti;
5253 + unsigned long len;
5254 + u32 tpi_data[3];
5255 +- int cc, rc;
5256 ++ int rc;
5257 + u64 addr;
5258
5259 - #ifndef CONFIG_CPU_MIPSR6
5260 --#define LoadWU(addr, value, res) \
5261 -+#define _LoadWU(addr, value, res, type) \
5262 - __asm__ __volatile__ ( \
5263 -- "1:\t"user_lwl("%0", "3(%2)")"\n" \
5264 -- "2:\t"user_lwr("%0", "(%2)")"\n\t" \
5265 -+ "1:\t"type##_lwl("%0", "3(%2)")"\n" \
5266 -+ "2:\t"type##_lwr("%0", "(%2)")"\n\t"\
5267 - "dsll\t%0, %0, 32\n\t" \
5268 - "dsrl\t%0, %0, 32\n\t" \
5269 - "li\t%1, 0\n" \
5270 -@@ -572,7 +572,7 @@ extern void show_registers(struct pt_regs *regs);
5271 - : "=&r" (value), "=r" (res) \
5272 - : "r" (addr), "i" (-EFAULT));
5273 +- rc = 0;
5274 + addr = kvm_s390_get_base_disp_s(vcpu);
5275 + if (addr & 3)
5276 + return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
5277 +- cc = 0;
5278 ++
5279 + inti = kvm_s390_get_io_int(vcpu->kvm, vcpu->arch.sie_block->gcr[6], 0);
5280 +- if (!inti)
5281 +- goto no_interrupt;
5282 +- cc = 1;
5283 ++ if (!inti) {
5284 ++ kvm_s390_set_psw_cc(vcpu, 0);
5285 ++ return 0;
5286 ++ }
5287 ++
5288 + tpi_data[0] = inti->io.subchannel_id << 16 | inti->io.subchannel_nr;
5289 + tpi_data[1] = inti->io.io_int_parm;
5290 + tpi_data[2] = inti->io.io_int_word;
5291 +@@ -251,30 +252,38 @@ static int handle_tpi(struct kvm_vcpu *vcpu)
5292 + */
5293 + len = sizeof(tpi_data) - 4;
5294 + rc = write_guest(vcpu, addr, &tpi_data, len);
5295 +- if (rc)
5296 +- return kvm_s390_inject_prog_cond(vcpu, rc);
5297 ++ if (rc) {
5298 ++ rc = kvm_s390_inject_prog_cond(vcpu, rc);
5299 ++ goto reinject_interrupt;
5300 ++ }
5301 + } else {
5302 + /*
5303 + * Store the three-word I/O interruption code into
5304 + * the appropriate lowcore area.
5305 + */
5306 + len = sizeof(tpi_data);
5307 +- if (write_guest_lc(vcpu, __LC_SUBCHANNEL_ID, &tpi_data, len))
5308 ++ if (write_guest_lc(vcpu, __LC_SUBCHANNEL_ID, &tpi_data, len)) {
5309 ++ /* failed writes to the low core are not recoverable */
5310 + rc = -EFAULT;
5311 ++ goto reinject_interrupt;
5312 ++ }
5313 + }
5314 ++
5315 ++ /* irq was successfully handed to the guest */
5316 ++ kfree(inti);
5317 ++ kvm_s390_set_psw_cc(vcpu, 1);
5318 ++ return 0;
5319 ++reinject_interrupt:
5320 + /*
5321 + * If we encounter a problem storing the interruption code, the
5322 + * instruction is suppressed from the guest's view: reinject the
5323 + * interrupt.
5324 + */
5325 +- if (!rc)
5326 ++ if (kvm_s390_reinject_io_int(vcpu->kvm, inti)) {
5327 + kfree(inti);
5328 +- else
5329 +- kvm_s390_reinject_io_int(vcpu->kvm, inti);
5330 +-no_interrupt:
5331 +- /* Set condition code and we're done. */
5332 +- if (!rc)
5333 +- kvm_s390_set_psw_cc(vcpu, cc);
5334 ++ rc = -EFAULT;
5335 ++ }
5336 ++ /* don't set the cc, a pgm irq was injected or we drop to user space */
5337 + return rc ? -EFAULT : 0;
5338 + }
5339
5340 --#define LoadDW(addr, value, res) \
5341 -+#define _LoadDW(addr, value, res) \
5342 - __asm__ __volatile__ ( \
5343 - "1:\tldl\t%0, 7(%2)\n" \
5344 - "2:\tldr\t%0, (%2)\n\t" \
5345 -@@ -591,18 +591,18 @@ extern void show_registers(struct pt_regs *regs);
5346 - : "r" (addr), "i" (-EFAULT));
5347 - #else
5348 - /* MIPSR6 has not lwl and ldl instructions */
5349 --#define LoadWU(addr, value, res) \
5350 -+#define _LoadWU(addr, value, res, type) \
5351 - __asm__ __volatile__ ( \
5352 - ".set\tpush\n\t" \
5353 - ".set\tnoat\n\t" \
5354 -- "1:"user_lbu("%0", "3(%2)")"\n\t" \
5355 -- "2:"user_lbu("$1", "2(%2)")"\n\t" \
5356 -+ "1:"type##_lbu("%0", "3(%2)")"\n\t" \
5357 -+ "2:"type##_lbu("$1", "2(%2)")"\n\t" \
5358 - "sll\t%0, 0x8\n\t" \
5359 - "or\t%0, $1\n\t" \
5360 -- "3:"user_lbu("$1", "1(%2)")"\n\t" \
5361 -+ "3:"type##_lbu("$1", "1(%2)")"\n\t" \
5362 - "sll\t%0, 0x8\n\t" \
5363 - "or\t%0, $1\n\t" \
5364 -- "4:"user_lbu("$1", "0(%2)")"\n\t" \
5365 -+ "4:"type##_lbu("$1", "0(%2)")"\n\t" \
5366 - "sll\t%0, 0x8\n\t" \
5367 - "or\t%0, $1\n\t" \
5368 - "li\t%1, 0\n" \
5369 -@@ -622,7 +622,7 @@ extern void show_registers(struct pt_regs *regs);
5370 - : "=&r" (value), "=r" (res) \
5371 - : "r" (addr), "i" (-EFAULT));
5372 +@@ -467,6 +476,7 @@ static void handle_stsi_3_2_2(struct kvm_vcpu *vcpu, struct sysinfo_3_2_2 *mem)
5373 + for (n = mem->count - 1; n > 0 ; n--)
5374 + memcpy(&mem->vm[n], &mem->vm[n - 1], sizeof(mem->vm[0]));
5375
5376 --#define LoadDW(addr, value, res) \
5377 -+#define _LoadDW(addr, value, res) \
5378 - __asm__ __volatile__ ( \
5379 - ".set\tpush\n\t" \
5380 - ".set\tnoat\n\t" \
5381 -@@ -670,12 +670,12 @@ extern void show_registers(struct pt_regs *regs);
5382 - : "r" (addr), "i" (-EFAULT));
5383 - #endif /* CONFIG_CPU_MIPSR6 */
5384 ++ memset(&mem->vm[0], 0, sizeof(mem->vm[0]));
5385 + mem->vm[0].cpus_total = cpus;
5386 + mem->vm[0].cpus_configured = cpus;
5387 + mem->vm[0].cpus_standby = 0;
5388 +diff --git a/arch/x86/include/asm/insn.h b/arch/x86/include/asm/insn.h
5389 +index 47f29b1..e7814b7 100644
5390 +--- a/arch/x86/include/asm/insn.h
5391 ++++ b/arch/x86/include/asm/insn.h
5392 +@@ -69,7 +69,7 @@ struct insn {
5393 + const insn_byte_t *next_byte;
5394 + };
5395
5396 --#define StoreHW(addr, value, res) \
5397 -+#define _StoreHW(addr, value, res, type) \
5398 - __asm__ __volatile__ ( \
5399 - ".set\tnoat\n" \
5400 -- "1:\t"user_sb("%1", "0(%2)")"\n" \
5401 -+ "1:\t"type##_sb("%1", "0(%2)")"\n" \
5402 - "srl\t$1,%1, 0x8\n" \
5403 -- "2:\t"user_sb("$1", "1(%2)")"\n" \
5404 -+ "2:\t"type##_sb("$1", "1(%2)")"\n" \
5405 - ".set\tat\n\t" \
5406 - "li\t%0, 0\n" \
5407 - "3:\n\t" \
5408 -@@ -691,10 +691,10 @@ extern void show_registers(struct pt_regs *regs);
5409 - : "=r" (res) \
5410 - : "r" (value), "r" (addr), "i" (-EFAULT));
5411 - #ifndef CONFIG_CPU_MIPSR6
5412 --#define StoreW(addr, value, res) \
5413 -+#define _StoreW(addr, value, res, type) \
5414 - __asm__ __volatile__ ( \
5415 -- "1:\t"user_swl("%1", "3(%2)")"\n" \
5416 -- "2:\t"user_swr("%1", "(%2)")"\n\t" \
5417 -+ "1:\t"type##_swl("%1", "3(%2)")"\n" \
5418 -+ "2:\t"type##_swr("%1", "(%2)")"\n\t"\
5419 - "li\t%0, 0\n" \
5420 - "3:\n\t" \
5421 - ".insn\n\t" \
5422 -@@ -709,7 +709,7 @@ extern void show_registers(struct pt_regs *regs);
5423 - : "=r" (res) \
5424 - : "r" (value), "r" (addr), "i" (-EFAULT));
5425 +-#define MAX_INSN_SIZE 16
5426 ++#define MAX_INSN_SIZE 15
5427
5428 --#define StoreDW(addr, value, res) \
5429 -+#define _StoreDW(addr, value, res) \
5430 - __asm__ __volatile__ ( \
5431 - "1:\tsdl\t%1, 7(%2)\n" \
5432 - "2:\tsdr\t%1, (%2)\n\t" \
5433 -@@ -728,17 +728,17 @@ extern void show_registers(struct pt_regs *regs);
5434 - : "r" (value), "r" (addr), "i" (-EFAULT));
5435 - #else
5436 - /* MIPSR6 has no swl and sdl instructions */
5437 --#define StoreW(addr, value, res) \
5438 -+#define _StoreW(addr, value, res, type) \
5439 - __asm__ __volatile__ ( \
5440 - ".set\tpush\n\t" \
5441 - ".set\tnoat\n\t" \
5442 -- "1:"user_sb("%1", "0(%2)")"\n\t" \
5443 -+ "1:"type##_sb("%1", "0(%2)")"\n\t" \
5444 - "srl\t$1, %1, 0x8\n\t" \
5445 -- "2:"user_sb("$1", "1(%2)")"\n\t" \
5446 -+ "2:"type##_sb("$1", "1(%2)")"\n\t" \
5447 - "srl\t$1, $1, 0x8\n\t" \
5448 -- "3:"user_sb("$1", "2(%2)")"\n\t" \
5449 -+ "3:"type##_sb("$1", "2(%2)")"\n\t" \
5450 - "srl\t$1, $1, 0x8\n\t" \
5451 -- "4:"user_sb("$1", "3(%2)")"\n\t" \
5452 -+ "4:"type##_sb("$1", "3(%2)")"\n\t" \
5453 - ".set\tpop\n\t" \
5454 - "li\t%0, 0\n" \
5455 - "10:\n\t" \
5456 -@@ -757,7 +757,7 @@ extern void show_registers(struct pt_regs *regs);
5457 - : "r" (value), "r" (addr), "i" (-EFAULT) \
5458 - : "memory");
5459 + #define X86_MODRM_MOD(modrm) (((modrm) & 0xc0) >> 6)
5460 + #define X86_MODRM_REG(modrm) (((modrm) & 0x38) >> 3)
5461 +diff --git a/arch/x86/include/asm/mwait.h b/arch/x86/include/asm/mwait.h
5462 +index a1410db..653dfa7 100644
5463 +--- a/arch/x86/include/asm/mwait.h
5464 ++++ b/arch/x86/include/asm/mwait.h
5465 +@@ -30,6 +30,14 @@ static inline void __mwait(unsigned long eax, unsigned long ecx)
5466 + :: "a" (eax), "c" (ecx));
5467 + }
5468
5469 --#define StoreDW(addr, value, res) \
5470 -+#define _StoreDW(addr, value, res) \
5471 - __asm__ __volatile__ ( \
5472 - ".set\tpush\n\t" \
5473 - ".set\tnoat\n\t" \
5474 -@@ -801,6 +801,22 @@ extern void show_registers(struct pt_regs *regs);
5475 - #endif /* CONFIG_CPU_MIPSR6 */
5476 - #endif
5477 -
5478 -+#define LoadHWU(addr, value, res) _LoadHWU(addr, value, res, kernel)
5479 -+#define LoadHWUE(addr, value, res) _LoadHWU(addr, value, res, user)
5480 -+#define LoadWU(addr, value, res) _LoadWU(addr, value, res, kernel)
5481 -+#define LoadWUE(addr, value, res) _LoadWU(addr, value, res, user)
5482 -+#define LoadHW(addr, value, res) _LoadHW(addr, value, res, kernel)
5483 -+#define LoadHWE(addr, value, res) _LoadHW(addr, value, res, user)
5484 -+#define LoadW(addr, value, res) _LoadW(addr, value, res, kernel)
5485 -+#define LoadWE(addr, value, res) _LoadW(addr, value, res, user)
5486 -+#define LoadDW(addr, value, res) _LoadDW(addr, value, res)
5487 -+
5488 -+#define StoreHW(addr, value, res) _StoreHW(addr, value, res, kernel)
5489 -+#define StoreHWE(addr, value, res) _StoreHW(addr, value, res, user)
5490 -+#define StoreW(addr, value, res) _StoreW(addr, value, res, kernel)
5491 -+#define StoreWE(addr, value, res) _StoreW(addr, value, res, user)
5492 -+#define StoreDW(addr, value, res) _StoreDW(addr, value, res)
5493 -+
5494 - static void emulate_load_store_insn(struct pt_regs *regs,
5495 - void __user *addr, unsigned int __user *pc)
5496 - {
5497 -@@ -872,7 +888,7 @@ static void emulate_load_store_insn(struct pt_regs *regs,
5498 - set_fs(seg);
5499 - goto sigbus;
5500 - }
5501 -- LoadHW(addr, value, res);
5502 -+ LoadHWE(addr, value, res);
5503 - if (res) {
5504 - set_fs(seg);
5505 - goto fault;
5506 -@@ -885,7 +901,7 @@ static void emulate_load_store_insn(struct pt_regs *regs,
5507 - set_fs(seg);
5508 - goto sigbus;
5509 - }
5510 -- LoadW(addr, value, res);
5511 -+ LoadWE(addr, value, res);
5512 - if (res) {
5513 - set_fs(seg);
5514 - goto fault;
5515 -@@ -898,7 +914,7 @@ static void emulate_load_store_insn(struct pt_regs *regs,
5516 - set_fs(seg);
5517 - goto sigbus;
5518 - }
5519 -- LoadHWU(addr, value, res);
5520 -+ LoadHWUE(addr, value, res);
5521 - if (res) {
5522 - set_fs(seg);
5523 - goto fault;
5524 -@@ -913,7 +929,7 @@ static void emulate_load_store_insn(struct pt_regs *regs,
5525 - }
5526 - compute_return_epc(regs);
5527 - value = regs->regs[insn.spec3_format.rt];
5528 -- StoreHW(addr, value, res);
5529 -+ StoreHWE(addr, value, res);
5530 - if (res) {
5531 - set_fs(seg);
5532 - goto fault;
5533 -@@ -926,7 +942,7 @@ static void emulate_load_store_insn(struct pt_regs *regs,
5534 - }
5535 - compute_return_epc(regs);
5536 - value = regs->regs[insn.spec3_format.rt];
5537 -- StoreW(addr, value, res);
5538 -+ StoreWE(addr, value, res);
5539 - if (res) {
5540 - set_fs(seg);
5541 - goto fault;
5542 ---
5543 -2.3.6
5544 -
5545 -
5546 -From ae0a145ca5b6c135e068a08f859e3f10ad2242d9 Mon Sep 17 00:00:00 2001
5547 -From: Markos Chandras <markos.chandras@××××××.com>
5548 -Date: Mon, 9 Mar 2015 14:54:51 +0000
5549 -Subject: [PATCH 040/219] MIPS: unaligned: Surround load/store macros in do {}
5550 - while statements
5551 -Cc: mpagano@g.o
5552 -
5553 -commit 3563c32d6532ece53c9dd8905a8e41983ef9952f upstream.
5554 -
5555 -It's best to surround such complex macros with do {} while statements
5556 -so they can appear as independent logical blocks when used within other
5557 -control blocks.
5558 -
5559 -Signed-off-by: Markos Chandras <markos.chandras@××××××.com>
5560 -Cc: linux-mips@××××××××××.org
5561 -Patchwork: https://patchwork.linux-mips.org/patch/9502/
5562 -Signed-off-by: Ralf Baechle <ralf@××××××××××.org>
5563 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
5564 -Signed-off-by: Mike Pagano <mpagano@g.o>
5565 ----
5566 - arch/mips/kernel/unaligned.c | 116 +++++++++++++++++++++++++++++++++----------
5567 - 1 file changed, 90 insertions(+), 26 deletions(-)
5568 -
5569 -diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
5570 -index 7a5707e..ab47590 100644
5571 ---- a/arch/mips/kernel/unaligned.c
5572 -+++ b/arch/mips/kernel/unaligned.c
5573 -@@ -110,6 +110,7 @@ extern void show_registers(struct pt_regs *regs);
5574 -
5575 - #ifdef __BIG_ENDIAN
5576 - #define _LoadHW(addr, value, res, type) \
5577 -+do { \
5578 - __asm__ __volatile__ (".set\tnoat\n" \
5579 - "1:\t"type##_lb("%0", "0(%2)")"\n" \
5580 - "2:\t"type##_lbu("$1", "1(%2)")"\n\t"\
5581 -@@ -127,10 +128,12 @@ extern void show_registers(struct pt_regs *regs);
5582 - STR(PTR)"\t2b, 4b\n\t" \
5583 - ".previous" \
5584 - : "=&r" (value), "=r" (res) \
5585 -- : "r" (addr), "i" (-EFAULT));
5586 -+ : "r" (addr), "i" (-EFAULT)); \
5587 -+} while(0)
5588 -
5589 - #ifndef CONFIG_CPU_MIPSR6
5590 - #define _LoadW(addr, value, res, type) \
5591 -+do { \
5592 - __asm__ __volatile__ ( \
5593 - "1:\t"type##_lwl("%0", "(%2)")"\n" \
5594 - "2:\t"type##_lwr("%0", "3(%2)")"\n\t"\
5595 -@@ -146,10 +149,13 @@ extern void show_registers(struct pt_regs *regs);
5596 - STR(PTR)"\t2b, 4b\n\t" \
5597 - ".previous" \
5598 - : "=&r" (value), "=r" (res) \
5599 -- : "r" (addr), "i" (-EFAULT));
5600 -+ : "r" (addr), "i" (-EFAULT)); \
5601 -+} while(0)
5602 -+
5603 - #else
5604 - /* MIPSR6 has no lwl instruction */
5605 - #define _LoadW(addr, value, res, type) \
5606 -+do { \
5607 - __asm__ __volatile__ ( \
5608 - ".set\tpush\n" \
5609 - ".set\tnoat\n\t" \
5610 -@@ -178,10 +184,13 @@ extern void show_registers(struct pt_regs *regs);
5611 - STR(PTR)"\t4b, 11b\n\t" \
5612 - ".previous" \
5613 - : "=&r" (value), "=r" (res) \
5614 -- : "r" (addr), "i" (-EFAULT));
5615 -+ : "r" (addr), "i" (-EFAULT)); \
5616 -+} while(0)
5617 ++static inline void __sti_mwait(unsigned long eax, unsigned long ecx)
5618 ++{
5619 ++ trace_hardirqs_on();
5620 ++ /* "mwait %eax, %ecx;" */
5621 ++ asm volatile("sti; .byte 0x0f, 0x01, 0xc9;"
5622 ++ :: "a" (eax), "c" (ecx));
5623 ++}
5624 +
5625 - #endif /* CONFIG_CPU_MIPSR6 */
5626 -
5627 - #define _LoadHWU(addr, value, res, type) \
5628 -+do { \
5629 - __asm__ __volatile__ ( \
5630 - ".set\tnoat\n" \
5631 - "1:\t"type##_lbu("%0", "0(%2)")"\n" \
5632 -@@ -201,10 +210,12 @@ extern void show_registers(struct pt_regs *regs);
5633 - STR(PTR)"\t2b, 4b\n\t" \
5634 - ".previous" \
5635 - : "=&r" (value), "=r" (res) \
5636 -- : "r" (addr), "i" (-EFAULT));
5637 -+ : "r" (addr), "i" (-EFAULT)); \
5638 -+} while(0)
5639 + /*
5640 + * This uses new MONITOR/MWAIT instructions on P4 processors with PNI,
5641 + * which can obviate IPI to trigger checking of need_resched.
5642 +diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
5643 +index d6b078e..25b1cc0 100644
5644 +--- a/arch/x86/include/asm/pvclock.h
5645 ++++ b/arch/x86/include/asm/pvclock.h
5646 +@@ -95,6 +95,7 @@ unsigned __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src,
5647
5648 - #ifndef CONFIG_CPU_MIPSR6
5649 - #define _LoadWU(addr, value, res, type) \
5650 -+do { \
5651 - __asm__ __volatile__ ( \
5652 - "1:\t"type##_lwl("%0", "(%2)")"\n" \
5653 - "2:\t"type##_lwr("%0", "3(%2)")"\n\t"\
5654 -@@ -222,9 +233,11 @@ extern void show_registers(struct pt_regs *regs);
5655 - STR(PTR)"\t2b, 4b\n\t" \
5656 - ".previous" \
5657 - : "=&r" (value), "=r" (res) \
5658 -- : "r" (addr), "i" (-EFAULT));
5659 -+ : "r" (addr), "i" (-EFAULT)); \
5660 -+} while(0)
5661 + struct pvclock_vsyscall_time_info {
5662 + struct pvclock_vcpu_time_info pvti;
5663 ++ u32 migrate_count;
5664 + } __attribute__((__aligned__(SMP_CACHE_BYTES)));
5665
5666 - #define _LoadDW(addr, value, res) \
5667 -+do { \
5668 - __asm__ __volatile__ ( \
5669 - "1:\tldl\t%0, (%2)\n" \
5670 - "2:\tldr\t%0, 7(%2)\n\t" \
5671 -@@ -240,10 +253,13 @@ extern void show_registers(struct pt_regs *regs);
5672 - STR(PTR)"\t2b, 4b\n\t" \
5673 - ".previous" \
5674 - : "=&r" (value), "=r" (res) \
5675 -- : "r" (addr), "i" (-EFAULT));
5676 -+ : "r" (addr), "i" (-EFAULT)); \
5677 -+} while(0)
5678 -+
5679 - #else
5680 - /* MIPSR6 has not lwl and ldl instructions */
5681 - #define _LoadWU(addr, value, res, type) \
5682 -+do { \
5683 - __asm__ __volatile__ ( \
5684 - ".set\tpush\n\t" \
5685 - ".set\tnoat\n\t" \
5686 -@@ -272,9 +288,11 @@ extern void show_registers(struct pt_regs *regs);
5687 - STR(PTR)"\t4b, 11b\n\t" \
5688 - ".previous" \
5689 - : "=&r" (value), "=r" (res) \
5690 -- : "r" (addr), "i" (-EFAULT));
5691 -+ : "r" (addr), "i" (-EFAULT)); \
5692 -+} while(0)
5693 + #define PVTI_SIZE sizeof(struct pvclock_vsyscall_time_info)
5694 +diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
5695 +index 0739833..666bcf1 100644
5696 +--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
5697 ++++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
5698 +@@ -557,6 +557,8 @@ struct event_constraint intel_core2_pebs_event_constraints[] = {
5699 + INTEL_FLAGS_UEVENT_CONSTRAINT(0x00c5, 0x1), /* BR_INST_RETIRED.MISPRED */
5700 + INTEL_FLAGS_UEVENT_CONSTRAINT(0x1fc7, 0x1), /* SIMD_INST_RETURED.ANY */
5701 + INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */
5702 ++ /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */
5703 ++ INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x01),
5704 + EVENT_CONSTRAINT_END
5705 + };
5706
5707 - #define _LoadDW(addr, value, res) \
5708 -+do { \
5709 - __asm__ __volatile__ ( \
5710 - ".set\tpush\n\t" \
5711 - ".set\tnoat\n\t" \
5712 -@@ -319,11 +337,14 @@ extern void show_registers(struct pt_regs *regs);
5713 - STR(PTR)"\t8b, 11b\n\t" \
5714 - ".previous" \
5715 - : "=&r" (value), "=r" (res) \
5716 -- : "r" (addr), "i" (-EFAULT));
5717 -+ : "r" (addr), "i" (-EFAULT)); \
5718 -+} while(0)
5719 -+
5720 - #endif /* CONFIG_CPU_MIPSR6 */
5721 +@@ -564,6 +566,8 @@ struct event_constraint intel_atom_pebs_event_constraints[] = {
5722 + INTEL_FLAGS_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */
5723 + INTEL_FLAGS_UEVENT_CONSTRAINT(0x00c5, 0x1), /* MISPREDICTED_BRANCH_RETIRED */
5724 + INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */
5725 ++ /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */
5726 ++ INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x01),
5727 + EVENT_CONSTRAINT_END
5728 + };
5729
5730 +@@ -587,6 +591,8 @@ struct event_constraint intel_nehalem_pebs_event_constraints[] = {
5731 + INTEL_FLAGS_UEVENT_CONSTRAINT(0x20c8, 0xf), /* ITLB_MISS_RETIRED */
5732 + INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */
5733 + INTEL_FLAGS_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */
5734 ++ /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */
5735 ++ INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x0f),
5736 + EVENT_CONSTRAINT_END
5737 + };
5738
5739 - #define _StoreHW(addr, value, res, type) \
5740 -+do { \
5741 - __asm__ __volatile__ ( \
5742 - ".set\tnoat\n" \
5743 - "1:\t"type##_sb("%1", "1(%2)")"\n" \
5744 -@@ -342,10 +363,12 @@ extern void show_registers(struct pt_regs *regs);
5745 - STR(PTR)"\t2b, 4b\n\t" \
5746 - ".previous" \
5747 - : "=r" (res) \
5748 -- : "r" (value), "r" (addr), "i" (-EFAULT));
5749 -+ : "r" (value), "r" (addr), "i" (-EFAULT));\
5750 -+} while(0)
5751 +@@ -602,6 +608,8 @@ struct event_constraint intel_westmere_pebs_event_constraints[] = {
5752 + INTEL_FLAGS_UEVENT_CONSTRAINT(0x20c8, 0xf), /* ITLB_MISS_RETIRED */
5753 + INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */
5754 + INTEL_FLAGS_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */
5755 ++ /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */
5756 ++ INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x0f),
5757 + EVENT_CONSTRAINT_END
5758 + };
5759
5760 - #ifndef CONFIG_CPU_MIPSR6
5761 - #define _StoreW(addr, value, res, type) \
5762 -+do { \
5763 - __asm__ __volatile__ ( \
5764 - "1:\t"type##_swl("%1", "(%2)")"\n" \
5765 - "2:\t"type##_swr("%1", "3(%2)")"\n\t"\
5766 -@@ -361,9 +384,11 @@ extern void show_registers(struct pt_regs *regs);
5767 - STR(PTR)"\t2b, 4b\n\t" \
5768 - ".previous" \
5769 - : "=r" (res) \
5770 -- : "r" (value), "r" (addr), "i" (-EFAULT));
5771 -+ : "r" (value), "r" (addr), "i" (-EFAULT)); \
5772 -+} while(0)
5773 +diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
5774 +index 046e2d6..a388bb8 100644
5775 +--- a/arch/x86/kernel/process.c
5776 ++++ b/arch/x86/kernel/process.c
5777 +@@ -24,6 +24,7 @@
5778 + #include <asm/syscalls.h>
5779 + #include <asm/idle.h>
5780 + #include <asm/uaccess.h>
5781 ++#include <asm/mwait.h>
5782 + #include <asm/i387.h>
5783 + #include <asm/fpu-internal.h>
5784 + #include <asm/debugreg.h>
5785 +@@ -399,6 +400,53 @@ static void amd_e400_idle(void)
5786 + default_idle();
5787 + }
5788
5789 - #define _StoreDW(addr, value, res) \
5790 -+do { \
5791 - __asm__ __volatile__ ( \
5792 - "1:\tsdl\t%1,(%2)\n" \
5793 - "2:\tsdr\t%1, 7(%2)\n\t" \
5794 -@@ -379,10 +404,13 @@ extern void show_registers(struct pt_regs *regs);
5795 - STR(PTR)"\t2b, 4b\n\t" \
5796 - ".previous" \
5797 - : "=r" (res) \
5798 -- : "r" (value), "r" (addr), "i" (-EFAULT));
5799 -+ : "r" (value), "r" (addr), "i" (-EFAULT)); \
5800 -+} while(0)
5801 -+
5802 - #else
5803 - /* MIPSR6 has no swl and sdl instructions */
5804 - #define _StoreW(addr, value, res, type) \
5805 -+do { \
5806 - __asm__ __volatile__ ( \
5807 - ".set\tpush\n\t" \
5808 - ".set\tnoat\n\t" \
5809 -@@ -409,9 +437,11 @@ extern void show_registers(struct pt_regs *regs);
5810 - ".previous" \
5811 - : "=&r" (res) \
5812 - : "r" (value), "r" (addr), "i" (-EFAULT) \
5813 -- : "memory");
5814 -+ : "memory"); \
5815 -+} while(0)
5816 ++/*
5817 ++ * Intel Core2 and older machines prefer MWAIT over HALT for C1.
5818 ++ * We can't rely on cpuidle installing MWAIT, because it will not load
5819 ++ * on systems that support only C1 -- so the boot default must be MWAIT.
5820 ++ *
5821 ++ * Some AMD machines are the opposite, they depend on using HALT.
5822 ++ *
5823 ++ * So for default C1, which is used during boot until cpuidle loads,
5824 ++ * use MWAIT-C1 on Intel HW that has it, else use HALT.
5825 ++ */
5826 ++static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
5827 ++{
5828 ++ if (c->x86_vendor != X86_VENDOR_INTEL)
5829 ++ return 0;
5830 ++
5831 ++ if (!cpu_has(c, X86_FEATURE_MWAIT))
5832 ++ return 0;
5833 ++
5834 ++ return 1;
5835 ++}
5836 ++
5837 ++/*
5838 ++ * MONITOR/MWAIT with no hints, used for default default C1 state.
5839 ++ * This invokes MWAIT with interrutps enabled and no flags,
5840 ++ * which is backwards compatible with the original MWAIT implementation.
5841 ++ */
5842 ++
5843 ++static void mwait_idle(void)
5844 ++{
5845 ++ if (!current_set_polling_and_test()) {
5846 ++ if (this_cpu_has(X86_BUG_CLFLUSH_MONITOR)) {
5847 ++ smp_mb(); /* quirk */
5848 ++ clflush((void *)&current_thread_info()->flags);
5849 ++ smp_mb(); /* quirk */
5850 ++ }
5851 ++
5852 ++ __monitor((void *)&current_thread_info()->flags, 0, 0);
5853 ++ if (!need_resched())
5854 ++ __sti_mwait(0, 0);
5855 ++ else
5856 ++ local_irq_enable();
5857 ++ } else {
5858 ++ local_irq_enable();
5859 ++ }
5860 ++ __current_clr_polling();
5861 ++}
5862 ++
5863 + void select_idle_routine(const struct cpuinfo_x86 *c)
5864 + {
5865 + #ifdef CONFIG_SMP
5866 +@@ -412,6 +460,9 @@ void select_idle_routine(const struct cpuinfo_x86 *c)
5867 + /* E400: APIC timer interrupt does not wake up CPU from C1e */
5868 + pr_info("using AMD E400 aware idle routine\n");
5869 + x86_idle = amd_e400_idle;
5870 ++ } else if (prefer_mwait_c1_over_halt(c)) {
5871 ++ pr_info("using mwait in idle threads\n");
5872 ++ x86_idle = mwait_idle;
5873 + } else
5874 + x86_idle = default_idle;
5875 + }
5876 +diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
5877 +index 2f355d2..e5ecd20 100644
5878 +--- a/arch/x86/kernel/pvclock.c
5879 ++++ b/arch/x86/kernel/pvclock.c
5880 +@@ -141,7 +141,46 @@ void pvclock_read_wallclock(struct pvclock_wall_clock *wall_clock,
5881 + set_normalized_timespec(ts, now.tv_sec, now.tv_nsec);
5882 + }
5883
5884 - #define StoreDW(addr, value, res) \
5885 -+do { \
5886 - __asm__ __volatile__ ( \
5887 - ".set\tpush\n\t" \
5888 - ".set\tnoat\n\t" \
5889 -@@ -451,12 +481,15 @@ extern void show_registers(struct pt_regs *regs);
5890 - ".previous" \
5891 - : "=&r" (res) \
5892 - : "r" (value), "r" (addr), "i" (-EFAULT) \
5893 -- : "memory");
5894 -+ : "memory"); \
5895 -+} while(0)
5896 ++static struct pvclock_vsyscall_time_info *pvclock_vdso_info;
5897 +
5898 - #endif /* CONFIG_CPU_MIPSR6 */
5899 ++static struct pvclock_vsyscall_time_info *
5900 ++pvclock_get_vsyscall_user_time_info(int cpu)
5901 ++{
5902 ++ if (!pvclock_vdso_info) {
5903 ++ BUG();
5904 ++ return NULL;
5905 ++ }
5906 ++
5907 ++ return &pvclock_vdso_info[cpu];
5908 ++}
5909 ++
5910 ++struct pvclock_vcpu_time_info *pvclock_get_vsyscall_time_info(int cpu)
5911 ++{
5912 ++ return &pvclock_get_vsyscall_user_time_info(cpu)->pvti;
5913 ++}
5914 ++
5915 + #ifdef CONFIG_X86_64
5916 ++static int pvclock_task_migrate(struct notifier_block *nb, unsigned long l,
5917 ++ void *v)
5918 ++{
5919 ++ struct task_migration_notifier *mn = v;
5920 ++ struct pvclock_vsyscall_time_info *pvti;
5921 ++
5922 ++ pvti = pvclock_get_vsyscall_user_time_info(mn->from_cpu);
5923 ++
5924 ++ /* this is NULL when pvclock vsyscall is not initialized */
5925 ++ if (unlikely(pvti == NULL))
5926 ++ return NOTIFY_DONE;
5927 ++
5928 ++ pvti->migrate_count++;
5929 ++
5930 ++ return NOTIFY_DONE;
5931 ++}
5932 ++
5933 ++static struct notifier_block pvclock_migrate = {
5934 ++ .notifier_call = pvclock_task_migrate,
5935 ++};
5936 ++
5937 + /*
5938 + * Initialize the generic pvclock vsyscall state. This will allocate
5939 + * a/some page(s) for the per-vcpu pvclock information, set up a
5940 +@@ -155,12 +194,17 @@ int __init pvclock_init_vsyscall(struct pvclock_vsyscall_time_info *i,
5941
5942 - #else /* __BIG_ENDIAN */
5943 + WARN_ON (size != PVCLOCK_VSYSCALL_NR_PAGES*PAGE_SIZE);
5944
5945 - #define _LoadHW(addr, value, res, type) \
5946 -+do { \
5947 - __asm__ __volatile__ (".set\tnoat\n" \
5948 - "1:\t"type##_lb("%0", "1(%2)")"\n" \
5949 - "2:\t"type##_lbu("$1", "0(%2)")"\n\t"\
5950 -@@ -474,10 +507,12 @@ extern void show_registers(struct pt_regs *regs);
5951 - STR(PTR)"\t2b, 4b\n\t" \
5952 - ".previous" \
5953 - : "=&r" (value), "=r" (res) \
5954 -- : "r" (addr), "i" (-EFAULT));
5955 -+ : "r" (addr), "i" (-EFAULT)); \
5956 -+} while(0)
5957 ++ pvclock_vdso_info = i;
5958 ++
5959 + for (idx = 0; idx <= (PVCLOCK_FIXMAP_END-PVCLOCK_FIXMAP_BEGIN); idx++) {
5960 + __set_fixmap(PVCLOCK_FIXMAP_BEGIN + idx,
5961 + __pa(i) + (idx*PAGE_SIZE),
5962 + PAGE_KERNEL_VVAR);
5963 + }
5964
5965 - #ifndef CONFIG_CPU_MIPSR6
5966 - #define _LoadW(addr, value, res, type) \
5967 -+do { \
5968 - __asm__ __volatile__ ( \
5969 - "1:\t"type##_lwl("%0", "3(%2)")"\n" \
5970 - "2:\t"type##_lwr("%0", "(%2)")"\n\t"\
5971 -@@ -493,10 +528,13 @@ extern void show_registers(struct pt_regs *regs);
5972 - STR(PTR)"\t2b, 4b\n\t" \
5973 - ".previous" \
5974 - : "=&r" (value), "=r" (res) \
5975 -- : "r" (addr), "i" (-EFAULT));
5976 -+ : "r" (addr), "i" (-EFAULT)); \
5977 -+} while(0)
5978 +
5979 - #else
5980 - /* MIPSR6 has no lwl instruction */
5981 - #define _LoadW(addr, value, res, type) \
5982 -+do { \
5983 - __asm__ __volatile__ ( \
5984 - ".set\tpush\n" \
5985 - ".set\tnoat\n\t" \
5986 -@@ -525,11 +563,14 @@ extern void show_registers(struct pt_regs *regs);
5987 - STR(PTR)"\t4b, 11b\n\t" \
5988 - ".previous" \
5989 - : "=&r" (value), "=r" (res) \
5990 -- : "r" (addr), "i" (-EFAULT));
5991 -+ : "r" (addr), "i" (-EFAULT)); \
5992 -+} while(0)
5993 ++ register_task_migration_notifier(&pvclock_migrate);
5994 +
5995 - #endif /* CONFIG_CPU_MIPSR6 */
5996 + return 0;
5997 + }
5998 + #endif
5999 +diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
6000 +index ae4f6d3..a60bd3a 100644
6001 +--- a/arch/x86/kvm/vmx.c
6002 ++++ b/arch/x86/kvm/vmx.c
6003 +@@ -3621,8 +3621,16 @@ static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
6004
6005 + static int vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
6006 + {
6007 +- unsigned long hw_cr4 = cr4 | (to_vmx(vcpu)->rmode.vm86_active ?
6008 +- KVM_RMODE_VM_CR4_ALWAYS_ON : KVM_PMODE_VM_CR4_ALWAYS_ON);
6009 ++ /*
6010 ++ * Pass through host's Machine Check Enable value to hw_cr4, which
6011 ++ * is in force while we are in guest mode. Do not let guests control
6012 ++ * this bit, even if host CR4.MCE == 0.
6013 ++ */
6014 ++ unsigned long hw_cr4 =
6015 ++ (cr4_read_shadow() & X86_CR4_MCE) |
6016 ++ (cr4 & ~X86_CR4_MCE) |
6017 ++ (to_vmx(vcpu)->rmode.vm86_active ?
6018 ++ KVM_RMODE_VM_CR4_ALWAYS_ON : KVM_PMODE_VM_CR4_ALWAYS_ON);
6019
6020 - #define _LoadHWU(addr, value, res, type) \
6021 -+do { \
6022 - __asm__ __volatile__ ( \
6023 - ".set\tnoat\n" \
6024 - "1:\t"type##_lbu("%0", "1(%2)")"\n" \
6025 -@@ -549,10 +590,12 @@ extern void show_registers(struct pt_regs *regs);
6026 - STR(PTR)"\t2b, 4b\n\t" \
6027 - ".previous" \
6028 - : "=&r" (value), "=r" (res) \
6029 -- : "r" (addr), "i" (-EFAULT));
6030 -+ : "r" (addr), "i" (-EFAULT)); \
6031 -+} while(0)
6032 + if (cr4 & X86_CR4_VMXE) {
6033 + /*
6034 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
6035 +index 32bf19e..e222ba5 100644
6036 +--- a/arch/x86/kvm/x86.c
6037 ++++ b/arch/x86/kvm/x86.c
6038 +@@ -5775,7 +5775,6 @@ int kvm_arch_init(void *opaque)
6039 + kvm_set_mmio_spte_mask();
6040
6041 - #ifndef CONFIG_CPU_MIPSR6
6042 - #define _LoadWU(addr, value, res, type) \
6043 -+do { \
6044 - __asm__ __volatile__ ( \
6045 - "1:\t"type##_lwl("%0", "3(%2)")"\n" \
6046 - "2:\t"type##_lwr("%0", "(%2)")"\n\t"\
6047 -@@ -570,9 +613,11 @@ extern void show_registers(struct pt_regs *regs);
6048 - STR(PTR)"\t2b, 4b\n\t" \
6049 - ".previous" \
6050 - : "=&r" (value), "=r" (res) \
6051 -- : "r" (addr), "i" (-EFAULT));
6052 -+ : "r" (addr), "i" (-EFAULT)); \
6053 -+} while(0)
6054 + kvm_x86_ops = ops;
6055 +- kvm_init_msr_list();
6056
6057 - #define _LoadDW(addr, value, res) \
6058 -+do { \
6059 - __asm__ __volatile__ ( \
6060 - "1:\tldl\t%0, 7(%2)\n" \
6061 - "2:\tldr\t%0, (%2)\n\t" \
6062 -@@ -588,10 +633,13 @@ extern void show_registers(struct pt_regs *regs);
6063 - STR(PTR)"\t2b, 4b\n\t" \
6064 - ".previous" \
6065 - : "=&r" (value), "=r" (res) \
6066 -- : "r" (addr), "i" (-EFAULT));
6067 -+ : "r" (addr), "i" (-EFAULT)); \
6068 -+} while(0)
6069 -+
6070 - #else
6071 - /* MIPSR6 has not lwl and ldl instructions */
6072 - #define _LoadWU(addr, value, res, type) \
6073 -+do { \
6074 - __asm__ __volatile__ ( \
6075 - ".set\tpush\n\t" \
6076 - ".set\tnoat\n\t" \
6077 -@@ -620,9 +668,11 @@ extern void show_registers(struct pt_regs *regs);
6078 - STR(PTR)"\t4b, 11b\n\t" \
6079 - ".previous" \
6080 - : "=&r" (value), "=r" (res) \
6081 -- : "r" (addr), "i" (-EFAULT));
6082 -+ : "r" (addr), "i" (-EFAULT)); \
6083 -+} while(0)
6084 + kvm_mmu_set_mask_ptes(PT_USER_MASK, PT_ACCESSED_MASK,
6085 + PT_DIRTY_MASK, PT64_NX_MASK, 0);
6086 +@@ -7209,7 +7208,14 @@ void kvm_arch_hardware_disable(void)
6087
6088 - #define _LoadDW(addr, value, res) \
6089 -+do { \
6090 - __asm__ __volatile__ ( \
6091 - ".set\tpush\n\t" \
6092 - ".set\tnoat\n\t" \
6093 -@@ -667,10 +717,12 @@ extern void show_registers(struct pt_regs *regs);
6094 - STR(PTR)"\t8b, 11b\n\t" \
6095 - ".previous" \
6096 - : "=&r" (value), "=r" (res) \
6097 -- : "r" (addr), "i" (-EFAULT));
6098 -+ : "r" (addr), "i" (-EFAULT)); \
6099 -+} while(0)
6100 - #endif /* CONFIG_CPU_MIPSR6 */
6101 -
6102 - #define _StoreHW(addr, value, res, type) \
6103 -+do { \
6104 - __asm__ __volatile__ ( \
6105 - ".set\tnoat\n" \
6106 - "1:\t"type##_sb("%1", "0(%2)")"\n" \
6107 -@@ -689,9 +741,12 @@ extern void show_registers(struct pt_regs *regs);
6108 - STR(PTR)"\t2b, 4b\n\t" \
6109 - ".previous" \
6110 - : "=r" (res) \
6111 -- : "r" (value), "r" (addr), "i" (-EFAULT));
6112 -+ : "r" (value), "r" (addr), "i" (-EFAULT));\
6113 -+} while(0)
6114 + int kvm_arch_hardware_setup(void)
6115 + {
6116 +- return kvm_x86_ops->hardware_setup();
6117 ++ int r;
6118 +
6119 - #ifndef CONFIG_CPU_MIPSR6
6120 - #define _StoreW(addr, value, res, type) \
6121 -+do { \
6122 - __asm__ __volatile__ ( \
6123 - "1:\t"type##_swl("%1", "3(%2)")"\n" \
6124 - "2:\t"type##_swr("%1", "(%2)")"\n\t"\
6125 -@@ -707,9 +762,11 @@ extern void show_registers(struct pt_regs *regs);
6126 - STR(PTR)"\t2b, 4b\n\t" \
6127 - ".previous" \
6128 - : "=r" (res) \
6129 -- : "r" (value), "r" (addr), "i" (-EFAULT));
6130 -+ : "r" (value), "r" (addr), "i" (-EFAULT)); \
6131 -+} while(0)
6132 -
6133 - #define _StoreDW(addr, value, res) \
6134 -+do { \
6135 - __asm__ __volatile__ ( \
6136 - "1:\tsdl\t%1, 7(%2)\n" \
6137 - "2:\tsdr\t%1, (%2)\n\t" \
6138 -@@ -725,10 +782,13 @@ extern void show_registers(struct pt_regs *regs);
6139 - STR(PTR)"\t2b, 4b\n\t" \
6140 - ".previous" \
6141 - : "=r" (res) \
6142 -- : "r" (value), "r" (addr), "i" (-EFAULT));
6143 -+ : "r" (value), "r" (addr), "i" (-EFAULT)); \
6144 -+} while(0)
6145 ++ r = kvm_x86_ops->hardware_setup();
6146 ++ if (r != 0)
6147 ++ return r;
6148 +
6149 - #else
6150 - /* MIPSR6 has no swl and sdl instructions */
6151 - #define _StoreW(addr, value, res, type) \
6152 -+do { \
6153 - __asm__ __volatile__ ( \
6154 - ".set\tpush\n\t" \
6155 - ".set\tnoat\n\t" \
6156 -@@ -755,9 +815,11 @@ extern void show_registers(struct pt_regs *regs);
6157 - ".previous" \
6158 - : "=&r" (res) \
6159 - : "r" (value), "r" (addr), "i" (-EFAULT) \
6160 -- : "memory");
6161 -+ : "memory"); \
6162 -+} while(0)
6163 ++ kvm_init_msr_list();
6164 ++ return 0;
6165 + }
6166
6167 - #define _StoreDW(addr, value, res) \
6168 -+do { \
6169 - __asm__ __volatile__ ( \
6170 - ".set\tpush\n\t" \
6171 - ".set\tnoat\n\t" \
6172 -@@ -797,7 +859,9 @@ extern void show_registers(struct pt_regs *regs);
6173 - ".previous" \
6174 - : "=&r" (res) \
6175 - : "r" (value), "r" (addr), "i" (-EFAULT) \
6176 -- : "memory");
6177 -+ : "memory"); \
6178 -+} while(0)
6179 + void kvm_arch_hardware_unsetup(void)
6180 +diff --git a/arch/x86/lib/insn.c b/arch/x86/lib/insn.c
6181 +index 1313ae6..85994f5 100644
6182 +--- a/arch/x86/lib/insn.c
6183 ++++ b/arch/x86/lib/insn.c
6184 +@@ -52,6 +52,13 @@
6185 + */
6186 + void insn_init(struct insn *insn, const void *kaddr, int buf_len, int x86_64)
6187 + {
6188 ++ /*
6189 ++ * Instructions longer than MAX_INSN_SIZE (15 bytes) are invalid
6190 ++ * even if the input buffer is long enough to hold them.
6191 ++ */
6192 ++ if (buf_len > MAX_INSN_SIZE)
6193 ++ buf_len = MAX_INSN_SIZE;
6194 +
6195 - #endif /* CONFIG_CPU_MIPSR6 */
6196 - #endif
6197 + memset(insn, 0, sizeof(*insn));
6198 + insn->kaddr = kaddr;
6199 + insn->end_kaddr = kaddr + buf_len;
6200 +diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
6201 +index 1f33b3d..0a42327 100644
6202 +--- a/arch/x86/lib/usercopy_64.c
6203 ++++ b/arch/x86/lib/usercopy_64.c
6204 +@@ -82,7 +82,7 @@ copy_user_handle_tail(char *to, char *from, unsigned len)
6205 + clac();
6206
6207 ---
6208 -2.3.6
6209 -
6210 -
6211 -From e239cb24f08477d187a5bb831088de60f70e3ade Mon Sep 17 00:00:00 2001
6212 -From: Markos Chandras <markos.chandras@××××××.com>
6213 -Date: Mon, 9 Mar 2015 14:54:52 +0000
6214 -Subject: [PATCH 041/219] MIPS: unaligned: Fix regular load/store instruction
6215 - emulation for EVA
6216 -Cc: mpagano@g.o
6217 -
6218 -commit 6eae35485b26f9e51ab896eb8a936bed9908fdf6 upstream.
6219 -
6220 -When emulating a regular lh/lw/lhu/sh/sw we need to use the appropriate
6221 -instruction if we are in EVA mode. This is necessary for userspace
6222 -applications which trigger alignment exceptions. In such case, the
6223 -userspace load/store instruction needs to be emulated with the correct
6224 -eva/non-eva instruction by the kernel emulator.
6225 -
6226 -Signed-off-by: Markos Chandras <markos.chandras@××××××.com>
6227 -Fixes: c1771216ab48 ("MIPS: kernel: unaligned: Handle unaligned accesses for EVA")
6228 -Cc: linux-mips@××××××××××.org
6229 -Patchwork: https://patchwork.linux-mips.org/patch/9503/
6230 -Signed-off-by: Ralf Baechle <ralf@××××××××××.org>
6231 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
6232 -Signed-off-by: Mike Pagano <mpagano@g.o>
6233 ----
6234 - arch/mips/kernel/unaligned.c | 52 +++++++++++++++++++++++++++++++++++++++-----
6235 - 1 file changed, 47 insertions(+), 5 deletions(-)
6236 -
6237 -diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
6238 -index ab47590..7659da2 100644
6239 ---- a/arch/mips/kernel/unaligned.c
6240 -+++ b/arch/mips/kernel/unaligned.c
6241 -@@ -1023,7 +1023,15 @@ static void emulate_load_store_insn(struct pt_regs *regs,
6242 - if (!access_ok(VERIFY_READ, addr, 2))
6243 - goto sigbus;
6244 + /* If the destination is a kernel buffer, we always clear the end */
6245 +- if ((unsigned long)to >= TASK_SIZE_MAX)
6246 ++ if (!__addr_ok(to))
6247 + memset(to, 0, len);
6248 + return len;
6249 + }
6250 +diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
6251 +index 9793322..40d2473 100644
6252 +--- a/arch/x86/vdso/vclock_gettime.c
6253 ++++ b/arch/x86/vdso/vclock_gettime.c
6254 +@@ -82,18 +82,15 @@ static notrace cycle_t vread_pvclock(int *mode)
6255 + cycle_t ret;
6256 + u64 last;
6257 + u32 version;
6258 ++ u32 migrate_count;
6259 + u8 flags;
6260 + unsigned cpu, cpu1;
6261
6262 -- LoadHW(addr, value, res);
6263 -+ if (config_enabled(CONFIG_EVA)) {
6264 -+ if (segment_eq(get_fs(), get_ds()))
6265 -+ LoadHW(addr, value, res);
6266 -+ else
6267 -+ LoadHWE(addr, value, res);
6268 -+ } else {
6269 -+ LoadHW(addr, value, res);
6270 -+ }
6271 -+
6272 - if (res)
6273 - goto fault;
6274 - compute_return_epc(regs);
6275 -@@ -1034,7 +1042,15 @@ static void emulate_load_store_insn(struct pt_regs *regs,
6276 - if (!access_ok(VERIFY_READ, addr, 4))
6277 - goto sigbus;
6278
6279 -- LoadW(addr, value, res);
6280 -+ if (config_enabled(CONFIG_EVA)) {
6281 -+ if (segment_eq(get_fs(), get_ds()))
6282 -+ LoadW(addr, value, res);
6283 -+ else
6284 -+ LoadWE(addr, value, res);
6285 -+ } else {
6286 -+ LoadW(addr, value, res);
6287 -+ }
6288 -+
6289 - if (res)
6290 - goto fault;
6291 - compute_return_epc(regs);
6292 -@@ -1045,7 +1061,15 @@ static void emulate_load_store_insn(struct pt_regs *regs,
6293 - if (!access_ok(VERIFY_READ, addr, 2))
6294 - goto sigbus;
6295 + /*
6296 +- * Note: hypervisor must guarantee that:
6297 +- * 1. cpu ID number maps 1:1 to per-CPU pvclock time info.
6298 +- * 2. that per-CPU pvclock time info is updated if the
6299 +- * underlying CPU changes.
6300 +- * 3. that version is increased whenever underlying CPU
6301 +- * changes.
6302 +- *
6303 ++ * When looping to get a consistent (time-info, tsc) pair, we
6304 ++ * also need to deal with the possibility we can switch vcpus,
6305 ++ * so make sure we always re-fetch time-info for the current vcpu.
6306 + */
6307 + do {
6308 + cpu = __getcpu() & VGETCPU_CPU_MASK;
6309 +@@ -102,20 +99,27 @@ static notrace cycle_t vread_pvclock(int *mode)
6310 + * __getcpu() calls (Gleb).
6311 + */
6312
6313 -- LoadHWU(addr, value, res);
6314 -+ if (config_enabled(CONFIG_EVA)) {
6315 -+ if (segment_eq(get_fs(), get_ds()))
6316 -+ LoadHWU(addr, value, res);
6317 -+ else
6318 -+ LoadHWUE(addr, value, res);
6319 -+ } else {
6320 -+ LoadHWU(addr, value, res);
6321 -+ }
6322 +- pvti = get_pvti(cpu);
6323 ++ /* Make sure migrate_count will change if we leave the VCPU. */
6324 ++ do {
6325 ++ pvti = get_pvti(cpu);
6326 ++ migrate_count = pvti->migrate_count;
6327 +
6328 - if (res)
6329 - goto fault;
6330 - compute_return_epc(regs);
6331 -@@ -1104,7 +1128,16 @@ static void emulate_load_store_insn(struct pt_regs *regs,
6332 ++ cpu1 = cpu;
6333 ++ cpu = __getcpu() & VGETCPU_CPU_MASK;
6334 ++ } while (unlikely(cpu != cpu1));
6335
6336 - compute_return_epc(regs);
6337 - value = regs->regs[insn.i_format.rt];
6338 -- StoreHW(addr, value, res);
6339 -+
6340 -+ if (config_enabled(CONFIG_EVA)) {
6341 -+ if (segment_eq(get_fs(), get_ds()))
6342 -+ StoreHW(addr, value, res);
6343 -+ else
6344 -+ StoreHWE(addr, value, res);
6345 -+ } else {
6346 -+ StoreHW(addr, value, res);
6347 -+ }
6348 -+
6349 - if (res)
6350 - goto fault;
6351 - break;
6352 -@@ -1115,7 +1148,16 @@ static void emulate_load_store_insn(struct pt_regs *regs,
6353 + version = __pvclock_read_cycles(&pvti->pvti, &ret, &flags);
6354
6355 - compute_return_epc(regs);
6356 - value = regs->regs[insn.i_format.rt];
6357 -- StoreW(addr, value, res);
6358 -+
6359 -+ if (config_enabled(CONFIG_EVA)) {
6360 -+ if (segment_eq(get_fs(), get_ds()))
6361 -+ StoreW(addr, value, res);
6362 -+ else
6363 -+ StoreWE(addr, value, res);
6364 -+ } else {
6365 -+ StoreW(addr, value, res);
6366 -+ }
6367 -+
6368 - if (res)
6369 - goto fault;
6370 - break;
6371 ---
6372 -2.3.6
6373 -
6374 -
6375 -From 9da8705189d48b9d74724d5ae37c5a3a486fcfef Mon Sep 17 00:00:00 2001
6376 -From: Huacai Chen <chenhc@××××××.com>
6377 -Date: Thu, 12 Mar 2015 11:51:06 +0800
6378 -Subject: [PATCH 042/219] MIPS: Loongson-3: Add IRQF_NO_SUSPEND to Cascade
6379 - irqaction
6380 -Cc: mpagano@g.o
6381 -
6382 -commit 0add9c2f1cff9f3f1f2eb7e9babefa872a9d14b9 upstream.
6383 -
6384 -HPET irq is routed to i8259 and then to MIPS CPU irq (cascade). After
6385 -commit a3e6c1eff5 (MIPS: IRQ: Fix disable_irq on CPU IRQs), if without
6386 -IRQF_NO_SUSPEND in cascade_irqaction, HPET interrupts will lost during
6387 -suspend. The result is machine cannot be waken up.
6388 -
6389 -Signed-off-by: Huacai Chen <chenhc@××××××.com>
6390 -Cc: Steven J. Hill <Steven.Hill@××××××.com>
6391 -Cc: linux-mips@××××××××××.org
6392 -Cc: Fuxin Zhang <zhangfx@××××××.com>
6393 -Cc: Zhangjin Wu <wuzhangjin@×××××.com>
6394 -Patchwork: https://patchwork.linux-mips.org/patch/9528/
6395 -Signed-off-by: Ralf Baechle <ralf@××××××××××.org>
6396 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
6397 -Signed-off-by: Mike Pagano <mpagano@g.o>
6398 ----
6399 - arch/mips/loongson/loongson-3/irq.c | 1 +
6400 - 1 file changed, 1 insertion(+)
6401 -
6402 -diff --git a/arch/mips/loongson/loongson-3/irq.c b/arch/mips/loongson/loongson-3/irq.c
6403 -index 21221ed..0f75b6b 100644
6404 ---- a/arch/mips/loongson/loongson-3/irq.c
6405 -+++ b/arch/mips/loongson/loongson-3/irq.c
6406 -@@ -44,6 +44,7 @@ void mach_irq_dispatch(unsigned int pending)
6407 + /*
6408 + * Test we're still on the cpu as well as the version.
6409 +- * We could have been migrated just after the first
6410 +- * vgetcpu but before fetching the version, so we
6411 +- * wouldn't notice a version change.
6412 ++ * - We must read TSC of pvti's VCPU.
6413 ++ * - KVM doesn't follow the versioning protocol, so data could
6414 ++ * change before version if we left the VCPU.
6415 + */
6416 +- cpu1 = __getcpu() & VGETCPU_CPU_MASK;
6417 +- } while (unlikely(cpu != cpu1 ||
6418 +- (pvti->pvti.version & 1) ||
6419 +- pvti->pvti.version != version));
6420 ++ smp_rmb();
6421 ++ } while (unlikely((pvti->pvti.version & 1) ||
6422 ++ pvti->pvti.version != version ||
6423 ++ pvti->migrate_count != migrate_count));
6424
6425 - static struct irqaction cascade_irqaction = {
6426 - .handler = no_action,
6427 -+ .flags = IRQF_NO_SUSPEND,
6428 - .name = "cascade",
6429 - };
6430 + if (unlikely(!(flags & PVCLOCK_TSC_STABLE_BIT)))
6431 + *mode = VCLOCK_NONE;
6432 +diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
6433 +index e31d494..87be10e 100644
6434 +--- a/arch/xtensa/Kconfig
6435 ++++ b/arch/xtensa/Kconfig
6436 +@@ -428,6 +428,36 @@ config DEFAULT_MEM_SIZE
6437
6438 ---
6439 -2.3.6
6440 -
6441 -
6442 -From 6fbe5c7cd4d50582ba22c0a979131e347ec7b132 Mon Sep 17 00:00:00 2001
6443 -From: Huacai Chen <chenhc@××××××.com>
6444 -Date: Sun, 29 Mar 2015 10:54:05 +0800
6445 -Subject: [PATCH 043/219] MIPS: Hibernate: flush TLB entries earlier
6446 -Cc: mpagano@g.o
6447 -
6448 -commit a843d00d038b11267279e3b5388222320f9ddc1d upstream.
6449 -
6450 -We found that TLB mismatch not only happens after kernel resume, but
6451 -also happens during snapshot restore. So move it to the beginning of
6452 -swsusp_arch_suspend().
6453 -
6454 -Signed-off-by: Huacai Chen <chenhc@××××××.com>
6455 -Cc: Steven J. Hill <Steven.Hill@××××××.com>
6456 -Cc: linux-mips@××××××××××.org
6457 -Cc: Fuxin Zhang <zhangfx@××××××.com>
6458 -Cc: Zhangjin Wu <wuzhangjin@×××××.com>
6459 -Patchwork: https://patchwork.linux-mips.org/patch/9621/
6460 -Signed-off-by: Ralf Baechle <ralf@××××××××××.org>
6461 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
6462 -Signed-off-by: Mike Pagano <mpagano@g.o>
6463 ----
6464 - arch/mips/power/hibernate.S | 3 ++-
6465 - 1 file changed, 2 insertions(+), 1 deletion(-)
6466 -
6467 -diff --git a/arch/mips/power/hibernate.S b/arch/mips/power/hibernate.S
6468 -index 32a7c82..e7567c8 100644
6469 ---- a/arch/mips/power/hibernate.S
6470 -+++ b/arch/mips/power/hibernate.S
6471 -@@ -30,6 +30,8 @@ LEAF(swsusp_arch_suspend)
6472 - END(swsusp_arch_suspend)
6473 + If unsure, leave the default value here.
6474
6475 - LEAF(swsusp_arch_resume)
6476 -+ /* Avoid TLB mismatch during and after kernel resume */
6477 -+ jal local_flush_tlb_all
6478 - PTR_L t0, restore_pblist
6479 - 0:
6480 - PTR_L t1, PBE_ADDRESS(t0) /* source */
6481 -@@ -43,7 +45,6 @@ LEAF(swsusp_arch_resume)
6482 - bne t1, t3, 1b
6483 - PTR_L t0, PBE_NEXT(t0)
6484 - bnez t0, 0b
6485 -- jal local_flush_tlb_all /* Avoid TLB mismatch after kernel resume */
6486 - PTR_LA t0, saved_regs
6487 - PTR_L ra, PT_R31(t0)
6488 - PTR_L sp, PT_R29(t0)
6489 ---
6490 -2.3.6
6491 -
6492 -
6493 -From f0ce3bf7fa069f614101c819576cb0344076e95c Mon Sep 17 00:00:00 2001
6494 -From: Sudip Mukherjee <sudipm.mukherjee@×××××.com>
6495 -Date: Tue, 24 Mar 2015 16:29:32 +0530
6496 -Subject: [PATCH 044/219] staging: panel: fix lcd type
6497 -Cc: mpagano@g.o
6498 -
6499 -commit 2c20d92dad5db6440cfa88d811b69fd605240ce4 upstream.
6500 -
6501 -the lcd type as defined in the Kconfig is not matching in the code.
6502 -as a result the rs, rw and en pins were getting interchanged.
6503 -Kconfig defines the value of PANEL_LCD to be 1 if we select custom
6504 -configuration but in the code LCD_TYPE_CUSTOM is defined as 5.
6505 -
6506 -my hardware is LCD_TYPE_CUSTOM, but the pins were assigned to it
6507 -as pins of LCD_TYPE_OLD, and it was not working.
6508 -Now values are corrected with referenece to the values defined in
6509 -Kconfig and it is working.
6510 -checked on JHD204A lcd with LCD_TYPE_CUSTOM configuration.
6511 -
6512 -Signed-off-by: Sudip Mukherjee <sudip@×××××××××××.org>
6513 -Acked-by: Willy Tarreau <w@×××.eu>
6514 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
6515 -Signed-off-by: Mike Pagano <mpagano@g.o>
6516 ----
6517 - drivers/staging/panel/panel.c | 12 ++++++------
6518 - 1 file changed, 6 insertions(+), 6 deletions(-)
6519 -
6520 -diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
6521 -index 6ed35b6..04fc217 100644
6522 ---- a/drivers/staging/panel/panel.c
6523 -+++ b/drivers/staging/panel/panel.c
6524 -@@ -335,11 +335,11 @@ static unsigned char lcd_bits[LCD_PORTS][LCD_BITS][BIT_STATES];
6525 - * LCD types
6526 - */
6527 - #define LCD_TYPE_NONE 0
6528 --#define LCD_TYPE_OLD 1
6529 --#define LCD_TYPE_KS0074 2
6530 --#define LCD_TYPE_HANTRONIX 3
6531 --#define LCD_TYPE_NEXCOM 4
6532 --#define LCD_TYPE_CUSTOM 5
6533 -+#define LCD_TYPE_CUSTOM 1
6534 -+#define LCD_TYPE_OLD 2
6535 -+#define LCD_TYPE_KS0074 3
6536 -+#define LCD_TYPE_HANTRONIX 4
6537 -+#define LCD_TYPE_NEXCOM 5
6538 ++config XTFPGA_LCD
6539 ++ bool "Enable XTFPGA LCD driver"
6540 ++ depends on XTENSA_PLATFORM_XTFPGA
6541 ++ default n
6542 ++ help
6543 ++ There's a 2x16 LCD on most of XTFPGA boards, kernel may output
6544 ++ progress messages there during bootup/shutdown. It may be useful
6545 ++ during board bringup.
6546 ++
6547 ++ If unsure, say N.
6548 ++
6549 ++config XTFPGA_LCD_BASE_ADDR
6550 ++ hex "XTFPGA LCD base address"
6551 ++ depends on XTFPGA_LCD
6552 ++ default "0x0d0c0000"
6553 ++ help
6554 ++ Base address of the LCD controller inside KIO region.
6555 ++ Different boards from XTFPGA family have LCD controller at different
6556 ++ addresses. Please consult prototyping user guide for your board for
6557 ++ the correct address. Wrong address here may lead to hardware lockup.
6558 ++
6559 ++config XTFPGA_LCD_8BIT_ACCESS
6560 ++ bool "Use 8-bit access to XTFPGA LCD"
6561 ++ depends on XTFPGA_LCD
6562 ++ default n
6563 ++ help
6564 ++ LCD may be connected with 4- or 8-bit interface, 8-bit access may
6565 ++ only be used with 8-bit interface. Please consult prototyping user
6566 ++ guide for your board for the correct interface width.
6567 ++
6568 + endmenu
6569
6570 - /*
6571 - * keypad types
6572 -@@ -502,7 +502,7 @@ MODULE_PARM_DESC(keypad_type,
6573 - static int lcd_type = NOT_SET;
6574 - module_param(lcd_type, int, 0000);
6575 - MODULE_PARM_DESC(lcd_type,
6576 -- "LCD type: 0=none, 1=old //, 2=serial ks0074, 3=hantronix //, 4=nexcom //, 5=compiled-in");
6577 -+ "LCD type: 0=none, 1=compiled-in, 2=old, 3=serial ks0074, 4=hantronix, 5=nexcom");
6578 + menu "Executable file formats"
6579 +diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h
6580 +index db5bb72..62d8465 100644
6581 +--- a/arch/xtensa/include/uapi/asm/unistd.h
6582 ++++ b/arch/xtensa/include/uapi/asm/unistd.h
6583 +@@ -715,7 +715,7 @@ __SYSCALL(323, sys_process_vm_writev, 6)
6584 + __SYSCALL(324, sys_name_to_handle_at, 5)
6585 + #define __NR_open_by_handle_at 325
6586 + __SYSCALL(325, sys_open_by_handle_at, 3)
6587 +-#define __NR_sync_file_range 326
6588 ++#define __NR_sync_file_range2 326
6589 + __SYSCALL(326, sys_sync_file_range2, 6)
6590 + #define __NR_perf_event_open 327
6591 + __SYSCALL(327, sys_perf_event_open, 5)
6592 +diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
6593 +index d05f8fe..17b1ef3 100644
6594 +--- a/arch/xtensa/platforms/iss/network.c
6595 ++++ b/arch/xtensa/platforms/iss/network.c
6596 +@@ -349,8 +349,8 @@ static void iss_net_timer(unsigned long priv)
6597 + {
6598 + struct iss_net_private *lp = (struct iss_net_private *)priv;
6599
6600 - static int lcd_height = NOT_SET;
6601 - module_param(lcd_height, int, 0000);
6602 ---
6603 -2.3.6
6604 -
6605 -
6606 -From da01c0cfb196bef048fcb16727d646138d257ce3 Mon Sep 17 00:00:00 2001
6607 -From: Alistair Strachan <alistair.strachan@××××××.com>
6608 -Date: Tue, 24 Mar 2015 14:51:31 -0700
6609 -Subject: [PATCH 045/219] staging: android: sync: Fix memory corruption in
6610 - sync_timeline_signal().
6611 -Cc: mpagano@g.o
6612 -
6613 -commit 8e43c9c75faf2902955bd2ecd7a50a8cc41cb00a upstream.
6614 -
6615 -The android_fence_release() function checks for active sync points
6616 -by calling list_empty() on the list head embedded on the sync
6617 -point. However, it is only valid to use list_empty() on nodes that
6618 -have been initialized with INIT_LIST_HEAD() or list_del_init().
6619 -
6620 -Because the list entry has likely been removed from the active list
6621 -by sync_timeline_signal(), there is a good chance that this
6622 -WARN_ON_ONCE() will be hit due to dangling pointers pointing at
6623 -freed memory (even though the sync drivers did nothing wrong)
6624 -and memory corruption will ensue as the list entry is removed for
6625 -a second time, corrupting the active list.
6626 -
6627 -This problem can be reproduced quite easily with CONFIG_DEBUG_LIST=y
6628 -and fences with more than one sync point.
6629 -
6630 -Signed-off-by: Alistair Strachan <alistair.strachan@××××××.com>
6631 -Cc: Maarten Lankhorst <maarten.lankhorst@×××××××××.com>
6632 -Cc: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
6633 -Cc: Colin Cross <ccross@××××××.com>
6634 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
6635 -Signed-off-by: Mike Pagano <mpagano@g.o>
6636 ----
6637 - drivers/staging/android/sync.c | 2 +-
6638 - 1 file changed, 1 insertion(+), 1 deletion(-)
6639 -
6640 -diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
6641 -index 7bdb62b..f83e00c 100644
6642 ---- a/drivers/staging/android/sync.c
6643 -+++ b/drivers/staging/android/sync.c
6644 -@@ -114,7 +114,7 @@ void sync_timeline_signal(struct sync_timeline *obj)
6645 - list_for_each_entry_safe(pt, next, &obj->active_list_head,
6646 - active_list) {
6647 - if (fence_is_signaled_locked(&pt->base))
6648 -- list_del(&pt->active_list);
6649 -+ list_del_init(&pt->active_list);
6650 - }
6651 +- spin_lock(&lp->lock);
6652 + iss_net_poll();
6653 ++ spin_lock(&lp->lock);
6654 + mod_timer(&lp->timer, jiffies + lp->timer_val);
6655 + spin_unlock(&lp->lock);
6656 + }
6657 +@@ -361,7 +361,7 @@ static int iss_net_open(struct net_device *dev)
6658 + struct iss_net_private *lp = netdev_priv(dev);
6659 + int err;
6660
6661 - spin_unlock_irqrestore(&obj->child_list_lock, flags);
6662 ---
6663 -2.3.6
6664 -
6665 -
6666 -From c373916a7434a49607ece05dbf0f60c697ad7291 Mon Sep 17 00:00:00 2001
6667 -From: Malcolm Priestley <tvboxspy@×××××.com>
6668 -Date: Wed, 1 Apr 2015 22:32:52 +0100
6669 -Subject: [PATCH 046/219] staging: vt6655: use ieee80211_tx_info to select
6670 - packet type.
6671 -Cc: mpagano@g.o
6672 -
6673 -commit a6388e68321a1e0a0f408379c2a36396807745b3 upstream.
6674 -
6675 -Information for packet type is in ieee80211_tx_info
6676 -
6677 -band IEEE80211_BAND_5GHZ for PK_TYPE_11A.
6678 -
6679 -IEEE80211_TX_RC_USE_CTS_PROTECT via tx_rate flags selects PK_TYPE_11GB
6680 -
6681 -This ensures that the packet is always the right type.
6682 -
6683 -Signed-off-by: Malcolm Priestley <tvboxspy@×××××.com>
6684 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
6685 -Signed-off-by: Mike Pagano <mpagano@g.o>
6686 ----
6687 - drivers/staging/vt6655/rxtx.c | 14 +++++++++++---
6688 - 1 file changed, 11 insertions(+), 3 deletions(-)
6689 -
6690 -diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
6691 -index 07ce3fd..fdf5c56 100644
6692 ---- a/drivers/staging/vt6655/rxtx.c
6693 -+++ b/drivers/staging/vt6655/rxtx.c
6694 -@@ -1308,10 +1308,18 @@ int vnt_generate_fifo_header(struct vnt_private *priv, u32 dma_idx,
6695 - priv->hw->conf.chandef.chan->hw_value);
6696 - }
6697 +- spin_lock(&lp->lock);
6698 ++ spin_lock_bh(&lp->lock);
6699
6700 -- if (current_rate > RATE_11M)
6701 -- pkt_type = (u8)priv->byPacketType;
6702 -- else
6703 -+ if (current_rate > RATE_11M) {
6704 -+ if (info->band == IEEE80211_BAND_5GHZ) {
6705 -+ pkt_type = PK_TYPE_11A;
6706 -+ } else {
6707 -+ if (tx_rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
6708 -+ pkt_type = PK_TYPE_11GB;
6709 -+ else
6710 -+ pkt_type = PK_TYPE_11GA;
6711 -+ }
6712 -+ } else {
6713 - pkt_type = PK_TYPE_11B;
6714 -+ }
6715 + err = lp->tp.open(lp);
6716 + if (err < 0)
6717 +@@ -376,9 +376,11 @@ static int iss_net_open(struct net_device *dev)
6718 + while ((err = iss_net_rx(dev)) > 0)
6719 + ;
6720
6721 - /*Set fifo controls */
6722 - if (pkt_type == PK_TYPE_11A)
6723 ---
6724 -2.3.6
6725 -
6726 -
6727 -From a89d16cbd3a2838b54e404d7f8dd0af60667fa21 Mon Sep 17 00:00:00 2001
6728 -From: NeilBrown <neilb@××××.de>
6729 -Date: Fri, 10 Apr 2015 13:19:04 +1000
6730 -Subject: [PATCH 047/219] md/raid0: fix bug with chunksize not a power of 2.
6731 -Cc: mpagano@g.o
6732 -
6733 -commit 47d68979cc968535cb87f3e5f2e6a3533ea48fbd upstream.
6734 -
6735 -Since commit 20d0189b1012a37d2533a87fb451f7852f2418d1
6736 -in v3.14-rc1 RAID0 has performed incorrect calculations
6737 -when the chunksize is not a power of 2.
6738 -
6739 -This happens because "sector_div()" modifies its first argument, but
6740 -this wasn't taken into account in the patch.
6741 -
6742 -So restore that first arg before re-using the variable.
6743 -
6744 -Reported-by: Joe Landman <joe.landman@×××××.com>
6745 -Reported-by: Dave Chinner <david@×××××××××.com>
6746 -Fixes: 20d0189b1012a37d2533a87fb451f7852f2418d1
6747 -Signed-off-by: NeilBrown <neilb@××××.de>
6748 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
6749 -Signed-off-by: Mike Pagano <mpagano@g.o>
6750 ----
6751 - drivers/md/raid0.c | 3 ++-
6752 - 1 file changed, 2 insertions(+), 1 deletion(-)
6753 -
6754 -diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
6755 -index 3ed9f42..3b5d7f7 100644
6756 ---- a/drivers/md/raid0.c
6757 -+++ b/drivers/md/raid0.c
6758 -@@ -313,7 +313,7 @@ static struct strip_zone *find_zone(struct r0conf *conf,
6759 +- spin_lock(&opened_lock);
6760 ++ spin_unlock_bh(&lp->lock);
6761 ++ spin_lock_bh(&opened_lock);
6762 + list_add(&lp->opened_list, &opened);
6763 +- spin_unlock(&opened_lock);
6764 ++ spin_unlock_bh(&opened_lock);
6765 ++ spin_lock_bh(&lp->lock);
6766
6767 - /*
6768 - * remaps the bio to the target device. we separate two flows.
6769 -- * power 2 flow and a general flow for the sake of perfromance
6770 -+ * power 2 flow and a general flow for the sake of performance
6771 - */
6772 - static struct md_rdev *map_sector(struct mddev *mddev, struct strip_zone *zone,
6773 - sector_t sector, sector_t *sector_offset)
6774 -@@ -524,6 +524,7 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio)
6775 - split = bio;
6776 - }
6777 + init_timer(&lp->timer);
6778 + lp->timer_val = ISS_NET_TIMER_VALUE;
6779 +@@ -387,7 +389,7 @@ static int iss_net_open(struct net_device *dev)
6780 + mod_timer(&lp->timer, jiffies + lp->timer_val);
6781
6782 -+ sector = bio->bi_iter.bi_sector;
6783 - zone = find_zone(mddev->private, &sector);
6784 - tmp_dev = map_sector(mddev, zone, sector, &sector);
6785 - split->bi_bdev = tmp_dev->bdev;
6786 ---
6787 -2.3.6
6788 -
6789 -
6790 -From a3ec48fa3f64ea293bfe691a02c17c0a7d2887e1 Mon Sep 17 00:00:00 2001
6791 -From: Christoph Hellwig <hch@×××××××××.org>
6792 -Date: Wed, 15 Apr 2015 09:44:37 -0700
6793 -Subject: [PATCH 048/219] megaraid_sas: use raw_smp_processor_id()
6794 -Cc: mpagano@g.o
6795 -
6796 -commit 16b8528d20607925899b1df93bfd8fbab98d267c upstream.
6797 -
6798 -We only want to steer the I/O completion towards a queue, but don't
6799 -actually access any per-CPU data, so the raw_ version is fine to use
6800 -and avoids the warnings when using smp_processor_id().
6801 -
6802 -Signed-off-by: Christoph Hellwig <hch@×××.de>
6803 -Reported-by: Andy Lutomirski <luto@××××××.org>
6804 -Tested-by: Andy Lutomirski <luto@××××××.org>
6805 -Acked-by: Sumit Saxena <sumit.saxena@×××××××××.com>
6806 -Signed-off-by: James Bottomley <JBottomley@××××.com>
6807 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
6808 -Signed-off-by: Mike Pagano <mpagano@g.o>
6809 ----
6810 - drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 ++++++---
6811 - 1 file changed, 6 insertions(+), 3 deletions(-)
6812 -
6813 -diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
6814 -index 675b5e7..5a0800d 100644
6815 ---- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
6816 -+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
6817 -@@ -1584,11 +1584,11 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,
6818 - fp_possible = io_info.fpOkForIo;
6819 - }
6820 + out:
6821 +- spin_unlock(&lp->lock);
6822 ++ spin_unlock_bh(&lp->lock);
6823 + return err;
6824 + }
6825
6826 -- /* Use smp_processor_id() for now until cmd->request->cpu is CPU
6827 -+ /* Use raw_smp_processor_id() for now until cmd->request->cpu is CPU
6828 - id by default, not CPU group id, otherwise all MSI-X queues won't
6829 - be utilized */
6830 - cmd->request_desc->SCSIIO.MSIxIndex = instance->msix_vectors ?
6831 -- smp_processor_id() % instance->msix_vectors : 0;
6832 -+ raw_smp_processor_id() % instance->msix_vectors : 0;
6833 +@@ -395,7 +397,7 @@ static int iss_net_close(struct net_device *dev)
6834 + {
6835 + struct iss_net_private *lp = netdev_priv(dev);
6836 + netif_stop_queue(dev);
6837 +- spin_lock(&lp->lock);
6838 ++ spin_lock_bh(&lp->lock);
6839
6840 - if (fp_possible) {
6841 - megasas_set_pd_lba(io_request, scp->cmd_len, &io_info, scp,
6842 -@@ -1693,7 +1693,10 @@ megasas_build_dcdb_fusion(struct megasas_instance *instance,
6843 - << MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT;
6844 - cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle;
6845 - cmd->request_desc->SCSIIO.MSIxIndex =
6846 -- instance->msix_vectors ? smp_processor_id() % instance->msix_vectors : 0;
6847 -+ instance->msix_vectors ?
6848 -+ raw_smp_processor_id() %
6849 -+ instance->msix_vectors :
6850 -+ 0;
6851 - os_timeout_value = scmd->request->timeout / HZ;
6852 + spin_lock(&opened_lock);
6853 + list_del(&opened);
6854 +@@ -405,18 +407,17 @@ static int iss_net_close(struct net_device *dev)
6855
6856 - if (instance->secure_jbod_support &&
6857 ---
6858 -2.3.6
6859 -
6860 -
6861 -From e654ded279c44285d07a31fe6d6c6fb74a9b5465 Mon Sep 17 00:00:00 2001
6862 -From: Sudeep Holla <sudeep.holla@×××.com>
6863 -Date: Tue, 17 Mar 2015 17:28:46 +0000
6864 -Subject: [PATCH 049/219] drivers/base: cacheinfo: validate device node for all
6865 - the caches
6866 -Cc: mpagano@g.o
6867 -
6868 -commit 8a7d95f95c95f396decbd4cda6d4903fc4664946 upstream.
6869 -
6870 -On architectures that depend on DT for obtaining cache hierarcy, we need
6871 -to validate the device node for all the cache indices, failing to do so
6872 -might result in wrong information being exposed to the userspace.
6873 -
6874 -This is quite possible on initial/incomplete versions of the device
6875 -trees. In such cases, it's better to bail out if all the required device
6876 -nodes are not present.
6877 -
6878 -This patch adds checks for the validation of device node for all the
6879 -caches and doesn't initialise the cacheinfo if there's any error.
6880 -
6881 -Reported-by: Mark Rutland <mark.rutland@×××.com>
6882 -Acked-by: Mark Rutland <mark.rutland@×××.com>
6883 -Signed-off-by: Sudeep Holla <sudeep.holla@×××.com>
6884 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
6885 -Signed-off-by: Mike Pagano <mpagano@g.o>
6886 ----
6887 - drivers/base/cacheinfo.c | 13 +++++++++++--
6888 - 1 file changed, 11 insertions(+), 2 deletions(-)
6889 -
6890 -diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c
6891 -index 6e64563..9c2ba1c 100644
6892 ---- a/drivers/base/cacheinfo.c
6893 -+++ b/drivers/base/cacheinfo.c
6894 -@@ -62,15 +62,21 @@ static int cache_setup_of_node(unsigned int cpu)
6895 - return -ENOENT;
6896 - }
6897 + lp->tp.close(lp);
6898
6899 -- while (np && index < cache_leaves(cpu)) {
6900 -+ while (index < cache_leaves(cpu)) {
6901 - this_leaf = this_cpu_ci->info_list + index;
6902 - if (this_leaf->level != 1)
6903 - np = of_find_next_cache_node(np);
6904 - else
6905 - np = of_node_get(np);/* cpu node itself */
6906 -+ if (!np)
6907 -+ break;
6908 - this_leaf->of_node = np;
6909 - index++;
6910 - }
6911 -+
6912 -+ if (index != cache_leaves(cpu)) /* not all OF nodes populated */
6913 -+ return -ENOENT;
6914 -+
6915 +- spin_unlock(&lp->lock);
6916 ++ spin_unlock_bh(&lp->lock);
6917 return 0;
6918 }
6919
6920 -@@ -189,8 +195,11 @@ static int detect_cache_attributes(unsigned int cpu)
6921 - * will be set up here only if they are not populated already
6922 - */
6923 - ret = cache_shared_cpu_map_setup(cpu);
6924 -- if (ret)
6925 -+ if (ret) {
6926 -+ pr_warn("Unable to detect cache hierarcy from DT for CPU %d\n",
6927 -+ cpu);
6928 - goto free_ci;
6929 -+ }
6930 - return 0;
6931 -
6932 - free_ci:
6933 ---
6934 -2.3.6
6935 -
6936 -
6937 -From 766f84104c3a294da5c4f1660589b3d167c5b1c6 Mon Sep 17 00:00:00 2001
6938 -From: Oliver Neukum <oneukum@××××.de>
6939 -Date: Fri, 20 Mar 2015 14:29:34 +0100
6940 -Subject: [PATCH 050/219] cdc-wdm: fix endianness bug in debug statements
6941 -Cc: mpagano@g.o
6942 -
6943 -commit 323ece54e0761198946ecd0c2091f1d2bfdfcb64 upstream.
6944 -
6945 -Values directly from descriptors given in debug statements
6946 -must be converted to native endianness.
6947 -
6948 -Signed-off-by: Oliver Neukum <oneukum@××××.de>
6949 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
6950 -Signed-off-by: Mike Pagano <mpagano@g.o>
6951 ----
6952 - drivers/usb/class/cdc-wdm.c | 12 +++++++-----
6953 - 1 file changed, 7 insertions(+), 5 deletions(-)
6954 -
6955 -diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
6956 -index a051a7a..a81f9dd 100644
6957 ---- a/drivers/usb/class/cdc-wdm.c
6958 -+++ b/drivers/usb/class/cdc-wdm.c
6959 -@@ -245,7 +245,7 @@ static void wdm_int_callback(struct urb *urb)
6960 - case USB_CDC_NOTIFY_RESPONSE_AVAILABLE:
6961 - dev_dbg(&desc->intf->dev,
6962 - "NOTIFY_RESPONSE_AVAILABLE received: index %d len %d",
6963 -- dr->wIndex, dr->wLength);
6964 -+ le16_to_cpu(dr->wIndex), le16_to_cpu(dr->wLength));
6965 - break;
6966 -
6967 - case USB_CDC_NOTIFY_NETWORK_CONNECTION:
6968 -@@ -262,7 +262,9 @@ static void wdm_int_callback(struct urb *urb)
6969 - clear_bit(WDM_POLL_RUNNING, &desc->flags);
6970 - dev_err(&desc->intf->dev,
6971 - "unknown notification %d received: index %d len %d\n",
6972 -- dr->bNotificationType, dr->wIndex, dr->wLength);
6973 -+ dr->bNotificationType,
6974 -+ le16_to_cpu(dr->wIndex),
6975 -+ le16_to_cpu(dr->wLength));
6976 - goto exit;
6977 - }
6978 + static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
6979 + {
6980 + struct iss_net_private *lp = netdev_priv(dev);
6981 +- unsigned long flags;
6982 + int len;
6983
6984 -@@ -408,7 +410,7 @@ static ssize_t wdm_write
6985 - USB_RECIP_INTERFACE);
6986 - req->bRequest = USB_CDC_SEND_ENCAPSULATED_COMMAND;
6987 - req->wValue = 0;
6988 -- req->wIndex = desc->inum;
6989 -+ req->wIndex = desc->inum; /* already converted */
6990 - req->wLength = cpu_to_le16(count);
6991 - set_bit(WDM_IN_USE, &desc->flags);
6992 - desc->outbuf = buf;
6993 -@@ -422,7 +424,7 @@ static ssize_t wdm_write
6994 - rv = usb_translate_errors(rv);
6995 - } else {
6996 - dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d",
6997 -- req->wIndex);
6998 -+ le16_to_cpu(req->wIndex));
6999 - }
7000 - out:
7001 - usb_autopm_put_interface(desc->intf);
7002 -@@ -820,7 +822,7 @@ static int wdm_create(struct usb_interface *intf, struct usb_endpoint_descriptor
7003 - desc->irq->bRequestType = (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE);
7004 - desc->irq->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE;
7005 - desc->irq->wValue = 0;
7006 -- desc->irq->wIndex = desc->inum;
7007 -+ desc->irq->wIndex = desc->inum; /* already converted */
7008 - desc->irq->wLength = cpu_to_le16(desc->wMaxCommand);
7009 + netif_stop_queue(dev);
7010 +- spin_lock_irqsave(&lp->lock, flags);
7011 ++ spin_lock_bh(&lp->lock);
7012
7013 - usb_fill_control_urb(
7014 ---
7015 -2.3.6
7016 -
7017 -
7018 -From 7df0c5a403d2e9a1698a6ebdcf6e37a0639aad85 Mon Sep 17 00:00:00 2001
7019 -From: Geert Uytterhoeven <geert+renesas@××××××.be>
7020 -Date: Wed, 18 Feb 2015 17:34:59 +0100
7021 -Subject: [PATCH 051/219] mmc: tmio: Remove bogus un-initialization in
7022 - tmio_mmc_host_free()
7023 -Cc: mpagano@g.o
7024 -
7025 -commit 13a6a2ed1f5e77ae47c2b1a8e3bf22b2fa2d56ba upstream.
7026 -
7027 -If CONFIG_DEBUG_SLAB=y:
7028 -
7029 - sh_mobile_sdhi ee100000.sd: Got CD GPIO
7030 - sh_mobile_sdhi ee100000.sd: Got WP GPIO
7031 - platform ee100000.sd: Driver sh_mobile_sdhi requests probe deferral
7032 - ...
7033 - Slab corruption (Not tainted): kmalloc-1024 start=ed8b3c00, len=1024
7034 - 2d0: 00 00 00 00 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b ....kkkkkkkkkkkk
7035 - Prev obj: start=ed8b3800, len=1024
7036 - 000: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
7037 - 010: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
7038 -
7039 -Struct tmio_mmc_host is embedded inside struct mmc_host, and thus is
7040 -freed by the call to mmc_free_host(). Hence it must not be written to
7041 -afterwards, as that will corrupt freed (and perhaps already reused)
7042 -memory.
7043 -
7044 -Fixes: 94b110aff8679b14 ("mmc: tmio: add tmio_mmc_host_alloc/free()")
7045 -Signed-off-by: Geert Uytterhoeven <geert+renesas@××××××.be>
7046 -Signed-off-by: Ulf Hansson <ulf.hansson@××××××.org>
7047 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
7048 -Signed-off-by: Mike Pagano <mpagano@g.o>
7049 ----
7050 - drivers/mmc/host/tmio_mmc_pio.c | 2 --
7051 - 1 file changed, 2 deletions(-)
7052 -
7053 -diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
7054 -index a31c357..dba7e1c 100644
7055 ---- a/drivers/mmc/host/tmio_mmc_pio.c
7056 -+++ b/drivers/mmc/host/tmio_mmc_pio.c
7057 -@@ -1073,8 +1073,6 @@ EXPORT_SYMBOL(tmio_mmc_host_alloc);
7058 - void tmio_mmc_host_free(struct tmio_mmc_host *host)
7059 - {
7060 - mmc_free_host(host->mmc);
7061 --
7062 -- host->mmc = NULL;
7063 - }
7064 - EXPORT_SYMBOL(tmio_mmc_host_free);
7065 + len = lp->tp.write(lp, &skb);
7066
7067 ---
7068 -2.3.6
7069 -
7070 -
7071 -From 85895968a9444e810f96cc951c6b5fc7dd183296 Mon Sep 17 00:00:00 2001
7072 -From: Chen-Yu Tsai <wens@××××.org>
7073 -Date: Tue, 3 Mar 2015 09:44:40 +0800
7074 -Subject: [PATCH 052/219] mmc: sunxi: Use devm_reset_control_get_optional() for
7075 - reset control
7076 -MIME-Version: 1.0
7077 -Content-Type: text/plain; charset=UTF-8
7078 -Content-Transfer-Encoding: 8bit
7079 -Cc: mpagano@g.o
7080 -
7081 -commit 9e71c589e44ddf2b86f361c81e360c6b0d0354b1 upstream.
7082 -
7083 -The reset control for the sunxi mmc controller is optional. Some
7084 -newer platforms (sun6i, sun8i, sun9i) have it, while older ones
7085 -(sun4i, sun5i, sun7i) don't.
7086 -
7087 -Use the properly stubbed _optional version so the driver does not
7088 -fail to compile when RESET_CONTROLLER=n.
7089 -
7090 -This patch also adds a check for deferred probing on the reset
7091 -control.
7092 -
7093 -Signed-off-by: Chen-Yu Tsai <wens@××××.org>
7094 -Acked-by: David Lanzendörfer <david.lanzendoerfer@×××.ch>
7095 -Signed-off-by: Ulf Hansson <ulf.hansson@××××××.org>
7096 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
7097 -Signed-off-by: Mike Pagano <mpagano@g.o>
7098 ----
7099 - drivers/mmc/host/sunxi-mmc.c | 4 +++-
7100 - 1 file changed, 3 insertions(+), 1 deletion(-)
7101 -
7102 -diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
7103 -index e8a4218..459ed1b 100644
7104 ---- a/drivers/mmc/host/sunxi-mmc.c
7105 -+++ b/drivers/mmc/host/sunxi-mmc.c
7106 -@@ -930,7 +930,9 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
7107 - return PTR_ERR(host->clk_sample);
7108 +@@ -438,7 +439,7 @@ static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
7109 + pr_err("%s: %s failed(%d)\n", dev->name, __func__, len);
7110 }
7111
7112 -- host->reset = devm_reset_control_get(&pdev->dev, "ahb");
7113 -+ host->reset = devm_reset_control_get_optional(&pdev->dev, "ahb");
7114 -+ if (PTR_ERR(host->reset) == -EPROBE_DEFER)
7115 -+ return PTR_ERR(host->reset);
7116 -
7117 - ret = clk_prepare_enable(host->clk_ahb);
7118 - if (ret) {
7119 ---
7120 -2.3.6
7121 -
7122 -
7123 -From 662552a3bf88447e8985bdad78fc7e548487416b Mon Sep 17 00:00:00 2001
7124 -From: Lucas Stach <l.stach@×××××××××××.de>
7125 -Date: Wed, 1 Apr 2015 10:46:15 +0200
7126 -Subject: [PATCH 053/219] spi: imx: read back the RX/TX watermark levels
7127 - earlier
7128 -Cc: mpagano@g.o
7129 -
7130 -commit f511ab09dfb0fe7b2335eccac51ff9f001a32e4a upstream.
7131 -
7132 -They are used to decide if the controller can do DMA on a buffer
7133 -of a specific length and thus are needed before any transfer is attempted.
7134 -
7135 -This fixes a memory leak where the SPI core uses the drivers can_dma()
7136 -callback to determine if a buffer needs to be mapped. As the watermark
7137 -levels aren't correct at that point the driver falsely claims to be able to
7138 -DMA the buffer when it fact it isn't.
7139 -After the transfer has been done the core uses the same callback to
7140 -determine if it needs to unmap the buffers. As the driver now correctly
7141 -claims to not being able to DMA the buffer the core doesn't attempt to
7142 -unmap the buffer which leaves the SGT leaking.
7143 -
7144 -Fixes: f62caccd12c17e4 (spi: spi-imx: add DMA support)
7145 -Signed-off-by: Lucas Stach <l.stach@×××××××××××.de>
7146 -Signed-off-by: Mark Brown <broonie@××××××.org>
7147 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
7148 -Signed-off-by: Mike Pagano <mpagano@g.o>
7149 ----
7150 - drivers/spi/spi-imx.c | 4 ++--
7151 - 1 file changed, 2 insertions(+), 2 deletions(-)
7152 -
7153 -diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
7154 -index 6fea4af..aea3a67 100644
7155 ---- a/drivers/spi/spi-imx.c
7156 -+++ b/drivers/spi/spi-imx.c
7157 -@@ -370,8 +370,6 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx,
7158 - if (spi_imx->dma_is_inited) {
7159 - dma = readl(spi_imx->base + MX51_ECSPI_DMA);
7160 +- spin_unlock_irqrestore(&lp->lock, flags);
7161 ++ spin_unlock_bh(&lp->lock);
7162
7163 -- spi_imx->tx_wml = spi_imx_get_fifosize(spi_imx) / 2;
7164 -- spi_imx->rx_wml = spi_imx_get_fifosize(spi_imx) / 2;
7165 - spi_imx->rxt_wml = spi_imx_get_fifosize(spi_imx) / 2;
7166 - rx_wml_cfg = spi_imx->rx_wml << MX51_ECSPI_DMA_RX_WML_OFFSET;
7167 - tx_wml_cfg = spi_imx->tx_wml << MX51_ECSPI_DMA_TX_WML_OFFSET;
7168 -@@ -868,6 +866,8 @@ static int spi_imx_sdma_init(struct device *dev, struct spi_imx_data *spi_imx,
7169 - master->max_dma_len = MAX_SDMA_BD_BYTES;
7170 - spi_imx->bitbang.master->flags = SPI_MASTER_MUST_RX |
7171 - SPI_MASTER_MUST_TX;
7172 -+ spi_imx->tx_wml = spi_imx_get_fifosize(spi_imx) / 2;
7173 -+ spi_imx->rx_wml = spi_imx_get_fifosize(spi_imx) / 2;
7174 - spi_imx->dma_is_inited = 1;
7175 + dev_kfree_skb(skb);
7176 + return NETDEV_TX_OK;
7177 +@@ -466,9 +467,9 @@ static int iss_net_set_mac(struct net_device *dev, void *addr)
7178
7179 + if (!is_valid_ether_addr(hwaddr->sa_data))
7180 + return -EADDRNOTAVAIL;
7181 +- spin_lock(&lp->lock);
7182 ++ spin_lock_bh(&lp->lock);
7183 + memcpy(dev->dev_addr, hwaddr->sa_data, ETH_ALEN);
7184 +- spin_unlock(&lp->lock);
7185 ++ spin_unlock_bh(&lp->lock);
7186 return 0;
7187 ---
7188 -2.3.6
7189 -
7190 -
7191 -From 721669bff3eaa852476783845293dca50431ce5b Mon Sep 17 00:00:00 2001
7192 -From: Ian Abbott <abbotti@××××××.uk>
7193 -Date: Mon, 23 Mar 2015 17:50:27 +0000
7194 -Subject: [PATCH 054/219] spi: spidev: fix possible arithmetic overflow for
7195 - multi-transfer message
7196 -Cc: mpagano@g.o
7197 -
7198 -commit f20fbaad7620af2df36a1f9d1c9ecf48ead5b747 upstream.
7199 -
7200 -`spidev_message()` sums the lengths of the individual SPI transfers to
7201 -determine the overall SPI message length. It restricts the total
7202 -length, returning an error if too long, but it does not check for
7203 -arithmetic overflow. For example, if the SPI message consisted of two
7204 -transfers and the first has a length of 10 and the second has a length
7205 -of (__u32)(-1), the total length would be seen as 9, even though the
7206 -second transfer is actually very long. If the second transfer specifies
7207 -a null `rx_buf` and a non-null `tx_buf`, the `copy_from_user()` could
7208 -overrun the spidev's pre-allocated tx buffer before it reaches an
7209 -invalid user memory address. Fix it by checking that neither the total
7210 -nor the individual transfer lengths exceed the maximum allowed value.
7211 -
7212 -Thanks to Dan Carpenter for reporting the potential integer overflow.
7213 -
7214 -Signed-off-by: Ian Abbott <abbotti@××××××.uk>
7215 -Signed-off-by: Mark Brown <broonie@××××××.org>
7216 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
7217 -Signed-off-by: Mike Pagano <mpagano@g.o>
7218 ----
7219 - drivers/spi/spidev.c | 5 ++++-
7220 - 1 file changed, 4 insertions(+), 1 deletion(-)
7221 -
7222 -diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
7223 -index 4eb7a98..7bf5186 100644
7224 ---- a/drivers/spi/spidev.c
7225 -+++ b/drivers/spi/spidev.c
7226 -@@ -245,7 +245,10 @@ static int spidev_message(struct spidev_data *spidev,
7227 - k_tmp->len = u_tmp->len;
7228 -
7229 - total += k_tmp->len;
7230 -- if (total > bufsiz) {
7231 -+ /* Check total length of transfers. Also check each
7232 -+ * transfer length to avoid arithmetic overflow.
7233 -+ */
7234 -+ if (total > bufsiz || k_tmp->len > bufsiz) {
7235 - status = -EMSGSIZE;
7236 - goto done;
7237 - }
7238 ---
7239 -2.3.6
7240 -
7241 -
7242 -From 855715fa0e283d4ff8280c79ac2c531116bc3290 Mon Sep 17 00:00:00 2001
7243 -From: Krzysztof Kozlowski <k.kozlowski@×××××××.com>
7244 -Date: Thu, 12 Mar 2015 08:43:59 +0100
7245 -Subject: [PATCH 055/219] compal-laptop: Fix leaking hwmon device
7246 -Cc: mpagano@g.o
7247 -
7248 -commit ad774702f1705c04e5fa492b793d8d477a504fa6 upstream.
7249 -
7250 -The commit c2be45f09bb0 ("compal-laptop: Use
7251 -devm_hwmon_device_register_with_groups") wanted to change the
7252 -registering of hwmon device to resource-managed version. It mostly did
7253 -it except the main thing - it forgot to use devm-like function so the
7254 -hwmon device leaked after device removal or probe failure.
7255 -
7256 -Signed-off-by: Krzysztof Kozlowski <k.kozlowski@×××××××.com>
7257 -Fixes: c2be45f09bb0 ("compal-laptop: Use devm_hwmon_device_register_with_groups")
7258 -Acked-by: Guenter Roeck <linux@××××××××.net>
7259 -Acked-by: Darren Hart <dvhart@×××××××××××.com>
7260 -Signed-off-by: Sebastian Reichel <sre@××××××.org>
7261 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
7262 -Signed-off-by: Mike Pagano <mpagano@g.o>
7263 ----
7264 - drivers/platform/x86/compal-laptop.c | 6 +++---
7265 - 1 file changed, 3 insertions(+), 3 deletions(-)
7266 -
7267 -diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
7268 -index 15c0fab..eb9885e 100644
7269 ---- a/drivers/platform/x86/compal-laptop.c
7270 -+++ b/drivers/platform/x86/compal-laptop.c
7271 -@@ -1026,9 +1026,9 @@ static int compal_probe(struct platform_device *pdev)
7272 - if (err)
7273 - return err;
7274 + }
7275
7276 -- hwmon_dev = hwmon_device_register_with_groups(&pdev->dev,
7277 -- "compal", data,
7278 -- compal_hwmon_groups);
7279 -+ hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev,
7280 -+ "compal", data,
7281 -+ compal_hwmon_groups);
7282 - if (IS_ERR(hwmon_dev)) {
7283 - err = PTR_ERR(hwmon_dev);
7284 - goto remove;
7285 ---
7286 -2.3.6
7287 -
7288 -
7289 -From 7d91365ba6ce7256b1afb1197aecf3dd0dca6e65 Mon Sep 17 00:00:00 2001
7290 -From: Krzysztof Kozlowski <k.kozlowski@×××××××.com>
7291 -Date: Thu, 12 Mar 2015 08:44:00 +0100
7292 -Subject: [PATCH 056/219] compal-laptop: Check return value of
7293 - power_supply_register
7294 -Cc: mpagano@g.o
7295 -
7296 -commit 1915a718b1872edffcb13e5436a9f7302d3d36f0 upstream.
7297 -
7298 -The return value of power_supply_register() call was not checked and
7299 -even on error probe() function returned 0. If registering failed then
7300 -during unbind the driver tried to unregister power supply which was not
7301 -actually registered.
7302 -
7303 -This could lead to memory corruption because power_supply_unregister()
7304 -unconditionally cleans up given power supply.
7305 -
7306 -Fix this by checking return status of power_supply_register() call. In
7307 -case of failure, clean up sysfs entries and fail the probe.
7308 -
7309 -Signed-off-by: Krzysztof Kozlowski <k.kozlowski@×××××××.com>
7310 -Fixes: 9be0fcb5ed46 ("compal-laptop: add JHL90, battery & hwmon interface")
7311 -Signed-off-by: Sebastian Reichel <sre@××××××.org>
7312 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
7313 -Signed-off-by: Mike Pagano <mpagano@g.o>
7314 ----
7315 - drivers/platform/x86/compal-laptop.c | 4 +++-
7316 - 1 file changed, 3 insertions(+), 1 deletion(-)
7317 -
7318 -diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
7319 -index eb9885e..bceb30b 100644
7320 ---- a/drivers/platform/x86/compal-laptop.c
7321 -+++ b/drivers/platform/x86/compal-laptop.c
7322 -@@ -1036,7 +1036,9 @@ static int compal_probe(struct platform_device *pdev)
7323 +@@ -520,11 +521,11 @@ static int iss_net_configure(int index, char *init)
7324 + *lp = (struct iss_net_private) {
7325 + .device_list = LIST_HEAD_INIT(lp->device_list),
7326 + .opened_list = LIST_HEAD_INIT(lp->opened_list),
7327 +- .lock = __SPIN_LOCK_UNLOCKED(lp.lock),
7328 + .dev = dev,
7329 + .index = index,
7330 +- };
7331 ++ };
7332
7333 - /* Power supply */
7334 - initialize_power_supply_data(data);
7335 -- power_supply_register(&compal_device->dev, &data->psy);
7336 -+ err = power_supply_register(&compal_device->dev, &data->psy);
7337 -+ if (err < 0)
7338 -+ goto remove;
7339 ++ spin_lock_init(&lp->lock);
7340 + /*
7341 + * If this name ends up conflicting with an existing registered
7342 + * netdevice, that is OK, register_netdev{,ice}() will notice this
7343 +diff --git a/arch/xtensa/platforms/xtfpga/Makefile b/arch/xtensa/platforms/xtfpga/Makefile
7344 +index b9ae206..7839d38 100644
7345 +--- a/arch/xtensa/platforms/xtfpga/Makefile
7346 ++++ b/arch/xtensa/platforms/xtfpga/Makefile
7347 +@@ -6,4 +6,5 @@
7348 + #
7349 + # Note 2! The CFLAGS definitions are in the main makefile...
7350
7351 - platform_set_drvdata(pdev, data);
7352 +-obj-y = setup.o lcd.o
7353 ++obj-y += setup.o
7354 ++obj-$(CONFIG_XTFPGA_LCD) += lcd.o
7355 +diff --git a/arch/xtensa/platforms/xtfpga/include/platform/hardware.h b/arch/xtensa/platforms/xtfpga/include/platform/hardware.h
7356 +index 6edd20b..4e0af26 100644
7357 +--- a/arch/xtensa/platforms/xtfpga/include/platform/hardware.h
7358 ++++ b/arch/xtensa/platforms/xtfpga/include/platform/hardware.h
7359 +@@ -40,9 +40,6 @@
7360
7361 ---
7362 -2.3.6
7363 -
7364 -
7365 -From 676ee802b67bf6ea0287ab5b25ae3f551cf27f74 Mon Sep 17 00:00:00 2001
7366 -From: Steven Rostedt <rostedt@×××××××.org>
7367 -Date: Tue, 17 Mar 2015 10:40:38 -0400
7368 -Subject: [PATCH 057/219] ring-buffer: Replace this_cpu_*() with __this_cpu_*()
7369 -Cc: mpagano@g.o
7370 -
7371 -commit 80a9b64e2c156b6523e7a01f2ba6e5d86e722814 upstream.
7372 -
7373 -It has come to my attention that this_cpu_read/write are horrible on
7374 -architectures other than x86. Worse yet, they actually disable
7375 -preemption or interrupts! This caused some unexpected tracing results
7376 -on ARM.
7377 -
7378 - 101.356868: preempt_count_add <-ring_buffer_lock_reserve
7379 - 101.356870: preempt_count_sub <-ring_buffer_lock_reserve
7380 -
7381 -The ring_buffer_lock_reserve has recursion protection that requires
7382 -accessing a per cpu variable. But since preempt_disable() is traced, it
7383 -too got traced while accessing the variable that is suppose to prevent
7384 -recursion like this.
7385 -
7386 -The generic version of this_cpu_read() and write() are:
7387 -
7388 - #define this_cpu_generic_read(pcp) \
7389 - ({ typeof(pcp) ret__; \
7390 - preempt_disable(); \
7391 - ret__ = *this_cpu_ptr(&(pcp)); \
7392 - preempt_enable(); \
7393 - ret__; \
7394 - })
7395 -
7396 - #define this_cpu_generic_to_op(pcp, val, op) \
7397 - do { \
7398 - unsigned long flags; \
7399 - raw_local_irq_save(flags); \
7400 - *__this_cpu_ptr(&(pcp)) op val; \
7401 - raw_local_irq_restore(flags); \
7402 - } while (0)
7403 -
7404 -Which is unacceptable for locations that know they are within preempt
7405 -disabled or interrupt disabled locations.
7406 -
7407 -Paul McKenney stated that __this_cpu_() versions produce much better code on
7408 -other architectures than this_cpu_() does, if we know that the call is done in
7409 -a preempt disabled location.
7410 -
7411 -I also changed the recursive_unlock() to use two local variables instead
7412 -of accessing the per_cpu variable twice.
7413 -
7414 -Link: http://lkml.kernel.org/r/20150317114411.GE3589@××××××××××××××.com
7415 -Link: http://lkml.kernel.org/r/20150317104038.312e73d1@×××××××××××××.home
7416 -
7417 -Acked-by: Christoph Lameter <cl@×××××.com>
7418 -Reported-by: Uwe Kleine-Koenig <u.kleine-koenig@×××××××××××.de>
7419 -Tested-by: Uwe Kleine-Koenig <u.kleine-koenig@×××××××××××.de>
7420 -Signed-off-by: Steven Rostedt <rostedt@×××××××.org>
7421 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
7422 -Signed-off-by: Mike Pagano <mpagano@g.o>
7423 ----
7424 - kernel/trace/ring_buffer.c | 11 +++++------
7425 - 1 file changed, 5 insertions(+), 6 deletions(-)
7426 -
7427 -diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
7428 -index 5040d44..922048a 100644
7429 ---- a/kernel/trace/ring_buffer.c
7430 -+++ b/kernel/trace/ring_buffer.c
7431 -@@ -2679,7 +2679,7 @@ static DEFINE_PER_CPU(unsigned int, current_context);
7432 + /* UART */
7433 + #define DUART16552_PADDR (XCHAL_KIO_PADDR + 0x0D050020)
7434 +-/* LCD instruction and data addresses. */
7435 +-#define LCD_INSTR_ADDR ((char *)IOADDR(0x0D040000))
7436 +-#define LCD_DATA_ADDR ((char *)IOADDR(0x0D040004))
7437
7438 - static __always_inline int trace_recursive_lock(void)
7439 - {
7440 -- unsigned int val = this_cpu_read(current_context);
7441 -+ unsigned int val = __this_cpu_read(current_context);
7442 - int bit;
7443 + /* Misc. */
7444 + #define XTFPGA_FPGAREGS_VADDR IOADDR(0x0D020000)
7445 +diff --git a/arch/xtensa/platforms/xtfpga/include/platform/lcd.h b/arch/xtensa/platforms/xtfpga/include/platform/lcd.h
7446 +index 0e43564..4c8541e 100644
7447 +--- a/arch/xtensa/platforms/xtfpga/include/platform/lcd.h
7448 ++++ b/arch/xtensa/platforms/xtfpga/include/platform/lcd.h
7449 +@@ -11,10 +11,25 @@
7450 + #ifndef __XTENSA_XTAVNET_LCD_H
7451 + #define __XTENSA_XTAVNET_LCD_H
7452
7453 - if (in_interrupt()) {
7454 -@@ -2696,18 +2696,17 @@ static __always_inline int trace_recursive_lock(void)
7455 - return 1;
7456 ++#ifdef CONFIG_XTFPGA_LCD
7457 + /* Display string STR at position POS on the LCD. */
7458 + void lcd_disp_at_pos(char *str, unsigned char pos);
7459
7460 - val |= (1 << bit);
7461 -- this_cpu_write(current_context, val);
7462 -+ __this_cpu_write(current_context, val);
7463 + /* Shift the contents of the LCD display left or right. */
7464 + void lcd_shiftleft(void);
7465 + void lcd_shiftright(void);
7466 ++#else
7467 ++static inline void lcd_disp_at_pos(char *str, unsigned char pos)
7468 ++{
7469 ++}
7470 ++
7471 ++static inline void lcd_shiftleft(void)
7472 ++{
7473 ++}
7474 ++
7475 ++static inline void lcd_shiftright(void)
7476 ++{
7477 ++}
7478 ++#endif
7479 ++
7480 + #endif
7481 +diff --git a/arch/xtensa/platforms/xtfpga/lcd.c b/arch/xtensa/platforms/xtfpga/lcd.c
7482 +index 2872301..4dc0c1b 100644
7483 +--- a/arch/xtensa/platforms/xtfpga/lcd.c
7484 ++++ b/arch/xtensa/platforms/xtfpga/lcd.c
7485 +@@ -1,50 +1,63 @@
7486 + /*
7487 +- * Driver for the LCD display on the Tensilica LX60 Board.
7488 ++ * Driver for the LCD display on the Tensilica XTFPGA board family.
7489 ++ * http://www.mytechcorp.com/cfdata/productFile/File1/MOC-16216B-B-A0A04.pdf
7490 + *
7491 + * This file is subject to the terms and conditions of the GNU General Public
7492 + * License. See the file "COPYING" in the main directory of this archive
7493 + * for more details.
7494 + *
7495 + * Copyright (C) 2001, 2006 Tensilica Inc.
7496 ++ * Copyright (C) 2015 Cadence Design Systems Inc.
7497 + */
7498
7499 - return 0;
7500 - }
7501 +-/*
7502 +- *
7503 +- * FIXME: this code is from the examples from the LX60 user guide.
7504 +- *
7505 +- * The lcd_pause function does busy waiting, which is probably not
7506 +- * great. Maybe the code could be changed to use kernel timers, or
7507 +- * change the hardware to not need to wait.
7508 +- */
7509 +-
7510 ++#include <linux/delay.h>
7511 + #include <linux/init.h>
7512 + #include <linux/io.h>
7513
7514 - static __always_inline void trace_recursive_unlock(void)
7515 - {
7516 -- unsigned int val = this_cpu_read(current_context);
7517 -+ unsigned int val = __this_cpu_read(current_context);
7518 + #include <platform/hardware.h>
7519 + #include <platform/lcd.h>
7520 +-#include <linux/delay.h>
7521
7522 -- val--;
7523 -- val &= this_cpu_read(current_context);
7524 -- this_cpu_write(current_context, val);
7525 -+ val &= val & (val - 1);
7526 -+ __this_cpu_write(current_context, val);
7527 - }
7528 +-#define LCD_PAUSE_ITERATIONS 4000
7529 ++/* LCD instruction and data addresses. */
7530 ++#define LCD_INSTR_ADDR ((char *)IOADDR(CONFIG_XTFPGA_LCD_BASE_ADDR))
7531 ++#define LCD_DATA_ADDR (LCD_INSTR_ADDR + 4)
7532 ++
7533 + #define LCD_CLEAR 0x1
7534 + #define LCD_DISPLAY_ON 0xc
7535
7536 - #else
7537 ---
7538 -2.3.6
7539 -
7540 -
7541 -From 85020c092b437aaceec966678ec5fd9f7792b547 Mon Sep 17 00:00:00 2001
7542 -From: Krzysztof Kozlowski <k.kozlowski@×××××××.com>
7543 -Date: Fri, 20 Feb 2015 14:32:22 +0100
7544 -Subject: [PATCH 058/219] power_supply: twl4030_madc: Check return value of
7545 - power_supply_register
7546 -Cc: mpagano@g.o
7547 -
7548 -commit 68c3ed6fa7e0d69529ced772d650ab128916a81d upstream.
7549 -
7550 -The return value of power_supply_register() call was not checked and
7551 -even on error probe() function returned 0. If registering failed then
7552 -during unbind the driver tried to unregister power supply which was not
7553 -actually registered.
7554 -
7555 -This could lead to memory corruption because power_supply_unregister()
7556 -unconditionally cleans up given power supply.
7557 -
7558 -Signed-off-by: Krzysztof Kozlowski <k.kozlowski@×××××××.com>
7559 -Fixes: da0a00ebc239 ("power: Add twl4030_madc battery driver.")
7560 -Signed-off-by: Sebastian Reichel <sre@××××××.org>
7561 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
7562 -Signed-off-by: Mike Pagano <mpagano@g.o>
7563 ----
7564 - drivers/power/twl4030_madc_battery.c | 7 +++++--
7565 - 1 file changed, 5 insertions(+), 2 deletions(-)
7566 -
7567 -diff --git a/drivers/power/twl4030_madc_battery.c b/drivers/power/twl4030_madc_battery.c
7568 -index 7ef445a..cf90760 100644
7569 ---- a/drivers/power/twl4030_madc_battery.c
7570 -+++ b/drivers/power/twl4030_madc_battery.c
7571 -@@ -192,6 +192,7 @@ static int twl4030_madc_battery_probe(struct platform_device *pdev)
7572 - {
7573 - struct twl4030_madc_battery *twl4030_madc_bat;
7574 - struct twl4030_madc_bat_platform_data *pdata = pdev->dev.platform_data;
7575 -+ int ret = 0;
7576 + /* 8bit and 2 lines display */
7577 + #define LCD_DISPLAY_MODE8BIT 0x38
7578 ++#define LCD_DISPLAY_MODE4BIT 0x28
7579 + #define LCD_DISPLAY_POS 0x80
7580 + #define LCD_SHIFT_LEFT 0x18
7581 + #define LCD_SHIFT_RIGHT 0x1c
7582
7583 - twl4030_madc_bat = kzalloc(sizeof(*twl4030_madc_bat), GFP_KERNEL);
7584 - if (!twl4030_madc_bat)
7585 -@@ -216,9 +217,11 @@ static int twl4030_madc_battery_probe(struct platform_device *pdev)
7586 ++static void lcd_put_byte(u8 *addr, u8 data)
7587 ++{
7588 ++#ifdef CONFIG_XTFPGA_LCD_8BIT_ACCESS
7589 ++ ACCESS_ONCE(*addr) = data;
7590 ++#else
7591 ++ ACCESS_ONCE(*addr) = data & 0xf0;
7592 ++ ACCESS_ONCE(*addr) = (data << 4) & 0xf0;
7593 ++#endif
7594 ++}
7595 ++
7596 + static int __init lcd_init(void)
7597 + {
7598 +- *LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT;
7599 ++ ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT;
7600 + mdelay(5);
7601 +- *LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT;
7602 ++ ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT;
7603 + udelay(200);
7604 +- *LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT;
7605 ++ ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT;
7606 ++ udelay(50);
7607 ++#ifndef CONFIG_XTFPGA_LCD_8BIT_ACCESS
7608 ++ ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE4BIT;
7609 ++ udelay(50);
7610 ++ lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_MODE4BIT);
7611 + udelay(50);
7612 +- *LCD_INSTR_ADDR = LCD_DISPLAY_ON;
7613 ++#endif
7614 ++ lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_ON);
7615 + udelay(50);
7616 +- *LCD_INSTR_ADDR = LCD_CLEAR;
7617 ++ lcd_put_byte(LCD_INSTR_ADDR, LCD_CLEAR);
7618 + mdelay(10);
7619 + lcd_disp_at_pos("XTENSA LINUX", 0);
7620 + return 0;
7621 +@@ -52,10 +65,10 @@ static int __init lcd_init(void)
7622
7623 - twl4030_madc_bat->pdata = pdata;
7624 - platform_set_drvdata(pdev, twl4030_madc_bat);
7625 -- power_supply_register(&pdev->dev, &twl4030_madc_bat->psy);
7626 -+ ret = power_supply_register(&pdev->dev, &twl4030_madc_bat->psy);
7627 -+ if (ret < 0)
7628 -+ kfree(twl4030_madc_bat);
7629 + void lcd_disp_at_pos(char *str, unsigned char pos)
7630 + {
7631 +- *LCD_INSTR_ADDR = LCD_DISPLAY_POS | pos;
7632 ++ lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_POS | pos);
7633 + udelay(100);
7634 + while (*str != 0) {
7635 +- *LCD_DATA_ADDR = *str;
7636 ++ lcd_put_byte(LCD_DATA_ADDR, *str);
7637 + udelay(200);
7638 + str++;
7639 + }
7640 +@@ -63,13 +76,13 @@ void lcd_disp_at_pos(char *str, unsigned char pos)
7641
7642 -- return 0;
7643 -+ return ret;
7644 + void lcd_shiftleft(void)
7645 + {
7646 +- *LCD_INSTR_ADDR = LCD_SHIFT_LEFT;
7647 ++ lcd_put_byte(LCD_INSTR_ADDR, LCD_SHIFT_LEFT);
7648 + udelay(50);
7649 }
7650
7651 - static int twl4030_madc_battery_remove(struct platform_device *pdev)
7652 ---
7653 -2.3.6
7654 -
7655 -
7656 -From e7b8d14c9be1ddb14796569a636807647e30724c Mon Sep 17 00:00:00 2001
7657 -From: Krzysztof Kozlowski <k.kozlowski@×××××××.com>
7658 -Date: Fri, 20 Feb 2015 14:32:25 +0100
7659 -Subject: [PATCH 059/219] power_supply: lp8788-charger: Fix leaked power supply
7660 - on probe fail
7661 -Cc: mpagano@g.o
7662 -
7663 -commit a7117f81e8391e035c49b3440792f7e6cea28173 upstream.
7664 -
7665 -Driver forgot to unregister charger power supply if registering of
7666 -battery supply failed in probe(). In such case the memory associated
7667 -with power supply leaked.
7668 -
7669 -Signed-off-by: Krzysztof Kozlowski <k.kozlowski@×××××××.com>
7670 -Fixes: 98a276649358 ("power_supply: Add new lp8788 charger driver")
7671 -Signed-off-by: Sebastian Reichel <sre@××××××.org>
7672 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
7673 -Signed-off-by: Mike Pagano <mpagano@g.o>
7674 ----
7675 - drivers/power/lp8788-charger.c | 4 +++-
7676 - 1 file changed, 3 insertions(+), 1 deletion(-)
7677 -
7678 -diff --git a/drivers/power/lp8788-charger.c b/drivers/power/lp8788-charger.c
7679 -index 21fc233..176dab2 100644
7680 ---- a/drivers/power/lp8788-charger.c
7681 -+++ b/drivers/power/lp8788-charger.c
7682 -@@ -417,8 +417,10 @@ static int lp8788_psy_register(struct platform_device *pdev,
7683 - pchg->battery.num_properties = ARRAY_SIZE(lp8788_battery_prop);
7684 - pchg->battery.get_property = lp8788_battery_get_property;
7685 + void lcd_shiftright(void)
7686 + {
7687 +- *LCD_INSTR_ADDR = LCD_SHIFT_RIGHT;
7688 ++ lcd_put_byte(LCD_INSTR_ADDR, LCD_SHIFT_RIGHT);
7689 + udelay(50);
7690 + }
7691
7692 -- if (power_supply_register(&pdev->dev, &pchg->battery))
7693 -+ if (power_supply_register(&pdev->dev, &pchg->battery)) {
7694 -+ power_supply_unregister(&pchg->charger);
7695 - return -EPERM;
7696 -+ }
7697 +diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
7698 +index 5ed064e..ccf7932 100644
7699 +--- a/drivers/acpi/acpica/evgpe.c
7700 ++++ b/drivers/acpi/acpica/evgpe.c
7701 +@@ -92,6 +92,7 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info)
7702 + ACPI_SET_BIT(gpe_register_info->enable_for_run,
7703 + (u8)register_bit);
7704 + }
7705 ++ gpe_register_info->enable_mask = gpe_register_info->enable_for_run;
7706
7707 - return 0;
7708 + return_ACPI_STATUS(AE_OK);
7709 }
7710 ---
7711 -2.3.6
7712 -
7713 -
7714 -From a8cb866f5168eaec313528f7059b0025b859cccf Mon Sep 17 00:00:00 2001
7715 -From: Krzysztof Kozlowski <k.kozlowski@×××××××.com>
7716 -Date: Fri, 20 Feb 2015 14:32:23 +0100
7717 -Subject: [PATCH 060/219] power_supply: ipaq_micro_battery: Fix leaking
7718 - workqueue
7719 -Cc: mpagano@g.o
7720 -
7721 -commit f852ec461e24504690445e7d281cbe806df5ccef upstream.
7722 -
7723 -Driver allocates singlethread workqueue in probe but it is not destroyed
7724 -during removal.
7725 -
7726 -Signed-off-by: Krzysztof Kozlowski <k.kozlowski@×××××××.com>
7727 -Fixes: 00a588f9d27f ("power: add driver for battery reading on iPaq h3xxx")
7728 -Signed-off-by: Sebastian Reichel <sre@××××××.org>
7729 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
7730 -Signed-off-by: Mike Pagano <mpagano@g.o>
7731 ----
7732 - drivers/power/ipaq_micro_battery.c | 1 +
7733 - 1 file changed, 1 insertion(+)
7734 -
7735 -diff --git a/drivers/power/ipaq_micro_battery.c b/drivers/power/ipaq_micro_battery.c
7736 -index 9d69460..698cf16 100644
7737 ---- a/drivers/power/ipaq_micro_battery.c
7738 -+++ b/drivers/power/ipaq_micro_battery.c
7739 -@@ -251,6 +251,7 @@ static int micro_batt_remove(struct platform_device *pdev)
7740 - power_supply_unregister(&micro_ac_power);
7741 - power_supply_unregister(&micro_batt_power);
7742 - cancel_delayed_work_sync(&mb->update);
7743 -+ destroy_workqueue(mb->wq);
7744 +@@ -123,7 +124,7 @@ acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
7745
7746 - return 0;
7747 + /* Enable the requested GPE */
7748 +
7749 +- status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE_SAVE);
7750 ++ status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
7751 + return_ACPI_STATUS(status);
7752 }
7753 ---
7754 -2.3.6
7755 -
7756 -
7757 -From 640e9bd83b3a3bc313eb0ade22effbab5c135a76 Mon Sep 17 00:00:00 2001
7758 -From: Krzysztof Kozlowski <k.kozlowski@×××××××.com>
7759 -Date: Fri, 20 Feb 2015 14:32:24 +0100
7760 -Subject: [PATCH 061/219] power_supply: ipaq_micro_battery: Check return values
7761 - in probe
7762 -Cc: mpagano@g.o
7763 -
7764 -commit a2c1d531854c4319610f1d83351213b47a633969 upstream.
7765 -
7766 -The return values of create_singlethread_workqueue() and
7767 -power_supply_register() calls were not checked and even on error probe()
7768 -function returned 0.
7769 -
7770 -1. If allocation of workqueue failed (returning NULL) then further
7771 - accesses could lead to NULL pointer dereference. The
7772 - queue_delayed_work() expects workqueue to be non-NULL.
7773 -
7774 -2. If registration of power supply failed then during unbind the driver
7775 - tried to unregister power supply which was not actually registered.
7776 - This could lead to memory corruption because
7777 - power_supply_unregister() unconditionally cleans up given power
7778 - supply.
7779 -
7780 -Signed-off-by: Krzysztof Kozlowski <k.kozlowski@×××××××.com>
7781 -Fixes: 00a588f9d27f ("power: add driver for battery reading on iPaq h3xxx")
7782 -Signed-off-by: Sebastian Reichel <sre@××××××.org>
7783 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
7784 -Signed-off-by: Mike Pagano <mpagano@g.o>
7785 ----
7786 - drivers/power/ipaq_micro_battery.c | 21 +++++++++++++++++++--
7787 - 1 file changed, 19 insertions(+), 2 deletions(-)
7788 -
7789 -diff --git a/drivers/power/ipaq_micro_battery.c b/drivers/power/ipaq_micro_battery.c
7790 -index 698cf16..96b15e0 100644
7791 ---- a/drivers/power/ipaq_micro_battery.c
7792 -+++ b/drivers/power/ipaq_micro_battery.c
7793 -@@ -226,6 +226,7 @@ static struct power_supply micro_ac_power = {
7794 - static int micro_batt_probe(struct platform_device *pdev)
7795 - {
7796 - struct micro_battery *mb;
7797 -+ int ret;
7798
7799 - mb = devm_kzalloc(&pdev->dev, sizeof(*mb), GFP_KERNEL);
7800 - if (!mb)
7801 -@@ -233,14 +234,30 @@ static int micro_batt_probe(struct platform_device *pdev)
7802 +@@ -202,7 +203,7 @@ acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_info)
7803 + if (ACPI_SUCCESS(status)) {
7804 + status =
7805 + acpi_hw_low_set_gpe(gpe_event_info,
7806 +- ACPI_GPE_DISABLE_SAVE);
7807 ++ ACPI_GPE_DISABLE);
7808 + }
7809
7810 - mb->micro = dev_get_drvdata(pdev->dev.parent);
7811 - mb->wq = create_singlethread_workqueue("ipaq-battery-wq");
7812 -+ if (!mb->wq)
7813 -+ return -ENOMEM;
7814 -+
7815 - INIT_DELAYED_WORK(&mb->update, micro_battery_work);
7816 - platform_set_drvdata(pdev, mb);
7817 - queue_delayed_work(mb->wq, &mb->update, 1);
7818 -- power_supply_register(&pdev->dev, &micro_batt_power);
7819 -- power_supply_register(&pdev->dev, &micro_ac_power);
7820 -+
7821 -+ ret = power_supply_register(&pdev->dev, &micro_batt_power);
7822 -+ if (ret < 0)
7823 -+ goto batt_err;
7824 -+
7825 -+ ret = power_supply_register(&pdev->dev, &micro_ac_power);
7826 -+ if (ret < 0)
7827 -+ goto ac_err;
7828 + if (ACPI_FAILURE(status)) {
7829 +diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c
7830 +index 84bc550..af6514e 100644
7831 +--- a/drivers/acpi/acpica/hwgpe.c
7832 ++++ b/drivers/acpi/acpica/hwgpe.c
7833 +@@ -89,6 +89,8 @@ u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info)
7834 + * RETURN: Status
7835 + *
7836 + * DESCRIPTION: Enable or disable a single GPE in the parent enable register.
7837 ++ * The enable_mask field of the involved GPE register must be
7838 ++ * updated by the caller if necessary.
7839 + *
7840 + ******************************************************************************/
7841
7842 - dev_info(&pdev->dev, "iPAQ micro battery driver\n");
7843 - return 0;
7844 -+
7845 -+ac_err:
7846 -+ power_supply_unregister(&micro_ac_power);
7847 -+batt_err:
7848 -+ cancel_delayed_work_sync(&mb->update);
7849 -+ destroy_workqueue(mb->wq);
7850 -+ return ret;
7851 - }
7852 +@@ -119,7 +121,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
7853 + /* Set or clear just the bit that corresponds to this GPE */
7854
7855 - static int micro_batt_remove(struct platform_device *pdev)
7856 ---
7857 -2.3.6
7858 -
7859 -
7860 -From 4fc2e2c56db0c05c62444ed7bc8d285704155386 Mon Sep 17 00:00:00 2001
7861 -From: Oliver Neukum <oneukum@××××.de>
7862 -Date: Wed, 25 Mar 2015 15:13:36 +0100
7863 -Subject: [PATCH 062/219] HID: add HP OEM mouse to quirk ALWAYS_POLL
7864 -Cc: mpagano@g.o
7865 -
7866 -commit 7a8e53c414c8183e8735e3b08d9a776200e6e665 upstream.
7867 -
7868 -This mouse needs QUIRK_ALWAYS_POLL.
7869 -
7870 -Signed-off-by: Oliver Neukum <oneukum@××××.de>
7871 -Signed-off-by: Jiri Kosina <jkosina@××××.cz>
7872 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
7873 -Signed-off-by: Mike Pagano <mpagano@g.o>
7874 ----
7875 - drivers/hid/hid-ids.h | 3 +++
7876 - drivers/hid/usbhid/hid-quirks.c | 1 +
7877 - 2 files changed, 4 insertions(+)
7878 -
7879 -diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
7880 -index 9c47867..7ace715 100644
7881 ---- a/drivers/hid/hid-ids.h
7882 -+++ b/drivers/hid/hid-ids.h
7883 -@@ -459,6 +459,9 @@
7884 - #define USB_DEVICE_ID_UGCI_FLYING 0x0020
7885 - #define USB_DEVICE_ID_UGCI_FIGHTING 0x0030
7886 + register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info);
7887 +- switch (action & ~ACPI_GPE_SAVE_MASK) {
7888 ++ switch (action) {
7889 + case ACPI_GPE_CONDITIONAL_ENABLE:
7890
7891 -+#define USB_VENDOR_ID_HP 0x03f0
7892 -+#define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE 0x0a4a
7893 -+
7894 - #define USB_VENDOR_ID_HUION 0x256c
7895 - #define USB_DEVICE_ID_HUION_TABLET 0x006e
7896 + /* Only enable if the corresponding enable_mask bit is set */
7897 +@@ -149,9 +151,6 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
7898 + /* Write the updated enable mask */
7899
7900 -diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
7901 -index a821277..fe6c60d 100644
7902 ---- a/drivers/hid/usbhid/hid-quirks.c
7903 -+++ b/drivers/hid/usbhid/hid-quirks.c
7904 -@@ -78,6 +78,7 @@ static const struct hid_blacklist {
7905 - { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
7906 - { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
7907 - { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
7908 -+ { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
7909 - { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, HID_QUIRK_ALWAYS_POLL },
7910 - { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
7911 - { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },
7912 ---
7913 -2.3.6
7914 -
7915 -
7916 -From 66997b1d6c47e793556da41877262f5ac92e8d4d Mon Sep 17 00:00:00 2001
7917 -From: Oliver Neukum <oneukum@××××.de>
7918 -Date: Wed, 25 Mar 2015 15:38:31 +0100
7919 -Subject: [PATCH 063/219] HID: add quirk for PIXART OEM mouse used by HP
7920 -Cc: mpagano@g.o
7921 -
7922 -commit b70b82580248b5393241c986082842ec05a2b7d7 upstream.
7923 -
7924 -This mouse is also known under other IDs. It needs the quirk or will disconnect
7925 -in runlevel 1 or 3.
7926 -
7927 -Signed-off-by: Oliver Neukum <oneukum@××××.de>
7928 -Signed-off-by: Jiri Kosina <jkosina@××××.cz>
7929 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
7930 -Signed-off-by: Mike Pagano <mpagano@g.o>
7931 ----
7932 - drivers/hid/hid-ids.h | 1 +
7933 - drivers/hid/usbhid/hid-quirks.c | 1 +
7934 - 2 files changed, 2 insertions(+)
7935 -
7936 -diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
7937 -index 7ace715..7fe5590 100644
7938 ---- a/drivers/hid/hid-ids.h
7939 -+++ b/drivers/hid/hid-ids.h
7940 -@@ -461,6 +461,7 @@
7941 + status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address);
7942 +- if (ACPI_SUCCESS(status) && (action & ACPI_GPE_SAVE_MASK)) {
7943 +- gpe_register_info->enable_mask = (u8)enable_mask;
7944 +- }
7945 + return (status);
7946 + }
7947
7948 - #define USB_VENDOR_ID_HP 0x03f0
7949 - #define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE 0x0a4a
7950 -+#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE 0x134a
7951 -
7952 - #define USB_VENDOR_ID_HUION 0x256c
7953 - #define USB_DEVICE_ID_HUION_TABLET 0x006e
7954 -diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
7955 -index fe6c60d..4e3ae9f 100644
7956 ---- a/drivers/hid/usbhid/hid-quirks.c
7957 -+++ b/drivers/hid/usbhid/hid-quirks.c
7958 -@@ -79,6 +79,7 @@ static const struct hid_blacklist {
7959 - { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
7960 - { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
7961 - { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
7962 -+ { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
7963 - { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, HID_QUIRK_ALWAYS_POLL },
7964 - { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
7965 - { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },
7966 ---
7967 -2.3.6
7968 -
7969 -
7970 -From 3bc3783ea692a04256e2cf027bfd98bf7b8d82a6 Mon Sep 17 00:00:00 2001
7971 -From: Andrew Elble <aweits@×××.edu>
7972 -Date: Mon, 23 Feb 2015 08:51:24 -0500
7973 -Subject: [PATCH 064/219] NFS: fix BUG() crash in notify_change() with patch to
7974 - chown_common()
7975 -Cc: mpagano@g.o
7976 -
7977 -commit c1b8940b42bb6487b10f2267a96b486276ce9ff7 upstream.
7978 -
7979 -We have observed a BUG() crash in fs/attr.c:notify_change(). The crash
7980 -occurs during an rsync into a filesystem that is exported via NFS.
7981 -
7982 -1.) fs/attr.c:notify_change() modifies the caller's version of attr.
7983 -2.) 6de0ec00ba8d ("VFS: make notify_change pass ATTR_KILL_S*ID to
7984 - setattr operations") introduced a BUG() restriction such that "no
7985 - function will ever call notify_change() with both ATTR_MODE and
7986 - ATTR_KILL_S*ID set". Under some circumstances though, it will have
7987 - assisted in setting the caller's version of attr to this very
7988 - combination.
7989 -3.) 27ac0ffeac80 ("locks: break delegations on any attribute
7990 - modification") introduced code to handle breaking
7991 - delegations. This can result in notify_change() being re-called. attr
7992 - _must_ be explicitly reset to avoid triggering the BUG() established
7993 - in #2.
7994 -4.) The path that that triggers this is via fs/open.c:chmod_common().
7995 - The combination of attr flags set here and in the first call to
7996 - notify_change() along with a later failed break_deleg_wait()
7997 - results in notify_change() being called again via retry_deleg
7998 - without resetting attr.
7999 -
8000 -Solution is to move retry_deleg in chmod_common() a bit further up to
8001 -ensure attr is completely reset.
8002 -
8003 -There are other places where this seemingly could occur, such as
8004 -fs/utimes.c:utimes_common(), but the attr flags are not initially
8005 -set in such a way to trigger this.
8006 -
8007 -Fixes: 27ac0ffeac80 ("locks: break delegations on any attribute modification")
8008 -Reported-by: Eric Meddaugh <etmsys@×××.edu>
8009 -Tested-by: Eric Meddaugh <etmsys@×××.edu>
8010 -Signed-off-by: Andrew Elble <aweits@×××.edu>
8011 -Signed-off-by: Al Viro <viro@×××××××××××××××.uk>
8012 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
8013 -Signed-off-by: Mike Pagano <mpagano@g.o>
8014 ----
8015 - fs/open.c | 2 +-
8016 - 1 file changed, 1 insertion(+), 1 deletion(-)
8017 -
8018 -diff --git a/fs/open.c b/fs/open.c
8019 -index 33f9cbf..44a3be1 100644
8020 ---- a/fs/open.c
8021 -+++ b/fs/open.c
8022 -@@ -570,6 +570,7 @@ static int chown_common(struct path *path, uid_t user, gid_t group)
8023 - uid = make_kuid(current_user_ns(), user);
8024 - gid = make_kgid(current_user_ns(), group);
8025 -
8026 -+retry_deleg:
8027 - newattrs.ia_valid = ATTR_CTIME;
8028 - if (user != (uid_t) -1) {
8029 - if (!uid_valid(uid))
8030 -@@ -586,7 +587,6 @@ static int chown_common(struct path *path, uid_t user, gid_t group)
8031 - if (!S_ISDIR(inode->i_mode))
8032 - newattrs.ia_valid |=
8033 - ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV;
8034 --retry_deleg:
8035 - mutex_lock(&inode->i_mutex);
8036 - error = security_path_chown(path, uid, gid);
8037 - if (!error)
8038 ---
8039 -2.3.6
8040 -
8041 -
8042 -From 46d09e1c86167373dcb343cfd6c901c78624ff01 Mon Sep 17 00:00:00 2001
8043 -From: Russell King <rmk+kernel@×××××××××××××.uk>
8044 -Date: Wed, 1 Apr 2015 16:20:39 +0100
8045 -Subject: [PATCH 065/219] ARM: fix broken hibernation
8046 -Cc: mpagano@g.o
8047 -
8048 -commit 767bf7e7a1e82a81c59778348d156993d0a6175d upstream.
8049 -
8050 -Normally, when a CPU wants to clear a cache line to zero in the external
8051 -L2 cache, it would generate bus cycles to write each word as it would do
8052 -with any other data access.
8053 -
8054 -However, a Cortex A9 connected to a L2C-310 has a specific feature where
8055 -the CPU can detect this operation, and signal that it wants to zero an
8056 -entire cache line. This feature, known as Full Line of Zeros (FLZ),
8057 -involves a non-standard AXI signalling mechanism which only the L2C-310
8058 -can properly interpret.
8059 -
8060 -There are separate enable bits in both the L2C-310 and the Cortex A9 -
8061 -the L2C-310 needs to be enabled and have the FLZ enable bit set in the
8062 -auxiliary control register before the Cortex A9 has this feature
8063 -enabled.
8064 -
8065 -Unfortunately, the suspend code was not respecting this - it's not
8066 -obvious from the code:
8067 -
8068 -swsusp_arch_suspend()
8069 - cpu_suspend() /* saves the Cortex A9 auxiliary control register */
8070 - arch_save_image()
8071 - soft_restart() /* turns off FLZ in Cortex A9, and disables L2C */
8072 - cpu_resume() /* restores the Cortex A9 registers, inc auxcr */
8073 -
8074 -At this point, we end up with the L2C disabled, but the Cortex A9 with
8075 -FLZ enabled - which means any memset() or zeroing of a full cache line
8076 -will fail to take effect.
8077 -
8078 -A similar issue exists in the resume path, but it's slightly more
8079 -complex:
8080 -
8081 -swsusp_arch_suspend()
8082 - cpu_suspend() /* saves the Cortex A9 auxiliary control register */
8083 - arch_save_image() /* image with A9 auxcr saved */
8084 -...
8085 -swsusp_arch_resume()
8086 - call_with_stack()
8087 - arch_restore_image() /* restores image with A9 auxcr saved above */
8088 - soft_restart() /* turns off FLZ in Cortex A9, and disables L2C */
8089 - cpu_resume() /* restores the Cortex A9 registers, inc auxcr */
8090 -
8091 -Again, here we end up with the L2C disabled, but Cortex A9 FLZ enabled.
8092 -
8093 -There's no need to turn off the L2C in either of these two paths; there
8094 -are benefits from not doing so - for example, the page copies will be
8095 -faster with the L2C enabled.
8096 -
8097 -Hence, fix this by providing a variant of soft_restart() which can be
8098 -used without turning the L2 cache controller off, and use it in both
8099 -of these paths to keep the L2C enabled across the respective resume
8100 -transitions.
8101 -
8102 -Fixes: 8ef418c7178f ("ARM: l2c: trial at enabling some Cortex-A9 optimisations")
8103 -Reported-by: Sean Cross <xobs@××××××.com>
8104 -Tested-by: Sean Cross <xobs@××××××.com>
8105 -Signed-off-by: Russell King <rmk+kernel@×××××××××××××.uk>
8106 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
8107 -Signed-off-by: Mike Pagano <mpagano@g.o>
8108 ----
8109 - arch/arm/kernel/hibernate.c | 5 +++--
8110 - arch/arm/kernel/process.c | 10 ++++++++--
8111 - arch/arm/kernel/reboot.h | 6 ++++++
8112 - 3 files changed, 17 insertions(+), 4 deletions(-)
8113 - create mode 100644 arch/arm/kernel/reboot.h
8114 -
8115 -diff --git a/arch/arm/kernel/hibernate.c b/arch/arm/kernel/hibernate.c
8116 -index c4cc50e..cfb354f 100644
8117 ---- a/arch/arm/kernel/hibernate.c
8118 -+++ b/arch/arm/kernel/hibernate.c
8119 -@@ -22,6 +22,7 @@
8120 - #include <asm/suspend.h>
8121 - #include <asm/memory.h>
8122 - #include <asm/sections.h>
8123 -+#include "reboot.h"
8124 -
8125 - int pfn_is_nosave(unsigned long pfn)
8126 +@@ -286,10 +285,8 @@ acpi_hw_gpe_enable_write(u8 enable_mask,
8127 {
8128 -@@ -61,7 +62,7 @@ static int notrace arch_save_image(unsigned long unused)
8129 + acpi_status status;
8130
8131 - ret = swsusp_save();
8132 - if (ret == 0)
8133 -- soft_restart(virt_to_phys(cpu_resume));
8134 -+ _soft_restart(virt_to_phys(cpu_resume), false);
8135 - return ret;
8136 ++ gpe_register_info->enable_mask = enable_mask;
8137 + status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address);
8138 +- if (ACPI_SUCCESS(status)) {
8139 +- gpe_register_info->enable_mask = enable_mask;
8140 +- }
8141 + return (status);
8142 }
8143
8144 -@@ -86,7 +87,7 @@ static void notrace arch_restore_image(void *unused)
8145 - for (pbe = restore_pblist; pbe; pbe = pbe->next)
8146 - copy_page(pbe->orig_address, pbe->address);
8147 +diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
8148 +index 9bad45e..7fbc2b9 100644
8149 +--- a/drivers/acpi/acpica/tbinstal.c
8150 ++++ b/drivers/acpi/acpica/tbinstal.c
8151 +@@ -346,7 +346,6 @@ acpi_tb_install_standard_table(acpi_physical_address address,
8152 + */
8153 + acpi_tb_uninstall_table(&new_table_desc);
8154 + *table_index = i;
8155 +- (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
8156 + return_ACPI_STATUS(AE_OK);
8157 + }
8158 + }
8159 +diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
8160 +index bbca783..349f4fd 100644
8161 +--- a/drivers/acpi/scan.c
8162 ++++ b/drivers/acpi/scan.c
8163 +@@ -298,7 +298,11 @@ bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent)
8164 + struct acpi_device_physical_node *pn;
8165 + bool offline = true;
8166
8167 -- soft_restart(virt_to_phys(cpu_resume));
8168 -+ _soft_restart(virt_to_phys(cpu_resume), false);
8169 - }
8170 +- mutex_lock(&adev->physical_node_lock);
8171 ++ /*
8172 ++ * acpi_container_offline() calls this for all of the container's
8173 ++ * children under the container's physical_node_lock lock.
8174 ++ */
8175 ++ mutex_lock_nested(&adev->physical_node_lock, SINGLE_DEPTH_NESTING);
8176
8177 - static u64 resume_stack[PAGE_SIZE/2/sizeof(u64)] __nosavedata;
8178 -diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
8179 -index fdfa3a7..2bf1a16 100644
8180 ---- a/arch/arm/kernel/process.c
8181 -+++ b/arch/arm/kernel/process.c
8182 -@@ -41,6 +41,7 @@
8183 - #include <asm/system_misc.h>
8184 - #include <asm/mach/time.h>
8185 - #include <asm/tls.h>
8186 -+#include "reboot.h"
8187 + list_for_each_entry(pn, &adev->physical_node_list, node)
8188 + if (device_supports_offline(pn->dev) && !pn->dev->offline) {
8189 +diff --git a/drivers/base/bus.c b/drivers/base/bus.c
8190 +index 876bae5..79bc203 100644
8191 +--- a/drivers/base/bus.c
8192 ++++ b/drivers/base/bus.c
8193 +@@ -515,11 +515,11 @@ int bus_add_device(struct device *dev)
8194 + goto out_put;
8195 + error = device_add_groups(dev, bus->dev_groups);
8196 + if (error)
8197 +- goto out_groups;
8198 ++ goto out_id;
8199 + error = sysfs_create_link(&bus->p->devices_kset->kobj,
8200 + &dev->kobj, dev_name(dev));
8201 + if (error)
8202 +- goto out_id;
8203 ++ goto out_groups;
8204 + error = sysfs_create_link(&dev->kobj,
8205 + &dev->bus->p->subsys.kobj, "subsystem");
8206 + if (error)
8207 +diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c
8208 +index 6e64563..9c2ba1c 100644
8209 +--- a/drivers/base/cacheinfo.c
8210 ++++ b/drivers/base/cacheinfo.c
8211 +@@ -62,15 +62,21 @@ static int cache_setup_of_node(unsigned int cpu)
8212 + return -ENOENT;
8213 + }
8214
8215 - #ifdef CONFIG_CC_STACKPROTECTOR
8216 - #include <linux/stackprotector.h>
8217 -@@ -95,7 +96,7 @@ static void __soft_restart(void *addr)
8218 - BUG();
8219 +- while (np && index < cache_leaves(cpu)) {
8220 ++ while (index < cache_leaves(cpu)) {
8221 + this_leaf = this_cpu_ci->info_list + index;
8222 + if (this_leaf->level != 1)
8223 + np = of_find_next_cache_node(np);
8224 + else
8225 + np = of_node_get(np);/* cpu node itself */
8226 ++ if (!np)
8227 ++ break;
8228 + this_leaf->of_node = np;
8229 + index++;
8230 + }
8231 ++
8232 ++ if (index != cache_leaves(cpu)) /* not all OF nodes populated */
8233 ++ return -ENOENT;
8234 ++
8235 + return 0;
8236 }
8237
8238 --void soft_restart(unsigned long addr)
8239 -+void _soft_restart(unsigned long addr, bool disable_l2)
8240 - {
8241 - u64 *stack = soft_restart_stack + ARRAY_SIZE(soft_restart_stack);
8242 +@@ -189,8 +195,11 @@ static int detect_cache_attributes(unsigned int cpu)
8243 + * will be set up here only if they are not populated already
8244 + */
8245 + ret = cache_shared_cpu_map_setup(cpu);
8246 +- if (ret)
8247 ++ if (ret) {
8248 ++ pr_warn("Unable to detect cache hierarcy from DT for CPU %d\n",
8249 ++ cpu);
8250 + goto free_ci;
8251 ++ }
8252 + return 0;
8253
8254 -@@ -104,7 +105,7 @@ void soft_restart(unsigned long addr)
8255 - local_fiq_disable();
8256 + free_ci:
8257 +diff --git a/drivers/base/platform.c b/drivers/base/platform.c
8258 +index 9421fed..e68ab79 100644
8259 +--- a/drivers/base/platform.c
8260 ++++ b/drivers/base/platform.c
8261 +@@ -101,6 +101,15 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
8262 + }
8263
8264 - /* Disable the L2 if we're the last man standing. */
8265 -- if (num_online_cpus() == 1)
8266 -+ if (disable_l2)
8267 - outer_disable();
8268 + r = platform_get_resource(dev, IORESOURCE_IRQ, num);
8269 ++ /*
8270 ++ * The resources may pass trigger flags to the irqs that need
8271 ++ * to be set up. It so happens that the trigger flags for
8272 ++ * IORESOURCE_BITS correspond 1-to-1 to the IRQF_TRIGGER*
8273 ++ * settings.
8274 ++ */
8275 ++ if (r && r->flags & IORESOURCE_BITS)
8276 ++ irqd_set_trigger_type(irq_get_irq_data(r->start),
8277 ++ r->flags & IORESOURCE_BITS);
8278
8279 - /* Change to the new stack and continue with the reset. */
8280 -@@ -114,6 +115,11 @@ void soft_restart(unsigned long addr)
8281 - BUG();
8282 + return r ? r->start : -ENXIO;
8283 + #endif
8284 +diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
8285 +index de4c849..288547a 100644
8286 +--- a/drivers/bluetooth/ath3k.c
8287 ++++ b/drivers/bluetooth/ath3k.c
8288 +@@ -65,6 +65,7 @@ static const struct usb_device_id ath3k_table[] = {
8289 + /* Atheros AR3011 with sflash firmware*/
8290 + { USB_DEVICE(0x0489, 0xE027) },
8291 + { USB_DEVICE(0x0489, 0xE03D) },
8292 ++ { USB_DEVICE(0x04F2, 0xAFF1) },
8293 + { USB_DEVICE(0x0930, 0x0215) },
8294 + { USB_DEVICE(0x0CF3, 0x3002) },
8295 + { USB_DEVICE(0x0CF3, 0xE019) },
8296 +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
8297 +index 8bfc4c2..2c527da 100644
8298 +--- a/drivers/bluetooth/btusb.c
8299 ++++ b/drivers/bluetooth/btusb.c
8300 +@@ -159,6 +159,7 @@ static const struct usb_device_id blacklist_table[] = {
8301 + /* Atheros 3011 with sflash firmware */
8302 + { USB_DEVICE(0x0489, 0xe027), .driver_info = BTUSB_IGNORE },
8303 + { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE },
8304 ++ { USB_DEVICE(0x04f2, 0xaff1), .driver_info = BTUSB_IGNORE },
8305 + { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE },
8306 + { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE },
8307 + { USB_DEVICE(0x0cf3, 0xe019), .driver_info = BTUSB_IGNORE },
8308 +diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
8309 +index e096e9c..283f00a 100644
8310 +--- a/drivers/char/tpm/tpm-chip.c
8311 ++++ b/drivers/char/tpm/tpm-chip.c
8312 +@@ -170,6 +170,41 @@ static void tpm_dev_del_device(struct tpm_chip *chip)
8313 + device_unregister(&chip->dev);
8314 }
8315
8316 -+void soft_restart(unsigned long addr)
8317 ++static int tpm1_chip_register(struct tpm_chip *chip)
8318 +{
8319 -+ _soft_restart(addr, num_online_cpus() == 1);
8320 -+}
8321 ++ int rc;
8322 +
8323 - /*
8324 - * Function pointers to optional machine specific functions
8325 - */
8326 -diff --git a/arch/arm/kernel/reboot.h b/arch/arm/kernel/reboot.h
8327 -new file mode 100644
8328 -index 0000000..c87f058
8329 ---- /dev/null
8330 -+++ b/arch/arm/kernel/reboot.h
8331 -@@ -0,0 +1,6 @@
8332 -+#ifndef REBOOT_H
8333 -+#define REBOOT_H
8334 ++ if (chip->flags & TPM_CHIP_FLAG_TPM2)
8335 ++ return 0;
8336 +
8337 -+extern void _soft_restart(unsigned long addr, bool disable_l2);
8338 ++ rc = tpm_sysfs_add_device(chip);
8339 ++ if (rc)
8340 ++ return rc;
8341 ++
8342 ++ rc = tpm_add_ppi(chip);
8343 ++ if (rc) {
8344 ++ tpm_sysfs_del_device(chip);
8345 ++ return rc;
8346 ++ }
8347 ++
8348 ++ chip->bios_dir = tpm_bios_log_setup(chip->devname);
8349 +
8350 -+#endif
8351 ---
8352 -2.3.6
8353 -
8354 -
8355 -From c5528d2a0edcbbc3ceba739ec70133e2594486c4 Mon Sep 17 00:00:00 2001
8356 -From: Andrey Ryabinin <a.ryabinin@×××××××.com>
8357 -Date: Fri, 20 Mar 2015 15:42:27 +0100
8358 -Subject: [PATCH 066/219] ARM: 8320/1: fix integer overflow in ELF_ET_DYN_BASE
8359 -Cc: mpagano@g.o
8360 -
8361 -commit 8defb3367fcd19d1af64c07792aade0747b54e0f upstream.
8362 -
8363 -Usually ELF_ET_DYN_BASE is 2/3 of TASK_SIZE. With 3G/1G user/kernel
8364 -split this is not so, because 2*TASK_SIZE overflows 32 bits,
8365 -so the actual value of ELF_ET_DYN_BASE is:
8366 - (2 * TASK_SIZE / 3) = 0x2a000000
8367 -
8368 -When ASLR is disabled PIE binaries will load at ELF_ET_DYN_BASE address.
8369 -On 32bit platforms AddressSanitzer uses addresses [0x20000000 - 0x40000000]
8370 -for shadow memory [1]. So ASan doesn't work for PIE binaries when ASLR disabled
8371 -as it fails to map shadow memory.
8372 -Also after Kees's 'split ET_DYN ASLR from mmap ASLR' patchset PIE binaries
8373 -has a high chance of loading somewhere in between [0x2a000000 - 0x40000000]
8374 -even if ASLR enabled. This makes ASan with PIE absolutely incompatible.
8375 -
8376 -Fix overflow by dividing TASK_SIZE prior to multiplying.
8377 -After this patch ELF_ET_DYN_BASE equals to (for CONFIG_VMSPLIT_3G=y):
8378 - (TASK_SIZE / 3 * 2) = 0x7f555554
8379 -
8380 -[1] https://code.google.com/p/address-sanitizer/wiki/AddressSanitizerAlgorithm#Mapping
8381 -
8382 -Signed-off-by: Andrey Ryabinin <a.ryabinin@×××××××.com>
8383 -Reported-by: Maria Guseva <m.guseva@×××××××.com>
8384 -Signed-off-by: Russell King <rmk+kernel@×××××××××××××.uk>
8385 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
8386 -Signed-off-by: Mike Pagano <mpagano@g.o>
8387 ----
8388 - arch/arm/include/asm/elf.h | 2 +-
8389 - 1 file changed, 1 insertion(+), 1 deletion(-)
8390 -
8391 -diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
8392 -index afb9caf..674d03f 100644
8393 ---- a/arch/arm/include/asm/elf.h
8394 -+++ b/arch/arm/include/asm/elf.h
8395 -@@ -115,7 +115,7 @@ int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs);
8396 - the loader. We need to make sure that it is out of the way of the program
8397 - that it will "exec", and that there is sufficient room for the brk. */
8398 -
8399 --#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
8400 -+#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
8401 -
8402 - /* When the program starts, a1 contains a pointer to a function to be
8403 - registered with atexit, as per the SVR4 ABI. A value of 0 means we
8404 ---
8405 -2.3.6
8406 -
8407 -
8408 -From 6ec6b63f4e9d59f78b61944f8c533d9ff029f46f Mon Sep 17 00:00:00 2001
8409 -From: Gregory CLEMENT <gregory.clement@××××××××××××××.com>
8410 -Date: Fri, 30 Jan 2015 12:34:25 +0100
8411 -Subject: [PATCH 067/219] ARM: mvebu: Disable CPU Idle on Armada 38x
8412 -Cc: mpagano@g.o
8413 -
8414 -commit 548ae94c1cc7fc120848757249b9a542b1080ffb upstream.
8415 -
8416 -On Armada 38x SoCs, under heavy I/O load, the system hangs when CPU
8417 -Idle is enabled. Waiting for a solution to this issue, this patch
8418 -disables the CPU Idle support for this SoC.
8419 -
8420 -As CPU Hot plug support also uses some of the CPU Idle functions it is
8421 -also affected by the same issue. This patch disables it also for the
8422 -Armada 38x SoCs.
8423 -
8424 -Signed-off-by: Gregory CLEMENT <gregory.clement@××××××××××××××.com>
8425 -Tested-by: Thomas Petazzoni <thomas.petazzoni@××××××××××××××.com>
8426 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
8427 -Signed-off-by: Mike Pagano <mpagano@g.o>
8428 ----
8429 - arch/arm/mach-mvebu/pmsu.c | 16 +++++++++++++++-
8430 - 1 file changed, 15 insertions(+), 1 deletion(-)
8431 -
8432 -diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
8433 -index 8b9f5e2..4f4e222 100644
8434 ---- a/arch/arm/mach-mvebu/pmsu.c
8435 -+++ b/arch/arm/mach-mvebu/pmsu.c
8436 -@@ -415,6 +415,9 @@ static __init int armada_38x_cpuidle_init(void)
8437 - void __iomem *mpsoc_base;
8438 - u32 reg;
8439 -
8440 -+ pr_warn("CPU idle is currently broken on Armada 38x: disabling");
8441 + return 0;
8442 ++}
8443 +
8444 - np = of_find_compatible_node(NULL, NULL,
8445 - "marvell,armada-380-coherency-fabric");
8446 - if (!np)
8447 -@@ -476,6 +479,16 @@ static int __init mvebu_v7_cpu_pm_init(void)
8448 - return 0;
8449 - of_node_put(np);
8450 -
8451 -+ /*
8452 -+ * Currently the CPU idle support for Armada 38x is broken, as
8453 -+ * the CPU hotplug uses some of the CPU idle functions it is
8454 -+ * broken too, so let's disable it
8455 -+ */
8456 -+ if (of_machine_is_compatible("marvell,armada380")) {
8457 -+ cpu_hotplug_disable();
8458 -+ pr_warn("CPU hotplug support is currently broken on Armada 38x: disabling");
8459 -+ }
8460 ++static void tpm1_chip_unregister(struct tpm_chip *chip)
8461 ++{
8462 ++ if (chip->flags & TPM_CHIP_FLAG_TPM2)
8463 ++ return;
8464 +
8465 - if (of_machine_is_compatible("marvell,armadaxp"))
8466 - ret = armada_xp_cpuidle_init();
8467 - else if (of_machine_is_compatible("marvell,armada370"))
8468 -@@ -489,7 +502,8 @@ static int __init mvebu_v7_cpu_pm_init(void)
8469 - return ret;
8470 ++ if (chip->bios_dir)
8471 ++ tpm_bios_log_teardown(chip->bios_dir);
8472 ++
8473 ++ tpm_remove_ppi(chip);
8474 ++
8475 ++ tpm_sysfs_del_device(chip);
8476 ++}
8477 ++
8478 + /*
8479 + * tpm_chip_register() - create a character device for the TPM chip
8480 + * @chip: TPM chip to use.
8481 +@@ -185,22 +220,13 @@ int tpm_chip_register(struct tpm_chip *chip)
8482 + {
8483 + int rc;
8484
8485 - mvebu_v7_pmsu_enable_l2_powerdown_onidle();
8486 -- platform_device_register(&mvebu_v7_cpuidle_device);
8487 -+ if (mvebu_v7_cpuidle_device.name)
8488 -+ platform_device_register(&mvebu_v7_cpuidle_device);
8489 - cpu_pm_register_notifier(&mvebu_v7_cpu_pm_notifier);
8490 +- /* Populate sysfs for TPM1 devices. */
8491 +- if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
8492 +- rc = tpm_sysfs_add_device(chip);
8493 +- if (rc)
8494 +- goto del_misc;
8495 +-
8496 +- rc = tpm_add_ppi(chip);
8497 +- if (rc)
8498 +- goto del_sysfs;
8499 +-
8500 +- chip->bios_dir = tpm_bios_log_setup(chip->devname);
8501 +- }
8502 ++ rc = tpm1_chip_register(chip);
8503 ++ if (rc)
8504 ++ return rc;
8505
8506 - return 0;
8507 ---
8508 -2.3.6
8509 -
8510 -
8511 -From 3c9d536953582615eb9054c38a5e4de6c711ccb5 Mon Sep 17 00:00:00 2001
8512 -From: Charles Keepax <ckeepax@×××××××××××××××××××××××.com>
8513 -Date: Fri, 27 Mar 2015 01:58:08 +0900
8514 -Subject: [PATCH 068/219] ARM: S3C64XX: Use fixed IRQ bases to avoid conflicts
8515 - on Cragganmore
8516 -Cc: mpagano@g.o
8517 -
8518 -commit 4e330ae4ab2915444f1e6dca1358a910aa259362 upstream.
8519 -
8520 -There are two PMICs on Cragganmore, currently one dynamically assign
8521 -its IRQ base and the other uses a fixed base. It is possible for the
8522 -statically assigned PMIC to fail if its IRQ is taken by the dynamically
8523 -assigned one. Fix this by statically assigning both the IRQ bases.
8524 -
8525 -Signed-off-by: Charles Keepax <ckeepax@×××××××××××××××××××××××.com>
8526 -Signed-off-by: Kukjin Kim <kgene@××××××.org>
8527 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
8528 -Signed-off-by: Mike Pagano <mpagano@g.o>
8529 ----
8530 - arch/arm/mach-s3c64xx/crag6410.h | 1 +
8531 - arch/arm/mach-s3c64xx/mach-crag6410.c | 1 +
8532 - 2 files changed, 2 insertions(+)
8533 -
8534 -diff --git a/arch/arm/mach-s3c64xx/crag6410.h b/arch/arm/mach-s3c64xx/crag6410.h
8535 -index 7bc6668..dcbe17f 100644
8536 ---- a/arch/arm/mach-s3c64xx/crag6410.h
8537 -+++ b/arch/arm/mach-s3c64xx/crag6410.h
8538 -@@ -14,6 +14,7 @@
8539 - #include <mach/gpio-samsung.h>
8540 + rc = tpm_dev_add_device(chip);
8541 + if (rc)
8542 +- return rc;
8543 ++ goto out_err;
8544
8545 - #define GLENFARCLAS_PMIC_IRQ_BASE IRQ_BOARD_START
8546 -+#define BANFF_PMIC_IRQ_BASE (IRQ_BOARD_START + 64)
8547 + /* Make the chip available. */
8548 + spin_lock(&driver_lock);
8549 +@@ -210,10 +236,8 @@ int tpm_chip_register(struct tpm_chip *chip)
8550 + chip->flags |= TPM_CHIP_FLAG_REGISTERED;
8551
8552 - #define PCA935X_GPIO_BASE GPIO_BOARD_START
8553 - #define CODEC_GPIO_BASE (GPIO_BOARD_START + 8)
8554 -diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
8555 -index 10b913b..65c426b 100644
8556 ---- a/arch/arm/mach-s3c64xx/mach-crag6410.c
8557 -+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
8558 -@@ -554,6 +554,7 @@ static struct wm831x_touch_pdata touch_pdata = {
8559 + return 0;
8560 +-del_sysfs:
8561 +- tpm_sysfs_del_device(chip);
8562 +-del_misc:
8563 +- tpm_dev_del_device(chip);
8564 ++out_err:
8565 ++ tpm1_chip_unregister(chip);
8566 + return rc;
8567 + }
8568 + EXPORT_SYMBOL_GPL(tpm_chip_register);
8569 +@@ -238,13 +262,7 @@ void tpm_chip_unregister(struct tpm_chip *chip)
8570 + spin_unlock(&driver_lock);
8571 + synchronize_rcu();
8572
8573 - static struct wm831x_pdata crag_pmic_pdata = {
8574 - .wm831x_num = 1,
8575 -+ .irq_base = BANFF_PMIC_IRQ_BASE,
8576 - .gpio_base = BANFF_PMIC_GPIO_BASE,
8577 - .soft_shutdown = true,
8578 +- if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
8579 +- if (chip->bios_dir)
8580 +- tpm_bios_log_teardown(chip->bios_dir);
8581 +- tpm_remove_ppi(chip);
8582 +- tpm_sysfs_del_device(chip);
8583 +- }
8584 +-
8585 ++ tpm1_chip_unregister(chip);
8586 + tpm_dev_del_device(chip);
8587 + }
8588 + EXPORT_SYMBOL_GPL(tpm_chip_unregister);
8589 +diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
8590 +index a23ac0c..0b7c3e8 100644
8591 +--- a/drivers/clk/at91/clk-usb.c
8592 ++++ b/drivers/clk/at91/clk-usb.c
8593 +@@ -56,22 +56,55 @@ static unsigned long at91sam9x5_clk_usb_recalc_rate(struct clk_hw *hw,
8594 + return DIV_ROUND_CLOSEST(parent_rate, (usbdiv + 1));
8595 + }
8596
8597 ---
8598 -2.3.6
8599 -
8600 -
8601 -From 64d90ab58af7a385a7955061e0a319f7f939ddff Mon Sep 17 00:00:00 2001
8602 -From: Nicolas Ferre <nicolas.ferre@×××××.com>
8603 -Date: Tue, 31 Mar 2015 10:56:10 +0200
8604 -Subject: [PATCH 069/219] ARM: at91/dt: sama5d3 xplained: add phy address for
8605 - macb1
8606 -Cc: mpagano@g.o
8607 -
8608 -commit 98b80987c940956da48f0c703f60340128bb8521 upstream.
8609 -
8610 -After 57a38effa598 (net: phy: micrel: disable broadcast for KSZ8081/KSZ8091)
8611 -the macb1 interface refuses to work properly because it tries
8612 -to cling to address 0 which isn't able to communicate in broadcast with
8613 -the mac anymore. The micrel phy on the board is actually configured
8614 -to show up at address 1.
8615 -Adding the phy node and its real address fixes the issue.
8616 -
8617 -Signed-off-by: Nicolas Ferre <nicolas.ferre@×××××.com>
8618 -Cc: Johan Hovold <johan@××××××.org>
8619 -Signed-off-by: Olof Johansson <olof@×××××.net>
8620 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
8621 -Signed-off-by: Mike Pagano <mpagano@g.o>
8622 ----
8623 - arch/arm/boot/dts/at91-sama5d3_xplained.dts | 6 ++++++
8624 - 1 file changed, 6 insertions(+)
8625 -
8626 -diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
8627 -index fec1fca..6c4bc53 100644
8628 ---- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts
8629 -+++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
8630 -@@ -167,7 +167,13 @@
8631 +-static long at91sam9x5_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate,
8632 +- unsigned long *parent_rate)
8633 ++static long at91sam9x5_clk_usb_determine_rate(struct clk_hw *hw,
8634 ++ unsigned long rate,
8635 ++ unsigned long min_rate,
8636 ++ unsigned long max_rate,
8637 ++ unsigned long *best_parent_rate,
8638 ++ struct clk_hw **best_parent_hw)
8639 + {
8640 +- unsigned long div;
8641 ++ struct clk *parent = NULL;
8642 ++ long best_rate = -EINVAL;
8643 ++ unsigned long tmp_rate;
8644 ++ int best_diff = -1;
8645 ++ int tmp_diff;
8646 ++ int i;
8647
8648 - macb1: ethernet@f802c000 {
8649 - phy-mode = "rmii";
8650 -+ #address-cells = <1>;
8651 -+ #size-cells = <0>;
8652 - status = "okay";
8653 +- if (!rate)
8654 +- return -EINVAL;
8655 ++ for (i = 0; i < __clk_get_num_parents(hw->clk); i++) {
8656 ++ int div;
8657 +
8658 +- if (rate >= *parent_rate)
8659 +- return *parent_rate;
8660 ++ parent = clk_get_parent_by_index(hw->clk, i);
8661 ++ if (!parent)
8662 ++ continue;
8663 +
8664 -+ ethernet-phy@1 {
8665 -+ reg = <0x1>;
8666 -+ };
8667 - };
8668 ++ for (div = 1; div < SAM9X5_USB_MAX_DIV + 2; div++) {
8669 ++ unsigned long tmp_parent_rate;
8670 ++
8671 ++ tmp_parent_rate = rate * div;
8672 ++ tmp_parent_rate = __clk_round_rate(parent,
8673 ++ tmp_parent_rate);
8674 ++ tmp_rate = DIV_ROUND_CLOSEST(tmp_parent_rate, div);
8675 ++ if (tmp_rate < rate)
8676 ++ tmp_diff = rate - tmp_rate;
8677 ++ else
8678 ++ tmp_diff = tmp_rate - rate;
8679 ++
8680 ++ if (best_diff < 0 || best_diff > tmp_diff) {
8681 ++ best_rate = tmp_rate;
8682 ++ best_diff = tmp_diff;
8683 ++ *best_parent_rate = tmp_parent_rate;
8684 ++ *best_parent_hw = __clk_get_hw(parent);
8685 ++ }
8686 ++
8687 ++ if (!best_diff || tmp_rate < rate)
8688 ++ break;
8689 ++ }
8690
8691 - dbgu: serial@ffffee00 {
8692 ---
8693 -2.3.6
8694 -
8695 -
8696 -From 5b126c3890f31b1b0e2bbfd94aace90169664e69 Mon Sep 17 00:00:00 2001
8697 -From: Sebastian Hesselbarth <sebastian.hesselbarth@×××××.com>
8698 -Date: Tue, 17 Feb 2015 19:52:04 +0100
8699 -Subject: [PATCH 070/219] ARM: dts: dove: Fix uart[23] reg property
8700 -Cc: mpagano@g.o
8701 -
8702 -commit a74cd13b807029397f7232449df929bac11fb228 upstream.
8703 -
8704 -Fix Dove's register addresses of uart2 and uart3 nodes that seem to
8705 -be broken since ages due to a copy-and-paste error.
8706 -
8707 -Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@×××××.com>
8708 -Acked-by: Gregory CLEMENT <gregory.clement@××××××××××××××.com>
8709 -Signed-off-by: Gregory CLEMENT <gregory.clement@××××××××××××××.com>
8710 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
8711 -Signed-off-by: Mike Pagano <mpagano@g.o>
8712 ----
8713 - arch/arm/boot/dts/dove.dtsi | 4 ++--
8714 - 1 file changed, 2 insertions(+), 2 deletions(-)
8715 -
8716 -diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
8717 -index a5441d5..3cc8b83 100644
8718 ---- a/arch/arm/boot/dts/dove.dtsi
8719 -+++ b/arch/arm/boot/dts/dove.dtsi
8720 -@@ -154,7 +154,7 @@
8721 +- div = DIV_ROUND_CLOSEST(*parent_rate, rate);
8722 +- if (div > SAM9X5_USB_MAX_DIV + 1)
8723 +- div = SAM9X5_USB_MAX_DIV + 1;
8724 ++ if (!best_diff)
8725 ++ break;
8726 ++ }
8727
8728 - uart2: serial@12200 {
8729 - compatible = "ns16550a";
8730 -- reg = <0x12000 0x100>;
8731 -+ reg = <0x12200 0x100>;
8732 - reg-shift = <2>;
8733 - interrupts = <9>;
8734 - clocks = <&core_clk 0>;
8735 -@@ -163,7 +163,7 @@
8736 +- return DIV_ROUND_CLOSEST(*parent_rate, div);
8737 ++ return best_rate;
8738 + }
8739
8740 - uart3: serial@12300 {
8741 - compatible = "ns16550a";
8742 -- reg = <0x12100 0x100>;
8743 -+ reg = <0x12300 0x100>;
8744 - reg-shift = <2>;
8745 - interrupts = <10>;
8746 - clocks = <&core_clk 0>;
8747 ---
8748 -2.3.6
8749 -
8750 -
8751 -From 422be9a5e09ea7d6e84ad2c3d05dfdf01e4a7a3f Mon Sep 17 00:00:00 2001
8752 -From: Andreas Faerber <afaerber@××××.de>
8753 -Date: Wed, 18 Mar 2015 01:25:18 +0900
8754 -Subject: [PATCH 071/219] ARM: dts: fix mmc node updates for exynos5250-spring
8755 -Cc: mpagano@g.o
8756 -
8757 -commit 7e9e20b1faab02357501553d7f4e3efec1b4cfd3 upstream.
8758 -
8759 -Resolve a merge conflict with mmc refactoring aaa25a5a33cb ("ARM: dts:
8760 -unuse the slot-node and deprecate the supports-highspeed for dw-mmc in
8761 -exynos") by dropping the slot@0 nodes, moving its bus-width property to
8762 -the mmc node and replacing supports-highspeed with cap-{mmc,sd}-highspeed,
8763 -matching exynos5250-snow.
8764 -
8765 -Cc: Jaehoon Chung <jh80.chung@×××××××.com>
8766 -Fixes: 53dd4138bb0a ("ARM: dts: Add exynos5250-spring device tree")
8767 -Signed-off-by: Andreas Faerber <afaerber@××××.de>
8768 -Reviewed-by: Javier Martinez Canillas <javier.martinez@××××××××××××.uk>
8769 -Signed-off-by: Kukjin Kim <kgene@××××××.org>
8770 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
8771 -Signed-off-by: Mike Pagano <mpagano@g.o>
8772 ----
8773 - arch/arm/boot/dts/exynos5250-spring.dts | 16 ++++------------
8774 - 1 file changed, 4 insertions(+), 12 deletions(-)
8775 -
8776 -diff --git a/arch/arm/boot/dts/exynos5250-spring.dts b/arch/arm/boot/dts/exynos5250-spring.dts
8777 -index f027754..c41600e 100644
8778 ---- a/arch/arm/boot/dts/exynos5250-spring.dts
8779 -+++ b/arch/arm/boot/dts/exynos5250-spring.dts
8780 -@@ -429,7 +429,6 @@
8781 - &mmc_0 {
8782 - status = "okay";
8783 - num-slots = <1>;
8784 -- supports-highspeed;
8785 - broken-cd;
8786 - card-detect-delay = <200>;
8787 - samsung,dw-mshc-ciu-div = <3>;
8788 -@@ -437,11 +436,8 @@
8789 - samsung,dw-mshc-ddr-timing = <1 2>;
8790 - pinctrl-names = "default";
8791 - pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_cd &sd0_bus4 &sd0_bus8>;
8792 --
8793 -- slot@0 {
8794 -- reg = <0>;
8795 -- bus-width = <8>;
8796 -- };
8797 -+ bus-width = <8>;
8798 -+ cap-mmc-highspeed;
8799 - };
8800 + static int at91sam9x5_clk_usb_set_parent(struct clk_hw *hw, u8 index)
8801 +@@ -121,7 +154,7 @@ static int at91sam9x5_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate,
8802
8803 - /*
8804 -@@ -451,7 +447,6 @@
8805 - &mmc_1 {
8806 - status = "okay";
8807 - num-slots = <1>;
8808 -- supports-highspeed;
8809 - broken-cd;
8810 - card-detect-delay = <200>;
8811 - samsung,dw-mshc-ciu-div = <3>;
8812 -@@ -459,11 +454,8 @@
8813 - samsung,dw-mshc-ddr-timing = <1 2>;
8814 - pinctrl-names = "default";
8815 - pinctrl-0 = <&sd1_clk &sd1_cmd &sd1_cd &sd1_bus4>;
8816 --
8817 -- slot@0 {
8818 -- reg = <0>;
8819 -- bus-width = <4>;
8820 -- };
8821 -+ bus-width = <4>;
8822 -+ cap-sd-highspeed;
8823 + static const struct clk_ops at91sam9x5_usb_ops = {
8824 + .recalc_rate = at91sam9x5_clk_usb_recalc_rate,
8825 +- .round_rate = at91sam9x5_clk_usb_round_rate,
8826 ++ .determine_rate = at91sam9x5_clk_usb_determine_rate,
8827 + .get_parent = at91sam9x5_clk_usb_get_parent,
8828 + .set_parent = at91sam9x5_clk_usb_set_parent,
8829 + .set_rate = at91sam9x5_clk_usb_set_rate,
8830 +@@ -159,7 +192,7 @@ static const struct clk_ops at91sam9n12_usb_ops = {
8831 + .disable = at91sam9n12_clk_usb_disable,
8832 + .is_enabled = at91sam9n12_clk_usb_is_enabled,
8833 + .recalc_rate = at91sam9x5_clk_usb_recalc_rate,
8834 +- .round_rate = at91sam9x5_clk_usb_round_rate,
8835 ++ .determine_rate = at91sam9x5_clk_usb_determine_rate,
8836 + .set_rate = at91sam9x5_clk_usb_set_rate,
8837 };
8838
8839 - &pinctrl_0 {
8840 ---
8841 -2.3.6
8842 -
8843 -
8844 -From 55db0145ac65aec05c736cddb3a6717b83619d7e Mon Sep 17 00:00:00 2001
8845 -From: Felipe Balbi <balbi@××.com>
8846 -Date: Mon, 30 Dec 2013 12:33:53 -0600
8847 -Subject: [PATCH 072/219] usb: musb: core: fix TX/RX endpoint order
8848 -Cc: mpagano@g.o
8849 -
8850 -commit e3c93e1a3f35be4cf1493d3ccfb0c6d9209e4922 upstream.
8851 -
8852 -As per Mentor Graphics' documentation, we should
8853 -always handle TX endpoints before RX endpoints.
8854 -
8855 -This patch fixes that error while also updating
8856 -some hard-to-read comments which were scattered
8857 -around musb_interrupt().
8858 -
8859 -This patch should be backported as far back as
8860 -possible since this error has been in the driver
8861 -since it's conception.
8862 -
8863 -Signed-off-by: Felipe Balbi <balbi@××.com>
8864 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
8865 -Signed-off-by: Mike Pagano <mpagano@g.o>
8866 ----
8867 - drivers/usb/musb/musb_core.c | 44 ++++++++++++++++++++++++++------------------
8868 - 1 file changed, 26 insertions(+), 18 deletions(-)
8869 -
8870 -diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
8871 -index 067920f..461bfe8 100644
8872 ---- a/drivers/usb/musb/musb_core.c
8873 -+++ b/drivers/usb/musb/musb_core.c
8874 -@@ -1597,16 +1597,30 @@ irqreturn_t musb_interrupt(struct musb *musb)
8875 - is_host_active(musb) ? "host" : "peripheral",
8876 - musb->int_usb, musb->int_tx, musb->int_rx);
8877 -
8878 -- /* the core can interrupt us for multiple reasons; docs have
8879 -- * a generic interrupt flowchart to follow
8880 -+ /**
8881 -+ * According to Mentor Graphics' documentation, flowchart on page 98,
8882 -+ * IRQ should be handled as follows:
8883 -+ *
8884 -+ * . Resume IRQ
8885 -+ * . Session Request IRQ
8886 -+ * . VBUS Error IRQ
8887 -+ * . Suspend IRQ
8888 -+ * . Connect IRQ
8889 -+ * . Disconnect IRQ
8890 -+ * . Reset/Babble IRQ
8891 -+ * . SOF IRQ (we're not using this one)
8892 -+ * . Endpoint 0 IRQ
8893 -+ * . TX Endpoints
8894 -+ * . RX Endpoints
8895 -+ *
8896 -+ * We will be following that flowchart in order to avoid any problems
8897 -+ * that might arise with internal Finite State Machine.
8898 - */
8899 -+
8900 - if (musb->int_usb)
8901 - retval |= musb_stage0_irq(musb, musb->int_usb,
8902 - devctl);
8903 -
8904 -- /* "stage 1" is handling endpoint irqs */
8905 --
8906 -- /* handle endpoint 0 first */
8907 - if (musb->int_tx & 1) {
8908 - if (is_host_active(musb))
8909 - retval |= musb_h_ep0_irq(musb);
8910 -@@ -1614,37 +1628,31 @@ irqreturn_t musb_interrupt(struct musb *musb)
8911 - retval |= musb_g_ep0_irq(musb);
8912 - }
8913 -
8914 -- /* RX on endpoints 1-15 */
8915 -- reg = musb->int_rx >> 1;
8916 -+ reg = musb->int_tx >> 1;
8917 - ep_num = 1;
8918 - while (reg) {
8919 - if (reg & 1) {
8920 -- /* musb_ep_select(musb->mregs, ep_num); */
8921 -- /* REVISIT just retval = ep->rx_irq(...) */
8922 - retval = IRQ_HANDLED;
8923 - if (is_host_active(musb))
8924 -- musb_host_rx(musb, ep_num);
8925 -+ musb_host_tx(musb, ep_num);
8926 - else
8927 -- musb_g_rx(musb, ep_num);
8928 -+ musb_g_tx(musb, ep_num);
8929 - }
8930 --
8931 - reg >>= 1;
8932 - ep_num++;
8933 - }
8934 +@@ -179,7 +212,8 @@ at91sam9x5_clk_register_usb(struct at91_pmc *pmc, const char *name,
8935 + init.ops = &at91sam9x5_usb_ops;
8936 + init.parent_names = parent_names;
8937 + init.num_parents = num_parents;
8938 +- init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE;
8939 ++ init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE |
8940 ++ CLK_SET_RATE_PARENT;
8941
8942 -- /* TX on endpoints 1-15 */
8943 -- reg = musb->int_tx >> 1;
8944 -+ reg = musb->int_rx >> 1;
8945 - ep_num = 1;
8946 - while (reg) {
8947 - if (reg & 1) {
8948 -- /* musb_ep_select(musb->mregs, ep_num); */
8949 -- /* REVISIT just retval |= ep->tx_irq(...) */
8950 - retval = IRQ_HANDLED;
8951 - if (is_host_active(musb))
8952 -- musb_host_tx(musb, ep_num);
8953 -+ musb_host_rx(musb, ep_num);
8954 - else
8955 -- musb_g_tx(musb, ep_num);
8956 -+ musb_g_rx(musb, ep_num);
8957 - }
8958 -+
8959 - reg >>= 1;
8960 - ep_num++;
8961 - }
8962 ---
8963 -2.3.6
8964 -
8965 -
8966 -From 968986cb57477f487045baa184eee0cf7a82b2e3 Mon Sep 17 00:00:00 2001
8967 -From: Axel Lin <axel.lin@××××××.com>
8968 -Date: Thu, 12 Mar 2015 09:15:28 +0800
8969 -Subject: [PATCH 073/219] usb: phy: Find the right match in devm_usb_phy_match
8970 -Cc: mpagano@g.o
8971 -
8972 -commit 869aee0f31429fa9d94d5aef539602b73ae0cf4b upstream.
8973 -
8974 -The res parameter passed to devm_usb_phy_match() is the location where the
8975 -pointer to the usb_phy is stored, hence it needs to be dereferenced before
8976 -comparing to the match data in order to find the correct match.
8977 -
8978 -Fixes: 410219dcd2ba ("usb: otg: utils: devres: Add API's to associate a device with the phy")
8979 -Signed-off-by: Axel Lin <axel.lin@××××××.com>
8980 -Signed-off-by: Felipe Balbi <balbi@××.com>
8981 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
8982 -Signed-off-by: Mike Pagano <mpagano@g.o>
8983 ----
8984 - drivers/usb/phy/phy.c | 4 +++-
8985 - 1 file changed, 3 insertions(+), 1 deletion(-)
8986 -
8987 -diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
8988 -index 2f9735b..d1cd6b5 100644
8989 ---- a/drivers/usb/phy/phy.c
8990 -+++ b/drivers/usb/phy/phy.c
8991 -@@ -81,7 +81,9 @@ static void devm_usb_phy_release(struct device *dev, void *res)
8992 + usb->hw.init = &init;
8993 + usb->pmc = pmc;
8994 +@@ -207,7 +241,7 @@ at91sam9n12_clk_register_usb(struct at91_pmc *pmc, const char *name,
8995 + init.ops = &at91sam9n12_usb_ops;
8996 + init.parent_names = &parent_name;
8997 + init.num_parents = 1;
8998 +- init.flags = CLK_SET_RATE_GATE;
8999 ++ init.flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT;
9000
9001 - static int devm_usb_phy_match(struct device *dev, void *res, void *match_data)
9002 - {
9003 -- return res == match_data;
9004 -+ struct usb_phy **phy = res;
9005 -+
9006 -+ return *phy == match_data;
9007 + usb->hw.init = &init;
9008 + usb->pmc = pmc;
9009 +diff --git a/drivers/clk/qcom/clk-rcg.c b/drivers/clk/qcom/clk-rcg.c
9010 +index 0039bd7..466f30c 100644
9011 +--- a/drivers/clk/qcom/clk-rcg.c
9012 ++++ b/drivers/clk/qcom/clk-rcg.c
9013 +@@ -495,6 +495,57 @@ static int clk_rcg_bypass_set_rate(struct clk_hw *hw, unsigned long rate,
9014 + return __clk_rcg_set_rate(rcg, rcg->freq_tbl);
9015 }
9016
9017 - /**
9018 ---
9019 -2.3.6
9020 -
9021 -
9022 -From c3f787950225dc61f2a4342601d78d1052d0f8ef Mon Sep 17 00:00:00 2001
9023 -From: Felipe Balbi <balbi@××.com>
9024 -Date: Fri, 13 Feb 2015 14:34:25 -0600
9025 -Subject: [PATCH 074/219] usb: define a generic USB_RESUME_TIMEOUT macro
9026 -Cc: mpagano@g.o
9027 -
9028 -commit 62f0342de1f012f3e90607d39e20fce811391169 upstream.
9029 -
9030 -Every USB Host controller should use this new
9031 -macro to define for how long resume signalling
9032 -should be driven on the bus.
9033 -
9034 -Currently, almost every single USB controller
9035 -is using a 20ms timeout for resume signalling.
9036 -
9037 -That's problematic for two reasons:
9038 -
9039 -a) sometimes that 20ms timer expires a little
9040 -before 20ms, which makes us fail certification
9041 -
9042 -b) some (many) devices actually need more than
9043 -20ms resume signalling.
9044 -
9045 -Sure, in case of (b) we can state that the device
9046 -is against the USB spec, but the fact is that
9047 -we have no control over which device the certification
9048 -lab will use. We also have no control over which host
9049 -they will use. Most likely they'll be using a Windows
9050 -PC which, again, we have no control over how that
9051 -USB stack is written and how long resume signalling
9052 -they are using.
9053 -
9054 -At the end of the day, we must make sure Linux passes
9055 -electrical compliance when working as Host or as Device
9056 -and currently we don't pass compliance as host because
9057 -we're driving resume signallig for exactly 20ms and
9058 -that confuses certification test setup resulting in
9059 -Certification failure.
9060 -
9061 -Acked-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9062 -Acked-by: Peter Chen <peter.chen@×××××××××.com>
9063 -Signed-off-by: Felipe Balbi <balbi@××.com>
9064 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9065 -Signed-off-by: Mike Pagano <mpagano@g.o>
9066 ----
9067 - include/linux/usb.h | 26 ++++++++++++++++++++++++++
9068 - 1 file changed, 26 insertions(+)
9069 -
9070 -diff --git a/include/linux/usb.h b/include/linux/usb.h
9071 -index 7ee1b5c..447fe29 100644
9072 ---- a/include/linux/usb.h
9073 -+++ b/include/linux/usb.h
9074 -@@ -205,6 +205,32 @@ void usb_put_intf(struct usb_interface *intf);
9075 - #define USB_MAXINTERFACES 32
9076 - #define USB_MAXIADS (USB_MAXINTERFACES/2)
9077 -
9078 +/*
9079 -+ * USB Resume Timer: Every Host controller driver should drive the resume
9080 -+ * signalling on the bus for the amount of time defined by this macro.
9081 -+ *
9082 -+ * That way we will have a 'stable' behavior among all HCDs supported by Linux.
9083 -+ *
9084 -+ * Note that the USB Specification states we should drive resume for *at least*
9085 -+ * 20 ms, but it doesn't give an upper bound. This creates two possible
9086 -+ * situations which we want to avoid:
9087 -+ *
9088 -+ * (a) sometimes an msleep(20) might expire slightly before 20 ms, which causes
9089 -+ * us to fail USB Electrical Tests, thus failing Certification
9090 -+ *
9091 -+ * (b) Some (many) devices actually need more than 20 ms of resume signalling,
9092 -+ * and while we can argue that's against the USB Specification, we don't have
9093 -+ * control over which devices a certification laboratory will be using for
9094 -+ * certification. If CertLab uses a device which was tested against Windows and
9095 -+ * that happens to have relaxed resume signalling rules, we might fall into
9096 -+ * situations where we fail interoperability and electrical tests.
9097 -+ *
9098 -+ * In order to avoid both conditions, we're using a 40 ms resume timeout, which
9099 -+ * should cope with both LPJ calibration errors and devices not following every
9100 -+ * detail of the USB Specification.
9101 ++ * This type of clock has a glitch-free mux that switches between the output of
9102 ++ * the M/N counter and an always on clock source (XO). When clk_set_rate() is
9103 ++ * called we need to make sure that we don't switch to the M/N counter if it
9104 ++ * isn't clocking because the mux will get stuck and the clock will stop
9105 ++ * outputting a clock. This can happen if the framework isn't aware that this
9106 ++ * clock is on and so clk_set_rate() doesn't turn on the new parent. To fix
9107 ++ * this we switch the mux in the enable/disable ops and reprogram the M/N
9108 ++ * counter in the set_rate op. We also make sure to switch away from the M/N
9109 ++ * counter in set_rate if software thinks the clock is off.
9110 + */
9111 -+#define USB_RESUME_TIMEOUT 40 /* ms */
9112 ++static int clk_rcg_lcc_set_rate(struct clk_hw *hw, unsigned long rate,
9113 ++ unsigned long parent_rate)
9114 ++{
9115 ++ struct clk_rcg *rcg = to_clk_rcg(hw);
9116 ++ const struct freq_tbl *f;
9117 ++ int ret;
9118 ++ u32 gfm = BIT(10);
9119 +
9120 - /**
9121 - * struct usb_interface_cache - long-term representation of a device interface
9122 - * @num_altsetting: number of altsettings defined.
9123 ---
9124 -2.3.6
9125 -
9126 -
9127 -From 913916432e9f24d403a51dae54b905b07e509dd9 Mon Sep 17 00:00:00 2001
9128 -From: Felipe Balbi <balbi@××.com>
9129 -Date: Fri, 13 Feb 2015 14:46:27 -0600
9130 -Subject: [PATCH 075/219] usb: musb: use new USB_RESUME_TIMEOUT
9131 -Cc: mpagano@g.o
9132 -
9133 -commit 309be239369609929d5d3833ee043f7c5afc95d1 upstream.
9134 -
9135 -Make sure we're using the new macro, so our
9136 -resume signaling will always pass certification.
9137 -
9138 -Based on original work by Bin Liu <Bin Liu <b-liu@××.com>>
9139 -
9140 -Cc: Bin Liu <b-liu@××.com>
9141 -Signed-off-by: Felipe Balbi <balbi@××.com>
9142 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9143 -Signed-off-by: Mike Pagano <mpagano@g.o>
9144 ----
9145 - drivers/usb/musb/musb_core.c | 7 ++++---
9146 - drivers/usb/musb/musb_virthub.c | 2 +-
9147 - 2 files changed, 5 insertions(+), 4 deletions(-)
9148 -
9149 -diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
9150 -index 461bfe8..ec0ee3b 100644
9151 ---- a/drivers/usb/musb/musb_core.c
9152 -+++ b/drivers/usb/musb/musb_core.c
9153 -@@ -99,6 +99,7 @@
9154 - #include <linux/platform_device.h>
9155 - #include <linux/io.h>
9156 - #include <linux/dma-mapping.h>
9157 -+#include <linux/usb.h>
9158 -
9159 - #include "musb_core.h"
9160 -
9161 -@@ -562,7 +563,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
9162 - (USB_PORT_STAT_C_SUSPEND << 16)
9163 - | MUSB_PORT_STAT_RESUME;
9164 - musb->rh_timer = jiffies
9165 -- + msecs_to_jiffies(20);
9166 -+ + msecs_to_jiffies(USB_RESUME_TIMEOUT);
9167 - musb->need_finish_resume = 1;
9168 ++ f = qcom_find_freq(rcg->freq_tbl, rate);
9169 ++ if (!f)
9170 ++ return -EINVAL;
9171 ++
9172 ++ /* Switch to XO to avoid glitches */
9173 ++ regmap_update_bits(rcg->clkr.regmap, rcg->ns_reg, gfm, 0);
9174 ++ ret = __clk_rcg_set_rate(rcg, f);
9175 ++ /* Switch back to M/N if it's clocking */
9176 ++ if (__clk_is_enabled(hw->clk))
9177 ++ regmap_update_bits(rcg->clkr.regmap, rcg->ns_reg, gfm, gfm);
9178 ++
9179 ++ return ret;
9180 ++}
9181 ++
9182 ++static int clk_rcg_lcc_enable(struct clk_hw *hw)
9183 ++{
9184 ++ struct clk_rcg *rcg = to_clk_rcg(hw);
9185 ++ u32 gfm = BIT(10);
9186 ++
9187 ++ /* Use M/N */
9188 ++ return regmap_update_bits(rcg->clkr.regmap, rcg->ns_reg, gfm, gfm);
9189 ++}
9190 ++
9191 ++static void clk_rcg_lcc_disable(struct clk_hw *hw)
9192 ++{
9193 ++ struct clk_rcg *rcg = to_clk_rcg(hw);
9194 ++ u32 gfm = BIT(10);
9195 ++
9196 ++ /* Use XO */
9197 ++ regmap_update_bits(rcg->clkr.regmap, rcg->ns_reg, gfm, 0);
9198 ++}
9199 ++
9200 + static int __clk_dyn_rcg_set_rate(struct clk_hw *hw, unsigned long rate)
9201 + {
9202 + struct clk_dyn_rcg *rcg = to_clk_dyn_rcg(hw);
9203 +@@ -543,6 +594,17 @@ const struct clk_ops clk_rcg_bypass_ops = {
9204 + };
9205 + EXPORT_SYMBOL_GPL(clk_rcg_bypass_ops);
9206
9207 - musb->xceiv->otg->state = OTG_STATE_A_HOST;
9208 -@@ -2471,7 +2472,7 @@ static int musb_resume(struct device *dev)
9209 - if (musb->need_finish_resume) {
9210 - musb->need_finish_resume = 0;
9211 - schedule_delayed_work(&musb->finish_resume_work,
9212 -- msecs_to_jiffies(20));
9213 -+ msecs_to_jiffies(USB_RESUME_TIMEOUT));
9214 - }
9215 ++const struct clk_ops clk_rcg_lcc_ops = {
9216 ++ .enable = clk_rcg_lcc_enable,
9217 ++ .disable = clk_rcg_lcc_disable,
9218 ++ .get_parent = clk_rcg_get_parent,
9219 ++ .set_parent = clk_rcg_set_parent,
9220 ++ .recalc_rate = clk_rcg_recalc_rate,
9221 ++ .determine_rate = clk_rcg_determine_rate,
9222 ++ .set_rate = clk_rcg_lcc_set_rate,
9223 ++};
9224 ++EXPORT_SYMBOL_GPL(clk_rcg_lcc_ops);
9225 ++
9226 + const struct clk_ops clk_dyn_rcg_ops = {
9227 + .enable = clk_enable_regmap,
9228 + .is_enabled = clk_is_enabled_regmap,
9229 +diff --git a/drivers/clk/qcom/clk-rcg.h b/drivers/clk/qcom/clk-rcg.h
9230 +index 687e41f..d09d06b 100644
9231 +--- a/drivers/clk/qcom/clk-rcg.h
9232 ++++ b/drivers/clk/qcom/clk-rcg.h
9233 +@@ -96,6 +96,7 @@ struct clk_rcg {
9234
9235 - /*
9236 -@@ -2514,7 +2515,7 @@ static int musb_runtime_resume(struct device *dev)
9237 - if (musb->need_finish_resume) {
9238 - musb->need_finish_resume = 0;
9239 - schedule_delayed_work(&musb->finish_resume_work,
9240 -- msecs_to_jiffies(20));
9241 -+ msecs_to_jiffies(USB_RESUME_TIMEOUT));
9242 - }
9243 + extern const struct clk_ops clk_rcg_ops;
9244 + extern const struct clk_ops clk_rcg_bypass_ops;
9245 ++extern const struct clk_ops clk_rcg_lcc_ops;
9246
9247 - return 0;
9248 -diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
9249 -index 294e159..5428ed1 100644
9250 ---- a/drivers/usb/musb/musb_virthub.c
9251 -+++ b/drivers/usb/musb/musb_virthub.c
9252 -@@ -136,7 +136,7 @@ void musb_port_suspend(struct musb *musb, bool do_suspend)
9253 - /* later, GetPortStatus will stop RESUME signaling */
9254 - musb->port1_status |= MUSB_PORT_STAT_RESUME;
9255 - schedule_delayed_work(&musb->finish_resume_work,
9256 -- msecs_to_jiffies(20));
9257 -+ msecs_to_jiffies(USB_RESUME_TIMEOUT));
9258 - }
9259 - }
9260 + #define to_clk_rcg(_hw) container_of(to_clk_regmap(_hw), struct clk_rcg, clkr)
9261
9262 ---
9263 -2.3.6
9264 -
9265 -
9266 -From 0e33853a595e4947e416e86c966a2f532084b3ae Mon Sep 17 00:00:00 2001
9267 -From: Felipe Balbi <balbi@××.com>
9268 -Date: Fri, 13 Feb 2015 14:57:54 -0600
9269 -Subject: [PATCH 076/219] usb: host: oxu210hp: use new USB_RESUME_TIMEOUT
9270 -Cc: mpagano@g.o
9271 -
9272 -commit 84c0d178eb9f3a3ae4d63dc97a440266cf17f7f5 upstream.
9273 -
9274 -Make sure we're using the new macro, so our
9275 -resume signaling will always pass certification.
9276 -
9277 -Signed-off-by: Felipe Balbi <balbi@××.com>
9278 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9279 -Signed-off-by: Mike Pagano <mpagano@g.o>
9280 ----
9281 - drivers/usb/host/oxu210hp-hcd.c | 7 ++++---
9282 - 1 file changed, 4 insertions(+), 3 deletions(-)
9283 -
9284 -diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
9285 -index ef7efb2..28a2866 100644
9286 ---- a/drivers/usb/host/oxu210hp-hcd.c
9287 -+++ b/drivers/usb/host/oxu210hp-hcd.c
9288 -@@ -2500,11 +2500,12 @@ static irqreturn_t oxu210_hcd_irq(struct usb_hcd *hcd)
9289 - || oxu->reset_done[i] != 0)
9290 - continue;
9291 +diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c
9292 +index 742acfa..381f274 100644
9293 +--- a/drivers/clk/qcom/clk-rcg2.c
9294 ++++ b/drivers/clk/qcom/clk-rcg2.c
9295 +@@ -243,7 +243,7 @@ static int clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f)
9296 + mask |= CFG_SRC_SEL_MASK | CFG_MODE_MASK;
9297 + cfg = f->pre_div << CFG_SRC_DIV_SHIFT;
9298 + cfg |= rcg->parent_map[f->src] << CFG_SRC_SEL_SHIFT;
9299 +- if (rcg->mnd_width && f->n)
9300 ++ if (rcg->mnd_width && f->n && (f->m != f->n))
9301 + cfg |= CFG_MODE_DUAL_EDGE;
9302 + ret = regmap_update_bits(rcg->clkr.regmap,
9303 + rcg->cmd_rcgr + CFG_REG, mask, cfg);
9304 +diff --git a/drivers/clk/qcom/gcc-ipq806x.c b/drivers/clk/qcom/gcc-ipq806x.c
9305 +index cbdc31d..a015bb0 100644
9306 +--- a/drivers/clk/qcom/gcc-ipq806x.c
9307 ++++ b/drivers/clk/qcom/gcc-ipq806x.c
9308 +@@ -525,8 +525,8 @@ static struct freq_tbl clk_tbl_gsbi_qup[] = {
9309 + { 10800000, P_PXO, 1, 2, 5 },
9310 + { 15060000, P_PLL8, 1, 2, 51 },
9311 + { 24000000, P_PLL8, 4, 1, 4 },
9312 ++ { 25000000, P_PXO, 1, 0, 0 },
9313 + { 25600000, P_PLL8, 1, 1, 15 },
9314 +- { 27000000, P_PXO, 1, 0, 0 },
9315 + { 48000000, P_PLL8, 4, 1, 2 },
9316 + { 51200000, P_PLL8, 1, 2, 15 },
9317 + { }
9318 +diff --git a/drivers/clk/qcom/lcc-ipq806x.c b/drivers/clk/qcom/lcc-ipq806x.c
9319 +index c9ff27b..a6d3a67 100644
9320 +--- a/drivers/clk/qcom/lcc-ipq806x.c
9321 ++++ b/drivers/clk/qcom/lcc-ipq806x.c
9322 +@@ -294,14 +294,14 @@ static struct clk_regmap_mux pcm_clk = {
9323 + };
9324
9325 -- /* start 20 msec resume signaling from this port,
9326 -- * and make hub_wq collect PORT_STAT_C_SUSPEND to
9327 -+ /* start USB_RESUME_TIMEOUT resume signaling from this
9328 -+ * port, and make hub_wq collect PORT_STAT_C_SUSPEND to
9329 - * stop that signaling.
9330 - */
9331 -- oxu->reset_done[i] = jiffies + msecs_to_jiffies(20);
9332 -+ oxu->reset_done[i] = jiffies +
9333 -+ msecs_to_jiffies(USB_RESUME_TIMEOUT);
9334 - oxu_dbg(oxu, "port %d remote wakeup\n", i + 1);
9335 - mod_timer(&hcd->rh_timer, oxu->reset_done[i]);
9336 - }
9337 ---
9338 -2.3.6
9339 -
9340 -
9341 -From 9aeb024dc65fa1c9520c655a36d52d48e4285ab1 Mon Sep 17 00:00:00 2001
9342 -From: Felipe Balbi <balbi@××.com>
9343 -Date: Fri, 13 Feb 2015 14:55:34 -0600
9344 -Subject: [PATCH 077/219] usb: host: fusbh200: use new USB_RESUME_TIMEOUT
9345 -Cc: mpagano@g.o
9346 -
9347 -commit 595227db1f2d98bfc33f02a55842f268e12b247d upstream.
9348 -
9349 -Make sure we're using the new macro, so our
9350 -resume signaling will always pass certification.
9351 -
9352 -Signed-off-by: Felipe Balbi <balbi@××.com>
9353 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9354 -Signed-off-by: Mike Pagano <mpagano@g.o>
9355 ----
9356 - drivers/usb/host/fusbh200-hcd.c | 3 +--
9357 - 1 file changed, 1 insertion(+), 2 deletions(-)
9358 -
9359 -diff --git a/drivers/usb/host/fusbh200-hcd.c b/drivers/usb/host/fusbh200-hcd.c
9360 -index a83eefe..ba77e2e 100644
9361 ---- a/drivers/usb/host/fusbh200-hcd.c
9362 -+++ b/drivers/usb/host/fusbh200-hcd.c
9363 -@@ -1550,10 +1550,9 @@ static int fusbh200_hub_control (
9364 - if ((temp & PORT_PE) == 0)
9365 - goto error;
9366 + static struct freq_tbl clk_tbl_aif_osr[] = {
9367 +- { 22050, P_PLL4, 1, 147, 20480 },
9368 +- { 32000, P_PLL4, 1, 1, 96 },
9369 +- { 44100, P_PLL4, 1, 147, 10240 },
9370 +- { 48000, P_PLL4, 1, 1, 64 },
9371 +- { 88200, P_PLL4, 1, 147, 5120 },
9372 +- { 96000, P_PLL4, 1, 1, 32 },
9373 +- { 176400, P_PLL4, 1, 147, 2560 },
9374 +- { 192000, P_PLL4, 1, 1, 16 },
9375 ++ { 2822400, P_PLL4, 1, 147, 20480 },
9376 ++ { 4096000, P_PLL4, 1, 1, 96 },
9377 ++ { 5644800, P_PLL4, 1, 147, 10240 },
9378 ++ { 6144000, P_PLL4, 1, 1, 64 },
9379 ++ { 11289600, P_PLL4, 1, 147, 5120 },
9380 ++ { 12288000, P_PLL4, 1, 1, 32 },
9381 ++ { 22579200, P_PLL4, 1, 147, 2560 },
9382 ++ { 24576000, P_PLL4, 1, 1, 16 },
9383 + { },
9384 + };
9385
9386 -- /* resume signaling for 20 msec */
9387 - fusbh200_writel(fusbh200, temp | PORT_RESUME, status_reg);
9388 - fusbh200->reset_done[wIndex] = jiffies
9389 -- + msecs_to_jiffies(20);
9390 -+ + msecs_to_jiffies(USB_RESUME_TIMEOUT);
9391 - break;
9392 - case USB_PORT_FEAT_C_SUSPEND:
9393 - clear_bit(wIndex, &fusbh200->port_c_suspend);
9394 ---
9395 -2.3.6
9396 -
9397 -
9398 -From c8d7235af46783ee3e312ea5c877ac73de8c435d Mon Sep 17 00:00:00 2001
9399 -From: Felipe Balbi <balbi@××.com>
9400 -Date: Fri, 13 Feb 2015 14:44:17 -0600
9401 -Subject: [PATCH 078/219] usb: host: uhci: use new USB_RESUME_TIMEOUT
9402 -Cc: mpagano@g.o
9403 -
9404 -commit b8fb6f79f76f478acbbffccc966daa878f172a0a upstream.
9405 -
9406 -Make sure we're using the new macro, so our
9407 -resume signaling will always pass certification.
9408 -
9409 -Signed-off-by: Felipe Balbi <balbi@××.com>
9410 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9411 -Signed-off-by: Mike Pagano <mpagano@g.o>
9412 ----
9413 - drivers/usb/host/uhci-hub.c | 5 +++--
9414 - 1 file changed, 3 insertions(+), 2 deletions(-)
9415 -
9416 -diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c
9417 -index 19ba5ea..7b3d1af 100644
9418 ---- a/drivers/usb/host/uhci-hub.c
9419 -+++ b/drivers/usb/host/uhci-hub.c
9420 -@@ -166,7 +166,7 @@ static void uhci_check_ports(struct uhci_hcd *uhci)
9421 - /* Port received a wakeup request */
9422 - set_bit(port, &uhci->resuming_ports);
9423 - uhci->ports_timeout = jiffies +
9424 -- msecs_to_jiffies(25);
9425 -+ msecs_to_jiffies(USB_RESUME_TIMEOUT);
9426 - usb_hcd_start_port_resume(
9427 - &uhci_to_hcd(uhci)->self, port);
9428 +@@ -360,7 +360,7 @@ static struct clk_branch spdif_clk = {
9429 + };
9430
9431 -@@ -338,7 +338,8 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
9432 - uhci_finish_suspend(uhci, port, port_addr);
9433 + static struct freq_tbl clk_tbl_ahbix[] = {
9434 +- { 131072, P_PLL4, 1, 1, 3 },
9435 ++ { 131072000, P_PLL4, 1, 1, 3 },
9436 + { },
9437 + };
9438
9439 - /* USB v2.0 7.1.7.5 */
9440 -- uhci->ports_timeout = jiffies + msecs_to_jiffies(50);
9441 -+ uhci->ports_timeout = jiffies +
9442 -+ msecs_to_jiffies(USB_RESUME_TIMEOUT);
9443 - break;
9444 - case USB_PORT_FEAT_POWER:
9445 - /* UHCI has no power switching */
9446 ---
9447 -2.3.6
9448 -
9449 -
9450 -From fb4655758ba685c5aa07b9af45b18895e3df2a26 Mon Sep 17 00:00:00 2001
9451 -From: Felipe Balbi <balbi@××.com>
9452 -Date: Fri, 13 Feb 2015 14:54:38 -0600
9453 -Subject: [PATCH 079/219] usb: host: fotg210: use new USB_RESUME_TIMEOUT
9454 -Cc: mpagano@g.o
9455 -
9456 -commit 7e136bb71a08e8b8be3bc492f041d9b0bea3856d upstream.
9457 -
9458 -Make sure we're using the new macro, so our
9459 -resume signaling will always pass certification.
9460 -
9461 -Signed-off-by: Felipe Balbi <balbi@××.com>
9462 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9463 -Signed-off-by: Mike Pagano <mpagano@g.o>
9464 ----
9465 - drivers/usb/host/fotg210-hcd.c | 2 +-
9466 - 1 file changed, 1 insertion(+), 1 deletion(-)
9467 -
9468 -diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
9469 -index 475b21f..7a6681f 100644
9470 ---- a/drivers/usb/host/fotg210-hcd.c
9471 -+++ b/drivers/usb/host/fotg210-hcd.c
9472 -@@ -1595,7 +1595,7 @@ static int fotg210_hub_control(
9473 - /* resume signaling for 20 msec */
9474 - fotg210_writel(fotg210, temp | PORT_RESUME, status_reg);
9475 - fotg210->reset_done[wIndex] = jiffies
9476 -- + msecs_to_jiffies(20);
9477 -+ + msecs_to_jiffies(USB_RESUME_TIMEOUT);
9478 - break;
9479 - case USB_PORT_FEAT_C_SUSPEND:
9480 - clear_bit(wIndex, &fotg210->port_c_suspend);
9481 ---
9482 -2.3.6
9483 -
9484 -
9485 -From 14c69a53b6c0640d94796b04762ed943e9cf3918 Mon Sep 17 00:00:00 2001
9486 -From: Felipe Balbi <balbi@××.com>
9487 -Date: Fri, 13 Feb 2015 14:58:53 -0600
9488 -Subject: [PATCH 080/219] usb: host: r8a66597: use new USB_RESUME_TIMEOUT
9489 -Cc: mpagano@g.o
9490 -
9491 -commit 7a606ac29752a3e571b83f9b3fceb1eaa1d37781 upstream.
9492 -
9493 -While this driver was already using a 50ms resume
9494 -timeout, let's make sure everybody uses the same
9495 -macro so it's easy to fix later should anything
9496 -go wrong.
9497 -
9498 -It also gives a more "stable" expectation to Linux
9499 -users.
9500 -
9501 -Signed-off-by: Felipe Balbi <balbi@××.com>
9502 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9503 -Signed-off-by: Mike Pagano <mpagano@g.o>
9504 ----
9505 - drivers/usb/host/r8a66597-hcd.c | 2 +-
9506 - 1 file changed, 1 insertion(+), 1 deletion(-)
9507 -
9508 -diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
9509 -index bdc82fe..54a4170 100644
9510 ---- a/drivers/usb/host/r8a66597-hcd.c
9511 -+++ b/drivers/usb/host/r8a66597-hcd.c
9512 -@@ -2301,7 +2301,7 @@ static int r8a66597_bus_resume(struct usb_hcd *hcd)
9513 - rh->port &= ~USB_PORT_STAT_SUSPEND;
9514 - rh->port |= USB_PORT_STAT_C_SUSPEND << 16;
9515 - r8a66597_mdfy(r8a66597, RESUME, RESUME | UACT, dvstctr_reg);
9516 -- msleep(50);
9517 -+ msleep(USB_RESUME_TIMEOUT);
9518 - r8a66597_mdfy(r8a66597, UACT, RESUME | UACT, dvstctr_reg);
9519 - }
9520 +@@ -386,13 +386,12 @@ static struct clk_rcg ahbix_clk = {
9521 + .freq_tbl = clk_tbl_ahbix,
9522 + .clkr = {
9523 + .enable_reg = 0x38,
9524 +- .enable_mask = BIT(10), /* toggle the gfmux to select mn/pxo */
9525 ++ .enable_mask = BIT(11),
9526 + .hw.init = &(struct clk_init_data){
9527 + .name = "ahbix",
9528 + .parent_names = lcc_pxo_pll4,
9529 + .num_parents = 2,
9530 +- .ops = &clk_rcg_ops,
9531 +- .flags = CLK_SET_RATE_GATE,
9532 ++ .ops = &clk_rcg_lcc_ops,
9533 + },
9534 + },
9535 + };
9536 +diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c
9537 +index 51462e8..714d6ba 100644
9538 +--- a/drivers/clk/samsung/clk-exynos4.c
9539 ++++ b/drivers/clk/samsung/clk-exynos4.c
9540 +@@ -1354,7 +1354,7 @@ static struct samsung_pll_clock exynos4x12_plls[nr_plls] __initdata = {
9541 + VPLL_LOCK, VPLL_CON0, NULL),
9542 + };
9543
9544 ---
9545 -2.3.6
9546 -
9547 -
9548 -From 34f698795e94955800a8ba8acdea4a725211a20a Mon Sep 17 00:00:00 2001
9549 -From: Felipe Balbi <balbi@××.com>
9550 -Date: Fri, 13 Feb 2015 14:50:10 -0600
9551 -Subject: [PATCH 081/219] usb: host: isp116x: use new USB_RESUME_TIMEOUT
9552 -Cc: mpagano@g.o
9553 -
9554 -commit 8c0ae6574ccfd3d619876a65829aad74c9d22ba5 upstream.
9555 -
9556 -Make sure we're using the new macro, so our
9557 -resume signaling will always pass certification.
9558 -
9559 -Signed-off-by: Felipe Balbi <balbi@××.com>
9560 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9561 -Signed-off-by: Mike Pagano <mpagano@g.o>
9562 ----
9563 - drivers/usb/host/isp116x-hcd.c | 2 +-
9564 - 1 file changed, 1 insertion(+), 1 deletion(-)
9565 -
9566 -diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
9567 -index 113d0cc..9ef5644 100644
9568 ---- a/drivers/usb/host/isp116x-hcd.c
9569 -+++ b/drivers/usb/host/isp116x-hcd.c
9570 -@@ -1490,7 +1490,7 @@ static int isp116x_bus_resume(struct usb_hcd *hcd)
9571 - spin_unlock_irq(&isp116x->lock);
9572 +-static void __init exynos4_core_down_clock(enum exynos4_soc soc)
9573 ++static void __init exynos4x12_core_down_clock(void)
9574 + {
9575 + unsigned int tmp;
9576
9577 - hcd->state = HC_STATE_RESUMING;
9578 -- msleep(20);
9579 -+ msleep(USB_RESUME_TIMEOUT);
9580 +@@ -1373,11 +1373,9 @@ static void __init exynos4_core_down_clock(enum exynos4_soc soc)
9581 + __raw_writel(tmp, reg_base + PWR_CTRL1);
9582
9583 - /* Go operational */
9584 - spin_lock_irq(&isp116x->lock);
9585 ---
9586 -2.3.6
9587 -
9588 -
9589 -From 9a0a677ad3526bf0914aecab14423c761e5af9e7 Mon Sep 17 00:00:00 2001
9590 -From: Felipe Balbi <balbi@××.com>
9591 -Date: Fri, 13 Feb 2015 14:39:13 -0600
9592 -Subject: [PATCH 082/219] usb: host: xhci: use new USB_RESUME_TIMEOUT
9593 -Cc: mpagano@g.o
9594 -
9595 -commit b9e451885deb6262dbaf5cd14aa77d192d9ac759 upstream.
9596 -
9597 -Make sure we're using the new macro, so our
9598 -resume signaling will always pass certification.
9599 -
9600 -Acked-by: Mathias Nyman <mathias.nyman@×××××××××××.com>
9601 -Signed-off-by: Felipe Balbi <balbi@××.com>
9602 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9603 -Signed-off-by: Mike Pagano <mpagano@g.o>
9604 ----
9605 - drivers/usb/host/xhci-ring.c | 2 +-
9606 - 1 file changed, 1 insertion(+), 1 deletion(-)
9607 -
9608 -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
9609 -index 73485fa..eeedde8 100644
9610 ---- a/drivers/usb/host/xhci-ring.c
9611 -+++ b/drivers/usb/host/xhci-ring.c
9612 -@@ -1574,7 +1574,7 @@ static void handle_port_status(struct xhci_hcd *xhci,
9613 - } else {
9614 - xhci_dbg(xhci, "resume HS port %d\n", port_id);
9615 - bus_state->resume_done[faked_port_index] = jiffies +
9616 -- msecs_to_jiffies(20);
9617 -+ msecs_to_jiffies(USB_RESUME_TIMEOUT);
9618 - set_bit(faked_port_index, &bus_state->resuming_ports);
9619 - mod_timer(&hcd->rh_timer,
9620 - bus_state->resume_done[faked_port_index]);
9621 ---
9622 -2.3.6
9623 -
9624 -
9625 -From 426c93ea979c24f4f011351af58d5f5319514493 Mon Sep 17 00:00:00 2001
9626 -From: Felipe Balbi <balbi@××.com>
9627 -Date: Fri, 13 Feb 2015 14:42:25 -0600
9628 -Subject: [PATCH 083/219] usb: host: ehci: use new USB_RESUME_TIMEOUT
9629 -Cc: mpagano@g.o
9630 -
9631 -commit ea16328f80ca8d74434352157f37ef60e2f55ce2 upstream.
9632 -
9633 -Make sure we're using the new macro, so our
9634 -resume signaling will always pass certification.
9635 -
9636 -Signed-off-by: Felipe Balbi <balbi@××.com>
9637 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9638 -Signed-off-by: Mike Pagano <mpagano@g.o>
9639 ----
9640 - drivers/usb/host/ehci-hcd.c | 10 +++++-----
9641 - drivers/usb/host/ehci-hub.c | 9 ++++++---
9642 - 2 files changed, 11 insertions(+), 8 deletions(-)
9643 -
9644 -diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
9645 -index 85e56d1..f4d88df 100644
9646 ---- a/drivers/usb/host/ehci-hcd.c
9647 -+++ b/drivers/usb/host/ehci-hcd.c
9648 -@@ -792,12 +792,12 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
9649 - ehci->reset_done[i] == 0))
9650 - continue;
9651 + /*
9652 +- * Disable the clock up feature on Exynos4x12, in case it was
9653 +- * enabled by bootloader.
9654 ++ * Disable the clock up feature in case it was enabled by bootloader.
9655 + */
9656 +- if (exynos4_soc == EXYNOS4X12)
9657 +- __raw_writel(0x0, reg_base + E4X12_PWR_CTRL2);
9658 ++ __raw_writel(0x0, reg_base + E4X12_PWR_CTRL2);
9659 + }
9660
9661 -- /* start 20 msec resume signaling from this port,
9662 -- * and make hub_wq collect PORT_STAT_C_SUSPEND to
9663 -- * stop that signaling. Use 5 ms extra for safety,
9664 -- * like usb_port_resume() does.
9665 -+ /* start USB_RESUME_TIMEOUT msec resume signaling from
9666 -+ * this port, and make hub_wq collect
9667 -+ * PORT_STAT_C_SUSPEND to stop that signaling.
9668 - */
9669 -- ehci->reset_done[i] = jiffies + msecs_to_jiffies(25);
9670 -+ ehci->reset_done[i] = jiffies +
9671 -+ msecs_to_jiffies(USB_RESUME_TIMEOUT);
9672 - set_bit(i, &ehci->resuming_ports);
9673 - ehci_dbg (ehci, "port %d remote wakeup\n", i + 1);
9674 - usb_hcd_start_port_resume(&hcd->self, i);
9675 -diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
9676 -index 87cf86f..7354d01 100644
9677 ---- a/drivers/usb/host/ehci-hub.c
9678 -+++ b/drivers/usb/host/ehci-hub.c
9679 -@@ -471,10 +471,13 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
9680 - ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
9681 - }
9682 + /* register exynos4 clocks */
9683 +@@ -1474,7 +1472,8 @@ static void __init exynos4_clk_init(struct device_node *np,
9684 + samsung_clk_register_alias(ctx, exynos4_aliases,
9685 + ARRAY_SIZE(exynos4_aliases));
9686
9687 -- /* msleep for 20ms only if code is trying to resume port */
9688 -+ /*
9689 -+ * msleep for USB_RESUME_TIMEOUT ms only if code is trying to resume
9690 -+ * port
9691 -+ */
9692 - if (resume_needed) {
9693 - spin_unlock_irq(&ehci->lock);
9694 -- msleep(20);
9695 -+ msleep(USB_RESUME_TIMEOUT);
9696 - spin_lock_irq(&ehci->lock);
9697 - if (ehci->shutdown)
9698 - goto shutdown;
9699 -@@ -942,7 +945,7 @@ int ehci_hub_control(
9700 - temp &= ~PORT_WAKE_BITS;
9701 - ehci_writel(ehci, temp | PORT_RESUME, status_reg);
9702 - ehci->reset_done[wIndex] = jiffies
9703 -- + msecs_to_jiffies(20);
9704 -+ + msecs_to_jiffies(USB_RESUME_TIMEOUT);
9705 - set_bit(wIndex, &ehci->resuming_ports);
9706 - usb_hcd_start_port_resume(&hcd->self, wIndex);
9707 - break;
9708 ---
9709 -2.3.6
9710 -
9711 -
9712 -From 6a0ecbeea7d077ae4e49c3a1ef03a38bb91c5218 Mon Sep 17 00:00:00 2001
9713 -From: Felipe Balbi <balbi@××.com>
9714 -Date: Fri, 13 Feb 2015 15:00:38 -0600
9715 -Subject: [PATCH 084/219] usb: host: sl811: use new USB_RESUME_TIMEOUT
9716 -Cc: mpagano@g.o
9717 -
9718 -commit 08debfb13b199716da6153940c31968c556b195d upstream.
9719 -
9720 -Make sure we're using the new macro, so our
9721 -resume signaling will always pass certification.
9722 -
9723 -Signed-off-by: Felipe Balbi <balbi@××.com>
9724 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9725 -Signed-off-by: Mike Pagano <mpagano@g.o>
9726 ----
9727 - drivers/usb/host/sl811-hcd.c | 2 +-
9728 - 1 file changed, 1 insertion(+), 1 deletion(-)
9729 -
9730 -diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
9731 -index 4f4ba1e..9118cd8 100644
9732 ---- a/drivers/usb/host/sl811-hcd.c
9733 -+++ b/drivers/usb/host/sl811-hcd.c
9734 -@@ -1259,7 +1259,7 @@ sl811h_hub_control(
9735 - sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1);
9736 +- exynos4_core_down_clock(soc);
9737 ++ if (soc == EXYNOS4X12)
9738 ++ exynos4x12_core_down_clock();
9739 + exynos4_clk_sleep_init();
9740
9741 - mod_timer(&sl811->timer, jiffies
9742 -- + msecs_to_jiffies(20));
9743 -+ + msecs_to_jiffies(USB_RESUME_TIMEOUT));
9744 - break;
9745 - case USB_PORT_FEAT_POWER:
9746 - port_power(sl811, 0);
9747 ---
9748 -2.3.6
9749 -
9750 -
9751 -From 8271acf33346951d281a428ae8a40f20750e789f Mon Sep 17 00:00:00 2001
9752 -From: Felipe Balbi <balbi@××.com>
9753 -Date: Fri, 13 Feb 2015 15:03:13 -0600
9754 -Subject: [PATCH 085/219] usb: dwc2: hcd: use new USB_RESUME_TIMEOUT
9755 -Cc: mpagano@g.o
9756 -
9757 -commit 74bd7b69801819707713b88e9d0bc074efa2f5e7 upstream.
9758 -
9759 -Make sure we're using the new macro, so our
9760 -resume signaling will always pass certification.
9761 -
9762 -Signed-off-by: Felipe Balbi <balbi@××.com>
9763 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9764 -Signed-off-by: Mike Pagano <mpagano@g.o>
9765 ----
9766 - drivers/usb/dwc2/hcd.c | 2 +-
9767 - 1 file changed, 1 insertion(+), 1 deletion(-)
9768 -
9769 -diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
9770 -index c78c874..758b7e0 100644
9771 ---- a/drivers/usb/dwc2/hcd.c
9772 -+++ b/drivers/usb/dwc2/hcd.c
9773 -@@ -1521,7 +1521,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
9774 - dev_dbg(hsotg->dev,
9775 - "ClearPortFeature USB_PORT_FEAT_SUSPEND\n");
9776 - writel(0, hsotg->regs + PCGCTL);
9777 -- usleep_range(20000, 40000);
9778 -+ msleep(USB_RESUME_TIMEOUT);
9779 + samsung_clk_of_add_provider(np, ctx);
9780 +diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c
9781 +index 9a893f2..23ce0af 100644
9782 +--- a/drivers/clk/tegra/clk-tegra124.c
9783 ++++ b/drivers/clk/tegra/clk-tegra124.c
9784 +@@ -1110,16 +1110,18 @@ static __init void tegra124_periph_clk_init(void __iomem *clk_base,
9785 + 1, 2);
9786 + clks[TEGRA124_CLK_XUSB_SS_DIV2] = clk;
9787
9788 - hprt0 = dwc2_read_hprt0(hsotg);
9789 - hprt0 |= HPRT0_RES;
9790 ---
9791 -2.3.6
9792 -
9793 -
9794 -From b6053a1546ea879b47c346628cf40401bcf9e27e Mon Sep 17 00:00:00 2001
9795 -From: Felipe Balbi <balbi@××.com>
9796 -Date: Fri, 13 Feb 2015 15:04:06 -0600
9797 -Subject: [PATCH 086/219] usb: isp1760: hcd: use new USB_RESUME_TIMEOUT
9798 -Cc: mpagano@g.o
9799 -
9800 -commit 59c9904cce77b55892e15f40791f1e66e4d3a1e6 upstream.
9801 -
9802 -Make sure we're using the new macro, so our
9803 -resume signaling will always pass certification.
9804 -
9805 -Signed-off-by: Felipe Balbi <balbi@××.com>
9806 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9807 -Signed-off-by: Mike Pagano <mpagano@g.o>
9808 ----
9809 - drivers/usb/isp1760/isp1760-hcd.c | 2 +-
9810 - 1 file changed, 1 insertion(+), 1 deletion(-)
9811 -
9812 -diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c
9813 -index 3cb98b1..7911b6b 100644
9814 ---- a/drivers/usb/isp1760/isp1760-hcd.c
9815 -+++ b/drivers/usb/isp1760/isp1760-hcd.c
9816 -@@ -1869,7 +1869,7 @@ static int isp1760_hub_control(struct usb_hcd *hcd, u16 typeReq,
9817 - reg_write32(hcd->regs, HC_PORTSC1,
9818 - temp | PORT_RESUME);
9819 - priv->reset_done = jiffies +
9820 -- msecs_to_jiffies(20);
9821 -+ msecs_to_jiffies(USB_RESUME_TIMEOUT);
9822 - }
9823 - break;
9824 - case USB_PORT_FEAT_C_SUSPEND:
9825 ---
9826 -2.3.6
9827 -
9828 -
9829 -From 1eeba7304a3e8070983c3a9f757a6b51236a64de Mon Sep 17 00:00:00 2001
9830 -From: Felipe Balbi <balbi@××.com>
9831 -Date: Fri, 13 Feb 2015 15:38:33 -0600
9832 -Subject: [PATCH 087/219] usb: core: hub: use new USB_RESUME_TIMEOUT
9833 -Cc: mpagano@g.o
9834 -
9835 -commit bbc78c07a51f6fd29c227b1220a9016e585358ba upstream.
9836 -
9837 -Make sure we're using the new macro, so our
9838 -resume signaling will always pass certification.
9839 -
9840 -Signed-off-by: Felipe Balbi <balbi@××.com>
9841 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9842 -Signed-off-by: Mike Pagano <mpagano@g.o>
9843 ----
9844 - drivers/usb/core/hub.c | 4 ++--
9845 - 1 file changed, 2 insertions(+), 2 deletions(-)
9846 -
9847 -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
9848 -index d7c3d5a..3b71516 100644
9849 ---- a/drivers/usb/core/hub.c
9850 -+++ b/drivers/usb/core/hub.c
9851 -@@ -3406,10 +3406,10 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
9852 - if (status) {
9853 - dev_dbg(&port_dev->dev, "can't resume, status %d\n", status);
9854 - } else {
9855 -- /* drive resume for at least 20 msec */
9856 -+ /* drive resume for USB_RESUME_TIMEOUT msec */
9857 - dev_dbg(&udev->dev, "usb %sresume\n",
9858 - (PMSG_IS_AUTO(msg) ? "auto-" : ""));
9859 -- msleep(25);
9860 -+ msleep(USB_RESUME_TIMEOUT);
9861 +- clk = clk_register_gate(NULL, "plld_dsi", "plld_out0", 0,
9862 ++ clk = clk_register_gate(NULL, "pll_d_dsi_out", "pll_d_out0", 0,
9863 + clk_base + PLLD_MISC, 30, 0, &pll_d_lock);
9864 +- clks[TEGRA124_CLK_PLLD_DSI] = clk;
9865 ++ clks[TEGRA124_CLK_PLL_D_DSI_OUT] = clk;
9866
9867 - /* Virtual root hubs can trigger on GET_PORT_STATUS to
9868 - * stop resume signaling. Then finish the resume
9869 ---
9870 -2.3.6
9871 -
9872 -
9873 -From f5a652339c3ff18b6184d0ee02f7f0eef2ebe681 Mon Sep 17 00:00:00 2001
9874 -From: Boris Brezillon <boris.brezillon@××××××××××××××.com>
9875 -Date: Sun, 29 Mar 2015 03:45:33 +0200
9876 -Subject: [PATCH 088/219] clk: at91: usb: propagate rate modification to the
9877 - parent clk
9878 -Cc: mpagano@g.o
9879 -
9880 -commit 4591243102faa8de92da320edea47219901461e9 upstream.
9881 -
9882 -The at91sam9n12 and at91sam9x5 usb clocks do not propagate rate
9883 -modification requests to their parents.
9884 -This causes a bug when the PLLB is left uninitialized by the bootloader
9885 -(PLL multiplier set to 0, or in other words, PLL rate = 0 Hz).
9886 -
9887 -Implement the determinate_rate method and propagate the change rate
9888 -request to the parent clk.
9889 -
9890 -Signed-off-by: Boris Brezillon <boris.brezillon@××××××××××××××.com>
9891 -Reported-by: Bo Shen <voice.shen@×××××.com>
9892 -Tested-by: Bo Shen <voice.shen@×××××.com>
9893 -Signed-off-by: Michael Turquette <mturquette@××××××.org>
9894 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
9895 -Signed-off-by: Mike Pagano <mpagano@g.o>
9896 ----
9897 - drivers/clk/at91/clk-usb.c | 64 +++++++++++++++++++++++++++++++++++-----------
9898 - 1 file changed, 49 insertions(+), 15 deletions(-)
9899 -
9900 -diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
9901 -index a23ac0c..0b7c3e8 100644
9902 ---- a/drivers/clk/at91/clk-usb.c
9903 -+++ b/drivers/clk/at91/clk-usb.c
9904 -@@ -56,22 +56,55 @@ static unsigned long at91sam9x5_clk_usb_recalc_rate(struct clk_hw *hw,
9905 - return DIV_ROUND_CLOSEST(parent_rate, (usbdiv + 1));
9906 - }
9907 +- clk = tegra_clk_register_periph_gate("dsia", "plld_dsi", 0, clk_base,
9908 +- 0, 48, periph_clk_enb_refcnt);
9909 ++ clk = tegra_clk_register_periph_gate("dsia", "pll_d_dsi_out", 0,
9910 ++ clk_base, 0, 48,
9911 ++ periph_clk_enb_refcnt);
9912 + clks[TEGRA124_CLK_DSIA] = clk;
9913
9914 --static long at91sam9x5_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate,
9915 -- unsigned long *parent_rate)
9916 -+static long at91sam9x5_clk_usb_determine_rate(struct clk_hw *hw,
9917 -+ unsigned long rate,
9918 -+ unsigned long min_rate,
9919 -+ unsigned long max_rate,
9920 -+ unsigned long *best_parent_rate,
9921 -+ struct clk_hw **best_parent_hw)
9922 - {
9923 -- unsigned long div;
9924 -+ struct clk *parent = NULL;
9925 -+ long best_rate = -EINVAL;
9926 -+ unsigned long tmp_rate;
9927 -+ int best_diff = -1;
9928 -+ int tmp_diff;
9929 -+ int i;
9930 +- clk = tegra_clk_register_periph_gate("dsib", "plld_dsi", 0, clk_base,
9931 +- 0, 82, periph_clk_enb_refcnt);
9932 ++ clk = tegra_clk_register_periph_gate("dsib", "pll_d_dsi_out", 0,
9933 ++ clk_base, 0, 82,
9934 ++ periph_clk_enb_refcnt);
9935 + clks[TEGRA124_CLK_DSIB] = clk;
9936
9937 -- if (!rate)
9938 -- return -EINVAL;
9939 -+ for (i = 0; i < __clk_get_num_parents(hw->clk); i++) {
9940 -+ int div;
9941 + /* emc mux */
9942 +diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c
9943 +index 9ddb754..7a1df61 100644
9944 +--- a/drivers/clk/tegra/clk.c
9945 ++++ b/drivers/clk/tegra/clk.c
9946 +@@ -272,7 +272,7 @@ void __init tegra_add_of_provider(struct device_node *np)
9947 + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
9948
9949 -- if (rate >= *parent_rate)
9950 -- return *parent_rate;
9951 -+ parent = clk_get_parent_by_index(hw->clk, i);
9952 -+ if (!parent)
9953 -+ continue;
9954 + rst_ctlr.of_node = np;
9955 +- rst_ctlr.nr_resets = clk_num * 32;
9956 ++ rst_ctlr.nr_resets = periph_banks * 32;
9957 + reset_controller_register(&rst_ctlr);
9958 + }
9959 +
9960 +diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
9961 +index 42f95a4..9a28b7e 100644
9962 +--- a/drivers/crypto/omap-aes.c
9963 ++++ b/drivers/crypto/omap-aes.c
9964 +@@ -554,15 +554,23 @@ static int omap_aes_crypt_dma_stop(struct omap_aes_dev *dd)
9965 + return err;
9966 + }
9967 +
9968 +-static int omap_aes_check_aligned(struct scatterlist *sg)
9969 ++static int omap_aes_check_aligned(struct scatterlist *sg, int total)
9970 + {
9971 ++ int len = 0;
9972 +
9973 -+ for (div = 1; div < SAM9X5_USB_MAX_DIV + 2; div++) {
9974 -+ unsigned long tmp_parent_rate;
9975 + while (sg) {
9976 + if (!IS_ALIGNED(sg->offset, 4))
9977 + return -1;
9978 + if (!IS_ALIGNED(sg->length, AES_BLOCK_SIZE))
9979 + return -1;
9980 +
9981 -+ tmp_parent_rate = rate * div;
9982 -+ tmp_parent_rate = __clk_round_rate(parent,
9983 -+ tmp_parent_rate);
9984 -+ tmp_rate = DIV_ROUND_CLOSEST(tmp_parent_rate, div);
9985 -+ if (tmp_rate < rate)
9986 -+ tmp_diff = rate - tmp_rate;
9987 -+ else
9988 -+ tmp_diff = tmp_rate - rate;
9989 ++ len += sg->length;
9990 + sg = sg_next(sg);
9991 + }
9992 +
9993 -+ if (best_diff < 0 || best_diff > tmp_diff) {
9994 -+ best_rate = tmp_rate;
9995 -+ best_diff = tmp_diff;
9996 -+ *best_parent_rate = tmp_parent_rate;
9997 -+ *best_parent_hw = __clk_get_hw(parent);
9998 -+ }
9999 ++ if (len != total)
10000 ++ return -1;
10001 +
10002 -+ if (!best_diff || tmp_rate < rate)
10003 -+ break;
10004 -+ }
10005 + return 0;
10006 + }
10007
10008 -- div = DIV_ROUND_CLOSEST(*parent_rate, rate);
10009 -- if (div > SAM9X5_USB_MAX_DIV + 1)
10010 -- div = SAM9X5_USB_MAX_DIV + 1;
10011 -+ if (!best_diff)
10012 -+ break;
10013 -+ }
10014 +@@ -633,8 +641,8 @@ static int omap_aes_handle_queue(struct omap_aes_dev *dd,
10015 + dd->in_sg = req->src;
10016 + dd->out_sg = req->dst;
10017
10018 -- return DIV_ROUND_CLOSEST(*parent_rate, div);
10019 -+ return best_rate;
10020 - }
10021 +- if (omap_aes_check_aligned(dd->in_sg) ||
10022 +- omap_aes_check_aligned(dd->out_sg)) {
10023 ++ if (omap_aes_check_aligned(dd->in_sg, dd->total) ||
10024 ++ omap_aes_check_aligned(dd->out_sg, dd->total)) {
10025 + if (omap_aes_copy_sgs(dd))
10026 + pr_err("Failed to copy SGs for unaligned cases\n");
10027 + dd->sgs_copied = 1;
10028 +diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
10029 +index d0bc123..1a54205 100644
10030 +--- a/drivers/gpio/gpio-mvebu.c
10031 ++++ b/drivers/gpio/gpio-mvebu.c
10032 +@@ -320,11 +320,13 @@ static void mvebu_gpio_edge_irq_mask(struct irq_data *d)
10033 + {
10034 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
10035 + struct mvebu_gpio_chip *mvchip = gc->private;
10036 ++ struct irq_chip_type *ct = irq_data_get_chip_type(d);
10037 + u32 mask = 1 << (d->irq - gc->irq_base);
10038
10039 - static int at91sam9x5_clk_usb_set_parent(struct clk_hw *hw, u8 index)
10040 -@@ -121,7 +154,7 @@ static int at91sam9x5_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate,
10041 + irq_gc_lock(gc);
10042 +- gc->mask_cache &= ~mask;
10043 +- writel_relaxed(gc->mask_cache, mvebu_gpioreg_edge_mask(mvchip));
10044 ++ ct->mask_cache_priv &= ~mask;
10045 ++
10046 ++ writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_edge_mask(mvchip));
10047 + irq_gc_unlock(gc);
10048 + }
10049
10050 - static const struct clk_ops at91sam9x5_usb_ops = {
10051 - .recalc_rate = at91sam9x5_clk_usb_recalc_rate,
10052 -- .round_rate = at91sam9x5_clk_usb_round_rate,
10053 -+ .determine_rate = at91sam9x5_clk_usb_determine_rate,
10054 - .get_parent = at91sam9x5_clk_usb_get_parent,
10055 - .set_parent = at91sam9x5_clk_usb_set_parent,
10056 - .set_rate = at91sam9x5_clk_usb_set_rate,
10057 -@@ -159,7 +192,7 @@ static const struct clk_ops at91sam9n12_usb_ops = {
10058 - .disable = at91sam9n12_clk_usb_disable,
10059 - .is_enabled = at91sam9n12_clk_usb_is_enabled,
10060 - .recalc_rate = at91sam9x5_clk_usb_recalc_rate,
10061 -- .round_rate = at91sam9x5_clk_usb_round_rate,
10062 -+ .determine_rate = at91sam9x5_clk_usb_determine_rate,
10063 - .set_rate = at91sam9x5_clk_usb_set_rate,
10064 - };
10065 -
10066 -@@ -179,7 +212,8 @@ at91sam9x5_clk_register_usb(struct at91_pmc *pmc, const char *name,
10067 - init.ops = &at91sam9x5_usb_ops;
10068 - init.parent_names = parent_names;
10069 - init.num_parents = num_parents;
10070 -- init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE;
10071 -+ init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE |
10072 -+ CLK_SET_RATE_PARENT;
10073 +@@ -332,11 +334,13 @@ static void mvebu_gpio_edge_irq_unmask(struct irq_data *d)
10074 + {
10075 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
10076 + struct mvebu_gpio_chip *mvchip = gc->private;
10077 ++ struct irq_chip_type *ct = irq_data_get_chip_type(d);
10078 ++
10079 + u32 mask = 1 << (d->irq - gc->irq_base);
10080
10081 - usb->hw.init = &init;
10082 - usb->pmc = pmc;
10083 -@@ -207,7 +241,7 @@ at91sam9n12_clk_register_usb(struct at91_pmc *pmc, const char *name,
10084 - init.ops = &at91sam9n12_usb_ops;
10085 - init.parent_names = &parent_name;
10086 - init.num_parents = 1;
10087 -- init.flags = CLK_SET_RATE_GATE;
10088 -+ init.flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT;
10089 + irq_gc_lock(gc);
10090 +- gc->mask_cache |= mask;
10091 +- writel_relaxed(gc->mask_cache, mvebu_gpioreg_edge_mask(mvchip));
10092 ++ ct->mask_cache_priv |= mask;
10093 ++ writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_edge_mask(mvchip));
10094 + irq_gc_unlock(gc);
10095 + }
10096
10097 - usb->hw.init = &init;
10098 - usb->pmc = pmc;
10099 ---
10100 -2.3.6
10101 -
10102 -
10103 -From ffa5893889612e5d65e456c0b433d0160d46c4eb Mon Sep 17 00:00:00 2001
10104 -From: Yves-Alexis Perez <corsac@××××××.org>
10105 -Date: Sat, 11 Apr 2015 09:31:35 +0200
10106 -Subject: [PATCH 089/219] ALSA: hda - Add dock support for ThinkPad X250
10107 - (17aa:2226)
10108 -Cc: mpagano@g.o
10109 -
10110 -commit c0278669fb61596cc1a10ab8686d27c37269c37b upstream.
10111 -
10112 -This model uses the same dock port as the previous generation.
10113 -
10114 -Signed-off-by: Yves-Alexis Perez <corsac@××××××.org>
10115 -Signed-off-by: Takashi Iwai <tiwai@××××.de>
10116 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
10117 -Signed-off-by: Mike Pagano <mpagano@g.o>
10118 ----
10119 - sound/pci/hda/patch_realtek.c | 1 +
10120 - 1 file changed, 1 insertion(+)
10121 -
10122 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
10123 -index f9d12c0..3ad85c7 100644
10124 ---- a/sound/pci/hda/patch_realtek.c
10125 -+++ b/sound/pci/hda/patch_realtek.c
10126 -@@ -5047,6 +5047,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
10127 - SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
10128 - SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
10129 - SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10130 -+ SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
10131 - SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
10132 - SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
10133 - SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10134 ---
10135 -2.3.6
10136 -
10137 -
10138 -From 0b586ed327f10ed037bf84381cbdb16754d7bdfd Mon Sep 17 00:00:00 2001
10139 -From: Adam Honse <calcprogrammer1@×××××.com>
10140 -Date: Sun, 12 Apr 2015 01:03:07 -0500
10141 -Subject: [PATCH 090/219] ALSA: usb-audio: Don't attempt to get Microsoft
10142 - Lifecam Cinema sample rate
10143 -Cc: mpagano@g.o
10144 -
10145 -commit eef0342cf32689f77d78ee3302999e5caaa6a8f3 upstream.
10146 -
10147 -Adds Microsoft LifeCam Cinema USB ID to the snd_usb_get_sample_rate_quirk list as the Lifecam Cinema does not appear to support getting the sample rate.
10148 -
10149 -Fixes the issue where the LifeCam Cinema would wait for USB timeout and log the message "cannot get freq at ep 0x82" when accessed.
10150 -
10151 -Addresses bug report https://bugzilla.kernel.org/show_bug.cgi?id=95961.
10152 -
10153 -Signed-off-by: Adam Honse <calcprogrammer1@×××××.com>
10154 -Signed-off-by: Takashi Iwai <tiwai@××××.de>
10155 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
10156 -Signed-off-by: Mike Pagano <mpagano@g.o>
10157 ----
10158 - sound/usb/quirks.c | 1 +
10159 - 1 file changed, 1 insertion(+)
10160 -
10161 -diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
10162 -index 9a28365..32631a8 100644
10163 ---- a/sound/usb/quirks.c
10164 -+++ b/sound/usb/quirks.c
10165 -@@ -1115,6 +1115,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)
10166 +@@ -344,11 +348,13 @@ static void mvebu_gpio_level_irq_mask(struct irq_data *d)
10167 {
10168 - /* devices which do not support reading the sample rate. */
10169 - switch (chip->usb_id) {
10170 -+ case USB_ID(0x045E, 0x075D): /* MS Lifecam Cinema */
10171 - case USB_ID(0x045E, 0x076D): /* MS Lifecam HD-5000 */
10172 - case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */
10173 - return true;
10174 ---
10175 -2.3.6
10176 -
10177 -
10178 -From 15c97265c67f27eef7d92262964a43e0aff8df61 Mon Sep 17 00:00:00 2001
10179 -From: Michael Gernoth <michael@×××××××.net>
10180 -Date: Thu, 9 Apr 2015 23:42:15 +0200
10181 -Subject: [PATCH 091/219] ALSA: emu10k1: don't deadlock in proc-functions
10182 -Cc: mpagano@g.o
10183 -
10184 -commit 91bf0c2dcb935a87e5c0795f5047456b965fd143 upstream.
10185 -
10186 -The functions snd_emu10k1_proc_spdif_read and snd_emu1010_fpga_read
10187 -acquire the emu_lock before accessing the FPGA. The function used
10188 -to access the FPGA (snd_emu1010_fpga_read) also tries to take
10189 -the emu_lock which causes a deadlock.
10190 -Remove the outer locking in the proc-functions (guarding only the
10191 -already safe fpga read) to prevent this deadlock.
10192 -
10193 -[removed superfluous flags variables too -- tiwai]
10194 -
10195 -Signed-off-by: Michael Gernoth <michael@×××××××.net>
10196 -Signed-off-by: Takashi Iwai <tiwai@××××.de>
10197 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
10198 -Signed-off-by: Mike Pagano <mpagano@g.o>
10199 ----
10200 - sound/pci/emu10k1/emuproc.c | 12 ------------
10201 - 1 file changed, 12 deletions(-)
10202 -
10203 -diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c
10204 -index 2ca9f2e..53745f4 100644
10205 ---- a/sound/pci/emu10k1/emuproc.c
10206 -+++ b/sound/pci/emu10k1/emuproc.c
10207 -@@ -241,31 +241,22 @@ static void snd_emu10k1_proc_spdif_read(struct snd_info_entry *entry,
10208 - struct snd_emu10k1 *emu = entry->private_data;
10209 - u32 value;
10210 - u32 value2;
10211 -- unsigned long flags;
10212 - u32 rate;
10213 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
10214 + struct mvebu_gpio_chip *mvchip = gc->private;
10215 ++ struct irq_chip_type *ct = irq_data_get_chip_type(d);
10216 ++
10217 + u32 mask = 1 << (d->irq - gc->irq_base);
10218
10219 - if (emu->card_capabilities->emu_model) {
10220 -- spin_lock_irqsave(&emu->emu_lock, flags);
10221 - snd_emu1010_fpga_read(emu, 0x38, &value);
10222 -- spin_unlock_irqrestore(&emu->emu_lock, flags);
10223 - if ((value & 0x1) == 0) {
10224 -- spin_lock_irqsave(&emu->emu_lock, flags);
10225 - snd_emu1010_fpga_read(emu, 0x2a, &value);
10226 - snd_emu1010_fpga_read(emu, 0x2b, &value2);
10227 -- spin_unlock_irqrestore(&emu->emu_lock, flags);
10228 - rate = 0x1770000 / (((value << 5) | value2)+1);
10229 - snd_iprintf(buffer, "ADAT Locked : %u\n", rate);
10230 - } else {
10231 - snd_iprintf(buffer, "ADAT Unlocked\n");
10232 - }
10233 -- spin_lock_irqsave(&emu->emu_lock, flags);
10234 - snd_emu1010_fpga_read(emu, 0x20, &value);
10235 -- spin_unlock_irqrestore(&emu->emu_lock, flags);
10236 - if ((value & 0x4) == 0) {
10237 -- spin_lock_irqsave(&emu->emu_lock, flags);
10238 - snd_emu1010_fpga_read(emu, 0x28, &value);
10239 - snd_emu1010_fpga_read(emu, 0x29, &value2);
10240 -- spin_unlock_irqrestore(&emu->emu_lock, flags);
10241 - rate = 0x1770000 / (((value << 5) | value2)+1);
10242 - snd_iprintf(buffer, "SPDIF Locked : %d\n", rate);
10243 - } else {
10244 -@@ -410,14 +401,11 @@ static void snd_emu_proc_emu1010_reg_read(struct snd_info_entry *entry,
10245 + irq_gc_lock(gc);
10246 +- gc->mask_cache &= ~mask;
10247 +- writel_relaxed(gc->mask_cache, mvebu_gpioreg_level_mask(mvchip));
10248 ++ ct->mask_cache_priv &= ~mask;
10249 ++ writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_level_mask(mvchip));
10250 + irq_gc_unlock(gc);
10251 + }
10252 +
10253 +@@ -356,11 +362,13 @@ static void mvebu_gpio_level_irq_unmask(struct irq_data *d)
10254 {
10255 - struct snd_emu10k1 *emu = entry->private_data;
10256 - u32 value;
10257 -- unsigned long flags;
10258 - int i;
10259 - snd_iprintf(buffer, "EMU1010 Registers:\n\n");
10260 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
10261 + struct mvebu_gpio_chip *mvchip = gc->private;
10262 ++ struct irq_chip_type *ct = irq_data_get_chip_type(d);
10263 ++
10264 + u32 mask = 1 << (d->irq - gc->irq_base);
10265
10266 - for(i = 0; i < 0x40; i+=1) {
10267 -- spin_lock_irqsave(&emu->emu_lock, flags);
10268 - snd_emu1010_fpga_read(emu, i, &value);
10269 -- spin_unlock_irqrestore(&emu->emu_lock, flags);
10270 - snd_iprintf(buffer, "%02X: %08X, %02X\n", i, value, (value >> 8) & 0x7f);
10271 - }
10272 + irq_gc_lock(gc);
10273 +- gc->mask_cache |= mask;
10274 +- writel_relaxed(gc->mask_cache, mvebu_gpioreg_level_mask(mvchip));
10275 ++ ct->mask_cache_priv |= mask;
10276 ++ writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_level_mask(mvchip));
10277 + irq_gc_unlock(gc);
10278 }
10279 ---
10280 -2.3.6
10281 -
10282 -
10283 -From 0933e9dd839f4d37d408d9365266940928a73a8c Mon Sep 17 00:00:00 2001
10284 -From: Jo-Philipp Wich <jow@×××××××.org>
10285 -Date: Mon, 13 Apr 2015 12:47:26 +0200
10286 -Subject: [PATCH 092/219] ALSA: hda/realtek - Enable the ALC292 dock fixup on
10287 - the Thinkpad T450
10288 -Cc: mpagano@g.o
10289 -
10290 -commit f2aa111041ce36b94e651d882458dea502e76721 upstream.
10291 -
10292 -The Lenovo Thinkpad T450 requires the ALC292_FIXUP_TPT440_DOCK as well in
10293 -order to get working sound output on the docking stations headphone jack.
10294 -
10295 -Patch tested on a Thinkpad T450 (20BVCTO1WW) using kernel 4.0-rc7 in
10296 -conjunction with a ThinkPad Ultradock.
10297 -
10298 -Signed-off-by: Jo-Philipp Wich <jow@×××××××.org>
10299 -Signed-off-by: Takashi Iwai <tiwai@××××.de>
10300 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
10301 -Signed-off-by: Mike Pagano <mpagano@g.o>
10302 ----
10303 - sound/pci/hda/patch_realtek.c | 1 +
10304 - 1 file changed, 1 insertion(+)
10305 -
10306 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
10307 -index 3ad85c7..f37e4ea 100644
10308 ---- a/sound/pci/hda/patch_realtek.c
10309 -+++ b/sound/pci/hda/patch_realtek.c
10310 -@@ -5054,6 +5054,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
10311 - SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
10312 - SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
10313 - SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10314 -+ SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
10315 - SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
10316 - SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10317 - SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
10318 ---
10319 -2.3.6
10320 -
10321 -
10322 -From cb927a0ae496171966921e084eb7f6c2dc04e43b Mon Sep 17 00:00:00 2001
10323 -From: David Henningsson <david.henningsson@×××××××××.com>
10324 -Date: Tue, 21 Apr 2015 10:48:46 +0200
10325 -Subject: [PATCH 093/219] ALSA: hda - fix "num_steps = 0" error on ALC256
10326 -Cc: mpagano@g.o
10327 -
10328 -commit 7d1b6e29327428993ba568bdd8c66734070f45e0 upstream.
10329 -
10330 -The ALC256 does not have a mixer nid at 0x0b, and there's no
10331 -loopback path (the output pins are directly connected to the DACs).
10332 -
10333 -This commit fixes an "num_steps = 0 for NID=0xb (ctl = Beep Playback Volume)"
10334 -error (and as a result, problems with amixer/alsamixer).
10335 -
10336 -If there's pcbeep functionality, it certainly isn't controlled by setting an
10337 -amp on 0x0b, so disable beep functionality (at least for now).
10338 -
10339 -BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1446517
10340 -Signed-off-by: David Henningsson <david.henningsson@×××××××××.com>
10341 -Signed-off-by: Takashi Iwai <tiwai@××××.de>
10342 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
10343 -Signed-off-by: Mike Pagano <mpagano@g.o>
10344 ----
10345 - sound/pci/hda/patch_realtek.c | 5 +++--
10346 - 1 file changed, 3 insertions(+), 2 deletions(-)
10347 -
10348 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
10349 -index f37e4ea..b46bb84 100644
10350 ---- a/sound/pci/hda/patch_realtek.c
10351 -+++ b/sound/pci/hda/patch_realtek.c
10352 -@@ -5565,6 +5565,7 @@ static int patch_alc269(struct hda_codec *codec)
10353 - break;
10354 - case 0x10ec0256:
10355 - spec->codec_variant = ALC269_TYPE_ALC256;
10356 -+ spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
10357 - break;
10358 - }
10359
10360 -@@ -5578,8 +5579,8 @@ static int patch_alc269(struct hda_codec *codec)
10361 - if (err < 0)
10362 - goto error;
10363 +diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
10364 +index bf17a60..1dbfba5 100644
10365 +--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
10366 ++++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
10367 +@@ -32,10 +32,16 @@
10368 + #include <drm/bridge/ptn3460.h>
10369
10370 -- if (!spec->gen.no_analog && spec->gen.beep_nid)
10371 -- set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
10372 -+ if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid)
10373 -+ set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
10374 + #include "exynos_dp_core.h"
10375 ++#include "exynos_drm_fimd.h"
10376
10377 - codec->patch_ops = alc_patch_ops;
10378 - #ifdef CONFIG_PM
10379 ---
10380 -2.3.6
10381 -
10382 -
10383 -From c7a98726965179726bbd105e5ff6465c1d09ace1 Mon Sep 17 00:00:00 2001
10384 -From: Kailang Yang <kailang@×××××××.com>
10385 -Date: Thu, 23 Apr 2015 15:10:53 +0800
10386 -Subject: [PATCH 094/219] ALSA: hda/realtek - Fix Headphone Mic doesn't
10387 - recording for ALC256
10388 -Cc: mpagano@g.o
10389 -
10390 -commit d32b66668c702aed0e330dc5ca186afbadcdacf8 upstream.
10391 -
10392 -Switch default pcbeep path to Line in path.
10393 -
10394 -Signed-off-by: Kailang Yang <kailang@×××××××.com>
10395 -Tested-by: Hui Wang <hui.wang@×××××××××.com>
10396 -Signed-off-by: Takashi Iwai <tiwai@××××.de>
10397 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
10398 -Signed-off-by: Mike Pagano <mpagano@g.o>
10399 ----
10400 - sound/pci/hda/patch_realtek.c | 1 +
10401 - 1 file changed, 1 insertion(+)
10402 -
10403 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
10404 -index b46bb84..2210e1b 100644
10405 ---- a/sound/pci/hda/patch_realtek.c
10406 -+++ b/sound/pci/hda/patch_realtek.c
10407 -@@ -5566,6 +5566,7 @@ static int patch_alc269(struct hda_codec *codec)
10408 - case 0x10ec0256:
10409 - spec->codec_variant = ALC269_TYPE_ALC256;
10410 - spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
10411 -+ alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
10412 - break;
10413 - }
10414 + #define ctx_from_connector(c) container_of(c, struct exynos_dp_device, \
10415 + connector)
10416
10417 ---
10418 -2.3.6
10419 -
10420 -
10421 -From ca7d80c841febeb3688d5ed57660d37b4baedad5 Mon Sep 17 00:00:00 2001
10422 -From: Hui Wang <hui.wang@×××××××××.com>
10423 -Date: Fri, 24 Apr 2015 13:39:59 +0800
10424 -Subject: [PATCH 095/219] ALSA: hda - fix headset mic detection problem for one
10425 - more machine
10426 -Cc: mpagano@g.o
10427 -
10428 -commit e8191a8e475551b277d85cd76c3f0f52fdf42e86 upstream.
10429 -
10430 -We have two machines with alc256 codec in the pin quirk table, so
10431 -moving the common pins to ALC256_STANDARD_PINS.
10432 -
10433 -BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1447909
10434 -Signed-off-by: Hui Wang <hui.wang@×××××××××.com>
10435 -Signed-off-by: Takashi Iwai <tiwai@××××.de>
10436 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
10437 -Signed-off-by: Mike Pagano <mpagano@g.o>
10438 ----
10439 - sound/pci/hda/patch_realtek.c | 24 +++++++++++++++---------
10440 - 1 file changed, 15 insertions(+), 9 deletions(-)
10441 -
10442 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
10443 -index 2210e1b..2fd490b 100644
10444 ---- a/sound/pci/hda/patch_realtek.c
10445 -+++ b/sound/pci/hda/patch_realtek.c
10446 -@@ -5144,6 +5144,16 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
10447 - {0x1b, 0x411111f0}, \
10448 - {0x1e, 0x411111f0}
10449 ++static inline struct exynos_drm_crtc *dp_to_crtc(struct exynos_dp_device *dp)
10450 ++{
10451 ++ return to_exynos_crtc(dp->encoder->crtc);
10452 ++}
10453 ++
10454 + static inline struct exynos_dp_device *
10455 + display_to_dp(struct exynos_drm_display *d)
10456 + {
10457 +@@ -1070,6 +1076,8 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp)
10458 + }
10459 + }
10460
10461 -+#define ALC256_STANDARD_PINS \
10462 -+ {0x12, 0x90a60140}, \
10463 -+ {0x14, 0x90170110}, \
10464 -+ {0x19, 0x411111f0}, \
10465 -+ {0x1a, 0x411111f0}, \
10466 -+ {0x1b, 0x411111f0}, \
10467 -+ {0x1d, 0x40700001}, \
10468 -+ {0x1e, 0x411111f0}, \
10469 -+ {0x21, 0x02211020}
10470 ++ fimd_dp_clock_enable(dp_to_crtc(dp), true);
10471 +
10472 - #define ALC282_STANDARD_PINS \
10473 - {0x14, 0x90170110}, \
10474 - {0x18, 0x411111f0}, \
10475 -@@ -5237,15 +5247,11 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
10476 - {0x1d, 0x40700001},
10477 - {0x21, 0x02211050}),
10478 - SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10479 -- {0x12, 0x90a60140},
10480 -- {0x13, 0x40000000},
10481 -- {0x14, 0x90170110},
10482 -- {0x19, 0x411111f0},
10483 -- {0x1a, 0x411111f0},
10484 -- {0x1b, 0x411111f0},
10485 -- {0x1d, 0x40700001},
10486 -- {0x1e, 0x411111f0},
10487 -- {0x21, 0x02211020}),
10488 -+ ALC256_STANDARD_PINS,
10489 -+ {0x13, 0x40000000}),
10490 -+ SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10491 -+ ALC256_STANDARD_PINS,
10492 -+ {0x13, 0x411111f0}),
10493 - SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
10494 - {0x12, 0x90a60130},
10495 - {0x13, 0x40000000},
10496 ---
10497 -2.3.6
10498 -
10499 -
10500 -From 53c20b74579ec9bb7b45b2208fce79df09e8bdfb Mon Sep 17 00:00:00 2001
10501 -From: Ulrik De Bie <ulrik.debie-os@×××××.org>
10502 -Date: Mon, 6 Apr 2015 15:35:38 -0700
10503 -Subject: [PATCH 096/219] Input: elantech - fix absolute mode setting on some
10504 - ASUS laptops
10505 -Cc: mpagano@g.o
10506 -
10507 -commit bd884149aca61de269fd9bad83fe2a4232ffab21 upstream.
10508 -
10509 -On ASUS TP500LN and X750JN, the touchpad absolute mode is reset each
10510 -time set_rate is done.
10511 -
10512 -In order to fix this, we will verify the firmware version, and if it
10513 -matches the one in those laptops, the set_rate function is overloaded
10514 -with a function elantech_set_rate_restore_reg_07 that performs the
10515 -set_rate with the original function, followed by a restore of reg_07
10516 -(the register that sets the absolute mode on elantech v4 hardware).
10517 -
10518 -Also the ASUS TP500LN and X750JN firmware version, capabilities, and
10519 -button constellation is added to elantech.c
10520 -
10521 -Reported-and-tested-by: George Moutsopoulos <gmoutso@××××××××.uk>
10522 -Signed-off-by: Ulrik De Bie <ulrik.debie-os@×××××.org>
10523 -Signed-off-by: Dmitry Torokhov <dmitry.torokhov@×××××.com>
10524 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
10525 -Signed-off-by: Mike Pagano <mpagano@g.o>
10526 ----
10527 - drivers/input/mouse/elantech.c | 22 ++++++++++++++++++++++
10528 - drivers/input/mouse/elantech.h | 1 +
10529 - 2 files changed, 23 insertions(+)
10530 -
10531 -diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
10532 -index 6e22682..991dc6b 100644
10533 ---- a/drivers/input/mouse/elantech.c
10534 -+++ b/drivers/input/mouse/elantech.c
10535 -@@ -893,6 +893,21 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse)
10536 - }
10537 + clk_prepare_enable(dp->clock);
10538 + exynos_dp_phy_init(dp);
10539 + exynos_dp_init_dp(dp);
10540 +@@ -1094,6 +1102,8 @@ static void exynos_dp_poweroff(struct exynos_dp_device *dp)
10541 + exynos_dp_phy_exit(dp);
10542 + clk_disable_unprepare(dp->clock);
10543
10544 - /*
10545 -+ * This writes the reg_07 value again to the hardware at the end of every
10546 -+ * set_rate call because the register loses its value. reg_07 allows setting
10547 -+ * absolute mode on v4 hardware
10548 -+ */
10549 -+static void elantech_set_rate_restore_reg_07(struct psmouse *psmouse,
10550 -+ unsigned int rate)
10551 -+{
10552 -+ struct elantech_data *etd = psmouse->private;
10553 ++ fimd_dp_clock_enable(dp_to_crtc(dp), false);
10554 +
10555 -+ etd->original_set_rate(psmouse, rate);
10556 -+ if (elantech_write_reg(psmouse, 0x07, etd->reg_07))
10557 -+ psmouse_err(psmouse, "restoring reg_07 failed\n");
10558 + if (dp->panel) {
10559 + if (drm_panel_unprepare(dp->panel))
10560 + DRM_ERROR("failed to turnoff the panel\n");
10561 +diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
10562 +index 33a10ce..5d58f6c 100644
10563 +--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
10564 ++++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
10565 +@@ -32,6 +32,7 @@
10566 + #include "exynos_drm_fbdev.h"
10567 + #include "exynos_drm_crtc.h"
10568 + #include "exynos_drm_iommu.h"
10569 ++#include "exynos_drm_fimd.h"
10570 +
10571 + /*
10572 + * FIMD stands for Fully Interactive Mobile Display and
10573 +@@ -1233,6 +1234,24 @@ static int fimd_remove(struct platform_device *pdev)
10574 + return 0;
10575 + }
10576 +
10577 ++void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable)
10578 ++{
10579 ++ struct fimd_context *ctx = crtc->ctx;
10580 ++ u32 val;
10581 ++
10582 ++ /*
10583 ++ * Only Exynos 5250, 5260, 5410 and 542x requires enabling DP/MIE
10584 ++ * clock. On these SoCs the bootloader may enable it but any
10585 ++ * power domain off/on will reset it to disable state.
10586 ++ */
10587 ++ if (ctx->driver_data != &exynos5_fimd_driver_data)
10588 ++ return;
10589 ++
10590 ++ val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE;
10591 ++ writel(DP_MIE_CLK_DP_ENABLE, ctx->regs + DP_MIE_CLKCON);
10592 +}
10593 ++EXPORT_SYMBOL_GPL(fimd_dp_clock_enable);
10594 +
10595 + struct platform_driver fimd_driver = {
10596 + .probe = fimd_probe,
10597 + .remove = fimd_remove,
10598 +diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.h b/drivers/gpu/drm/exynos/exynos_drm_fimd.h
10599 +new file mode 100644
10600 +index 0000000..b4fcaa5
10601 +--- /dev/null
10602 ++++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.h
10603 +@@ -0,0 +1,15 @@
10604 +/*
10605 - * Put the touchpad into absolute mode
10606 - */
10607 - static int elantech_set_absolute_mode(struct psmouse *psmouse)
10608 -@@ -1094,6 +1109,8 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse,
10609 - * Asus K53SV 0x450f01 78, 15, 0c 2 hw buttons
10610 - * Asus G46VW 0x460f02 00, 18, 0c 2 hw buttons
10611 - * Asus G750JX 0x360f00 00, 16, 0c 2 hw buttons
10612 -+ * Asus TP500LN 0x381f17 10, 14, 0e clickpad
10613 -+ * Asus X750JN 0x381f17 10, 14, 0e clickpad
10614 - * Asus UX31 0x361f00 20, 15, 0e clickpad
10615 - * Asus UX32VD 0x361f02 00, 15, 0e clickpad
10616 - * Avatar AVIU-145A2 0x361f00 ? clickpad
10617 -@@ -1635,6 +1652,11 @@ int elantech_init(struct psmouse *psmouse)
10618 - goto init_fail;
10619 - }
10620 -
10621 -+ if (etd->fw_version == 0x381f17) {
10622 -+ etd->original_set_rate = psmouse->set_rate;
10623 -+ psmouse->set_rate = elantech_set_rate_restore_reg_07;
10624 -+ }
10625 ++ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
10626 ++ *
10627 ++ * This program is free software; you can redistribute it and/or modify it
10628 ++ * under the terms of the GNU General Public License as published by the
10629 ++ * Free Software Foundation; either version 2 of the License, or (at your
10630 ++ * option) any later version.
10631 ++ */
10632 +
10633 - if (elantech_set_input_params(psmouse)) {
10634 - psmouse_err(psmouse, "failed to query touchpad range.\n");
10635 - goto init_fail;
10636 -diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
10637 -index 6f3afec..f965d15 100644
10638 ---- a/drivers/input/mouse/elantech.h
10639 -+++ b/drivers/input/mouse/elantech.h
10640 -@@ -142,6 +142,7 @@ struct elantech_data {
10641 - struct finger_pos mt[ETP_MAX_FINGERS];
10642 - unsigned char parity[256];
10643 - int (*send_cmd)(struct psmouse *psmouse, unsigned char c, unsigned char *param);
10644 -+ void (*original_set_rate)(struct psmouse *psmouse, unsigned int rate);
10645 - };
10646 ++#ifndef _EXYNOS_DRM_FIMD_H_
10647 ++#define _EXYNOS_DRM_FIMD_H_
10648 ++
10649 ++extern void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable);
10650 ++
10651 ++#endif /* _EXYNOS_DRM_FIMD_H_ */
10652 +diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c
10653 +index fa140e0..60ab1f7 100644
10654 +--- a/drivers/gpu/drm/i2c/adv7511.c
10655 ++++ b/drivers/gpu/drm/i2c/adv7511.c
10656 +@@ -33,6 +33,7 @@ struct adv7511 {
10657
10658 - #ifdef CONFIG_MOUSE_PS2_ELANTECH
10659 ---
10660 -2.3.6
10661 -
10662 -
10663 -From 93ab611572eae4cb426cf006c70a7c7216603cfe Mon Sep 17 00:00:00 2001
10664 -From: Hans de Goede <hdegoede@××××××.com>
10665 -Date: Wed, 8 Apr 2015 09:26:42 -0700
10666 -Subject: [PATCH 097/219] Input: alps - fix touchpad buttons getting stuck when
10667 - used with trackpoint
10668 -MIME-Version: 1.0
10669 -Content-Type: text/plain; charset=UTF-8
10670 -Content-Transfer-Encoding: 8bit
10671 -Cc: mpagano@g.o
10672 -
10673 -commit 6bcca19f5dcedc3a006ca0bcc3699a437cadee74 upstream.
10674 -
10675 -When the left touchpad button gets pressed, and then the trackpoint is
10676 -moved, and then the button is released, the following happens:
10677 -
10678 -1) touchpad packet is received, touchpad evdev node reports BTN_LEFT 1
10679 -
10680 -2) pointing stick packet is received, the hw will report a BTN_LEFT 1 in
10681 - this packet because when the trackstick is active it communicates the
10682 - combined touchpad + pointing stick buttons in the trackstick packet,
10683 - since alps_report_bare_ps2_packet passes NULL (*) for the dev2 parameter
10684 - to alps_report_buttons the combining is not detected and the
10685 - pointing stick evdev node will also report BTN_LEFT 1
10686 -
10687 -3) on release of the button a pointing stick packet with BTN_LEFT 0 is
10688 - received and the pointing stick evdev node will report BTN_LEFT 0
10689 -
10690 -Note how because of the passing as NULL for dev2 the touchpad evdev node
10691 -will never send BTN_LEFT 0 in this scenario leading to a stuck mouse button.
10692 -
10693 -This is a regression in 4.0 introduced by commit 04aae283ba6a8
10694 -("Input: ALPS - do not mix trackstick and external PS/2 mouse data")
10695 -
10696 -This commit fixes this by passing in the touchpad evdev as dev2 parameter
10697 -when calling alps_report_buttons for the pointingstick on alps v2 devices,
10698 -so that alps_report_buttons correctly detect that we're already reporting
10699 -the button as pressed via the touchpad evdev node, and will also send the
10700 -release event there.
10701 -
10702 -Reported-by: Hans de Bruin <jmdebruin@××××××.nl>
10703 -Signed-off-by: Hans de Goede <hdegoede@××××××.com>
10704 -Acked-by: Pali Rohár <pali.rohar@×××××.com>
10705 -Signed-off-by: Dmitry Torokhov <dmitry.torokhov@×××××.com>
10706 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
10707 -Signed-off-by: Mike Pagano <mpagano@g.o>
10708 ----
10709 - drivers/input/mouse/alps.c | 5 +++--
10710 - 1 file changed, 3 insertions(+), 2 deletions(-)
10711 -
10712 -diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
10713 -index 27bcdbc..ea6cb64 100644
10714 ---- a/drivers/input/mouse/alps.c
10715 -+++ b/drivers/input/mouse/alps.c
10716 -@@ -1159,13 +1159,14 @@ static void alps_report_bare_ps2_packet(struct psmouse *psmouse,
10717 - bool report_buttons)
10718 - {
10719 - struct alps_data *priv = psmouse->private;
10720 -- struct input_dev *dev;
10721 -+ struct input_dev *dev, *dev2 = NULL;
10722 + unsigned int current_edid_segment;
10723 + uint8_t edid_buf[256];
10724 ++ bool edid_read;
10725
10726 - /* Figure out which device to use to report the bare packet */
10727 - if (priv->proto_version == ALPS_PROTO_V2 &&
10728 - (priv->flags & ALPS_DUALPOINT)) {
10729 - /* On V2 devices the DualPoint Stick reports bare packets */
10730 - dev = priv->dev2;
10731 -+ dev2 = psmouse->dev;
10732 - } else if (unlikely(IS_ERR_OR_NULL(priv->dev3))) {
10733 - /* Register dev3 mouse if we received PS/2 packet first time */
10734 - if (!IS_ERR(priv->dev3))
10735 -@@ -1177,7 +1178,7 @@ static void alps_report_bare_ps2_packet(struct psmouse *psmouse,
10736 - }
10737 + wait_queue_head_t wq;
10738 + struct drm_encoder *encoder;
10739 +@@ -379,69 +380,71 @@ static bool adv7511_hpd(struct adv7511 *adv7511)
10740 + return false;
10741 + }
10742
10743 - if (report_buttons)
10744 -- alps_report_buttons(dev, NULL,
10745 -+ alps_report_buttons(dev, dev2,
10746 - packet[0] & 1, packet[0] & 2, packet[0] & 4);
10747 +-static irqreturn_t adv7511_irq_handler(int irq, void *devid)
10748 +-{
10749 +- struct adv7511 *adv7511 = devid;
10750 +-
10751 +- if (adv7511_hpd(adv7511))
10752 +- drm_helper_hpd_irq_event(adv7511->encoder->dev);
10753 +-
10754 +- wake_up_all(&adv7511->wq);
10755 +-
10756 +- return IRQ_HANDLED;
10757 +-}
10758 +-
10759 +-static unsigned int adv7511_is_interrupt_pending(struct adv7511 *adv7511,
10760 +- unsigned int irq)
10761 ++static int adv7511_irq_process(struct adv7511 *adv7511)
10762 + {
10763 + unsigned int irq0, irq1;
10764 +- unsigned int pending;
10765 + int ret;
10766
10767 - input_report_rel(dev, REL_X,
10768 ---
10769 -2.3.6
10770 -
10771 -
10772 -From 9a7fcd609f2e3eaf2d661ee26ab7601e450cd7a2 Mon Sep 17 00:00:00 2001
10773 -From: Johan Hovold <johan@××××××.org>
10774 -Date: Wed, 25 Mar 2015 12:07:05 +0100
10775 -Subject: [PATCH 098/219] mfd: core: Fix platform-device name collisions
10776 -Cc: mpagano@g.o
10777 -
10778 -commit a77c50b44cfb663ad03faba9800fec19bdf83577 upstream.
10779 -
10780 -Since commit 6e3f62f0793e ("mfd: core: Fix platform-device id
10781 -generation") we honour PLATFORM_DEVID_AUTO and PLATFORM_DEVID_NONE when
10782 -registering mfd-devices.
10783 -
10784 -Unfortunately, some mfd-drivers rely on the old behaviour of generating
10785 -platform-device ids by adding the cell id also to the special value of
10786 -PLATFORM_DEVID_NONE. The resulting platform ids are not only used to
10787 -generate device-unique names, but are also used instead of the cell id
10788 -to identify cells when probing subdevices.
10789 -
10790 -These drivers should be updated to use PLATFORM_DEVID_AUTO, which would
10791 -also allow more than one device to be registered without resorting to
10792 -hacks (see for example wm831x), but lets fix the regression first by
10793 -partially reverting the above mentioned commit with respect to
10794 -PLATFORM_DEVID_NONE.
10795 -
10796 -Fixes: 6e3f62f0793e ("mfd: core: Fix platform-device id generation")
10797 -Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@×××××××.com>
10798 -Signed-off-by: Johan Hovold <johan@××××××.org>
10799 -Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@×××××××.com>
10800 -Signed-off-by: Lee Jones <lee.jones@××××××.org>
10801 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
10802 -Signed-off-by: Mike Pagano <mpagano@g.o>
10803 ----
10804 - drivers/mfd/mfd-core.c | 2 +-
10805 - 1 file changed, 1 insertion(+), 1 deletion(-)
10806 -
10807 -diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
10808 -index 2a87f69..1aed3b7 100644
10809 ---- a/drivers/mfd/mfd-core.c
10810 -+++ b/drivers/mfd/mfd-core.c
10811 -@@ -128,7 +128,7 @@ static int mfd_add_device(struct device *parent, int id,
10812 - int platform_id;
10813 - int r;
10814 + ret = regmap_read(adv7511->regmap, ADV7511_REG_INT(0), &irq0);
10815 + if (ret < 0)
10816 +- return 0;
10817 ++ return ret;
10818 ++
10819 + ret = regmap_read(adv7511->regmap, ADV7511_REG_INT(1), &irq1);
10820 + if (ret < 0)
10821 +- return 0;
10822 ++ return ret;
10823 ++
10824 ++ regmap_write(adv7511->regmap, ADV7511_REG_INT(0), irq0);
10825 ++ regmap_write(adv7511->regmap, ADV7511_REG_INT(1), irq1);
10826 ++
10827 ++ if (irq0 & ADV7511_INT0_HDP)
10828 ++ drm_helper_hpd_irq_event(adv7511->encoder->dev);
10829 ++
10830 ++ if (irq0 & ADV7511_INT0_EDID_READY || irq1 & ADV7511_INT1_DDC_ERROR) {
10831 ++ adv7511->edid_read = true;
10832 ++
10833 ++ if (adv7511->i2c_main->irq)
10834 ++ wake_up_all(&adv7511->wq);
10835 ++ }
10836 ++
10837 ++ return 0;
10838 ++}
10839
10840 -- if (id < 0)
10841 -+ if (id == PLATFORM_DEVID_AUTO)
10842 - platform_id = id;
10843 - else
10844 - platform_id = id + cell->id;
10845 ---
10846 -2.3.6
10847 -
10848 -
10849 -From 671ea8186b4d894fef503c13745152d9827d7a1b Mon Sep 17 00:00:00 2001
10850 -From: Michael Davidson <md@××××××.com>
10851 -Date: Tue, 14 Apr 2015 15:47:38 -0700
10852 -Subject: [PATCH 099/219] fs/binfmt_elf.c: fix bug in loading of PIE binaries
10853 -Cc: mpagano@g.o
10854 -
10855 -commit a87938b2e246b81b4fb713edb371a9fa3c5c3c86 upstream.
10856 -
10857 -With CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE enabled, and a normal top-down
10858 -address allocation strategy, load_elf_binary() will attempt to map a PIE
10859 -binary into an address range immediately below mm->mmap_base.
10860 -
10861 -Unfortunately, load_elf_ binary() does not take account of the need to
10862 -allocate sufficient space for the entire binary which means that, while
10863 -the first PT_LOAD segment is mapped below mm->mmap_base, the subsequent
10864 -PT_LOAD segment(s) end up being mapped above mm->mmap_base into the are
10865 -that is supposed to be the "gap" between the stack and the binary.
10866 -
10867 -Since the size of the "gap" on x86_64 is only guaranteed to be 128MB this
10868 -means that binaries with large data segments > 128MB can end up mapping
10869 -part of their data segment over their stack resulting in corruption of the
10870 -stack (and the data segment once the binary starts to run).
10871 -
10872 -Any PIE binary with a data segment > 128MB is vulnerable to this although
10873 -address randomization means that the actual gap between the stack and the
10874 -end of the binary is normally greater than 128MB. The larger the data
10875 -segment of the binary the higher the probability of failure.
10876 -
10877 -Fix this by calculating the total size of the binary in the same way as
10878 -load_elf_interp().
10879 -
10880 -Signed-off-by: Michael Davidson <md@××××××.com>
10881 -Cc: Alexander Viro <viro@×××××××××××××××.uk>
10882 -Cc: Jiri Kosina <jkosina@××××.cz>
10883 -Cc: Kees Cook <keescook@××××××××.org>
10884 -Signed-off-by: Andrew Morton <akpm@××××××××××××××××.org>
10885 -Signed-off-by: Linus Torvalds <torvalds@××××××××××××××××.org>
10886 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
10887 -Signed-off-by: Mike Pagano <mpagano@g.o>
10888 ----
10889 - fs/binfmt_elf.c | 9 ++++++++-
10890 - 1 file changed, 8 insertions(+), 1 deletion(-)
10891 -
10892 -diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
10893 -index 995986b..d925f55 100644
10894 ---- a/fs/binfmt_elf.c
10895 -+++ b/fs/binfmt_elf.c
10896 -@@ -862,6 +862,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
10897 - i < loc->elf_ex.e_phnum; i++, elf_ppnt++) {
10898 - int elf_prot = 0, elf_flags;
10899 - unsigned long k, vaddr;
10900 -+ unsigned long total_size = 0;
10901 +- pending = (irq1 << 8) | irq0;
10902 ++static irqreturn_t adv7511_irq_handler(int irq, void *devid)
10903 ++{
10904 ++ struct adv7511 *adv7511 = devid;
10905 ++ int ret;
10906
10907 - if (elf_ppnt->p_type != PT_LOAD)
10908 - continue;
10909 -@@ -924,10 +925,16 @@ static int load_elf_binary(struct linux_binprm *bprm)
10910 - #else
10911 - load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr);
10912 - #endif
10913 -+ total_size = total_mapping_size(elf_phdata,
10914 -+ loc->elf_ex.e_phnum);
10915 -+ if (!total_size) {
10916 -+ error = -EINVAL;
10917 -+ goto out_free_dentry;
10918 -+ }
10919 - }
10920 +- return pending & irq;
10921 ++ ret = adv7511_irq_process(adv7511);
10922 ++ return ret < 0 ? IRQ_NONE : IRQ_HANDLED;
10923 + }
10924
10925 - error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt,
10926 -- elf_prot, elf_flags, 0);
10927 -+ elf_prot, elf_flags, total_size);
10928 - if (BAD_ADDR(error)) {
10929 - retval = IS_ERR((void *)error) ?
10930 - PTR_ERR((void*)error) : -EINVAL;
10931 ---
10932 -2.3.6
10933 -
10934 -
10935 -From 12ea13bf83f15c5cf59b4039295f98b0d7a83881 Mon Sep 17 00:00:00 2001
10936 -From: Oleg Nesterov <oleg@××××××.com>
10937 -Date: Thu, 16 Apr 2015 12:47:29 -0700
10938 -Subject: [PATCH 100/219] ptrace: fix race between ptrace_resume() and
10939 - wait_task_stopped()
10940 -Cc: mpagano@g.o
10941 -
10942 -commit b72c186999e689cb0b055ab1c7b3cd8fffbeb5ed upstream.
10943 -
10944 -ptrace_resume() is called when the tracee is still __TASK_TRACED. We set
10945 -tracee->exit_code and then wake_up_state() changes tracee->state. If the
10946 -tracer's sub-thread does wait() in between, task_stopped_code(ptrace => T)
10947 -wrongly looks like another report from tracee.
10948 -
10949 -This confuses debugger, and since wait_task_stopped() clears ->exit_code
10950 -the tracee can miss a signal.
10951 -
10952 -Test-case:
10953 -
10954 - #include <stdio.h>
10955 - #include <unistd.h>
10956 - #include <sys/wait.h>
10957 - #include <sys/ptrace.h>
10958 - #include <pthread.h>
10959 - #include <assert.h>
10960 -
10961 - int pid;
10962 -
10963 - void *waiter(void *arg)
10964 - {
10965 - int stat;
10966 -
10967 - for (;;) {
10968 - assert(pid == wait(&stat));
10969 - assert(WIFSTOPPED(stat));
10970 - if (WSTOPSIG(stat) == SIGHUP)
10971 - continue;
10972 -
10973 - assert(WSTOPSIG(stat) == SIGCONT);
10974 - printf("ERR! extra/wrong report:%x\n", stat);
10975 - }
10976 - }
10977 -
10978 - int main(void)
10979 - {
10980 - pthread_t thread;
10981 -
10982 - pid = fork();
10983 - if (!pid) {
10984 - assert(ptrace(PTRACE_TRACEME, 0,0,0) == 0);
10985 - for (;;)
10986 - kill(getpid(), SIGHUP);
10987 - }
10988 -
10989 - assert(pthread_create(&thread, NULL, waiter, NULL) == 0);
10990 -
10991 - for (;;)
10992 - ptrace(PTRACE_CONT, pid, 0, SIGCONT);
10993 -
10994 - return 0;
10995 - }
10996 -
10997 -Note for stable: the bug is very old, but without 9899d11f6544 "ptrace:
10998 -ensure arch_ptrace/ptrace_request can never race with SIGKILL" the fix
10999 -should use lock_task_sighand(child).
11000 -
11001 -Signed-off-by: Oleg Nesterov <oleg@××××××.com>
11002 -Reported-by: Pavel Labath <labath@××××××.com>
11003 -Tested-by: Pavel Labath <labath@××××××.com>
11004 -Signed-off-by: Andrew Morton <akpm@××××××××××××××××.org>
11005 -Signed-off-by: Linus Torvalds <torvalds@××××××××××××××××.org>
11006 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
11007 -Signed-off-by: Mike Pagano <mpagano@g.o>
11008 ----
11009 - kernel/ptrace.c | 20 ++++++++++++++++++++
11010 - 1 file changed, 20 insertions(+)
11011 -
11012 -diff --git a/kernel/ptrace.c b/kernel/ptrace.c
11013 -index 227fec3..9a34bd8 100644
11014 ---- a/kernel/ptrace.c
11015 -+++ b/kernel/ptrace.c
11016 -@@ -697,6 +697,8 @@ static int ptrace_peek_siginfo(struct task_struct *child,
11017 - static int ptrace_resume(struct task_struct *child, long request,
11018 - unsigned long data)
11019 - {
11020 -+ bool need_siglock;
11021 +-static int adv7511_wait_for_interrupt(struct adv7511 *adv7511, int irq,
11022 +- int timeout)
11023 ++/* -----------------------------------------------------------------------------
11024 ++ * EDID retrieval
11025 ++ */
11026 +
11027 - if (!valid_signal(data))
11028 - return -EIO;
11029 -
11030 -@@ -724,8 +726,26 @@ static int ptrace_resume(struct task_struct *child, long request,
11031 - user_disable_single_step(child);
11032 - }
11033 ++static int adv7511_wait_for_edid(struct adv7511 *adv7511, int timeout)
11034 + {
11035 +- unsigned int pending;
11036 + int ret;
11037
11038 -+ /*
11039 -+ * Change ->exit_code and ->state under siglock to avoid the race
11040 -+ * with wait_task_stopped() in between; a non-zero ->exit_code will
11041 -+ * wrongly look like another report from tracee.
11042 -+ *
11043 -+ * Note that we need siglock even if ->exit_code == data and/or this
11044 -+ * status was not reported yet, the new status must not be cleared by
11045 -+ * wait_task_stopped() after resume.
11046 -+ *
11047 -+ * If data == 0 we do not care if wait_task_stopped() reports the old
11048 -+ * status and clears the code too; this can't race with the tracee, it
11049 -+ * takes siglock after resume.
11050 -+ */
11051 -+ need_siglock = data && !thread_group_empty(current);
11052 -+ if (need_siglock)
11053 -+ spin_lock_irq(&child->sighand->siglock);
11054 - child->exit_code = data;
11055 - wake_up_state(child, __TASK_TRACED);
11056 -+ if (need_siglock)
11057 -+ spin_unlock_irq(&child->sighand->siglock);
11058 + if (adv7511->i2c_main->irq) {
11059 + ret = wait_event_interruptible_timeout(adv7511->wq,
11060 +- adv7511_is_interrupt_pending(adv7511, irq),
11061 +- msecs_to_jiffies(timeout));
11062 +- if (ret <= 0)
11063 +- return 0;
11064 +- pending = adv7511_is_interrupt_pending(adv7511, irq);
11065 ++ adv7511->edid_read, msecs_to_jiffies(timeout));
11066 + } else {
11067 +- if (timeout < 25)
11068 +- timeout = 25;
11069 +- do {
11070 +- pending = adv7511_is_interrupt_pending(adv7511, irq);
11071 +- if (pending)
11072 ++ for (; timeout > 0; timeout -= 25) {
11073 ++ ret = adv7511_irq_process(adv7511);
11074 ++ if (ret < 0)
11075 + break;
11076 ++
11077 ++ if (adv7511->edid_read)
11078 ++ break;
11079 ++
11080 + msleep(25);
11081 +- timeout -= 25;
11082 +- } while (timeout >= 25);
11083 ++ }
11084 + }
11085
11086 - return 0;
11087 +- return pending;
11088 ++ return adv7511->edid_read ? 0 : -EIO;
11089 }
11090 ---
11091 -2.3.6
11092 -
11093 -
11094 -From 64b22d90114136c3f66fef541c844bc2deb539c5 Mon Sep 17 00:00:00 2001
11095 -From: Len Brown <len.brown@×××××.com>
11096 -Date: Tue, 24 Mar 2015 23:23:20 -0400
11097 -Subject: [PATCH 101/219] intel_idle: Update support for Silvermont Core in
11098 - Baytrail SOC
11099 -Cc: mpagano@g.o
11100 -
11101 -commit d7ef76717322c8e2df7d4360b33faa9466cb1a0d upstream.
11102 -
11103 -On some Silvermont-Core/Baytrail-SOC systems,
11104 -C1E latency is higher than original specifications.
11105 -Although C1E is still enumerated in CPUID.MWAIT.EDX,
11106 -we delete the state from intel_idle to avoid latency impact.
11107 -
11108 -Under some conditions, the latency of the C6N-BYT and C6S-BYT states
11109 -may exceed the specified values of 40 and 140 usec, respectively.
11110 -Increase those values to 300 and 500 usec; to assure
11111 -that the hardware does not violate constraints that may be set
11112 -by the Linux PM_QOS sub-system.
11113 -
11114 -Also increase the C7-BYT target residency to 4.0 ms from 1.5 ms.
11115 -
11116 -Signed-off-by: Len Brown <len.brown@×××××.com>
11117 -Cc: Kumar P Mahesh <mahesh.kumar.p@×××××.com>
11118 -Cc: Alan Cox <alan@×××××××××××.com>
11119 -Cc: Mika Westerberg <mika.westerberg@×××××××××××.com>
11120 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
11121 -Signed-off-by: Mike Pagano <mpagano@g.o>
11122 ----
11123 - drivers/idle/intel_idle.c | 14 +++-----------
11124 - 1 file changed, 3 insertions(+), 11 deletions(-)
11125 -
11126 -diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
11127 -index b0e5852..44d1d79 100644
11128 ---- a/drivers/idle/intel_idle.c
11129 -+++ b/drivers/idle/intel_idle.c
11130 -@@ -218,18 +218,10 @@ static struct cpuidle_state byt_cstates[] = {
11131 - .enter = &intel_idle,
11132 - .enter_freeze = intel_idle_freeze, },
11133 - {
11134 -- .name = "C1E-BYT",
11135 -- .desc = "MWAIT 0x01",
11136 -- .flags = MWAIT2flg(0x01),
11137 -- .exit_latency = 15,
11138 -- .target_residency = 30,
11139 -- .enter = &intel_idle,
11140 -- .enter_freeze = intel_idle_freeze, },
11141 -- {
11142 - .name = "C6N-BYT",
11143 - .desc = "MWAIT 0x58",
11144 - .flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TLB_FLUSHED,
11145 -- .exit_latency = 40,
11146 -+ .exit_latency = 300,
11147 - .target_residency = 275,
11148 - .enter = &intel_idle,
11149 - .enter_freeze = intel_idle_freeze, },
11150 -@@ -237,7 +229,7 @@ static struct cpuidle_state byt_cstates[] = {
11151 - .name = "C6S-BYT",
11152 - .desc = "MWAIT 0x52",
11153 - .flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED,
11154 -- .exit_latency = 140,
11155 -+ .exit_latency = 500,
11156 - .target_residency = 560,
11157 - .enter = &intel_idle,
11158 - .enter_freeze = intel_idle_freeze, },
11159 -@@ -246,7 +238,7 @@ static struct cpuidle_state byt_cstates[] = {
11160 - .desc = "MWAIT 0x60",
11161 - .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
11162 - .exit_latency = 1200,
11163 -- .target_residency = 1500,
11164 -+ .target_residency = 4000,
11165 - .enter = &intel_idle,
11166 - .enter_freeze = intel_idle_freeze, },
11167 - {
11168 ---
11169 -2.3.6
11170 -
11171 -
11172 -From 6181a6b2238de82fed39b0568645ea6a1ff2c6fd Mon Sep 17 00:00:00 2001
11173 -From: Nicolas Ferre <nicolas.ferre@×××××.com>
11174 -Date: Tue, 31 Mar 2015 15:02:05 +0200
11175 -Subject: [PATCH 102/219] net/macb: fix the peripheral version test
11176 -Cc: mpagano@g.o
11177 -
11178 -commit 361918970b7426bba97a64678ef2b2679c37199b upstream.
11179 -
11180 -We currently need two checks of the peripheral version in MACB_MID register.
11181 -One of them got out of sync after modification by 8a013a9c71b2 (net: macb:
11182 -Include multi queue support for xilinx ZynqMP ethernet version).
11183 -Fix this in macb_configure_caps() so that xilinx ZynqMP will be considered
11184 -as a GEM flavor.
11185 -
11186 -Fixes: 8a013a9c71b2 ("net: macb: Include multi queue support for xilinx ZynqMP
11187 -ethernet version")
11188 -
11189 -Signed-off-by: Nicolas Ferre <nicolas.ferre@×××××.com>
11190 -Cc: Michal Simek <michal.simek@××××××.com>
11191 -Cc: Punnaiah Choudary Kalluri <punnaia@××××××.com>
11192 -Signed-off-by: David S. Miller <davem@×××××××××.net>
11193 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
11194 -Signed-off-by: Mike Pagano <mpagano@g.o>
11195 ----
11196 - drivers/net/ethernet/cadence/macb.c | 2 +-
11197 - 1 file changed, 1 insertion(+), 1 deletion(-)
11198 -
11199 -diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
11200 -index 81d4153..77bf133 100644
11201 ---- a/drivers/net/ethernet/cadence/macb.c
11202 -+++ b/drivers/net/ethernet/cadence/macb.c
11203 -@@ -2165,7 +2165,7 @@ static void macb_configure_caps(struct macb *bp)
11204 - }
11205 - }
11206
11207 -- if (MACB_BFEXT(IDNUM, macb_readl(bp, MID)) == 0x2)
11208 -+ if (MACB_BFEXT(IDNUM, macb_readl(bp, MID)) >= 0x2)
11209 - bp->caps |= MACB_CAPS_MACB_IS_GEM;
11210 +-/* -----------------------------------------------------------------------------
11211 +- * EDID retrieval
11212 +- */
11213 +-
11214 + static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block,
11215 + size_t len)
11216 + {
11217 +@@ -463,19 +466,14 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block,
11218 + return ret;
11219
11220 - if (macb_is_gem(bp)) {
11221 ---
11222 -2.3.6
11223 -
11224 -
11225 -From 95df5a6b8698921ca30cd55853446016a2acb891 Mon Sep 17 00:00:00 2001
11226 -From: Christophe Ricard <christophe.ricard@×××××.com>
11227 -Date: Tue, 31 Mar 2015 08:02:15 +0200
11228 -Subject: [PATCH 103/219] NFC: st21nfcb: Retry i2c_master_send if it returns a
11229 - negative value
11230 -Cc: mpagano@g.o
11231 -
11232 -commit d4a41d10b2cb5890aeda6b2912973b2a754b05b1 upstream.
11233 -
11234 -i2c_master_send may return many negative values different than
11235 --EREMOTEIO.
11236 -In case an i2c transaction is NACK'ed, on raspberry pi B+
11237 -kernel 3.18, -EIO is generated instead.
11238 -
11239 -Signed-off-by: Christophe Ricard <christophe-h.ricard@××.com>
11240 -Signed-off-by: Samuel Ortiz <sameo@×××××××××××.com>
11241 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
11242 -Signed-off-by: Mike Pagano <mpagano@g.o>
11243 ----
11244 - drivers/nfc/st21nfcb/i2c.c | 4 ++--
11245 - 1 file changed, 2 insertions(+), 2 deletions(-)
11246 -
11247 -diff --git a/drivers/nfc/st21nfcb/i2c.c b/drivers/nfc/st21nfcb/i2c.c
11248 -index eb88693..7b53a5c 100644
11249 ---- a/drivers/nfc/st21nfcb/i2c.c
11250 -+++ b/drivers/nfc/st21nfcb/i2c.c
11251 -@@ -109,7 +109,7 @@ static int st21nfcb_nci_i2c_write(void *phy_id, struct sk_buff *skb)
11252 - return phy->ndlc->hard_fault;
11253 + if (status != 2) {
11254 ++ adv7511->edid_read = false;
11255 + regmap_write(adv7511->regmap, ADV7511_REG_EDID_SEGMENT,
11256 + block);
11257 +- ret = adv7511_wait_for_interrupt(adv7511,
11258 +- ADV7511_INT0_EDID_READY |
11259 +- ADV7511_INT1_DDC_ERROR, 200);
11260 +-
11261 +- if (!(ret & ADV7511_INT0_EDID_READY))
11262 +- return -EIO;
11263 ++ ret = adv7511_wait_for_edid(adv7511, 200);
11264 ++ if (ret < 0)
11265 ++ return ret;
11266 + }
11267
11268 - r = i2c_master_send(client, skb->data, skb->len);
11269 -- if (r == -EREMOTEIO) { /* Retry, chip was in standby */
11270 -+ if (r < 0) { /* Retry, chip was in standby */
11271 - usleep_range(1000, 4000);
11272 - r = i2c_master_send(client, skb->data, skb->len);
11273 - }
11274 -@@ -148,7 +148,7 @@ static int st21nfcb_nci_i2c_read(struct st21nfcb_i2c_phy *phy,
11275 - struct i2c_client *client = phy->i2c_dev;
11276 +- regmap_write(adv7511->regmap, ADV7511_REG_INT(0),
11277 +- ADV7511_INT0_EDID_READY | ADV7511_INT1_DDC_ERROR);
11278 +-
11279 + /* Break this apart, hopefully more I2C controllers will
11280 + * support 64 byte transfers than 256 byte transfers
11281 + */
11282 +@@ -528,7 +526,9 @@ static int adv7511_get_modes(struct drm_encoder *encoder,
11283 + /* Reading the EDID only works if the device is powered */
11284 + if (adv7511->dpms_mode != DRM_MODE_DPMS_ON) {
11285 + regmap_write(adv7511->regmap, ADV7511_REG_INT(0),
11286 +- ADV7511_INT0_EDID_READY | ADV7511_INT1_DDC_ERROR);
11287 ++ ADV7511_INT0_EDID_READY);
11288 ++ regmap_write(adv7511->regmap, ADV7511_REG_INT(1),
11289 ++ ADV7511_INT1_DDC_ERROR);
11290 + regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER,
11291 + ADV7511_POWER_POWER_DOWN, 0);
11292 + adv7511->current_edid_segment = -1;
11293 +@@ -563,7 +563,9 @@ static void adv7511_encoder_dpms(struct drm_encoder *encoder, int mode)
11294 + adv7511->current_edid_segment = -1;
11295
11296 - r = i2c_master_recv(client, buf, ST21NFCB_NCI_I2C_MIN_SIZE);
11297 -- if (r == -EREMOTEIO) { /* Retry, chip was in standby */
11298 -+ if (r < 0) { /* Retry, chip was in standby */
11299 - usleep_range(1000, 4000);
11300 - r = i2c_master_recv(client, buf, ST21NFCB_NCI_I2C_MIN_SIZE);
11301 - }
11302 ---
11303 -2.3.6
11304 -
11305 -
11306 -From 9e2d43e521a469a50ef03b55cef24e7d260bbdbb Mon Sep 17 00:00:00 2001
11307 -From: Larry Finger <Larry.Finger@××××××××.net>
11308 -Date: Mon, 23 Mar 2015 18:14:10 -0500
11309 -Subject: [PATCH 104/219] rtlwifi: rtl8192cu: Add new USB ID
11310 -Cc: mpagano@g.o
11311 -
11312 -commit 2f92b314f4daff2117847ac5343c54d3d041bf78 upstream.
11313 -
11314 -USB ID 2001:330d is used for a D-Link DWA-131.
11315 -
11316 -Signed-off-by: Larry Finger <Larry.Finger@××××××××.net>
11317 -Signed-off-by: Kalle Valo <kvalo@××××××××××.org>
11318 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
11319 -Signed-off-by: Mike Pagano <mpagano@g.o>
11320 ----
11321 - drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 +
11322 - 1 file changed, 1 insertion(+)
11323 -
11324 -diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
11325 -index 90a714c..6fde250 100644
11326 ---- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
11327 -+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
11328 -@@ -377,6 +377,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
11329 - {RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/
11330 - {RTL_USB_DEVICE(0x2001, 0x3309, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/
11331 - {RTL_USB_DEVICE(0x2001, 0x330a, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/
11332 -+ {RTL_USB_DEVICE(0x2001, 0x330d, rtl92cu_hal_cfg)}, /*D-Link DWA-131 */
11333 - {RTL_USB_DEVICE(0x2019, 0xab2b, rtl92cu_hal_cfg)}, /*Planex -Abocom*/
11334 - {RTL_USB_DEVICE(0x20f4, 0x624d, rtl92cu_hal_cfg)}, /*TRENDNet*/
11335 - {RTL_USB_DEVICE(0x2357, 0x0100, rtl92cu_hal_cfg)}, /*TP-Link WN8200ND*/
11336 ---
11337 -2.3.6
11338 -
11339 -
11340 -From a9fe1b9caf0ea4ccada73ce243b23fd6a7e896d3 Mon Sep 17 00:00:00 2001
11341 -From: Marek Vasut <marex@××××.de>
11342 -Date: Thu, 26 Mar 2015 02:16:06 +0100
11343 -Subject: [PATCH 105/219] rtlwifi: rtl8192cu: Add new device ID
11344 -Cc: mpagano@g.o
11345 -
11346 -commit 9374e7d2fdcad3c36dafc8d3effd554bc702c4b6 upstream.
11347 -
11348 -Add new ID for ASUS N10 WiFi dongle.
11349 -
11350 -Signed-off-by: Marek Vasut <marex@××××.de>
11351 -Tested-by: Marek Vasut <marex@××××.de>
11352 -Cc: Larry Finger <Larry.Finger@××××××××.net>
11353 -Cc: John W. Linville <linville@×××××××××.com>
11354 -Acked-by: Larry Finger <Larry.Finger@××××××××.net>
11355 -Signed-off-by: Kalle Valo <kvalo@××××××××××.org>
11356 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
11357 -Signed-off-by: Mike Pagano <mpagano@g.o>
11358 ----
11359 - drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 +
11360 - 1 file changed, 1 insertion(+)
11361 -
11362 -diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
11363 -index 6fde250..23806c2 100644
11364 ---- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
11365 -+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
11366 -@@ -321,6 +321,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
11367 - {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
11368 - {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
11369 - {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/
11370 -+ {RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
11371 - {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/
11372 - {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
11373 - {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
11374 ---
11375 -2.3.6
11376 -
11377 -
11378 -From 3536e283ea6797daac8054aebea238cafe9a464c Mon Sep 17 00:00:00 2001
11379 -From: Lukas Czerner <lczerner@××××××.com>
11380 -Date: Fri, 3 Apr 2015 10:46:58 -0400
11381 -Subject: [PATCH 106/219] ext4: make fsync to sync parent dir in no-journal for
11382 - real this time
11383 -Cc: mpagano@g.o
11384 -
11385 -commit e12fb97222fc41e8442896934f76d39ef99b590a upstream.
11386 -
11387 -Previously commit 14ece1028b3ed53ffec1b1213ffc6acaf79ad77c added a
11388 -support for for syncing parent directory of newly created inodes to
11389 -make sure that the inode is not lost after a power failure in
11390 -no-journal mode.
11391 -
11392 -However this does not work in majority of cases, namely:
11393 - - if the directory has inline data
11394 - - if the directory is already indexed
11395 - - if the directory already has at least one block and:
11396 - - the new entry fits into it
11397 - - or we've successfully converted it to indexed
11398 -
11399 -So in those cases we might lose the inode entirely even after fsync in
11400 -the no-journal mode. This also includes ext2 default mode obviously.
11401 -
11402 -I've noticed this while running xfstest generic/321 and even though the
11403 -test should fail (we need to run fsck after a crash in no-journal mode)
11404 -I could not find a newly created entries even when if it was fsynced
11405 -before.
11406 -
11407 -Fix this by adjusting the ext4_add_entry() successful exit paths to set
11408 -the inode EXT4_STATE_NEWENTRY so that fsync has the chance to fsync the
11409 -parent directory as well.
11410 -
11411 -Signed-off-by: Lukas Czerner <lczerner@××××××.com>
11412 -Signed-off-by: Theodore Ts'o <tytso@×××.edu>
11413 -Reviewed-by: Jan Kara <jack@××××.cz>
11414 -Cc: Frank Mayhar <fmayhar@××××××.com>
11415 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
11416 -Signed-off-by: Mike Pagano <mpagano@g.o>
11417 ----
11418 - fs/ext4/namei.c | 20 +++++++++++---------
11419 - 1 file changed, 11 insertions(+), 9 deletions(-)
11420 -
11421 -diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
11422 -index 28fe71a..aae7011 100644
11423 ---- a/fs/ext4/namei.c
11424 -+++ b/fs/ext4/namei.c
11425 -@@ -1865,7 +1865,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
11426 - struct inode *inode)
11427 - {
11428 - struct inode *dir = dentry->d_parent->d_inode;
11429 -- struct buffer_head *bh;
11430 -+ struct buffer_head *bh = NULL;
11431 - struct ext4_dir_entry_2 *de;
11432 - struct ext4_dir_entry_tail *t;
11433 - struct super_block *sb;
11434 -@@ -1889,14 +1889,14 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
11435 - return retval;
11436 - if (retval == 1) {
11437 - retval = 0;
11438 -- return retval;
11439 -+ goto out;
11440 - }
11441 - }
11442 + regmap_write(adv7511->regmap, ADV7511_REG_INT(0),
11443 +- ADV7511_INT0_EDID_READY | ADV7511_INT1_DDC_ERROR);
11444 ++ ADV7511_INT0_EDID_READY);
11445 ++ regmap_write(adv7511->regmap, ADV7511_REG_INT(1),
11446 ++ ADV7511_INT1_DDC_ERROR);
11447 + regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER,
11448 + ADV7511_POWER_POWER_DOWN, 0);
11449 + /*
11450 +diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
11451 +index 5c66b56..ec4d932 100644
11452 +--- a/drivers/gpu/drm/i915/i915_drv.c
11453 ++++ b/drivers/gpu/drm/i915/i915_drv.c
11454 +@@ -1042,7 +1042,7 @@ static void vlv_save_gunit_s0ix_state(struct drm_i915_private *dev_priv)
11455 + s->lra_limits[i] = I915_READ(GEN7_LRA_LIMITS_BASE + i * 4);
11456
11457 - if (is_dx(dir)) {
11458 - retval = ext4_dx_add_entry(handle, dentry, inode);
11459 - if (!retval || (retval != ERR_BAD_DX_DIR))
11460 -- return retval;
11461 -+ goto out;
11462 - ext4_clear_inode_flag(dir, EXT4_INODE_INDEX);
11463 - dx_fallback++;
11464 - ext4_mark_inode_dirty(handle, dir);
11465 -@@ -1908,14 +1908,15 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
11466 - return PTR_ERR(bh);
11467 + s->media_max_req_count = I915_READ(GEN7_MEDIA_MAX_REQ_COUNT);
11468 +- s->gfx_max_req_count = I915_READ(GEN7_MEDIA_MAX_REQ_COUNT);
11469 ++ s->gfx_max_req_count = I915_READ(GEN7_GFX_MAX_REQ_COUNT);
11470
11471 - retval = add_dirent_to_buf(handle, dentry, inode, NULL, bh);
11472 -- if (retval != -ENOSPC) {
11473 -- brelse(bh);
11474 -- return retval;
11475 -- }
11476 -+ if (retval != -ENOSPC)
11477 -+ goto out;
11478 + s->render_hwsp = I915_READ(RENDER_HWS_PGA_GEN7);
11479 + s->ecochk = I915_READ(GAM_ECOCHK);
11480 +@@ -1124,7 +1124,7 @@ static void vlv_restore_gunit_s0ix_state(struct drm_i915_private *dev_priv)
11481 + I915_WRITE(GEN7_LRA_LIMITS_BASE + i * 4, s->lra_limits[i]);
11482
11483 - if (blocks == 1 && !dx_fallback &&
11484 -- EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX))
11485 -- return make_indexed_dir(handle, dentry, inode, bh);
11486 -+ EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX)) {
11487 -+ retval = make_indexed_dir(handle, dentry, inode, bh);
11488 -+ bh = NULL; /* make_indexed_dir releases bh */
11489 -+ goto out;
11490 -+ }
11491 - brelse(bh);
11492 - }
11493 - bh = ext4_append(handle, dir, &block);
11494 -@@ -1931,6 +1932,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
11495 - }
11496 + I915_WRITE(GEN7_MEDIA_MAX_REQ_COUNT, s->media_max_req_count);
11497 +- I915_WRITE(GEN7_MEDIA_MAX_REQ_COUNT, s->gfx_max_req_count);
11498 ++ I915_WRITE(GEN7_GFX_MAX_REQ_COUNT, s->gfx_max_req_count);
11499
11500 - retval = add_dirent_to_buf(handle, dentry, inode, de, bh);
11501 -+out:
11502 - brelse(bh);
11503 - if (retval == 0)
11504 - ext4_set_inode_state(inode, EXT4_STATE_NEWENTRY);
11505 ---
11506 -2.3.6
11507 -
11508 -
11509 -From 1527fbabfa4fdb32f66b47dd48518572fb4e0eaa Mon Sep 17 00:00:00 2001
11510 -From: "Eric W. Biederman" <ebiederm@××××××××.com>
11511 -Date: Wed, 24 Dec 2014 07:20:01 -0600
11512 -Subject: [PATCH 107/219] mnt: Improve the umount_tree flags
11513 -Cc: mpagano@g.o
11514 -
11515 -commit e819f152104c9f7c9fe50e1aecce6f5d4bf06d65 upstream.
11516 -
11517 -- Remove the unneeded declaration from pnode.h
11518 -- Mark umount_tree static as it has no callers outside of namespace.c
11519 -- Define an enumeration of umount_tree's flags.
11520 -- Pass umount_tree's flags in by name
11521 -
11522 -This removes the magic numbers 0, 1 and 2 making the code a little
11523 -clearer and makes it possible for there to be lazy unmounts that don't
11524 -propagate. Which is what __detach_mounts actually wants for example.
11525 -
11526 -Signed-off-by: "Eric W. Biederman" <ebiederm@××××××××.com>
11527 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
11528 -Signed-off-by: Mike Pagano <mpagano@g.o>
11529 ----
11530 - fs/namespace.c | 31 ++++++++++++++++---------------
11531 - fs/pnode.h | 1 -
11532 - 2 files changed, 16 insertions(+), 16 deletions(-)
11533 -
11534 -diff --git a/fs/namespace.c b/fs/namespace.c
11535 -index 82ef140..712b3c5 100644
11536 ---- a/fs/namespace.c
11537 -+++ b/fs/namespace.c
11538 -@@ -1319,14 +1319,15 @@ static inline void namespace_lock(void)
11539 - down_write(&namespace_sem);
11540 - }
11541 -
11542 -+enum umount_tree_flags {
11543 -+ UMOUNT_SYNC = 1,
11544 -+ UMOUNT_PROPAGATE = 2,
11545 -+};
11546 - /*
11547 - * mount_lock must be held
11548 - * namespace_sem must be held for write
11549 -- * how = 0 => just this tree, don't propagate
11550 -- * how = 1 => propagate; we know that nobody else has reference to any victims
11551 -- * how = 2 => lazy umount
11552 - */
11553 --void umount_tree(struct mount *mnt, int how)
11554 -+static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
11555 - {
11556 - HLIST_HEAD(tmp_list);
11557 - struct mount *p;
11558 -@@ -1339,7 +1340,7 @@ void umount_tree(struct mount *mnt, int how)
11559 - hlist_for_each_entry(p, &tmp_list, mnt_hash)
11560 - list_del_init(&p->mnt_child);
11561 + I915_WRITE(RENDER_HWS_PGA_GEN7, s->render_hwsp);
11562 + I915_WRITE(GAM_ECOCHK, s->ecochk);
11563 +diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
11564 +index ede5bbb..07320cb 100644
11565 +--- a/drivers/gpu/drm/i915/i915_irq.c
11566 ++++ b/drivers/gpu/drm/i915/i915_irq.c
11567 +@@ -3718,14 +3718,12 @@ static int i8xx_irq_postinstall(struct drm_device *dev)
11568 + ~(I915_DISPLAY_PIPE_A_EVENT_INTERRUPT |
11569 + I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |
11570 + I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT |
11571 +- I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT |
11572 +- I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT);
11573 ++ I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT);
11574 + I915_WRITE16(IMR, dev_priv->irq_mask);
11575
11576 -- if (how)
11577 -+ if (how & UMOUNT_PROPAGATE)
11578 - propagate_umount(&tmp_list);
11579 + I915_WRITE16(IER,
11580 + I915_DISPLAY_PIPE_A_EVENT_INTERRUPT |
11581 + I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |
11582 +- I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT |
11583 + I915_USER_INTERRUPT);
11584 + POSTING_READ16(IER);
11585
11586 - while (!hlist_empty(&tmp_list)) {
11587 -@@ -1349,7 +1350,7 @@ void umount_tree(struct mount *mnt, int how)
11588 - list_del_init(&p->mnt_list);
11589 - __touch_mnt_namespace(p->mnt_ns);
11590 - p->mnt_ns = NULL;
11591 -- if (how < 2)
11592 -+ if (how & UMOUNT_SYNC)
11593 - p->mnt.mnt_flags |= MNT_SYNC_UMOUNT;
11594 +@@ -3887,14 +3885,12 @@ static int i915_irq_postinstall(struct drm_device *dev)
11595 + I915_DISPLAY_PIPE_A_EVENT_INTERRUPT |
11596 + I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |
11597 + I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT |
11598 +- I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT |
11599 +- I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT);
11600 ++ I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT);
11601
11602 - pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt, &unmounted);
11603 -@@ -1447,14 +1448,14 @@ static int do_umount(struct mount *mnt, int flags)
11604 + enable_mask =
11605 + I915_ASLE_INTERRUPT |
11606 + I915_DISPLAY_PIPE_A_EVENT_INTERRUPT |
11607 + I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |
11608 +- I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT |
11609 + I915_USER_INTERRUPT;
11610
11611 - if (flags & MNT_DETACH) {
11612 - if (!list_empty(&mnt->mnt_list))
11613 -- umount_tree(mnt, 2);
11614 -+ umount_tree(mnt, UMOUNT_PROPAGATE);
11615 - retval = 0;
11616 - } else {
11617 - shrink_submounts(mnt);
11618 - retval = -EBUSY;
11619 - if (!propagate_mount_busy(mnt, 2)) {
11620 - if (!list_empty(&mnt->mnt_list))
11621 -- umount_tree(mnt, 1);
11622 -+ umount_tree(mnt, UMOUNT_PROPAGATE|UMOUNT_SYNC);
11623 - retval = 0;
11624 - }
11625 - }
11626 -@@ -1486,7 +1487,7 @@ void __detach_mounts(struct dentry *dentry)
11627 - lock_mount_hash();
11628 - while (!hlist_empty(&mp->m_list)) {
11629 - mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list);
11630 -- umount_tree(mnt, 2);
11631 -+ umount_tree(mnt, UMOUNT_PROPAGATE);
11632 - }
11633 - unlock_mount_hash();
11634 - put_mountpoint(mp);
11635 -@@ -1648,7 +1649,7 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
11636 - out:
11637 - if (res) {
11638 - lock_mount_hash();
11639 -- umount_tree(res, 0);
11640 -+ umount_tree(res, UMOUNT_SYNC);
11641 - unlock_mount_hash();
11642 - }
11643 - return q;
11644 -@@ -1672,7 +1673,7 @@ void drop_collected_mounts(struct vfsmount *mnt)
11645 - {
11646 - namespace_lock();
11647 - lock_mount_hash();
11648 -- umount_tree(real_mount(mnt), 0);
11649 -+ umount_tree(real_mount(mnt), UMOUNT_SYNC);
11650 - unlock_mount_hash();
11651 - namespace_unlock();
11652 - }
11653 -@@ -1855,7 +1856,7 @@ static int attach_recursive_mnt(struct mount *source_mnt,
11654 - out_cleanup_ids:
11655 - while (!hlist_empty(&tree_list)) {
11656 - child = hlist_entry(tree_list.first, struct mount, mnt_hash);
11657 -- umount_tree(child, 0);
11658 -+ umount_tree(child, UMOUNT_SYNC);
11659 - }
11660 - unlock_mount_hash();
11661 - cleanup_group_ids(source_mnt, NULL);
11662 -@@ -2035,7 +2036,7 @@ static int do_loopback(struct path *path, const char *old_name,
11663 - err = graft_tree(mnt, parent, mp);
11664 - if (err) {
11665 - lock_mount_hash();
11666 -- umount_tree(mnt, 0);
11667 -+ umount_tree(mnt, UMOUNT_SYNC);
11668 - unlock_mount_hash();
11669 - }
11670 - out2:
11671 -@@ -2406,7 +2407,7 @@ void mark_mounts_for_expiry(struct list_head *mounts)
11672 - while (!list_empty(&graveyard)) {
11673 - mnt = list_first_entry(&graveyard, struct mount, mnt_expire);
11674 - touch_mnt_namespace(mnt->mnt_ns);
11675 -- umount_tree(mnt, 1);
11676 -+ umount_tree(mnt, UMOUNT_PROPAGATE|UMOUNT_SYNC);
11677 - }
11678 - unlock_mount_hash();
11679 - namespace_unlock();
11680 -@@ -2477,7 +2478,7 @@ static void shrink_submounts(struct mount *mnt)
11681 - m = list_first_entry(&graveyard, struct mount,
11682 - mnt_expire);
11683 - touch_mnt_namespace(m->mnt_ns);
11684 -- umount_tree(m, 1);
11685 -+ umount_tree(m, UMOUNT_PROPAGATE|UMOUNT_SYNC);
11686 - }
11687 - }
11688 + if (I915_HAS_HOTPLUG(dev)) {
11689 +diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
11690 +index 33b3d0a2..f536ff2 100644
11691 +--- a/drivers/gpu/drm/i915/i915_reg.h
11692 ++++ b/drivers/gpu/drm/i915/i915_reg.h
11693 +@@ -1740,6 +1740,7 @@ enum punit_power_well {
11694 + #define GMBUS_CYCLE_INDEX (2<<25)
11695 + #define GMBUS_CYCLE_STOP (4<<25)
11696 + #define GMBUS_BYTE_COUNT_SHIFT 16
11697 ++#define GMBUS_BYTE_COUNT_MAX 256U
11698 + #define GMBUS_SLAVE_INDEX_SHIFT 8
11699 + #define GMBUS_SLAVE_ADDR_SHIFT 1
11700 + #define GMBUS_SLAVE_READ (1<<0)
11701 +diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
11702 +index b31088a..56e437e 100644
11703 +--- a/drivers/gpu/drm/i915/intel_i2c.c
11704 ++++ b/drivers/gpu/drm/i915/intel_i2c.c
11705 +@@ -270,18 +270,17 @@ gmbus_wait_idle(struct drm_i915_private *dev_priv)
11706 }
11707 -diff --git a/fs/pnode.h b/fs/pnode.h
11708 -index 4a24635..16afc3d 100644
11709 ---- a/fs/pnode.h
11710 -+++ b/fs/pnode.h
11711 -@@ -47,7 +47,6 @@ int get_dominating_id(struct mount *mnt, const struct path *root);
11712 - unsigned int mnt_get_count(struct mount *mnt);
11713 - void mnt_set_mountpoint(struct mount *, struct mountpoint *,
11714 - struct mount *);
11715 --void umount_tree(struct mount *, int);
11716 - struct mount *copy_tree(struct mount *, struct dentry *, int);
11717 - bool is_path_reachable(struct mount *, struct dentry *,
11718 - const struct path *root);
11719 ---
11720 -2.3.6
11721 -
11722 -
11723 -From a15f7b5e276d1b8f71d3d64d7f3f509e77bee5e4 Mon Sep 17 00:00:00 2001
11724 -From: "Eric W. Biederman" <ebiederm@××××××××.com>
11725 -Date: Wed, 24 Dec 2014 07:35:10 -0600
11726 -Subject: [PATCH 108/219] mnt: Don't propagate umounts in __detach_mounts
11727 -Cc: mpagano@g.o
11728 -
11729 -commit 8318e667f176f7ea34451a1a530634e293f216ac upstream.
11730 -
11731 -Invoking mount propagation from __detach_mounts is inefficient and
11732 -wrong.
11733 -
11734 -It is inefficient because __detach_mounts already walks the list of
11735 -mounts that where something needs to be done, and mount propagation
11736 -walks some subset of those mounts again.
11737 -
11738 -It is actively wrong because if the dentry that is passed to
11739 -__detach_mounts is not part of the path to a mount that mount should
11740 -not be affected.
11741 -
11742 -change_mnt_propagation(p,MS_PRIVATE) modifies the mount propagation
11743 -tree of a master mount so it's slaves are connected to another master
11744 -if possible. Which means even removing a mount from the middle of a
11745 -mount tree with __detach_mounts will not deprive any mount propagated
11746 -mount events.
11747 -
11748 -Signed-off-by: "Eric W. Biederman" <ebiederm@××××××××.com>
11749 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
11750 -Signed-off-by: Mike Pagano <mpagano@g.o>
11751 ----
11752 - fs/namespace.c | 2 +-
11753 - 1 file changed, 1 insertion(+), 1 deletion(-)
11754 -
11755 -diff --git a/fs/namespace.c b/fs/namespace.c
11756 -index 712b3c5..616a694 100644
11757 ---- a/fs/namespace.c
11758 -+++ b/fs/namespace.c
11759 -@@ -1487,7 +1487,7 @@ void __detach_mounts(struct dentry *dentry)
11760 - lock_mount_hash();
11761 - while (!hlist_empty(&mp->m_list)) {
11762 - mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list);
11763 -- umount_tree(mnt, UMOUNT_PROPAGATE);
11764 -+ umount_tree(mnt, 0);
11765 - }
11766 - unlock_mount_hash();
11767 - put_mountpoint(mp);
11768 ---
11769 -2.3.6
11770 -
11771 -
11772 -From 953bab2cb35f8f6f2a0183c1b27ff7466f72bccc Mon Sep 17 00:00:00 2001
11773 -From: "Eric W. Biederman" <ebiederm@××××××××.com>
11774 -Date: Thu, 18 Dec 2014 13:10:48 -0600
11775 -Subject: [PATCH 109/219] mnt: In umount_tree reuse mnt_list instead of
11776 - mnt_hash
11777 -Cc: mpagano@g.o
11778 -
11779 -commit c003b26ff98ca04a180ff34c38c007a3998d62f9 upstream.
11780 -
11781 -umount_tree builds a list of mounts that need to be unmounted.
11782 -Utilize mnt_list for this purpose instead of mnt_hash. This begins to
11783 -allow keeping a mount on the mnt_hash after it is unmounted, which is
11784 -necessary for a properly functioning MNT_LOCKED implementation.
11785 -
11786 -The fact that mnt_list is an ordinary list makding available list_move
11787 -is nice bonus.
11788 -
11789 -Signed-off-by: "Eric W. Biederman" <ebiederm@××××××××.com>
11790 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
11791 -Signed-off-by: Mike Pagano <mpagano@g.o>
11792 ----
11793 - fs/namespace.c | 20 +++++++++++---------
11794 - fs/pnode.c | 6 +++---
11795 - fs/pnode.h | 2 +-
11796 - 3 files changed, 15 insertions(+), 13 deletions(-)
11797 -
11798 -diff --git a/fs/namespace.c b/fs/namespace.c
11799 -index 616a694..18df0af 100644
11800 ---- a/fs/namespace.c
11801 -+++ b/fs/namespace.c
11802 -@@ -1329,23 +1329,25 @@ enum umount_tree_flags {
11803 - */
11804 - static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
11805 - {
11806 -- HLIST_HEAD(tmp_list);
11807 -+ LIST_HEAD(tmp_list);
11808 - struct mount *p;
11809 -
11810 -- for (p = mnt; p; p = next_mnt(p, mnt)) {
11811 -- hlist_del_init_rcu(&p->mnt_hash);
11812 -- hlist_add_head(&p->mnt_hash, &tmp_list);
11813 -- }
11814 -+ /* Gather the mounts to umount */
11815 -+ for (p = mnt; p; p = next_mnt(p, mnt))
11816 -+ list_move(&p->mnt_list, &tmp_list);
11817 -
11818 -- hlist_for_each_entry(p, &tmp_list, mnt_hash)
11819 -+ /* Hide the mounts from lookup_mnt and mnt_mounts */
11820 -+ list_for_each_entry(p, &tmp_list, mnt_list) {
11821 -+ hlist_del_init_rcu(&p->mnt_hash);
11822 - list_del_init(&p->mnt_child);
11823 -+ }
11824 -
11825 -+ /* Add propogated mounts to the tmp_list */
11826 - if (how & UMOUNT_PROPAGATE)
11827 - propagate_umount(&tmp_list);
11828
11829 -- while (!hlist_empty(&tmp_list)) {
11830 -- p = hlist_entry(tmp_list.first, struct mount, mnt_hash);
11831 -- hlist_del_init_rcu(&p->mnt_hash);
11832 -+ while (!list_empty(&tmp_list)) {
11833 -+ p = list_first_entry(&tmp_list, struct mount, mnt_list);
11834 - list_del_init(&p->mnt_expire);
11835 - list_del_init(&p->mnt_list);
11836 - __touch_mnt_namespace(p->mnt_ns);
11837 -diff --git a/fs/pnode.c b/fs/pnode.c
11838 -index 260ac8f..bf012af 100644
11839 ---- a/fs/pnode.c
11840 -+++ b/fs/pnode.c
11841 -@@ -384,7 +384,7 @@ static void __propagate_umount(struct mount *mnt)
11842 - if (child && list_empty(&child->mnt_mounts)) {
11843 - list_del_init(&child->mnt_child);
11844 - hlist_del_init_rcu(&child->mnt_hash);
11845 -- hlist_add_before_rcu(&child->mnt_hash, &mnt->mnt_hash);
11846 -+ list_move_tail(&child->mnt_list, &mnt->mnt_list);
11847 - }
11848 - }
11849 - }
11850 -@@ -396,11 +396,11 @@ static void __propagate_umount(struct mount *mnt)
11851 - *
11852 - * vfsmount lock must be held for write
11853 - */
11854 --int propagate_umount(struct hlist_head *list)
11855 -+int propagate_umount(struct list_head *list)
11856 + static int
11857 +-gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg,
11858 +- u32 gmbus1_index)
11859 ++gmbus_xfer_read_chunk(struct drm_i915_private *dev_priv,
11860 ++ unsigned short addr, u8 *buf, unsigned int len,
11861 ++ u32 gmbus1_index)
11862 {
11863 - struct mount *mnt;
11864 + int reg_offset = dev_priv->gpio_mmio_base;
11865 +- u16 len = msg->len;
11866 +- u8 *buf = msg->buf;
11867
11868 -- hlist_for_each_entry(mnt, list, mnt_hash)
11869 -+ list_for_each_entry(mnt, list, mnt_list)
11870 - __propagate_umount(mnt);
11871 - return 0;
11872 + I915_WRITE(GMBUS1 + reg_offset,
11873 + gmbus1_index |
11874 + GMBUS_CYCLE_WAIT |
11875 + (len << GMBUS_BYTE_COUNT_SHIFT) |
11876 +- (msg->addr << GMBUS_SLAVE_ADDR_SHIFT) |
11877 ++ (addr << GMBUS_SLAVE_ADDR_SHIFT) |
11878 + GMBUS_SLAVE_READ | GMBUS_SW_RDY);
11879 + while (len) {
11880 + int ret;
11881 +@@ -303,11 +302,35 @@ gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg,
11882 }
11883 -diff --git a/fs/pnode.h b/fs/pnode.h
11884 -index 16afc3d..aa6d65d 100644
11885 ---- a/fs/pnode.h
11886 -+++ b/fs/pnode.h
11887 -@@ -40,7 +40,7 @@ static inline void set_mnt_shared(struct mount *mnt)
11888 - void change_mnt_propagation(struct mount *, int);
11889 - int propagate_mnt(struct mount *, struct mountpoint *, struct mount *,
11890 - struct hlist_head *);
11891 --int propagate_umount(struct hlist_head *);
11892 -+int propagate_umount(struct list_head *);
11893 - int propagate_mount_busy(struct mount *, int);
11894 - void mnt_release_group_id(struct mount *);
11895 - int get_dominating_id(struct mount *mnt, const struct path *root);
11896 ---
11897 -2.3.6
11898 -
11899 -
11900 -From 7052e71b2d085f76800115d4a212dcaf82b86262 Mon Sep 17 00:00:00 2001
11901 -From: "Eric W. Biederman" <ebiederm@××××××××.com>
11902 -Date: Mon, 22 Dec 2014 18:30:08 -0600
11903 -Subject: [PATCH 110/219] mnt: Add MNT_UMOUNT flag
11904 -Cc: mpagano@g.o
11905 -
11906 -commit 590ce4bcbfb4e0462a720a4ad901e84416080bba upstream.
11907 -
11908 -In some instances it is necessary to know if the the unmounting
11909 -process has begun on a mount. Add MNT_UMOUNT to make that reliably
11910 -testable.
11911 -
11912 -This fix gets used in fixing locked mounts in MNT_DETACH
11913 -
11914 -Signed-off-by: "Eric W. Biederman" <ebiederm@××××××××.com>
11915 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
11916 -Signed-off-by: Mike Pagano <mpagano@g.o>
11917 ----
11918 - fs/namespace.c | 4 +++-
11919 - fs/pnode.c | 1 +
11920 - include/linux/mount.h | 1 +
11921 - 3 files changed, 5 insertions(+), 1 deletion(-)
11922 -
11923 -diff --git a/fs/namespace.c b/fs/namespace.c
11924 -index 18df0af..9f3c7e5 100644
11925 ---- a/fs/namespace.c
11926 -+++ b/fs/namespace.c
11927 -@@ -1333,8 +1333,10 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
11928 - struct mount *p;
11929 -
11930 - /* Gather the mounts to umount */
11931 -- for (p = mnt; p; p = next_mnt(p, mnt))
11932 -+ for (p = mnt; p; p = next_mnt(p, mnt)) {
11933 -+ p->mnt.mnt_flags |= MNT_UMOUNT;
11934 - list_move(&p->mnt_list, &tmp_list);
11935 -+ }
11936
11937 - /* Hide the mounts from lookup_mnt and mnt_mounts */
11938 - list_for_each_entry(p, &tmp_list, mnt_list) {
11939 -diff --git a/fs/pnode.c b/fs/pnode.c
11940 -index bf012af..ac3aa0d 100644
11941 ---- a/fs/pnode.c
11942 -+++ b/fs/pnode.c
11943 -@@ -384,6 +384,7 @@ static void __propagate_umount(struct mount *mnt)
11944 - if (child && list_empty(&child->mnt_mounts)) {
11945 - list_del_init(&child->mnt_child);
11946 - hlist_del_init_rcu(&child->mnt_hash);
11947 -+ child->mnt.mnt_flags |= MNT_UMOUNT;
11948 - list_move_tail(&child->mnt_list, &mnt->mnt_list);
11949 - }
11950 - }
11951 -diff --git a/include/linux/mount.h b/include/linux/mount.h
11952 -index c2c561d..564beee 100644
11953 ---- a/include/linux/mount.h
11954 -+++ b/include/linux/mount.h
11955 -@@ -61,6 +61,7 @@ struct mnt_namespace;
11956 - #define MNT_DOOMED 0x1000000
11957 - #define MNT_SYNC_UMOUNT 0x2000000
11958 - #define MNT_MARKED 0x4000000
11959 -+#define MNT_UMOUNT 0x8000000
11960 -
11961 - struct vfsmount {
11962 - struct dentry *mnt_root; /* root of the mounted tree */
11963 ---
11964 -2.3.6
11965 -
11966 -
11967 -From 7a9742a65c02e30a62ae42c765eb4dff26b51cc9 Mon Sep 17 00:00:00 2001
11968 -From: "Eric W. Biederman" <ebiederm@××××××××.com>
11969 -Date: Mon, 22 Dec 2014 19:12:07 -0600
11970 -Subject: [PATCH 111/219] mnt: Delay removal from the mount hash.
11971 -Cc: mpagano@g.o
11972 -
11973 -commit 411a938b5abc9cb126c41cccf5975ae464fe0f3e upstream.
11974 -
11975 -- Modify __lookup_mnt_hash_last to ignore mounts that have MNT_UMOUNTED set.
11976 -- Don't remove mounts from the mount hash table in propogate_umount
11977 -- Don't remove mounts from the mount hash table in umount_tree before
11978 - the entire list of mounts to be umounted is selected.
11979 -- Remove mounts from the mount hash table as the last thing that
11980 - happens in the case where a mount has a parent in umount_tree.
11981 - Mounts without parents are not hashed (by definition).
11982 -
11983 -This paves the way for delaying removal from the mount hash table even
11984 -farther and fixing the MNT_LOCKED vs MNT_DETACH issue.
11985 -
11986 -Signed-off-by: "Eric W. Biederman" <ebiederm@××××××××.com>
11987 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
11988 -Signed-off-by: Mike Pagano <mpagano@g.o>
11989 ----
11990 - fs/namespace.c | 13 ++++++++-----
11991 - fs/pnode.c | 1 -
11992 - 2 files changed, 8 insertions(+), 6 deletions(-)
11993 -
11994 -diff --git a/fs/namespace.c b/fs/namespace.c
11995 -index 9f3c7e5..6c477be 100644
11996 ---- a/fs/namespace.c
11997 -+++ b/fs/namespace.c
11998 -@@ -632,14 +632,17 @@ struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry)
11999 - */
12000 - struct mount *__lookup_mnt_last(struct vfsmount *mnt, struct dentry *dentry)
12001 + static int
12002 +-gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg)
12003 ++gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg,
12004 ++ u32 gmbus1_index)
12005 {
12006 -- struct mount *p, *res;
12007 -- res = p = __lookup_mnt(mnt, dentry);
12008 -+ struct mount *p, *res = NULL;
12009 -+ p = __lookup_mnt(mnt, dentry);
12010 - if (!p)
12011 - goto out;
12012 -+ if (!(p->mnt.mnt_flags & MNT_UMOUNT))
12013 -+ res = p;
12014 - hlist_for_each_entry_continue(p, mnt_hash) {
12015 - if (&p->mnt_parent->mnt != mnt || p->mnt_mountpoint != dentry)
12016 - break;
12017 -- res = p;
12018 -+ if (!(p->mnt.mnt_flags & MNT_UMOUNT))
12019 -+ res = p;
12020 - }
12021 - out:
12022 - return res;
12023 -@@ -1338,9 +1341,8 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
12024 - list_move(&p->mnt_list, &tmp_list);
12025 - }
12026 -
12027 -- /* Hide the mounts from lookup_mnt and mnt_mounts */
12028 -+ /* Hide the mounts from mnt_mounts */
12029 - list_for_each_entry(p, &tmp_list, mnt_list) {
12030 -- hlist_del_init_rcu(&p->mnt_hash);
12031 - list_del_init(&p->mnt_child);
12032 - }
12033 -
12034 -@@ -1367,6 +1369,7 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
12035 - p->mnt_mountpoint = p->mnt.mnt_root;
12036 - p->mnt_parent = p;
12037 - p->mnt_mp = NULL;
12038 -+ hlist_del_init_rcu(&p->mnt_hash);
12039 - }
12040 - change_mnt_propagation(p, MS_PRIVATE);
12041 - }
12042 -diff --git a/fs/pnode.c b/fs/pnode.c
12043 -index ac3aa0d..c27ae38 100644
12044 ---- a/fs/pnode.c
12045 -+++ b/fs/pnode.c
12046 -@@ -383,7 +383,6 @@ static void __propagate_umount(struct mount *mnt)
12047 - */
12048 - if (child && list_empty(&child->mnt_mounts)) {
12049 - list_del_init(&child->mnt_child);
12050 -- hlist_del_init_rcu(&child->mnt_hash);
12051 - child->mnt.mnt_flags |= MNT_UMOUNT;
12052 - list_move_tail(&child->mnt_list, &mnt->mnt_list);
12053 - }
12054 ---
12055 -2.3.6
12056 -
12057 -
12058 -From 397dd1fc1225b478824134ddd5540f889b13809d Mon Sep 17 00:00:00 2001
12059 -From: "Eric W. Biederman" <ebiederm@××××××××.com>
12060 -Date: Sat, 3 Jan 2015 05:39:35 -0600
12061 -Subject: [PATCH 112/219] mnt: On an unmount propagate clearing of MNT_LOCKED
12062 -Cc: mpagano@g.o
12063 -
12064 -commit 5d88457eb5b86b475422dc882f089203faaeedb5 upstream.
12065 -
12066 -A prerequisite of calling umount_tree is that the point where the tree
12067 -is mounted at is valid to unmount.
12068 -
12069 -If we are propagating the effect of the unmount clear MNT_LOCKED in
12070 -every instance where the same filesystem is mounted on the same
12071 -mountpoint in the mount tree, as we know (by virtue of the fact
12072 -that umount_tree was called) that it is safe to reveal what
12073 -is at that mountpoint.
12074 -
12075 -Signed-off-by: "Eric W. Biederman" <ebiederm@××××××××.com>
12076 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
12077 -Signed-off-by: Mike Pagano <mpagano@g.o>
12078 ----
12079 - fs/namespace.c | 3 +++
12080 - fs/pnode.c | 20 ++++++++++++++++++++
12081 - fs/pnode.h | 1 +
12082 - 3 files changed, 24 insertions(+)
12083 -
12084 -diff --git a/fs/namespace.c b/fs/namespace.c
12085 -index 6c477be..7d9a69d 100644
12086 ---- a/fs/namespace.c
12087 -+++ b/fs/namespace.c
12088 -@@ -1335,6 +1335,9 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
12089 - LIST_HEAD(tmp_list);
12090 - struct mount *p;
12091 -
12092 -+ if (how & UMOUNT_PROPAGATE)
12093 -+ propagate_mount_unlock(mnt);
12094 +- int reg_offset = dev_priv->gpio_mmio_base;
12095 +- u16 len = msg->len;
12096 + u8 *buf = msg->buf;
12097 ++ unsigned int rx_size = msg->len;
12098 ++ unsigned int len;
12099 ++ int ret;
12100 +
12101 - /* Gather the mounts to umount */
12102 - for (p = mnt; p; p = next_mnt(p, mnt)) {
12103 - p->mnt.mnt_flags |= MNT_UMOUNT;
12104 -diff --git a/fs/pnode.c b/fs/pnode.c
12105 -index c27ae38..8989029 100644
12106 ---- a/fs/pnode.c
12107 -+++ b/fs/pnode.c
12108 -@@ -362,6 +362,26 @@ int propagate_mount_busy(struct mount *mnt, int refcnt)
12109 - }
12110 -
12111 - /*
12112 -+ * Clear MNT_LOCKED when it can be shown to be safe.
12113 -+ *
12114 -+ * mount_lock lock must be held for write
12115 -+ */
12116 -+void propagate_mount_unlock(struct mount *mnt)
12117 -+{
12118 -+ struct mount *parent = mnt->mnt_parent;
12119 -+ struct mount *m, *child;
12120 ++ do {
12121 ++ len = min(rx_size, GMBUS_BYTE_COUNT_MAX);
12122 +
12123 -+ BUG_ON(parent == mnt);
12124 ++ ret = gmbus_xfer_read_chunk(dev_priv, msg->addr,
12125 ++ buf, len, gmbus1_index);
12126 ++ if (ret)
12127 ++ return ret;
12128 +
12129 -+ for (m = propagation_next(parent, parent); m;
12130 -+ m = propagation_next(m, parent)) {
12131 -+ child = __lookup_mnt_last(&m->mnt, mnt->mnt_mountpoint);
12132 -+ if (child)
12133 -+ child->mnt.mnt_flags &= ~MNT_LOCKED;
12134 -+ }
12135 ++ rx_size -= len;
12136 ++ buf += len;
12137 ++ } while (rx_size != 0);
12138 ++
12139 ++ return 0;
12140 +}
12141 +
12142 -+/*
12143 - * NOTE: unmounting 'mnt' naturally propagates to all other mounts its
12144 - * parent propagates to.
12145 - */
12146 -diff --git a/fs/pnode.h b/fs/pnode.h
12147 -index aa6d65d..af47d4b 100644
12148 ---- a/fs/pnode.h
12149 -+++ b/fs/pnode.h
12150 -@@ -42,6 +42,7 @@ int propagate_mnt(struct mount *, struct mountpoint *, struct mount *,
12151 - struct hlist_head *);
12152 - int propagate_umount(struct list_head *);
12153 - int propagate_mount_busy(struct mount *, int);
12154 -+void propagate_mount_unlock(struct mount *);
12155 - void mnt_release_group_id(struct mount *);
12156 - int get_dominating_id(struct mount *mnt, const struct path *root);
12157 - unsigned int mnt_get_count(struct mount *mnt);
12158 ---
12159 -2.3.6
12160 -
12161 -
12162 -From 928116b22b1eb446c59a0fb93857d7a6d80930af Mon Sep 17 00:00:00 2001
12163 -From: "Eric W. Biederman" <ebiederm@××××××××.com>
12164 -Date: Mon, 5 Jan 2015 13:38:04 -0600
12165 -Subject: [PATCH 113/219] mnt: Don't propagate unmounts to locked mounts
12166 -Cc: mpagano@g.o
12167 -
12168 -commit 0c56fe31420ca599c90240315f7959bf1b4eb6ce upstream.
12169 -
12170 -If the first mount in shared subtree is locked don't unmount the
12171 -shared subtree.
12172 -
12173 -This is ensured by walking through the mounts parents before children
12174 -and marking a mount as unmountable if it is not locked or it is locked
12175 -but it's parent is marked.
12176 -
12177 -This allows recursive mount detach to propagate through a set of
12178 -mounts when unmounting them would not reveal what is under any locked
12179 -mount.
12180 -
12181 -Signed-off-by: "Eric W. Biederman" <ebiederm@××××××××.com>
12182 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
12183 -Signed-off-by: Mike Pagano <mpagano@g.o>
12184 ----
12185 - fs/pnode.c | 32 +++++++++++++++++++++++++++++---
12186 - fs/pnode.h | 1 +
12187 - 2 files changed, 30 insertions(+), 3 deletions(-)
12188 -
12189 -diff --git a/fs/pnode.c b/fs/pnode.c
12190 -index 8989029..6367e1e 100644
12191 ---- a/fs/pnode.c
12192 -+++ b/fs/pnode.c
12193 -@@ -382,6 +382,26 @@ void propagate_mount_unlock(struct mount *mnt)
12194 - }
12195 ++static int
12196 ++gmbus_xfer_write_chunk(struct drm_i915_private *dev_priv,
12197 ++ unsigned short addr, u8 *buf, unsigned int len)
12198 ++{
12199 ++ int reg_offset = dev_priv->gpio_mmio_base;
12200 ++ unsigned int chunk_size = len;
12201 + u32 val, loop;
12202
12203 - /*
12204 -+ * Mark all mounts that the MNT_LOCKED logic will allow to be unmounted.
12205 -+ */
12206 -+static void mark_umount_candidates(struct mount *mnt)
12207 + val = loop = 0;
12208 +@@ -319,8 +342,8 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg)
12209 + I915_WRITE(GMBUS3 + reg_offset, val);
12210 + I915_WRITE(GMBUS1 + reg_offset,
12211 + GMBUS_CYCLE_WAIT |
12212 +- (msg->len << GMBUS_BYTE_COUNT_SHIFT) |
12213 +- (msg->addr << GMBUS_SLAVE_ADDR_SHIFT) |
12214 ++ (chunk_size << GMBUS_BYTE_COUNT_SHIFT) |
12215 ++ (addr << GMBUS_SLAVE_ADDR_SHIFT) |
12216 + GMBUS_SLAVE_WRITE | GMBUS_SW_RDY);
12217 + while (len) {
12218 + int ret;
12219 +@@ -337,6 +360,29 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg)
12220 + if (ret)
12221 + return ret;
12222 + }
12223 ++
12224 ++ return 0;
12225 ++}
12226 ++
12227 ++static int
12228 ++gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg)
12229 +{
12230 -+ struct mount *parent = mnt->mnt_parent;
12231 -+ struct mount *m;
12232 ++ u8 *buf = msg->buf;
12233 ++ unsigned int tx_size = msg->len;
12234 ++ unsigned int len;
12235 ++ int ret;
12236 +
12237 -+ BUG_ON(parent == mnt);
12238 ++ do {
12239 ++ len = min(tx_size, GMBUS_BYTE_COUNT_MAX);
12240 +
12241 -+ for (m = propagation_next(parent, parent); m;
12242 -+ m = propagation_next(m, parent)) {
12243 -+ struct mount *child = __lookup_mnt_last(&m->mnt,
12244 -+ mnt->mnt_mountpoint);
12245 -+ if (child && (!IS_MNT_LOCKED(child) || IS_MNT_MARKED(m))) {
12246 -+ SET_MNT_MARK(child);
12247 -+ }
12248 -+ }
12249 -+}
12250 ++ ret = gmbus_xfer_write_chunk(dev_priv, msg->addr, buf, len);
12251 ++ if (ret)
12252 ++ return ret;
12253 +
12254 -+/*
12255 - * NOTE: unmounting 'mnt' naturally propagates to all other mounts its
12256 - * parent propagates to.
12257 - */
12258 -@@ -398,10 +418,13 @@ static void __propagate_umount(struct mount *mnt)
12259 - struct mount *child = __lookup_mnt_last(&m->mnt,
12260 - mnt->mnt_mountpoint);
12261 - /*
12262 -- * umount the child only if the child has no
12263 -- * other children
12264 -+ * umount the child only if the child has no children
12265 -+ * and the child is marked safe to unmount.
12266 - */
12267 -- if (child && list_empty(&child->mnt_mounts)) {
12268 -+ if (!child || !IS_MNT_MARKED(child))
12269 -+ continue;
12270 -+ CLEAR_MNT_MARK(child);
12271 -+ if (list_empty(&child->mnt_mounts)) {
12272 - list_del_init(&child->mnt_child);
12273 - child->mnt.mnt_flags |= MNT_UMOUNT;
12274 - list_move_tail(&child->mnt_list, &mnt->mnt_list);
12275 -@@ -420,6 +443,9 @@ int propagate_umount(struct list_head *list)
12276 - {
12277 - struct mount *mnt;
12278 -
12279 -+ list_for_each_entry_reverse(mnt, list, mnt_list)
12280 -+ mark_umount_candidates(mnt);
12281 ++ buf += len;
12282 ++ tx_size -= len;
12283 ++ } while (tx_size != 0);
12284 +
12285 - list_for_each_entry(mnt, list, mnt_list)
12286 - __propagate_umount(mnt);
12287 return 0;
12288 -diff --git a/fs/pnode.h b/fs/pnode.h
12289 -index af47d4b..0fcdbe7 100644
12290 ---- a/fs/pnode.h
12291 -+++ b/fs/pnode.h
12292 -@@ -19,6 +19,7 @@
12293 - #define IS_MNT_MARKED(m) ((m)->mnt.mnt_flags & MNT_MARKED)
12294 - #define SET_MNT_MARK(m) ((m)->mnt.mnt_flags |= MNT_MARKED)
12295 - #define CLEAR_MNT_MARK(m) ((m)->mnt.mnt_flags &= ~MNT_MARKED)
12296 -+#define IS_MNT_LOCKED(m) ((m)->mnt.mnt_flags & MNT_LOCKED)
12297 -
12298 - #define CL_EXPIRE 0x01
12299 - #define CL_SLAVE 0x02
12300 ---
12301 -2.3.6
12302 -
12303 -
12304 -From 92e35ac5954f9f7829ad88066930a4b2b58fe4dd Mon Sep 17 00:00:00 2001
12305 -From: "Eric W. Biederman" <ebiederm@××××××××.com>
12306 -Date: Mon, 29 Dec 2014 13:03:41 -0600
12307 -Subject: [PATCH 114/219] mnt: Factor out unhash_mnt from detach_mnt and
12308 - umount_tree
12309 -Cc: mpagano@g.o
12310 -
12311 -commit 7bdb11de8ee4f4ae195e2fa19efd304e0b36c63b upstream.
12312 -
12313 -Create a function unhash_mnt that contains the common code between
12314 -detach_mnt and umount_tree, and use unhash_mnt in place of the common
12315 -code. This add a unncessary list_del_init(mnt->mnt_child) into
12316 -umount_tree but given that mnt_child is already empty this extra
12317 -line is a noop.
12318 -
12319 -Signed-off-by: "Eric W. Biederman" <ebiederm@××××××××.com>
12320 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
12321 -Signed-off-by: Mike Pagano <mpagano@g.o>
12322 ----
12323 - fs/namespace.c | 21 ++++++++++++---------
12324 - 1 file changed, 12 insertions(+), 9 deletions(-)
12325 -
12326 -diff --git a/fs/namespace.c b/fs/namespace.c
12327 -index 7d9a69d..0e95c84 100644
12328 ---- a/fs/namespace.c
12329 -+++ b/fs/namespace.c
12330 -@@ -798,10 +798,8 @@ static void __touch_mnt_namespace(struct mnt_namespace *ns)
12331 - /*
12332 - * vfsmount lock must be held for write
12333 - */
12334 --static void detach_mnt(struct mount *mnt, struct path *old_path)
12335 -+static void unhash_mnt(struct mount *mnt)
12336 - {
12337 -- old_path->dentry = mnt->mnt_mountpoint;
12338 -- old_path->mnt = &mnt->mnt_parent->mnt;
12339 - mnt->mnt_parent = mnt;
12340 - mnt->mnt_mountpoint = mnt->mnt.mnt_root;
12341 - list_del_init(&mnt->mnt_child);
12342 -@@ -814,6 +812,16 @@ static void detach_mnt(struct mount *mnt, struct path *old_path)
12343 - /*
12344 - * vfsmount lock must be held for write
12345 - */
12346 -+static void detach_mnt(struct mount *mnt, struct path *old_path)
12347 -+{
12348 -+ old_path->dentry = mnt->mnt_mountpoint;
12349 -+ old_path->mnt = &mnt->mnt_parent->mnt;
12350 -+ unhash_mnt(mnt);
12351 -+}
12352 -+
12353 -+/*
12354 -+ * vfsmount lock must be held for write
12355 -+ */
12356 - void mnt_set_mountpoint(struct mount *mnt,
12357 - struct mountpoint *mp,
12358 - struct mount *child_mnt)
12359 -@@ -1364,15 +1372,10 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
12360 + }
12361
12362 - pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt, &unmounted);
12363 - if (mnt_has_parent(p)) {
12364 -- hlist_del_init(&p->mnt_mp_list);
12365 -- put_mountpoint(p->mnt_mp);
12366 - mnt_add_count(p->mnt_parent, -1);
12367 - /* old mountpoint will be dropped when we can do that */
12368 - p->mnt_ex_mountpoint = p->mnt_mountpoint;
12369 -- p->mnt_mountpoint = p->mnt.mnt_root;
12370 -- p->mnt_parent = p;
12371 -- p->mnt_mp = NULL;
12372 -- hlist_del_init_rcu(&p->mnt_hash);
12373 -+ unhash_mnt(p);
12374 - }
12375 - change_mnt_propagation(p, MS_PRIVATE);
12376 - }
12377 ---
12378 -2.3.6
12379 -
12380 -
12381 -From 2db706971b3f28b3d59a9af231578803da85def8 Mon Sep 17 00:00:00 2001
12382 -From: "Eric W. Biederman" <ebiederm@××××××××.com>
12383 -Date: Thu, 15 Jan 2015 22:58:33 -0600
12384 -Subject: [PATCH 115/219] mnt: Factor umount_mnt from umount_tree
12385 -Cc: mpagano@g.o
12386 -
12387 -commit 6a46c5735c29175da55b2fa9d53775182422cdd7 upstream.
12388 -
12389 -For future use factor out a function umount_mnt from umount_tree.
12390 -This function unhashes a mount and remembers where the mount
12391 -was mounted so that eventually when the code makes it to a
12392 -sleeping context the mountpoint can be dput.
12393 -
12394 -Signed-off-by: "Eric W. Biederman" <ebiederm@××××××××.com>
12395 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
12396 -Signed-off-by: Mike Pagano <mpagano@g.o>
12397 ----
12398 - fs/namespace.c | 14 +++++++++++---
12399 - 1 file changed, 11 insertions(+), 3 deletions(-)
12400 -
12401 -diff --git a/fs/namespace.c b/fs/namespace.c
12402 -index 0e95c84..c905e48 100644
12403 ---- a/fs/namespace.c
12404 -+++ b/fs/namespace.c
12405 -@@ -822,6 +822,16 @@ static void detach_mnt(struct mount *mnt, struct path *old_path)
12406 - /*
12407 - * vfsmount lock must be held for write
12408 - */
12409 -+static void umount_mnt(struct mount *mnt)
12410 -+{
12411 -+ /* old mountpoint will be dropped when we can do that */
12412 -+ mnt->mnt_ex_mountpoint = mnt->mnt_mountpoint;
12413 -+ unhash_mnt(mnt);
12414 -+}
12415 +diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
12416 +index 86807ee..9bd5611 100644
12417 +--- a/drivers/gpu/drm/radeon/atombios_crtc.c
12418 ++++ b/drivers/gpu/drm/radeon/atombios_crtc.c
12419 +@@ -330,8 +330,10 @@ atombios_set_crtc_dtd_timing(struct drm_crtc *crtc,
12420 + misc |= ATOM_COMPOSITESYNC;
12421 + if (mode->flags & DRM_MODE_FLAG_INTERLACE)
12422 + misc |= ATOM_INTERLACE;
12423 +- if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
12424 ++ if (mode->flags & DRM_MODE_FLAG_DBLCLK)
12425 + misc |= ATOM_DOUBLE_CLOCK_MODE;
12426 ++ if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
12427 ++ misc |= ATOM_H_REPLICATIONBY2 | ATOM_V_REPLICATIONBY2;
12428 +
12429 + args.susModeMiscInfo.usAccess = cpu_to_le16(misc);
12430 + args.ucCRTC = radeon_crtc->crtc_id;
12431 +@@ -374,8 +376,10 @@ static void atombios_crtc_set_timing(struct drm_crtc *crtc,
12432 + misc |= ATOM_COMPOSITESYNC;
12433 + if (mode->flags & DRM_MODE_FLAG_INTERLACE)
12434 + misc |= ATOM_INTERLACE;
12435 +- if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
12436 ++ if (mode->flags & DRM_MODE_FLAG_DBLCLK)
12437 + misc |= ATOM_DOUBLE_CLOCK_MODE;
12438 ++ if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
12439 ++ misc |= ATOM_H_REPLICATIONBY2 | ATOM_V_REPLICATIONBY2;
12440 +
12441 + args.susModeMiscInfo.usAccess = cpu_to_le16(misc);
12442 + args.ucCRTC = radeon_crtc->crtc_id;
12443 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
12444 +index 9c47867..7fe5590 100644
12445 +--- a/drivers/hid/hid-ids.h
12446 ++++ b/drivers/hid/hid-ids.h
12447 +@@ -459,6 +459,10 @@
12448 + #define USB_DEVICE_ID_UGCI_FLYING 0x0020
12449 + #define USB_DEVICE_ID_UGCI_FIGHTING 0x0030
12450 +
12451 ++#define USB_VENDOR_ID_HP 0x03f0
12452 ++#define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE 0x0a4a
12453 ++#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE 0x134a
12454 +
12455 -+/*
12456 -+ * vfsmount lock must be held for write
12457 -+ */
12458 - void mnt_set_mountpoint(struct mount *mnt,
12459 - struct mountpoint *mp,
12460 - struct mount *child_mnt)
12461 -@@ -1373,9 +1383,7 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
12462 - pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt, &unmounted);
12463 - if (mnt_has_parent(p)) {
12464 - mnt_add_count(p->mnt_parent, -1);
12465 -- /* old mountpoint will be dropped when we can do that */
12466 -- p->mnt_ex_mountpoint = p->mnt_mountpoint;
12467 -- unhash_mnt(p);
12468 -+ umount_mnt(p);
12469 - }
12470 - change_mnt_propagation(p, MS_PRIVATE);
12471 + #define USB_VENDOR_ID_HUION 0x256c
12472 + #define USB_DEVICE_ID_HUION_TABLET 0x006e
12473 +
12474 +diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
12475 +index a821277..4e3ae9f 100644
12476 +--- a/drivers/hid/usbhid/hid-quirks.c
12477 ++++ b/drivers/hid/usbhid/hid-quirks.c
12478 +@@ -78,6 +78,8 @@ static const struct hid_blacklist {
12479 + { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
12480 + { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
12481 + { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
12482 ++ { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
12483 ++ { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
12484 + { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, HID_QUIRK_ALWAYS_POLL },
12485 + { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
12486 + { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },
12487 +diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
12488 +index 2978f5e..00bc30e 100644
12489 +--- a/drivers/hv/channel.c
12490 ++++ b/drivers/hv/channel.c
12491 +@@ -135,7 +135,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
12492 + GFP_KERNEL);
12493 + if (!open_info) {
12494 + err = -ENOMEM;
12495 +- goto error0;
12496 ++ goto error_gpadl;
12497 }
12498 ---
12499 -2.3.6
12500 -
12501 -
12502 -From 20e62ee6fa3da23a792ca31d4b68069060317260 Mon Sep 17 00:00:00 2001
12503 -From: "Eric W. Biederman" <ebiederm@××××××××.com>
12504 -Date: Tue, 23 Dec 2014 21:37:03 -0600
12505 -Subject: [PATCH 116/219] mnt: Honor MNT_LOCKED when detaching mounts
12506 -Cc: mpagano@g.o
12507 -
12508 -commit ce07d891a0891d3c0d0c2d73d577490486b809e1 upstream.
12509 -
12510 -Modify umount(MNT_DETACH) to keep mounts in the hash table that are
12511 -locked to their parent mounts, when the parent is lazily unmounted.
12512 -
12513 -In mntput_no_expire detach the children from the hash table, depending
12514 -on mnt_pin_kill in cleanup_mnt to decrement the mnt_count of the children.
12515 -
12516 -In __detach_mounts if there are any mounts that have been unmounted
12517 -but still are on the list of mounts of a mountpoint, remove their
12518 -children from the mount hash table and those children to the unmounted
12519 -list so they won't linger potentially indefinitely waiting for their
12520 -final mntput, now that the mounts serve no purpose.
12521 -
12522 -Signed-off-by: "Eric W. Biederman" <ebiederm@××××××××.com>
12523 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
12524 -Signed-off-by: Mike Pagano <mpagano@g.o>
12525 ----
12526 - fs/namespace.c | 29 ++++++++++++++++++++++++++---
12527 - fs/pnode.h | 2 ++
12528 - 2 files changed, 28 insertions(+), 3 deletions(-)
12529 -
12530 -diff --git a/fs/namespace.c b/fs/namespace.c
12531 -index c905e48..24de1e9 100644
12532 ---- a/fs/namespace.c
12533 -+++ b/fs/namespace.c
12534 -@@ -1099,6 +1099,13 @@ static void mntput_no_expire(struct mount *mnt)
12535 - rcu_read_unlock();
12536
12537 - list_del(&mnt->mnt_instance);
12538 -+
12539 -+ if (unlikely(!list_empty(&mnt->mnt_mounts))) {
12540 -+ struct mount *p, *tmp;
12541 -+ list_for_each_entry_safe(p, tmp, &mnt->mnt_mounts, mnt_child) {
12542 -+ umount_mnt(p);
12543 -+ }
12544 -+ }
12545 - unlock_mount_hash();
12546 + init_completion(&open_info->waitevent);
12547 +@@ -151,7 +151,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
12548
12549 - if (likely(!(mnt->mnt.mnt_flags & MNT_INTERNAL))) {
12550 -@@ -1372,6 +1379,7 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
12551 - propagate_umount(&tmp_list);
12552 + if (userdatalen > MAX_USER_DEFINED_BYTES) {
12553 + err = -EINVAL;
12554 +- goto error0;
12555 ++ goto error_gpadl;
12556 + }
12557
12558 - while (!list_empty(&tmp_list)) {
12559 -+ bool disconnect;
12560 - p = list_first_entry(&tmp_list, struct mount, mnt_list);
12561 - list_del_init(&p->mnt_expire);
12562 - list_del_init(&p->mnt_list);
12563 -@@ -1380,10 +1388,18 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
12564 - if (how & UMOUNT_SYNC)
12565 - p->mnt.mnt_flags |= MNT_SYNC_UMOUNT;
12566 + if (userdatalen)
12567 +@@ -195,6 +195,9 @@ error1:
12568 + list_del(&open_info->msglistentry);
12569 + spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
12570
12571 -- pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt, &unmounted);
12572 -+ disconnect = !IS_MNT_LOCKED_AND_LAZY(p);
12573 ++error_gpadl:
12574 ++ vmbus_teardown_gpadl(newchannel, newchannel->ringbuffer_gpadlhandle);
12575 +
12576 -+ pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt,
12577 -+ disconnect ? &unmounted : NULL);
12578 - if (mnt_has_parent(p)) {
12579 - mnt_add_count(p->mnt_parent, -1);
12580 -- umount_mnt(p);
12581 -+ if (!disconnect) {
12582 -+ /* Don't forget about p */
12583 -+ list_add_tail(&p->mnt_child, &p->mnt_parent->mnt_mounts);
12584 -+ } else {
12585 -+ umount_mnt(p);
12586 -+ }
12587 - }
12588 - change_mnt_propagation(p, MS_PRIVATE);
12589 - }
12590 -@@ -1508,7 +1524,14 @@ void __detach_mounts(struct dentry *dentry)
12591 - lock_mount_hash();
12592 - while (!hlist_empty(&mp->m_list)) {
12593 - mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list);
12594 -- umount_tree(mnt, 0);
12595 -+ if (mnt->mnt.mnt_flags & MNT_UMOUNT) {
12596 -+ struct mount *p, *tmp;
12597 -+ list_for_each_entry_safe(p, tmp, &mnt->mnt_mounts, mnt_child) {
12598 -+ hlist_add_head(&p->mnt_umount.s_list, &unmounted);
12599 -+ umount_mnt(p);
12600 -+ }
12601 -+ }
12602 -+ else umount_tree(mnt, 0);
12603 - }
12604 - unlock_mount_hash();
12605 - put_mountpoint(mp);
12606 -diff --git a/fs/pnode.h b/fs/pnode.h
12607 -index 0fcdbe7..7114ce6 100644
12608 ---- a/fs/pnode.h
12609 -+++ b/fs/pnode.h
12610 -@@ -20,6 +20,8 @@
12611 - #define SET_MNT_MARK(m) ((m)->mnt.mnt_flags |= MNT_MARKED)
12612 - #define CLEAR_MNT_MARK(m) ((m)->mnt.mnt_flags &= ~MNT_MARKED)
12613 - #define IS_MNT_LOCKED(m) ((m)->mnt.mnt_flags & MNT_LOCKED)
12614 -+#define IS_MNT_LOCKED_AND_LAZY(m) \
12615 -+ (((m)->mnt.mnt_flags & (MNT_LOCKED|MNT_SYNC_UMOUNT)) == MNT_LOCKED)
12616 + error0:
12617 + free_pages((unsigned long)out,
12618 + get_order(send_ringbuffer_size + recv_ringbuffer_size));
12619 +diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
12620 +index 5f96b1b..019d542 100644
12621 +--- a/drivers/i2c/busses/i2c-rk3x.c
12622 ++++ b/drivers/i2c/busses/i2c-rk3x.c
12623 +@@ -833,7 +833,7 @@ static int rk3x_i2c_xfer(struct i2c_adapter *adap,
12624 + clk_disable(i2c->clk);
12625 + spin_unlock_irqrestore(&i2c->lock, flags);
12626
12627 - #define CL_EXPIRE 0x01
12628 - #define CL_SLAVE 0x02
12629 ---
12630 -2.3.6
12631 -
12632 -
12633 -From c076cbf218f3cb83dffe6982587d2b9751318962 Mon Sep 17 00:00:00 2001
12634 -From: "Eric W. Biederman" <ebiederm@××××××××.com>
12635 -Date: Mon, 19 Jan 2015 11:48:45 -0600
12636 -Subject: [PATCH 117/219] mnt: Fix the error check in __detach_mounts
12637 -Cc: mpagano@g.o
12638 -
12639 -commit f53e57975151f54ad8caa1b0ac8a78091cd5700a upstream.
12640 -
12641 -lookup_mountpoint can return either NULL or an error value.
12642 -Update the test in __detach_mounts to test for an error value
12643 -to avoid pathological cases causing a NULL pointer dereferences.
12644 -
12645 -The callers of __detach_mounts should prevent it from ever being
12646 -called on an unlinked dentry but don't take any chances.
12647 -
12648 -Signed-off-by: "Eric W. Biederman" <ebiederm@××××××××.com>
12649 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
12650 -Signed-off-by: Mike Pagano <mpagano@g.o>
12651 ----
12652 - fs/namespace.c | 2 +-
12653 - 1 file changed, 1 insertion(+), 1 deletion(-)
12654 -
12655 -diff --git a/fs/namespace.c b/fs/namespace.c
12656 -index 24de1e9..9e33895 100644
12657 ---- a/fs/namespace.c
12658 -+++ b/fs/namespace.c
12659 -@@ -1518,7 +1518,7 @@ void __detach_mounts(struct dentry *dentry)
12660 +- return ret;
12661 ++ return ret < 0 ? ret : num;
12662 + }
12663
12664 - namespace_lock();
12665 - mp = lookup_mountpoint(dentry);
12666 -- if (!mp)
12667 -+ if (IS_ERR_OR_NULL(mp))
12668 - goto out_unlock;
12669 + static u32 rk3x_i2c_func(struct i2c_adapter *adap)
12670 +diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
12671 +index edf274c..8143162 100644
12672 +--- a/drivers/i2c/i2c-core.c
12673 ++++ b/drivers/i2c/i2c-core.c
12674 +@@ -596,6 +596,7 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap)
12675 + adap->bus_recovery_info->set_scl(adap, 1);
12676 + return i2c_generic_recovery(adap);
12677 + }
12678 ++EXPORT_SYMBOL_GPL(i2c_generic_scl_recovery);
12679
12680 - lock_mount_hash();
12681 ---
12682 -2.3.6
12683 -
12684 -
12685 -From 84b78514033ff22c443473214ab6d0508394cf7a Mon Sep 17 00:00:00 2001
12686 -From: "Eric W. Biederman" <ebiederm@××××××××.com>
12687 -Date: Wed, 1 Apr 2015 18:30:06 -0500
12688 -Subject: [PATCH 118/219] mnt: Update detach_mounts to leave mounts connected
12689 -Cc: mpagano@g.o
12690 -
12691 -commit e0c9c0afd2fc958ffa34b697972721d81df8a56f upstream.
12692 -
12693 -Now that it is possible to lazily unmount an entire mount tree and
12694 -leave the individual mounts connected to each other add a new flag
12695 -UMOUNT_CONNECTED to umount_tree to force this behavior and use
12696 -this flag in detach_mounts.
12697 -
12698 -This closes a bug where the deletion of a file or directory could
12699 -trigger an unmount and reveal data under a mount point.
12700 -
12701 -Signed-off-by: "Eric W. Biederman" <ebiederm@××××××××.com>
12702 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
12703 -Signed-off-by: Mike Pagano <mpagano@g.o>
12704 ----
12705 - fs/namespace.c | 8 ++++++--
12706 - 1 file changed, 6 insertions(+), 2 deletions(-)
12707 -
12708 -diff --git a/fs/namespace.c b/fs/namespace.c
12709 -index 9e33895..4622ee3 100644
12710 ---- a/fs/namespace.c
12711 -+++ b/fs/namespace.c
12712 -@@ -1350,6 +1350,7 @@ static inline void namespace_lock(void)
12713 - enum umount_tree_flags {
12714 - UMOUNT_SYNC = 1,
12715 - UMOUNT_PROPAGATE = 2,
12716 -+ UMOUNT_CONNECTED = 4,
12717 - };
12718 - /*
12719 - * mount_lock must be held
12720 -@@ -1388,7 +1389,10 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
12721 - if (how & UMOUNT_SYNC)
12722 - p->mnt.mnt_flags |= MNT_SYNC_UMOUNT;
12723 + int i2c_generic_gpio_recovery(struct i2c_adapter *adap)
12724 + {
12725 +@@ -610,6 +611,7 @@ int i2c_generic_gpio_recovery(struct i2c_adapter *adap)
12726
12727 -- disconnect = !IS_MNT_LOCKED_AND_LAZY(p);
12728 -+ disconnect = !(((how & UMOUNT_CONNECTED) &&
12729 -+ mnt_has_parent(p) &&
12730 -+ (p->mnt_parent->mnt.mnt_flags & MNT_UMOUNT)) ||
12731 -+ IS_MNT_LOCKED_AND_LAZY(p));
12732 + return ret;
12733 + }
12734 ++EXPORT_SYMBOL_GPL(i2c_generic_gpio_recovery);
12735
12736 - pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt,
12737 - disconnect ? &unmounted : NULL);
12738 -@@ -1531,7 +1535,7 @@ void __detach_mounts(struct dentry *dentry)
12739 - umount_mnt(p);
12740 - }
12741 - }
12742 -- else umount_tree(mnt, 0);
12743 -+ else umount_tree(mnt, UMOUNT_CONNECTED);
12744 - }
12745 - unlock_mount_hash();
12746 - put_mountpoint(mp);
12747 ---
12748 -2.3.6
12749 -
12750 -
12751 -From 85c75cd8131b5aa9fe4efc6400ae1d0631497720 Mon Sep 17 00:00:00 2001
12752 -From: Jarkko Sakkinen <jarkko.sakkinen@×××××××××××.com>
12753 -Date: Wed, 18 Mar 2015 08:17:14 +0200
12754 -Subject: [PATCH 119/219] tpm: fix: sanitized code paths in tpm_chip_register()
12755 -Cc: mpagano@g.o
12756 -
12757 -commit 34d47b6322087665be33ca3aa81775b143a4d7ac upstream.
12758 -
12759 -I started to work with PPI interface so that it would be available
12760 -under character device sysfs directory and realized that chip
12761 -registeration was still too messy.
12762 -
12763 -In TPM 1.x in some rare scenarios (errors that almost never occur)
12764 -wrong order in deinitialization steps was taken in teardown. I
12765 -reproduced these scenarios by manually inserting error codes in the
12766 -place of the corresponding function calls.
12767 -
12768 -The key problem is that the teardown is messy with two separate code
12769 -paths (this was inherited when moving code from tpm-interface.c).
12770 -
12771 -Moved TPM 1.x specific register/unregister functionality to own helper
12772 -functions and added single code path for teardown in tpm_chip_register().
12773 -Now the code paths have been fixed and it should be easier to review
12774 -later on this part of the code.
12775 -
12776 -Fixes: 7a1d7e6dd76a ("tpm: TPM 2.0 baseline support")
12777 -Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@×××××××××××.com>
12778 -Tested-by: Scot Doyle <lkml14@×××××××××.com>
12779 -Reviewed-by: Peter Huewe <peterhuewe@×××.de>
12780 -Signed-off-by: Peter Huewe <peterhuewe@×××.de>
12781 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
12782 -Signed-off-by: Mike Pagano <mpagano@g.o>
12783 ----
12784 - drivers/char/tpm/tpm-chip.c | 66 ++++++++++++++++++++++++++++-----------------
12785 - 1 file changed, 42 insertions(+), 24 deletions(-)
12786 -
12787 -diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
12788 -index e096e9c..283f00a 100644
12789 ---- a/drivers/char/tpm/tpm-chip.c
12790 -+++ b/drivers/char/tpm/tpm-chip.c
12791 -@@ -170,6 +170,41 @@ static void tpm_dev_del_device(struct tpm_chip *chip)
12792 - device_unregister(&chip->dev);
12793 + int i2c_recover_bus(struct i2c_adapter *adap)
12794 + {
12795 +@@ -619,6 +621,7 @@ int i2c_recover_bus(struct i2c_adapter *adap)
12796 + dev_dbg(&adap->dev, "Trying i2c bus recovery\n");
12797 + return adap->bus_recovery_info->recover_bus(adap);
12798 }
12799 ++EXPORT_SYMBOL_GPL(i2c_recover_bus);
12800
12801 -+static int tpm1_chip_register(struct tpm_chip *chip)
12802 -+{
12803 -+ int rc;
12804 -+
12805 -+ if (chip->flags & TPM_CHIP_FLAG_TPM2)
12806 -+ return 0;
12807 -+
12808 -+ rc = tpm_sysfs_add_device(chip);
12809 -+ if (rc)
12810 -+ return rc;
12811 -+
12812 -+ rc = tpm_add_ppi(chip);
12813 -+ if (rc) {
12814 -+ tpm_sysfs_del_device(chip);
12815 -+ return rc;
12816 -+ }
12817 -+
12818 -+ chip->bios_dir = tpm_bios_log_setup(chip->devname);
12819 -+
12820 -+ return 0;
12821 -+}
12822 -+
12823 -+static void tpm1_chip_unregister(struct tpm_chip *chip)
12824 -+{
12825 -+ if (chip->flags & TPM_CHIP_FLAG_TPM2)
12826 -+ return;
12827 + static int i2c_device_probe(struct device *dev)
12828 + {
12829 +@@ -1410,6 +1413,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
12830 +
12831 + dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name);
12832 +
12833 ++ pm_runtime_no_callbacks(&adap->dev);
12834 +
12835 -+ if (chip->bios_dir)
12836 -+ tpm_bios_log_teardown(chip->bios_dir);
12837 -+
12838 -+ tpm_remove_ppi(chip);
12839 -+
12840 -+ tpm_sysfs_del_device(chip);
12841 -+}
12842 -+
12843 - /*
12844 - * tpm_chip_register() - create a character device for the TPM chip
12845 - * @chip: TPM chip to use.
12846 -@@ -185,22 +220,13 @@ int tpm_chip_register(struct tpm_chip *chip)
12847 - {
12848 - int rc;
12849 + #ifdef CONFIG_I2C_COMPAT
12850 + res = class_compat_create_link(i2c_adapter_compat_class, &adap->dev,
12851 + adap->dev.parent);
12852 +diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
12853 +index 593f7ca..06cc1ff 100644
12854 +--- a/drivers/i2c/i2c-mux.c
12855 ++++ b/drivers/i2c/i2c-mux.c
12856 +@@ -32,8 +32,9 @@ struct i2c_mux_priv {
12857 + struct i2c_algorithm algo;
12858
12859 -- /* Populate sysfs for TPM1 devices. */
12860 -- if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
12861 -- rc = tpm_sysfs_add_device(chip);
12862 -- if (rc)
12863 -- goto del_misc;
12864 --
12865 -- rc = tpm_add_ppi(chip);
12866 -- if (rc)
12867 -- goto del_sysfs;
12868 --
12869 -- chip->bios_dir = tpm_bios_log_setup(chip->devname);
12870 -- }
12871 -+ rc = tpm1_chip_register(chip);
12872 -+ if (rc)
12873 -+ return rc;
12874 + struct i2c_adapter *parent;
12875 +- void *mux_priv; /* the mux chip/device */
12876 +- u32 chan_id; /* the channel id */
12877 ++ struct device *mux_dev;
12878 ++ void *mux_priv;
12879 ++ u32 chan_id;
12880
12881 - rc = tpm_dev_add_device(chip);
12882 - if (rc)
12883 -- return rc;
12884 -+ goto out_err;
12885 + int (*select)(struct i2c_adapter *, void *mux_priv, u32 chan_id);
12886 + int (*deselect)(struct i2c_adapter *, void *mux_priv, u32 chan_id);
12887 +@@ -119,6 +120,7 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
12888
12889 - /* Make the chip available. */
12890 - spin_lock(&driver_lock);
12891 -@@ -210,10 +236,8 @@ int tpm_chip_register(struct tpm_chip *chip)
12892 - chip->flags |= TPM_CHIP_FLAG_REGISTERED;
12893 + /* Set up private adapter data */
12894 + priv->parent = parent;
12895 ++ priv->mux_dev = mux_dev;
12896 + priv->mux_priv = mux_priv;
12897 + priv->chan_id = chan_id;
12898 + priv->select = select;
12899 +@@ -203,7 +205,7 @@ void i2c_del_mux_adapter(struct i2c_adapter *adap)
12900 + char symlink_name[20];
12901
12902 - return 0;
12903 --del_sysfs:
12904 -- tpm_sysfs_del_device(chip);
12905 --del_misc:
12906 -- tpm_dev_del_device(chip);
12907 -+out_err:
12908 -+ tpm1_chip_unregister(chip);
12909 - return rc;
12910 - }
12911 - EXPORT_SYMBOL_GPL(tpm_chip_register);
12912 -@@ -238,13 +262,7 @@ void tpm_chip_unregister(struct tpm_chip *chip)
12913 - spin_unlock(&driver_lock);
12914 - synchronize_rcu();
12915 + snprintf(symlink_name, sizeof(symlink_name), "channel-%u", priv->chan_id);
12916 +- sysfs_remove_link(&adap->dev.parent->kobj, symlink_name);
12917 ++ sysfs_remove_link(&priv->mux_dev->kobj, symlink_name);
12918
12919 -- if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
12920 -- if (chip->bios_dir)
12921 -- tpm_bios_log_teardown(chip->bios_dir);
12922 -- tpm_remove_ppi(chip);
12923 -- tpm_sysfs_del_device(chip);
12924 -- }
12925 --
12926 -+ tpm1_chip_unregister(chip);
12927 - tpm_dev_del_device(chip);
12928 - }
12929 - EXPORT_SYMBOL_GPL(tpm_chip_unregister);
12930 ---
12931 -2.3.6
12932 -
12933 -
12934 -From b0566aa080d2ab7f5810f5bdea53c02dfc78ff16 Mon Sep 17 00:00:00 2001
12935 -From: Vinson Lee <vlee@×××××××.com>
12936 -Date: Mon, 9 Feb 2015 16:29:37 -0800
12937 -Subject: [PATCH 120/219] perf symbols: Define STT_GNU_IFUNC for glibc 2.9 and
12938 - older.
12939 -MIME-Version: 1.0
12940 -Content-Type: text/plain; charset=UTF-8
12941 -Content-Transfer-Encoding: 8bit
12942 -Cc: mpagano@g.o
12943 -
12944 -commit 4e31050f482c02c822b150d71cf1ea5be7c9d6e4 upstream.
12945 -
12946 -The token STT_GNU_IFUNC is not available with glibc 2.9 and older.
12947 -Define this token if it is not already defined.
12948 -
12949 -This patch fixes this build errors with older versions of glibc.
12950 -
12951 - CC util/symbol-elf.o
12952 -util/symbol-elf.c: In function ‘elf_sym__is_function’:
12953 -util/symbol-elf.c:75: error: ‘STT_GNU_IFUNC’ undeclared (first use in this function)
12954 -util/symbol-elf.c:75: error: (Each undeclared identifier is reported only once
12955 -util/symbol-elf.c:75: error: for each function it appears in.)
12956 -make: *** [util/symbol-elf.o] Error 1
12957 -
12958 -Signed-off-by: Vinson Lee <vlee@×××××××.com>
12959 -Acked-by: Namhyung Kim <namhyung@××××××.org>
12960 -Cc: Adrian Hunter <adrian.hunter@×××××.com>
12961 -Cc: Anton Blanchard <anton@×××××.org>
12962 -Cc: Avi Kivity <avi@××××××××××××××××.com>
12963 -Cc: Jiri Olsa <jolsa@××××××.com>
12964 -Cc: Paul Mackerras <paulus@×××××.org>
12965 -Cc: Peter Zijlstra <a.p.zijlstra@××××××.nl>
12966 -Cc: Stephane Eranian <eranian@××××××.com>
12967 -Cc: Waiman Long <Waiman.Long@××.com>
12968 -Link: http://lkml.kernel.org/r/1423528286-13630-1-git-send-email-vlee@××××××××××××.com
12969 -Signed-off-by: Arnaldo Carvalho de Melo <acme@××××××.com>
12970 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
12971 -Signed-off-by: Mike Pagano <mpagano@g.o>
12972 ----
12973 - tools/perf/util/symbol-elf.c | 4 ++++
12974 - 1 file changed, 4 insertions(+)
12975 -
12976 -diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
12977 -index 33b7a2a..9bdf007 100644
12978 ---- a/tools/perf/util/symbol-elf.c
12979 -+++ b/tools/perf/util/symbol-elf.c
12980 -@@ -74,6 +74,10 @@ static inline uint8_t elf_sym__type(const GElf_Sym *sym)
12981 - return GELF_ST_TYPE(sym->st_info);
12982 - }
12983 + sysfs_remove_link(&priv->adap.dev.kobj, "mux_device");
12984 + i2c_del_adapter(adap);
12985 +diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
12986 +index b0e5852..44d1d79 100644
12987 +--- a/drivers/idle/intel_idle.c
12988 ++++ b/drivers/idle/intel_idle.c
12989 +@@ -218,18 +218,10 @@ static struct cpuidle_state byt_cstates[] = {
12990 + .enter = &intel_idle,
12991 + .enter_freeze = intel_idle_freeze, },
12992 + {
12993 +- .name = "C1E-BYT",
12994 +- .desc = "MWAIT 0x01",
12995 +- .flags = MWAIT2flg(0x01),
12996 +- .exit_latency = 15,
12997 +- .target_residency = 30,
12998 +- .enter = &intel_idle,
12999 +- .enter_freeze = intel_idle_freeze, },
13000 +- {
13001 + .name = "C6N-BYT",
13002 + .desc = "MWAIT 0x58",
13003 + .flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TLB_FLUSHED,
13004 +- .exit_latency = 40,
13005 ++ .exit_latency = 300,
13006 + .target_residency = 275,
13007 + .enter = &intel_idle,
13008 + .enter_freeze = intel_idle_freeze, },
13009 +@@ -237,7 +229,7 @@ static struct cpuidle_state byt_cstates[] = {
13010 + .name = "C6S-BYT",
13011 + .desc = "MWAIT 0x52",
13012 + .flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED,
13013 +- .exit_latency = 140,
13014 ++ .exit_latency = 500,
13015 + .target_residency = 560,
13016 + .enter = &intel_idle,
13017 + .enter_freeze = intel_idle_freeze, },
13018 +@@ -246,7 +238,7 @@ static struct cpuidle_state byt_cstates[] = {
13019 + .desc = "MWAIT 0x60",
13020 + .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
13021 + .exit_latency = 1200,
13022 +- .target_residency = 1500,
13023 ++ .target_residency = 4000,
13024 + .enter = &intel_idle,
13025 + .enter_freeze = intel_idle_freeze, },
13026 + {
13027 +diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
13028 +index 8c014b5..38acb3c 100644
13029 +--- a/drivers/infiniband/core/umem.c
13030 ++++ b/drivers/infiniband/core/umem.c
13031 +@@ -99,12 +99,15 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
13032 + if (dmasync)
13033 + dma_set_attr(DMA_ATTR_WRITE_BARRIER, &attrs);
13034
13035 -+#ifndef STT_GNU_IFUNC
13036 -+#define STT_GNU_IFUNC 10
13037 -+#endif
13038 ++ if (!size)
13039 ++ return ERR_PTR(-EINVAL);
13040 +
13041 - static inline int elf_sym__is_function(const GElf_Sym *sym)
13042 - {
13043 - return (elf_sym__type(sym) == STT_FUNC ||
13044 ---
13045 -2.3.6
13046 -
13047 -
13048 -From eefadbaae8af748e25d6fb903b56c6d3e38215b8 Mon Sep 17 00:00:00 2001
13049 -From: "H.J. Lu" <hjl.tools@×××××.com>
13050 -Date: Tue, 17 Mar 2015 15:27:48 -0700
13051 -Subject: [PATCH 121/219] perf tools: Fix perf-read-vdsox32 not building and
13052 - lib64 install dir
13053 -Cc: mpagano@g.o
13054 -
13055 -commit 76aea7731e7050c066943a1d7456ec6510702601 upstream.
13056 -
13057 -Commit:
13058 -
13059 - c6e5e9fbc3ea ("perf tools: Fix building error in x86_64 when dwarf unwind is on")
13060 -
13061 -removed the definition of IS_X86_64 but not all places using it, with
13062 -the consequence that perf-read-vdsox32 would not be built anymore, and
13063 -the default lib install directory was 'lib' instead of 'lib64'.
13064 -
13065 -Also needs to go to v3.19.
13066 -
13067 -Signed-off-by: H.J. Lu <hjl.tools@×××××.com>
13068 -Acked-by: Adrian Hunter <adrian.hunter@×××××.com>
13069 -Acked-by: Jiri Olsa <jolsa@××××××.org>
13070 -Link: http://lkml.kernel.org/r/CAMe9rOqpGVq3D88w+D15ef7sv6G6k57ZeTvxBm46=WFgzo9p1w@××××××××××.com
13071 -Signed-off-by: Arnaldo Carvalho de Melo <acme@××××××.com>
13072 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
13073 -Signed-off-by: Mike Pagano <mpagano@g.o>
13074 ----
13075 - tools/perf/config/Makefile | 4 ++--
13076 - tools/perf/tests/make | 2 +-
13077 - 2 files changed, 3 insertions(+), 3 deletions(-)
13078 -
13079 -diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
13080 -index cc22408..0884d31 100644
13081 ---- a/tools/perf/config/Makefile
13082 -+++ b/tools/perf/config/Makefile
13083 -@@ -651,7 +651,7 @@ ifeq (${IS_64_BIT}, 1)
13084 - NO_PERF_READ_VDSO32 := 1
13085 - endif
13086 - endif
13087 -- ifneq (${IS_X86_64}, 1)
13088 -+ ifneq ($(ARCH), x86)
13089 - NO_PERF_READ_VDSOX32 := 1
13090 - endif
13091 - ifndef NO_PERF_READ_VDSOX32
13092 -@@ -699,7 +699,7 @@ sysconfdir = $(prefix)/etc
13093 - ETC_PERFCONFIG = etc/perfconfig
13094 - endif
13095 - ifndef lib
13096 --ifeq ($(IS_X86_64),1)
13097 -+ifeq ($(ARCH)$(IS_64_BIT), x861)
13098 - lib = lib64
13099 - else
13100 - lib = lib
13101 -diff --git a/tools/perf/tests/make b/tools/perf/tests/make
13102 -index 75709d2..bff8532 100644
13103 ---- a/tools/perf/tests/make
13104 -+++ b/tools/perf/tests/make
13105 -@@ -5,7 +5,7 @@ include config/Makefile.arch
13106 + /*
13107 + * If the combination of the addr and size requested for this memory
13108 + * region causes an integer overflow, return error.
13109 + */
13110 +- if ((PAGE_ALIGN(addr + size) <= size) ||
13111 +- (PAGE_ALIGN(addr + size) <= addr))
13112 ++ if (((addr + size) < addr) ||
13113 ++ PAGE_ALIGN(addr + size) < (addr + size))
13114 + return ERR_PTR(-EINVAL);
13115
13116 - # FIXME looks like x86 is the only arch running tests ;-)
13117 - # we need some IS_(32/64) flag to make this generic
13118 --ifeq ($(IS_X86_64),1)
13119 -+ifeq ($(ARCH)$(IS_64_BIT), x861)
13120 - lib = lib64
13121 - else
13122 - lib = lib
13123 ---
13124 -2.3.6
13125 -
13126 -
13127 -From a245448568a6f791b7d4617e622adf6e7118d174 Mon Sep 17 00:00:00 2001
13128 -From: Vinson Lee <vlee@×××××××.com>
13129 -Date: Mon, 23 Mar 2015 12:09:16 -0700
13130 -Subject: [PATCH 122/219] perf tools: Work around lack of sched_getcpu in glibc
13131 - < 2.6.
13132 -MIME-Version: 1.0
13133 -Content-Type: text/plain; charset=UTF-8
13134 -Content-Transfer-Encoding: 8bit
13135 -Cc: mpagano@g.o
13136 -
13137 -commit e1e455f4f4d35850c30235747620d0d078fe9f64 upstream.
13138 -
13139 -This patch fixes this build error with glibc < 2.6.
13140 -
13141 - CC util/cloexec.o
13142 -cc1: warnings being treated as errors
13143 -util/cloexec.c: In function ‘perf_flag_probe’:
13144 -util/cloexec.c:24: error: implicit declaration of function
13145 -‘sched_getcpu’
13146 -util/cloexec.c:24: error: nested extern declaration of ‘sched_getcpu’
13147 -make: *** [util/cloexec.o] Error 1
13148 -
13149 -Signed-off-by: Vinson Lee <vlee@×××××××.com>
13150 -Acked-by: Jiri Olsa <jolsa@××××××.org>
13151 -Acked-by: Namhyung Kim <namhyung@××××××.org>
13152 -Cc: Adrian Hunter <adrian.hunter@×××××.com>
13153 -Cc: Masami Hiramatsu <masami.hiramatsu.pt@×××××××.com>
13154 -Cc: Paul Mackerras <paulus@×××××.org>
13155 -Cc: Peter Zijlstra <a.p.zijlstra@××××××.nl>
13156 -Cc: Yann Droneaud <ydroneaud@××××××.com>
13157 -Link: http://lkml.kernel.org/r/1427137761-16119-1-git-send-email-vlee@××××××××××××.com
13158 -Signed-off-by: Arnaldo Carvalho de Melo <acme@××××××.com>
13159 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
13160 -Signed-off-by: Mike Pagano <mpagano@g.o>
13161 ----
13162 - tools/perf/util/cloexec.c | 6 ++++++
13163 - tools/perf/util/cloexec.h | 6 ++++++
13164 - 2 files changed, 12 insertions(+)
13165 -
13166 -diff --git a/tools/perf/util/cloexec.c b/tools/perf/util/cloexec.c
13167 -index 6da965b..85b5238 100644
13168 ---- a/tools/perf/util/cloexec.c
13169 -+++ b/tools/perf/util/cloexec.c
13170 -@@ -7,6 +7,12 @@
13171 + if (!can_do_mlock())
13172 +diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
13173 +index ed2bd67..fbde33a 100644
13174 +--- a/drivers/infiniband/hw/mlx4/qp.c
13175 ++++ b/drivers/infiniband/hw/mlx4/qp.c
13176 +@@ -2605,8 +2605,7 @@ static int build_lso_seg(struct mlx4_wqe_lso_seg *wqe, struct ib_send_wr *wr,
13177
13178 - static unsigned long flag = PERF_FLAG_FD_CLOEXEC;
13179 + memcpy(wqe->header, wr->wr.ud.header, wr->wr.ud.hlen);
13180
13181 -+int __weak sched_getcpu(void)
13182 -+{
13183 -+ errno = ENOSYS;
13184 -+ return -1;
13185 -+}
13186 -+
13187 - static int perf_flag_probe(void)
13188 - {
13189 - /* use 'safest' configuration as used in perf_evsel__fallback() */
13190 -diff --git a/tools/perf/util/cloexec.h b/tools/perf/util/cloexec.h
13191 -index 94a5a7d..68888c2 100644
13192 ---- a/tools/perf/util/cloexec.h
13193 -+++ b/tools/perf/util/cloexec.h
13194 -@@ -3,4 +3,10 @@
13195 +- *lso_hdr_sz = cpu_to_be32((wr->wr.ud.mss - wr->wr.ud.hlen) << 16 |
13196 +- wr->wr.ud.hlen);
13197 ++ *lso_hdr_sz = cpu_to_be32(wr->wr.ud.mss << 16 | wr->wr.ud.hlen);
13198 + *lso_seg_len = halign;
13199 + return 0;
13200 + }
13201 +diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
13202 +index 20e859a..76eb57b 100644
13203 +--- a/drivers/infiniband/ulp/iser/iser_initiator.c
13204 ++++ b/drivers/infiniband/ulp/iser/iser_initiator.c
13205 +@@ -409,8 +409,8 @@ int iser_send_command(struct iscsi_conn *conn,
13206 + if (scsi_prot_sg_count(sc)) {
13207 + prot_buf->buf = scsi_prot_sglist(sc);
13208 + prot_buf->size = scsi_prot_sg_count(sc);
13209 +- prot_buf->data_len = data_buf->data_len >>
13210 +- ilog2(sc->device->sector_size) * 8;
13211 ++ prot_buf->data_len = (data_buf->data_len >>
13212 ++ ilog2(sc->device->sector_size)) * 8;
13213 + }
13214
13215 - unsigned long perf_event_open_cloexec_flag(void);
13216 + if (hdr->flags & ISCSI_FLAG_CMD_READ) {
13217 +diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
13218 +index 075b19c..147029a 100644
13219 +--- a/drivers/infiniband/ulp/isert/ib_isert.c
13220 ++++ b/drivers/infiniband/ulp/isert/ib_isert.c
13221 +@@ -222,7 +222,7 @@ fail:
13222 + static void
13223 + isert_free_rx_descriptors(struct isert_conn *isert_conn)
13224 + {
13225 +- struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
13226 ++ struct ib_device *ib_dev = isert_conn->conn_device->ib_device;
13227 + struct iser_rx_desc *rx_desc;
13228 + int i;
13229
13230 -+#ifdef __GLIBC_PREREQ
13231 -+#if !__GLIBC_PREREQ(2, 6)
13232 -+extern int sched_getcpu(void) __THROW;
13233 -+#endif
13234 -+#endif
13235 -+
13236 - #endif /* __PERF_CLOEXEC_H */
13237 ---
13238 -2.3.6
13239 -
13240 -
13241 -From beda5943f15926783dc6768e8f821266ae6e8fb3 Mon Sep 17 00:00:00 2001
13242 -From: Anton Blanchard <anton@×××××.org>
13243 -Date: Tue, 14 Apr 2015 07:51:03 +1000
13244 -Subject: [PATCH 123/219] powerpc/perf: Cap 64bit userspace backtraces to
13245 - PERF_MAX_STACK_DEPTH
13246 -Cc: mpagano@g.o
13247 -
13248 -commit 9a5cbce421a283e6aea3c4007f141735bf9da8c3 upstream.
13249 -
13250 -We cap 32bit userspace backtraces to PERF_MAX_STACK_DEPTH
13251 -(currently 127), but we forgot to do the same for 64bit backtraces.
13252 -
13253 -Signed-off-by: Anton Blanchard <anton@×××××.org>
13254 -Signed-off-by: Michael Ellerman <mpe@×××××××××××.au>
13255 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
13256 -Signed-off-by: Mike Pagano <mpagano@g.o>
13257 ----
13258 - arch/powerpc/perf/callchain.c | 2 +-
13259 - 1 file changed, 1 insertion(+), 1 deletion(-)
13260 -
13261 -diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c
13262 -index 2396dda..ead5535 100644
13263 ---- a/arch/powerpc/perf/callchain.c
13264 -+++ b/arch/powerpc/perf/callchain.c
13265 -@@ -243,7 +243,7 @@ static void perf_callchain_user_64(struct perf_callchain_entry *entry,
13266 - sp = regs->gpr[1];
13267 - perf_callchain_store(entry, next_ip);
13268 +@@ -719,8 +719,8 @@ out:
13269 + static void
13270 + isert_connect_release(struct isert_conn *isert_conn)
13271 + {
13272 +- struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
13273 + struct isert_device *device = isert_conn->conn_device;
13274 ++ struct ib_device *ib_dev = device->ib_device;
13275
13276 -- for (;;) {
13277 -+ while (entry->nr < PERF_MAX_STACK_DEPTH) {
13278 - fp = (unsigned long __user *) sp;
13279 - if (!valid_user_sp(sp, 1) || read_user_stack_64(fp, &next_sp))
13280 - return;
13281 ---
13282 -2.3.6
13283 -
13284 -
13285 -From f0289e90ac96271337d6d0f9c9a6ceb2aea62a05 Mon Sep 17 00:00:00 2001
13286 -From: "Steven Rostedt (Red Hat)" <rostedt@×××××××.org>
13287 -Date: Tue, 24 Mar 2015 09:57:55 -0400
13288 -Subject: [PATCH 124/219] tools lib traceevent kbuffer: Remove extra update to
13289 - data pointer in PADDING
13290 -Cc: mpagano@g.o
13291 -
13292 -commit c5e691928bf166ac03430e957038b60adba3cf6c upstream.
13293 -
13294 -When a event PADDING is hit (a deleted event that is still in the ring
13295 -buffer), translate_data() sets the length of the padding and also updates
13296 -the data pointer which is passed back to the caller.
13297 -
13298 -This is unneeded because the caller also updates the data pointer with
13299 -the passed back length. translate_data() should not update the pointer,
13300 -only set the length.
13301 -
13302 -Signed-off-by: Steven Rostedt <rostedt@×××××××.org>
13303 -Cc: Andrew Morton <akpm@××××××××××××××××.org>
13304 -Cc: Jiri Olsa <jolsa@××××××.com>
13305 -Cc: Namhyung Kim <namhyung@××××××.org>
13306 -Link: http://lkml.kernel.org/r/20150324135923.461431960@×××××××.org
13307 -Signed-off-by: Arnaldo Carvalho de Melo <acme@××××××.com>
13308 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
13309 -Signed-off-by: Mike Pagano <mpagano@g.o>
13310 ----
13311 - tools/lib/traceevent/kbuffer-parse.c | 1 -
13312 - 1 file changed, 1 deletion(-)
13313 -
13314 -diff --git a/tools/lib/traceevent/kbuffer-parse.c b/tools/lib/traceevent/kbuffer-parse.c
13315 -index dcc6652..deb3569 100644
13316 ---- a/tools/lib/traceevent/kbuffer-parse.c
13317 -+++ b/tools/lib/traceevent/kbuffer-parse.c
13318 -@@ -372,7 +372,6 @@ translate_data(struct kbuffer *kbuf, void *data, void **rptr,
13319 - switch (type_len) {
13320 - case KBUFFER_TYPE_PADDING:
13321 - *length = read_4(kbuf, data);
13322 -- data += *length;
13323 - break;
13324 + isert_dbg("conn %p\n", isert_conn);
13325
13326 - case KBUFFER_TYPE_TIME_EXTEND:
13327 ---
13328 -2.3.6
13329 -
13330 -
13331 -From e5e82af52cd373fed10be67faba90cd2eed6fb17 Mon Sep 17 00:00:00 2001
13332 -From: Thomas D <whissi@××××××.de>
13333 -Date: Mon, 5 Jan 2015 21:37:23 +0100
13334 -Subject: [PATCH 125/219] tools/power turbostat: Use $(CURDIR) instead of
13335 - $(PWD) and add support for O= option in Makefile
13336 -Cc: mpagano@g.o
13337 -
13338 -commit f82263c6989c31ae9b94cecddffb29dcbec38710 upstream.
13339 -
13340 -Since commit ee0778a30153
13341 -("tools/power: turbostat: make Makefile a bit more capable")
13342 -turbostat's Makefile is using
13343 -
13344 - [...]
13345 - BUILD_OUTPUT := $(PWD)
13346 - [...]
13347 -
13348 -which obviously causes trouble when building "turbostat" with
13349 -
13350 - make -C /usr/src/linux/tools/power/x86/turbostat ARCH=x86 turbostat
13351 -
13352 -because GNU make does not update nor guarantee that $PWD is set.
13353 -
13354 -This patch changes the Makefile to use $CURDIR instead, which GNU make
13355 -guarantees to set and update (i.e. when using "make -C ...") and also
13356 -adds support for the O= option (see "make help" in your root of your
13357 -kernel source tree for more details).
13358 -
13359 -Link: https://bugs.gentoo.org/show_bug.cgi?id=533918
13360 -Fixes: ee0778a30153 ("tools/power: turbostat: make Makefile a bit more capable")
13361 -Signed-off-by: Thomas D. <whissi@××××××.de>
13362 -Cc: Mark Asselstine <mark.asselstine@×××××××××.com>
13363 -Signed-off-by: Len Brown <len.brown@×××××.com>
13364 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
13365 -Signed-off-by: Mike Pagano <mpagano@g.o>
13366 ----
13367 - tools/power/x86/turbostat/Makefile | 6 +++++-
13368 - 1 file changed, 5 insertions(+), 1 deletion(-)
13369 -
13370 -diff --git a/tools/power/x86/turbostat/Makefile b/tools/power/x86/turbostat/Makefile
13371 -index d1b3a36..4039854 100644
13372 ---- a/tools/power/x86/turbostat/Makefile
13373 -+++ b/tools/power/x86/turbostat/Makefile
13374 -@@ -1,8 +1,12 @@
13375 - CC = $(CROSS_COMPILE)gcc
13376 --BUILD_OUTPUT := $(PWD)
13377 -+BUILD_OUTPUT := $(CURDIR)
13378 - PREFIX := /usr
13379 - DESTDIR :=
13380 +@@ -728,7 +728,8 @@ isert_connect_release(struct isert_conn *isert_conn)
13381 + isert_conn_free_fastreg_pool(isert_conn);
13382
13383 -+ifeq ("$(origin O)", "command line")
13384 -+ BUILD_OUTPUT := $(O)
13385 -+endif
13386 -+
13387 - turbostat : turbostat.c
13388 - CFLAGS += -Wall
13389 - CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/uapi/asm/msr-index.h"'
13390 ---
13391 -2.3.6
13392 -
13393 -
13394 -From 67e9563f2e494959696ff3128cf9d5fb1b3dbad7 Mon Sep 17 00:00:00 2001
13395 -From: Brian Norris <computersforpeace@×××××.com>
13396 -Date: Sat, 28 Feb 2015 02:23:25 -0800
13397 -Subject: [PATCH 126/219] UBI: account for bitflips in both the VID header and
13398 - data
13399 -Cc: mpagano@g.o
13400 -
13401 -commit 8eef7d70f7c6772c3490f410ee2bceab3b543fa1 upstream.
13402 -
13403 -We are completely discarding the earlier value of 'bitflips', which
13404 -could reflect a bitflip found in ubi_io_read_vid_hdr(). Let's use the
13405 -bitwise OR of header and data 'bitflip' statuses instead.
13406 -
13407 -Coverity CID #1226856
13408 -
13409 -Signed-off-by: Brian Norris <computersforpeace@×××××.com>
13410 -Signed-off-by: Richard Weinberger <richard@×××.at>
13411 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
13412 -Signed-off-by: Mike Pagano <mpagano@g.o>
13413 ----
13414 - drivers/mtd/ubi/attach.c | 2 +-
13415 - 1 file changed, 1 insertion(+), 1 deletion(-)
13416 -
13417 -diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
13418 -index 9d2e16f..b5e1548 100644
13419 ---- a/drivers/mtd/ubi/attach.c
13420 -+++ b/drivers/mtd/ubi/attach.c
13421 -@@ -410,7 +410,7 @@ int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb,
13422 - second_is_newer = !second_is_newer;
13423 - } else {
13424 - dbg_bld("PEB %d CRC is OK", pnum);
13425 -- bitflips = !!err;
13426 -+ bitflips |= !!err;
13427 - }
13428 - mutex_unlock(&ubi->buf_mutex);
13429 + isert_free_rx_descriptors(isert_conn);
13430 +- rdma_destroy_id(isert_conn->conn_cm_id);
13431 ++ if (isert_conn->conn_cm_id)
13432 ++ rdma_destroy_id(isert_conn->conn_cm_id);
13433
13434 ---
13435 -2.3.6
13436 -
13437 -
13438 -From 921b47c10b2b18b3562152aa0eacc1b2e56c6996 Mon Sep 17 00:00:00 2001
13439 -From: Brian Norris <computersforpeace@×××××.com>
13440 -Date: Sat, 28 Feb 2015 02:23:26 -0800
13441 -Subject: [PATCH 127/219] UBI: fix out of bounds write
13442 -Cc: mpagano@g.o
13443 -
13444 -commit d74adbdb9abf0d2506a6c4afa534d894f28b763f upstream.
13445 -
13446 -If aeb->len >= vol->reserved_pebs, we should not be writing aeb into the
13447 -PEB->LEB mapping.
13448 -
13449 -Caught by Coverity, CID #711212.
13450 -
13451 -Signed-off-by: Brian Norris <computersforpeace@×××××.com>
13452 -Signed-off-by: Richard Weinberger <richard@×××.at>
13453 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
13454 -Signed-off-by: Mike Pagano <mpagano@g.o>
13455 ----
13456 - drivers/mtd/ubi/eba.c | 3 ++-
13457 - 1 file changed, 2 insertions(+), 1 deletion(-)
13458 -
13459 -diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
13460 -index 16e34b3..8c9a710 100644
13461 ---- a/drivers/mtd/ubi/eba.c
13462 -+++ b/drivers/mtd/ubi/eba.c
13463 -@@ -1419,7 +1419,8 @@ int ubi_eba_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
13464 - * during re-size.
13465 - */
13466 - ubi_move_aeb_to_list(av, aeb, &ai->erase);
13467 -- vol->eba_tbl[aeb->lnum] = aeb->pnum;
13468 -+ else
13469 -+ vol->eba_tbl[aeb->lnum] = aeb->pnum;
13470 - }
13471 - }
13472 + if (isert_conn->conn_qp) {
13473 + struct isert_comp *comp = isert_conn->conn_qp->recv_cq->cq_context;
13474 +@@ -878,12 +879,15 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id,
13475 + return 0;
13476 + }
13477
13478 ---
13479 -2.3.6
13480 -
13481 -
13482 -From 5a156e848f96a0f0024ef94a3e19979f8f7e9dbc Mon Sep 17 00:00:00 2001
13483 -From: Brian Norris <computersforpeace@×××××.com>
13484 -Date: Sat, 28 Feb 2015 02:23:27 -0800
13485 -Subject: [PATCH 128/219] UBI: initialize LEB number variable
13486 -Cc: mpagano@g.o
13487 -
13488 -commit f16db8071ce18819fbd705ddcc91c6f392fb61f8 upstream.
13489 -
13490 -In some of the 'out_not_moved' error paths, lnum may be used
13491 -uninitialized. Don't ignore the warning; let's fix it.
13492 -
13493 -This uninitialized variable doesn't have much visible effect in the end,
13494 -since we just schedule the PEB for erasure, and its LEB number doesn't
13495 -really matter (it just gets printed in debug messages). But let's get it
13496 -straight anyway.
13497 -
13498 -Coverity CID #113449
13499 -
13500 -Signed-off-by: Brian Norris <computersforpeace@×××××.com>
13501 -Signed-off-by: Richard Weinberger <richard@×××.at>
13502 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
13503 -Signed-off-by: Mike Pagano <mpagano@g.o>
13504 ----
13505 - drivers/mtd/ubi/wl.c | 2 +-
13506 - 1 file changed, 1 insertion(+), 1 deletion(-)
13507 -
13508 -diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
13509 -index 8f7bde6..0bd92d8 100644
13510 ---- a/drivers/mtd/ubi/wl.c
13511 -+++ b/drivers/mtd/ubi/wl.c
13512 -@@ -1002,7 +1002,7 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
13513 - int shutdown)
13514 +-static void
13515 ++static int
13516 + isert_connect_error(struct rdma_cm_id *cma_id)
13517 {
13518 - int err, scrubbing = 0, torture = 0, protect = 0, erroneous = 0;
13519 -- int vol_id = -1, uninitialized_var(lnum);
13520 -+ int vol_id = -1, lnum = -1;
13521 - #ifdef CONFIG_MTD_UBI_FASTMAP
13522 - int anchor = wrk->anchor;
13523 - #endif
13524 ---
13525 -2.3.6
13526 -
13527 -
13528 -From 075831830ff0277572a93633cce3807394955358 Mon Sep 17 00:00:00 2001
13529 -From: Brian Norris <computersforpeace@×××××.com>
13530 -Date: Sat, 28 Feb 2015 02:23:28 -0800
13531 -Subject: [PATCH 129/219] UBI: fix check for "too many bytes"
13532 -Cc: mpagano@g.o
13533 -
13534 -commit 299d0c5b27346a77a0777c993372bf8777d4f2e5 upstream.
13535 -
13536 -The comparison from the previous line seems to have been erroneously
13537 -(partially) copied-and-pasted onto the next. The second line should be
13538 -checking req.bytes, not req.lnum.
13539 -
13540 -Coverity CID #139400
13541 -
13542 -Signed-off-by: Brian Norris <computersforpeace@×××××.com>
13543 -[rw: Fixed comparison]
13544 -Signed-off-by: Richard Weinberger <richard@×××.at>
13545 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
13546 -
13547 -Signed-off-by: Mike Pagano <mpagano@g.o>
13548 ----
13549 - drivers/mtd/ubi/cdev.c | 2 +-
13550 - 1 file changed, 1 insertion(+), 1 deletion(-)
13551 -
13552 -diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
13553 -index d647e50..d16fccf 100644
13554 ---- a/drivers/mtd/ubi/cdev.c
13555 -+++ b/drivers/mtd/ubi/cdev.c
13556 -@@ -455,7 +455,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
13557 - /* Validate the request */
13558 - err = -EINVAL;
13559 - if (req.lnum < 0 || req.lnum >= vol->reserved_pebs ||
13560 -- req.bytes < 0 || req.lnum >= vol->usable_leb_size)
13561 -+ req.bytes < 0 || req.bytes > vol->usable_leb_size)
13562 - break;
13563 -
13564 - err = get_exclusive(desc);
13565 ---
13566 -2.3.6
13567 -
13568 -
13569 -From 1d05935b31efb2e398e1772b76a6513b9484574a Mon Sep 17 00:00:00 2001
13570 -From: "K. Y. Srinivasan" <kys@×××××××××.com>
13571 -Date: Fri, 27 Mar 2015 00:27:18 -0700
13572 -Subject: [PATCH 130/219] scsi: storvsc: Fix a bug in copy_from_bounce_buffer()
13573 -Cc: mpagano@g.o
13574 -
13575 -commit 8de580742fee8bc34d116f57a20b22b9a5f08403 upstream.
13576 -
13577 -We may exit this function without properly freeing up the maapings
13578 -we may have acquired. Fix the bug.
13579 -
13580 -Signed-off-by: K. Y. Srinivasan <kys@×××××××××.com>
13581 -Reviewed-by: Long Li <longli@×××××××××.com>
13582 -Signed-off-by: James Bottomley <JBottomley@××××.com>
13583 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
13584 -Signed-off-by: Mike Pagano <mpagano@g.o>
13585 ----
13586 - drivers/scsi/storvsc_drv.c | 15 ++++++++-------
13587 - 1 file changed, 8 insertions(+), 7 deletions(-)
13588 -
13589 -diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
13590 -index efc6e44..bf8c5c1 100644
13591 ---- a/drivers/scsi/storvsc_drv.c
13592 -+++ b/drivers/scsi/storvsc_drv.c
13593 -@@ -746,21 +746,22 @@ static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl,
13594 - if (bounce_sgl[j].length == PAGE_SIZE) {
13595 - /* full..move to next entry */
13596 - sg_kunmap_atomic(bounce_addr);
13597 -+ bounce_addr = 0;
13598 - j++;
13599 -+ }
13600 -
13601 -- /* if we need to use another bounce buffer */
13602 -- if (srclen || i != orig_sgl_count - 1)
13603 -- bounce_addr = sg_kmap_atomic(bounce_sgl,j);
13604 -+ /* if we need to use another bounce buffer */
13605 -+ if (srclen && bounce_addr == 0)
13606 -+ bounce_addr = sg_kmap_atomic(bounce_sgl, j);
13607 -
13608 -- } else if (srclen == 0 && i == orig_sgl_count - 1) {
13609 -- /* unmap the last bounce that is < PAGE_SIZE */
13610 -- sg_kunmap_atomic(bounce_addr);
13611 -- }
13612 - }
13613 -
13614 - sg_kunmap_atomic(src_addr - orig_sgl[i].offset);
13615 - }
13616 + struct isert_conn *isert_conn = cma_id->qp->qp_context;
13617
13618 -+ if (bounce_addr)
13619 -+ sg_kunmap_atomic(bounce_addr);
13620 ++ isert_conn->conn_cm_id = NULL;
13621 + isert_put_conn(isert_conn);
13622 +
13623 - local_irq_restore(flags);
13624 ++ return -1;
13625 + }
13626
13627 - return total_copied;
13628 ---
13629 -2.3.6
13630 -
13631 -
13632 -From 7f61df07930dae7b1a94f088365362a191d2f4ec Mon Sep 17 00:00:00 2001
13633 -From: Nicholas Bellinger <nab@×××××××××××.org>
13634 -Date: Thu, 26 Feb 2015 22:19:15 -0800
13635 -Subject: [PATCH 131/219] iscsi-target: Convert iscsi_thread_set usage to
13636 - kthread.h
13637 -Cc: mpagano@g.o
13638 -
13639 -commit 88dcd2dab5c23b1c9cfc396246d8f476c872f0ca upstream.
13640 -
13641 -This patch converts iscsi-target code to use modern kthread.h API
13642 -callers for creating RX/TX threads for each new iscsi_conn descriptor,
13643 -and releasing associated RX/TX threads during connection shutdown.
13644 -
13645 -This is done using iscsit_start_kthreads() -> kthread_run() to start
13646 -new kthreads from within iscsi_post_login_handler(), and invoking
13647 -kthread_stop() from existing iscsit_close_connection() code.
13648 -
13649 -Also, convert iscsit_logout_post_handler_closesession() code to use
13650 -cmpxchg when determing when iscsit_cause_connection_reinstatement()
13651 -needs to sleep waiting for completion.
13652 -
13653 -Reported-by: Sagi Grimberg <sagig@××××××××.com>
13654 -Tested-by: Sagi Grimberg <sagig@××××××××.com>
13655 -Cc: Slava Shwartsman <valyushash@×××××.com>
13656 -Signed-off-by: Nicholas Bellinger <nab@×××××××××××.org>
13657 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
13658 -Signed-off-by: Mike Pagano <mpagano@g.o>
13659 ----
13660 - drivers/target/iscsi/iscsi_target.c | 104 +++++++++++++-----------------
13661 - drivers/target/iscsi/iscsi_target_erl0.c | 13 ++--
13662 - drivers/target/iscsi/iscsi_target_login.c | 59 +++++++++++++++--
13663 - include/target/iscsi/iscsi_target_core.h | 7 ++
13664 - 4 files changed, 114 insertions(+), 69 deletions(-)
13665 -
13666 -diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
13667 -index 77d6425..5e35612 100644
13668 ---- a/drivers/target/iscsi/iscsi_target.c
13669 -+++ b/drivers/target/iscsi/iscsi_target.c
13670 -@@ -537,7 +537,7 @@ static struct iscsit_transport iscsi_target_transport = {
13671 + static int
13672 +@@ -912,7 +916,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
13673 + case RDMA_CM_EVENT_REJECTED: /* FALLTHRU */
13674 + case RDMA_CM_EVENT_UNREACHABLE: /* FALLTHRU */
13675 + case RDMA_CM_EVENT_CONNECT_ERROR:
13676 +- isert_connect_error(cma_id);
13677 ++ ret = isert_connect_error(cma_id);
13678 + break;
13679 + default:
13680 + isert_err("Unhandled RDMA CMA event: %d\n", event->event);
13681 +@@ -1861,11 +1865,13 @@ isert_completion_rdma_read(struct iser_tx_desc *tx_desc,
13682 + cmd->i_state = ISTATE_RECEIVED_LAST_DATAOUT;
13683 + spin_unlock_bh(&cmd->istate_lock);
13684
13685 - static int __init iscsi_target_init_module(void)
13686 - {
13687 -- int ret = 0;
13688 -+ int ret = 0, size;
13689 +- if (ret)
13690 ++ if (ret) {
13691 ++ target_put_sess_cmd(se_cmd->se_sess, se_cmd);
13692 + transport_send_check_condition_and_sense(se_cmd,
13693 + se_cmd->pi_err, 0);
13694 +- else
13695 ++ } else {
13696 + target_execute_cmd(se_cmd);
13697 ++ }
13698 + }
13699
13700 - pr_debug("iSCSI-Target "ISCSIT_VERSION"\n");
13701 + static void
13702 +diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
13703 +index 27bcdbc..ea6cb64 100644
13704 +--- a/drivers/input/mouse/alps.c
13705 ++++ b/drivers/input/mouse/alps.c
13706 +@@ -1159,13 +1159,14 @@ static void alps_report_bare_ps2_packet(struct psmouse *psmouse,
13707 + bool report_buttons)
13708 + {
13709 + struct alps_data *priv = psmouse->private;
13710 +- struct input_dev *dev;
13711 ++ struct input_dev *dev, *dev2 = NULL;
13712
13713 -@@ -546,6 +546,7 @@ static int __init iscsi_target_init_module(void)
13714 - pr_err("Unable to allocate memory for iscsit_global\n");
13715 - return -1;
13716 + /* Figure out which device to use to report the bare packet */
13717 + if (priv->proto_version == ALPS_PROTO_V2 &&
13718 + (priv->flags & ALPS_DUALPOINT)) {
13719 + /* On V2 devices the DualPoint Stick reports bare packets */
13720 + dev = priv->dev2;
13721 ++ dev2 = psmouse->dev;
13722 + } else if (unlikely(IS_ERR_OR_NULL(priv->dev3))) {
13723 + /* Register dev3 mouse if we received PS/2 packet first time */
13724 + if (!IS_ERR(priv->dev3))
13725 +@@ -1177,7 +1178,7 @@ static void alps_report_bare_ps2_packet(struct psmouse *psmouse,
13726 }
13727 -+ spin_lock_init(&iscsit_global->ts_bitmap_lock);
13728 - mutex_init(&auth_id_lock);
13729 - spin_lock_init(&sess_idr_lock);
13730 - idr_init(&tiqn_idr);
13731 -@@ -555,15 +556,11 @@ static int __init iscsi_target_init_module(void)
13732 - if (ret < 0)
13733 - goto out;
13734
13735 -- ret = iscsi_thread_set_init();
13736 -- if (ret < 0)
13737 -+ size = BITS_TO_LONGS(ISCSIT_BITMAP_BITS) * sizeof(long);
13738 -+ iscsit_global->ts_bitmap = vzalloc(size);
13739 -+ if (!iscsit_global->ts_bitmap) {
13740 -+ pr_err("Unable to allocate iscsit_global->ts_bitmap\n");
13741 - goto configfs_out;
13742 --
13743 -- if (iscsi_allocate_thread_sets(TARGET_THREAD_SET_COUNT) !=
13744 -- TARGET_THREAD_SET_COUNT) {
13745 -- pr_err("iscsi_allocate_thread_sets() returned"
13746 -- " unexpected value!\n");
13747 -- goto ts_out1;
13748 - }
13749 + if (report_buttons)
13750 +- alps_report_buttons(dev, NULL,
13751 ++ alps_report_buttons(dev, dev2,
13752 + packet[0] & 1, packet[0] & 2, packet[0] & 4);
13753
13754 - lio_qr_cache = kmem_cache_create("lio_qr_cache",
13755 -@@ -572,7 +569,7 @@ static int __init iscsi_target_init_module(void)
13756 - if (!lio_qr_cache) {
13757 - pr_err("nable to kmem_cache_create() for"
13758 - " lio_qr_cache\n");
13759 -- goto ts_out2;
13760 -+ goto bitmap_out;
13761 - }
13762 + input_report_rel(dev, REL_X,
13763 +diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
13764 +index 6e22682..991dc6b 100644
13765 +--- a/drivers/input/mouse/elantech.c
13766 ++++ b/drivers/input/mouse/elantech.c
13767 +@@ -893,6 +893,21 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse)
13768 + }
13769
13770 - lio_dr_cache = kmem_cache_create("lio_dr_cache",
13771 -@@ -617,10 +614,8 @@ dr_out:
13772 - kmem_cache_destroy(lio_dr_cache);
13773 - qr_out:
13774 - kmem_cache_destroy(lio_qr_cache);
13775 --ts_out2:
13776 -- iscsi_deallocate_thread_sets();
13777 --ts_out1:
13778 -- iscsi_thread_set_free();
13779 -+bitmap_out:
13780 -+ vfree(iscsit_global->ts_bitmap);
13781 - configfs_out:
13782 - iscsi_target_deregister_configfs();
13783 - out:
13784 -@@ -630,8 +625,6 @@ out:
13785 + /*
13786 ++ * This writes the reg_07 value again to the hardware at the end of every
13787 ++ * set_rate call because the register loses its value. reg_07 allows setting
13788 ++ * absolute mode on v4 hardware
13789 ++ */
13790 ++static void elantech_set_rate_restore_reg_07(struct psmouse *psmouse,
13791 ++ unsigned int rate)
13792 ++{
13793 ++ struct elantech_data *etd = psmouse->private;
13794 ++
13795 ++ etd->original_set_rate(psmouse, rate);
13796 ++ if (elantech_write_reg(psmouse, 0x07, etd->reg_07))
13797 ++ psmouse_err(psmouse, "restoring reg_07 failed\n");
13798 ++}
13799 ++
13800 ++/*
13801 + * Put the touchpad into absolute mode
13802 + */
13803 + static int elantech_set_absolute_mode(struct psmouse *psmouse)
13804 +@@ -1094,6 +1109,8 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse,
13805 + * Asus K53SV 0x450f01 78, 15, 0c 2 hw buttons
13806 + * Asus G46VW 0x460f02 00, 18, 0c 2 hw buttons
13807 + * Asus G750JX 0x360f00 00, 16, 0c 2 hw buttons
13808 ++ * Asus TP500LN 0x381f17 10, 14, 0e clickpad
13809 ++ * Asus X750JN 0x381f17 10, 14, 0e clickpad
13810 + * Asus UX31 0x361f00 20, 15, 0e clickpad
13811 + * Asus UX32VD 0x361f02 00, 15, 0e clickpad
13812 + * Avatar AVIU-145A2 0x361f00 ? clickpad
13813 +@@ -1635,6 +1652,11 @@ int elantech_init(struct psmouse *psmouse)
13814 + goto init_fail;
13815 + }
13816
13817 - static void __exit iscsi_target_cleanup_module(void)
13818 - {
13819 -- iscsi_deallocate_thread_sets();
13820 -- iscsi_thread_set_free();
13821 - iscsit_release_discovery_tpg();
13822 - iscsit_unregister_transport(&iscsi_target_transport);
13823 - kmem_cache_destroy(lio_qr_cache);
13824 -@@ -641,6 +634,7 @@ static void __exit iscsi_target_cleanup_module(void)
13825 ++ if (etd->fw_version == 0x381f17) {
13826 ++ etd->original_set_rate = psmouse->set_rate;
13827 ++ psmouse->set_rate = elantech_set_rate_restore_reg_07;
13828 ++ }
13829 ++
13830 + if (elantech_set_input_params(psmouse)) {
13831 + psmouse_err(psmouse, "failed to query touchpad range.\n");
13832 + goto init_fail;
13833 +diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
13834 +index 6f3afec..f965d15 100644
13835 +--- a/drivers/input/mouse/elantech.h
13836 ++++ b/drivers/input/mouse/elantech.h
13837 +@@ -142,6 +142,7 @@ struct elantech_data {
13838 + struct finger_pos mt[ETP_MAX_FINGERS];
13839 + unsigned char parity[256];
13840 + int (*send_cmd)(struct psmouse *psmouse, unsigned char c, unsigned char *param);
13841 ++ void (*original_set_rate)(struct psmouse *psmouse, unsigned int rate);
13842 + };
13843
13844 - iscsi_target_deregister_configfs();
13845 + #ifdef CONFIG_MOUSE_PS2_ELANTECH
13846 +diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
13847 +index 713a962..41473929 100644
13848 +--- a/drivers/md/dm-crypt.c
13849 ++++ b/drivers/md/dm-crypt.c
13850 +@@ -925,11 +925,10 @@ static int crypt_convert(struct crypt_config *cc,
13851
13852 -+ vfree(iscsit_global->ts_bitmap);
13853 - kfree(iscsit_global);
13854 - }
13855 + switch (r) {
13856 + /* async */
13857 ++ case -EINPROGRESS:
13858 + case -EBUSY:
13859 + wait_for_completion(&ctx->restart);
13860 + reinit_completion(&ctx->restart);
13861 +- /* fall through*/
13862 +- case -EINPROGRESS:
13863 + ctx->req = NULL;
13864 + ctx->cc_sector++;
13865 + continue;
13866 +@@ -1346,10 +1345,8 @@ static void kcryptd_async_done(struct crypto_async_request *async_req,
13867 + struct dm_crypt_io *io = container_of(ctx, struct dm_crypt_io, ctx);
13868 + struct crypt_config *cc = io->cc;
13869
13870 -@@ -3715,17 +3709,16 @@ static int iscsit_send_reject(
13871 +- if (error == -EINPROGRESS) {
13872 +- complete(&ctx->restart);
13873 ++ if (error == -EINPROGRESS)
13874 + return;
13875 +- }
13876
13877 - void iscsit_thread_get_cpumask(struct iscsi_conn *conn)
13878 - {
13879 -- struct iscsi_thread_set *ts = conn->thread_set;
13880 - int ord, cpu;
13881 - /*
13882 -- * thread_id is assigned from iscsit_global->ts_bitmap from
13883 -- * within iscsi_thread_set.c:iscsi_allocate_thread_sets()
13884 -+ * bitmap_id is assigned from iscsit_global->ts_bitmap from
13885 -+ * within iscsit_start_kthreads()
13886 - *
13887 -- * Here we use thread_id to determine which CPU that this
13888 -- * iSCSI connection's iscsi_thread_set will be scheduled to
13889 -+ * Here we use bitmap_id to determine which CPU that this
13890 -+ * iSCSI connection's RX/TX threads will be scheduled to
13891 - * execute upon.
13892 - */
13893 -- ord = ts->thread_id % cpumask_weight(cpu_online_mask);
13894 -+ ord = conn->bitmap_id % cpumask_weight(cpu_online_mask);
13895 - for_each_online_cpu(cpu) {
13896 - if (ord-- == 0) {
13897 - cpumask_set_cpu(cpu, conn->conn_cpumask);
13898 -@@ -3914,7 +3907,7 @@ check_rsp_state:
13899 - switch (state) {
13900 - case ISTATE_SEND_LOGOUTRSP:
13901 - if (!iscsit_logout_post_handler(cmd, conn))
13902 -- goto restart;
13903 -+ return -ECONNRESET;
13904 - /* fall through */
13905 - case ISTATE_SEND_STATUS:
13906 - case ISTATE_SEND_ASYNCMSG:
13907 -@@ -3942,8 +3935,6 @@ check_rsp_state:
13908 + if (!error && cc->iv_gen_ops && cc->iv_gen_ops->post)
13909 + error = cc->iv_gen_ops->post(cc, iv_of_dmreq(cc, dmreq), dmreq);
13910 +@@ -1360,12 +1357,15 @@ static void kcryptd_async_done(struct crypto_async_request *async_req,
13911 + crypt_free_req(cc, req_of_dmreq(cc, dmreq), io->base_bio);
13912
13913 - err:
13914 - return -1;
13915 --restart:
13916 -- return -EAGAIN;
13917 - }
13918 + if (!atomic_dec_and_test(&ctx->cc_pending))
13919 +- return;
13920 ++ goto done;
13921
13922 - static int iscsit_handle_response_queue(struct iscsi_conn *conn)
13923 -@@ -3970,21 +3961,13 @@ static int iscsit_handle_response_queue(struct iscsi_conn *conn)
13924 - int iscsi_target_tx_thread(void *arg)
13925 - {
13926 - int ret = 0;
13927 -- struct iscsi_conn *conn;
13928 -- struct iscsi_thread_set *ts = arg;
13929 -+ struct iscsi_conn *conn = arg;
13930 - /*
13931 - * Allow ourselves to be interrupted by SIGINT so that a
13932 - * connection recovery / failure event can be triggered externally.
13933 - */
13934 - allow_signal(SIGINT);
13935 + if (bio_data_dir(io->base_bio) == READ)
13936 + kcryptd_crypt_read_done(io);
13937 + else
13938 + kcryptd_crypt_write_io_submit(io, 1);
13939 ++done:
13940 ++ if (!completion_done(&ctx->restart))
13941 ++ complete(&ctx->restart);
13942 + }
13943
13944 --restart:
13945 -- conn = iscsi_tx_thread_pre_handler(ts);
13946 -- if (!conn)
13947 -- goto out;
13948 --
13949 -- ret = 0;
13950 --
13951 - while (!kthread_should_stop()) {
13952 - /*
13953 - * Ensure that both TX and RX per connection kthreads
13954 -@@ -3993,11 +3976,9 @@ restart:
13955 - iscsit_thread_check_cpumask(conn, current, 1);
13956 + static void kcryptd_crypt(struct work_struct *work)
13957 +diff --git a/drivers/md/md.c b/drivers/md/md.c
13958 +index 717daad..e617878 100644
13959 +--- a/drivers/md/md.c
13960 ++++ b/drivers/md/md.c
13961 +@@ -249,6 +249,7 @@ static void md_make_request(struct request_queue *q, struct bio *bio)
13962 + const int rw = bio_data_dir(bio);
13963 + struct mddev *mddev = q->queuedata;
13964 + unsigned int sectors;
13965 ++ int cpu;
13966
13967 - wait_event_interruptible(conn->queues_wq,
13968 -- !iscsit_conn_all_queues_empty(conn) ||
13969 -- ts->status == ISCSI_THREAD_SET_RESET);
13970 -+ !iscsit_conn_all_queues_empty(conn));
13971 + if (mddev == NULL || mddev->pers == NULL
13972 + || !mddev->ready) {
13973 +@@ -284,7 +285,10 @@ static void md_make_request(struct request_queue *q, struct bio *bio)
13974 + sectors = bio_sectors(bio);
13975 + mddev->pers->make_request(mddev, bio);
13976
13977 -- if ((ts->status == ISCSI_THREAD_SET_RESET) ||
13978 -- signal_pending(current))
13979 -+ if (signal_pending(current))
13980 - goto transport_err;
13981 +- generic_start_io_acct(rw, sectors, &mddev->gendisk->part0);
13982 ++ cpu = part_stat_lock();
13983 ++ part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]);
13984 ++ part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw], sectors);
13985 ++ part_stat_unlock();
13986
13987 - get_immediate:
13988 -@@ -4008,15 +3989,14 @@ get_immediate:
13989 - ret = iscsit_handle_response_queue(conn);
13990 - if (ret == 1)
13991 - goto get_immediate;
13992 -- else if (ret == -EAGAIN)
13993 -- goto restart;
13994 -+ else if (ret == -ECONNRESET)
13995 -+ goto out;
13996 - else if (ret < 0)
13997 - goto transport_err;
13998 - }
13999 + if (atomic_dec_and_test(&mddev->active_io) && mddev->suspended)
14000 + wake_up(&mddev->sb_wait);
14001 +diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
14002 +index 3ed9f42..3b5d7f7 100644
14003 +--- a/drivers/md/raid0.c
14004 ++++ b/drivers/md/raid0.c
14005 +@@ -313,7 +313,7 @@ static struct strip_zone *find_zone(struct r0conf *conf,
14006
14007 - transport_err:
14008 - iscsit_take_action_for_connection_exit(conn);
14009 -- goto restart;
14010 - out:
14011 - return 0;
14012 - }
14013 -@@ -4111,8 +4091,7 @@ int iscsi_target_rx_thread(void *arg)
14014 - int ret;
14015 - u8 buffer[ISCSI_HDR_LEN], opcode;
14016 - u32 checksum = 0, digest = 0;
14017 -- struct iscsi_conn *conn = NULL;
14018 -- struct iscsi_thread_set *ts = arg;
14019 -+ struct iscsi_conn *conn = arg;
14020 - struct kvec iov;
14021 - /*
14022 - * Allow ourselves to be interrupted by SIGINT so that a
14023 -@@ -4120,11 +4099,6 @@ int iscsi_target_rx_thread(void *arg)
14024 - */
14025 - allow_signal(SIGINT);
14026 + /*
14027 + * remaps the bio to the target device. we separate two flows.
14028 +- * power 2 flow and a general flow for the sake of perfromance
14029 ++ * power 2 flow and a general flow for the sake of performance
14030 + */
14031 + static struct md_rdev *map_sector(struct mddev *mddev, struct strip_zone *zone,
14032 + sector_t sector, sector_t *sector_offset)
14033 +@@ -524,6 +524,7 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio)
14034 + split = bio;
14035 + }
14036
14037 --restart:
14038 -- conn = iscsi_rx_thread_pre_handler(ts);
14039 -- if (!conn)
14040 -- goto out;
14041 --
14042 - if (conn->conn_transport->transport_type == ISCSI_INFINIBAND) {
14043 - struct completion comp;
14044 - int rc;
14045 -@@ -4134,7 +4108,7 @@ restart:
14046 - if (rc < 0)
14047 - goto transport_err;
14048 ++ sector = bio->bi_iter.bi_sector;
14049 + zone = find_zone(mddev->private, &sector);
14050 + tmp_dev = map_sector(mddev, zone, sector, &sector);
14051 + split->bi_bdev = tmp_dev->bdev;
14052 +diff --git a/drivers/media/rc/img-ir/img-ir-core.c b/drivers/media/rc/img-ir/img-ir-core.c
14053 +index 77c78de..7020659 100644
14054 +--- a/drivers/media/rc/img-ir/img-ir-core.c
14055 ++++ b/drivers/media/rc/img-ir/img-ir-core.c
14056 +@@ -146,7 +146,7 @@ static int img_ir_remove(struct platform_device *pdev)
14057 + {
14058 + struct img_ir_priv *priv = platform_get_drvdata(pdev);
14059
14060 -- goto out;
14061 -+ goto transport_err;
14062 - }
14063 +- free_irq(priv->irq, img_ir_isr);
14064 ++ free_irq(priv->irq, priv);
14065 + img_ir_remove_hw(priv);
14066 + img_ir_remove_raw(priv);
14067
14068 - while (!kthread_should_stop()) {
14069 -@@ -4210,8 +4184,6 @@ transport_err:
14070 - if (!signal_pending(current))
14071 - atomic_set(&conn->transport_failed, 1);
14072 - iscsit_take_action_for_connection_exit(conn);
14073 -- goto restart;
14074 --out:
14075 - return 0;
14076 - }
14077 +diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c
14078 +index 65a326c..749ad56 100644
14079 +--- a/drivers/media/usb/stk1160/stk1160-v4l.c
14080 ++++ b/drivers/media/usb/stk1160/stk1160-v4l.c
14081 +@@ -240,6 +240,11 @@ static int stk1160_stop_streaming(struct stk1160 *dev)
14082 + if (mutex_lock_interruptible(&dev->v4l_lock))
14083 + return -ERESTARTSYS;
14084
14085 -@@ -4273,7 +4245,24 @@ int iscsit_close_connection(
14086 - if (conn->conn_transport->transport_type == ISCSI_TCP)
14087 - complete(&conn->conn_logout_comp);
14088 ++ /*
14089 ++ * Once URBs are cancelled, the URB complete handler
14090 ++ * won't be running. This is required to safely release the
14091 ++ * current buffer (dev->isoc_ctl.buf).
14092 ++ */
14093 + stk1160_cancel_isoc(dev);
14094
14095 -- iscsi_release_thread_set(conn);
14096 -+ if (!strcmp(current->comm, ISCSI_RX_THREAD_NAME)) {
14097 -+ if (conn->tx_thread &&
14098 -+ cmpxchg(&conn->tx_thread_active, true, false)) {
14099 -+ send_sig(SIGINT, conn->tx_thread, 1);
14100 -+ kthread_stop(conn->tx_thread);
14101 -+ }
14102 -+ } else if (!strcmp(current->comm, ISCSI_TX_THREAD_NAME)) {
14103 -+ if (conn->rx_thread &&
14104 -+ cmpxchg(&conn->rx_thread_active, true, false)) {
14105 -+ send_sig(SIGINT, conn->rx_thread, 1);
14106 -+ kthread_stop(conn->rx_thread);
14107 -+ }
14108 -+ }
14109 + /*
14110 +@@ -620,8 +625,16 @@ void stk1160_clear_queue(struct stk1160 *dev)
14111 + stk1160_info("buffer [%p/%d] aborted\n",
14112 + buf, buf->vb.v4l2_buf.index);
14113 + }
14114 +- /* It's important to clear current buffer */
14115 +- dev->isoc_ctl.buf = NULL;
14116 +
14117 -+ spin_lock(&iscsit_global->ts_bitmap_lock);
14118 -+ bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id,
14119 -+ get_order(1));
14120 -+ spin_unlock(&iscsit_global->ts_bitmap_lock);
14121 ++ /* It's important to release the current buffer */
14122 ++ if (dev->isoc_ctl.buf) {
14123 ++ buf = dev->isoc_ctl.buf;
14124 ++ dev->isoc_ctl.buf = NULL;
14125 ++
14126 ++ vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
14127 ++ stk1160_info("buffer [%p/%d] aborted\n",
14128 ++ buf, buf->vb.v4l2_buf.index);
14129 ++ }
14130 + spin_unlock_irqrestore(&dev->buf_lock, flags);
14131 + }
14132
14133 - iscsit_stop_timers_for_cmds(conn);
14134 - iscsit_stop_nopin_response_timer(conn);
14135 -@@ -4551,15 +4540,13 @@ static void iscsit_logout_post_handler_closesession(
14136 - struct iscsi_conn *conn)
14137 - {
14138 - struct iscsi_session *sess = conn->sess;
14139 --
14140 -- iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD);
14141 -- iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD);
14142 -+ int sleep = cmpxchg(&conn->tx_thread_active, true, false);
14143 +diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
14144 +index fc145d2..922a750 100644
14145 +--- a/drivers/memstick/core/mspro_block.c
14146 ++++ b/drivers/memstick/core/mspro_block.c
14147 +@@ -758,7 +758,7 @@ static int mspro_block_complete_req(struct memstick_dev *card, int error)
14148
14149 - atomic_set(&conn->conn_logout_remove, 0);
14150 - complete(&conn->conn_logout_comp);
14151 + if (error || (card->current_mrq.tpc == MSPRO_CMD_STOP)) {
14152 + if (msb->data_dir == READ) {
14153 +- for (cnt = 0; cnt < msb->current_seg; cnt++)
14154 ++ for (cnt = 0; cnt < msb->current_seg; cnt++) {
14155 + t_len += msb->req_sg[cnt].length
14156 + / msb->page_size;
14157
14158 - iscsit_dec_conn_usage_count(conn);
14159 -- iscsit_stop_session(sess, 1, 1);
14160 -+ iscsit_stop_session(sess, sleep, sleep);
14161 - iscsit_dec_session_usage_count(sess);
14162 - target_put_session(sess->se_sess);
14163 - }
14164 -@@ -4567,13 +4554,12 @@ static void iscsit_logout_post_handler_closesession(
14165 - static void iscsit_logout_post_handler_samecid(
14166 - struct iscsi_conn *conn)
14167 - {
14168 -- iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD);
14169 -- iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD);
14170 -+ int sleep = cmpxchg(&conn->tx_thread_active, true, false);
14171 +@@ -766,6 +766,7 @@ static int mspro_block_complete_req(struct memstick_dev *card, int error)
14172 + t_len += msb->current_page - 1;
14173
14174 - atomic_set(&conn->conn_logout_remove, 0);
14175 - complete(&conn->conn_logout_comp);
14176 + t_len *= msb->page_size;
14177 ++ }
14178 + }
14179 + } else
14180 + t_len = blk_rq_bytes(msb->block_req);
14181 +diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
14182 +index 2a87f69..1aed3b7 100644
14183 +--- a/drivers/mfd/mfd-core.c
14184 ++++ b/drivers/mfd/mfd-core.c
14185 +@@ -128,7 +128,7 @@ static int mfd_add_device(struct device *parent, int id,
14186 + int platform_id;
14187 + int r;
14188
14189 -- iscsit_cause_connection_reinstatement(conn, 1);
14190 -+ iscsit_cause_connection_reinstatement(conn, sleep);
14191 - iscsit_dec_conn_usage_count(conn);
14192 +- if (id < 0)
14193 ++ if (id == PLATFORM_DEVID_AUTO)
14194 + platform_id = id;
14195 + else
14196 + platform_id = id + cell->id;
14197 +diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
14198 +index e8a4218..459ed1b 100644
14199 +--- a/drivers/mmc/host/sunxi-mmc.c
14200 ++++ b/drivers/mmc/host/sunxi-mmc.c
14201 +@@ -930,7 +930,9 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
14202 + return PTR_ERR(host->clk_sample);
14203 + }
14204 +
14205 +- host->reset = devm_reset_control_get(&pdev->dev, "ahb");
14206 ++ host->reset = devm_reset_control_get_optional(&pdev->dev, "ahb");
14207 ++ if (PTR_ERR(host->reset) == -EPROBE_DEFER)
14208 ++ return PTR_ERR(host->reset);
14209 +
14210 + ret = clk_prepare_enable(host->clk_ahb);
14211 + if (ret) {
14212 +diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
14213 +index a31c357..dba7e1c 100644
14214 +--- a/drivers/mmc/host/tmio_mmc_pio.c
14215 ++++ b/drivers/mmc/host/tmio_mmc_pio.c
14216 +@@ -1073,8 +1073,6 @@ EXPORT_SYMBOL(tmio_mmc_host_alloc);
14217 + void tmio_mmc_host_free(struct tmio_mmc_host *host)
14218 + {
14219 + mmc_free_host(host->mmc);
14220 +-
14221 +- host->mmc = NULL;
14222 }
14223 + EXPORT_SYMBOL(tmio_mmc_host_free);
14224
14225 -diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c
14226 -index bdd8731..e008ed2 100644
14227 ---- a/drivers/target/iscsi/iscsi_target_erl0.c
14228 -+++ b/drivers/target/iscsi/iscsi_target_erl0.c
14229 -@@ -860,7 +860,10 @@ void iscsit_connection_reinstatement_rcfr(struct iscsi_conn *conn)
14230 +diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
14231 +index 9d2e16f..b5e1548 100644
14232 +--- a/drivers/mtd/ubi/attach.c
14233 ++++ b/drivers/mtd/ubi/attach.c
14234 +@@ -410,7 +410,7 @@ int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb,
14235 + second_is_newer = !second_is_newer;
14236 + } else {
14237 + dbg_bld("PEB %d CRC is OK", pnum);
14238 +- bitflips = !!err;
14239 ++ bitflips |= !!err;
14240 }
14241 - spin_unlock_bh(&conn->state_lock);
14242 + mutex_unlock(&ubi->buf_mutex);
14243
14244 -- iscsi_thread_set_force_reinstatement(conn);
14245 -+ if (conn->tx_thread && conn->tx_thread_active)
14246 -+ send_sig(SIGINT, conn->tx_thread, 1);
14247 -+ if (conn->rx_thread && conn->rx_thread_active)
14248 -+ send_sig(SIGINT, conn->rx_thread, 1);
14249 +diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
14250 +index d647e50..d16fccf 100644
14251 +--- a/drivers/mtd/ubi/cdev.c
14252 ++++ b/drivers/mtd/ubi/cdev.c
14253 +@@ -455,7 +455,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
14254 + /* Validate the request */
14255 + err = -EINVAL;
14256 + if (req.lnum < 0 || req.lnum >= vol->reserved_pebs ||
14257 +- req.bytes < 0 || req.lnum >= vol->usable_leb_size)
14258 ++ req.bytes < 0 || req.bytes > vol->usable_leb_size)
14259 + break;
14260
14261 - sleep:
14262 - wait_for_completion(&conn->conn_wait_rcfr_comp);
14263 -@@ -885,10 +888,10 @@ void iscsit_cause_connection_reinstatement(struct iscsi_conn *conn, int sleep)
14264 - return;
14265 + err = get_exclusive(desc);
14266 +diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
14267 +index 16e34b3..8c9a710 100644
14268 +--- a/drivers/mtd/ubi/eba.c
14269 ++++ b/drivers/mtd/ubi/eba.c
14270 +@@ -1419,7 +1419,8 @@ int ubi_eba_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
14271 + * during re-size.
14272 + */
14273 + ubi_move_aeb_to_list(av, aeb, &ai->erase);
14274 +- vol->eba_tbl[aeb->lnum] = aeb->pnum;
14275 ++ else
14276 ++ vol->eba_tbl[aeb->lnum] = aeb->pnum;
14277 + }
14278 }
14279
14280 -- if (iscsi_thread_set_force_reinstatement(conn) < 0) {
14281 -- spin_unlock_bh(&conn->state_lock);
14282 -- return;
14283 -- }
14284 -+ if (conn->tx_thread && conn->tx_thread_active)
14285 -+ send_sig(SIGINT, conn->tx_thread, 1);
14286 -+ if (conn->rx_thread && conn->rx_thread_active)
14287 -+ send_sig(SIGINT, conn->rx_thread, 1);
14288 +diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
14289 +index 8f7bde6..0bd92d8 100644
14290 +--- a/drivers/mtd/ubi/wl.c
14291 ++++ b/drivers/mtd/ubi/wl.c
14292 +@@ -1002,7 +1002,7 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
14293 + int shutdown)
14294 + {
14295 + int err, scrubbing = 0, torture = 0, protect = 0, erroneous = 0;
14296 +- int vol_id = -1, uninitialized_var(lnum);
14297 ++ int vol_id = -1, lnum = -1;
14298 + #ifdef CONFIG_MTD_UBI_FASTMAP
14299 + int anchor = wrk->anchor;
14300 + #endif
14301 +diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
14302 +index 81d4153..77bf133 100644
14303 +--- a/drivers/net/ethernet/cadence/macb.c
14304 ++++ b/drivers/net/ethernet/cadence/macb.c
14305 +@@ -2165,7 +2165,7 @@ static void macb_configure_caps(struct macb *bp)
14306 + }
14307 + }
14308
14309 - atomic_set(&conn->connection_reinstatement, 1);
14310 - if (!sleep) {
14311 -diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
14312 -index 153fb66..345f073 100644
14313 ---- a/drivers/target/iscsi/iscsi_target_login.c
14314 -+++ b/drivers/target/iscsi/iscsi_target_login.c
14315 -@@ -699,6 +699,51 @@ static void iscsi_post_login_start_timers(struct iscsi_conn *conn)
14316 - iscsit_start_nopin_timer(conn);
14317 - }
14318 +- if (MACB_BFEXT(IDNUM, macb_readl(bp, MID)) == 0x2)
14319 ++ if (MACB_BFEXT(IDNUM, macb_readl(bp, MID)) >= 0x2)
14320 + bp->caps |= MACB_CAPS_MACB_IS_GEM;
14321
14322 -+int iscsit_start_kthreads(struct iscsi_conn *conn)
14323 + if (macb_is_gem(bp)) {
14324 +diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
14325 +index 7f997d3..a71c446 100644
14326 +--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
14327 ++++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
14328 +@@ -144,6 +144,11 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
14329 + static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
14330 + struct e1000_rx_ring *rx_ring,
14331 + int *work_done, int work_to_do);
14332 ++static void e1000_alloc_dummy_rx_buffers(struct e1000_adapter *adapter,
14333 ++ struct e1000_rx_ring *rx_ring,
14334 ++ int cleaned_count)
14335 +{
14336 -+ int ret = 0;
14337 -+
14338 -+ spin_lock(&iscsit_global->ts_bitmap_lock);
14339 -+ conn->bitmap_id = bitmap_find_free_region(iscsit_global->ts_bitmap,
14340 -+ ISCSIT_BITMAP_BITS, get_order(1));
14341 -+ spin_unlock(&iscsit_global->ts_bitmap_lock);
14342 -+
14343 -+ if (conn->bitmap_id < 0) {
14344 -+ pr_err("bitmap_find_free_region() failed for"
14345 -+ " iscsit_start_kthreads()\n");
14346 -+ return -ENOMEM;
14347 -+ }
14348 -+
14349 -+ conn->tx_thread = kthread_run(iscsi_target_tx_thread, conn,
14350 -+ "%s", ISCSI_TX_THREAD_NAME);
14351 -+ if (IS_ERR(conn->tx_thread)) {
14352 -+ pr_err("Unable to start iscsi_target_tx_thread\n");
14353 -+ ret = PTR_ERR(conn->tx_thread);
14354 -+ goto out_bitmap;
14355 -+ }
14356 -+ conn->tx_thread_active = true;
14357 -+
14358 -+ conn->rx_thread = kthread_run(iscsi_target_rx_thread, conn,
14359 -+ "%s", ISCSI_RX_THREAD_NAME);
14360 -+ if (IS_ERR(conn->rx_thread)) {
14361 -+ pr_err("Unable to start iscsi_target_rx_thread\n");
14362 -+ ret = PTR_ERR(conn->rx_thread);
14363 -+ goto out_tx;
14364 -+ }
14365 -+ conn->rx_thread_active = true;
14366 -+
14367 -+ return 0;
14368 -+out_tx:
14369 -+ kthread_stop(conn->tx_thread);
14370 -+ conn->tx_thread_active = false;
14371 -+out_bitmap:
14372 -+ spin_lock(&iscsit_global->ts_bitmap_lock);
14373 -+ bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id,
14374 -+ get_order(1));
14375 -+ spin_unlock(&iscsit_global->ts_bitmap_lock);
14376 -+ return ret;
14377 +}
14378 -+
14379 - int iscsi_post_login_handler(
14380 - struct iscsi_np *np,
14381 - struct iscsi_conn *conn,
14382 -@@ -709,7 +754,7 @@ int iscsi_post_login_handler(
14383 - struct se_session *se_sess = sess->se_sess;
14384 - struct iscsi_portal_group *tpg = sess->tpg;
14385 - struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;
14386 -- struct iscsi_thread_set *ts;
14387 -+ int rc;
14388 -
14389 - iscsit_inc_conn_usage_count(conn);
14390 + static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
14391 + struct e1000_rx_ring *rx_ring,
14392 + int cleaned_count);
14393 +@@ -3552,8 +3557,11 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
14394 + msleep(1);
14395 + /* e1000_down has a dependency on max_frame_size */
14396 + hw->max_frame_size = max_frame;
14397 +- if (netif_running(netdev))
14398 ++ if (netif_running(netdev)) {
14399 ++ /* prevent buffers from being reallocated */
14400 ++ adapter->alloc_rx_buf = e1000_alloc_dummy_rx_buffers;
14401 + e1000_down(adapter);
14402 ++ }
14403
14404 -@@ -724,7 +769,6 @@ int iscsi_post_login_handler(
14405 - /*
14406 - * SCSI Initiator -> SCSI Target Port Mapping
14407 - */
14408 -- ts = iscsi_get_thread_set();
14409 - if (!zero_tsih) {
14410 - iscsi_set_session_parameters(sess->sess_ops,
14411 - conn->param_list, 0);
14412 -@@ -751,9 +795,11 @@ int iscsi_post_login_handler(
14413 - sess->sess_ops->InitiatorName);
14414 - spin_unlock_bh(&sess->conn_lock);
14415 + /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN
14416 + * means we reserve 2 more, this pushes us to allocate from the next
14417 +diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
14418 +index af829c5..7ace07d 100644
14419 +--- a/drivers/net/ethernet/marvell/pxa168_eth.c
14420 ++++ b/drivers/net/ethernet/marvell/pxa168_eth.c
14421 +@@ -1508,7 +1508,8 @@ static int pxa168_eth_probe(struct platform_device *pdev)
14422 + np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0);
14423 + if (!np) {
14424 + dev_err(&pdev->dev, "missing phy-handle\n");
14425 +- return -EINVAL;
14426 ++ err = -EINVAL;
14427 ++ goto err_netdev;
14428 + }
14429 + of_property_read_u32(np, "reg", &pep->phy_addr);
14430 + pep->phy_intf = of_get_phy_mode(pdev->dev.of_node);
14431 +@@ -1526,7 +1527,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
14432 + pep->smi_bus = mdiobus_alloc();
14433 + if (pep->smi_bus == NULL) {
14434 + err = -ENOMEM;
14435 +- goto err_base;
14436 ++ goto err_netdev;
14437 + }
14438 + pep->smi_bus->priv = pep;
14439 + pep->smi_bus->name = "pxa168_eth smi";
14440 +@@ -1551,13 +1552,10 @@ err_mdiobus:
14441 + mdiobus_unregister(pep->smi_bus);
14442 + err_free_mdio:
14443 + mdiobus_free(pep->smi_bus);
14444 +-err_base:
14445 +- iounmap(pep->base);
14446 + err_netdev:
14447 + free_netdev(dev);
14448 + err_clk:
14449 +- clk_disable(clk);
14450 +- clk_put(clk);
14451 ++ clk_disable_unprepare(clk);
14452 + return err;
14453 + }
14454
14455 -- iscsi_post_login_start_timers(conn);
14456 -+ rc = iscsit_start_kthreads(conn);
14457 -+ if (rc)
14458 -+ return rc;
14459 +@@ -1574,13 +1572,9 @@ static int pxa168_eth_remove(struct platform_device *pdev)
14460 + if (pep->phy)
14461 + phy_disconnect(pep->phy);
14462 + if (pep->clk) {
14463 +- clk_disable(pep->clk);
14464 +- clk_put(pep->clk);
14465 +- pep->clk = NULL;
14466 ++ clk_disable_unprepare(pep->clk);
14467 + }
14468
14469 -- iscsi_activate_thread_set(conn, ts);
14470 -+ iscsi_post_login_start_timers(conn);
14471 - /*
14472 - * Determine CPU mask to ensure connection's RX and TX kthreads
14473 - * are scheduled on the same CPU.
14474 -@@ -810,8 +856,11 @@ int iscsi_post_login_handler(
14475 - " iSCSI Target Portal Group: %hu\n", tpg->nsessions, tpg->tpgt);
14476 - spin_unlock_bh(&se_tpg->session_lock);
14477 +- iounmap(pep->base);
14478 +- pep->base = NULL;
14479 + mdiobus_unregister(pep->smi_bus);
14480 + mdiobus_free(pep->smi_bus);
14481 + unregister_netdev(dev);
14482 +diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
14483 +index a7b58ba..3dccf01 100644
14484 +--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
14485 ++++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
14486 +@@ -981,20 +981,21 @@ static int mlx4_en_check_rxfh_func(struct net_device *dev, u8 hfunc)
14487 + struct mlx4_en_priv *priv = netdev_priv(dev);
14488
14489 -+ rc = iscsit_start_kthreads(conn);
14490 -+ if (rc)
14491 -+ return rc;
14492 -+
14493 - iscsi_post_login_start_timers(conn);
14494 -- iscsi_activate_thread_set(conn, ts);
14495 - /*
14496 - * Determine CPU mask to ensure connection's RX and TX kthreads
14497 - * are scheduled on the same CPU.
14498 -diff --git a/include/target/iscsi/iscsi_target_core.h b/include/target/iscsi/iscsi_target_core.h
14499 -index d3583d3..dd0f3ab 100644
14500 ---- a/include/target/iscsi/iscsi_target_core.h
14501 -+++ b/include/target/iscsi/iscsi_target_core.h
14502 -@@ -602,6 +602,11 @@ struct iscsi_conn {
14503 - struct iscsi_session *sess;
14504 - /* Pointer to thread_set in use for this conn's threads */
14505 - struct iscsi_thread_set *thread_set;
14506 -+ int bitmap_id;
14507 -+ int rx_thread_active;
14508 -+ struct task_struct *rx_thread;
14509 -+ int tx_thread_active;
14510 -+ struct task_struct *tx_thread;
14511 - /* list_head for session connection list */
14512 - struct list_head conn_list;
14513 - } ____cacheline_aligned;
14514 -@@ -871,10 +876,12 @@ struct iscsit_global {
14515 - /* Unique identifier used for the authentication daemon */
14516 - u32 auth_id;
14517 - u32 inactive_ts;
14518 -+#define ISCSIT_BITMAP_BITS 262144
14519 - /* Thread Set bitmap count */
14520 - int ts_bitmap_count;
14521 - /* Thread Set bitmap pointer */
14522 - unsigned long *ts_bitmap;
14523 -+ spinlock_t ts_bitmap_lock;
14524 - /* Used for iSCSI discovery session authentication */
14525 - struct iscsi_node_acl discovery_acl;
14526 - struct iscsi_portal_group *discovery_tpg;
14527 ---
14528 -2.3.6
14529 -
14530 -
14531 -From ca7767a3f859d6e5487ddcf7a23515e19188b922 Mon Sep 17 00:00:00 2001
14532 -From: Nicholas Bellinger <nab@×××××××××××.org>
14533 -Date: Tue, 7 Apr 2015 21:53:27 +0000
14534 -Subject: [PATCH 132/219] target: Fix COMPARE_AND_WRITE with SG_TO_MEM_NOALLOC
14535 - handling
14536 -Cc: mpagano@g.o
14537 -
14538 -commit c8e639852ad720499912acedfd6b072325fd2807 upstream.
14539 -
14540 -This patch fixes a bug for COMPARE_AND_WRITE handling with
14541 -fabrics using SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC.
14542 -
14543 -It adds the missing allocation for cmd->t_bidi_data_sg within
14544 -transport_generic_new_cmd() that is used by COMPARE_AND_WRITE
14545 -for the initial READ payload, even if the fabric is already
14546 -providing a pre-allocated buffer for cmd->t_data_sg.
14547 -
14548 -Also, fix zero-length COMPARE_AND_WRITE handling within the
14549 -compare_and_write_callback() and target_complete_ok_work()
14550 -to queue the response, skipping the initial READ.
14551 -
14552 -This fixes COMPARE_AND_WRITE emulation with loopback, vhost,
14553 -and xen-backend fabric drivers using SG_TO_MEM_NOALLOC.
14554 -
14555 -Reported-by: Christoph Hellwig <hch@×××.de>
14556 -Cc: Christoph Hellwig <hch@×××.de>
14557 -Signed-off-by: Nicholas Bellinger <nab@×××××××××××.org>
14558 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
14559 -Signed-off-by: Mike Pagano <mpagano@g.o>
14560 ----
14561 - drivers/target/target_core_sbc.c | 15 +++++++++-----
14562 - drivers/target/target_core_transport.c | 37 ++++++++++++++++++++++++++++++----
14563 - include/target/target_core_base.h | 2 +-
14564 - 3 files changed, 44 insertions(+), 10 deletions(-)
14565 -
14566 -diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
14567 -index 3e72974..755bd9b3 100644
14568 ---- a/drivers/target/target_core_sbc.c
14569 -+++ b/drivers/target/target_core_sbc.c
14570 -@@ -312,7 +312,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o
14571 - return 0;
14572 - }
14573 + /* check if requested function is supported by the device */
14574 +- if ((hfunc == ETH_RSS_HASH_TOP &&
14575 +- !(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_TOP)) ||
14576 +- (hfunc == ETH_RSS_HASH_XOR &&
14577 +- !(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_XOR)))
14578 +- return -EINVAL;
14579 ++ if (hfunc == ETH_RSS_HASH_TOP) {
14580 ++ if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_TOP))
14581 ++ return -EINVAL;
14582 ++ if (!(dev->features & NETIF_F_RXHASH))
14583 ++ en_warn(priv, "Toeplitz hash function should be used in conjunction with RX hashing for optimal performance\n");
14584 ++ return 0;
14585 ++ } else if (hfunc == ETH_RSS_HASH_XOR) {
14586 ++ if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_XOR))
14587 ++ return -EINVAL;
14588 ++ if (dev->features & NETIF_F_RXHASH)
14589 ++ en_warn(priv, "Enabling both XOR Hash function and RX Hashing can limit RPS functionality\n");
14590 ++ return 0;
14591 ++ }
14592
14593 --static sense_reason_t xdreadwrite_callback(struct se_cmd *cmd)
14594 -+static sense_reason_t xdreadwrite_callback(struct se_cmd *cmd, bool success)
14595 - {
14596 - unsigned char *buf, *addr;
14597 - struct scatterlist *sg;
14598 -@@ -376,7 +376,7 @@ sbc_execute_rw(struct se_cmd *cmd)
14599 - cmd->data_direction);
14600 +- priv->rss_hash_fn = hfunc;
14601 +- if (hfunc == ETH_RSS_HASH_TOP && !(dev->features & NETIF_F_RXHASH))
14602 +- en_warn(priv,
14603 +- "Toeplitz hash function should be used in conjunction with RX hashing for optimal performance\n");
14604 +- if (hfunc == ETH_RSS_HASH_XOR && (dev->features & NETIF_F_RXHASH))
14605 +- en_warn(priv,
14606 +- "Enabling both XOR Hash function and RX Hashing can limit RPS functionality\n");
14607 +- return 0;
14608 ++ return -EINVAL;
14609 }
14610
14611 --static sense_reason_t compare_and_write_post(struct se_cmd *cmd)
14612 -+static sense_reason_t compare_and_write_post(struct se_cmd *cmd, bool success)
14613 - {
14614 - struct se_device *dev = cmd->se_dev;
14615 + static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key,
14616 +@@ -1068,6 +1069,8 @@ static int mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index,
14617 + priv->prof->rss_rings = rss_rings;
14618 + if (key)
14619 + memcpy(priv->rss_key, key, MLX4_EN_RSS_KEY_SIZE);
14620 ++ if (hfunc != ETH_RSS_HASH_NO_CHANGE)
14621 ++ priv->rss_hash_fn = hfunc;
14622
14623 -@@ -399,7 +399,7 @@ static sense_reason_t compare_and_write_post(struct se_cmd *cmd)
14624 - return TCM_NO_SENSE;
14625 - }
14626 -
14627 --static sense_reason_t compare_and_write_callback(struct se_cmd *cmd)
14628 -+static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool success)
14629 + if (port_up) {
14630 + err = mlx4_en_start_port(dev);
14631 +diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
14632 +index af034db..9d15566 100644
14633 +--- a/drivers/net/ppp/ppp_generic.c
14634 ++++ b/drivers/net/ppp/ppp_generic.c
14635 +@@ -1716,6 +1716,7 @@ ppp_receive_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
14636 {
14637 - struct se_device *dev = cmd->se_dev;
14638 - struct scatterlist *write_sg = NULL, *sg;
14639 -@@ -414,11 +414,16 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd)
14640 + /* note: a 0-length skb is used as an error indication */
14641 + if (skb->len > 0) {
14642 ++ skb_checksum_complete_unset(skb);
14643 + #ifdef CONFIG_PPP_MULTILINK
14644 + /* XXX do channel-level decompression here */
14645 + if (PPP_PROTO(skb) == PPP_MP)
14646 +diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
14647 +index 90a714c..23806c2 100644
14648 +--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
14649 ++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
14650 +@@ -321,6 +321,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
14651 + {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
14652 + {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
14653 + {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/
14654 ++ {RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
14655 + {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/
14656 + {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
14657 + {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
14658 +@@ -377,6 +378,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
14659 + {RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/
14660 + {RTL_USB_DEVICE(0x2001, 0x3309, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/
14661 + {RTL_USB_DEVICE(0x2001, 0x330a, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/
14662 ++ {RTL_USB_DEVICE(0x2001, 0x330d, rtl92cu_hal_cfg)}, /*D-Link DWA-131 */
14663 + {RTL_USB_DEVICE(0x2019, 0xab2b, rtl92cu_hal_cfg)}, /*Planex -Abocom*/
14664 + {RTL_USB_DEVICE(0x20f4, 0x624d, rtl92cu_hal_cfg)}, /*TRENDNet*/
14665 + {RTL_USB_DEVICE(0x2357, 0x0100, rtl92cu_hal_cfg)}, /*TP-Link WN8200ND*/
14666 +diff --git a/drivers/net/wireless/ti/wl18xx/debugfs.c b/drivers/net/wireless/ti/wl18xx/debugfs.c
14667 +index c93fae9..5fbd223 100644
14668 +--- a/drivers/net/wireless/ti/wl18xx/debugfs.c
14669 ++++ b/drivers/net/wireless/ti/wl18xx/debugfs.c
14670 +@@ -139,7 +139,7 @@ WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, protection_filter, "%u");
14671 + WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, accum_arp_pend_requests, "%u");
14672 + WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, max_arp_queue_dep, "%u");
14673
14674 - /*
14675 - * Handle early failure in transport_generic_request_failure(),
14676 -- * which will not have taken ->caw_mutex yet..
14677 -+ * which will not have taken ->caw_sem yet..
14678 - */
14679 -- if (!cmd->t_data_sg || !cmd->t_bidi_data_sg)
14680 -+ if (!success && (!cmd->t_data_sg || !cmd->t_bidi_data_sg))
14681 - return TCM_NO_SENSE;
14682 - /*
14683 -+ * Handle special case for zero-length COMPARE_AND_WRITE
14684 -+ */
14685 -+ if (!cmd->data_length)
14686 -+ goto out;
14687 -+ /*
14688 - * Immediately exit + release dev->caw_sem if command has already
14689 - * been failed with a non-zero SCSI status.
14690 - */
14691 -diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
14692 -index ac3cbab..f786de0 100644
14693 ---- a/drivers/target/target_core_transport.c
14694 -+++ b/drivers/target/target_core_transport.c
14695 -@@ -1615,11 +1615,11 @@ void transport_generic_request_failure(struct se_cmd *cmd,
14696 - transport_complete_task_attr(cmd);
14697 - /*
14698 - * Handle special case for COMPARE_AND_WRITE failure, where the
14699 -- * callback is expected to drop the per device ->caw_mutex.
14700 -+ * callback is expected to drop the per device ->caw_sem.
14701 - */
14702 - if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
14703 - cmd->transport_complete_callback)
14704 -- cmd->transport_complete_callback(cmd);
14705 -+ cmd->transport_complete_callback(cmd, false);
14706 +-WL18XX_DEBUGFS_FWSTATS_FILE(rx_rate, rx_frames_per_rates, "%u");
14707 ++WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(rx_rate, rx_frames_per_rates, 50);
14708
14709 - switch (sense_reason) {
14710 - case TCM_NON_EXISTENT_LUN:
14711 -@@ -1975,8 +1975,12 @@ static void target_complete_ok_work(struct work_struct *work)
14712 - if (cmd->transport_complete_callback) {
14713 - sense_reason_t rc;
14714 + WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, tx_agg_vs_rate,
14715 + AGGR_STATS_TX_AGG*AGGR_STATS_TX_RATE);
14716 +diff --git a/drivers/net/wireless/ti/wlcore/debugfs.h b/drivers/net/wireless/ti/wlcore/debugfs.h
14717 +index 0f2cfb0..bf14676 100644
14718 +--- a/drivers/net/wireless/ti/wlcore/debugfs.h
14719 ++++ b/drivers/net/wireless/ti/wlcore/debugfs.h
14720 +@@ -26,8 +26,8 @@
14721
14722 -- rc = cmd->transport_complete_callback(cmd);
14723 -+ rc = cmd->transport_complete_callback(cmd, true);
14724 - if (!rc && !(cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE_POST)) {
14725 -+ if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
14726 -+ !cmd->data_length)
14727 -+ goto queue_rsp;
14728 -+
14729 - return;
14730 - } else if (rc) {
14731 - ret = transport_send_check_condition_and_sense(cmd,
14732 -@@ -1990,6 +1994,7 @@ static void target_complete_ok_work(struct work_struct *work)
14733 - }
14734 - }
14735 + #include "wlcore.h"
14736
14737 -+queue_rsp:
14738 - switch (cmd->data_direction) {
14739 - case DMA_FROM_DEVICE:
14740 - spin_lock(&cmd->se_lun->lun_sep_lock);
14741 -@@ -2094,6 +2099,16 @@ static inline void transport_reset_sgl_orig(struct se_cmd *cmd)
14742 - static inline void transport_free_pages(struct se_cmd *cmd)
14743 - {
14744 - if (cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) {
14745 -+ /*
14746 -+ * Release special case READ buffer payload required for
14747 -+ * SG_TO_MEM_NOALLOC to function with COMPARE_AND_WRITE
14748 -+ */
14749 -+ if (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) {
14750 -+ transport_free_sgl(cmd->t_bidi_data_sg,
14751 -+ cmd->t_bidi_data_nents);
14752 -+ cmd->t_bidi_data_sg = NULL;
14753 -+ cmd->t_bidi_data_nents = 0;
14754 -+ }
14755 - transport_reset_sgl_orig(cmd);
14756 - return;
14757 - }
14758 -@@ -2246,6 +2261,7 @@ sense_reason_t
14759 - transport_generic_new_cmd(struct se_cmd *cmd)
14760 - {
14761 - int ret = 0;
14762 -+ bool zero_flag = !(cmd->se_cmd_flags & SCF_SCSI_DATA_CDB);
14763 +-int wl1271_format_buffer(char __user *userbuf, size_t count,
14764 +- loff_t *ppos, char *fmt, ...);
14765 ++__printf(4, 5) int wl1271_format_buffer(char __user *userbuf, size_t count,
14766 ++ loff_t *ppos, char *fmt, ...);
14767
14768 - /*
14769 - * Determine is the TCM fabric module has already allocated physical
14770 -@@ -2254,7 +2270,6 @@ transport_generic_new_cmd(struct se_cmd *cmd)
14771 - */
14772 - if (!(cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) &&
14773 - cmd->data_length) {
14774 -- bool zero_flag = !(cmd->se_cmd_flags & SCF_SCSI_DATA_CDB);
14775 + int wl1271_debugfs_init(struct wl1271 *wl);
14776 + void wl1271_debugfs_exit(struct wl1271 *wl);
14777 +diff --git a/drivers/nfc/st21nfcb/i2c.c b/drivers/nfc/st21nfcb/i2c.c
14778 +index eb88693..7b53a5c 100644
14779 +--- a/drivers/nfc/st21nfcb/i2c.c
14780 ++++ b/drivers/nfc/st21nfcb/i2c.c
14781 +@@ -109,7 +109,7 @@ static int st21nfcb_nci_i2c_write(void *phy_id, struct sk_buff *skb)
14782 + return phy->ndlc->hard_fault;
14783
14784 - if ((cmd->se_cmd_flags & SCF_BIDI) ||
14785 - (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE)) {
14786 -@@ -2285,6 +2300,20 @@ transport_generic_new_cmd(struct se_cmd *cmd)
14787 - cmd->data_length, zero_flag);
14788 - if (ret < 0)
14789 - return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
14790 -+ } else if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
14791 -+ cmd->data_length) {
14792 -+ /*
14793 -+ * Special case for COMPARE_AND_WRITE with fabrics
14794 -+ * using SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC.
14795 -+ */
14796 -+ u32 caw_length = cmd->t_task_nolb *
14797 -+ cmd->se_dev->dev_attrib.block_size;
14798 -+
14799 -+ ret = target_alloc_sgl(&cmd->t_bidi_data_sg,
14800 -+ &cmd->t_bidi_data_nents,
14801 -+ caw_length, zero_flag);
14802 -+ if (ret < 0)
14803 -+ return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
14804 + r = i2c_master_send(client, skb->data, skb->len);
14805 +- if (r == -EREMOTEIO) { /* Retry, chip was in standby */
14806 ++ if (r < 0) { /* Retry, chip was in standby */
14807 + usleep_range(1000, 4000);
14808 + r = i2c_master_send(client, skb->data, skb->len);
14809 }
14810 - /*
14811 - * If this command is not a write we can execute it right here,
14812 -diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
14813 -index 672150b..985ca4c 100644
14814 ---- a/include/target/target_core_base.h
14815 -+++ b/include/target/target_core_base.h
14816 -@@ -524,7 +524,7 @@ struct se_cmd {
14817 - sense_reason_t (*execute_cmd)(struct se_cmd *);
14818 - sense_reason_t (*execute_rw)(struct se_cmd *, struct scatterlist *,
14819 - u32, enum dma_data_direction);
14820 -- sense_reason_t (*transport_complete_callback)(struct se_cmd *);
14821 -+ sense_reason_t (*transport_complete_callback)(struct se_cmd *, bool);
14822 +@@ -148,7 +148,7 @@ static int st21nfcb_nci_i2c_read(struct st21nfcb_i2c_phy *phy,
14823 + struct i2c_client *client = phy->i2c_dev;
14824
14825 - unsigned char *t_task_cdb;
14826 - unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
14827 ---
14828 -2.3.6
14829 -
14830 -
14831 -From 54afccf4a4f42da1ef3eca9b56ed8dd25a8d7f1c Mon Sep 17 00:00:00 2001
14832 -From: Akinobu Mita <akinobu.mita@×××××.com>
14833 -Date: Mon, 13 Apr 2015 23:21:56 +0900
14834 -Subject: [PATCH 133/219] target/file: Fix BUG() when CONFIG_DEBUG_SG=y and DIF
14835 - protection enabled
14836 -Cc: mpagano@g.o
14837 -
14838 -commit 38da0f49e8aa1649af397d53f88e163d0e60c058 upstream.
14839 -
14840 -When CONFIG_DEBUG_SG=y and DIF protection support enabled, kernel
14841 -BUG()s are triggered due to the following two issues:
14842 -
14843 -1) prot_sg is not initialized by sg_init_table().
14844 -
14845 -When CONFIG_DEBUG_SG=y, scatterlist helpers check sg entry has a
14846 -correct magic value.
14847 -
14848 -2) vmalloc'ed buffer is passed to sg_set_buf().
14849 -
14850 -sg_set_buf() uses virt_to_page() to convert virtual address to struct
14851 -page, but it doesn't work with vmalloc address. vmalloc_to_page()
14852 -should be used instead. As prot_buf isn't usually too large, so
14853 -fix it by allocating prot_buf by kmalloc instead of vmalloc.
14854 -
14855 -Signed-off-by: Akinobu Mita <akinobu.mita@×××××.com>
14856 -Cc: Sagi Grimberg <sagig@××××××××.com>
14857 -Cc: "Martin K. Petersen" <martin.petersen@××××××.com>
14858 -Cc: Christoph Hellwig <hch@×××.de>
14859 -Cc: "James E.J. Bottomley" <James.Bottomley@×××××××××××××××××.com>
14860 -Signed-off-by: Nicholas Bellinger <nab@×××××××××××.org>
14861 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
14862 -Signed-off-by: Mike Pagano <mpagano@g.o>
14863 ----
14864 - drivers/target/target_core_file.c | 15 ++++++++-------
14865 - 1 file changed, 8 insertions(+), 7 deletions(-)
14866 -
14867 -diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
14868 -index 44620fb..8ca1883 100644
14869 ---- a/drivers/target/target_core_file.c
14870 -+++ b/drivers/target/target_core_file.c
14871 -@@ -274,7 +274,7 @@ static int fd_do_prot_rw(struct se_cmd *cmd, struct fd_prot *fd_prot,
14872 - se_dev->prot_length;
14873 + r = i2c_master_recv(client, buf, ST21NFCB_NCI_I2C_MIN_SIZE);
14874 +- if (r == -EREMOTEIO) { /* Retry, chip was in standby */
14875 ++ if (r < 0) { /* Retry, chip was in standby */
14876 + usleep_range(1000, 4000);
14877 + r = i2c_master_recv(client, buf, ST21NFCB_NCI_I2C_MIN_SIZE);
14878 + }
14879 +diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
14880 +index 15c0fab..bceb30b 100644
14881 +--- a/drivers/platform/x86/compal-laptop.c
14882 ++++ b/drivers/platform/x86/compal-laptop.c
14883 +@@ -1026,9 +1026,9 @@ static int compal_probe(struct platform_device *pdev)
14884 + if (err)
14885 + return err;
14886
14887 - if (!is_write) {
14888 -- fd_prot->prot_buf = vzalloc(prot_size);
14889 -+ fd_prot->prot_buf = kzalloc(prot_size, GFP_KERNEL);
14890 - if (!fd_prot->prot_buf) {
14891 - pr_err("Unable to allocate fd_prot->prot_buf\n");
14892 - return -ENOMEM;
14893 -@@ -286,9 +286,10 @@ static int fd_do_prot_rw(struct se_cmd *cmd, struct fd_prot *fd_prot,
14894 - fd_prot->prot_sg_nents, GFP_KERNEL);
14895 - if (!fd_prot->prot_sg) {
14896 - pr_err("Unable to allocate fd_prot->prot_sg\n");
14897 -- vfree(fd_prot->prot_buf);
14898 -+ kfree(fd_prot->prot_buf);
14899 - return -ENOMEM;
14900 - }
14901 -+ sg_init_table(fd_prot->prot_sg, fd_prot->prot_sg_nents);
14902 - size = prot_size;
14903 +- hwmon_dev = hwmon_device_register_with_groups(&pdev->dev,
14904 +- "compal", data,
14905 +- compal_hwmon_groups);
14906 ++ hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev,
14907 ++ "compal", data,
14908 ++ compal_hwmon_groups);
14909 + if (IS_ERR(hwmon_dev)) {
14910 + err = PTR_ERR(hwmon_dev);
14911 + goto remove;
14912 +@@ -1036,7 +1036,9 @@ static int compal_probe(struct platform_device *pdev)
14913
14914 - for_each_sg(fd_prot->prot_sg, sg, fd_prot->prot_sg_nents, i) {
14915 -@@ -318,7 +319,7 @@ static int fd_do_prot_rw(struct se_cmd *cmd, struct fd_prot *fd_prot,
14916 + /* Power supply */
14917 + initialize_power_supply_data(data);
14918 +- power_supply_register(&compal_device->dev, &data->psy);
14919 ++ err = power_supply_register(&compal_device->dev, &data->psy);
14920 ++ if (err < 0)
14921 ++ goto remove;
14922
14923 - if (is_write || ret < 0) {
14924 - kfree(fd_prot->prot_sg);
14925 -- vfree(fd_prot->prot_buf);
14926 -+ kfree(fd_prot->prot_buf);
14927 - }
14928 + platform_set_drvdata(pdev, data);
14929
14930 - return ret;
14931 -@@ -658,11 +659,11 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
14932 - 0, fd_prot.prot_sg, 0);
14933 - if (rc) {
14934 - kfree(fd_prot.prot_sg);
14935 -- vfree(fd_prot.prot_buf);
14936 -+ kfree(fd_prot.prot_buf);
14937 - return rc;
14938 - }
14939 - kfree(fd_prot.prot_sg);
14940 -- vfree(fd_prot.prot_buf);
14941 -+ kfree(fd_prot.prot_buf);
14942 - }
14943 - } else {
14944 - memset(&fd_prot, 0, sizeof(struct fd_prot));
14945 -@@ -678,7 +679,7 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
14946 - 0, fd_prot.prot_sg, 0);
14947 - if (rc) {
14948 - kfree(fd_prot.prot_sg);
14949 -- vfree(fd_prot.prot_buf);
14950 -+ kfree(fd_prot.prot_buf);
14951 - return rc;
14952 - }
14953 - }
14954 -@@ -714,7 +715,7 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
14955 -
14956 - if (ret < 0) {
14957 - kfree(fd_prot.prot_sg);
14958 -- vfree(fd_prot.prot_buf);
14959 -+ kfree(fd_prot.prot_buf);
14960 - return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
14961 - }
14962 +diff --git a/drivers/power/ipaq_micro_battery.c b/drivers/power/ipaq_micro_battery.c
14963 +index 9d69460..96b15e0 100644
14964 +--- a/drivers/power/ipaq_micro_battery.c
14965 ++++ b/drivers/power/ipaq_micro_battery.c
14966 +@@ -226,6 +226,7 @@ static struct power_supply micro_ac_power = {
14967 + static int micro_batt_probe(struct platform_device *pdev)
14968 + {
14969 + struct micro_battery *mb;
14970 ++ int ret;
14971
14972 ---
14973 -2.3.6
14974 -
14975 -
14976 -From 1d6b56f309d72a9ce2be3129f41c4a1138693091 Mon Sep 17 00:00:00 2001
14977 -From: Akinobu Mita <akinobu.mita@×××××.com>
14978 -Date: Mon, 13 Apr 2015 23:21:58 +0900
14979 -Subject: [PATCH 134/219] target/file: Fix UNMAP with DIF protection support
14980 -Cc: mpagano@g.o
14981 -
14982 -commit 64d240b721b21e266ffde645ec965c3b6d1c551f upstream.
14983 -
14984 -When UNMAP command is issued with DIF protection support enabled,
14985 -the protection info for the unmapped region is remain unchanged.
14986 -So READ command for the region causes data integrity failure.
14987 -
14988 -This fixes it by invalidating protection info for the unmapped region
14989 -by filling with 0xff pattern. This change also adds helper function
14990 -fd_do_prot_fill() in order to reduce code duplication with existing
14991 -fd_format_prot().
14992 -
14993 -Signed-off-by: Akinobu Mita <akinobu.mita@×××××.com>
14994 -Reviewed-by: Sagi Grimberg <sagig@××××××××.com>
14995 -Reviewed-by: "Martin K. Petersen" <martin.petersen@××××××.com>
14996 -Cc: Christoph Hellwig <hch@×××.de>
14997 -Cc: "James E.J. Bottomley" <James.Bottomley@×××××××××××××××××.com>
14998 -Signed-off-by: Nicholas Bellinger <nab@×××××××××××.org>
14999 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
15000 -Signed-off-by: Mike Pagano <mpagano@g.o>
15001 ----
15002 - drivers/target/target_core_file.c | 86 +++++++++++++++++++++++++++------------
15003 - 1 file changed, 61 insertions(+), 25 deletions(-)
15004 -
15005 -diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
15006 -index 8ca1883..7e12909 100644
15007 ---- a/drivers/target/target_core_file.c
15008 -+++ b/drivers/target/target_core_file.c
15009 -@@ -550,6 +550,56 @@ fd_execute_write_same(struct se_cmd *cmd)
15010 - return 0;
15011 - }
15012 + mb = devm_kzalloc(&pdev->dev, sizeof(*mb), GFP_KERNEL);
15013 + if (!mb)
15014 +@@ -233,14 +234,30 @@ static int micro_batt_probe(struct platform_device *pdev)
15015
15016 -+static int
15017 -+fd_do_prot_fill(struct se_device *se_dev, sector_t lba, sector_t nolb,
15018 -+ void *buf, size_t bufsize)
15019 -+{
15020 -+ struct fd_dev *fd_dev = FD_DEV(se_dev);
15021 -+ struct file *prot_fd = fd_dev->fd_prot_file;
15022 -+ sector_t prot_length, prot;
15023 -+ loff_t pos = lba * se_dev->prot_length;
15024 -+
15025 -+ if (!prot_fd) {
15026 -+ pr_err("Unable to locate fd_dev->fd_prot_file\n");
15027 -+ return -ENODEV;
15028 -+ }
15029 -+
15030 -+ prot_length = nolb * se_dev->prot_length;
15031 -+
15032 -+ for (prot = 0; prot < prot_length;) {
15033 -+ sector_t len = min_t(sector_t, bufsize, prot_length - prot);
15034 -+ ssize_t ret = kernel_write(prot_fd, buf, len, pos + prot);
15035 -+
15036 -+ if (ret != len) {
15037 -+ pr_err("vfs_write to prot file failed: %zd\n", ret);
15038 -+ return ret < 0 ? ret : -ENODEV;
15039 -+ }
15040 -+ prot += ret;
15041 -+ }
15042 -+
15043 -+ return 0;
15044 -+}
15045 -+
15046 -+static int
15047 -+fd_do_prot_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb)
15048 -+{
15049 -+ void *buf;
15050 -+ int rc;
15051 -+
15052 -+ buf = (void *)__get_free_page(GFP_KERNEL);
15053 -+ if (!buf) {
15054 -+ pr_err("Unable to allocate FILEIO prot buf\n");
15055 + mb->micro = dev_get_drvdata(pdev->dev.parent);
15056 + mb->wq = create_singlethread_workqueue("ipaq-battery-wq");
15057 ++ if (!mb->wq)
15058 + return -ENOMEM;
15059 -+ }
15060 -+ memset(buf, 0xff, PAGE_SIZE);
15061 +
15062 -+ rc = fd_do_prot_fill(cmd->se_dev, lba, nolb, buf, PAGE_SIZE);
15063 -+
15064 -+ free_page((unsigned long)buf);
15065 + INIT_DELAYED_WORK(&mb->update, micro_battery_work);
15066 + platform_set_drvdata(pdev, mb);
15067 + queue_delayed_work(mb->wq, &mb->update, 1);
15068 +- power_supply_register(&pdev->dev, &micro_batt_power);
15069 +- power_supply_register(&pdev->dev, &micro_ac_power);
15070 +
15071 -+ return rc;
15072 -+}
15073 ++ ret = power_supply_register(&pdev->dev, &micro_batt_power);
15074 ++ if (ret < 0)
15075 ++ goto batt_err;
15076 +
15077 - static sense_reason_t
15078 - fd_do_unmap(struct se_cmd *cmd, void *priv, sector_t lba, sector_t nolb)
15079 - {
15080 -@@ -557,6 +607,12 @@ fd_do_unmap(struct se_cmd *cmd, void *priv, sector_t lba, sector_t nolb)
15081 - struct inode *inode = file->f_mapping->host;
15082 - int ret;
15083 ++ ret = power_supply_register(&pdev->dev, &micro_ac_power);
15084 ++ if (ret < 0)
15085 ++ goto ac_err;
15086
15087 -+ if (cmd->se_dev->dev_attrib.pi_prot_type) {
15088 -+ ret = fd_do_prot_unmap(cmd, lba, nolb);
15089 -+ if (ret)
15090 -+ return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
15091 -+ }
15092 + dev_info(&pdev->dev, "iPAQ micro battery driver\n");
15093 + return 0;
15094 +
15095 - if (S_ISBLK(inode->i_mode)) {
15096 - /* The backend is block device, use discard */
15097 - struct block_device *bdev = inode->i_bdev;
15098 -@@ -879,48 +935,28 @@ static int fd_init_prot(struct se_device *dev)
15099 -
15100 - static int fd_format_prot(struct se_device *dev)
15101 - {
15102 -- struct fd_dev *fd_dev = FD_DEV(dev);
15103 -- struct file *prot_fd = fd_dev->fd_prot_file;
15104 -- sector_t prot_length, prot;
15105 - unsigned char *buf;
15106 -- loff_t pos = 0;
15107 - int unit_size = FDBD_FORMAT_UNIT_SIZE * dev->dev_attrib.block_size;
15108 -- int rc, ret = 0, size, len;
15109 -+ int ret;
15110 ++ac_err:
15111 ++ power_supply_unregister(&micro_ac_power);
15112 ++batt_err:
15113 ++ cancel_delayed_work_sync(&mb->update);
15114 ++ destroy_workqueue(mb->wq);
15115 ++ return ret;
15116 + }
15117
15118 - if (!dev->dev_attrib.pi_prot_type) {
15119 - pr_err("Unable to format_prot while pi_prot_type == 0\n");
15120 - return -ENODEV;
15121 - }
15122 -- if (!prot_fd) {
15123 -- pr_err("Unable to locate fd_dev->fd_prot_file\n");
15124 -- return -ENODEV;
15125 -- }
15126 + static int micro_batt_remove(struct platform_device *pdev)
15127 +@@ -251,6 +268,7 @@ static int micro_batt_remove(struct platform_device *pdev)
15128 + power_supply_unregister(&micro_ac_power);
15129 + power_supply_unregister(&micro_batt_power);
15130 + cancel_delayed_work_sync(&mb->update);
15131 ++ destroy_workqueue(mb->wq);
15132
15133 - buf = vzalloc(unit_size);
15134 - if (!buf) {
15135 - pr_err("Unable to allocate FILEIO prot buf\n");
15136 - return -ENOMEM;
15137 - }
15138 -- prot_length = (dev->transport->get_blocks(dev) + 1) * dev->prot_length;
15139 -- size = prot_length;
15140 + return 0;
15141 + }
15142 +diff --git a/drivers/power/lp8788-charger.c b/drivers/power/lp8788-charger.c
15143 +index 21fc233..176dab2 100644
15144 +--- a/drivers/power/lp8788-charger.c
15145 ++++ b/drivers/power/lp8788-charger.c
15146 +@@ -417,8 +417,10 @@ static int lp8788_psy_register(struct platform_device *pdev,
15147 + pchg->battery.num_properties = ARRAY_SIZE(lp8788_battery_prop);
15148 + pchg->battery.get_property = lp8788_battery_get_property;
15149
15150 - pr_debug("Using FILEIO prot_length: %llu\n",
15151 -- (unsigned long long)prot_length);
15152 -+ (unsigned long long)(dev->transport->get_blocks(dev) + 1) *
15153 -+ dev->prot_length);
15154 +- if (power_supply_register(&pdev->dev, &pchg->battery))
15155 ++ if (power_supply_register(&pdev->dev, &pchg->battery)) {
15156 ++ power_supply_unregister(&pchg->charger);
15157 + return -EPERM;
15158 ++ }
15159
15160 - memset(buf, 0xff, unit_size);
15161 -- for (prot = 0; prot < prot_length; prot += unit_size) {
15162 -- len = min(unit_size, size);
15163 -- rc = kernel_write(prot_fd, buf, len, pos);
15164 -- if (rc != len) {
15165 -- pr_err("vfs_write to prot file failed: %d\n", rc);
15166 -- ret = -ENODEV;
15167 -- goto out;
15168 -- }
15169 -- pos += len;
15170 -- size -= len;
15171 -- }
15172 --
15173 --out:
15174 -+ ret = fd_do_prot_fill(dev, 0, dev->transport->get_blocks(dev) + 1,
15175 -+ buf, unit_size);
15176 - vfree(buf);
15177 - return ret;
15178 + return 0;
15179 }
15180 ---
15181 -2.3.6
15182 -
15183 -
15184 -From 53e5aa168e3ba918741417ac2177db04a84f77c1 Mon Sep 17 00:00:00 2001
15185 -From: Akinobu Mita <akinobu.mita@×××××.com>
15186 -Date: Mon, 13 Apr 2015 23:21:57 +0900
15187 -Subject: [PATCH 135/219] target/file: Fix SG table for prot_buf initialization
15188 -Cc: mpagano@g.o
15189 -
15190 -commit c836777830428372074d5129ac513e1472c99791 upstream.
15191 -
15192 -In fd_do_prot_rw(), it allocates prot_buf which is used to copy from
15193 -se_cmd->t_prot_sg by sbc_dif_copy_prot(). The SG table for prot_buf
15194 -is also initialized by allocating 'se_cmd->t_prot_nents' entries of
15195 -scatterlist and setting the data length of each entry to PAGE_SIZE
15196 -at most.
15197 -
15198 -However if se_cmd->t_prot_sg contains a clustered entry (i.e.
15199 -sg->length > PAGE_SIZE), the SG table for prot_buf can't be
15200 -initialized correctly and sbc_dif_copy_prot() can't copy to prot_buf.
15201 -(This actually happened with TCM loopback fabric module)
15202 -
15203 -As prot_buf is allocated by kzalloc() and it's physically contiguous,
15204 -we only need a single scatterlist entry.
15205 -
15206 -Signed-off-by: Akinobu Mita <akinobu.mita@×××××.com>
15207 -Cc: Sagi Grimberg <sagig@××××××××.com>
15208 -Cc: "Martin K. Petersen" <martin.petersen@××××××.com>
15209 -Cc: Christoph Hellwig <hch@×××.de>
15210 -Cc: "James E.J. Bottomley" <James.Bottomley@×××××××××××××××××.com>
15211 -Signed-off-by: Nicholas Bellinger <nab@×××××××××××.org>
15212 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
15213 -Signed-off-by: Mike Pagano <mpagano@g.o>
15214 ----
15215 - drivers/target/target_core_file.c | 21 ++++++---------------
15216 - 1 file changed, 6 insertions(+), 15 deletions(-)
15217 -
15218 -diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
15219 -index 7e12909..cbb0cc2 100644
15220 ---- a/drivers/target/target_core_file.c
15221 -+++ b/drivers/target/target_core_file.c
15222 -@@ -264,11 +264,10 @@ static int fd_do_prot_rw(struct se_cmd *cmd, struct fd_prot *fd_prot,
15223 - struct se_device *se_dev = cmd->se_dev;
15224 - struct fd_dev *dev = FD_DEV(se_dev);
15225 - struct file *prot_fd = dev->fd_prot_file;
15226 -- struct scatterlist *sg;
15227 - loff_t pos = (cmd->t_task_lba * se_dev->prot_length);
15228 - unsigned char *buf;
15229 -- u32 prot_size, len, size;
15230 -- int rc, ret = 1, i;
15231 -+ u32 prot_size;
15232 -+ int rc, ret = 1;
15233 -
15234 - prot_size = (cmd->data_length / se_dev->dev_attrib.block_size) *
15235 - se_dev->prot_length;
15236 -@@ -281,24 +280,16 @@ static int fd_do_prot_rw(struct se_cmd *cmd, struct fd_prot *fd_prot,
15237 - }
15238 - buf = fd_prot->prot_buf;
15239 +diff --git a/drivers/power/twl4030_madc_battery.c b/drivers/power/twl4030_madc_battery.c
15240 +index 7ef445a..cf90760 100644
15241 +--- a/drivers/power/twl4030_madc_battery.c
15242 ++++ b/drivers/power/twl4030_madc_battery.c
15243 +@@ -192,6 +192,7 @@ static int twl4030_madc_battery_probe(struct platform_device *pdev)
15244 + {
15245 + struct twl4030_madc_battery *twl4030_madc_bat;
15246 + struct twl4030_madc_bat_platform_data *pdata = pdev->dev.platform_data;
15247 ++ int ret = 0;
15248
15249 -- fd_prot->prot_sg_nents = cmd->t_prot_nents;
15250 -- fd_prot->prot_sg = kzalloc(sizeof(struct scatterlist) *
15251 -- fd_prot->prot_sg_nents, GFP_KERNEL);
15252 -+ fd_prot->prot_sg_nents = 1;
15253 -+ fd_prot->prot_sg = kzalloc(sizeof(struct scatterlist),
15254 -+ GFP_KERNEL);
15255 - if (!fd_prot->prot_sg) {
15256 - pr_err("Unable to allocate fd_prot->prot_sg\n");
15257 - kfree(fd_prot->prot_buf);
15258 - return -ENOMEM;
15259 - }
15260 - sg_init_table(fd_prot->prot_sg, fd_prot->prot_sg_nents);
15261 -- size = prot_size;
15262 --
15263 -- for_each_sg(fd_prot->prot_sg, sg, fd_prot->prot_sg_nents, i) {
15264 --
15265 -- len = min_t(u32, PAGE_SIZE, size);
15266 -- sg_set_buf(sg, buf, len);
15267 -- size -= len;
15268 -- buf += len;
15269 -- }
15270 -+ sg_set_buf(fd_prot->prot_sg, buf, prot_size);
15271 - }
15272 + twl4030_madc_bat = kzalloc(sizeof(*twl4030_madc_bat), GFP_KERNEL);
15273 + if (!twl4030_madc_bat)
15274 +@@ -216,9 +217,11 @@ static int twl4030_madc_battery_probe(struct platform_device *pdev)
15275
15276 - if (is_write) {
15277 ---
15278 -2.3.6
15279 -
15280 -
15281 -From 6c617001eadca79dc3c26a6e2d2844ad48c1a178 Mon Sep 17 00:00:00 2001
15282 -From: Sagi Grimberg <sagig@××××××××.com>
15283 -Date: Sun, 29 Mar 2015 15:52:03 +0300
15284 -Subject: [PATCH 136/219] iser-target: Fix session hang in case of an rdma read
15285 - DIF error
15286 -Cc: mpagano@g.o
15287 -
15288 -commit 364189f0ada5478e4faf8a552d6071a650d757cd upstream.
15289 -
15290 -This hang was a result of a missing command put when
15291 -a DIF error occurred during a rdma read (and we sent
15292 -an CHECK_CONDITION error without passing it to the
15293 -backend).
15294 -
15295 -Signed-off-by: Sagi Grimberg <sagig@××××××××.com>
15296 -Signed-off-by: Nicholas Bellinger <nab@×××××××××××.org>
15297 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
15298 -Signed-off-by: Mike Pagano <mpagano@g.o>
15299 ----
15300 - drivers/infiniband/ulp/isert/ib_isert.c | 6 ++++--
15301 - 1 file changed, 4 insertions(+), 2 deletions(-)
15302 -
15303 -diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
15304 -index 075b19c..4b8d518 100644
15305 ---- a/drivers/infiniband/ulp/isert/ib_isert.c
15306 -+++ b/drivers/infiniband/ulp/isert/ib_isert.c
15307 -@@ -1861,11 +1861,13 @@ isert_completion_rdma_read(struct iser_tx_desc *tx_desc,
15308 - cmd->i_state = ISTATE_RECEIVED_LAST_DATAOUT;
15309 - spin_unlock_bh(&cmd->istate_lock);
15310 + twl4030_madc_bat->pdata = pdata;
15311 + platform_set_drvdata(pdev, twl4030_madc_bat);
15312 +- power_supply_register(&pdev->dev, &twl4030_madc_bat->psy);
15313 ++ ret = power_supply_register(&pdev->dev, &twl4030_madc_bat->psy);
15314 ++ if (ret < 0)
15315 ++ kfree(twl4030_madc_bat);
15316
15317 -- if (ret)
15318 -+ if (ret) {
15319 -+ target_put_sess_cmd(se_cmd->se_sess, se_cmd);
15320 - transport_send_check_condition_and_sense(se_cmd,
15321 - se_cmd->pi_err, 0);
15322 -- else
15323 -+ } else {
15324 - target_execute_cmd(se_cmd);
15325 -+ }
15326 +- return 0;
15327 ++ return ret;
15328 }
15329
15330 - static void
15331 ---
15332 -2.3.6
15333 -
15334 -
15335 -From c1398bc9478760e098fd1a36c9d67eeaf1bc5813 Mon Sep 17 00:00:00 2001
15336 -From: Sagi Grimberg <sagig@××××××××.com>
15337 -Date: Sun, 29 Mar 2015 15:52:04 +0300
15338 -Subject: [PATCH 137/219] iser-target: Fix possible deadlock in RDMA_CM
15339 - connection error
15340 -Cc: mpagano@g.o
15341 -
15342 -commit 4a579da2586bd3b79b025947ea24ede2bbfede62 upstream.
15343 -
15344 -Before we reach to connection established we may get an
15345 -error event. In this case the core won't teardown this
15346 -connection (never established it), so we take care of freeing
15347 -it ourselves.
15348 -
15349 -Signed-off-by: Sagi Grimberg <sagig@××××××××.com>
15350 -Signed-off-by: Nicholas Bellinger <nab@×××××××××××.org>
15351 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
15352 -Signed-off-by: Mike Pagano <mpagano@g.o>
15353 ----
15354 - drivers/infiniband/ulp/isert/ib_isert.c | 14 +++++++++-----
15355 - 1 file changed, 9 insertions(+), 5 deletions(-)
15356 -
15357 -diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
15358 -index 4b8d518..147029a 100644
15359 ---- a/drivers/infiniband/ulp/isert/ib_isert.c
15360 -+++ b/drivers/infiniband/ulp/isert/ib_isert.c
15361 -@@ -222,7 +222,7 @@ fail:
15362 - static void
15363 - isert_free_rx_descriptors(struct isert_conn *isert_conn)
15364 - {
15365 -- struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
15366 -+ struct ib_device *ib_dev = isert_conn->conn_device->ib_device;
15367 - struct iser_rx_desc *rx_desc;
15368 - int i;
15369 + static int twl4030_madc_battery_remove(struct platform_device *pdev)
15370 +diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
15371 +index 675b5e7..5a0800d 100644
15372 +--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
15373 ++++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
15374 +@@ -1584,11 +1584,11 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,
15375 + fp_possible = io_info.fpOkForIo;
15376 + }
15377
15378 -@@ -719,8 +719,8 @@ out:
15379 - static void
15380 - isert_connect_release(struct isert_conn *isert_conn)
15381 - {
15382 -- struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
15383 - struct isert_device *device = isert_conn->conn_device;
15384 -+ struct ib_device *ib_dev = device->ib_device;
15385 +- /* Use smp_processor_id() for now until cmd->request->cpu is CPU
15386 ++ /* Use raw_smp_processor_id() for now until cmd->request->cpu is CPU
15387 + id by default, not CPU group id, otherwise all MSI-X queues won't
15388 + be utilized */
15389 + cmd->request_desc->SCSIIO.MSIxIndex = instance->msix_vectors ?
15390 +- smp_processor_id() % instance->msix_vectors : 0;
15391 ++ raw_smp_processor_id() % instance->msix_vectors : 0;
15392
15393 - isert_dbg("conn %p\n", isert_conn);
15394 + if (fp_possible) {
15395 + megasas_set_pd_lba(io_request, scp->cmd_len, &io_info, scp,
15396 +@@ -1693,7 +1693,10 @@ megasas_build_dcdb_fusion(struct megasas_instance *instance,
15397 + << MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT;
15398 + cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle;
15399 + cmd->request_desc->SCSIIO.MSIxIndex =
15400 +- instance->msix_vectors ? smp_processor_id() % instance->msix_vectors : 0;
15401 ++ instance->msix_vectors ?
15402 ++ raw_smp_processor_id() %
15403 ++ instance->msix_vectors :
15404 ++ 0;
15405 + os_timeout_value = scmd->request->timeout / HZ;
15406
15407 -@@ -728,7 +728,8 @@ isert_connect_release(struct isert_conn *isert_conn)
15408 - isert_conn_free_fastreg_pool(isert_conn);
15409 + if (instance->secure_jbod_support &&
15410 +diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
15411 +index 2d5ab6d..454536c 100644
15412 +--- a/drivers/scsi/mvsas/mv_sas.c
15413 ++++ b/drivers/scsi/mvsas/mv_sas.c
15414 +@@ -441,14 +441,11 @@ static u32 mvs_get_ncq_tag(struct sas_task *task, u32 *tag)
15415 + static int mvs_task_prep_ata(struct mvs_info *mvi,
15416 + struct mvs_task_exec_info *tei)
15417 + {
15418 +- struct sas_ha_struct *sha = mvi->sas;
15419 + struct sas_task *task = tei->task;
15420 + struct domain_device *dev = task->dev;
15421 + struct mvs_device *mvi_dev = dev->lldd_dev;
15422 + struct mvs_cmd_hdr *hdr = tei->hdr;
15423 + struct asd_sas_port *sas_port = dev->port;
15424 +- struct sas_phy *sphy = dev->phy;
15425 +- struct asd_sas_phy *sas_phy = sha->sas_phy[sphy->number];
15426 + struct mvs_slot_info *slot;
15427 + void *buf_prd;
15428 + u32 tag = tei->tag, hdr_tag;
15429 +@@ -468,7 +465,7 @@ static int mvs_task_prep_ata(struct mvs_info *mvi,
15430 + slot->tx = mvi->tx_prod;
15431 + del_q = TXQ_MODE_I | tag |
15432 + (TXQ_CMD_STP << TXQ_CMD_SHIFT) |
15433 +- (MVS_PHY_ID << TXQ_PHY_SHIFT) |
15434 ++ ((sas_port->phy_mask & TXQ_PHY_MASK) << TXQ_PHY_SHIFT) |
15435 + (mvi_dev->taskfileset << TXQ_SRS_SHIFT);
15436 + mvi->tx[mvi->tx_prod] = cpu_to_le32(del_q);
15437
15438 - isert_free_rx_descriptors(isert_conn);
15439 -- rdma_destroy_id(isert_conn->conn_cm_id);
15440 -+ if (isert_conn->conn_cm_id)
15441 -+ rdma_destroy_id(isert_conn->conn_cm_id);
15442 +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
15443 +index 6b78476..3290a3e 100644
15444 +--- a/drivers/scsi/sd.c
15445 ++++ b/drivers/scsi/sd.c
15446 +@@ -3100,6 +3100,7 @@ static void scsi_disk_release(struct device *dev)
15447 + ida_remove(&sd_index_ida, sdkp->index);
15448 + spin_unlock(&sd_index_lock);
15449
15450 - if (isert_conn->conn_qp) {
15451 - struct isert_comp *comp = isert_conn->conn_qp->recv_cq->cq_context;
15452 -@@ -878,12 +879,15 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id,
15453 - return 0;
15454 - }
15455 ++ blk_integrity_unregister(disk);
15456 + disk->private_data = NULL;
15457 + put_disk(disk);
15458 + put_device(&sdkp->device->sdev_gendev);
15459 +diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c
15460 +index 14c7d42..5c06d29 100644
15461 +--- a/drivers/scsi/sd_dif.c
15462 ++++ b/drivers/scsi/sd_dif.c
15463 +@@ -77,7 +77,7 @@ void sd_dif_config_host(struct scsi_disk *sdkp)
15464
15465 --static void
15466 -+static int
15467 - isert_connect_error(struct rdma_cm_id *cma_id)
15468 - {
15469 - struct isert_conn *isert_conn = cma_id->qp->qp_context;
15470 + disk->integrity->flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
15471
15472 -+ isert_conn->conn_cm_id = NULL;
15473 - isert_put_conn(isert_conn);
15474 -+
15475 -+ return -1;
15476 - }
15477 +- if (!sdkp)
15478 ++ if (!sdkp->ATO)
15479 + return;
15480
15481 - static int
15482 -@@ -912,7 +916,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
15483 - case RDMA_CM_EVENT_REJECTED: /* FALLTHRU */
15484 - case RDMA_CM_EVENT_UNREACHABLE: /* FALLTHRU */
15485 - case RDMA_CM_EVENT_CONNECT_ERROR:
15486 -- isert_connect_error(cma_id);
15487 -+ ret = isert_connect_error(cma_id);
15488 - break;
15489 - default:
15490 - isert_err("Unhandled RDMA CMA event: %d\n", event->event);
15491 ---
15492 -2.3.6
15493 -
15494 -
15495 -From 1ed449ae56cbf5db4f3ea0560a5bfbe95e30e89a Mon Sep 17 00:00:00 2001
15496 -From: Alexander Ploumistos <alex.ploumistos@×××××.com>
15497 -Date: Fri, 13 Feb 2015 21:05:11 +0200
15498 -Subject: [PATCH 138/219] Bluetooth: ath3k: Add support Atheros AR5B195 combo
15499 - Mini PCIe card
15500 -Cc: mpagano@g.o
15501 -
15502 -commit 2eeff0b4317a02f0e281df891d990194f0737aae upstream.
15503 -
15504 -Add 04f2:aff1 to ath3k.c supported devices list and btusb.c blacklist, so
15505 -that the device can load the ath3k firmware and re-enumerate itself as an
15506 -AR3011 device.
15507 -
15508 -T: Bus=05 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
15509 -D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
15510 -P: Vendor=04f2 ProdID=aff1 Rev= 0.01
15511 -C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
15512 -I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
15513 -E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
15514 -E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
15515 -E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
15516 -I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
15517 -E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
15518 -E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
15519 -I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
15520 -E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
15521 -E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
15522 -I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
15523 -E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
15524 -E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
15525 -I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
15526 -E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
15527 -E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
15528 -I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
15529 -E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
15530 -E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
15531 -I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
15532 -E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
15533 -E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
15534 -
15535 -Signed-off-by: Alexander Ploumistos <alexpl@×××××××××××××.org>
15536 -Signed-off-by: Marcel Holtmann <marcel@××××××××.org>
15537 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
15538 -Signed-off-by: Mike Pagano <mpagano@g.o>
15539 ----
15540 - drivers/bluetooth/ath3k.c | 1 +
15541 - drivers/bluetooth/btusb.c | 1 +
15542 - 2 files changed, 2 insertions(+)
15543 -
15544 -diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
15545 -index de4c849..288547a 100644
15546 ---- a/drivers/bluetooth/ath3k.c
15547 -+++ b/drivers/bluetooth/ath3k.c
15548 -@@ -65,6 +65,7 @@ static const struct usb_device_id ath3k_table[] = {
15549 - /* Atheros AR3011 with sflash firmware*/
15550 - { USB_DEVICE(0x0489, 0xE027) },
15551 - { USB_DEVICE(0x0489, 0xE03D) },
15552 -+ { USB_DEVICE(0x04F2, 0xAFF1) },
15553 - { USB_DEVICE(0x0930, 0x0215) },
15554 - { USB_DEVICE(0x0CF3, 0x3002) },
15555 - { USB_DEVICE(0x0CF3, 0xE019) },
15556 -diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
15557 -index 8bfc4c2..2c527da 100644
15558 ---- a/drivers/bluetooth/btusb.c
15559 -+++ b/drivers/bluetooth/btusb.c
15560 -@@ -159,6 +159,7 @@ static const struct usb_device_id blacklist_table[] = {
15561 - /* Atheros 3011 with sflash firmware */
15562 - { USB_DEVICE(0x0489, 0xe027), .driver_info = BTUSB_IGNORE },
15563 - { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE },
15564 -+ { USB_DEVICE(0x04f2, 0xaff1), .driver_info = BTUSB_IGNORE },
15565 - { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE },
15566 - { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE },
15567 - { USB_DEVICE(0x0cf3, 0xe019), .driver_info = BTUSB_IGNORE },
15568 ---
15569 -2.3.6
15570 -
15571 -
15572 -From 929315920e42097f53f97bfc88c6da4a41e19f66 Mon Sep 17 00:00:00 2001
15573 -From: Bo Yan <byan@××××××.com>
15574 -Date: Tue, 31 Mar 2015 21:30:48 +0100
15575 -Subject: [PATCH 139/219] arm64: fix midr range for Cortex-A57 erratum 832075
15576 -Cc: mpagano@g.o
15577 -
15578 -commit 6d1966dfd6e0ad2f8aa4b664ae1a62e33abe1998 upstream.
15579 -
15580 -Register MIDR_EL1 is masked to get variant and revision fields, then
15581 -compared against midr_range_min and midr_range_max when checking
15582 -whether CPU is affected by any particular erratum. However, variant
15583 -and revision fields in MIDR_EL1 are separated by 16 bits, so the min
15584 -and max of midr range should be constructed accordingly, otherwise
15585 -the patch will not be applied when variant field is non-0.
15586 -
15587 -Acked-by: Andre Przywara <andre.przywara@×××.com>
15588 -Reviewed-by: Paul Walmsley <paul@×××××.com>
15589 -Signed-off-by: Bo Yan <byan@××××××.com>
15590 -[will: use MIDR_VARIANT_SHIFT to construct upper bound]
15591 -Signed-off-by: Will Deacon <will.deacon@×××.com>
15592 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
15593 -
15594 -Signed-off-by: Mike Pagano <mpagano@g.o>
15595 ----
15596 - arch/arm64/kernel/cpu_errata.c | 3 ++-
15597 - 1 file changed, 2 insertions(+), 1 deletion(-)
15598 -
15599 -diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
15600 -index fa62637..7c48494 100644
15601 ---- a/arch/arm64/kernel/cpu_errata.c
15602 -+++ b/arch/arm64/kernel/cpu_errata.c
15603 -@@ -88,7 +88,8 @@ struct arm64_cpu_capabilities arm64_errata[] = {
15604 - /* Cortex-A57 r0p0 - r1p2 */
15605 - .desc = "ARM erratum 832075",
15606 - .capability = ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE,
15607 -- MIDR_RANGE(MIDR_CORTEX_A57, 0x00, 0x12),
15608 -+ MIDR_RANGE(MIDR_CORTEX_A57, 0x00,
15609 -+ (1 << MIDR_VARIANT_SHIFT) | 2),
15610 - },
15611 - #endif
15612 - {
15613 ---
15614 -2.3.6
15615 -
15616 -
15617 -From 28a75aebb66869d9b48970bc9ad2c50d06ca2368 Mon Sep 17 00:00:00 2001
15618 -From: Mark Rutland <mark.rutland@×××.com>
15619 -Date: Tue, 24 Mar 2015 13:50:27 +0000
15620 -Subject: [PATCH 140/219] arm64: head.S: ensure visibility of page tables
15621 -Cc: mpagano@g.o
15622 -
15623 -commit 91d57155dc5ab4b311624b7ee570339b6af19ad5 upstream.
15624 -
15625 -After writing the page tables, we use __inval_cache_range to invalidate
15626 -any stale cache entries. Strongly Ordered memory accesses are not
15627 -ordered w.r.t. cache maintenance instructions, and hence explicit memory
15628 -barriers are required to provide this ordering. However,
15629 -__inval_cache_range was written to be used on Normal Cacheable memory
15630 -once the MMU and caches are on, and does not have any barriers prior to
15631 -the DC instructions.
15632 -
15633 -This patch adds a DMB between the page tables being written and the
15634 -corresponding cachelines being invalidated, ensuring that the
15635 -invalidation makes the new data visible to subsequent cacheable
15636 -accesses. A barrier is not required before the prior invalidate as we do
15637 -not access the page table memory area prior to this, and earlier
15638 -barriers in preserve_boot_args and set_cpu_boot_mode_flag ensures
15639 -ordering w.r.t. any stores performed prior to entering Linux.
15640 -
15641 -Signed-off-by: Mark Rutland <mark.rutland@×××.com>
15642 -Cc: Catalin Marinas <catalin.marinas@×××.com>
15643 -Cc: Will Deacon <will.deacon@×××.com>
15644 -Fixes: c218bca74eeafa2f ("arm64: Relax the kernel cache requirements for boot")
15645 -Signed-off-by: Will Deacon <will.deacon@×××.com>
15646 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
15647 -Signed-off-by: Mike Pagano <mpagano@g.o>
15648 ----
15649 - arch/arm64/kernel/head.S | 1 +
15650 - 1 file changed, 1 insertion(+)
15651 -
15652 -diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
15653 -index 07f9305..c237ffb 100644
15654 ---- a/arch/arm64/kernel/head.S
15655 -+++ b/arch/arm64/kernel/head.S
15656 -@@ -426,6 +426,7 @@ __create_page_tables:
15657 - */
15658 - mov x0, x25
15659 - add x1, x26, #SWAPPER_DIR_SIZE
15660 -+ dmb sy
15661 - bl __inval_cache_range
15662 + if (type == SD_DIF_TYPE3_PROTECTION)
15663 +diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
15664 +index efc6e44..bf8c5c1 100644
15665 +--- a/drivers/scsi/storvsc_drv.c
15666 ++++ b/drivers/scsi/storvsc_drv.c
15667 +@@ -746,21 +746,22 @@ static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl,
15668 + if (bounce_sgl[j].length == PAGE_SIZE) {
15669 + /* full..move to next entry */
15670 + sg_kunmap_atomic(bounce_addr);
15671 ++ bounce_addr = 0;
15672 + j++;
15673 ++ }
15674
15675 - mov lr, x27
15676 ---
15677 -2.3.6
15678 -
15679 -
15680 -From 3b4f68e9d08a42860dd7491e973a1ba2abcf4ea7 Mon Sep 17 00:00:00 2001
15681 -From: Steve Capper <steve.capper@××××××.org>
15682 -Date: Mon, 16 Mar 2015 09:30:39 +0000
15683 -Subject: [PATCH 141/219] arm64: Adjust EFI libstub object include logic
15684 -Cc: mpagano@g.o
15685 -
15686 -commit ad08fd494bf00c03ae372e0bbd9cefa37bf608d6 upstream.
15687 -
15688 -Commit f4f75ad5 ("efi: efistub: Convert into static library")
15689 -introduced a static library for EFI stub, libstub.
15690 -
15691 -The EFI libstub directory is referenced by the kernel build system via
15692 -a obj subdirectory rule in:
15693 -drivers/firmware/efi/Makefile
15694 -
15695 -Unfortunately, arm64 also references the EFI libstub via:
15696 -libs-$(CONFIG_EFI_STUB) += drivers/firmware/efi/libstub/
15697 -
15698 -If we're unlucky, the kernel build system can enter libstub via two
15699 -simultaneous threads resulting in build failures such as:
15700 -
15701 -fixdep: error opening depfile: drivers/firmware/efi/libstub/.efi-stub-helper.o.d: No such file or directory
15702 -scripts/Makefile.build:257: recipe for target 'drivers/firmware/efi/libstub/efi-stub-helper.o' failed
15703 -make[1]: *** [drivers/firmware/efi/libstub/efi-stub-helper.o] Error 2
15704 -Makefile:939: recipe for target 'drivers/firmware/efi/libstub' failed
15705 -make: *** [drivers/firmware/efi/libstub] Error 2
15706 -make: *** Waiting for unfinished jobs....
15707 -
15708 -This patch adjusts the arm64 Makefile to reference the compiled library
15709 -explicitly (as is currently done in x86), rather than the directory.
15710 -
15711 -Fixes: f4f75ad5 efi: efistub: Convert into static library
15712 -Signed-off-by: Steve Capper <steve.capper@××××××.org>
15713 -Signed-off-by: Will Deacon <will.deacon@×××.com>
15714 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
15715 -Signed-off-by: Mike Pagano <mpagano@g.o>
15716 ----
15717 - arch/arm64/Makefile | 2 +-
15718 - 1 file changed, 1 insertion(+), 1 deletion(-)
15719 -
15720 -diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
15721 -index 69ceedc..4d2a925 100644
15722 ---- a/arch/arm64/Makefile
15723 -+++ b/arch/arm64/Makefile
15724 -@@ -48,7 +48,7 @@ core-$(CONFIG_KVM) += arch/arm64/kvm/
15725 - core-$(CONFIG_XEN) += arch/arm64/xen/
15726 - core-$(CONFIG_CRYPTO) += arch/arm64/crypto/
15727 - libs-y := arch/arm64/lib/ $(libs-y)
15728 --libs-$(CONFIG_EFI_STUB) += drivers/firmware/efi/libstub/
15729 -+core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
15730 +- /* if we need to use another bounce buffer */
15731 +- if (srclen || i != orig_sgl_count - 1)
15732 +- bounce_addr = sg_kmap_atomic(bounce_sgl,j);
15733 ++ /* if we need to use another bounce buffer */
15734 ++ if (srclen && bounce_addr == 0)
15735 ++ bounce_addr = sg_kmap_atomic(bounce_sgl, j);
15736
15737 - # Default target when executing plain make
15738 - KBUILD_IMAGE := Image.gz
15739 ---
15740 -2.3.6
15741 -
15742 -
15743 -From f5fc6d70222ede94eb601c8f2697df1a9bcd9535 Mon Sep 17 00:00:00 2001
15744 -From: Mark Rutland <mark.rutland@×××.com>
15745 -Date: Fri, 13 Mar 2015 16:14:34 +0000
15746 -Subject: [PATCH 142/219] arm64: apply alternatives for !SMP kernels
15747 -Cc: mpagano@g.o
15748 -
15749 -commit 137650aad96c9594683445e41afa8ac5a2097520 upstream.
15750 -
15751 -Currently we only perform alternative patching for kernels built with
15752 -CONFIG_SMP, as we call apply_alternatives_all() in smp.c, which is only
15753 -built for CONFIG_SMP. Thus !SMP kernels may not have necessary
15754 -alternatives patched in.
15755 -
15756 -This patch ensures that we call apply_alternatives_all() once all CPUs
15757 -are booted, even for !SMP kernels, by having the smp_init_cpus() stub
15758 -call this for !SMP kernels via up_late_init. A new wrapper,
15759 -do_post_cpus_up_work, is added so we can hook other calls here later
15760 -(e.g. boot mode logging).
15761 -
15762 -Cc: Andre Przywara <andre.przywara@×××.com>
15763 -Cc: Catalin Marinas <catalin.marinas@×××.com>
15764 -Fixes: e039ee4ee3fcf174 ("arm64: add alternative runtime patching")
15765 -Tested-by: Ard Biesheuvel <ard.biesheuvel@××××××.org>
15766 -Reviewed-by: Ard Biesheuvel <ard.biesheuvel@××××××.org>
15767 -Signed-off-by: Mark Rutland <mark.rutland@×××.com>
15768 -Signed-off-by: Will Deacon <will.deacon@×××.com>
15769 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
15770 -Signed-off-by: Mike Pagano <mpagano@g.o>
15771 ----
15772 - arch/arm64/Kconfig | 4 ++++
15773 - arch/arm64/include/asm/smp_plat.h | 2 ++
15774 - arch/arm64/kernel/setup.c | 12 ++++++++++++
15775 - arch/arm64/kernel/smp.c | 2 +-
15776 - 4 files changed, 19 insertions(+), 1 deletion(-)
15777 -
15778 -diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
15779 -index 1b8e973..0d46deb 100644
15780 ---- a/arch/arm64/Kconfig
15781 -+++ b/arch/arm64/Kconfig
15782 -@@ -470,6 +470,10 @@ config HOTPLUG_CPU
15783 +- } else if (srclen == 0 && i == orig_sgl_count - 1) {
15784 +- /* unmap the last bounce that is < PAGE_SIZE */
15785 +- sg_kunmap_atomic(bounce_addr);
15786 +- }
15787 + }
15788
15789 - source kernel/Kconfig.preempt
15790 + sg_kunmap_atomic(src_addr - orig_sgl[i].offset);
15791 + }
15792
15793 -+config UP_LATE_INIT
15794 -+ def_bool y
15795 -+ depends on !SMP
15796 ++ if (bounce_addr)
15797 ++ sg_kunmap_atomic(bounce_addr);
15798 +
15799 - config HZ
15800 - int
15801 - default 100
15802 -diff --git a/arch/arm64/include/asm/smp_plat.h b/arch/arm64/include/asm/smp_plat.h
15803 -index 59e2823..8dcd61e 100644
15804 ---- a/arch/arm64/include/asm/smp_plat.h
15805 -+++ b/arch/arm64/include/asm/smp_plat.h
15806 -@@ -40,4 +40,6 @@ static inline u32 mpidr_hash_size(void)
15807 - extern u64 __cpu_logical_map[NR_CPUS];
15808 - #define cpu_logical_map(cpu) __cpu_logical_map[cpu]
15809 + local_irq_restore(flags);
15810
15811 -+void __init do_post_cpus_up_work(void);
15812 -+
15813 - #endif /* __ASM_SMP_PLAT_H */
15814 -diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
15815 -index e8420f6..781f469 100644
15816 ---- a/arch/arm64/kernel/setup.c
15817 -+++ b/arch/arm64/kernel/setup.c
15818 -@@ -207,6 +207,18 @@ static void __init smp_build_mpidr_hash(void)
15819 - }
15820 - #endif
15821 + return total_copied;
15822 +diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
15823 +index 6fea4af..aea3a67 100644
15824 +--- a/drivers/spi/spi-imx.c
15825 ++++ b/drivers/spi/spi-imx.c
15826 +@@ -370,8 +370,6 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx,
15827 + if (spi_imx->dma_is_inited) {
15828 + dma = readl(spi_imx->base + MX51_ECSPI_DMA);
15829
15830 -+void __init do_post_cpus_up_work(void)
15831 -+{
15832 -+ apply_alternatives_all();
15833 -+}
15834 -+
15835 -+#ifdef CONFIG_UP_LATE_INIT
15836 -+void __init up_late_init(void)
15837 -+{
15838 -+ do_post_cpus_up_work();
15839 -+}
15840 -+#endif /* CONFIG_UP_LATE_INIT */
15841 -+
15842 - static void __init setup_processor(void)
15843 - {
15844 - struct cpu_info *cpu_info;
15845 -diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
15846 -index 328b8ce..4257369 100644
15847 ---- a/arch/arm64/kernel/smp.c
15848 -+++ b/arch/arm64/kernel/smp.c
15849 -@@ -309,7 +309,7 @@ void cpu_die(void)
15850 - void __init smp_cpus_done(unsigned int max_cpus)
15851 - {
15852 - pr_info("SMP: Total of %d processors activated.\n", num_online_cpus());
15853 -- apply_alternatives_all();
15854 -+ do_post_cpus_up_work();
15855 - }
15856 -
15857 - void __init smp_prepare_boot_cpu(void)
15858 ---
15859 -2.3.6
15860 -
15861 -
15862 -From d56f1962494430ce86e221537a2116a8ff0dca7e Mon Sep 17 00:00:00 2001
15863 -From: Will Deacon <will.deacon@×××.com>
15864 -Date: Mon, 23 Mar 2015 19:07:02 +0000
15865 -Subject: [PATCH 143/219] arm64: errata: add workaround for cortex-a53 erratum
15866 - #845719
15867 -Cc: mpagano@g.o
15868 -
15869 -commit 905e8c5dcaa147163672b06fe9dcb5abaacbc711 upstream.
15870 -
15871 -When running a compat (AArch32) userspace on Cortex-A53, a load at EL0
15872 -from a virtual address that matches the bottom 32 bits of the virtual
15873 -address used by a recent load at (AArch64) EL1 might return incorrect
15874 -data.
15875 -
15876 -This patch works around the issue by writing to the contextidr_el1
15877 -register on the exception return path when returning to a 32-bit task.
15878 -This workaround is patched in at runtime based on the MIDR value of the
15879 -processor.
15880 -
15881 -Reviewed-by: Marc Zyngier <marc.zyngier@×××.com>
15882 -Tested-by: Mark Rutland <mark.rutland@×××.com>
15883 -Signed-off-by: Will Deacon <will.deacon@×××.com>
15884 -Signed-off-by: Kevin Hilman <khilman@××××××.org>
15885 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
15886 -Signed-off-by: Mike Pagano <mpagano@g.o>
15887 ----
15888 - arch/arm64/Kconfig | 21 +++++++++++++++++++++
15889 - arch/arm64/include/asm/cpufeature.h | 3 ++-
15890 - arch/arm64/kernel/cpu_errata.c | 8 ++++++++
15891 - arch/arm64/kernel/entry.S | 20 ++++++++++++++++++++
15892 - 4 files changed, 51 insertions(+), 1 deletion(-)
15893 -
15894 -diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
15895 -index 0d46deb..a6186c2 100644
15896 ---- a/arch/arm64/Kconfig
15897 -+++ b/arch/arm64/Kconfig
15898 -@@ -361,6 +361,27 @@ config ARM64_ERRATUM_832075
15899 +- spi_imx->tx_wml = spi_imx_get_fifosize(spi_imx) / 2;
15900 +- spi_imx->rx_wml = spi_imx_get_fifosize(spi_imx) / 2;
15901 + spi_imx->rxt_wml = spi_imx_get_fifosize(spi_imx) / 2;
15902 + rx_wml_cfg = spi_imx->rx_wml << MX51_ECSPI_DMA_RX_WML_OFFSET;
15903 + tx_wml_cfg = spi_imx->tx_wml << MX51_ECSPI_DMA_TX_WML_OFFSET;
15904 +@@ -868,6 +866,8 @@ static int spi_imx_sdma_init(struct device *dev, struct spi_imx_data *spi_imx,
15905 + master->max_dma_len = MAX_SDMA_BD_BYTES;
15906 + spi_imx->bitbang.master->flags = SPI_MASTER_MUST_RX |
15907 + SPI_MASTER_MUST_TX;
15908 ++ spi_imx->tx_wml = spi_imx_get_fifosize(spi_imx) / 2;
15909 ++ spi_imx->rx_wml = spi_imx_get_fifosize(spi_imx) / 2;
15910 + spi_imx->dma_is_inited = 1;
15911
15912 - If unsure, say Y.
15913 + return 0;
15914 +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
15915 +index 4eb7a98..7bf5186 100644
15916 +--- a/drivers/spi/spidev.c
15917 ++++ b/drivers/spi/spidev.c
15918 +@@ -245,7 +245,10 @@ static int spidev_message(struct spidev_data *spidev,
15919 + k_tmp->len = u_tmp->len;
15920
15921 -+config ARM64_ERRATUM_845719
15922 -+ bool "Cortex-A53: 845719: a load might read incorrect data"
15923 -+ depends on COMPAT
15924 -+ default y
15925 -+ help
15926 -+ This option adds an alternative code sequence to work around ARM
15927 -+ erratum 845719 on Cortex-A53 parts up to r0p4.
15928 -+
15929 -+ When running a compat (AArch32) userspace on an affected Cortex-A53
15930 -+ part, a load at EL0 from a virtual address that matches the bottom 32
15931 -+ bits of the virtual address used by a recent load at (AArch64) EL1
15932 -+ might return incorrect data.
15933 -+
15934 -+ The workaround is to write the contextidr_el1 register on exception
15935 -+ return to a 32-bit task.
15936 -+ Please note that this does not necessarily enable the workaround,
15937 -+ as it depends on the alternative framework, which will only patch
15938 -+ the kernel if an affected CPU is detected.
15939 -+
15940 -+ If unsure, say Y.
15941 -+
15942 - endmenu
15943 + total += k_tmp->len;
15944 +- if (total > bufsiz) {
15945 ++ /* Check total length of transfers. Also check each
15946 ++ * transfer length to avoid arithmetic overflow.
15947 ++ */
15948 ++ if (total > bufsiz || k_tmp->len > bufsiz) {
15949 + status = -EMSGSIZE;
15950 + goto done;
15951 + }
15952 +diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
15953 +index 7bdb62b..f83e00c 100644
15954 +--- a/drivers/staging/android/sync.c
15955 ++++ b/drivers/staging/android/sync.c
15956 +@@ -114,7 +114,7 @@ void sync_timeline_signal(struct sync_timeline *obj)
15957 + list_for_each_entry_safe(pt, next, &obj->active_list_head,
15958 + active_list) {
15959 + if (fence_is_signaled_locked(&pt->base))
15960 +- list_del(&pt->active_list);
15961 ++ list_del_init(&pt->active_list);
15962 + }
15963
15964 + spin_unlock_irqrestore(&obj->child_list_lock, flags);
15965 +diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
15966 +index 6ed35b6..04fc217 100644
15967 +--- a/drivers/staging/panel/panel.c
15968 ++++ b/drivers/staging/panel/panel.c
15969 +@@ -335,11 +335,11 @@ static unsigned char lcd_bits[LCD_PORTS][LCD_BITS][BIT_STATES];
15970 + * LCD types
15971 + */
15972 + #define LCD_TYPE_NONE 0
15973 +-#define LCD_TYPE_OLD 1
15974 +-#define LCD_TYPE_KS0074 2
15975 +-#define LCD_TYPE_HANTRONIX 3
15976 +-#define LCD_TYPE_NEXCOM 4
15977 +-#define LCD_TYPE_CUSTOM 5
15978 ++#define LCD_TYPE_CUSTOM 1
15979 ++#define LCD_TYPE_OLD 2
15980 ++#define LCD_TYPE_KS0074 3
15981 ++#define LCD_TYPE_HANTRONIX 4
15982 ++#define LCD_TYPE_NEXCOM 5
15983
15984 -diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
15985 -index b6c16d5..3f0c53c 100644
15986 ---- a/arch/arm64/include/asm/cpufeature.h
15987 -+++ b/arch/arm64/include/asm/cpufeature.h
15988 -@@ -23,8 +23,9 @@
15989 + /*
15990 + * keypad types
15991 +@@ -502,7 +502,7 @@ MODULE_PARM_DESC(keypad_type,
15992 + static int lcd_type = NOT_SET;
15993 + module_param(lcd_type, int, 0000);
15994 + MODULE_PARM_DESC(lcd_type,
15995 +- "LCD type: 0=none, 1=old //, 2=serial ks0074, 3=hantronix //, 4=nexcom //, 5=compiled-in");
15996 ++ "LCD type: 0=none, 1=compiled-in, 2=old, 3=serial ks0074, 4=hantronix, 5=nexcom");
15997
15998 - #define ARM64_WORKAROUND_CLEAN_CACHE 0
15999 - #define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE 1
16000 -+#define ARM64_WORKAROUND_845719 2
16001 + static int lcd_height = NOT_SET;
16002 + module_param(lcd_height, int, 0000);
16003 +diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
16004 +index 07ce3fd..fdf5c56 100644
16005 +--- a/drivers/staging/vt6655/rxtx.c
16006 ++++ b/drivers/staging/vt6655/rxtx.c
16007 +@@ -1308,10 +1308,18 @@ int vnt_generate_fifo_header(struct vnt_private *priv, u32 dma_idx,
16008 + priv->hw->conf.chandef.chan->hw_value);
16009 + }
16010
16011 --#define ARM64_NCAPS 2
16012 -+#define ARM64_NCAPS 3
16013 +- if (current_rate > RATE_11M)
16014 +- pkt_type = (u8)priv->byPacketType;
16015 +- else
16016 ++ if (current_rate > RATE_11M) {
16017 ++ if (info->band == IEEE80211_BAND_5GHZ) {
16018 ++ pkt_type = PK_TYPE_11A;
16019 ++ } else {
16020 ++ if (tx_rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
16021 ++ pkt_type = PK_TYPE_11GB;
16022 ++ else
16023 ++ pkt_type = PK_TYPE_11GA;
16024 ++ }
16025 ++ } else {
16026 + pkt_type = PK_TYPE_11B;
16027 ++ }
16028
16029 - #ifndef __ASSEMBLY__
16030 + /*Set fifo controls */
16031 + if (pkt_type == PK_TYPE_11A)
16032 +diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
16033 +index 77d6425..5e35612 100644
16034 +--- a/drivers/target/iscsi/iscsi_target.c
16035 ++++ b/drivers/target/iscsi/iscsi_target.c
16036 +@@ -537,7 +537,7 @@ static struct iscsit_transport iscsi_target_transport = {
16037
16038 -diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
16039 -index 7c48494..ad6d523 100644
16040 ---- a/arch/arm64/kernel/cpu_errata.c
16041 -+++ b/arch/arm64/kernel/cpu_errata.c
16042 -@@ -92,6 +92,14 @@ struct arm64_cpu_capabilities arm64_errata[] = {
16043 - (1 << MIDR_VARIANT_SHIFT) | 2),
16044 - },
16045 - #endif
16046 -+#ifdef CONFIG_ARM64_ERRATUM_845719
16047 -+ {
16048 -+ /* Cortex-A53 r0p[01234] */
16049 -+ .desc = "ARM erratum 845719",
16050 -+ .capability = ARM64_WORKAROUND_845719,
16051 -+ MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x04),
16052 -+ },
16053 -+#endif
16054 - {
16055 - }
16056 - };
16057 -diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
16058 -index cf21bb3..959fe87 100644
16059 ---- a/arch/arm64/kernel/entry.S
16060 -+++ b/arch/arm64/kernel/entry.S
16061 -@@ -21,8 +21,10 @@
16062 - #include <linux/init.h>
16063 - #include <linux/linkage.h>
16064 + static int __init iscsi_target_init_module(void)
16065 + {
16066 +- int ret = 0;
16067 ++ int ret = 0, size;
16068
16069 -+#include <asm/alternative-asm.h>
16070 - #include <asm/assembler.h>
16071 - #include <asm/asm-offsets.h>
16072 -+#include <asm/cpufeature.h>
16073 - #include <asm/errno.h>
16074 - #include <asm/esr.h>
16075 - #include <asm/thread_info.h>
16076 -@@ -120,6 +122,24 @@
16077 - ct_user_enter
16078 - ldr x23, [sp, #S_SP] // load return stack pointer
16079 - msr sp_el0, x23
16080 -+
16081 -+#ifdef CONFIG_ARM64_ERRATUM_845719
16082 -+ alternative_insn \
16083 -+ "nop", \
16084 -+ "tbz x22, #4, 1f", \
16085 -+ ARM64_WORKAROUND_845719
16086 -+#ifdef CONFIG_PID_IN_CONTEXTIDR
16087 -+ alternative_insn \
16088 -+ "nop; nop", \
16089 -+ "mrs x29, contextidr_el1; msr contextidr_el1, x29; 1:", \
16090 -+ ARM64_WORKAROUND_845719
16091 -+#else
16092 -+ alternative_insn \
16093 -+ "nop", \
16094 -+ "msr contextidr_el1, xzr; 1:", \
16095 -+ ARM64_WORKAROUND_845719
16096 -+#endif
16097 -+#endif
16098 - .endif
16099 - msr elr_el1, x21 // set up the return data
16100 - msr spsr_el1, x22
16101 ---
16102 -2.3.6
16103 -
16104 -
16105 -From aa54f8fb00ef9c739f564672048ec0fcc08a61dc Mon Sep 17 00:00:00 2001
16106 -From: Gavin Shan <gwshan@××××××××××××××.com>
16107 -Date: Fri, 27 Mar 2015 11:29:00 +1100
16108 -Subject: [PATCH 144/219] powerpc/powernv: Don't map M64 segments using M32DT
16109 -Cc: mpagano@g.o
16110 -
16111 -commit 027fa02f84e851e21daffdf8900d6117071890f8 upstream.
16112 -
16113 -If M64 has been supported, the prefetchable 64-bits memory resources
16114 -shouldn't be mapped to the corresponding PE# via M32DT. Unfortunately,
16115 -we're doing that in pnv_ioda_setup_pe_seg() wrongly. The issue was
16116 -introduced by commit 262af55 ("powerpc/powernv: Enable M64 aperatus
16117 -for PHB3"). The patch fixes the issue by simply skipping M64 resources
16118 -when updating to M32DT.
16119 -
16120 -Signed-off-by: Gavin Shan <gwshan@××××××××××××××.com>
16121 -Signed-off-by: Benjamin Herrenschmidt <benh@×××××××××××××××.org>
16122 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
16123 -Signed-off-by: Mike Pagano <mpagano@g.o>
16124 ----
16125 - arch/powerpc/platforms/powernv/pci-ioda.c | 3 ++-
16126 - 1 file changed, 2 insertions(+), 1 deletion(-)
16127 -
16128 -diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
16129 -index 6c9ff2b..1d9369e 100644
16130 ---- a/arch/powerpc/platforms/powernv/pci-ioda.c
16131 -+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
16132 -@@ -1777,7 +1777,8 @@ static void pnv_ioda_setup_pe_seg(struct pci_controller *hose,
16133 - region.start += phb->ioda.io_segsize;
16134 - index++;
16135 - }
16136 -- } else if (res->flags & IORESOURCE_MEM) {
16137 -+ } else if ((res->flags & IORESOURCE_MEM) &&
16138 -+ !pnv_pci_is_mem_pref_64(res->flags)) {
16139 - region.start = res->start -
16140 - hose->mem_offset[0] -
16141 - phb->ioda.m32_pci_base;
16142 ---
16143 -2.3.6
16144 -
16145 -
16146 -From 7ef1951eca49005fdbb4768574b7076cae1eeb4c Mon Sep 17 00:00:00 2001
16147 -From: Dave Olson <olson@×××××××××××××××.com>
16148 -Date: Thu, 2 Apr 2015 21:28:45 -0700
16149 -Subject: [PATCH 145/219] powerpc: Fix missing L2 cache size in
16150 - /sys/devices/system/cpu
16151 -Cc: mpagano@g.o
16152 -
16153 -commit f7e9e358362557c3aa2c1ec47490f29fe880a09e upstream.
16154 -
16155 -This problem appears to have been introduced in 2.6.29 by commit
16156 -93197a36a9c1 "Rewrite sysfs processor cache info code".
16157 -
16158 -This caused lscpu to error out on at least e500v2 devices, eg:
16159 -
16160 - error: cannot open /sys/devices/system/cpu/cpu0/cache/index2/size: No such file or directory
16161 -
16162 -Some embedded powerpc systems use cache-size in DTS for the unified L2
16163 -cache size, not d-cache-size, so we need to allow for both DTS names.
16164 -Added a new CACHE_TYPE_UNIFIED_D cache_type_info structure to handle
16165 -this.
16166 -
16167 -Fixes: 93197a36a9c1 ("powerpc: Rewrite sysfs processor cache info code")
16168 -Signed-off-by: Dave Olson <olson@×××××××××××××××.com>
16169 -Signed-off-by: Michael Ellerman <mpe@×××××××××××.au>
16170 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
16171 -Signed-off-by: Mike Pagano <mpagano@g.o>
16172 ----
16173 - arch/powerpc/kernel/cacheinfo.c | 44 +++++++++++++++++++++++++++++++----------
16174 - 1 file changed, 34 insertions(+), 10 deletions(-)
16175 -
16176 -diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
16177 -index ae77b7e..c641983 100644
16178 ---- a/arch/powerpc/kernel/cacheinfo.c
16179 -+++ b/arch/powerpc/kernel/cacheinfo.c
16180 -@@ -61,12 +61,22 @@ struct cache_type_info {
16181 - };
16182 + pr_debug("iSCSI-Target "ISCSIT_VERSION"\n");
16183
16184 - /* These are used to index the cache_type_info array. */
16185 --#define CACHE_TYPE_UNIFIED 0
16186 --#define CACHE_TYPE_INSTRUCTION 1
16187 --#define CACHE_TYPE_DATA 2
16188 -+#define CACHE_TYPE_UNIFIED 0 /* cache-size, cache-block-size, etc. */
16189 -+#define CACHE_TYPE_UNIFIED_D 1 /* d-cache-size, d-cache-block-size, etc */
16190 -+#define CACHE_TYPE_INSTRUCTION 2
16191 -+#define CACHE_TYPE_DATA 3
16192 +@@ -546,6 +546,7 @@ static int __init iscsi_target_init_module(void)
16193 + pr_err("Unable to allocate memory for iscsit_global\n");
16194 + return -1;
16195 + }
16196 ++ spin_lock_init(&iscsit_global->ts_bitmap_lock);
16197 + mutex_init(&auth_id_lock);
16198 + spin_lock_init(&sess_idr_lock);
16199 + idr_init(&tiqn_idr);
16200 +@@ -555,15 +556,11 @@ static int __init iscsi_target_init_module(void)
16201 + if (ret < 0)
16202 + goto out;
16203
16204 - static const struct cache_type_info cache_type_info[] = {
16205 - {
16206 -+ /* Embedded systems that use cache-size, cache-block-size,
16207 -+ * etc. for the Unified (typically L2) cache. */
16208 -+ .name = "Unified",
16209 -+ .size_prop = "cache-size",
16210 -+ .line_size_props = { "cache-line-size",
16211 -+ "cache-block-size", },
16212 -+ .nr_sets_prop = "cache-sets",
16213 -+ },
16214 -+ {
16215 - /* PowerPC Processor binding says the [di]-cache-*
16216 - * must be equal on unified caches, so just use
16217 - * d-cache properties. */
16218 -@@ -293,7 +303,8 @@ static struct cache *cache_find_first_sibling(struct cache *cache)
16219 - {
16220 - struct cache *iter;
16221 +- ret = iscsi_thread_set_init();
16222 +- if (ret < 0)
16223 ++ size = BITS_TO_LONGS(ISCSIT_BITMAP_BITS) * sizeof(long);
16224 ++ iscsit_global->ts_bitmap = vzalloc(size);
16225 ++ if (!iscsit_global->ts_bitmap) {
16226 ++ pr_err("Unable to allocate iscsit_global->ts_bitmap\n");
16227 + goto configfs_out;
16228 +-
16229 +- if (iscsi_allocate_thread_sets(TARGET_THREAD_SET_COUNT) !=
16230 +- TARGET_THREAD_SET_COUNT) {
16231 +- pr_err("iscsi_allocate_thread_sets() returned"
16232 +- " unexpected value!\n");
16233 +- goto ts_out1;
16234 + }
16235
16236 -- if (cache->type == CACHE_TYPE_UNIFIED)
16237 -+ if (cache->type == CACHE_TYPE_UNIFIED ||
16238 -+ cache->type == CACHE_TYPE_UNIFIED_D)
16239 - return cache;
16240 + lio_qr_cache = kmem_cache_create("lio_qr_cache",
16241 +@@ -572,7 +569,7 @@ static int __init iscsi_target_init_module(void)
16242 + if (!lio_qr_cache) {
16243 + pr_err("nable to kmem_cache_create() for"
16244 + " lio_qr_cache\n");
16245 +- goto ts_out2;
16246 ++ goto bitmap_out;
16247 + }
16248
16249 - list_for_each_entry(iter, &cache_list, list)
16250 -@@ -324,16 +335,29 @@ static bool cache_node_is_unified(const struct device_node *np)
16251 - return of_get_property(np, "cache-unified", NULL);
16252 - }
16253 + lio_dr_cache = kmem_cache_create("lio_dr_cache",
16254 +@@ -617,10 +614,8 @@ dr_out:
16255 + kmem_cache_destroy(lio_dr_cache);
16256 + qr_out:
16257 + kmem_cache_destroy(lio_qr_cache);
16258 +-ts_out2:
16259 +- iscsi_deallocate_thread_sets();
16260 +-ts_out1:
16261 +- iscsi_thread_set_free();
16262 ++bitmap_out:
16263 ++ vfree(iscsit_global->ts_bitmap);
16264 + configfs_out:
16265 + iscsi_target_deregister_configfs();
16266 + out:
16267 +@@ -630,8 +625,6 @@ out:
16268
16269 --static struct cache *cache_do_one_devnode_unified(struct device_node *node,
16270 -- int level)
16271 -+/*
16272 -+ * Unified caches can have two different sets of tags. Most embedded
16273 -+ * use cache-size, etc. for the unified cache size, but open firmware systems
16274 -+ * use d-cache-size, etc. Check on initialization for which type we have, and
16275 -+ * return the appropriate structure type. Assume it's embedded if it isn't
16276 -+ * open firmware. If it's yet a 3rd type, then there will be missing entries
16277 -+ * in /sys/devices/system/cpu/cpu0/cache/index2/, and this code will need
16278 -+ * to be extended further.
16279 -+ */
16280 -+static int cache_is_unified_d(const struct device_node *np)
16281 + static void __exit iscsi_target_cleanup_module(void)
16282 {
16283 -- struct cache *cache;
16284 -+ return of_get_property(np,
16285 -+ cache_type_info[CACHE_TYPE_UNIFIED_D].size_prop, NULL) ?
16286 -+ CACHE_TYPE_UNIFIED_D : CACHE_TYPE_UNIFIED;
16287 -+}
16288 +- iscsi_deallocate_thread_sets();
16289 +- iscsi_thread_set_free();
16290 + iscsit_release_discovery_tpg();
16291 + iscsit_unregister_transport(&iscsi_target_transport);
16292 + kmem_cache_destroy(lio_qr_cache);
16293 +@@ -641,6 +634,7 @@ static void __exit iscsi_target_cleanup_module(void)
16294
16295 -+/*
16296 -+ */
16297 -+static struct cache *cache_do_one_devnode_unified(struct device_node *node, int level)
16298 -+{
16299 - pr_debug("creating L%d ucache for %s\n", level, node->full_name);
16300 + iscsi_target_deregister_configfs();
16301
16302 -- cache = new_cache(CACHE_TYPE_UNIFIED, level, node);
16303 --
16304 -- return cache;
16305 -+ return new_cache(cache_is_unified_d(node), level, node);
16306 ++ vfree(iscsit_global->ts_bitmap);
16307 + kfree(iscsit_global);
16308 }
16309
16310 - static struct cache *cache_do_one_devnode_split(struct device_node *node,
16311 ---
16312 -2.3.6
16313 -
16314 -
16315 -From 9fb1018337f9767398e0d62e5dce8499fd0f2bf0 Mon Sep 17 00:00:00 2001
16316 -From: Michael Ellerman <mpe@×××××××××××.au>
16317 -Date: Fri, 3 Apr 2015 14:11:53 +1100
16318 -Subject: [PATCH 146/219] powerpc/cell: Fix crash in iic_setup_cpu() after
16319 - per_cpu changes
16320 -Cc: mpagano@g.o
16321 -
16322 -commit b0dd00addc5035f87ec9c5820dacc1ebc7fcb3e6 upstream.
16323 -
16324 -The conversion from __get_cpu_var() to this_cpu_ptr() in iic_setup_cpu()
16325 -is wrong. It causes an oops at boot.
16326 -
16327 -We need the per-cpu address of struct cpu_iic, not cpu_iic.regs->prio.
16328 -
16329 -Sparse noticed this, because we pass a non-iomem pointer to out_be64(),
16330 -but we obviously don't check the sparse results often enough.
16331 -
16332 -Fixes: 69111bac42f5 ("powerpc: Replace __get_cpu_var uses")
16333 -Signed-off-by: Michael Ellerman <mpe@×××××××××××.au>
16334 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
16335 -Signed-off-by: Mike Pagano <mpagano@g.o>
16336 ----
16337 - arch/powerpc/platforms/cell/interrupt.c | 2 +-
16338 - 1 file changed, 1 insertion(+), 1 deletion(-)
16339 -
16340 -diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c
16341 -index 4c11421..3af8324 100644
16342 ---- a/arch/powerpc/platforms/cell/interrupt.c
16343 -+++ b/arch/powerpc/platforms/cell/interrupt.c
16344 -@@ -163,7 +163,7 @@ static unsigned int iic_get_irq(void)
16345 +@@ -3715,17 +3709,16 @@ static int iscsit_send_reject(
16346
16347 - void iic_setup_cpu(void)
16348 + void iscsit_thread_get_cpumask(struct iscsi_conn *conn)
16349 {
16350 -- out_be64(this_cpu_ptr(&cpu_iic.regs->prio), 0xff);
16351 -+ out_be64(&this_cpu_ptr(&cpu_iic)->regs->prio, 0xff);
16352 +- struct iscsi_thread_set *ts = conn->thread_set;
16353 + int ord, cpu;
16354 + /*
16355 +- * thread_id is assigned from iscsit_global->ts_bitmap from
16356 +- * within iscsi_thread_set.c:iscsi_allocate_thread_sets()
16357 ++ * bitmap_id is assigned from iscsit_global->ts_bitmap from
16358 ++ * within iscsit_start_kthreads()
16359 + *
16360 +- * Here we use thread_id to determine which CPU that this
16361 +- * iSCSI connection's iscsi_thread_set will be scheduled to
16362 ++ * Here we use bitmap_id to determine which CPU that this
16363 ++ * iSCSI connection's RX/TX threads will be scheduled to
16364 + * execute upon.
16365 + */
16366 +- ord = ts->thread_id % cpumask_weight(cpu_online_mask);
16367 ++ ord = conn->bitmap_id % cpumask_weight(cpu_online_mask);
16368 + for_each_online_cpu(cpu) {
16369 + if (ord-- == 0) {
16370 + cpumask_set_cpu(cpu, conn->conn_cpumask);
16371 +@@ -3914,7 +3907,7 @@ check_rsp_state:
16372 + switch (state) {
16373 + case ISTATE_SEND_LOGOUTRSP:
16374 + if (!iscsit_logout_post_handler(cmd, conn))
16375 +- goto restart;
16376 ++ return -ECONNRESET;
16377 + /* fall through */
16378 + case ISTATE_SEND_STATUS:
16379 + case ISTATE_SEND_ASYNCMSG:
16380 +@@ -3942,8 +3935,6 @@ check_rsp_state:
16381 +
16382 + err:
16383 + return -1;
16384 +-restart:
16385 +- return -EAGAIN;
16386 }
16387
16388 - u8 iic_get_target_id(int cpu)
16389 ---
16390 -2.3.6
16391 -
16392 -
16393 -From 94a5f3b014e7d81936ae02cc095cdf895f94fb19 Mon Sep 17 00:00:00 2001
16394 -From: Michael Ellerman <mpe@×××××××××××.au>
16395 -Date: Fri, 3 Apr 2015 14:11:54 +1100
16396 -Subject: [PATCH 147/219] powerpc/cell: Fix cell iommu after it_page_shift
16397 - changes
16398 -Cc: mpagano@g.o
16399 -
16400 -commit 7261b956b276aa97fbf60d00f1d7717d2ea6ee78 upstream.
16401 -
16402 -The patch to add it_page_shift incorrectly changed the increment of
16403 -uaddr to use it_page_shift, rather then (1 << it_page_shift).
16404 -
16405 -This broke booting on at least some Cell blades, as the iommu was
16406 -basically non-functional.
16407 -
16408 -Fixes: 3a553170d35d ("powerpc/iommu: Add it_page_shift field to determine iommu page size")
16409 -Signed-off-by: Michael Ellerman <michael@×××××××××××.au>
16410 -Signed-off-by: Michael Ellerman <mpe@×××××××××××.au>
16411 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
16412 -Signed-off-by: Mike Pagano <mpagano@g.o>
16413 ----
16414 - arch/powerpc/platforms/cell/iommu.c | 2 +-
16415 - 1 file changed, 1 insertion(+), 1 deletion(-)
16416 -
16417 -diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
16418 -index c7c8720..63db1b0 100644
16419 ---- a/arch/powerpc/platforms/cell/iommu.c
16420 -+++ b/arch/powerpc/platforms/cell/iommu.c
16421 -@@ -197,7 +197,7 @@ static int tce_build_cell(struct iommu_table *tbl, long index, long npages,
16422 + static int iscsit_handle_response_queue(struct iscsi_conn *conn)
16423 +@@ -3970,21 +3961,13 @@ static int iscsit_handle_response_queue(struct iscsi_conn *conn)
16424 + int iscsi_target_tx_thread(void *arg)
16425 + {
16426 + int ret = 0;
16427 +- struct iscsi_conn *conn;
16428 +- struct iscsi_thread_set *ts = arg;
16429 ++ struct iscsi_conn *conn = arg;
16430 + /*
16431 + * Allow ourselves to be interrupted by SIGINT so that a
16432 + * connection recovery / failure event can be triggered externally.
16433 + */
16434 + allow_signal(SIGINT);
16435
16436 - io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset);
16437 +-restart:
16438 +- conn = iscsi_tx_thread_pre_handler(ts);
16439 +- if (!conn)
16440 +- goto out;
16441 +-
16442 +- ret = 0;
16443 +-
16444 + while (!kthread_should_stop()) {
16445 + /*
16446 + * Ensure that both TX and RX per connection kthreads
16447 +@@ -3993,11 +3976,9 @@ restart:
16448 + iscsit_thread_check_cpumask(conn, current, 1);
16449
16450 -- for (i = 0; i < npages; i++, uaddr += tbl->it_page_shift)
16451 -+ for (i = 0; i < npages; i++, uaddr += (1 << tbl->it_page_shift))
16452 - io_pte[i] = base_pte | (__pa(uaddr) & CBE_IOPTE_RPN_Mask);
16453 + wait_event_interruptible(conn->queues_wq,
16454 +- !iscsit_conn_all_queues_empty(conn) ||
16455 +- ts->status == ISCSI_THREAD_SET_RESET);
16456 ++ !iscsit_conn_all_queues_empty(conn));
16457
16458 - mb();
16459 ---
16460 -2.3.6
16461 -
16462 -
16463 -From 755b29de0d793e3915b35f35c716705d9910109f Mon Sep 17 00:00:00 2001
16464 -From: Pascal Huerst <pascal.huerst@×××××.com>
16465 -Date: Thu, 2 Apr 2015 10:17:40 +0200
16466 -Subject: [PATCH 148/219] ASoC: cs4271: Increase delay time after reset
16467 -Cc: mpagano@g.o
16468 -
16469 -commit 74ff960222d90999508b4ba0d3449f796695b6d5 upstream.
16470 -
16471 -The delay time after a reset in the codec probe callback was too short,
16472 -and did not work on certain hw because the codec needs more time to
16473 -power on. This increases the delay time from 1us to 1ms.
16474 -
16475 -Signed-off-by: Pascal Huerst <pascal.huerst@×××××.com>
16476 -Acked-by: Brian Austin <brian.austin@××××××.com>
16477 -Signed-off-by: Mark Brown <broonie@××××××.org>
16478 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
16479 -Signed-off-by: Mike Pagano <mpagano@g.o>
16480 ----
16481 - sound/soc/codecs/cs4271.c | 4 ++--
16482 - 1 file changed, 2 insertions(+), 2 deletions(-)
16483 -
16484 -diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
16485 -index 7d3a6ac..e770ee6 100644
16486 ---- a/sound/soc/codecs/cs4271.c
16487 -+++ b/sound/soc/codecs/cs4271.c
16488 -@@ -561,10 +561,10 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec)
16489 - if (gpio_is_valid(cs4271->gpio_nreset)) {
16490 - /* Reset codec */
16491 - gpio_direction_output(cs4271->gpio_nreset, 0);
16492 -- udelay(1);
16493 -+ mdelay(1);
16494 - gpio_set_value(cs4271->gpio_nreset, 1);
16495 - /* Give the codec time to wake up */
16496 -- udelay(1);
16497 -+ mdelay(1);
16498 - }
16499 +- if ((ts->status == ISCSI_THREAD_SET_RESET) ||
16500 +- signal_pending(current))
16501 ++ if (signal_pending(current))
16502 + goto transport_err;
16503
16504 - ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2,
16505 ---
16506 -2.3.6
16507 -
16508 -
16509 -From d9493a0723e5a23b0250f43ea5e6d8ed66e1a343 Mon Sep 17 00:00:00 2001
16510 -From: Sergej Sawazki <ce3a@×××.de>
16511 -Date: Tue, 24 Mar 2015 21:13:22 +0100
16512 -Subject: [PATCH 149/219] ASoC: wm8741: Fix rates constraints values
16513 -Cc: mpagano@g.o
16514 -
16515 -commit 8787041d9bb832b9449b1eb878cedcebce42c61a upstream.
16516 -
16517 -The WM8741 DAC supports the following typical audio sampling rates:
16518 - 44.1kHz, 88.2kHz, 176.4kHz (eg: with a master clock of 22.5792MHz)
16519 - 32kHz, 48kHz, 96kHz, 192kHz (eg: with a master clock of 24.576MHz)
16520 -
16521 -For the rates lists, we should use 82000 instead of 88235, 176400
16522 -instead of 1764000 and 192000 instead of 19200 (seems to be a typo).
16523 -
16524 -Signed-off-by: Sergej Sawazki <ce3a@×××.de>
16525 -Acked-by: Charles Keepax <ckeepax@×××××××××××××××××××××××.com>
16526 -Signed-off-by: Mark Brown <broonie@××××××.org>
16527 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
16528 -Signed-off-by: Mike Pagano <mpagano@g.o>
16529 ----
16530 - sound/soc/codecs/wm8741.c | 8 ++++----
16531 - 1 file changed, 4 insertions(+), 4 deletions(-)
16532 -
16533 -diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c
16534 -index 31bb480..9e71c76 100644
16535 ---- a/sound/soc/codecs/wm8741.c
16536 -+++ b/sound/soc/codecs/wm8741.c
16537 -@@ -123,7 +123,7 @@ static struct {
16538 - };
16539 + get_immediate:
16540 +@@ -4008,15 +3989,14 @@ get_immediate:
16541 + ret = iscsit_handle_response_queue(conn);
16542 + if (ret == 1)
16543 + goto get_immediate;
16544 +- else if (ret == -EAGAIN)
16545 +- goto restart;
16546 ++ else if (ret == -ECONNRESET)
16547 ++ goto out;
16548 + else if (ret < 0)
16549 + goto transport_err;
16550 + }
16551
16552 - static const unsigned int rates_11289[] = {
16553 -- 44100, 88235,
16554 -+ 44100, 88200,
16555 - };
16556 + transport_err:
16557 + iscsit_take_action_for_connection_exit(conn);
16558 +- goto restart;
16559 + out:
16560 + return 0;
16561 + }
16562 +@@ -4111,8 +4091,7 @@ int iscsi_target_rx_thread(void *arg)
16563 + int ret;
16564 + u8 buffer[ISCSI_HDR_LEN], opcode;
16565 + u32 checksum = 0, digest = 0;
16566 +- struct iscsi_conn *conn = NULL;
16567 +- struct iscsi_thread_set *ts = arg;
16568 ++ struct iscsi_conn *conn = arg;
16569 + struct kvec iov;
16570 + /*
16571 + * Allow ourselves to be interrupted by SIGINT so that a
16572 +@@ -4120,11 +4099,6 @@ int iscsi_target_rx_thread(void *arg)
16573 + */
16574 + allow_signal(SIGINT);
16575
16576 - static const struct snd_pcm_hw_constraint_list constraints_11289 = {
16577 -@@ -150,7 +150,7 @@ static const struct snd_pcm_hw_constraint_list constraints_16384 = {
16578 - };
16579 +-restart:
16580 +- conn = iscsi_rx_thread_pre_handler(ts);
16581 +- if (!conn)
16582 +- goto out;
16583 +-
16584 + if (conn->conn_transport->transport_type == ISCSI_INFINIBAND) {
16585 + struct completion comp;
16586 + int rc;
16587 +@@ -4134,7 +4108,7 @@ restart:
16588 + if (rc < 0)
16589 + goto transport_err;
16590
16591 - static const unsigned int rates_16934[] = {
16592 -- 44100, 88235,
16593 -+ 44100, 88200,
16594 - };
16595 +- goto out;
16596 ++ goto transport_err;
16597 + }
16598
16599 - static const struct snd_pcm_hw_constraint_list constraints_16934 = {
16600 -@@ -168,7 +168,7 @@ static const struct snd_pcm_hw_constraint_list constraints_18432 = {
16601 - };
16602 + while (!kthread_should_stop()) {
16603 +@@ -4210,8 +4184,6 @@ transport_err:
16604 + if (!signal_pending(current))
16605 + atomic_set(&conn->transport_failed, 1);
16606 + iscsit_take_action_for_connection_exit(conn);
16607 +- goto restart;
16608 +-out:
16609 + return 0;
16610 + }
16611
16612 - static const unsigned int rates_22579[] = {
16613 -- 44100, 88235, 1764000
16614 -+ 44100, 88200, 176400
16615 - };
16616 +@@ -4273,7 +4245,24 @@ int iscsit_close_connection(
16617 + if (conn->conn_transport->transport_type == ISCSI_TCP)
16618 + complete(&conn->conn_logout_comp);
16619
16620 - static const struct snd_pcm_hw_constraint_list constraints_22579 = {
16621 -@@ -186,7 +186,7 @@ static const struct snd_pcm_hw_constraint_list constraints_24576 = {
16622 - };
16623 +- iscsi_release_thread_set(conn);
16624 ++ if (!strcmp(current->comm, ISCSI_RX_THREAD_NAME)) {
16625 ++ if (conn->tx_thread &&
16626 ++ cmpxchg(&conn->tx_thread_active, true, false)) {
16627 ++ send_sig(SIGINT, conn->tx_thread, 1);
16628 ++ kthread_stop(conn->tx_thread);
16629 ++ }
16630 ++ } else if (!strcmp(current->comm, ISCSI_TX_THREAD_NAME)) {
16631 ++ if (conn->rx_thread &&
16632 ++ cmpxchg(&conn->rx_thread_active, true, false)) {
16633 ++ send_sig(SIGINT, conn->rx_thread, 1);
16634 ++ kthread_stop(conn->rx_thread);
16635 ++ }
16636 ++ }
16637 ++
16638 ++ spin_lock(&iscsit_global->ts_bitmap_lock);
16639 ++ bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id,
16640 ++ get_order(1));
16641 ++ spin_unlock(&iscsit_global->ts_bitmap_lock);
16642
16643 - static const unsigned int rates_36864[] = {
16644 -- 48000, 96000, 19200
16645 -+ 48000, 96000, 192000
16646 - };
16647 + iscsit_stop_timers_for_cmds(conn);
16648 + iscsit_stop_nopin_response_timer(conn);
16649 +@@ -4551,15 +4540,13 @@ static void iscsit_logout_post_handler_closesession(
16650 + struct iscsi_conn *conn)
16651 + {
16652 + struct iscsi_session *sess = conn->sess;
16653 +-
16654 +- iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD);
16655 +- iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD);
16656 ++ int sleep = cmpxchg(&conn->tx_thread_active, true, false);
16657
16658 - static const struct snd_pcm_hw_constraint_list constraints_36864 = {
16659 ---
16660 -2.3.6
16661 -
16662 -
16663 -From f7a469cdb54b146db35083f167e9f844ffc31f0c Mon Sep 17 00:00:00 2001
16664 -From: Manish Badarkhe <manishvb@××.com>
16665 -Date: Thu, 26 Mar 2015 15:38:25 +0200
16666 -Subject: [PATCH 150/219] ASoC: davinci-evm: drop un-necessary remove function
16667 -Cc: mpagano@g.o
16668 -
16669 -commit a57069e33fbc6625f39e1b09c88ea44629a35206 upstream.
16670 -
16671 -As davinci card gets registered using 'devm_' api
16672 -there is no need to unregister the card in 'remove'
16673 -function.
16674 -Hence drop the 'remove' function.
16675 -
16676 -Fixes: ee2f615d6e59c (ASoC: davinci-evm: Add device tree binding)
16677 -Signed-off-by: Manish Badarkhe <manishvb@××.com>
16678 -Signed-off-by: Jyri Sarha <jsarha@××.com>
16679 -Signed-off-by: Mark Brown <broonie@××××××.org>
16680 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
16681 -Signed-off-by: Mike Pagano <mpagano@g.o>
16682 ----
16683 - sound/soc/davinci/davinci-evm.c | 10 ----------
16684 - 1 file changed, 10 deletions(-)
16685 -
16686 -diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
16687 -index b6bb594..8c2b9be 100644
16688 ---- a/sound/soc/davinci/davinci-evm.c
16689 -+++ b/sound/soc/davinci/davinci-evm.c
16690 -@@ -425,18 +425,8 @@ static int davinci_evm_probe(struct platform_device *pdev)
16691 - return ret;
16692 + atomic_set(&conn->conn_logout_remove, 0);
16693 + complete(&conn->conn_logout_comp);
16694 +
16695 + iscsit_dec_conn_usage_count(conn);
16696 +- iscsit_stop_session(sess, 1, 1);
16697 ++ iscsit_stop_session(sess, sleep, sleep);
16698 + iscsit_dec_session_usage_count(sess);
16699 + target_put_session(sess->se_sess);
16700 }
16701 +@@ -4567,13 +4554,12 @@ static void iscsit_logout_post_handler_closesession(
16702 + static void iscsit_logout_post_handler_samecid(
16703 + struct iscsi_conn *conn)
16704 + {
16705 +- iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD);
16706 +- iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD);
16707 ++ int sleep = cmpxchg(&conn->tx_thread_active, true, false);
16708
16709 --static int davinci_evm_remove(struct platform_device *pdev)
16710 --{
16711 -- struct snd_soc_card *card = platform_get_drvdata(pdev);
16712 --
16713 -- snd_soc_unregister_card(card);
16714 --
16715 -- return 0;
16716 --}
16717 --
16718 - static struct platform_driver davinci_evm_driver = {
16719 - .probe = davinci_evm_probe,
16720 -- .remove = davinci_evm_remove,
16721 - .driver = {
16722 - .name = "davinci_evm",
16723 - .pm = &snd_soc_pm_ops,
16724 ---
16725 -2.3.6
16726 -
16727 -
16728 -From f646e040a619bcea31a6cab378ccaccb6f4cb659 Mon Sep 17 00:00:00 2001
16729 -From: Howard Mitchell <hm@×××××××××××.uk>
16730 -Date: Thu, 19 Mar 2015 12:08:30 +0000
16731 -Subject: [PATCH 151/219] ASoC: pcm512x: Add 'Analogue' prefix to analogue
16732 - volume controls
16733 -Cc: mpagano@g.o
16734 -
16735 -commit 4d9b13c7cc803fbde59d7e998f7de2b9a2101c7e upstream.
16736 -
16737 -This is to ensure that 'alsactl restore' does not apply default
16738 -initialisation as the chip reset defaults are preferred.
16739 -
16740 -Signed-off-by: Howard Mitchell <hm@×××××××××××.uk>
16741 -Signed-off-by: Mark Brown <broonie@××××××.org>
16742 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
16743 -Signed-off-by: Mike Pagano <mpagano@g.o>
16744 ----
16745 - sound/soc/codecs/pcm512x.c | 4 ++--
16746 - 1 file changed, 2 insertions(+), 2 deletions(-)
16747 -
16748 -diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
16749 -index 474cae8..b48624c 100644
16750 ---- a/sound/soc/codecs/pcm512x.c
16751 -+++ b/sound/soc/codecs/pcm512x.c
16752 -@@ -304,9 +304,9 @@ static const struct soc_enum pcm512x_veds =
16753 - static const struct snd_kcontrol_new pcm512x_controls[] = {
16754 - SOC_DOUBLE_R_TLV("Digital Playback Volume", PCM512x_DIGITAL_VOLUME_2,
16755 - PCM512x_DIGITAL_VOLUME_3, 0, 255, 1, digital_tlv),
16756 --SOC_DOUBLE_TLV("Playback Volume", PCM512x_ANALOG_GAIN_CTRL,
16757 -+SOC_DOUBLE_TLV("Analogue Playback Volume", PCM512x_ANALOG_GAIN_CTRL,
16758 - PCM512x_LAGN_SHIFT, PCM512x_RAGN_SHIFT, 1, 1, analog_tlv),
16759 --SOC_DOUBLE_TLV("Playback Boost Volume", PCM512x_ANALOG_GAIN_BOOST,
16760 -+SOC_DOUBLE_TLV("Analogue Playback Boost Volume", PCM512x_ANALOG_GAIN_BOOST,
16761 - PCM512x_AGBL_SHIFT, PCM512x_AGBR_SHIFT, 1, 0, boost_tlv),
16762 - SOC_DOUBLE("Digital Playback Switch", PCM512x_MUTE, PCM512x_RQML_SHIFT,
16763 - PCM512x_RQMR_SHIFT, 1, 1),
16764 ---
16765 -2.3.6
16766 -
16767 -
16768 -From 43ebd1a85ee86416c2d45a3834e7425c396890e9 Mon Sep 17 00:00:00 2001
16769 -From: Howard Mitchell <hm@×××××××××××.uk>
16770 -Date: Fri, 20 Mar 2015 21:13:45 +0000
16771 -Subject: [PATCH 152/219] ASoC: pcm512x: Fix divide by zero issue
16772 -Cc: mpagano@g.o
16773 -
16774 -commit f073faa73626f41db7050a69edd5074c53ce6d6c upstream.
16775 -
16776 -If den=1 and pllin_rate>20MHz then den and num are adjusted to 0
16777 -causing a divide by zero error a few lines further on. Therefore
16778 -this patch correctly scales num and den such that
16779 -pllin_rate/den < 20MHz as required in the device data sheet.
16780 -
16781 -Signed-off-by: Howard Mitchell <hm@×××××××××××.uk>
16782 -Signed-off-by: Mark Brown <broonie@××××××××××.uk>
16783 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
16784 -Signed-off-by: Mike Pagano <mpagano@g.o>
16785 ----
16786 - sound/soc/codecs/pcm512x.c | 4 ++--
16787 - 1 file changed, 2 insertions(+), 2 deletions(-)
16788 -
16789 -diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
16790 -index b48624c..8c09e3f 100644
16791 ---- a/sound/soc/codecs/pcm512x.c
16792 -+++ b/sound/soc/codecs/pcm512x.c
16793 -@@ -576,8 +576,8 @@ static int pcm512x_find_pll_coeff(struct snd_soc_dai *dai,
16794 + atomic_set(&conn->conn_logout_remove, 0);
16795 + complete(&conn->conn_logout_comp);
16796
16797 - /* pllin_rate / P (or here, den) cannot be greater than 20 MHz */
16798 - if (pllin_rate / den > 20000000 && num < 8) {
16799 -- num *= 20000000 / (pllin_rate / den);
16800 -- den *= 20000000 / (pllin_rate / den);
16801 -+ num *= DIV_ROUND_UP(pllin_rate / den, 20000000);
16802 -+ den *= DIV_ROUND_UP(pllin_rate / den, 20000000);
16803 +- iscsit_cause_connection_reinstatement(conn, 1);
16804 ++ iscsit_cause_connection_reinstatement(conn, sleep);
16805 + iscsit_dec_conn_usage_count(conn);
16806 + }
16807 +
16808 +diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c
16809 +index bdd8731..e008ed2 100644
16810 +--- a/drivers/target/iscsi/iscsi_target_erl0.c
16811 ++++ b/drivers/target/iscsi/iscsi_target_erl0.c
16812 +@@ -860,7 +860,10 @@ void iscsit_connection_reinstatement_rcfr(struct iscsi_conn *conn)
16813 }
16814 - dev_dbg(dev, "num / den = %lu / %lu\n", num, den);
16815 + spin_unlock_bh(&conn->state_lock);
16816
16817 ---
16818 -2.3.6
16819 -
16820 -
16821 -From 650a628d5725e7eb8ed5f979fee058795cb06355 Mon Sep 17 00:00:00 2001
16822 -From: Lv Zheng <lv.zheng@×××××.com>
16823 -Date: Mon, 13 Apr 2015 11:48:58 +0800
16824 -Subject: [PATCH 153/219] ACPICA: Utilities: split IO address types from data
16825 - type models.
16826 -Cc: mpagano@g.o
16827 -
16828 -commit 2b8760100e1de69b6ff004c986328a82947db4ad upstream.
16829 -
16830 -ACPICA commit aacf863cfffd46338e268b7415f7435cae93b451
16831 -
16832 -It is reported that on a physically 64-bit addressed machine, 32-bit kernel
16833 -can trigger crashes in accessing the memory regions that are beyond the
16834 -32-bit boundary. The region field's start address should still be 32-bit
16835 -compliant, but after a calculation (adding some offsets), it may exceed the
16836 -32-bit boundary. This case is rare and buggy, but there are real BIOSes
16837 -leaked with such issues (see References below).
16838 -
16839 -This patch fixes this gap by always defining IO addresses as 64-bit, and
16840 -allows OSPMs to optimize it for a real 32-bit machine to reduce the size of
16841 -the internal objects.
16842 -
16843 -Internal acpi_physical_address usages in the structures that can be fixed
16844 -by this change include:
16845 - 1. struct acpi_object_region:
16846 - acpi_physical_address address;
16847 - 2. struct acpi_address_range:
16848 - acpi_physical_address start_address;
16849 - acpi_physical_address end_address;
16850 - 3. struct acpi_mem_space_context;
16851 - acpi_physical_address address;
16852 - 4. struct acpi_table_desc
16853 - acpi_physical_address address;
16854 -See known issues 1 for other usages.
16855 -
16856 -Note that acpi_io_address which is used for ACPI_PROCESSOR may also suffer
16857 -from same problem, so this patch changes it accordingly.
16858 -
16859 -For iasl, it will enforce acpi_physical_address as 32-bit to generate
16860 -32-bit OSPM compatible tables on 32-bit platforms, we need to define
16861 -ACPI_32BIT_PHYSICAL_ADDRESS for it in acenv.h.
16862 -
16863 -Known issues:
16864 - 1. Cleanup of mapped virtual address
16865 - In struct acpi_mem_space_context, acpi_physical_address is used as a virtual
16866 - address:
16867 - acpi_physical_address mapped_physical_address;
16868 - It is better to introduce acpi_virtual_address or use acpi_size instead.
16869 - This patch doesn't make such a change. Because this should be done along
16870 - with a change to acpi_os_map_memory()/acpi_os_unmap_memory().
16871 - There should be no functional problem to leave this unchanged except
16872 - that only this structure is enlarged unexpectedly.
16873 -
16874 -Link: https://github.com/acpica/acpica/commit/aacf863c
16875 -Reference: https://bugzilla.kernel.org/show_bug.cgi?id=87971
16876 -Reference: https://bugzilla.kernel.org/show_bug.cgi?id=79501
16877 -Reported-and-tested-by: Paul Menzel <paulepanter@×××××××××××××××××.net>
16878 -Reported-and-tested-by: Sial Nije <sialnije@×××××.com>
16879 -Signed-off-by: Lv Zheng <lv.zheng@×××××.com>
16880 -Signed-off-by: Bob Moore <robert.moore@×××××.com>
16881 -Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@×××××.com>
16882 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
16883 -Signed-off-by: Mike Pagano <mpagano@g.o>
16884 ----
16885 - include/acpi/actypes.h | 20 ++++++++++++++++++++
16886 - include/acpi/platform/acenv.h | 1 +
16887 - 2 files changed, 21 insertions(+)
16888 -
16889 -diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
16890 -index b034f10..658c42e 100644
16891 ---- a/include/acpi/actypes.h
16892 -+++ b/include/acpi/actypes.h
16893 -@@ -199,9 +199,29 @@ typedef int s32;
16894 - typedef s32 acpi_native_int;
16895 +- iscsi_thread_set_force_reinstatement(conn);
16896 ++ if (conn->tx_thread && conn->tx_thread_active)
16897 ++ send_sig(SIGINT, conn->tx_thread, 1);
16898 ++ if (conn->rx_thread && conn->rx_thread_active)
16899 ++ send_sig(SIGINT, conn->rx_thread, 1);
16900
16901 - typedef u32 acpi_size;
16902 + sleep:
16903 + wait_for_completion(&conn->conn_wait_rcfr_comp);
16904 +@@ -885,10 +888,10 @@ void iscsit_cause_connection_reinstatement(struct iscsi_conn *conn, int sleep)
16905 + return;
16906 + }
16907 +
16908 +- if (iscsi_thread_set_force_reinstatement(conn) < 0) {
16909 +- spin_unlock_bh(&conn->state_lock);
16910 +- return;
16911 +- }
16912 ++ if (conn->tx_thread && conn->tx_thread_active)
16913 ++ send_sig(SIGINT, conn->tx_thread, 1);
16914 ++ if (conn->rx_thread && conn->rx_thread_active)
16915 ++ send_sig(SIGINT, conn->rx_thread, 1);
16916 +
16917 + atomic_set(&conn->connection_reinstatement, 1);
16918 + if (!sleep) {
16919 +diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
16920 +index 153fb66..345f073 100644
16921 +--- a/drivers/target/iscsi/iscsi_target_login.c
16922 ++++ b/drivers/target/iscsi/iscsi_target_login.c
16923 +@@ -699,6 +699,51 @@ static void iscsi_post_login_start_timers(struct iscsi_conn *conn)
16924 + iscsit_start_nopin_timer(conn);
16925 + }
16926 +
16927 ++int iscsit_start_kthreads(struct iscsi_conn *conn)
16928 ++{
16929 ++ int ret = 0;
16930 +
16931 -+#ifdef ACPI_32BIT_PHYSICAL_ADDRESS
16932 ++ spin_lock(&iscsit_global->ts_bitmap_lock);
16933 ++ conn->bitmap_id = bitmap_find_free_region(iscsit_global->ts_bitmap,
16934 ++ ISCSIT_BITMAP_BITS, get_order(1));
16935 ++ spin_unlock(&iscsit_global->ts_bitmap_lock);
16936 +
16937 -+/*
16938 -+ * OSPMs can define this to shrink the size of the structures for 32-bit
16939 -+ * none PAE environment. ASL compiler may always define this to generate
16940 -+ * 32-bit OSPM compliant tables.
16941 -+ */
16942 - typedef u32 acpi_io_address;
16943 - typedef u32 acpi_physical_address;
16944 -
16945 -+#else /* ACPI_32BIT_PHYSICAL_ADDRESS */
16946 ++ if (conn->bitmap_id < 0) {
16947 ++ pr_err("bitmap_find_free_region() failed for"
16948 ++ " iscsit_start_kthreads()\n");
16949 ++ return -ENOMEM;
16950 ++ }
16951 +
16952 -+/*
16953 -+ * It is reported that, after some calculations, the physical addresses can
16954 -+ * wrap over the 32-bit boundary on 32-bit PAE environment.
16955 -+ * https://bugzilla.kernel.org/show_bug.cgi?id=87971
16956 -+ */
16957 -+typedef u64 acpi_io_address;
16958 -+typedef u64 acpi_physical_address;
16959 ++ conn->tx_thread = kthread_run(iscsi_target_tx_thread, conn,
16960 ++ "%s", ISCSI_TX_THREAD_NAME);
16961 ++ if (IS_ERR(conn->tx_thread)) {
16962 ++ pr_err("Unable to start iscsi_target_tx_thread\n");
16963 ++ ret = PTR_ERR(conn->tx_thread);
16964 ++ goto out_bitmap;
16965 ++ }
16966 ++ conn->tx_thread_active = true;
16967 +
16968 -+#endif /* ACPI_32BIT_PHYSICAL_ADDRESS */
16969 ++ conn->rx_thread = kthread_run(iscsi_target_rx_thread, conn,
16970 ++ "%s", ISCSI_RX_THREAD_NAME);
16971 ++ if (IS_ERR(conn->rx_thread)) {
16972 ++ pr_err("Unable to start iscsi_target_rx_thread\n");
16973 ++ ret = PTR_ERR(conn->rx_thread);
16974 ++ goto out_tx;
16975 ++ }
16976 ++ conn->rx_thread_active = true;
16977 +
16978 - #define ACPI_MAX_PTR ACPI_UINT32_MAX
16979 - #define ACPI_SIZE_MAX ACPI_UINT32_MAX
16980 ++ return 0;
16981 ++out_tx:
16982 ++ kthread_stop(conn->tx_thread);
16983 ++ conn->tx_thread_active = false;
16984 ++out_bitmap:
16985 ++ spin_lock(&iscsit_global->ts_bitmap_lock);
16986 ++ bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id,
16987 ++ get_order(1));
16988 ++ spin_unlock(&iscsit_global->ts_bitmap_lock);
16989 ++ return ret;
16990 ++}
16991 ++
16992 + int iscsi_post_login_handler(
16993 + struct iscsi_np *np,
16994 + struct iscsi_conn *conn,
16995 +@@ -709,7 +754,7 @@ int iscsi_post_login_handler(
16996 + struct se_session *se_sess = sess->se_sess;
16997 + struct iscsi_portal_group *tpg = sess->tpg;
16998 + struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;
16999 +- struct iscsi_thread_set *ts;
17000 ++ int rc;
17001
17002 -diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
17003 -index ad74dc5..ecdf940 100644
17004 ---- a/include/acpi/platform/acenv.h
17005 -+++ b/include/acpi/platform/acenv.h
17006 -@@ -76,6 +76,7 @@
17007 - #define ACPI_LARGE_NAMESPACE_NODE
17008 - #define ACPI_DATA_TABLE_DISASSEMBLY
17009 - #define ACPI_SINGLE_THREADED
17010 -+#define ACPI_32BIT_PHYSICAL_ADDRESS
17011 - #endif
17012 + iscsit_inc_conn_usage_count(conn);
17013
17014 - /* acpi_exec configuration. Multithreaded with full AML debugger */
17015 ---
17016 -2.3.6
17017 -
17018 -
17019 -From 5980bf8bc5dbb8e5338a3db6e311539eeb6242da Mon Sep 17 00:00:00 2001
17020 -From: Octavian Purdila <octavian.purdila@×××××.com>
17021 -Date: Mon, 13 Apr 2015 11:49:05 +0800
17022 -Subject: [PATCH 154/219] ACPICA: Tables: Don't release ACPI_MTX_TABLES in
17023 - acpi_tb_install_standard_table().
17024 -Cc: mpagano@g.o
17025 -
17026 -commit 77ddc2fe08329e375505bc36a3df3233fe57317b upstream.
17027 -
17028 -ACPICA commit c70434d4da13e65b6163c79a5aa16b40193631c7
17029 -
17030 -ACPI_MTX_TABLES is acquired and released by the callers of
17031 -acpi_tb_install_standard_table() so releasing it in the function itself is
17032 -causing the following error in Linux kernel if the table is reloaded:
17033 -
17034 -ACPI Error: Mutex [0x2] is not acquired, cannot release (20141107/utmutex-321)
17035 -Call Trace:
17036 - [<ffffffff81b0bd48>] dump_stack+0x4f/0x7b
17037 - [<ffffffff81546bf5>] acpi_ut_release_mutex+0x47/0x67
17038 - [<ffffffff81544357>] acpi_load_table+0x73/0xcb
17039 -
17040 -Link: https://github.com/acpica/acpica/commit/c70434d4
17041 -Signed-off-by: Octavian Purdila <octavian.purdila@×××××.com>
17042 -Signed-off-by: Lv Zheng <lv.zheng@×××××.com>
17043 -Signed-off-by: Bob Moore <robert.moore@×××××.com>
17044 -Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@×××××.com>
17045 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
17046 -Signed-off-by: Mike Pagano <mpagano@g.o>
17047 ----
17048 - drivers/acpi/acpica/tbinstal.c | 1 -
17049 - 1 file changed, 1 deletion(-)
17050 -
17051 -diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
17052 -index 9bad45e..7fbc2b9 100644
17053 ---- a/drivers/acpi/acpica/tbinstal.c
17054 -+++ b/drivers/acpi/acpica/tbinstal.c
17055 -@@ -346,7 +346,6 @@ acpi_tb_install_standard_table(acpi_physical_address address,
17056 - */
17057 - acpi_tb_uninstall_table(&new_table_desc);
17058 - *table_index = i;
17059 -- (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
17060 - return_ACPI_STATUS(AE_OK);
17061 - }
17062 - }
17063 ---
17064 -2.3.6
17065 -
17066 -
17067 -From afaed716d9f945416e6f0967384714ee3b066020 Mon Sep 17 00:00:00 2001
17068 -From: "Rafael J. Wysocki" <rafael.j.wysocki@×××××.com>
17069 -Date: Wed, 15 Apr 2015 04:00:27 +0200
17070 -Subject: [PATCH 155/219] ACPICA: Store GPE register enable masks upfront
17071 -Cc: mpagano@g.o
17072 -
17073 -commit 0ee0d34985ceffe4036319e1e46df8bff591b9e3 upstream.
17074 -
17075 -It is reported that ACPI interrupts do not work any more on
17076 -Dell Latitude D600 after commit c50f13c672df (ACPICA: Save
17077 -current masks of enabled GPEs after enable register writes).
17078 -The problem turns out to be related to the fact that the
17079 -enable_mask and enable_for_run GPE bit masks are not in
17080 -sync (in the absence of any system suspend/resume events)
17081 -for at least one GPE register on that machine.
17082 -
17083 -Address this problem by writing the enable_for_run mask into
17084 -enable_mask as soon as enable_for_run is updated instead of
17085 -doing that only after the subsequent register write has
17086 -succeeded. For consistency, update acpi_hw_gpe_enable_write()
17087 -to store the bit mask to be written into the GPE register
17088 -in enable_mask unconditionally before the write.
17089 -
17090 -Since the ACPI_GPE_SAVE_MASK flag is not necessary any more after
17091 -that, drop it along with the symbols depending on it.
17092 -
17093 -Reported-and-tested-by: Jim Bos <jim876@××××××.nl>
17094 -Fixes: c50f13c672df (ACPICA: Save current masks of enabled GPEs after enable register writes)
17095 -Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@×××××.com>
17096 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
17097 -Signed-off-by: Mike Pagano <mpagano@g.o>
17098 ----
17099 - drivers/acpi/acpica/evgpe.c | 5 +++--
17100 - drivers/acpi/acpica/hwgpe.c | 11 ++++-------
17101 - include/acpi/actypes.h | 4 ----
17102 - 3 files changed, 7 insertions(+), 13 deletions(-)
17103 -
17104 -diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
17105 -index 5ed064e..ccf7932 100644
17106 ---- a/drivers/acpi/acpica/evgpe.c
17107 -+++ b/drivers/acpi/acpica/evgpe.c
17108 -@@ -92,6 +92,7 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info)
17109 - ACPI_SET_BIT(gpe_register_info->enable_for_run,
17110 - (u8)register_bit);
17111 - }
17112 -+ gpe_register_info->enable_mask = gpe_register_info->enable_for_run;
17113 -
17114 - return_ACPI_STATUS(AE_OK);
17115 - }
17116 -@@ -123,7 +124,7 @@ acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
17117 -
17118 - /* Enable the requested GPE */
17119 -
17120 -- status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE_SAVE);
17121 -+ status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
17122 - return_ACPI_STATUS(status);
17123 - }
17124 -
17125 -@@ -202,7 +203,7 @@ acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_info)
17126 - if (ACPI_SUCCESS(status)) {
17127 - status =
17128 - acpi_hw_low_set_gpe(gpe_event_info,
17129 -- ACPI_GPE_DISABLE_SAVE);
17130 -+ ACPI_GPE_DISABLE);
17131 - }
17132 -
17133 - if (ACPI_FAILURE(status)) {
17134 -diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c
17135 -index 84bc550..af6514e 100644
17136 ---- a/drivers/acpi/acpica/hwgpe.c
17137 -+++ b/drivers/acpi/acpica/hwgpe.c
17138 -@@ -89,6 +89,8 @@ u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info)
17139 - * RETURN: Status
17140 - *
17141 - * DESCRIPTION: Enable or disable a single GPE in the parent enable register.
17142 -+ * The enable_mask field of the involved GPE register must be
17143 -+ * updated by the caller if necessary.
17144 - *
17145 - ******************************************************************************/
17146 -
17147 -@@ -119,7 +121,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
17148 - /* Set or clear just the bit that corresponds to this GPE */
17149 +@@ -724,7 +769,6 @@ int iscsi_post_login_handler(
17150 + /*
17151 + * SCSI Initiator -> SCSI Target Port Mapping
17152 + */
17153 +- ts = iscsi_get_thread_set();
17154 + if (!zero_tsih) {
17155 + iscsi_set_session_parameters(sess->sess_ops,
17156 + conn->param_list, 0);
17157 +@@ -751,9 +795,11 @@ int iscsi_post_login_handler(
17158 + sess->sess_ops->InitiatorName);
17159 + spin_unlock_bh(&sess->conn_lock);
17160
17161 - register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info);
17162 -- switch (action & ~ACPI_GPE_SAVE_MASK) {
17163 -+ switch (action) {
17164 - case ACPI_GPE_CONDITIONAL_ENABLE:
17165 +- iscsi_post_login_start_timers(conn);
17166 ++ rc = iscsit_start_kthreads(conn);
17167 ++ if (rc)
17168 ++ return rc;
17169
17170 - /* Only enable if the corresponding enable_mask bit is set */
17171 -@@ -149,9 +151,6 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
17172 - /* Write the updated enable mask */
17173 +- iscsi_activate_thread_set(conn, ts);
17174 ++ iscsi_post_login_start_timers(conn);
17175 + /*
17176 + * Determine CPU mask to ensure connection's RX and TX kthreads
17177 + * are scheduled on the same CPU.
17178 +@@ -810,8 +856,11 @@ int iscsi_post_login_handler(
17179 + " iSCSI Target Portal Group: %hu\n", tpg->nsessions, tpg->tpgt);
17180 + spin_unlock_bh(&se_tpg->session_lock);
17181
17182 - status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address);
17183 -- if (ACPI_SUCCESS(status) && (action & ACPI_GPE_SAVE_MASK)) {
17184 -- gpe_register_info->enable_mask = (u8)enable_mask;
17185 -- }
17186 - return (status);
17187 - }
17188 ++ rc = iscsit_start_kthreads(conn);
17189 ++ if (rc)
17190 ++ return rc;
17191 ++
17192 + iscsi_post_login_start_timers(conn);
17193 +- iscsi_activate_thread_set(conn, ts);
17194 + /*
17195 + * Determine CPU mask to ensure connection's RX and TX kthreads
17196 + * are scheduled on the same CPU.
17197 +diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
17198 +index 44620fb..cbb0cc2 100644
17199 +--- a/drivers/target/target_core_file.c
17200 ++++ b/drivers/target/target_core_file.c
17201 +@@ -264,40 +264,32 @@ static int fd_do_prot_rw(struct se_cmd *cmd, struct fd_prot *fd_prot,
17202 + struct se_device *se_dev = cmd->se_dev;
17203 + struct fd_dev *dev = FD_DEV(se_dev);
17204 + struct file *prot_fd = dev->fd_prot_file;
17205 +- struct scatterlist *sg;
17206 + loff_t pos = (cmd->t_task_lba * se_dev->prot_length);
17207 + unsigned char *buf;
17208 +- u32 prot_size, len, size;
17209 +- int rc, ret = 1, i;
17210 ++ u32 prot_size;
17211 ++ int rc, ret = 1;
17212
17213 -@@ -286,10 +285,8 @@ acpi_hw_gpe_enable_write(u8 enable_mask,
17214 - {
17215 - acpi_status status;
17216 + prot_size = (cmd->data_length / se_dev->dev_attrib.block_size) *
17217 + se_dev->prot_length;
17218
17219 -+ gpe_register_info->enable_mask = enable_mask;
17220 - status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address);
17221 -- if (ACPI_SUCCESS(status)) {
17222 -- gpe_register_info->enable_mask = enable_mask;
17223 -- }
17224 - return (status);
17225 - }
17226 + if (!is_write) {
17227 +- fd_prot->prot_buf = vzalloc(prot_size);
17228 ++ fd_prot->prot_buf = kzalloc(prot_size, GFP_KERNEL);
17229 + if (!fd_prot->prot_buf) {
17230 + pr_err("Unable to allocate fd_prot->prot_buf\n");
17231 + return -ENOMEM;
17232 + }
17233 + buf = fd_prot->prot_buf;
17234
17235 -diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
17236 -index 658c42e..0d58525 100644
17237 ---- a/include/acpi/actypes.h
17238 -+++ b/include/acpi/actypes.h
17239 -@@ -756,10 +756,6 @@ typedef u32 acpi_event_status;
17240 - #define ACPI_GPE_ENABLE 0
17241 - #define ACPI_GPE_DISABLE 1
17242 - #define ACPI_GPE_CONDITIONAL_ENABLE 2
17243 --#define ACPI_GPE_SAVE_MASK 4
17244 +- fd_prot->prot_sg_nents = cmd->t_prot_nents;
17245 +- fd_prot->prot_sg = kzalloc(sizeof(struct scatterlist) *
17246 +- fd_prot->prot_sg_nents, GFP_KERNEL);
17247 ++ fd_prot->prot_sg_nents = 1;
17248 ++ fd_prot->prot_sg = kzalloc(sizeof(struct scatterlist),
17249 ++ GFP_KERNEL);
17250 + if (!fd_prot->prot_sg) {
17251 + pr_err("Unable to allocate fd_prot->prot_sg\n");
17252 +- vfree(fd_prot->prot_buf);
17253 ++ kfree(fd_prot->prot_buf);
17254 + return -ENOMEM;
17255 + }
17256 +- size = prot_size;
17257 -
17258 --#define ACPI_GPE_ENABLE_SAVE (ACPI_GPE_ENABLE | ACPI_GPE_SAVE_MASK)
17259 --#define ACPI_GPE_DISABLE_SAVE (ACPI_GPE_DISABLE | ACPI_GPE_SAVE_MASK)
17260 -
17261 - /*
17262 - * GPE info flags - Per GPE
17263 ---
17264 -2.3.6
17265 -
17266 -
17267 -From 7b2f4da529f27b81d06a9c5d49803dc4b1d5eea3 Mon Sep 17 00:00:00 2001
17268 -From: "Rafael J. Wysocki" <rafael.j.wysocki@×××××.com>
17269 -Date: Sat, 18 Apr 2015 01:25:46 +0200
17270 -Subject: [PATCH 156/219] ACPI / scan: Annotate physical_node_lock in
17271 - acpi_scan_is_offline()
17272 -Cc: mpagano@g.o
17273 -
17274 -commit 4c533c801d1c9b5c38458a0e7516e0cf50643782 upstream.
17275 -
17276 -acpi_scan_is_offline() may be called under the physical_node_lock
17277 -lock of the given device object's parent, so prevent lockdep from
17278 -complaining about that by annotating that instance with
17279 -SINGLE_DEPTH_NESTING.
17280 -
17281 -Fixes: caa73ea158de (ACPI / hotplug / driver core: Handle containers in a special way)
17282 -Reported-and-tested-by: Xie XiuQi <xiexiuqi@××××××.com>
17283 -Reviewed-by: Toshi Kani <toshi.kani@××.com>
17284 -Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@×××××.com>
17285 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
17286 -Signed-off-by: Mike Pagano <mpagano@g.o>
17287 ----
17288 - drivers/acpi/scan.c | 6 +++++-
17289 - 1 file changed, 5 insertions(+), 1 deletion(-)
17290 -
17291 -diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
17292 -index bbca783..349f4fd 100644
17293 ---- a/drivers/acpi/scan.c
17294 -+++ b/drivers/acpi/scan.c
17295 -@@ -298,7 +298,11 @@ bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent)
17296 - struct acpi_device_physical_node *pn;
17297 - bool offline = true;
17298 +- for_each_sg(fd_prot->prot_sg, sg, fd_prot->prot_sg_nents, i) {
17299 +-
17300 +- len = min_t(u32, PAGE_SIZE, size);
17301 +- sg_set_buf(sg, buf, len);
17302 +- size -= len;
17303 +- buf += len;
17304 +- }
17305 ++ sg_init_table(fd_prot->prot_sg, fd_prot->prot_sg_nents);
17306 ++ sg_set_buf(fd_prot->prot_sg, buf, prot_size);
17307 + }
17308
17309 -- mutex_lock(&adev->physical_node_lock);
17310 -+ /*
17311 -+ * acpi_container_offline() calls this for all of the container's
17312 -+ * children under the container's physical_node_lock lock.
17313 -+ */
17314 -+ mutex_lock_nested(&adev->physical_node_lock, SINGLE_DEPTH_NESTING);
17315 + if (is_write) {
17316 +@@ -318,7 +310,7 @@ static int fd_do_prot_rw(struct se_cmd *cmd, struct fd_prot *fd_prot,
17317
17318 - list_for_each_entry(pn, &adev->physical_node_list, node)
17319 - if (device_supports_offline(pn->dev) && !pn->dev->offline) {
17320 ---
17321 -2.3.6
17322 -
17323 -
17324 -From 042741ecc3287d365daab83a5fd287aee607ea32 Mon Sep 17 00:00:00 2001
17325 -From: Max Filippov <jcmvbkbc@×××××.com>
17326 -Date: Fri, 27 Feb 2015 06:28:00 +0300
17327 -Subject: [PATCH 157/219] xtensa: xtfpga: fix hardware lockup caused by LCD
17328 - driver
17329 -Cc: mpagano@g.o
17330 -
17331 -commit 4949009eb8d40a441dcddcd96e101e77d31cf1b2 upstream.
17332 -
17333 -LCD driver is always built for the XTFPGA platform, but its base address
17334 -is not configurable, and is wrong for ML605/KC705. Its initialization
17335 -locks up KC705 board hardware.
17336 -
17337 -Make the whole driver optional, and its base address and bus width
17338 -configurable. Implement 4-bit bus access method.
17339 -
17340 -Signed-off-by: Max Filippov <jcmvbkbc@×××××.com>
17341 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
17342 -Signed-off-by: Mike Pagano <mpagano@g.o>
17343 ----
17344 - arch/xtensa/Kconfig | 30 ++++++++++++
17345 - arch/xtensa/platforms/xtfpga/Makefile | 3 +-
17346 - .../platforms/xtfpga/include/platform/hardware.h | 3 --
17347 - .../xtensa/platforms/xtfpga/include/platform/lcd.h | 15 ++++++
17348 - arch/xtensa/platforms/xtfpga/lcd.c | 55 +++++++++++++---------
17349 - 5 files changed, 81 insertions(+), 25 deletions(-)
17350 -
17351 -diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
17352 -index e31d494..87be10e 100644
17353 ---- a/arch/xtensa/Kconfig
17354 -+++ b/arch/xtensa/Kconfig
17355 -@@ -428,6 +428,36 @@ config DEFAULT_MEM_SIZE
17356 + if (is_write || ret < 0) {
17357 + kfree(fd_prot->prot_sg);
17358 +- vfree(fd_prot->prot_buf);
17359 ++ kfree(fd_prot->prot_buf);
17360 + }
17361
17362 - If unsure, leave the default value here.
17363 + return ret;
17364 +@@ -549,6 +541,56 @@ fd_execute_write_same(struct se_cmd *cmd)
17365 + return 0;
17366 + }
17367
17368 -+config XTFPGA_LCD
17369 -+ bool "Enable XTFPGA LCD driver"
17370 -+ depends on XTENSA_PLATFORM_XTFPGA
17371 -+ default n
17372 -+ help
17373 -+ There's a 2x16 LCD on most of XTFPGA boards, kernel may output
17374 -+ progress messages there during bootup/shutdown. It may be useful
17375 -+ during board bringup.
17376 ++static int
17377 ++fd_do_prot_fill(struct se_device *se_dev, sector_t lba, sector_t nolb,
17378 ++ void *buf, size_t bufsize)
17379 ++{
17380 ++ struct fd_dev *fd_dev = FD_DEV(se_dev);
17381 ++ struct file *prot_fd = fd_dev->fd_prot_file;
17382 ++ sector_t prot_length, prot;
17383 ++ loff_t pos = lba * se_dev->prot_length;
17384 +
17385 -+ If unsure, say N.
17386 ++ if (!prot_fd) {
17387 ++ pr_err("Unable to locate fd_dev->fd_prot_file\n");
17388 ++ return -ENODEV;
17389 ++ }
17390 +
17391 -+config XTFPGA_LCD_BASE_ADDR
17392 -+ hex "XTFPGA LCD base address"
17393 -+ depends on XTFPGA_LCD
17394 -+ default "0x0d0c0000"
17395 -+ help
17396 -+ Base address of the LCD controller inside KIO region.
17397 -+ Different boards from XTFPGA family have LCD controller at different
17398 -+ addresses. Please consult prototyping user guide for your board for
17399 -+ the correct address. Wrong address here may lead to hardware lockup.
17400 ++ prot_length = nolb * se_dev->prot_length;
17401 +
17402 -+config XTFPGA_LCD_8BIT_ACCESS
17403 -+ bool "Use 8-bit access to XTFPGA LCD"
17404 -+ depends on XTFPGA_LCD
17405 -+ default n
17406 -+ help
17407 -+ LCD may be connected with 4- or 8-bit interface, 8-bit access may
17408 -+ only be used with 8-bit interface. Please consult prototyping user
17409 -+ guide for your board for the correct interface width.
17410 ++ for (prot = 0; prot < prot_length;) {
17411 ++ sector_t len = min_t(sector_t, bufsize, prot_length - prot);
17412 ++ ssize_t ret = kernel_write(prot_fd, buf, len, pos + prot);
17413 +
17414 - endmenu
17415 -
17416 - menu "Executable file formats"
17417 -diff --git a/arch/xtensa/platforms/xtfpga/Makefile b/arch/xtensa/platforms/xtfpga/Makefile
17418 -index b9ae206..7839d38 100644
17419 ---- a/arch/xtensa/platforms/xtfpga/Makefile
17420 -+++ b/arch/xtensa/platforms/xtfpga/Makefile
17421 -@@ -6,4 +6,5 @@
17422 - #
17423 - # Note 2! The CFLAGS definitions are in the main makefile...
17424 -
17425 --obj-y = setup.o lcd.o
17426 -+obj-y += setup.o
17427 -+obj-$(CONFIG_XTFPGA_LCD) += lcd.o
17428 -diff --git a/arch/xtensa/platforms/xtfpga/include/platform/hardware.h b/arch/xtensa/platforms/xtfpga/include/platform/hardware.h
17429 -index 6edd20b..4e0af26 100644
17430 ---- a/arch/xtensa/platforms/xtfpga/include/platform/hardware.h
17431 -+++ b/arch/xtensa/platforms/xtfpga/include/platform/hardware.h
17432 -@@ -40,9 +40,6 @@
17433 -
17434 - /* UART */
17435 - #define DUART16552_PADDR (XCHAL_KIO_PADDR + 0x0D050020)
17436 --/* LCD instruction and data addresses. */
17437 --#define LCD_INSTR_ADDR ((char *)IOADDR(0x0D040000))
17438 --#define LCD_DATA_ADDR ((char *)IOADDR(0x0D040004))
17439 -
17440 - /* Misc. */
17441 - #define XTFPGA_FPGAREGS_VADDR IOADDR(0x0D020000)
17442 -diff --git a/arch/xtensa/platforms/xtfpga/include/platform/lcd.h b/arch/xtensa/platforms/xtfpga/include/platform/lcd.h
17443 -index 0e43564..4c8541e 100644
17444 ---- a/arch/xtensa/platforms/xtfpga/include/platform/lcd.h
17445 -+++ b/arch/xtensa/platforms/xtfpga/include/platform/lcd.h
17446 -@@ -11,10 +11,25 @@
17447 - #ifndef __XTENSA_XTAVNET_LCD_H
17448 - #define __XTENSA_XTAVNET_LCD_H
17449 -
17450 -+#ifdef CONFIG_XTFPGA_LCD
17451 - /* Display string STR at position POS on the LCD. */
17452 - void lcd_disp_at_pos(char *str, unsigned char pos);
17453 -
17454 - /* Shift the contents of the LCD display left or right. */
17455 - void lcd_shiftleft(void);
17456 - void lcd_shiftright(void);
17457 -+#else
17458 -+static inline void lcd_disp_at_pos(char *str, unsigned char pos)
17459 -+{
17460 -+}
17461 ++ if (ret != len) {
17462 ++ pr_err("vfs_write to prot file failed: %zd\n", ret);
17463 ++ return ret < 0 ? ret : -ENODEV;
17464 ++ }
17465 ++ prot += ret;
17466 ++ }
17467 +
17468 -+static inline void lcd_shiftleft(void)
17469 -+{
17470 ++ return 0;
17471 +}
17472 +
17473 -+static inline void lcd_shiftright(void)
17474 ++static int
17475 ++fd_do_prot_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb)
17476 +{
17477 ++ void *buf;
17478 ++ int rc;
17479 ++
17480 ++ buf = (void *)__get_free_page(GFP_KERNEL);
17481 ++ if (!buf) {
17482 ++ pr_err("Unable to allocate FILEIO prot buf\n");
17483 ++ return -ENOMEM;
17484 ++ }
17485 ++ memset(buf, 0xff, PAGE_SIZE);
17486 ++
17487 ++ rc = fd_do_prot_fill(cmd->se_dev, lba, nolb, buf, PAGE_SIZE);
17488 ++
17489 ++ free_page((unsigned long)buf);
17490 ++
17491 ++ return rc;
17492 +}
17493 -+#endif
17494 +
17495 - #endif
17496 -diff --git a/arch/xtensa/platforms/xtfpga/lcd.c b/arch/xtensa/platforms/xtfpga/lcd.c
17497 -index 2872301..4dc0c1b 100644
17498 ---- a/arch/xtensa/platforms/xtfpga/lcd.c
17499 -+++ b/arch/xtensa/platforms/xtfpga/lcd.c
17500 -@@ -1,50 +1,63 @@
17501 - /*
17502 -- * Driver for the LCD display on the Tensilica LX60 Board.
17503 -+ * Driver for the LCD display on the Tensilica XTFPGA board family.
17504 -+ * http://www.mytechcorp.com/cfdata/productFile/File1/MOC-16216B-B-A0A04.pdf
17505 - *
17506 - * This file is subject to the terms and conditions of the GNU General Public
17507 - * License. See the file "COPYING" in the main directory of this archive
17508 - * for more details.
17509 - *
17510 - * Copyright (C) 2001, 2006 Tensilica Inc.
17511 -+ * Copyright (C) 2015 Cadence Design Systems Inc.
17512 - */
17513 -
17514 --/*
17515 -- *
17516 -- * FIXME: this code is from the examples from the LX60 user guide.
17517 -- *
17518 -- * The lcd_pause function does busy waiting, which is probably not
17519 -- * great. Maybe the code could be changed to use kernel timers, or
17520 -- * change the hardware to not need to wait.
17521 -- */
17522 --
17523 -+#include <linux/delay.h>
17524 - #include <linux/init.h>
17525 - #include <linux/io.h>
17526 -
17527 - #include <platform/hardware.h>
17528 - #include <platform/lcd.h>
17529 --#include <linux/delay.h>
17530 + static sense_reason_t
17531 + fd_do_unmap(struct se_cmd *cmd, void *priv, sector_t lba, sector_t nolb)
17532 + {
17533 +@@ -556,6 +598,12 @@ fd_do_unmap(struct se_cmd *cmd, void *priv, sector_t lba, sector_t nolb)
17534 + struct inode *inode = file->f_mapping->host;
17535 + int ret;
17536
17537 --#define LCD_PAUSE_ITERATIONS 4000
17538 -+/* LCD instruction and data addresses. */
17539 -+#define LCD_INSTR_ADDR ((char *)IOADDR(CONFIG_XTFPGA_LCD_BASE_ADDR))
17540 -+#define LCD_DATA_ADDR (LCD_INSTR_ADDR + 4)
17541 ++ if (cmd->se_dev->dev_attrib.pi_prot_type) {
17542 ++ ret = fd_do_prot_unmap(cmd, lba, nolb);
17543 ++ if (ret)
17544 ++ return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
17545 ++ }
17546 +
17547 - #define LCD_CLEAR 0x1
17548 - #define LCD_DISPLAY_ON 0xc
17549 + if (S_ISBLK(inode->i_mode)) {
17550 + /* The backend is block device, use discard */
17551 + struct block_device *bdev = inode->i_bdev;
17552 +@@ -658,11 +706,11 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
17553 + 0, fd_prot.prot_sg, 0);
17554 + if (rc) {
17555 + kfree(fd_prot.prot_sg);
17556 +- vfree(fd_prot.prot_buf);
17557 ++ kfree(fd_prot.prot_buf);
17558 + return rc;
17559 + }
17560 + kfree(fd_prot.prot_sg);
17561 +- vfree(fd_prot.prot_buf);
17562 ++ kfree(fd_prot.prot_buf);
17563 + }
17564 + } else {
17565 + memset(&fd_prot, 0, sizeof(struct fd_prot));
17566 +@@ -678,7 +726,7 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
17567 + 0, fd_prot.prot_sg, 0);
17568 + if (rc) {
17569 + kfree(fd_prot.prot_sg);
17570 +- vfree(fd_prot.prot_buf);
17571 ++ kfree(fd_prot.prot_buf);
17572 + return rc;
17573 + }
17574 + }
17575 +@@ -714,7 +762,7 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
17576
17577 - /* 8bit and 2 lines display */
17578 - #define LCD_DISPLAY_MODE8BIT 0x38
17579 -+#define LCD_DISPLAY_MODE4BIT 0x28
17580 - #define LCD_DISPLAY_POS 0x80
17581 - #define LCD_SHIFT_LEFT 0x18
17582 - #define LCD_SHIFT_RIGHT 0x1c
17583 + if (ret < 0) {
17584 + kfree(fd_prot.prot_sg);
17585 +- vfree(fd_prot.prot_buf);
17586 ++ kfree(fd_prot.prot_buf);
17587 + return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
17588 + }
17589
17590 -+static void lcd_put_byte(u8 *addr, u8 data)
17591 -+{
17592 -+#ifdef CONFIG_XTFPGA_LCD_8BIT_ACCESS
17593 -+ ACCESS_ONCE(*addr) = data;
17594 -+#else
17595 -+ ACCESS_ONCE(*addr) = data & 0xf0;
17596 -+ ACCESS_ONCE(*addr) = (data << 4) & 0xf0;
17597 -+#endif
17598 -+}
17599 -+
17600 - static int __init lcd_init(void)
17601 - {
17602 -- *LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT;
17603 -+ ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT;
17604 - mdelay(5);
17605 -- *LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT;
17606 -+ ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT;
17607 - udelay(200);
17608 -- *LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT;
17609 -+ ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT;
17610 -+ udelay(50);
17611 -+#ifndef CONFIG_XTFPGA_LCD_8BIT_ACCESS
17612 -+ ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE4BIT;
17613 -+ udelay(50);
17614 -+ lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_MODE4BIT);
17615 - udelay(50);
17616 -- *LCD_INSTR_ADDR = LCD_DISPLAY_ON;
17617 -+#endif
17618 -+ lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_ON);
17619 - udelay(50);
17620 -- *LCD_INSTR_ADDR = LCD_CLEAR;
17621 -+ lcd_put_byte(LCD_INSTR_ADDR, LCD_CLEAR);
17622 - mdelay(10);
17623 - lcd_disp_at_pos("XTENSA LINUX", 0);
17624 - return 0;
17625 -@@ -52,10 +65,10 @@ static int __init lcd_init(void)
17626 +@@ -878,48 +926,28 @@ static int fd_init_prot(struct se_device *dev)
17627
17628 - void lcd_disp_at_pos(char *str, unsigned char pos)
17629 + static int fd_format_prot(struct se_device *dev)
17630 {
17631 -- *LCD_INSTR_ADDR = LCD_DISPLAY_POS | pos;
17632 -+ lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_POS | pos);
17633 - udelay(100);
17634 - while (*str != 0) {
17635 -- *LCD_DATA_ADDR = *str;
17636 -+ lcd_put_byte(LCD_DATA_ADDR, *str);
17637 - udelay(200);
17638 - str++;
17639 +- struct fd_dev *fd_dev = FD_DEV(dev);
17640 +- struct file *prot_fd = fd_dev->fd_prot_file;
17641 +- sector_t prot_length, prot;
17642 + unsigned char *buf;
17643 +- loff_t pos = 0;
17644 + int unit_size = FDBD_FORMAT_UNIT_SIZE * dev->dev_attrib.block_size;
17645 +- int rc, ret = 0, size, len;
17646 ++ int ret;
17647 +
17648 + if (!dev->dev_attrib.pi_prot_type) {
17649 + pr_err("Unable to format_prot while pi_prot_type == 0\n");
17650 + return -ENODEV;
17651 }
17652 -@@ -63,13 +76,13 @@ void lcd_disp_at_pos(char *str, unsigned char pos)
17653 +- if (!prot_fd) {
17654 +- pr_err("Unable to locate fd_dev->fd_prot_file\n");
17655 +- return -ENODEV;
17656 +- }
17657
17658 - void lcd_shiftleft(void)
17659 - {
17660 -- *LCD_INSTR_ADDR = LCD_SHIFT_LEFT;
17661 -+ lcd_put_byte(LCD_INSTR_ADDR, LCD_SHIFT_LEFT);
17662 - udelay(50);
17663 + buf = vzalloc(unit_size);
17664 + if (!buf) {
17665 + pr_err("Unable to allocate FILEIO prot buf\n");
17666 + return -ENOMEM;
17667 + }
17668 +- prot_length = (dev->transport->get_blocks(dev) + 1) * dev->prot_length;
17669 +- size = prot_length;
17670 +
17671 + pr_debug("Using FILEIO prot_length: %llu\n",
17672 +- (unsigned long long)prot_length);
17673 ++ (unsigned long long)(dev->transport->get_blocks(dev) + 1) *
17674 ++ dev->prot_length);
17675 +
17676 + memset(buf, 0xff, unit_size);
17677 +- for (prot = 0; prot < prot_length; prot += unit_size) {
17678 +- len = min(unit_size, size);
17679 +- rc = kernel_write(prot_fd, buf, len, pos);
17680 +- if (rc != len) {
17681 +- pr_err("vfs_write to prot file failed: %d\n", rc);
17682 +- ret = -ENODEV;
17683 +- goto out;
17684 +- }
17685 +- pos += len;
17686 +- size -= len;
17687 +- }
17688 +-
17689 +-out:
17690 ++ ret = fd_do_prot_fill(dev, 0, dev->transport->get_blocks(dev) + 1,
17691 ++ buf, unit_size);
17692 + vfree(buf);
17693 + return ret;
17694 + }
17695 +diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
17696 +index 3e72974..755bd9b3 100644
17697 +--- a/drivers/target/target_core_sbc.c
17698 ++++ b/drivers/target/target_core_sbc.c
17699 +@@ -312,7 +312,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o
17700 + return 0;
17701 }
17702
17703 - void lcd_shiftright(void)
17704 +-static sense_reason_t xdreadwrite_callback(struct se_cmd *cmd)
17705 ++static sense_reason_t xdreadwrite_callback(struct se_cmd *cmd, bool success)
17706 {
17707 -- *LCD_INSTR_ADDR = LCD_SHIFT_RIGHT;
17708 -+ lcd_put_byte(LCD_INSTR_ADDR, LCD_SHIFT_RIGHT);
17709 - udelay(50);
17710 + unsigned char *buf, *addr;
17711 + struct scatterlist *sg;
17712 +@@ -376,7 +376,7 @@ sbc_execute_rw(struct se_cmd *cmd)
17713 + cmd->data_direction);
17714 }
17715
17716 ---
17717 -2.3.6
17718 -
17719 -
17720 -From 3d421b4703e664742e5f8b80c8f61d64d6435fa2 Mon Sep 17 00:00:00 2001
17721 -From: Max Filippov <jcmvbkbc@×××××.com>
17722 -Date: Fri, 27 Feb 2015 11:02:38 +0300
17723 -Subject: [PATCH 158/219] xtensa: provide __NR_sync_file_range2 instead of
17724 - __NR_sync_file_range
17725 -Cc: mpagano@g.o
17726 -
17727 -commit 01e84c70fe40c8111f960987bcf7f931842e6d07 upstream.
17728 -
17729 -xtensa actually uses sync_file_range2 implementation, so it should
17730 -define __NR_sync_file_range2 as other architectures that use that
17731 -function. That fixes userspace interface (that apparently never worked)
17732 -and avoids special-casing xtensa in libc implementations.
17733 -See the thread ending at
17734 -http://lists.busybox.net/pipermail/uclibc/2015-February/048833.html
17735 -for more details.
17736 -
17737 -Signed-off-by: Max Filippov <jcmvbkbc@×××××.com>
17738 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
17739 -Signed-off-by: Mike Pagano <mpagano@g.o>
17740 ----
17741 - arch/xtensa/include/uapi/asm/unistd.h | 2 +-
17742 - 1 file changed, 1 insertion(+), 1 deletion(-)
17743 -
17744 -diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h
17745 -index db5bb72..62d8465 100644
17746 ---- a/arch/xtensa/include/uapi/asm/unistd.h
17747 -+++ b/arch/xtensa/include/uapi/asm/unistd.h
17748 -@@ -715,7 +715,7 @@ __SYSCALL(323, sys_process_vm_writev, 6)
17749 - __SYSCALL(324, sys_name_to_handle_at, 5)
17750 - #define __NR_open_by_handle_at 325
17751 - __SYSCALL(325, sys_open_by_handle_at, 3)
17752 --#define __NR_sync_file_range 326
17753 -+#define __NR_sync_file_range2 326
17754 - __SYSCALL(326, sys_sync_file_range2, 6)
17755 - #define __NR_perf_event_open 327
17756 - __SYSCALL(327, sys_perf_event_open, 5)
17757 ---
17758 -2.3.6
17759 -
17760 -
17761 -From 63c94a9787fee217938e65b3e11bed2b7179481f Mon Sep 17 00:00:00 2001
17762 -From: Max Filippov <jcmvbkbc@×××××.com>
17763 -Date: Fri, 3 Apr 2015 09:56:21 +0300
17764 -Subject: [PATCH 159/219] xtensa: ISS: fix locking in TAP network adapter
17765 -Cc: mpagano@g.o
17766 -
17767 -commit 24e94454c8cb6a13634f5a2f5a01da53a546a58d upstream.
17768 -
17769 -- don't lock lp->lock in the iss_net_timer for the call of iss_net_poll,
17770 - it will lock it itself;
17771 -- invert order of lp->lock and opened_lock acquisition in the
17772 - iss_net_open to make it consistent with iss_net_poll;
17773 -- replace spin_lock with spin_lock_bh when acquiring locks used in
17774 - iss_net_timer from non-atomic context;
17775 -- replace spin_lock_irqsave with spin_lock_bh in the iss_net_start_xmit
17776 - as the driver doesn't use lp->lock in the hard IRQ context;
17777 -- replace __SPIN_LOCK_UNLOCKED(lp.lock) with spin_lock_init, otherwise
17778 - lockdep is unhappy about using non-static key.
17779 -
17780 -Signed-off-by: Max Filippov <jcmvbkbc@×××××.com>
17781 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
17782 -Signed-off-by: Mike Pagano <mpagano@g.o>
17783 ----
17784 - arch/xtensa/platforms/iss/network.c | 29 +++++++++++++++--------------
17785 - 1 file changed, 15 insertions(+), 14 deletions(-)
17786 -
17787 -diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
17788 -index d05f8fe..17b1ef3 100644
17789 ---- a/arch/xtensa/platforms/iss/network.c
17790 -+++ b/arch/xtensa/platforms/iss/network.c
17791 -@@ -349,8 +349,8 @@ static void iss_net_timer(unsigned long priv)
17792 +-static sense_reason_t compare_and_write_post(struct se_cmd *cmd)
17793 ++static sense_reason_t compare_and_write_post(struct se_cmd *cmd, bool success)
17794 {
17795 - struct iss_net_private *lp = (struct iss_net_private *)priv;
17796 -
17797 -- spin_lock(&lp->lock);
17798 - iss_net_poll();
17799 -+ spin_lock(&lp->lock);
17800 - mod_timer(&lp->timer, jiffies + lp->timer_val);
17801 - spin_unlock(&lp->lock);
17802 - }
17803 -@@ -361,7 +361,7 @@ static int iss_net_open(struct net_device *dev)
17804 - struct iss_net_private *lp = netdev_priv(dev);
17805 - int err;
17806 -
17807 -- spin_lock(&lp->lock);
17808 -+ spin_lock_bh(&lp->lock);
17809 -
17810 - err = lp->tp.open(lp);
17811 - if (err < 0)
17812 -@@ -376,9 +376,11 @@ static int iss_net_open(struct net_device *dev)
17813 - while ((err = iss_net_rx(dev)) > 0)
17814 - ;
17815 -
17816 -- spin_lock(&opened_lock);
17817 -+ spin_unlock_bh(&lp->lock);
17818 -+ spin_lock_bh(&opened_lock);
17819 - list_add(&lp->opened_list, &opened);
17820 -- spin_unlock(&opened_lock);
17821 -+ spin_unlock_bh(&opened_lock);
17822 -+ spin_lock_bh(&lp->lock);
17823 -
17824 - init_timer(&lp->timer);
17825 - lp->timer_val = ISS_NET_TIMER_VALUE;
17826 -@@ -387,7 +389,7 @@ static int iss_net_open(struct net_device *dev)
17827 - mod_timer(&lp->timer, jiffies + lp->timer_val);
17828 + struct se_device *dev = cmd->se_dev;
17829
17830 - out:
17831 -- spin_unlock(&lp->lock);
17832 -+ spin_unlock_bh(&lp->lock);
17833 - return err;
17834 +@@ -399,7 +399,7 @@ static sense_reason_t compare_and_write_post(struct se_cmd *cmd)
17835 + return TCM_NO_SENSE;
17836 }
17837
17838 -@@ -395,7 +397,7 @@ static int iss_net_close(struct net_device *dev)
17839 +-static sense_reason_t compare_and_write_callback(struct se_cmd *cmd)
17840 ++static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool success)
17841 {
17842 - struct iss_net_private *lp = netdev_priv(dev);
17843 - netif_stop_queue(dev);
17844 -- spin_lock(&lp->lock);
17845 -+ spin_lock_bh(&lp->lock);
17846 + struct se_device *dev = cmd->se_dev;
17847 + struct scatterlist *write_sg = NULL, *sg;
17848 +@@ -414,11 +414,16 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd)
17849
17850 - spin_lock(&opened_lock);
17851 - list_del(&opened);
17852 -@@ -405,18 +407,17 @@ static int iss_net_close(struct net_device *dev)
17853 + /*
17854 + * Handle early failure in transport_generic_request_failure(),
17855 +- * which will not have taken ->caw_mutex yet..
17856 ++ * which will not have taken ->caw_sem yet..
17857 + */
17858 +- if (!cmd->t_data_sg || !cmd->t_bidi_data_sg)
17859 ++ if (!success && (!cmd->t_data_sg || !cmd->t_bidi_data_sg))
17860 + return TCM_NO_SENSE;
17861 + /*
17862 ++ * Handle special case for zero-length COMPARE_AND_WRITE
17863 ++ */
17864 ++ if (!cmd->data_length)
17865 ++ goto out;
17866 ++ /*
17867 + * Immediately exit + release dev->caw_sem if command has already
17868 + * been failed with a non-zero SCSI status.
17869 + */
17870 +diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
17871 +index ac3cbab..f786de0 100644
17872 +--- a/drivers/target/target_core_transport.c
17873 ++++ b/drivers/target/target_core_transport.c
17874 +@@ -1615,11 +1615,11 @@ void transport_generic_request_failure(struct se_cmd *cmd,
17875 + transport_complete_task_attr(cmd);
17876 + /*
17877 + * Handle special case for COMPARE_AND_WRITE failure, where the
17878 +- * callback is expected to drop the per device ->caw_mutex.
17879 ++ * callback is expected to drop the per device ->caw_sem.
17880 + */
17881 + if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
17882 + cmd->transport_complete_callback)
17883 +- cmd->transport_complete_callback(cmd);
17884 ++ cmd->transport_complete_callback(cmd, false);
17885
17886 - lp->tp.close(lp);
17887 + switch (sense_reason) {
17888 + case TCM_NON_EXISTENT_LUN:
17889 +@@ -1975,8 +1975,12 @@ static void target_complete_ok_work(struct work_struct *work)
17890 + if (cmd->transport_complete_callback) {
17891 + sense_reason_t rc;
17892
17893 -- spin_unlock(&lp->lock);
17894 -+ spin_unlock_bh(&lp->lock);
17895 - return 0;
17896 - }
17897 +- rc = cmd->transport_complete_callback(cmd);
17898 ++ rc = cmd->transport_complete_callback(cmd, true);
17899 + if (!rc && !(cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE_POST)) {
17900 ++ if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
17901 ++ !cmd->data_length)
17902 ++ goto queue_rsp;
17903 ++
17904 + return;
17905 + } else if (rc) {
17906 + ret = transport_send_check_condition_and_sense(cmd,
17907 +@@ -1990,6 +1994,7 @@ static void target_complete_ok_work(struct work_struct *work)
17908 + }
17909 + }
17910
17911 - static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
17912 ++queue_rsp:
17913 + switch (cmd->data_direction) {
17914 + case DMA_FROM_DEVICE:
17915 + spin_lock(&cmd->se_lun->lun_sep_lock);
17916 +@@ -2094,6 +2099,16 @@ static inline void transport_reset_sgl_orig(struct se_cmd *cmd)
17917 + static inline void transport_free_pages(struct se_cmd *cmd)
17918 {
17919 - struct iss_net_private *lp = netdev_priv(dev);
17920 -- unsigned long flags;
17921 - int len;
17922 + if (cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) {
17923 ++ /*
17924 ++ * Release special case READ buffer payload required for
17925 ++ * SG_TO_MEM_NOALLOC to function with COMPARE_AND_WRITE
17926 ++ */
17927 ++ if (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) {
17928 ++ transport_free_sgl(cmd->t_bidi_data_sg,
17929 ++ cmd->t_bidi_data_nents);
17930 ++ cmd->t_bidi_data_sg = NULL;
17931 ++ cmd->t_bidi_data_nents = 0;
17932 ++ }
17933 + transport_reset_sgl_orig(cmd);
17934 + return;
17935 + }
17936 +@@ -2246,6 +2261,7 @@ sense_reason_t
17937 + transport_generic_new_cmd(struct se_cmd *cmd)
17938 + {
17939 + int ret = 0;
17940 ++ bool zero_flag = !(cmd->se_cmd_flags & SCF_SCSI_DATA_CDB);
17941
17942 - netif_stop_queue(dev);
17943 -- spin_lock_irqsave(&lp->lock, flags);
17944 -+ spin_lock_bh(&lp->lock);
17945 + /*
17946 + * Determine is the TCM fabric module has already allocated physical
17947 +@@ -2254,7 +2270,6 @@ transport_generic_new_cmd(struct se_cmd *cmd)
17948 + */
17949 + if (!(cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) &&
17950 + cmd->data_length) {
17951 +- bool zero_flag = !(cmd->se_cmd_flags & SCF_SCSI_DATA_CDB);
17952
17953 - len = lp->tp.write(lp, &skb);
17954 + if ((cmd->se_cmd_flags & SCF_BIDI) ||
17955 + (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE)) {
17956 +@@ -2285,6 +2300,20 @@ transport_generic_new_cmd(struct se_cmd *cmd)
17957 + cmd->data_length, zero_flag);
17958 + if (ret < 0)
17959 + return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
17960 ++ } else if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
17961 ++ cmd->data_length) {
17962 ++ /*
17963 ++ * Special case for COMPARE_AND_WRITE with fabrics
17964 ++ * using SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC.
17965 ++ */
17966 ++ u32 caw_length = cmd->t_task_nolb *
17967 ++ cmd->se_dev->dev_attrib.block_size;
17968 ++
17969 ++ ret = target_alloc_sgl(&cmd->t_bidi_data_sg,
17970 ++ &cmd->t_bidi_data_nents,
17971 ++ caw_length, zero_flag);
17972 ++ if (ret < 0)
17973 ++ return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
17974 + }
17975 + /*
17976 + * If this command is not a write we can execute it right here,
17977 +diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
17978 +index deae122..d465ace 100644
17979 +--- a/drivers/tty/serial/8250/8250_core.c
17980 ++++ b/drivers/tty/serial/8250/8250_core.c
17981 +@@ -3444,7 +3444,8 @@ void serial8250_suspend_port(int line)
17982 + port->type != PORT_8250) {
17983 + unsigned char canary = 0xa5;
17984 + serial_out(up, UART_SCR, canary);
17985 +- up->canary = canary;
17986 ++ if (serial_in(up, UART_SCR) == canary)
17987 ++ up->canary = canary;
17988 + }
17989
17990 -@@ -438,7 +439,7 @@ static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
17991 - pr_err("%s: %s failed(%d)\n", dev->name, __func__, len);
17992 + uart_suspend_port(&serial8250_reg, port);
17993 +diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
17994 +index 6ae5b85..7a80250 100644
17995 +--- a/drivers/tty/serial/8250/8250_dw.c
17996 ++++ b/drivers/tty/serial/8250/8250_dw.c
17997 +@@ -629,6 +629,7 @@ static const struct acpi_device_id dw8250_acpi_match[] = {
17998 + { "80860F0A", 0 },
17999 + { "8086228A", 0 },
18000 + { "APMC0D08", 0},
18001 ++ { "AMD0020", 0 },
18002 + { },
18003 + };
18004 + MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match);
18005 +diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
18006 +index 0eb29b1..2306191 100644
18007 +--- a/drivers/tty/serial/imx.c
18008 ++++ b/drivers/tty/serial/imx.c
18009 +@@ -818,7 +818,7 @@ static irqreturn_t imx_int(int irq, void *dev_id)
18010 + if (sts2 & USR2_ORE) {
18011 + dev_err(sport->port.dev, "Rx FIFO overrun\n");
18012 + sport->port.icount.overrun++;
18013 +- writel(sts2 | USR2_ORE, sport->port.membase + USR2);
18014 ++ writel(USR2_ORE, sport->port.membase + USR2);
18015 }
18016
18017 -- spin_unlock_irqrestore(&lp->lock, flags);
18018 -+ spin_unlock_bh(&lp->lock);
18019 + return IRQ_HANDLED;
18020 +@@ -1181,10 +1181,12 @@ static int imx_startup(struct uart_port *port)
18021 + imx_uart_dma_init(sport);
18022
18023 - dev_kfree_skb(skb);
18024 - return NETDEV_TX_OK;
18025 -@@ -466,9 +467,9 @@ static int iss_net_set_mac(struct net_device *dev, void *addr)
18026 + spin_lock_irqsave(&sport->port.lock, flags);
18027 ++
18028 + /*
18029 + * Finally, clear and enable interrupts
18030 + */
18031 + writel(USR1_RTSD, sport->port.membase + USR1);
18032 ++ writel(USR2_ORE, sport->port.membase + USR2);
18033
18034 - if (!is_valid_ether_addr(hwaddr->sa_data))
18035 - return -EADDRNOTAVAIL;
18036 -- spin_lock(&lp->lock);
18037 -+ spin_lock_bh(&lp->lock);
18038 - memcpy(dev->dev_addr, hwaddr->sa_data, ETH_ALEN);
18039 -- spin_unlock(&lp->lock);
18040 -+ spin_unlock_bh(&lp->lock);
18041 - return 0;
18042 - }
18043 -
18044 -@@ -520,11 +521,11 @@ static int iss_net_configure(int index, char *init)
18045 - *lp = (struct iss_net_private) {
18046 - .device_list = LIST_HEAD_INIT(lp->device_list),
18047 - .opened_list = LIST_HEAD_INIT(lp->opened_list),
18048 -- .lock = __SPIN_LOCK_UNLOCKED(lp.lock),
18049 - .dev = dev,
18050 - .index = index,
18051 -- };
18052 -+ };
18053 -
18054 -+ spin_lock_init(&lp->lock);
18055 - /*
18056 - * If this name ends up conflicting with an existing registered
18057 - * netdevice, that is OK, register_netdev{,ice}() will notice this
18058 ---
18059 -2.3.6
18060 -
18061 -
18062 -From 6d4724e609d9640755996c9dc8f3f4ee79790957 Mon Sep 17 00:00:00 2001
18063 -From: Gregory CLEMENT <gregory.clement@××××××××××××××.com>
18064 -Date: Thu, 2 Apr 2015 17:11:11 +0200
18065 -Subject: [PATCH 160/219] gpio: mvebu: Fix mask/unmask managment per irq chip
18066 - type
18067 -Cc: mpagano@g.o
18068 -
18069 -commit 61819549f572edd7fce53f228c0d8420cdc85f71 upstream.
18070 -
18071 -Level IRQ handlers and edge IRQ handler are managed by tow different
18072 -sets of registers. But currently the driver uses the same mask for the
18073 -both registers. It lead to issues with the following scenario:
18074 -
18075 -First, an IRQ is requested on a GPIO to be triggered on front. After,
18076 -this an other IRQ is requested for a GPIO of the same bank but
18077 -triggered on level. Then the first one will be also setup to be
18078 -triggered on level. It leads to an interrupt storm.
18079 -
18080 -The different kind of handler are already associated with two
18081 -different irq chip type. With this patch the driver uses a private
18082 -mask for each one which solves this issue.
18083 -
18084 -It has been tested on an Armada XP based board and on an Armada 375
18085 -board. For the both boards, with this patch is applied, there is no
18086 -such interrupt storm when running the previous scenario.
18087 -
18088 -This bug was already fixed but in a different way in the legacy
18089 -version of this driver by Evgeniy Dushistov:
18090 -9ece8839b1277fb9128ff6833411614ab6c88d68 "ARM: orion: Fix for certain
18091 -sequence of request_irq can cause irq storm". The fact the new version
18092 -of the gpio drive could be affected had been discussed there:
18093 -http://thread.gmane.org/gmane.linux.ports.arm.kernel/344670/focus=364012
18094 -
18095 -Reported-by: Evgeniy A. Dushistov <dushistov@××××.ru>
18096 -Signed-off-by: Gregory CLEMENT <gregory.clement@××××××××××××××.com>
18097 -Signed-off-by: Linus Walleij <linus.walleij@××××××.org>
18098 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
18099 -Signed-off-by: Mike Pagano <mpagano@g.o>
18100 ----
18101 - drivers/gpio/gpio-mvebu.c | 24 ++++++++++++++++--------
18102 - 1 file changed, 16 insertions(+), 8 deletions(-)
18103 -
18104 -diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
18105 -index d0bc123..1a54205 100644
18106 ---- a/drivers/gpio/gpio-mvebu.c
18107 -+++ b/drivers/gpio/gpio-mvebu.c
18108 -@@ -320,11 +320,13 @@ static void mvebu_gpio_edge_irq_mask(struct irq_data *d)
18109 - {
18110 - struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
18111 - struct mvebu_gpio_chip *mvchip = gc->private;
18112 -+ struct irq_chip_type *ct = irq_data_get_chip_type(d);
18113 - u32 mask = 1 << (d->irq - gc->irq_base);
18114 -
18115 - irq_gc_lock(gc);
18116 -- gc->mask_cache &= ~mask;
18117 -- writel_relaxed(gc->mask_cache, mvebu_gpioreg_edge_mask(mvchip));
18118 -+ ct->mask_cache_priv &= ~mask;
18119 -+
18120 -+ writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_edge_mask(mvchip));
18121 - irq_gc_unlock(gc);
18122 - }
18123 -
18124 -@@ -332,11 +334,13 @@ static void mvebu_gpio_edge_irq_unmask(struct irq_data *d)
18125 - {
18126 - struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
18127 - struct mvebu_gpio_chip *mvchip = gc->private;
18128 -+ struct irq_chip_type *ct = irq_data_get_chip_type(d);
18129 -+
18130 - u32 mask = 1 << (d->irq - gc->irq_base);
18131 -
18132 - irq_gc_lock(gc);
18133 -- gc->mask_cache |= mask;
18134 -- writel_relaxed(gc->mask_cache, mvebu_gpioreg_edge_mask(mvchip));
18135 -+ ct->mask_cache_priv |= mask;
18136 -+ writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_edge_mask(mvchip));
18137 - irq_gc_unlock(gc);
18138 - }
18139 -
18140 -@@ -344,11 +348,13 @@ static void mvebu_gpio_level_irq_mask(struct irq_data *d)
18141 - {
18142 - struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
18143 - struct mvebu_gpio_chip *mvchip = gc->private;
18144 -+ struct irq_chip_type *ct = irq_data_get_chip_type(d);
18145 -+
18146 - u32 mask = 1 << (d->irq - gc->irq_base);
18147 -
18148 - irq_gc_lock(gc);
18149 -- gc->mask_cache &= ~mask;
18150 -- writel_relaxed(gc->mask_cache, mvebu_gpioreg_level_mask(mvchip));
18151 -+ ct->mask_cache_priv &= ~mask;
18152 -+ writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_level_mask(mvchip));
18153 - irq_gc_unlock(gc);
18154 - }
18155 -
18156 -@@ -356,11 +362,13 @@ static void mvebu_gpio_level_irq_unmask(struct irq_data *d)
18157 - {
18158 - struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
18159 - struct mvebu_gpio_chip *mvchip = gc->private;
18160 -+ struct irq_chip_type *ct = irq_data_get_chip_type(d);
18161 -+
18162 - u32 mask = 1 << (d->irq - gc->irq_base);
18163 -
18164 - irq_gc_lock(gc);
18165 -- gc->mask_cache |= mask;
18166 -- writel_relaxed(gc->mask_cache, mvebu_gpioreg_level_mask(mvchip));
18167 -+ ct->mask_cache_priv |= mask;
18168 -+ writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_level_mask(mvchip));
18169 - irq_gc_unlock(gc);
18170 - }
18171 -
18172 ---
18173 -2.3.6
18174 -
18175 -
18176 -From fb8e85723598714f519a827184910324690e2896 Mon Sep 17 00:00:00 2001
18177 -From: Bartlomiej Zolnierkiewicz <b.zolnierkie@×××××××.com>
18178 -Date: Fri, 27 Mar 2015 17:27:10 +0100
18179 -Subject: [PATCH 161/219] clk: samsung: exynos4: Disable ARMCLK down feature on
18180 - Exynos4210 SoC
18181 -Cc: mpagano@g.o
18182 -
18183 -commit 3a9e9cb65be84d6c64fbe9c69a73c15d59f29454 upstream.
18184 -
18185 -Commit 42773b28e71d ("clk: samsung: exynos4: Enable ARMCLK
18186 -down feature") enabled ARMCLK down feature on all Exynos4
18187 -SoCs. Unfortunately on Exynos4210 SoC ARMCLK down feature
18188 -causes a lockup when ondemand cpufreq governor is used.
18189 -Fix it by limiting ARMCLK down feature to Exynos4x12 SoCs.
18190 -
18191 -This patch was tested on:
18192 -- Exynos4210 SoC based Trats board
18193 -- Exynos4210 SoC based Origen board
18194 -- Exynos4412 SoC based Trats2 board
18195 -- Exynos4412 SoC based Odroid-U3 board
18196 -
18197 -Cc: Daniel Drake <drake@××××××××.com>
18198 -Cc: Tomasz Figa <t.figa@×××××××.com>
18199 -Cc: Kukjin Kim <kgene@××××××.org>
18200 -Fixes: 42773b28e71d ("clk: samsung: exynos4: Enable ARMCLK down feature")
18201 -Reviewed-by: Krzysztof Kozlowski <k.kozlowski@×××××××.com>
18202 -Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@×××××××.com>
18203 -Signed-off-by: Michael Turquette <mturquette@××××××.org>
18204 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
18205 -Signed-off-by: Mike Pagano <mpagano@g.o>
18206 ----
18207 - drivers/clk/samsung/clk-exynos4.c | 11 +++++------
18208 - 1 file changed, 5 insertions(+), 6 deletions(-)
18209 -
18210 -diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c
18211 -index 51462e8..714d6ba 100644
18212 ---- a/drivers/clk/samsung/clk-exynos4.c
18213 -+++ b/drivers/clk/samsung/clk-exynos4.c
18214 -@@ -1354,7 +1354,7 @@ static struct samsung_pll_clock exynos4x12_plls[nr_plls] __initdata = {
18215 - VPLL_LOCK, VPLL_CON0, NULL),
18216 - };
18217 -
18218 --static void __init exynos4_core_down_clock(enum exynos4_soc soc)
18219 -+static void __init exynos4x12_core_down_clock(void)
18220 - {
18221 - unsigned int tmp;
18222 -
18223 -@@ -1373,11 +1373,9 @@ static void __init exynos4_core_down_clock(enum exynos4_soc soc)
18224 - __raw_writel(tmp, reg_base + PWR_CTRL1);
18225 -
18226 - /*
18227 -- * Disable the clock up feature on Exynos4x12, in case it was
18228 -- * enabled by bootloader.
18229 -+ * Disable the clock up feature in case it was enabled by bootloader.
18230 - */
18231 -- if (exynos4_soc == EXYNOS4X12)
18232 -- __raw_writel(0x0, reg_base + E4X12_PWR_CTRL2);
18233 -+ __raw_writel(0x0, reg_base + E4X12_PWR_CTRL2);
18234 - }
18235 -
18236 - /* register exynos4 clocks */
18237 -@@ -1474,7 +1472,8 @@ static void __init exynos4_clk_init(struct device_node *np,
18238 - samsung_clk_register_alias(ctx, exynos4_aliases,
18239 - ARRAY_SIZE(exynos4_aliases));
18240 -
18241 -- exynos4_core_down_clock(soc);
18242 -+ if (soc == EXYNOS4X12)
18243 -+ exynos4x12_core_down_clock();
18244 - exynos4_clk_sleep_init();
18245 + if (sport->dma_is_inited && !sport->dma_is_enabled)
18246 + imx_enable_dma(sport);
18247 +@@ -1199,10 +1201,6 @@ static int imx_startup(struct uart_port *port)
18248
18249 - samsung_clk_of_add_provider(np, ctx);
18250 ---
18251 -2.3.6
18252 -
18253 -
18254 -From 41761ed1e3b457699c416c4e5eea1c86aa2d307c Mon Sep 17 00:00:00 2001
18255 -From: Thierry Reding <treding@××××××.com>
18256 -Date: Mon, 23 Mar 2015 10:57:46 +0100
18257 -Subject: [PATCH 162/219] clk: tegra: Register the proper number of resets
18258 -Cc: mpagano@g.o
18259 -
18260 -commit 5e43e259171e1eee8bc074d9c44be434e685087b upstream.
18261 -
18262 -The number of resets controls is 32 times the number of peripheral
18263 -register banks rather than 32 times the number of clocks. This reduces
18264 -(drastically) the number of reset controls registered from 10080 (315
18265 -clocks * 32) to 224 (6 peripheral register banks * 32).
18266 -
18267 -This also fixes a potential crash because trying to use any of the
18268 -excess reset controls (224-10079) would have caused accesses beyond
18269 -the array bounds of the peripheral register banks definition array.
18270 -
18271 -Cc: Peter De Schrijver <pdeschrijver@××××××.com>
18272 -Cc: Prashant Gaikwad <pgaikwad@××××××.com>
18273 -Fixes: 6d5b988e7dc5 ("clk: tegra: implement a reset driver")
18274 -Signed-off-by: Thierry Reding <treding@××××××.com>
18275 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
18276 -Signed-off-by: Mike Pagano <mpagano@g.o>
18277 ----
18278 - drivers/clk/tegra/clk.c | 2 +-
18279 - 1 file changed, 1 insertion(+), 1 deletion(-)
18280 -
18281 -diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c
18282 -index 9ddb754..7a1df61 100644
18283 ---- a/drivers/clk/tegra/clk.c
18284 -+++ b/drivers/clk/tegra/clk.c
18285 -@@ -272,7 +272,7 @@ void __init tegra_add_of_provider(struct device_node *np)
18286 - of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
18287 + writel(temp, sport->port.membase + UCR1);
18288
18289 - rst_ctlr.of_node = np;
18290 -- rst_ctlr.nr_resets = clk_num * 32;
18291 -+ rst_ctlr.nr_resets = periph_banks * 32;
18292 - reset_controller_register(&rst_ctlr);
18293 - }
18294 +- /* Clear any pending ORE flag before enabling interrupt */
18295 +- temp = readl(sport->port.membase + USR2);
18296 +- writel(temp | USR2_ORE, sport->port.membase + USR2);
18297 +-
18298 + temp = readl(sport->port.membase + UCR4);
18299 + temp |= UCR4_OREN;
18300 + writel(temp, sport->port.membase + UCR4);
18301 +diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
18302 +index a051a7a..a81f9dd 100644
18303 +--- a/drivers/usb/class/cdc-wdm.c
18304 ++++ b/drivers/usb/class/cdc-wdm.c
18305 +@@ -245,7 +245,7 @@ static void wdm_int_callback(struct urb *urb)
18306 + case USB_CDC_NOTIFY_RESPONSE_AVAILABLE:
18307 + dev_dbg(&desc->intf->dev,
18308 + "NOTIFY_RESPONSE_AVAILABLE received: index %d len %d",
18309 +- dr->wIndex, dr->wLength);
18310 ++ le16_to_cpu(dr->wIndex), le16_to_cpu(dr->wLength));
18311 + break;
18312
18313 ---
18314 -2.3.6
18315 -
18316 -
18317 -From 7c646709786798cd41b4e2feb7f9136214169c92 Mon Sep 17 00:00:00 2001
18318 -From: Thierry Reding <treding@××××××.com>
18319 -Date: Thu, 26 Mar 2015 17:53:01 +0100
18320 -Subject: [PATCH 163/219] clk: tegra: Use the proper parent for plld_dsi
18321 -Cc: mpagano@g.o
18322 -
18323 -commit c1d676cec572544616273d5853cb7cc38fbaa62b upstream.
18324 -
18325 -The current parent, plld_out0, does not exist. The proper name is
18326 -pll_d_out0. While at it, rename the plld_dsi clock to pll_d_dsi_out to
18327 -be more consistent with other clock names.
18328 -
18329 -Fixes: b270491eb9a0 ("clk: tegra: Define PLLD_DSI and remove dsia(b)_mux")
18330 -Signed-off-by: Thierry Reding <treding@××××××.com>
18331 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
18332 -Signed-off-by: Mike Pagano <mpagano@g.o>
18333 ----
18334 - drivers/clk/tegra/clk-tegra124.c | 14 ++++++++------
18335 - include/dt-bindings/clock/tegra124-car-common.h | 2 +-
18336 - 2 files changed, 9 insertions(+), 7 deletions(-)
18337 -
18338 -diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c
18339 -index 9a893f2..23ce0af 100644
18340 ---- a/drivers/clk/tegra/clk-tegra124.c
18341 -+++ b/drivers/clk/tegra/clk-tegra124.c
18342 -@@ -1110,16 +1110,18 @@ static __init void tegra124_periph_clk_init(void __iomem *clk_base,
18343 - 1, 2);
18344 - clks[TEGRA124_CLK_XUSB_SS_DIV2] = clk;
18345 + case USB_CDC_NOTIFY_NETWORK_CONNECTION:
18346 +@@ -262,7 +262,9 @@ static void wdm_int_callback(struct urb *urb)
18347 + clear_bit(WDM_POLL_RUNNING, &desc->flags);
18348 + dev_err(&desc->intf->dev,
18349 + "unknown notification %d received: index %d len %d\n",
18350 +- dr->bNotificationType, dr->wIndex, dr->wLength);
18351 ++ dr->bNotificationType,
18352 ++ le16_to_cpu(dr->wIndex),
18353 ++ le16_to_cpu(dr->wLength));
18354 + goto exit;
18355 + }
18356
18357 -- clk = clk_register_gate(NULL, "plld_dsi", "plld_out0", 0,
18358 -+ clk = clk_register_gate(NULL, "pll_d_dsi_out", "pll_d_out0", 0,
18359 - clk_base + PLLD_MISC, 30, 0, &pll_d_lock);
18360 -- clks[TEGRA124_CLK_PLLD_DSI] = clk;
18361 -+ clks[TEGRA124_CLK_PLL_D_DSI_OUT] = clk;
18362 +@@ -408,7 +410,7 @@ static ssize_t wdm_write
18363 + USB_RECIP_INTERFACE);
18364 + req->bRequest = USB_CDC_SEND_ENCAPSULATED_COMMAND;
18365 + req->wValue = 0;
18366 +- req->wIndex = desc->inum;
18367 ++ req->wIndex = desc->inum; /* already converted */
18368 + req->wLength = cpu_to_le16(count);
18369 + set_bit(WDM_IN_USE, &desc->flags);
18370 + desc->outbuf = buf;
18371 +@@ -422,7 +424,7 @@ static ssize_t wdm_write
18372 + rv = usb_translate_errors(rv);
18373 + } else {
18374 + dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d",
18375 +- req->wIndex);
18376 ++ le16_to_cpu(req->wIndex));
18377 + }
18378 + out:
18379 + usb_autopm_put_interface(desc->intf);
18380 +@@ -820,7 +822,7 @@ static int wdm_create(struct usb_interface *intf, struct usb_endpoint_descriptor
18381 + desc->irq->bRequestType = (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE);
18382 + desc->irq->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE;
18383 + desc->irq->wValue = 0;
18384 +- desc->irq->wIndex = desc->inum;
18385 ++ desc->irq->wIndex = desc->inum; /* already converted */
18386 + desc->irq->wLength = cpu_to_le16(desc->wMaxCommand);
18387
18388 -- clk = tegra_clk_register_periph_gate("dsia", "plld_dsi", 0, clk_base,
18389 -- 0, 48, periph_clk_enb_refcnt);
18390 -+ clk = tegra_clk_register_periph_gate("dsia", "pll_d_dsi_out", 0,
18391 -+ clk_base, 0, 48,
18392 -+ periph_clk_enb_refcnt);
18393 - clks[TEGRA124_CLK_DSIA] = clk;
18394 + usb_fill_control_urb(
18395 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
18396 +index d7c3d5a..3b71516 100644
18397 +--- a/drivers/usb/core/hub.c
18398 ++++ b/drivers/usb/core/hub.c
18399 +@@ -3406,10 +3406,10 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
18400 + if (status) {
18401 + dev_dbg(&port_dev->dev, "can't resume, status %d\n", status);
18402 + } else {
18403 +- /* drive resume for at least 20 msec */
18404 ++ /* drive resume for USB_RESUME_TIMEOUT msec */
18405 + dev_dbg(&udev->dev, "usb %sresume\n",
18406 + (PMSG_IS_AUTO(msg) ? "auto-" : ""));
18407 +- msleep(25);
18408 ++ msleep(USB_RESUME_TIMEOUT);
18409
18410 -- clk = tegra_clk_register_periph_gate("dsib", "plld_dsi", 0, clk_base,
18411 -- 0, 82, periph_clk_enb_refcnt);
18412 -+ clk = tegra_clk_register_periph_gate("dsib", "pll_d_dsi_out", 0,
18413 -+ clk_base, 0, 82,
18414 -+ periph_clk_enb_refcnt);
18415 - clks[TEGRA124_CLK_DSIB] = clk;
18416 + /* Virtual root hubs can trigger on GET_PORT_STATUS to
18417 + * stop resume signaling. Then finish the resume
18418 +diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
18419 +index c78c874..758b7e0 100644
18420 +--- a/drivers/usb/dwc2/hcd.c
18421 ++++ b/drivers/usb/dwc2/hcd.c
18422 +@@ -1521,7 +1521,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
18423 + dev_dbg(hsotg->dev,
18424 + "ClearPortFeature USB_PORT_FEAT_SUSPEND\n");
18425 + writel(0, hsotg->regs + PCGCTL);
18426 +- usleep_range(20000, 40000);
18427 ++ msleep(USB_RESUME_TIMEOUT);
18428
18429 - /* emc mux */
18430 -diff --git a/include/dt-bindings/clock/tegra124-car-common.h b/include/dt-bindings/clock/tegra124-car-common.h
18431 -index ae2eb17..a215609 100644
18432 ---- a/include/dt-bindings/clock/tegra124-car-common.h
18433 -+++ b/include/dt-bindings/clock/tegra124-car-common.h
18434 -@@ -297,7 +297,7 @@
18435 - #define TEGRA124_CLK_PLL_C4 270
18436 - #define TEGRA124_CLK_PLL_DP 271
18437 - #define TEGRA124_CLK_PLL_E_MUX 272
18438 --#define TEGRA124_CLK_PLLD_DSI 273
18439 -+#define TEGRA124_CLK_PLL_D_DSI_OUT 273
18440 - /* 274 */
18441 - /* 275 */
18442 - /* 276 */
18443 ---
18444 -2.3.6
18445 -
18446 -
18447 -From 1d77b1031e7230917ed6c8fd1ac82f18a9c33c9d Mon Sep 17 00:00:00 2001
18448 -From: Stephen Boyd <sboyd@××××××××××.org>
18449 -Date: Mon, 23 Feb 2015 13:30:28 -0800
18450 -Subject: [PATCH 164/219] clk: qcom: Fix i2c frequency table
18451 -Cc: mpagano@g.o
18452 -
18453 -commit 0bf0ff82c34da02ee5795101b328225a2d519594 upstream.
18454 -
18455 -PXO is 25MHz, not 27MHz. Fix the table.
18456 -
18457 -Fixes: 24d8fba44af3 "clk: qcom: Add support for IPQ8064's global
18458 -clock controller (GCC)"
18459 -
18460 -Signed-off-by: Stephen Boyd <sboyd@××××××××××.org>
18461 -Reviewed-by: Andy Gross <agross@××××××××××.org>
18462 -Tested-by: Andy Gross <agross@××××××××××.org>
18463 -Signed-off-by: Michael Turquette <mturquette@××××××.org>
18464 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
18465 -Signed-off-by: Mike Pagano <mpagano@g.o>
18466 ----
18467 - drivers/clk/qcom/gcc-ipq806x.c | 2 +-
18468 - 1 file changed, 1 insertion(+), 1 deletion(-)
18469 -
18470 -diff --git a/drivers/clk/qcom/gcc-ipq806x.c b/drivers/clk/qcom/gcc-ipq806x.c
18471 -index cbdc31d..a015bb0 100644
18472 ---- a/drivers/clk/qcom/gcc-ipq806x.c
18473 -+++ b/drivers/clk/qcom/gcc-ipq806x.c
18474 -@@ -525,8 +525,8 @@ static struct freq_tbl clk_tbl_gsbi_qup[] = {
18475 - { 10800000, P_PXO, 1, 2, 5 },
18476 - { 15060000, P_PLL8, 1, 2, 51 },
18477 - { 24000000, P_PLL8, 4, 1, 4 },
18478 -+ { 25000000, P_PXO, 1, 0, 0 },
18479 - { 25600000, P_PLL8, 1, 1, 15 },
18480 -- { 27000000, P_PXO, 1, 0, 0 },
18481 - { 48000000, P_PLL8, 4, 1, 2 },
18482 - { 51200000, P_PLL8, 1, 2, 15 },
18483 - { }
18484 ---
18485 -2.3.6
18486 -
18487 -
18488 -From 6761ec536ade4be25c5b846e71f96c8ecdc08347 Mon Sep 17 00:00:00 2001
18489 -From: Stephen Boyd <sboyd@××××××××××.org>
18490 -Date: Fri, 6 Mar 2015 15:41:53 -0800
18491 -Subject: [PATCH 165/219] clk: qcom: Properly change rates for ahbix clock
18492 -Cc: mpagano@g.o
18493 -
18494 -commit 9d3745d44a7faa7d24db7facb1949a1378162f3e upstream.
18495 -
18496 -The ahbix clock can never be turned off in practice. To change the
18497 -rates we need to switch the mux off the M/N counter to an always on
18498 -source (XO), reprogram the M/N counter to get the rate we want and
18499 -finally switch back to the M/N counter. Add a new ops structure
18500 -for this type of clock so that we can set the rate properly.
18501 -
18502 -Fixes: c99e515a92e9 "clk: qcom: Add IPQ806X LPASS clock controller (LCC) driver"
18503 -Tested-by: Kenneth Westfield <kwestfie@××××××××××.org>
18504 -Signed-off-by: Stephen Boyd <sboyd@××××××××××.org>
18505 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
18506 -Signed-off-by: Mike Pagano <mpagano@g.o>
18507 ----
18508 - drivers/clk/qcom/clk-rcg.c | 62 ++++++++++++++++++++++++++++++++++++++++++
18509 - drivers/clk/qcom/clk-rcg.h | 1 +
18510 - drivers/clk/qcom/lcc-ipq806x.c | 5 ++--
18511 - 3 files changed, 65 insertions(+), 3 deletions(-)
18512 -
18513 -diff --git a/drivers/clk/qcom/clk-rcg.c b/drivers/clk/qcom/clk-rcg.c
18514 -index 0039bd7..466f30c 100644
18515 ---- a/drivers/clk/qcom/clk-rcg.c
18516 -+++ b/drivers/clk/qcom/clk-rcg.c
18517 -@@ -495,6 +495,57 @@ static int clk_rcg_bypass_set_rate(struct clk_hw *hw, unsigned long rate,
18518 - return __clk_rcg_set_rate(rcg, rcg->freq_tbl);
18519 + hprt0 = dwc2_read_hprt0(hsotg);
18520 + hprt0 |= HPRT0_RES;
18521 +diff --git a/drivers/usb/gadget/legacy/printer.c b/drivers/usb/gadget/legacy/printer.c
18522 +index 9054598..6385c19 100644
18523 +--- a/drivers/usb/gadget/legacy/printer.c
18524 ++++ b/drivers/usb/gadget/legacy/printer.c
18525 +@@ -1031,6 +1031,15 @@ unknown:
18526 + break;
18527 + }
18528 + /* host either stalls (value < 0) or reports success */
18529 ++ if (value >= 0) {
18530 ++ req->length = value;
18531 ++ req->zero = value < wLength;
18532 ++ value = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
18533 ++ if (value < 0) {
18534 ++ ERROR(dev, "%s:%d Error!\n", __func__, __LINE__);
18535 ++ req->status = 0;
18536 ++ }
18537 ++ }
18538 + return value;
18539 }
18540
18541 -+/*
18542 -+ * This type of clock has a glitch-free mux that switches between the output of
18543 -+ * the M/N counter and an always on clock source (XO). When clk_set_rate() is
18544 -+ * called we need to make sure that we don't switch to the M/N counter if it
18545 -+ * isn't clocking because the mux will get stuck and the clock will stop
18546 -+ * outputting a clock. This can happen if the framework isn't aware that this
18547 -+ * clock is on and so clk_set_rate() doesn't turn on the new parent. To fix
18548 -+ * this we switch the mux in the enable/disable ops and reprogram the M/N
18549 -+ * counter in the set_rate op. We also make sure to switch away from the M/N
18550 -+ * counter in set_rate if software thinks the clock is off.
18551 -+ */
18552 -+static int clk_rcg_lcc_set_rate(struct clk_hw *hw, unsigned long rate,
18553 -+ unsigned long parent_rate)
18554 -+{
18555 -+ struct clk_rcg *rcg = to_clk_rcg(hw);
18556 -+ const struct freq_tbl *f;
18557 -+ int ret;
18558 -+ u32 gfm = BIT(10);
18559 -+
18560 -+ f = qcom_find_freq(rcg->freq_tbl, rate);
18561 -+ if (!f)
18562 -+ return -EINVAL;
18563 -+
18564 -+ /* Switch to XO to avoid glitches */
18565 -+ regmap_update_bits(rcg->clkr.regmap, rcg->ns_reg, gfm, 0);
18566 -+ ret = __clk_rcg_set_rate(rcg, f);
18567 -+ /* Switch back to M/N if it's clocking */
18568 -+ if (__clk_is_enabled(hw->clk))
18569 -+ regmap_update_bits(rcg->clkr.regmap, rcg->ns_reg, gfm, gfm);
18570 -+
18571 -+ return ret;
18572 -+}
18573 -+
18574 -+static int clk_rcg_lcc_enable(struct clk_hw *hw)
18575 -+{
18576 -+ struct clk_rcg *rcg = to_clk_rcg(hw);
18577 -+ u32 gfm = BIT(10);
18578 -+
18579 -+ /* Use M/N */
18580 -+ return regmap_update_bits(rcg->clkr.regmap, rcg->ns_reg, gfm, gfm);
18581 -+}
18582 -+
18583 -+static void clk_rcg_lcc_disable(struct clk_hw *hw)
18584 -+{
18585 -+ struct clk_rcg *rcg = to_clk_rcg(hw);
18586 -+ u32 gfm = BIT(10);
18587 -+
18588 -+ /* Use XO */
18589 -+ regmap_update_bits(rcg->clkr.regmap, rcg->ns_reg, gfm, 0);
18590 -+}
18591 -+
18592 - static int __clk_dyn_rcg_set_rate(struct clk_hw *hw, unsigned long rate)
18593 - {
18594 - struct clk_dyn_rcg *rcg = to_clk_dyn_rcg(hw);
18595 -@@ -543,6 +594,17 @@ const struct clk_ops clk_rcg_bypass_ops = {
18596 - };
18597 - EXPORT_SYMBOL_GPL(clk_rcg_bypass_ops);
18598 -
18599 -+const struct clk_ops clk_rcg_lcc_ops = {
18600 -+ .enable = clk_rcg_lcc_enable,
18601 -+ .disable = clk_rcg_lcc_disable,
18602 -+ .get_parent = clk_rcg_get_parent,
18603 -+ .set_parent = clk_rcg_set_parent,
18604 -+ .recalc_rate = clk_rcg_recalc_rate,
18605 -+ .determine_rate = clk_rcg_determine_rate,
18606 -+ .set_rate = clk_rcg_lcc_set_rate,
18607 -+};
18608 -+EXPORT_SYMBOL_GPL(clk_rcg_lcc_ops);
18609 -+
18610 - const struct clk_ops clk_dyn_rcg_ops = {
18611 - .enable = clk_enable_regmap,
18612 - .is_enabled = clk_is_enabled_regmap,
18613 -diff --git a/drivers/clk/qcom/clk-rcg.h b/drivers/clk/qcom/clk-rcg.h
18614 -index 687e41f..d09d06b 100644
18615 ---- a/drivers/clk/qcom/clk-rcg.h
18616 -+++ b/drivers/clk/qcom/clk-rcg.h
18617 -@@ -96,6 +96,7 @@ struct clk_rcg {
18618 -
18619 - extern const struct clk_ops clk_rcg_ops;
18620 - extern const struct clk_ops clk_rcg_bypass_ops;
18621 -+extern const struct clk_ops clk_rcg_lcc_ops;
18622 +diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
18623 +index 85e56d1..f4d88df 100644
18624 +--- a/drivers/usb/host/ehci-hcd.c
18625 ++++ b/drivers/usb/host/ehci-hcd.c
18626 +@@ -792,12 +792,12 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
18627 + ehci->reset_done[i] == 0))
18628 + continue;
18629
18630 - #define to_clk_rcg(_hw) container_of(to_clk_regmap(_hw), struct clk_rcg, clkr)
18631 +- /* start 20 msec resume signaling from this port,
18632 +- * and make hub_wq collect PORT_STAT_C_SUSPEND to
18633 +- * stop that signaling. Use 5 ms extra for safety,
18634 +- * like usb_port_resume() does.
18635 ++ /* start USB_RESUME_TIMEOUT msec resume signaling from
18636 ++ * this port, and make hub_wq collect
18637 ++ * PORT_STAT_C_SUSPEND to stop that signaling.
18638 + */
18639 +- ehci->reset_done[i] = jiffies + msecs_to_jiffies(25);
18640 ++ ehci->reset_done[i] = jiffies +
18641 ++ msecs_to_jiffies(USB_RESUME_TIMEOUT);
18642 + set_bit(i, &ehci->resuming_ports);
18643 + ehci_dbg (ehci, "port %d remote wakeup\n", i + 1);
18644 + usb_hcd_start_port_resume(&hcd->self, i);
18645 +diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
18646 +index 87cf86f..7354d01 100644
18647 +--- a/drivers/usb/host/ehci-hub.c
18648 ++++ b/drivers/usb/host/ehci-hub.c
18649 +@@ -471,10 +471,13 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
18650 + ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
18651 + }
18652
18653 -diff --git a/drivers/clk/qcom/lcc-ipq806x.c b/drivers/clk/qcom/lcc-ipq806x.c
18654 -index c9ff27b..19378b0 100644
18655 ---- a/drivers/clk/qcom/lcc-ipq806x.c
18656 -+++ b/drivers/clk/qcom/lcc-ipq806x.c
18657 -@@ -386,13 +386,12 @@ static struct clk_rcg ahbix_clk = {
18658 - .freq_tbl = clk_tbl_ahbix,
18659 - .clkr = {
18660 - .enable_reg = 0x38,
18661 -- .enable_mask = BIT(10), /* toggle the gfmux to select mn/pxo */
18662 -+ .enable_mask = BIT(11),
18663 - .hw.init = &(struct clk_init_data){
18664 - .name = "ahbix",
18665 - .parent_names = lcc_pxo_pll4,
18666 - .num_parents = 2,
18667 -- .ops = &clk_rcg_ops,
18668 -- .flags = CLK_SET_RATE_GATE,
18669 -+ .ops = &clk_rcg_lcc_ops,
18670 - },
18671 - },
18672 - };
18673 ---
18674 -2.3.6
18675 -
18676 -
18677 -From 0602addf5fe488d8ced792e6a8f7da073516d33b Mon Sep 17 00:00:00 2001
18678 -From: Archit Taneja <architt@××××××××××.org>
18679 -Date: Wed, 4 Mar 2015 15:19:35 +0530
18680 -Subject: [PATCH 166/219] clk: qcom: fix RCG M/N counter configuration
18681 -Cc: mpagano@g.o
18682 -
18683 -commit 0b21503dbbfa669dbd847b33578d4041513cddb2 upstream.
18684 -
18685 -Currently, a RCG's M/N counter (used for fraction division) is
18686 -set to either 'bypass' (counter disabled) or 'dual edge' (counter
18687 -enabled) based on whether the corresponding rcg struct has a mnd
18688 -field specified and a non-zero N.
18689 -
18690 -In the case where M and N are the same value, the M/N counter is
18691 -still enabled by code even though no division takes place.
18692 -Leaving the RCG in such a state can result in improper behavior.
18693 -This was observed with the DSI pixel clock RCG when M and N were
18694 -both set to 1.
18695 -
18696 -Add an additional check (M != N) to enable the M/N counter only
18697 -when it's needed for fraction division.
18698 -
18699 -Signed-off-by: Archit Taneja <architt@××××××××××.org>
18700 -Fixes: bcd61c0f535a (clk: qcom: Add support for root clock
18701 -generators (RCGs))
18702 -Signed-off-by: Stephen Boyd <sboyd@××××××××××.org>
18703 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
18704 -
18705 -Signed-off-by: Mike Pagano <mpagano@g.o>
18706 ----
18707 - drivers/clk/qcom/clk-rcg2.c | 2 +-
18708 - 1 file changed, 1 insertion(+), 1 deletion(-)
18709 -
18710 -diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c
18711 -index 742acfa..381f274 100644
18712 ---- a/drivers/clk/qcom/clk-rcg2.c
18713 -+++ b/drivers/clk/qcom/clk-rcg2.c
18714 -@@ -243,7 +243,7 @@ static int clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f)
18715 - mask |= CFG_SRC_SEL_MASK | CFG_MODE_MASK;
18716 - cfg = f->pre_div << CFG_SRC_DIV_SHIFT;
18717 - cfg |= rcg->parent_map[f->src] << CFG_SRC_SEL_SHIFT;
18718 -- if (rcg->mnd_width && f->n)
18719 -+ if (rcg->mnd_width && f->n && (f->m != f->n))
18720 - cfg |= CFG_MODE_DUAL_EDGE;
18721 - ret = regmap_update_bits(rcg->clkr.regmap,
18722 - rcg->cmd_rcgr + CFG_REG, mask, cfg);
18723 ---
18724 -2.3.6
18725 -
18726 -
18727 -From ea8ae530984cacf55cebc6a12bc43061f1dd41ed Mon Sep 17 00:00:00 2001
18728 -From: Stephen Boyd <sboyd@××××××××××.org>
18729 -Date: Thu, 26 Feb 2015 19:34:35 -0800
18730 -Subject: [PATCH 167/219] clk: qcom: Fix ipq806x LCC frequency tables
18731 -Cc: mpagano@g.o
18732 -
18733 -commit b3261d768bcdd4b368179ed85becf38c95461848 upstream.
18734 -
18735 -These frequency tables list the wrong rates. Either they don't
18736 -have the correct frequency at all, or they're specified in kHz
18737 -instead of Hz. Fix it.
18738 -
18739 -Fixes: c99e515a92e9 "clk: qcom: Add IPQ806X LPASS clock controller (LCC) driver"
18740 -Tested-by: Kenneth Westfield <kwestfie@××××××××××.org>
18741 -Signed-off-by: Stephen Boyd <sboyd@××××××××××.org>
18742 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
18743 -Signed-off-by: Mike Pagano <mpagano@g.o>
18744 ----
18745 - drivers/clk/qcom/lcc-ipq806x.c | 18 +++++++++---------
18746 - 1 file changed, 9 insertions(+), 9 deletions(-)
18747 -
18748 -diff --git a/drivers/clk/qcom/lcc-ipq806x.c b/drivers/clk/qcom/lcc-ipq806x.c
18749 -index 19378b0..a6d3a67 100644
18750 ---- a/drivers/clk/qcom/lcc-ipq806x.c
18751 -+++ b/drivers/clk/qcom/lcc-ipq806x.c
18752 -@@ -294,14 +294,14 @@ static struct clk_regmap_mux pcm_clk = {
18753 - };
18754 +- /* msleep for 20ms only if code is trying to resume port */
18755 ++ /*
18756 ++ * msleep for USB_RESUME_TIMEOUT ms only if code is trying to resume
18757 ++ * port
18758 ++ */
18759 + if (resume_needed) {
18760 + spin_unlock_irq(&ehci->lock);
18761 +- msleep(20);
18762 ++ msleep(USB_RESUME_TIMEOUT);
18763 + spin_lock_irq(&ehci->lock);
18764 + if (ehci->shutdown)
18765 + goto shutdown;
18766 +@@ -942,7 +945,7 @@ int ehci_hub_control(
18767 + temp &= ~PORT_WAKE_BITS;
18768 + ehci_writel(ehci, temp | PORT_RESUME, status_reg);
18769 + ehci->reset_done[wIndex] = jiffies
18770 +- + msecs_to_jiffies(20);
18771 ++ + msecs_to_jiffies(USB_RESUME_TIMEOUT);
18772 + set_bit(wIndex, &ehci->resuming_ports);
18773 + usb_hcd_start_port_resume(&hcd->self, wIndex);
18774 + break;
18775 +diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
18776 +index 475b21f..7a6681f 100644
18777 +--- a/drivers/usb/host/fotg210-hcd.c
18778 ++++ b/drivers/usb/host/fotg210-hcd.c
18779 +@@ -1595,7 +1595,7 @@ static int fotg210_hub_control(
18780 + /* resume signaling for 20 msec */
18781 + fotg210_writel(fotg210, temp | PORT_RESUME, status_reg);
18782 + fotg210->reset_done[wIndex] = jiffies
18783 +- + msecs_to_jiffies(20);
18784 ++ + msecs_to_jiffies(USB_RESUME_TIMEOUT);
18785 + break;
18786 + case USB_PORT_FEAT_C_SUSPEND:
18787 + clear_bit(wIndex, &fotg210->port_c_suspend);
18788 +diff --git a/drivers/usb/host/fusbh200-hcd.c b/drivers/usb/host/fusbh200-hcd.c
18789 +index a83eefe..ba77e2e 100644
18790 +--- a/drivers/usb/host/fusbh200-hcd.c
18791 ++++ b/drivers/usb/host/fusbh200-hcd.c
18792 +@@ -1550,10 +1550,9 @@ static int fusbh200_hub_control (
18793 + if ((temp & PORT_PE) == 0)
18794 + goto error;
18795
18796 - static struct freq_tbl clk_tbl_aif_osr[] = {
18797 -- { 22050, P_PLL4, 1, 147, 20480 },
18798 -- { 32000, P_PLL4, 1, 1, 96 },
18799 -- { 44100, P_PLL4, 1, 147, 10240 },
18800 -- { 48000, P_PLL4, 1, 1, 64 },
18801 -- { 88200, P_PLL4, 1, 147, 5120 },
18802 -- { 96000, P_PLL4, 1, 1, 32 },
18803 -- { 176400, P_PLL4, 1, 147, 2560 },
18804 -- { 192000, P_PLL4, 1, 1, 16 },
18805 -+ { 2822400, P_PLL4, 1, 147, 20480 },
18806 -+ { 4096000, P_PLL4, 1, 1, 96 },
18807 -+ { 5644800, P_PLL4, 1, 147, 10240 },
18808 -+ { 6144000, P_PLL4, 1, 1, 64 },
18809 -+ { 11289600, P_PLL4, 1, 147, 5120 },
18810 -+ { 12288000, P_PLL4, 1, 1, 32 },
18811 -+ { 22579200, P_PLL4, 1, 147, 2560 },
18812 -+ { 24576000, P_PLL4, 1, 1, 16 },
18813 - { },
18814 - };
18815 +- /* resume signaling for 20 msec */
18816 + fusbh200_writel(fusbh200, temp | PORT_RESUME, status_reg);
18817 + fusbh200->reset_done[wIndex] = jiffies
18818 +- + msecs_to_jiffies(20);
18819 ++ + msecs_to_jiffies(USB_RESUME_TIMEOUT);
18820 + break;
18821 + case USB_PORT_FEAT_C_SUSPEND:
18822 + clear_bit(wIndex, &fusbh200->port_c_suspend);
18823 +diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
18824 +index 113d0cc..9ef5644 100644
18825 +--- a/drivers/usb/host/isp116x-hcd.c
18826 ++++ b/drivers/usb/host/isp116x-hcd.c
18827 +@@ -1490,7 +1490,7 @@ static int isp116x_bus_resume(struct usb_hcd *hcd)
18828 + spin_unlock_irq(&isp116x->lock);
18829
18830 -@@ -360,7 +360,7 @@ static struct clk_branch spdif_clk = {
18831 - };
18832 + hcd->state = HC_STATE_RESUMING;
18833 +- msleep(20);
18834 ++ msleep(USB_RESUME_TIMEOUT);
18835
18836 - static struct freq_tbl clk_tbl_ahbix[] = {
18837 -- { 131072, P_PLL4, 1, 1, 3 },
18838 -+ { 131072000, P_PLL4, 1, 1, 3 },
18839 - { },
18840 - };
18841 + /* Go operational */
18842 + spin_lock_irq(&isp116x->lock);
18843 +diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
18844 +index ef7efb2..28a2866 100644
18845 +--- a/drivers/usb/host/oxu210hp-hcd.c
18846 ++++ b/drivers/usb/host/oxu210hp-hcd.c
18847 +@@ -2500,11 +2500,12 @@ static irqreturn_t oxu210_hcd_irq(struct usb_hcd *hcd)
18848 + || oxu->reset_done[i] != 0)
18849 + continue;
18850
18851 ---
18852 -2.3.6
18853 -
18854 -
18855 -From b1c9b99dda6dfe49023214a772ff59debfaa6824 Mon Sep 17 00:00:00 2001
18856 -From: Ben Collins <ben.c@××××××××.com>
18857 -Date: Fri, 3 Apr 2015 16:09:46 +0000
18858 -Subject: [PATCH 168/219] dm crypt: fix deadlock when async crypto algorithm
18859 - returns -EBUSY
18860 -Cc: mpagano@g.o
18861 -
18862 -commit 0618764cb25f6fa9fb31152995de42a8a0496475 upstream.
18863 -
18864 -I suspect this doesn't show up for most anyone because software
18865 -algorithms typically don't have a sense of being too busy. However,
18866 -when working with the Freescale CAAM driver it will return -EBUSY on
18867 -occasion under heavy -- which resulted in dm-crypt deadlock.
18868 -
18869 -After checking the logic in some other drivers, the scheme for
18870 -crypt_convert() and it's callback, kcryptd_async_done(), were not
18871 -correctly laid out to properly handle -EBUSY or -EINPROGRESS.
18872 -
18873 -Fix this by using the completion for both -EBUSY and -EINPROGRESS. Now
18874 -crypt_convert()'s use of completion is comparable to
18875 -af_alg_wait_for_completion(). Similarly, kcryptd_async_done() follows
18876 -the pattern used in af_alg_complete().
18877 -
18878 -Before this fix dm-crypt would lockup within 1-2 minutes running with
18879 -the CAAM driver. Fix was regression tested against software algorithms
18880 -on PPC32 and x86_64, and things seem perfectly happy there as well.
18881 -
18882 -Signed-off-by: Ben Collins <ben.c@××××××××.com>
18883 -Signed-off-by: Mike Snitzer <snitzer@××××××.com>
18884 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
18885 -Signed-off-by: Mike Pagano <mpagano@g.o>
18886 ----
18887 - drivers/md/dm-crypt.c | 12 ++++++------
18888 - 1 file changed, 6 insertions(+), 6 deletions(-)
18889 -
18890 -diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
18891 -index 713a962..41473929 100644
18892 ---- a/drivers/md/dm-crypt.c
18893 -+++ b/drivers/md/dm-crypt.c
18894 -@@ -925,11 +925,10 @@ static int crypt_convert(struct crypt_config *cc,
18895 +- /* start 20 msec resume signaling from this port,
18896 +- * and make hub_wq collect PORT_STAT_C_SUSPEND to
18897 ++ /* start USB_RESUME_TIMEOUT resume signaling from this
18898 ++ * port, and make hub_wq collect PORT_STAT_C_SUSPEND to
18899 + * stop that signaling.
18900 + */
18901 +- oxu->reset_done[i] = jiffies + msecs_to_jiffies(20);
18902 ++ oxu->reset_done[i] = jiffies +
18903 ++ msecs_to_jiffies(USB_RESUME_TIMEOUT);
18904 + oxu_dbg(oxu, "port %d remote wakeup\n", i + 1);
18905 + mod_timer(&hcd->rh_timer, oxu->reset_done[i]);
18906 + }
18907 +diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
18908 +index bdc82fe..54a4170 100644
18909 +--- a/drivers/usb/host/r8a66597-hcd.c
18910 ++++ b/drivers/usb/host/r8a66597-hcd.c
18911 +@@ -2301,7 +2301,7 @@ static int r8a66597_bus_resume(struct usb_hcd *hcd)
18912 + rh->port &= ~USB_PORT_STAT_SUSPEND;
18913 + rh->port |= USB_PORT_STAT_C_SUSPEND << 16;
18914 + r8a66597_mdfy(r8a66597, RESUME, RESUME | UACT, dvstctr_reg);
18915 +- msleep(50);
18916 ++ msleep(USB_RESUME_TIMEOUT);
18917 + r8a66597_mdfy(r8a66597, UACT, RESUME | UACT, dvstctr_reg);
18918 + }
18919
18920 - switch (r) {
18921 - /* async */
18922 -+ case -EINPROGRESS:
18923 - case -EBUSY:
18924 - wait_for_completion(&ctx->restart);
18925 - reinit_completion(&ctx->restart);
18926 -- /* fall through*/
18927 -- case -EINPROGRESS:
18928 - ctx->req = NULL;
18929 - ctx->cc_sector++;
18930 - continue;
18931 -@@ -1346,10 +1345,8 @@ static void kcryptd_async_done(struct crypto_async_request *async_req,
18932 - struct dm_crypt_io *io = container_of(ctx, struct dm_crypt_io, ctx);
18933 - struct crypt_config *cc = io->cc;
18934 +diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
18935 +index 4f4ba1e..9118cd8 100644
18936 +--- a/drivers/usb/host/sl811-hcd.c
18937 ++++ b/drivers/usb/host/sl811-hcd.c
18938 +@@ -1259,7 +1259,7 @@ sl811h_hub_control(
18939 + sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1);
18940
18941 -- if (error == -EINPROGRESS) {
18942 -- complete(&ctx->restart);
18943 -+ if (error == -EINPROGRESS)
18944 - return;
18945 -- }
18946 + mod_timer(&sl811->timer, jiffies
18947 +- + msecs_to_jiffies(20));
18948 ++ + msecs_to_jiffies(USB_RESUME_TIMEOUT));
18949 + break;
18950 + case USB_PORT_FEAT_POWER:
18951 + port_power(sl811, 0);
18952 +diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c
18953 +index 19ba5ea..7b3d1af 100644
18954 +--- a/drivers/usb/host/uhci-hub.c
18955 ++++ b/drivers/usb/host/uhci-hub.c
18956 +@@ -166,7 +166,7 @@ static void uhci_check_ports(struct uhci_hcd *uhci)
18957 + /* Port received a wakeup request */
18958 + set_bit(port, &uhci->resuming_ports);
18959 + uhci->ports_timeout = jiffies +
18960 +- msecs_to_jiffies(25);
18961 ++ msecs_to_jiffies(USB_RESUME_TIMEOUT);
18962 + usb_hcd_start_port_resume(
18963 + &uhci_to_hcd(uhci)->self, port);
18964
18965 - if (!error && cc->iv_gen_ops && cc->iv_gen_ops->post)
18966 - error = cc->iv_gen_ops->post(cc, iv_of_dmreq(cc, dmreq), dmreq);
18967 -@@ -1360,12 +1357,15 @@ static void kcryptd_async_done(struct crypto_async_request *async_req,
18968 - crypt_free_req(cc, req_of_dmreq(cc, dmreq), io->base_bio);
18969 +@@ -338,7 +338,8 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
18970 + uhci_finish_suspend(uhci, port, port_addr);
18971
18972 - if (!atomic_dec_and_test(&ctx->cc_pending))
18973 -- return;
18974 -+ goto done;
18975 + /* USB v2.0 7.1.7.5 */
18976 +- uhci->ports_timeout = jiffies + msecs_to_jiffies(50);
18977 ++ uhci->ports_timeout = jiffies +
18978 ++ msecs_to_jiffies(USB_RESUME_TIMEOUT);
18979 + break;
18980 + case USB_PORT_FEAT_POWER:
18981 + /* UHCI has no power switching */
18982 +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
18983 +index 73485fa..eeedde8 100644
18984 +--- a/drivers/usb/host/xhci-ring.c
18985 ++++ b/drivers/usb/host/xhci-ring.c
18986 +@@ -1574,7 +1574,7 @@ static void handle_port_status(struct xhci_hcd *xhci,
18987 + } else {
18988 + xhci_dbg(xhci, "resume HS port %d\n", port_id);
18989 + bus_state->resume_done[faked_port_index] = jiffies +
18990 +- msecs_to_jiffies(20);
18991 ++ msecs_to_jiffies(USB_RESUME_TIMEOUT);
18992 + set_bit(faked_port_index, &bus_state->resuming_ports);
18993 + mod_timer(&hcd->rh_timer,
18994 + bus_state->resume_done[faked_port_index]);
18995 +diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c
18996 +index 3cb98b1..7911b6b 100644
18997 +--- a/drivers/usb/isp1760/isp1760-hcd.c
18998 ++++ b/drivers/usb/isp1760/isp1760-hcd.c
18999 +@@ -1869,7 +1869,7 @@ static int isp1760_hub_control(struct usb_hcd *hcd, u16 typeReq,
19000 + reg_write32(hcd->regs, HC_PORTSC1,
19001 + temp | PORT_RESUME);
19002 + priv->reset_done = jiffies +
19003 +- msecs_to_jiffies(20);
19004 ++ msecs_to_jiffies(USB_RESUME_TIMEOUT);
19005 + }
19006 + break;
19007 + case USB_PORT_FEAT_C_SUSPEND:
19008 +diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
19009 +index 067920f..ec0ee3b 100644
19010 +--- a/drivers/usb/musb/musb_core.c
19011 ++++ b/drivers/usb/musb/musb_core.c
19012 +@@ -99,6 +99,7 @@
19013 + #include <linux/platform_device.h>
19014 + #include <linux/io.h>
19015 + #include <linux/dma-mapping.h>
19016 ++#include <linux/usb.h>
19017
19018 - if (bio_data_dir(io->base_bio) == READ)
19019 - kcryptd_crypt_read_done(io);
19020 - else
19021 - kcryptd_crypt_write_io_submit(io, 1);
19022 -+done:
19023 -+ if (!completion_done(&ctx->restart))
19024 -+ complete(&ctx->restart);
19025 - }
19026 + #include "musb_core.h"
19027
19028 - static void kcryptd_crypt(struct work_struct *work)
19029 ---
19030 -2.3.6
19031 -
19032 -
19033 -From 39b991a4765e2f7bd2faa383c66df5237117a8bb Mon Sep 17 00:00:00 2001
19034 -From: Ken Xue <Ken.Xue@×××.com>
19035 -Date: Mon, 9 Mar 2015 17:10:13 +0800
19036 -Subject: [PATCH 169/219] serial: 8250_dw: add support for AMD SOC Carrizo
19037 -Cc: mpagano@g.o
19038 -
19039 -commit 5ef86b74209db33c133b5f18738dd8f3189b63a1 upstream.
19040 -
19041 -Add ACPI identifier for UART on AMD SOC Carrizo.
19042 -
19043 -Signed-off-by: Ken Xue <Ken.Xue@×××.com>
19044 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
19045 -Signed-off-by: Mike Pagano <mpagano@g.o>
19046 ----
19047 - drivers/tty/serial/8250/8250_dw.c | 1 +
19048 - 1 file changed, 1 insertion(+)
19049 -
19050 -diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
19051 -index 6ae5b85..7a80250 100644
19052 ---- a/drivers/tty/serial/8250/8250_dw.c
19053 -+++ b/drivers/tty/serial/8250/8250_dw.c
19054 -@@ -629,6 +629,7 @@ static const struct acpi_device_id dw8250_acpi_match[] = {
19055 - { "80860F0A", 0 },
19056 - { "8086228A", 0 },
19057 - { "APMC0D08", 0},
19058 -+ { "AMD0020", 0 },
19059 - { },
19060 - };
19061 - MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match);
19062 ---
19063 -2.3.6
19064 -
19065 -
19066 -From 8067aec1b07ce3f80c8209eb3589abdf38753ac1 Mon Sep 17 00:00:00 2001
19067 -From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@×××××××××××.de>
19068 -Date: Tue, 24 Feb 2015 11:17:05 +0100
19069 -Subject: [PATCH 170/219] serial: imx: Fix clearing of receiver overrun flag
19070 -MIME-Version: 1.0
19071 -Content-Type: text/plain; charset=UTF-8
19072 -Content-Transfer-Encoding: 8bit
19073 -Cc: mpagano@g.o
19074 -
19075 -commit 91555ce9012557b2d621d7b0b6ec694218a2a9bc upstream.
19076 -
19077 -The writeable bits in the USR2 register are all "write 1 to
19078 -clear" so only write the bits that actually should be cleared.
19079 -
19080 -Fixes: f1f836e4209e ("serial: imx: Add Rx Fifo overrun error message")
19081 -Signed-off-by: Uwe Kleine-König <u.kleine-koenig@×××××××××××.de>
19082 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
19083 -Signed-off-by: Mike Pagano <mpagano@g.o>
19084 ----
19085 - drivers/tty/serial/imx.c | 8 +++-----
19086 - 1 file changed, 3 insertions(+), 5 deletions(-)
19087 -
19088 -diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
19089 -index 0eb29b1..2306191 100644
19090 ---- a/drivers/tty/serial/imx.c
19091 -+++ b/drivers/tty/serial/imx.c
19092 -@@ -818,7 +818,7 @@ static irqreturn_t imx_int(int irq, void *dev_id)
19093 - if (sts2 & USR2_ORE) {
19094 - dev_err(sport->port.dev, "Rx FIFO overrun\n");
19095 - sport->port.icount.overrun++;
19096 -- writel(sts2 | USR2_ORE, sport->port.membase + USR2);
19097 -+ writel(USR2_ORE, sport->port.membase + USR2);
19098 +@@ -562,7 +563,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
19099 + (USB_PORT_STAT_C_SUSPEND << 16)
19100 + | MUSB_PORT_STAT_RESUME;
19101 + musb->rh_timer = jiffies
19102 +- + msecs_to_jiffies(20);
19103 ++ + msecs_to_jiffies(USB_RESUME_TIMEOUT);
19104 + musb->need_finish_resume = 1;
19105 +
19106 + musb->xceiv->otg->state = OTG_STATE_A_HOST;
19107 +@@ -1597,16 +1598,30 @@ irqreturn_t musb_interrupt(struct musb *musb)
19108 + is_host_active(musb) ? "host" : "peripheral",
19109 + musb->int_usb, musb->int_tx, musb->int_rx);
19110 +
19111 +- /* the core can interrupt us for multiple reasons; docs have
19112 +- * a generic interrupt flowchart to follow
19113 ++ /**
19114 ++ * According to Mentor Graphics' documentation, flowchart on page 98,
19115 ++ * IRQ should be handled as follows:
19116 ++ *
19117 ++ * . Resume IRQ
19118 ++ * . Session Request IRQ
19119 ++ * . VBUS Error IRQ
19120 ++ * . Suspend IRQ
19121 ++ * . Connect IRQ
19122 ++ * . Disconnect IRQ
19123 ++ * . Reset/Babble IRQ
19124 ++ * . SOF IRQ (we're not using this one)
19125 ++ * . Endpoint 0 IRQ
19126 ++ * . TX Endpoints
19127 ++ * . RX Endpoints
19128 ++ *
19129 ++ * We will be following that flowchart in order to avoid any problems
19130 ++ * that might arise with internal Finite State Machine.
19131 + */
19132 ++
19133 + if (musb->int_usb)
19134 + retval |= musb_stage0_irq(musb, musb->int_usb,
19135 + devctl);
19136 +
19137 +- /* "stage 1" is handling endpoint irqs */
19138 +-
19139 +- /* handle endpoint 0 first */
19140 + if (musb->int_tx & 1) {
19141 + if (is_host_active(musb))
19142 + retval |= musb_h_ep0_irq(musb);
19143 +@@ -1614,37 +1629,31 @@ irqreturn_t musb_interrupt(struct musb *musb)
19144 + retval |= musb_g_ep0_irq(musb);
19145 + }
19146 +
19147 +- /* RX on endpoints 1-15 */
19148 +- reg = musb->int_rx >> 1;
19149 ++ reg = musb->int_tx >> 1;
19150 + ep_num = 1;
19151 + while (reg) {
19152 + if (reg & 1) {
19153 +- /* musb_ep_select(musb->mregs, ep_num); */
19154 +- /* REVISIT just retval = ep->rx_irq(...) */
19155 + retval = IRQ_HANDLED;
19156 + if (is_host_active(musb))
19157 +- musb_host_rx(musb, ep_num);
19158 ++ musb_host_tx(musb, ep_num);
19159 + else
19160 +- musb_g_rx(musb, ep_num);
19161 ++ musb_g_tx(musb, ep_num);
19162 + }
19163 +-
19164 + reg >>= 1;
19165 + ep_num++;
19166 }
19167
19168 - return IRQ_HANDLED;
19169 -@@ -1181,10 +1181,12 @@ static int imx_startup(struct uart_port *port)
19170 - imx_uart_dma_init(sport);
19171 -
19172 - spin_lock_irqsave(&sport->port.lock, flags);
19173 +- /* TX on endpoints 1-15 */
19174 +- reg = musb->int_tx >> 1;
19175 ++ reg = musb->int_rx >> 1;
19176 + ep_num = 1;
19177 + while (reg) {
19178 + if (reg & 1) {
19179 +- /* musb_ep_select(musb->mregs, ep_num); */
19180 +- /* REVISIT just retval |= ep->tx_irq(...) */
19181 + retval = IRQ_HANDLED;
19182 + if (is_host_active(musb))
19183 +- musb_host_tx(musb, ep_num);
19184 ++ musb_host_rx(musb, ep_num);
19185 + else
19186 +- musb_g_tx(musb, ep_num);
19187 ++ musb_g_rx(musb, ep_num);
19188 + }
19189 +
19190 - /*
19191 - * Finally, clear and enable interrupts
19192 - */
19193 - writel(USR1_RTSD, sport->port.membase + USR1);
19194 -+ writel(USR2_ORE, sport->port.membase + USR2);
19195 -
19196 - if (sport->dma_is_inited && !sport->dma_is_enabled)
19197 - imx_enable_dma(sport);
19198 -@@ -1199,10 +1201,6 @@ static int imx_startup(struct uart_port *port)
19199 + reg >>= 1;
19200 + ep_num++;
19201 + }
19202 +@@ -2463,7 +2472,7 @@ static int musb_resume(struct device *dev)
19203 + if (musb->need_finish_resume) {
19204 + musb->need_finish_resume = 0;
19205 + schedule_delayed_work(&musb->finish_resume_work,
19206 +- msecs_to_jiffies(20));
19207 ++ msecs_to_jiffies(USB_RESUME_TIMEOUT));
19208 + }
19209
19210 - writel(temp, sport->port.membase + UCR1);
19211 + /*
19212 +@@ -2506,7 +2515,7 @@ static int musb_runtime_resume(struct device *dev)
19213 + if (musb->need_finish_resume) {
19214 + musb->need_finish_resume = 0;
19215 + schedule_delayed_work(&musb->finish_resume_work,
19216 +- msecs_to_jiffies(20));
19217 ++ msecs_to_jiffies(USB_RESUME_TIMEOUT));
19218 + }
19219
19220 -- /* Clear any pending ORE flag before enabling interrupt */
19221 -- temp = readl(sport->port.membase + USR2);
19222 -- writel(temp | USR2_ORE, sport->port.membase + USR2);
19223 --
19224 - temp = readl(sport->port.membase + UCR4);
19225 - temp |= UCR4_OREN;
19226 - writel(temp, sport->port.membase + UCR4);
19227 ---
19228 -2.3.6
19229 -
19230 -
19231 -From cc1064fc8f1d71f9c3429e6bdd8129629fc39784 Mon Sep 17 00:00:00 2001
19232 -From: Peter Hurley <peter@××××××××××××××.com>
19233 -Date: Mon, 9 Mar 2015 14:05:01 -0400
19234 -Subject: [PATCH 171/219] serial: 8250: Check UART_SCR is writable
19235 -Cc: mpagano@g.o
19236 -
19237 -commit f01a0bd8921b9d6668d41fae3198970e6318f532 upstream.
19238 -
19239 -Au1x00/RT2800+ doesn't implement the 8250 scratch register (and
19240 -this may be true of other h/w currently supported by the 8250 driver);
19241 -read back the canary value written to the scratch register to enable
19242 -the console h/w restart after resume from system suspend.
19243 -
19244 -Fixes: 4516d50aabedb ("serial: 8250: Use canary to restart console ...")
19245 -Reported-by: Mason <slash.tmp@××××.fr>
19246 -Signed-off-by: Peter Hurley <peter@××××××××××××××.com>
19247 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
19248 -Signed-off-by: Mike Pagano <mpagano@g.o>
19249 ----
19250 - drivers/tty/serial/8250/8250_core.c | 3 ++-
19251 - 1 file changed, 2 insertions(+), 1 deletion(-)
19252 -
19253 -diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
19254 -index deae122..d465ace 100644
19255 ---- a/drivers/tty/serial/8250/8250_core.c
19256 -+++ b/drivers/tty/serial/8250/8250_core.c
19257 -@@ -3444,7 +3444,8 @@ void serial8250_suspend_port(int line)
19258 - port->type != PORT_8250) {
19259 - unsigned char canary = 0xa5;
19260 - serial_out(up, UART_SCR, canary);
19261 -- up->canary = canary;
19262 -+ if (serial_in(up, UART_SCR) == canary)
19263 -+ up->canary = canary;
19264 + return 0;
19265 +diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
19266 +index 294e159..5428ed1 100644
19267 +--- a/drivers/usb/musb/musb_virthub.c
19268 ++++ b/drivers/usb/musb/musb_virthub.c
19269 +@@ -136,7 +136,7 @@ void musb_port_suspend(struct musb *musb, bool do_suspend)
19270 + /* later, GetPortStatus will stop RESUME signaling */
19271 + musb->port1_status |= MUSB_PORT_STAT_RESUME;
19272 + schedule_delayed_work(&musb->finish_resume_work,
19273 +- msecs_to_jiffies(20));
19274 ++ msecs_to_jiffies(USB_RESUME_TIMEOUT));
19275 }
19276 + }
19277
19278 - uart_suspend_port(&serial8250_reg, port);
19279 ---
19280 -2.3.6
19281 -
19282 -
19283 -From 5cd06dd45f7cc5c15517266a61f8051ec16912ff Mon Sep 17 00:00:00 2001
19284 -From: "Martin K. Petersen" <martin.petersen@××××××.com>
19285 -Date: Tue, 14 Apr 2015 16:56:23 -0400
19286 -Subject: [PATCH 172/219] sd: Unregister integrity profile
19287 -Cc: mpagano@g.o
19288 -
19289 -commit e727c42bd55794765c460b7ac2b6cc969f2a9698 upstream.
19290 -
19291 -The new integrity code did not correctly unregister the profile for SD
19292 -disks. Call blk_integrity_unregister() when we release a disk.
19293 -
19294 -Signed-off-by: Martin K. Petersen <martin.petersen@××××××.com>
19295 -Reported-by: Sagi Grimberg <sagig@×××××××××××××××.il>
19296 -Tested-by: Sagi Grimberg <sagig@××××××××.com>
19297 -Signed-off-by: James Bottomley <JBottomley@××××.com>
19298 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
19299 -Signed-off-by: Mike Pagano <mpagano@g.o>
19300 ----
19301 - drivers/scsi/sd.c | 1 +
19302 - 1 file changed, 1 insertion(+)
19303 -
19304 -diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
19305 -index 6b78476..3290a3e 100644
19306 ---- a/drivers/scsi/sd.c
19307 -+++ b/drivers/scsi/sd.c
19308 -@@ -3100,6 +3100,7 @@ static void scsi_disk_release(struct device *dev)
19309 - ida_remove(&sd_index_ida, sdkp->index);
19310 - spin_unlock(&sd_index_lock);
19311 +diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
19312 +index 2f9735b..d1cd6b5 100644
19313 +--- a/drivers/usb/phy/phy.c
19314 ++++ b/drivers/usb/phy/phy.c
19315 +@@ -81,7 +81,9 @@ static void devm_usb_phy_release(struct device *dev, void *res)
19316
19317 -+ blk_integrity_unregister(disk);
19318 - disk->private_data = NULL;
19319 - put_disk(disk);
19320 - put_device(&sdkp->device->sdev_gendev);
19321 ---
19322 -2.3.6
19323 -
19324 -
19325 -From 5c87838eadeb1a63546e36f76917241d8fa6ea52 Mon Sep 17 00:00:00 2001
19326 -From: "Martin K. Petersen" <martin.petersen@××××××.com>
19327 -Date: Tue, 14 Apr 2015 17:11:03 -0400
19328 -Subject: [PATCH 173/219] sd: Fix missing ATO tag check
19329 -Cc: mpagano@g.o
19330 -
19331 -commit e557990e358934fb168d30371c9c0f63e314c6b8 upstream.
19332 -
19333 -3aec2f41a8bae introduced a merge error where we would end up check for
19334 -sdkp instead of sdkp->ATO. Fix this so we register app tag capability
19335 -correctly.
19336 -
19337 -Signed-off-by: Martin K. Petersen <martin.petersen@××××××.com>
19338 -Reviewed-by: Sagi Grimberg <sagig@××××××××.com>
19339 -Signed-off-by: James Bottomley <JBottomley@××××.com>
19340 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
19341 -Signed-off-by: Mike Pagano <mpagano@g.o>
19342 ----
19343 - drivers/scsi/sd_dif.c | 2 +-
19344 - 1 file changed, 1 insertion(+), 1 deletion(-)
19345 -
19346 -diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c
19347 -index 14c7d42..5c06d29 100644
19348 ---- a/drivers/scsi/sd_dif.c
19349 -+++ b/drivers/scsi/sd_dif.c
19350 -@@ -77,7 +77,7 @@ void sd_dif_config_host(struct scsi_disk *sdkp)
19351 + static int devm_usb_phy_match(struct device *dev, void *res, void *match_data)
19352 + {
19353 +- return res == match_data;
19354 ++ struct usb_phy **phy = res;
19355 ++
19356 ++ return *phy == match_data;
19357 + }
19358
19359 - disk->integrity->flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
19360 + /**
19361 +diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
19362 +index 995986b..d925f55 100644
19363 +--- a/fs/binfmt_elf.c
19364 ++++ b/fs/binfmt_elf.c
19365 +@@ -862,6 +862,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
19366 + i < loc->elf_ex.e_phnum; i++, elf_ppnt++) {
19367 + int elf_prot = 0, elf_flags;
19368 + unsigned long k, vaddr;
19369 ++ unsigned long total_size = 0;
19370
19371 -- if (!sdkp)
19372 -+ if (!sdkp->ATO)
19373 - return;
19374 + if (elf_ppnt->p_type != PT_LOAD)
19375 + continue;
19376 +@@ -924,10 +925,16 @@ static int load_elf_binary(struct linux_binprm *bprm)
19377 + #else
19378 + load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr);
19379 + #endif
19380 ++ total_size = total_mapping_size(elf_phdata,
19381 ++ loc->elf_ex.e_phnum);
19382 ++ if (!total_size) {
19383 ++ error = -EINVAL;
19384 ++ goto out_free_dentry;
19385 ++ }
19386 + }
19387
19388 - if (type == SD_DIF_TYPE3_PROTECTION)
19389 ---
19390 -2.3.6
19391 -
19392 -
19393 -From b9b4320c38bf2fadfd9299c36165c46f131200e0 Mon Sep 17 00:00:00 2001
19394 -From: "K. Y. Srinivasan" <kys@×××××××××.com>
19395 -Date: Fri, 27 Feb 2015 11:26:04 -0800
19396 -Subject: [PATCH 174/219] Drivers: hv: vmbus: Fix a bug in the error path in
19397 - vmbus_open()
19398 -Cc: mpagano@g.o
19399 -
19400 -commit 40384e4bbeb9f2651fe9bffc0062d9f31ef625bf upstream.
19401 -
19402 -Correctly rollback state if the failure occurs after we have handed over
19403 -the ownership of the buffer to the host.
19404 -
19405 -Signed-off-by: K. Y. Srinivasan <kys@×××××××××.com>
19406 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
19407 -Signed-off-by: Mike Pagano <mpagano@g.o>
19408 ----
19409 - drivers/hv/channel.c | 7 +++++--
19410 - 1 file changed, 5 insertions(+), 2 deletions(-)
19411 -
19412 -diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
19413 -index 2978f5e..00bc30e 100644
19414 ---- a/drivers/hv/channel.c
19415 -+++ b/drivers/hv/channel.c
19416 -@@ -135,7 +135,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
19417 - GFP_KERNEL);
19418 - if (!open_info) {
19419 - err = -ENOMEM;
19420 -- goto error0;
19421 -+ goto error_gpadl;
19422 + error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt,
19423 +- elf_prot, elf_flags, 0);
19424 ++ elf_prot, elf_flags, total_size);
19425 + if (BAD_ADDR(error)) {
19426 + retval = IS_ERR((void *)error) ?
19427 + PTR_ERR((void*)error) : -EINVAL;
19428 +diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
19429 +index 8b353ad..0a795c9 100644
19430 +--- a/fs/btrfs/extent-tree.c
19431 ++++ b/fs/btrfs/extent-tree.c
19432 +@@ -6956,12 +6956,11 @@ static int __btrfs_free_reserved_extent(struct btrfs_root *root,
19433 + return -ENOSPC;
19434 }
19435
19436 - init_completion(&open_info->waitevent);
19437 -@@ -151,7 +151,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
19438 -
19439 - if (userdatalen > MAX_USER_DEFINED_BYTES) {
19440 - err = -EINVAL;
19441 -- goto error0;
19442 -+ goto error_gpadl;
19443 +- if (btrfs_test_opt(root, DISCARD))
19444 +- ret = btrfs_discard_extent(root, start, len, NULL);
19445 +-
19446 + if (pin)
19447 + pin_down_extent(root, cache, start, len, 1);
19448 + else {
19449 ++ if (btrfs_test_opt(root, DISCARD))
19450 ++ ret = btrfs_discard_extent(root, start, len, NULL);
19451 + btrfs_add_free_space(cache, start, len);
19452 + btrfs_update_reserved_bytes(cache, len, RESERVE_FREE, delalloc);
19453 }
19454 +diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
19455 +index 74609b9..f23d4be 100644
19456 +--- a/fs/btrfs/ioctl.c
19457 ++++ b/fs/btrfs/ioctl.c
19458 +@@ -2897,6 +2897,9 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 len,
19459 + if (src == dst)
19460 + return -EINVAL;
19461
19462 - if (userdatalen)
19463 -@@ -195,6 +195,9 @@ error1:
19464 - list_del(&open_info->msglistentry);
19465 - spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
19466 -
19467 -+error_gpadl:
19468 -+ vmbus_teardown_gpadl(newchannel, newchannel->ringbuffer_gpadlhandle);
19469 ++ if (len == 0)
19470 ++ return 0;
19471 +
19472 - error0:
19473 - free_pages((unsigned long)out,
19474 - get_order(send_ringbuffer_size + recv_ringbuffer_size));
19475 ---
19476 -2.3.6
19477 -
19478 -
19479 -From 1f77a24829ac6dbe9a942752ee15054d403653d9 Mon Sep 17 00:00:00 2001
19480 -From: James Bottomley <JBottomley@××××.com>
19481 -Date: Wed, 15 Apr 2015 22:16:01 -0700
19482 -Subject: [PATCH 175/219] mvsas: fix panic on expander attached SATA devices
19483 -Cc: mpagano@g.o
19484 -
19485 -commit 56cbd0ccc1b508de19561211d7ab9e1c77e6b384 upstream.
19486 -
19487 -mvsas is giving a General protection fault when it encounters an expander
19488 -attached ATA device. Analysis of mvs_task_prep_ata() shows that the driver is
19489 -assuming all ATA devices are locally attached and obtaining the phy mask by
19490 -indexing the local phy table (in the HBA structure) with the phy id. Since
19491 -expanders have many more phys than the HBA, this is causing the index into the
19492 -HBA phy table to overflow and returning rubbish as the pointer.
19493 -
19494 -mvs_task_prep_ssp() instead does the phy mask using the port properties.
19495 -Mirror this in mvs_task_prep_ata() to fix the panic.
19496 -
19497 -Reported-by: Adam Talbot <ajtalbot1@×××××.com>
19498 -Tested-by: Adam Talbot <ajtalbot1@×××××.com>
19499 -Signed-off-by: James Bottomley <JBottomley@××××.com>
19500 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
19501 -Signed-off-by: Mike Pagano <mpagano@g.o>
19502 ----
19503 - drivers/scsi/mvsas/mv_sas.c | 5 +----
19504 - 1 file changed, 1 insertion(+), 4 deletions(-)
19505 -
19506 -diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
19507 -index 2d5ab6d..454536c 100644
19508 ---- a/drivers/scsi/mvsas/mv_sas.c
19509 -+++ b/drivers/scsi/mvsas/mv_sas.c
19510 -@@ -441,14 +441,11 @@ static u32 mvs_get_ncq_tag(struct sas_task *task, u32 *tag)
19511 - static int mvs_task_prep_ata(struct mvs_info *mvi,
19512 - struct mvs_task_exec_info *tei)
19513 - {
19514 -- struct sas_ha_struct *sha = mvi->sas;
19515 - struct sas_task *task = tei->task;
19516 - struct domain_device *dev = task->dev;
19517 - struct mvs_device *mvi_dev = dev->lldd_dev;
19518 - struct mvs_cmd_hdr *hdr = tei->hdr;
19519 - struct asd_sas_port *sas_port = dev->port;
19520 -- struct sas_phy *sphy = dev->phy;
19521 -- struct asd_sas_phy *sas_phy = sha->sas_phy[sphy->number];
19522 - struct mvs_slot_info *slot;
19523 - void *buf_prd;
19524 - u32 tag = tei->tag, hdr_tag;
19525 -@@ -468,7 +465,7 @@ static int mvs_task_prep_ata(struct mvs_info *mvi,
19526 - slot->tx = mvi->tx_prod;
19527 - del_q = TXQ_MODE_I | tag |
19528 - (TXQ_CMD_STP << TXQ_CMD_SHIFT) |
19529 -- (MVS_PHY_ID << TXQ_PHY_SHIFT) |
19530 -+ ((sas_port->phy_mask & TXQ_PHY_MASK) << TXQ_PHY_SHIFT) |
19531 - (mvi_dev->taskfileset << TXQ_SRS_SHIFT);
19532 - mvi->tx[mvi->tx_prod] = cpu_to_le32(del_q);
19533 -
19534 ---
19535 -2.3.6
19536 -
19537 -
19538 -From 287189f739322ef2f2b7698e613c85e7be8c9b9c Mon Sep 17 00:00:00 2001
19539 -From: Sifan Naeem <sifan.naeem@××××××.com>
19540 -Date: Tue, 10 Feb 2015 07:41:56 -0300
19541 -Subject: [PATCH 176/219] rc: img-ir: fix error in parameters passed to
19542 - irq_free()
19543 -Cc: mpagano@g.o
19544 -
19545 -commit 80ccf4ad06dc9d2f06a8347b2d309cdc959f72b3 upstream.
19546 -
19547 -img_ir_remove() passes a pointer to the ISR function as the 2nd
19548 -parameter to irq_free() instead of a pointer to the device data
19549 -structure.
19550 -This issue causes unloading img-ir module to fail with the below
19551 -warning after building and loading img-ir as a module.
19552 -
19553 -WARNING: CPU: 2 PID: 155 at ../kernel/irq/manage.c:1278
19554 -__free_irq+0xb4/0x214() Trying to free already-free IRQ 58
19555 -Modules linked in: img_ir(-)
19556 -CPU: 2 PID: 155 Comm: rmmod Not tainted 3.14.0 #55 ...
19557 -Call Trace:
19558 -...
19559 -[<8048d420>] __free_irq+0xb4/0x214
19560 -[<8048d6b4>] free_irq+0xac/0xf4
19561 -[<c009b130>] img_ir_remove+0x54/0xd4 [img_ir] [<8073ded0>]
19562 -platform_drv_remove+0x30/0x54 ...
19563 -
19564 -Fixes: 160a8f8aec4d ("[media] rc: img-ir: add base driver")
19565 -
19566 -Signed-off-by: Sifan Naeem <sifan.naeem@××××××.com>
19567 -Acked-by: James Hogan <james.hogan@××××××.com>
19568 -Signed-off-by: Mauro Carvalho Chehab <mchehab@×××××××××××.com>
19569 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
19570 -Signed-off-by: Mike Pagano <mpagano@g.o>
19571 ----
19572 - drivers/media/rc/img-ir/img-ir-core.c | 2 +-
19573 - 1 file changed, 1 insertion(+), 1 deletion(-)
19574 -
19575 -diff --git a/drivers/media/rc/img-ir/img-ir-core.c b/drivers/media/rc/img-ir/img-ir-core.c
19576 -index 77c78de..7020659 100644
19577 ---- a/drivers/media/rc/img-ir/img-ir-core.c
19578 -+++ b/drivers/media/rc/img-ir/img-ir-core.c
19579 -@@ -146,7 +146,7 @@ static int img_ir_remove(struct platform_device *pdev)
19580 - {
19581 - struct img_ir_priv *priv = platform_get_drvdata(pdev);
19582 -
19583 -- free_irq(priv->irq, img_ir_isr);
19584 -+ free_irq(priv->irq, priv);
19585 - img_ir_remove_hw(priv);
19586 - img_ir_remove_raw(priv);
19587 + btrfs_double_lock(src, loff, dst, dst_loff, len);
19588
19589 ---
19590 -2.3.6
19591 -
19592 -
19593 -From ecfdbe6a56ddd74036337f651bb2bd933341faa7 Mon Sep 17 00:00:00 2001
19594 -From: Ezequiel Garcia <ezequiel@×××××××××××××××××.ar>
19595 -Date: Tue, 10 Mar 2015 11:37:14 -0300
19596 -Subject: [PATCH 177/219] stk1160: Make sure current buffer is released
19597 -Cc: mpagano@g.o
19598 -
19599 -commit aeff09276748b66072f2db2e668cec955cf41959 upstream.
19600 -
19601 -The available (i.e. not used) buffers are returned by stk1160_clear_queue(),
19602 -on the stop_streaming() path. However, this is insufficient and the current
19603 -buffer must be released as well. Fix it.
19604 -
19605 -Signed-off-by: Ezequiel Garcia <ezequiel@×××××××××××××××××.ar>
19606 -Signed-off-by: Hans Verkuil <hans.verkuil@×××××.com>
19607 -Signed-off-by: Mauro Carvalho Chehab <mchehab@×××××××××××.com>
19608 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
19609 -Signed-off-by: Mike Pagano <mpagano@g.o>
19610 ----
19611 - drivers/media/usb/stk1160/stk1160-v4l.c | 17 +++++++++++++++--
19612 - 1 file changed, 15 insertions(+), 2 deletions(-)
19613 -
19614 -diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c
19615 -index 65a326c..749ad56 100644
19616 ---- a/drivers/media/usb/stk1160/stk1160-v4l.c
19617 -+++ b/drivers/media/usb/stk1160/stk1160-v4l.c
19618 -@@ -240,6 +240,11 @@ static int stk1160_stop_streaming(struct stk1160 *dev)
19619 - if (mutex_lock_interruptible(&dev->v4l_lock))
19620 - return -ERESTARTSYS;
19621 + ret = extent_same_check_offsets(src, loff, len);
19622 +@@ -3626,6 +3629,11 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
19623 + if (off + len == src->i_size)
19624 + len = ALIGN(src->i_size, bs) - off;
19625
19626 ++ if (len == 0) {
19627 ++ ret = 0;
19628 ++ goto out_unlock;
19629 ++ }
19630 ++
19631 + /* verify the end result is block aligned */
19632 + if (!IS_ALIGNED(off, bs) || !IS_ALIGNED(off + len, bs) ||
19633 + !IS_ALIGNED(destoff, bs))
19634 +diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
19635 +index 883b936..45ea704 100644
19636 +--- a/fs/btrfs/xattr.c
19637 ++++ b/fs/btrfs/xattr.c
19638 +@@ -364,22 +364,42 @@ const struct xattr_handler *btrfs_xattr_handlers[] = {
19639 + /*
19640 + * Check if the attribute is in a supported namespace.
19641 + *
19642 +- * This applied after the check for the synthetic attributes in the system
19643 ++ * This is applied after the check for the synthetic attributes in the system
19644 + * namespace.
19645 + */
19646 +-static bool btrfs_is_valid_xattr(const char *name)
19647 ++static int btrfs_is_valid_xattr(const char *name)
19648 + {
19649 +- return !strncmp(name, XATTR_SECURITY_PREFIX,
19650 +- XATTR_SECURITY_PREFIX_LEN) ||
19651 +- !strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) ||
19652 +- !strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) ||
19653 +- !strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) ||
19654 +- !strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN);
19655 ++ int len = strlen(name);
19656 ++ int prefixlen = 0;
19657 ++
19658 ++ if (!strncmp(name, XATTR_SECURITY_PREFIX,
19659 ++ XATTR_SECURITY_PREFIX_LEN))
19660 ++ prefixlen = XATTR_SECURITY_PREFIX_LEN;
19661 ++ else if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
19662 ++ prefixlen = XATTR_SYSTEM_PREFIX_LEN;
19663 ++ else if (!strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN))
19664 ++ prefixlen = XATTR_TRUSTED_PREFIX_LEN;
19665 ++ else if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN))
19666 ++ prefixlen = XATTR_USER_PREFIX_LEN;
19667 ++ else if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN))
19668 ++ prefixlen = XATTR_BTRFS_PREFIX_LEN;
19669 ++ else
19670 ++ return -EOPNOTSUPP;
19671 ++
19672 + /*
19673 -+ * Once URBs are cancelled, the URB complete handler
19674 -+ * won't be running. This is required to safely release the
19675 -+ * current buffer (dev->isoc_ctl.buf).
19676 ++ * The name cannot consist of just prefix
19677 + */
19678 - stk1160_cancel_isoc(dev);
19679 -
19680 - /*
19681 -@@ -620,8 +625,16 @@ void stk1160_clear_queue(struct stk1160 *dev)
19682 - stk1160_info("buffer [%p/%d] aborted\n",
19683 - buf, buf->vb.v4l2_buf.index);
19684 - }
19685 -- /* It's important to clear current buffer */
19686 -- dev->isoc_ctl.buf = NULL;
19687 -+
19688 -+ /* It's important to release the current buffer */
19689 -+ if (dev->isoc_ctl.buf) {
19690 -+ buf = dev->isoc_ctl.buf;
19691 -+ dev->isoc_ctl.buf = NULL;
19692 ++ if (len <= prefixlen)
19693 ++ return -EINVAL;
19694 +
19695 -+ vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
19696 -+ stk1160_info("buffer [%p/%d] aborted\n",
19697 -+ buf, buf->vb.v4l2_buf.index);
19698 -+ }
19699 - spin_unlock_irqrestore(&dev->buf_lock, flags);
19700 ++ return 0;
19701 }
19702
19703 ---
19704 -2.3.6
19705 -
19706 -
19707 -From d9bc10f7ccda1d662f3cd98f0949a03fe27b69e4 Mon Sep 17 00:00:00 2001
19708 -From: Yann Droneaud <ydroneaud@××××××.com>
19709 -Date: Mon, 13 Apr 2015 14:56:22 +0200
19710 -Subject: [PATCH 178/219] IB/core: disallow registering 0-sized memory region
19711 -Cc: mpagano@g.o
19712 -
19713 -commit 8abaae62f3fdead8f4ce0ab46b4ab93dee39bab2 upstream.
19714 -
19715 -If ib_umem_get() is called with a size equal to 0 and an
19716 -non-page aligned address, one page will be pinned and a
19717 -0-sized umem will be returned to the caller.
19718 -
19719 -This should not be allowed: it's not expected for a memory
19720 -region to have a size equal to 0.
19721 -
19722 -This patch adds a check to explicitly refuse to register
19723 -a 0-sized region.
19724 -
19725 -Link: http://mid.gmane.org/cover.1428929103.git.ydroneaud@××××××.com
19726 -Cc: Shachar Raindel <raindel@××××××××.com>
19727 -Cc: Jack Morgenstein <jackm@××××××××.com>
19728 -Cc: Or Gerlitz <ogerlitz@××××××××.com>
19729 -Signed-off-by: Yann Droneaud <ydroneaud@××××××.com>
19730 -Signed-off-by: Doug Ledford <dledford@××××××.com>
19731 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
19732 -Signed-off-by: Mike Pagano <mpagano@g.o>
19733 ----
19734 - drivers/infiniband/core/umem.c | 3 +++
19735 - 1 file changed, 3 insertions(+)
19736 -
19737 -diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
19738 -index 8c014b5..9ac4068 100644
19739 ---- a/drivers/infiniband/core/umem.c
19740 -+++ b/drivers/infiniband/core/umem.c
19741 -@@ -99,6 +99,9 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
19742 - if (dmasync)
19743 - dma_set_attr(DMA_ATTR_WRITE_BARRIER, &attrs);
19744 -
19745 -+ if (!size)
19746 -+ return ERR_PTR(-EINVAL);
19747 + ssize_t btrfs_getxattr(struct dentry *dentry, const char *name,
19748 + void *buffer, size_t size)
19749 + {
19750 ++ int ret;
19751 +
19752 /*
19753 - * If the combination of the addr and size requested for this memory
19754 - * region causes an integer overflow, return error.
19755 ---
19756 -2.3.6
19757 -
19758 -
19759 -From d0ddb13fc24a64a940e8050ea076e59bb04597f4 Mon Sep 17 00:00:00 2001
19760 -From: Yann Droneaud <ydroneaud@××××××.com>
19761 -Date: Mon, 13 Apr 2015 14:56:23 +0200
19762 -Subject: [PATCH 179/219] IB/core: don't disallow registering region starting
19763 - at 0x0
19764 -Cc: mpagano@g.o
19765 -
19766 -commit 66578b0b2f69659f00b6169e6fe7377c4b100d18 upstream.
19767 -
19768 -In a call to ib_umem_get(), if address is 0x0 and size is
19769 -already page aligned, check added in commit 8494057ab5e4
19770 -("IB/uverbs: Prevent integer overflow in ib_umem_get address
19771 -arithmetic") will refuse to register a memory region that
19772 -could otherwise be valid (provided vm.mmap_min_addr sysctl
19773 -and mmap_low_allowed SELinux knobs allow userspace to map
19774 -something at address 0x0).
19775 -
19776 -This patch allows back such registration: ib_umem_get()
19777 -should probably don't care of the base address provided it
19778 -can be pinned with get_user_pages().
19779 -
19780 -There's two possible overflows, in (addr + size) and in
19781 -PAGE_ALIGN(addr + size), this patch keep ensuring none
19782 -of them happen while allowing to pin memory at address
19783 -0x0. Anyway, the case of size equal 0 is no more (partially)
19784 -handled as 0-length memory region are disallowed by an
19785 -earlier check.
19786 -
19787 -Link: http://mid.gmane.org/cover.1428929103.git.ydroneaud@××××××.com
19788 -Cc: Shachar Raindel <raindel@××××××××.com>
19789 -Cc: Jack Morgenstein <jackm@××××××××.com>
19790 -Cc: Or Gerlitz <ogerlitz@××××××××.com>
19791 -Signed-off-by: Yann Droneaud <ydroneaud@××××××.com>
19792 -Reviewed-by: Sagi Grimberg <sagig@××××××××.com>
19793 -Reviewed-by: Haggai Eran <haggaie@××××××××.com>
19794 -Signed-off-by: Doug Ledford <dledford@××××××.com>
19795 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
19796 -Signed-off-by: Mike Pagano <mpagano@g.o>
19797 ----
19798 - drivers/infiniband/core/umem.c | 4 ++--
19799 - 1 file changed, 2 insertions(+), 2 deletions(-)
19800 -
19801 -diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
19802 -index 9ac4068..38acb3c 100644
19803 ---- a/drivers/infiniband/core/umem.c
19804 -+++ b/drivers/infiniband/core/umem.c
19805 -@@ -106,8 +106,8 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
19806 - * If the combination of the addr and size requested for this memory
19807 - * region causes an integer overflow, return error.
19808 - */
19809 -- if ((PAGE_ALIGN(addr + size) <= size) ||
19810 -- (PAGE_ALIGN(addr + size) <= addr))
19811 -+ if (((addr + size) < addr) ||
19812 -+ PAGE_ALIGN(addr + size) < (addr + size))
19813 - return ERR_PTR(-EINVAL);
19814 -
19815 - if (!can_do_mlock())
19816 ---
19817 -2.3.6
19818 -
19819 -
19820 -From 7fc80a4ea6d5b307470a6bb165b293e334b22c20 Mon Sep 17 00:00:00 2001
19821 -From: Erez Shitrit <erezsh@××××××××.com>
19822 -Date: Thu, 2 Apr 2015 13:39:05 +0300
19823 -Subject: [PATCH 180/219] IB/mlx4: Fix WQE LSO segment calculation
19824 -Cc: mpagano@g.o
19825 -
19826 -commit ca9b590caa17bcbbea119594992666e96cde9c2f upstream.
19827 -
19828 -The current code decreases from the mss size (which is the gso_size
19829 -from the kernel skb) the size of the packet headers.
19830 -
19831 -It shouldn't do that because the mss that comes from the stack
19832 -(e.g IPoIB) includes only the tcp payload without the headers.
19833 -
19834 -The result is indication to the HW that each packet that the HW sends
19835 -is smaller than what it could be, and too many packets will be sent
19836 -for big messages.
19837 -
19838 -An easy way to demonstrate one more aspect of the problem is by
19839 -configuring the ipoib mtu to be less than 2*hlen (2*56) and then
19840 -run app sending big TCP messages. This will tell the HW to send packets
19841 -with giant (negative value which under unsigned arithmetics becomes
19842 -a huge positive one) length and the QP moves to SQE state.
19843 -
19844 -Fixes: b832be1e4007 ('IB/mlx4: Add IPoIB LSO support')
19845 -Reported-by: Matthew Finlay <matt@××××××××.com>
19846 -Signed-off-by: Erez Shitrit <erezsh@××××××××.com>
19847 -Signed-off-by: Or Gerlitz <ogerlitz@××××××××.com>
19848 -Signed-off-by: Doug Ledford <dledford@××××××.com>
19849 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
19850 -Signed-off-by: Mike Pagano <mpagano@g.o>
19851 ----
19852 - drivers/infiniband/hw/mlx4/qp.c | 3 +--
19853 - 1 file changed, 1 insertion(+), 2 deletions(-)
19854 -
19855 -diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
19856 -index ed2bd67..fbde33a 100644
19857 ---- a/drivers/infiniband/hw/mlx4/qp.c
19858 -+++ b/drivers/infiniband/hw/mlx4/qp.c
19859 -@@ -2605,8 +2605,7 @@ static int build_lso_seg(struct mlx4_wqe_lso_seg *wqe, struct ib_send_wr *wr,
19860 -
19861 - memcpy(wqe->header, wr->wr.ud.header, wr->wr.ud.hlen);
19862 + * If this is a request for a synthetic attribute in the system.*
19863 + * namespace use the generic infrastructure to resolve a handler
19864 +@@ -388,8 +408,9 @@ ssize_t btrfs_getxattr(struct dentry *dentry, const char *name,
19865 + if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
19866 + return generic_getxattr(dentry, name, buffer, size);
19867
19868 -- *lso_hdr_sz = cpu_to_be32((wr->wr.ud.mss - wr->wr.ud.hlen) << 16 |
19869 -- wr->wr.ud.hlen);
19870 -+ *lso_hdr_sz = cpu_to_be32(wr->wr.ud.mss << 16 | wr->wr.ud.hlen);
19871 - *lso_seg_len = halign;
19872 - return 0;
19873 +- if (!btrfs_is_valid_xattr(name))
19874 +- return -EOPNOTSUPP;
19875 ++ ret = btrfs_is_valid_xattr(name);
19876 ++ if (ret)
19877 ++ return ret;
19878 + return __btrfs_getxattr(dentry->d_inode, name, buffer, size);
19879 }
19880 ---
19881 -2.3.6
19882 -
19883 -
19884 -From 6fb5785d6c07d834567ccf3f3ba2df9c3803b28b Mon Sep 17 00:00:00 2001
19885 -From: Sagi Grimberg <sagig@××××××××.com>
19886 -Date: Tue, 14 Apr 2015 18:08:13 +0300
19887 -Subject: [PATCH 181/219] IB/iser: Fix wrong calculation of protection buffer
19888 - length
19889 -Cc: mpagano@g.o
19890 -
19891 -commit a065fe6aa25ba6ba93c02dc13486131bb3c64d5f upstream.
19892 -
19893 -This length miss-calculation may cause a silent data corruption
19894 -in the DIX case and cause the device to reference unmapped area.
19895 -
19896 -Fixes: d77e65350f2d ('libiscsi, iser: Adjust data_length to include protection information')
19897 -Signed-off-by: Sagi Grimberg <sagig@××××××××.com>
19898 -Signed-off-by: Doug Ledford <dledford@××××××.com>
19899 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
19900 -Signed-off-by: Mike Pagano <mpagano@g.o>
19901 ----
19902 - drivers/infiniband/ulp/iser/iser_initiator.c | 4 ++--
19903 - 1 file changed, 2 insertions(+), 2 deletions(-)
19904 -
19905 -diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
19906 -index 20e859a..76eb57b 100644
19907 ---- a/drivers/infiniband/ulp/iser/iser_initiator.c
19908 -+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
19909 -@@ -409,8 +409,8 @@ int iser_send_command(struct iscsi_conn *conn,
19910 - if (scsi_prot_sg_count(sc)) {
19911 - prot_buf->buf = scsi_prot_sglist(sc);
19912 - prot_buf->size = scsi_prot_sg_count(sc);
19913 -- prot_buf->data_len = data_buf->data_len >>
19914 -- ilog2(sc->device->sector_size) * 8;
19915 -+ prot_buf->data_len = (data_buf->data_len >>
19916 -+ ilog2(sc->device->sector_size)) * 8;
19917 - }
19918
19919 - if (hdr->flags & ISCSI_FLAG_CMD_READ) {
19920 ---
19921 -2.3.6
19922 -
19923 -
19924 -From c62b024af945d20e01c3e8c416b9e00d137e6f02 Mon Sep 17 00:00:00 2001
19925 -From: Rabin Vincent <rabin@×××.in>
19926 -Date: Mon, 13 Apr 2015 22:30:12 +0200
19927 -Subject: [PATCH 182/219] tracing: Handle ftrace_dump() atomic context in
19928 - graph_trace_open()
19929 -Cc: mpagano@g.o
19930 -
19931 -commit ef99b88b16bee753fa51207abdc58ae660453ec6 upstream.
19932 -
19933 -graph_trace_open() can be called in atomic context from ftrace_dump().
19934 -Use GFP_ATOMIC for the memory allocations when that's the case, in order
19935 -to avoid the following splat.
19936 -
19937 - BUG: sleeping function called from invalid context at mm/slab.c:2849
19938 - in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/0
19939 - Backtrace:
19940 - ..
19941 - [<8004dc94>] (__might_sleep) from [<801371f4>] (kmem_cache_alloc_trace+0x160/0x238)
19942 - r7:87800040 r6:000080d0 r5:810d16e8 r4:000080d0
19943 - [<80137094>] (kmem_cache_alloc_trace) from [<800cbd60>] (graph_trace_open+0x30/0xd0)
19944 - r10:00000100 r9:809171a8 r8:00008e28 r7:810d16f0 r6:00000001 r5:810d16e8
19945 - r4:810d16f0
19946 - [<800cbd30>] (graph_trace_open) from [<800c79c4>] (trace_init_global_iter+0x50/0x9c)
19947 - r8:00008e28 r7:808c853c r6:00000001 r5:810d16e8 r4:810d16f0 r3:800cbd30
19948 - [<800c7974>] (trace_init_global_iter) from [<800c7aa0>] (ftrace_dump+0x90/0x2ec)
19949 - r4:810d2580 r3:00000000
19950 - [<800c7a10>] (ftrace_dump) from [<80414b2c>] (sysrq_ftrace_dump+0x1c/0x20)
19951 - r10:00000100 r9:809171a8 r8:808f6e7c r7:00000001 r6:00000007 r5:0000007a
19952 - r4:808d5394
19953 - [<80414b10>] (sysrq_ftrace_dump) from [<800169b8>] (return_to_handler+0x0/0x18)
19954 - [<80415498>] (__handle_sysrq) from [<800169b8>] (return_to_handler+0x0/0x18)
19955 - r8:808c8100 r7:808c8444 r6:00000101 r5:00000010 r4:84eb3210
19956 - [<80415668>] (handle_sysrq) from [<800169b8>] (return_to_handler+0x0/0x18)
19957 - [<8042a760>] (pl011_int) from [<800169b8>] (return_to_handler+0x0/0x18)
19958 - r10:809171bc r9:809171a8 r8:00000001 r7:00000026 r6:808c6000 r5:84f01e60
19959 - r4:8454fe00
19960 - [<8007782c>] (handle_irq_event_percpu) from [<80077b44>] (handle_irq_event+0x4c/0x6c)
19961 - r10:808c7ef0 r9:87283e00 r8:00000001 r7:00000000 r6:8454fe00 r5:84f01e60
19962 - r4:84f01e00
19963 - [<80077af8>] (handle_irq_event) from [<8007aa28>] (handle_fasteoi_irq+0xf0/0x1ac)
19964 - r6:808f52a4 r5:84f01e60 r4:84f01e00 r3:00000000
19965 - [<8007a938>] (handle_fasteoi_irq) from [<80076dc0>] (generic_handle_irq+0x3c/0x4c)
19966 - r6:00000026 r5:00000000 r4:00000026 r3:8007a938
19967 - [<80076d84>] (generic_handle_irq) from [<80077128>] (__handle_domain_irq+0x8c/0xfc)
19968 - r4:808c1e38 r3:0000002e
19969 - [<8007709c>] (__handle_domain_irq) from [<800087b8>] (gic_handle_irq+0x34/0x6c)
19970 - r10:80917748 r9:00000001 r8:88802100 r7:808c7ef0 r6:808c8fb0 r5:00000015
19971 - r4:8880210c r3:808c7ef0
19972 - [<80008784>] (gic_handle_irq) from [<80014044>] (__irq_svc+0x44/0x7c)
19973 -
19974 -Link: http://lkml.kernel.org/r/1428953721-31349-1-git-send-email-rabin@×××.in
19975 -Link: http://lkml.kernel.org/r/1428957012-2319-1-git-send-email-rabin@×××.in
19976 -
19977 -Signed-off-by: Rabin Vincent <rabin@×××.in>
19978 -Signed-off-by: Steven Rostedt <rostedt@×××××××.org>
19979 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
19980 -Signed-off-by: Mike Pagano <mpagano@g.o>
19981 ----
19982 - kernel/trace/trace_functions_graph.c | 8 ++++++--
19983 - 1 file changed, 6 insertions(+), 2 deletions(-)
19984 -
19985 -diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
19986 -index 2d25ad1..b6fce36 100644
19987 ---- a/kernel/trace/trace_functions_graph.c
19988 -+++ b/kernel/trace/trace_functions_graph.c
19989 -@@ -1309,15 +1309,19 @@ void graph_trace_open(struct trace_iterator *iter)
19990 +@@ -397,6 +418,7 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
19991 + size_t size, int flags)
19992 {
19993 - /* pid and depth on the last trace processed */
19994 - struct fgraph_data *data;
19995 -+ gfp_t gfpflags;
19996 - int cpu;
19997 -
19998 - iter->private = NULL;
19999 + struct btrfs_root *root = BTRFS_I(dentry->d_inode)->root;
20000 ++ int ret;
20001
20002 -- data = kzalloc(sizeof(*data), GFP_KERNEL);
20003 -+ /* We can be called in atomic context via ftrace_dump() */
20004 -+ gfpflags = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL;
20005 -+
20006 -+ data = kzalloc(sizeof(*data), gfpflags);
20007 - if (!data)
20008 - goto out_err;
20009 + /*
20010 + * The permission on security.* and system.* is not checked
20011 +@@ -413,8 +435,9 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
20012 + if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
20013 + return generic_setxattr(dentry, name, value, size, flags);
20014
20015 -- data->cpu_data = alloc_percpu(struct fgraph_cpu_data);
20016 -+ data->cpu_data = alloc_percpu_gfp(struct fgraph_cpu_data, gfpflags);
20017 - if (!data->cpu_data)
20018 - goto out_err_free;
20019 +- if (!btrfs_is_valid_xattr(name))
20020 +- return -EOPNOTSUPP;
20021 ++ ret = btrfs_is_valid_xattr(name);
20022 ++ if (ret)
20023 ++ return ret;
20024
20025 ---
20026 -2.3.6
20027 -
20028 -
20029 -From aaeb6f4d936e550fef1f068d2e883a23f757d5f5 Mon Sep 17 00:00:00 2001
20030 -From: Joonsoo Kim <iamjoonsoo.kim@×××.com>
20031 -Date: Thu, 16 Apr 2015 13:44:44 +0900
20032 -Subject: [PATCH 183/219] tracing: Fix incorrect enabling of trace events by
20033 - boot cmdline
20034 -Cc: mpagano@g.o
20035 -
20036 -commit 84fce9db4d7eaebd6cb2ee30c15da6d4e4daf846 upstream.
20037 -
20038 -There is a problem that trace events are not properly enabled with
20039 -boot cmdline. The problem is that if we pass "trace_event=kmem:mm_page_alloc"
20040 -to the boot cmdline, it enables all kmem trace events, and not just
20041 -the page_alloc event.
20042 -
20043 -This is caused by the parsing mechanism. When we parse the cmdline, the buffer
20044 -contents is modified due to tokenization. And, if we use this buffer
20045 -again, we will get the wrong result.
20046 -
20047 -Unfortunately, this buffer is be accessed three times to set trace events
20048 -properly at boot time. So, we need to handle this situation.
20049 -
20050 -There is already code handling ",", but we need another for ":".
20051 -This patch adds it.
20052 -
20053 -Link: http://lkml.kernel.org/r/1429159484-22977-1-git-send-email-iamjoonsoo.kim@×××.com
20054 -
20055 -Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@×××.com>
20056 -[ added missing return ret; ]
20057 -Signed-off-by: Steven Rostedt <rostedt@×××××××.org>
20058 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
20059 -
20060 -Signed-off-by: Mike Pagano <mpagano@g.o>
20061 ----
20062 - kernel/trace/trace_events.c | 9 ++++++++-
20063 - 1 file changed, 8 insertions(+), 1 deletion(-)
20064 -
20065 -diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
20066 -index db54dda..a9c10a3 100644
20067 ---- a/kernel/trace/trace_events.c
20068 -+++ b/kernel/trace/trace_events.c
20069 -@@ -565,6 +565,7 @@ static int __ftrace_set_clr_event(struct trace_array *tr, const char *match,
20070 - static int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set)
20071 + if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN))
20072 + return btrfs_set_prop(dentry->d_inode, name,
20073 +@@ -430,6 +453,7 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
20074 + int btrfs_removexattr(struct dentry *dentry, const char *name)
20075 {
20076 - char *event = NULL, *sub = NULL, *match;
20077 + struct btrfs_root *root = BTRFS_I(dentry->d_inode)->root;
20078 + int ret;
20079
20080 /*
20081 - * The buf format can be <subsystem>:<event-name>
20082 -@@ -590,7 +591,13 @@ static int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set)
20083 - event = NULL;
20084 - }
20085 -
20086 -- return __ftrace_set_clr_event(tr, match, sub, event, set);
20087 -+ ret = __ftrace_set_clr_event(tr, match, sub, event, set);
20088 -+
20089 -+ /* Put back the colon to allow this to be called again */
20090 -+ if (buf)
20091 -+ *(buf - 1) = ':';
20092 -+
20093 -+ return ret;
20094 - }
20095 -
20096 - /**
20097 ---
20098 -2.3.6
20099 -
20100 -
20101 -From c5bc4117a935b13fdc40db4753b9d32307d2e304 Mon Sep 17 00:00:00 2001
20102 -From: Wolfram Sang <wsa+renesas@××××××××××××××××.com>
20103 -Date: Thu, 23 Apr 2015 10:29:09 +0200
20104 -Subject: [PATCH 184/219] i2c: mux: use proper dev when removing "channel-X"
20105 - symlinks
20106 -Cc: mpagano@g.o
20107 -
20108 -commit 133778482ec6c8fde69406be380333963627c17a upstream.
20109 -
20110 -Those symlinks are created for the mux_dev, so we need to remove it from
20111 -there. Currently, it breaks for muxes where the mux_dev is not the device
20112 -of the parent adapter like this:
20113 -
20114 -[ 78.234644] WARNING: CPU: 0 PID: 365 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x5c/0x78()
20115 -[ 78.242438] sysfs: cannot create duplicate filename '/devices/platform/i2cbus@8/channel-0'
20116 -
20117 -Remove confusing comments while we are here.
20118 -
20119 -Signed-off-by: Wolfram Sang <wsa+renesas@××××××××××××××××.com>
20120 -Signed-off-by: Wolfram Sang <wsa@××××××××××.de>
20121 -Fixes: c9449affad2ae0
20122 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
20123 -Signed-off-by: Mike Pagano <mpagano@g.o>
20124 ----
20125 - drivers/i2c/i2c-mux.c | 8 +++++---
20126 - 1 file changed, 5 insertions(+), 3 deletions(-)
20127 -
20128 -diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
20129 -index 593f7ca..06cc1ff 100644
20130 ---- a/drivers/i2c/i2c-mux.c
20131 -+++ b/drivers/i2c/i2c-mux.c
20132 -@@ -32,8 +32,9 @@ struct i2c_mux_priv {
20133 - struct i2c_algorithm algo;
20134 -
20135 - struct i2c_adapter *parent;
20136 -- void *mux_priv; /* the mux chip/device */
20137 -- u32 chan_id; /* the channel id */
20138 -+ struct device *mux_dev;
20139 -+ void *mux_priv;
20140 -+ u32 chan_id;
20141 + * The permission on security.* and system.* is not checked
20142 +@@ -446,8 +470,9 @@ int btrfs_removexattr(struct dentry *dentry, const char *name)
20143 + if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
20144 + return generic_removexattr(dentry, name);
20145
20146 - int (*select)(struct i2c_adapter *, void *mux_priv, u32 chan_id);
20147 - int (*deselect)(struct i2c_adapter *, void *mux_priv, u32 chan_id);
20148 -@@ -119,6 +120,7 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
20149 +- if (!btrfs_is_valid_xattr(name))
20150 +- return -EOPNOTSUPP;
20151 ++ ret = btrfs_is_valid_xattr(name);
20152 ++ if (ret)
20153 ++ return ret;
20154
20155 - /* Set up private adapter data */
20156 - priv->parent = parent;
20157 -+ priv->mux_dev = mux_dev;
20158 - priv->mux_priv = mux_priv;
20159 - priv->chan_id = chan_id;
20160 - priv->select = select;
20161 -@@ -203,7 +205,7 @@ void i2c_del_mux_adapter(struct i2c_adapter *adap)
20162 - char symlink_name[20];
20163 + if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN))
20164 + return btrfs_set_prop(dentry->d_inode, name,
20165 +diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
20166 +index 28fe71a..aae7011 100644
20167 +--- a/fs/ext4/namei.c
20168 ++++ b/fs/ext4/namei.c
20169 +@@ -1865,7 +1865,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
20170 + struct inode *inode)
20171 + {
20172 + struct inode *dir = dentry->d_parent->d_inode;
20173 +- struct buffer_head *bh;
20174 ++ struct buffer_head *bh = NULL;
20175 + struct ext4_dir_entry_2 *de;
20176 + struct ext4_dir_entry_tail *t;
20177 + struct super_block *sb;
20178 +@@ -1889,14 +1889,14 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
20179 + return retval;
20180 + if (retval == 1) {
20181 + retval = 0;
20182 +- return retval;
20183 ++ goto out;
20184 + }
20185 + }
20186
20187 - snprintf(symlink_name, sizeof(symlink_name), "channel-%u", priv->chan_id);
20188 -- sysfs_remove_link(&adap->dev.parent->kobj, symlink_name);
20189 -+ sysfs_remove_link(&priv->mux_dev->kobj, symlink_name);
20190 + if (is_dx(dir)) {
20191 + retval = ext4_dx_add_entry(handle, dentry, inode);
20192 + if (!retval || (retval != ERR_BAD_DX_DIR))
20193 +- return retval;
20194 ++ goto out;
20195 + ext4_clear_inode_flag(dir, EXT4_INODE_INDEX);
20196 + dx_fallback++;
20197 + ext4_mark_inode_dirty(handle, dir);
20198 +@@ -1908,14 +1908,15 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
20199 + return PTR_ERR(bh);
20200
20201 - sysfs_remove_link(&priv->adap.dev.kobj, "mux_device");
20202 - i2c_del_adapter(adap);
20203 ---
20204 -2.3.6
20205 -
20206 -
20207 -From 7a86d818f4f71fdd0e1d16c07026e2b9a52be2d6 Mon Sep 17 00:00:00 2001
20208 -From: Dmitry Torokhov <dmitry.torokhov@×××××.com>
20209 -Date: Mon, 20 Apr 2015 15:14:47 -0700
20210 -Subject: [PATCH 185/219] i2c: rk3x: report number of messages transmitted
20211 -Cc: mpagano@g.o
20212 -
20213 -commit c6cbfb91b878224e78408a2e15901c79de77115a upstream.
20214 -
20215 -master_xfer() method should return number of i2c messages transferred,
20216 -but on Rockchip we were usually returning just 1, which caused trouble
20217 -with users that actually check number of transferred messages vs.
20218 -checking for negative error codes.
20219 -
20220 -Signed-off-by: Dmitry Torokhov <dmitry.torokhov@×××××.com>
20221 -Signed-off-by: Wolfram Sang <wsa@××××××××××.de>
20222 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
20223 -Signed-off-by: Mike Pagano <mpagano@g.o>
20224 ----
20225 - drivers/i2c/busses/i2c-rk3x.c | 2 +-
20226 - 1 file changed, 1 insertion(+), 1 deletion(-)
20227 -
20228 -diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
20229 -index 5f96b1b..019d542 100644
20230 ---- a/drivers/i2c/busses/i2c-rk3x.c
20231 -+++ b/drivers/i2c/busses/i2c-rk3x.c
20232 -@@ -833,7 +833,7 @@ static int rk3x_i2c_xfer(struct i2c_adapter *adap,
20233 - clk_disable(i2c->clk);
20234 - spin_unlock_irqrestore(&i2c->lock, flags);
20235 + retval = add_dirent_to_buf(handle, dentry, inode, NULL, bh);
20236 +- if (retval != -ENOSPC) {
20237 +- brelse(bh);
20238 +- return retval;
20239 +- }
20240 ++ if (retval != -ENOSPC)
20241 ++ goto out;
20242
20243 -- return ret;
20244 -+ return ret < 0 ? ret : num;
20245 - }
20246 + if (blocks == 1 && !dx_fallback &&
20247 +- EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX))
20248 +- return make_indexed_dir(handle, dentry, inode, bh);
20249 ++ EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX)) {
20250 ++ retval = make_indexed_dir(handle, dentry, inode, bh);
20251 ++ bh = NULL; /* make_indexed_dir releases bh */
20252 ++ goto out;
20253 ++ }
20254 + brelse(bh);
20255 + }
20256 + bh = ext4_append(handle, dir, &block);
20257 +@@ -1931,6 +1932,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
20258 + }
20259
20260 - static u32 rk3x_i2c_func(struct i2c_adapter *adap)
20261 ---
20262 -2.3.6
20263 -
20264 -
20265 -From 184848b540e3c7df18a22b983319fa4f64acec15 Mon Sep 17 00:00:00 2001
20266 -From: Charles Keepax <ckeepax@×××××××××××××××××××××××.com>
20267 -Date: Thu, 16 Apr 2015 13:05:19 +0100
20268 -Subject: [PATCH 186/219] i2c: Mark adapter devices with
20269 - pm_runtime_no_callbacks
20270 -Cc: mpagano@g.o
20271 -
20272 -commit 6ada5c1e1b077ab98fc144d7ac132b4dcc0148ec upstream.
20273 -
20274 -Commit 523c5b89640e ("i2c: Remove support for legacy PM") removed the PM
20275 -ops from the bus type, which causes the pm operations on the s3c2410
20276 -adapter device to fail (-ENOSUPP in rpm_callback). The adapter device
20277 -doesn't get bound to a driver and as such can't have its own pm_runtime
20278 -callbacks. Previously this was fine as the bus callbacks would have been
20279 -used, but now this can cause devices which use PM runtime and are
20280 -attached over I2C to fail to resume.
20281 -
20282 -This commit fixes this issue by marking all adapter devices with
20283 -pm_runtime_no_callbacks, since they can't have any.
20284 -
20285 -Signed-off-by: Charles Keepax <ckeepax@×××××××××××××××××××××××.com>
20286 -Acked-by: Beata Michalska <b.michalska@×××××××.com>
20287 -Signed-off-by: Wolfram Sang <wsa@××××××××××.de>
20288 -Fixes: 523c5b89640e
20289 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
20290 -Signed-off-by: Mike Pagano <mpagano@g.o>
20291 ----
20292 - drivers/i2c/i2c-core.c | 2 ++
20293 - 1 file changed, 2 insertions(+)
20294 -
20295 -diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
20296 -index edf274c..526c5a5 100644
20297 ---- a/drivers/i2c/i2c-core.c
20298 -+++ b/drivers/i2c/i2c-core.c
20299 -@@ -1410,6 +1410,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
20300 + retval = add_dirent_to_buf(handle, dentry, inode, de, bh);
20301 ++out:
20302 + brelse(bh);
20303 + if (retval == 0)
20304 + ext4_set_inode_state(inode, EXT4_STATE_NEWENTRY);
20305 +diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
20306 +index 665ef5a..a563ddb 100644
20307 +--- a/fs/lockd/svcsubs.c
20308 ++++ b/fs/lockd/svcsubs.c
20309 +@@ -31,7 +31,7 @@
20310 + static struct hlist_head nlm_files[FILE_NRHASH];
20311 + static DEFINE_MUTEX(nlm_file_mutex);
20312
20313 - dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name);
20314 +-#ifdef NFSD_DEBUG
20315 ++#ifdef CONFIG_SUNRPC_DEBUG
20316 + static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
20317 + {
20318 + u32 *fhp = (u32*)f->data;
20319 +diff --git a/fs/namei.c b/fs/namei.c
20320 +index c83145a..caa38a2 100644
20321 +--- a/fs/namei.c
20322 ++++ b/fs/namei.c
20323 +@@ -1591,7 +1591,8 @@ static inline int walk_component(struct nameidata *nd, struct path *path,
20324
20325 -+ pm_runtime_no_callbacks(&adap->dev);
20326 -+
20327 - #ifdef CONFIG_I2C_COMPAT
20328 - res = class_compat_create_link(i2c_adapter_compat_class, &adap->dev,
20329 - adap->dev.parent);
20330 ---
20331 -2.3.6
20332 -
20333 -
20334 -From 00b2c92fe1b560e1a984edf0671f0feb7886a7ed Mon Sep 17 00:00:00 2001
20335 -From: Mark Brown <broonie@××××××.org>
20336 -Date: Wed, 15 Apr 2015 19:18:39 +0100
20337 -Subject: [PATCH 187/219] i2c: core: Export bus recovery functions
20338 -Cc: mpagano@g.o
20339 -
20340 -commit c1c21f4e60ed4523292f1a89ff45a208bddd3849 upstream.
20341 -
20342 -Current -next fails to link an ARM allmodconfig because drivers that use
20343 -the core recovery functions can be built as modules but those functions
20344 -are not exported:
20345 -
20346 -ERROR: "i2c_generic_gpio_recovery" [drivers/i2c/busses/i2c-davinci.ko] undefined!
20347 -ERROR: "i2c_generic_scl_recovery" [drivers/i2c/busses/i2c-davinci.ko] undefined!
20348 -ERROR: "i2c_recover_bus" [drivers/i2c/busses/i2c-davinci.ko] undefined!
20349 -
20350 -Add exports to fix this.
20351 -
20352 -Fixes: 5f9296ba21b3c (i2c: Add bus recovery infrastructure)
20353 -Signed-off-by: Mark Brown <broonie@××××××.org>
20354 -Signed-off-by: Wolfram Sang <wsa@××××××××××.de>
20355 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
20356 -Signed-off-by: Mike Pagano <mpagano@g.o>
20357 ----
20358 - drivers/i2c/i2c-core.c | 3 +++
20359 - 1 file changed, 3 insertions(+)
20360 -
20361 -diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
20362 -index 526c5a5..8143162 100644
20363 ---- a/drivers/i2c/i2c-core.c
20364 -+++ b/drivers/i2c/i2c-core.c
20365 -@@ -596,6 +596,7 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap)
20366 - adap->bus_recovery_info->set_scl(adap, 1);
20367 - return i2c_generic_recovery(adap);
20368 - }
20369 -+EXPORT_SYMBOL_GPL(i2c_generic_scl_recovery);
20370 + if (should_follow_link(path->dentry, follow)) {
20371 + if (nd->flags & LOOKUP_RCU) {
20372 +- if (unlikely(unlazy_walk(nd, path->dentry))) {
20373 ++ if (unlikely(nd->path.mnt != path->mnt ||
20374 ++ unlazy_walk(nd, path->dentry))) {
20375 + err = -ECHILD;
20376 + goto out_err;
20377 + }
20378 +@@ -3047,7 +3048,8 @@ finish_lookup:
20379
20380 - int i2c_generic_gpio_recovery(struct i2c_adapter *adap)
20381 + if (should_follow_link(path->dentry, !symlink_ok)) {
20382 + if (nd->flags & LOOKUP_RCU) {
20383 +- if (unlikely(unlazy_walk(nd, path->dentry))) {
20384 ++ if (unlikely(nd->path.mnt != path->mnt ||
20385 ++ unlazy_walk(nd, path->dentry))) {
20386 + error = -ECHILD;
20387 + goto out;
20388 + }
20389 +diff --git a/fs/namespace.c b/fs/namespace.c
20390 +index 82ef140..4622ee3 100644
20391 +--- a/fs/namespace.c
20392 ++++ b/fs/namespace.c
20393 +@@ -632,14 +632,17 @@ struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry)
20394 + */
20395 + struct mount *__lookup_mnt_last(struct vfsmount *mnt, struct dentry *dentry)
20396 {
20397 -@@ -610,6 +611,7 @@ int i2c_generic_gpio_recovery(struct i2c_adapter *adap)
20398 +- struct mount *p, *res;
20399 +- res = p = __lookup_mnt(mnt, dentry);
20400 ++ struct mount *p, *res = NULL;
20401 ++ p = __lookup_mnt(mnt, dentry);
20402 + if (!p)
20403 + goto out;
20404 ++ if (!(p->mnt.mnt_flags & MNT_UMOUNT))
20405 ++ res = p;
20406 + hlist_for_each_entry_continue(p, mnt_hash) {
20407 + if (&p->mnt_parent->mnt != mnt || p->mnt_mountpoint != dentry)
20408 + break;
20409 +- res = p;
20410 ++ if (!(p->mnt.mnt_flags & MNT_UMOUNT))
20411 ++ res = p;
20412 + }
20413 + out:
20414 + return res;
20415 +@@ -795,10 +798,8 @@ static void __touch_mnt_namespace(struct mnt_namespace *ns)
20416 + /*
20417 + * vfsmount lock must be held for write
20418 + */
20419 +-static void detach_mnt(struct mount *mnt, struct path *old_path)
20420 ++static void unhash_mnt(struct mount *mnt)
20421 + {
20422 +- old_path->dentry = mnt->mnt_mountpoint;
20423 +- old_path->mnt = &mnt->mnt_parent->mnt;
20424 + mnt->mnt_parent = mnt;
20425 + mnt->mnt_mountpoint = mnt->mnt.mnt_root;
20426 + list_del_init(&mnt->mnt_child);
20427 +@@ -811,6 +812,26 @@ static void detach_mnt(struct mount *mnt, struct path *old_path)
20428 + /*
20429 + * vfsmount lock must be held for write
20430 + */
20431 ++static void detach_mnt(struct mount *mnt, struct path *old_path)
20432 ++{
20433 ++ old_path->dentry = mnt->mnt_mountpoint;
20434 ++ old_path->mnt = &mnt->mnt_parent->mnt;
20435 ++ unhash_mnt(mnt);
20436 ++}
20437 ++
20438 ++/*
20439 ++ * vfsmount lock must be held for write
20440 ++ */
20441 ++static void umount_mnt(struct mount *mnt)
20442 ++{
20443 ++ /* old mountpoint will be dropped when we can do that */
20444 ++ mnt->mnt_ex_mountpoint = mnt->mnt_mountpoint;
20445 ++ unhash_mnt(mnt);
20446 ++}
20447 ++
20448 ++/*
20449 ++ * vfsmount lock must be held for write
20450 ++ */
20451 + void mnt_set_mountpoint(struct mount *mnt,
20452 + struct mountpoint *mp,
20453 + struct mount *child_mnt)
20454 +@@ -1078,6 +1099,13 @@ static void mntput_no_expire(struct mount *mnt)
20455 + rcu_read_unlock();
20456
20457 - return ret;
20458 - }
20459 -+EXPORT_SYMBOL_GPL(i2c_generic_gpio_recovery);
20460 + list_del(&mnt->mnt_instance);
20461 ++
20462 ++ if (unlikely(!list_empty(&mnt->mnt_mounts))) {
20463 ++ struct mount *p, *tmp;
20464 ++ list_for_each_entry_safe(p, tmp, &mnt->mnt_mounts, mnt_child) {
20465 ++ umount_mnt(p);
20466 ++ }
20467 ++ }
20468 + unlock_mount_hash();
20469
20470 - int i2c_recover_bus(struct i2c_adapter *adap)
20471 - {
20472 -@@ -619,6 +621,7 @@ int i2c_recover_bus(struct i2c_adapter *adap)
20473 - dev_dbg(&adap->dev, "Trying i2c bus recovery\n");
20474 - return adap->bus_recovery_info->recover_bus(adap);
20475 + if (likely(!(mnt->mnt.mnt_flags & MNT_INTERNAL))) {
20476 +@@ -1319,49 +1347,63 @@ static inline void namespace_lock(void)
20477 + down_write(&namespace_sem);
20478 }
20479 -+EXPORT_SYMBOL_GPL(i2c_recover_bus);
20480
20481 - static int i2c_device_probe(struct device *dev)
20482 ++enum umount_tree_flags {
20483 ++ UMOUNT_SYNC = 1,
20484 ++ UMOUNT_PROPAGATE = 2,
20485 ++ UMOUNT_CONNECTED = 4,
20486 ++};
20487 + /*
20488 + * mount_lock must be held
20489 + * namespace_sem must be held for write
20490 +- * how = 0 => just this tree, don't propagate
20491 +- * how = 1 => propagate; we know that nobody else has reference to any victims
20492 +- * how = 2 => lazy umount
20493 + */
20494 +-void umount_tree(struct mount *mnt, int how)
20495 ++static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
20496 {
20497 ---
20498 -2.3.6
20499 -
20500 -
20501 -From 87479d71ffe1c2b63f7621fefbdc1cedd95dd49d Mon Sep 17 00:00:00 2001
20502 -From: Alex Deucher <alexander.deucher@×××.com>
20503 -Date: Tue, 24 Feb 2015 11:29:21 -0500
20504 -Subject: [PATCH 188/219] drm/radeon: fix doublescan modes (v2)
20505 -Cc: mpagano@g.o
20506 -
20507 -commit fd99a0943ffaa0320ea4f69d09ed188f950c0432 upstream.
20508 -
20509 -Use the correct flags for atom.
20510 -
20511 -v2: handle DRM_MODE_FLAG_DBLCLK
20512 -
20513 -Signed-off-by: Alex Deucher <alexander.deucher@×××.com>
20514 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
20515 -Signed-off-by: Mike Pagano <mpagano@g.o>
20516 ----
20517 - drivers/gpu/drm/radeon/atombios_crtc.c | 8 ++++++--
20518 - 1 file changed, 6 insertions(+), 2 deletions(-)
20519 -
20520 -diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
20521 -index 86807ee..9bd5611 100644
20522 ---- a/drivers/gpu/drm/radeon/atombios_crtc.c
20523 -+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
20524 -@@ -330,8 +330,10 @@ atombios_set_crtc_dtd_timing(struct drm_crtc *crtc,
20525 - misc |= ATOM_COMPOSITESYNC;
20526 - if (mode->flags & DRM_MODE_FLAG_INTERLACE)
20527 - misc |= ATOM_INTERLACE;
20528 -- if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
20529 -+ if (mode->flags & DRM_MODE_FLAG_DBLCLK)
20530 - misc |= ATOM_DOUBLE_CLOCK_MODE;
20531 -+ if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
20532 -+ misc |= ATOM_H_REPLICATIONBY2 | ATOM_V_REPLICATIONBY2;
20533 +- HLIST_HEAD(tmp_list);
20534 ++ LIST_HEAD(tmp_list);
20535 + struct mount *p;
20536
20537 - args.susModeMiscInfo.usAccess = cpu_to_le16(misc);
20538 - args.ucCRTC = radeon_crtc->crtc_id;
20539 -@@ -374,8 +376,10 @@ static void atombios_crtc_set_timing(struct drm_crtc *crtc,
20540 - misc |= ATOM_COMPOSITESYNC;
20541 - if (mode->flags & DRM_MODE_FLAG_INTERLACE)
20542 - misc |= ATOM_INTERLACE;
20543 -- if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
20544 -+ if (mode->flags & DRM_MODE_FLAG_DBLCLK)
20545 - misc |= ATOM_DOUBLE_CLOCK_MODE;
20546 -+ if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
20547 -+ misc |= ATOM_H_REPLICATIONBY2 | ATOM_V_REPLICATIONBY2;
20548 ++ if (how & UMOUNT_PROPAGATE)
20549 ++ propagate_mount_unlock(mnt);
20550 ++
20551 ++ /* Gather the mounts to umount */
20552 + for (p = mnt; p; p = next_mnt(p, mnt)) {
20553 +- hlist_del_init_rcu(&p->mnt_hash);
20554 +- hlist_add_head(&p->mnt_hash, &tmp_list);
20555 ++ p->mnt.mnt_flags |= MNT_UMOUNT;
20556 ++ list_move(&p->mnt_list, &tmp_list);
20557 + }
20558
20559 - args.susModeMiscInfo.usAccess = cpu_to_le16(misc);
20560 - args.ucCRTC = radeon_crtc->crtc_id;
20561 ---
20562 -2.3.6
20563 -
20564 -
20565 -From 7b645d942ed7101136f35bad5f6cb225c6e2adaa Mon Sep 17 00:00:00 2001
20566 -From: Krzysztof Kozlowski <k.kozlowski@×××××××.com>
20567 -Date: Tue, 7 Apr 2015 22:28:50 +0900
20568 -Subject: [PATCH 189/219] drm/exynos: Enable DP clock to fix display on
20569 - Exynos5250 and other
20570 -MIME-Version: 1.0
20571 -Content-Type: text/plain; charset=UTF-8
20572 -Content-Transfer-Encoding: 8bit
20573 -Cc: mpagano@g.o
20574 -
20575 -commit 1c363c7cccf64128087002b0779986ad16aff6dc upstream.
20576 -
20577 -After adding display power domain for Exynos5250 in commit
20578 -2d2c9a8d0a4f ("ARM: dts: add display power domain for exynos5250") the
20579 -display on Chromebook Snow and others stopped working after boot.
20580 -
20581 -The reason for this suggested Andrzej Hajda: the DP clock was disabled.
20582 -This clock is required by Display Port and is enabled by bootloader.
20583 -However when FIMD driver probing was deferred, the display power domain
20584 -was turned off. This effectively reset the value of DP clock enable
20585 -register.
20586 -
20587 -When exynos-dp is later probed, the clock is not enabled and display is
20588 -not properly configured:
20589 -
20590 -exynos-dp 145b0000.dp-controller: Timeout of video streamclk ok
20591 -exynos-dp 145b0000.dp-controller: unable to config video
20592 -
20593 -Fixes: 2d2c9a8d0a4f ("ARM: dts: add display power domain for exynos5250")
20594 -
20595 -Signed-off-by: Krzysztof Kozlowski <k.kozlowski@×××××××.com>
20596 -Reported-by: Javier Martinez Canillas <javier.martinez@××××××××××××.uk>
20597 -Tested-by: Javier Martinez Canillas <javier.martinez@××××××××××××.uk>
20598 -Tested-by: Andreas Färber <afaerber@××××.de>
20599 -Signed-off-by: Inki Dae <inki.dae@×××××××.com>
20600 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
20601 -Signed-off-by: Mike Pagano <mpagano@g.o>
20602 ----
20603 - drivers/gpu/drm/exynos/exynos_dp_core.c | 10 ++++++++++
20604 - drivers/gpu/drm/exynos/exynos_drm_fimd.c | 19 +++++++++++++++++++
20605 - drivers/gpu/drm/exynos/exynos_drm_fimd.h | 15 +++++++++++++++
20606 - include/video/samsung_fimd.h | 6 ++++++
20607 - 4 files changed, 50 insertions(+)
20608 - create mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimd.h
20609 -
20610 -diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
20611 -index bf17a60..1dbfba5 100644
20612 ---- a/drivers/gpu/drm/exynos/exynos_dp_core.c
20613 -+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
20614 -@@ -32,10 +32,16 @@
20615 - #include <drm/bridge/ptn3460.h>
20616 +- hlist_for_each_entry(p, &tmp_list, mnt_hash)
20617 ++ /* Hide the mounts from mnt_mounts */
20618 ++ list_for_each_entry(p, &tmp_list, mnt_list) {
20619 + list_del_init(&p->mnt_child);
20620 ++ }
20621
20622 - #include "exynos_dp_core.h"
20623 -+#include "exynos_drm_fimd.h"
20624 +- if (how)
20625 ++ /* Add propogated mounts to the tmp_list */
20626 ++ if (how & UMOUNT_PROPAGATE)
20627 + propagate_umount(&tmp_list);
20628
20629 - #define ctx_from_connector(c) container_of(c, struct exynos_dp_device, \
20630 - connector)
20631 +- while (!hlist_empty(&tmp_list)) {
20632 +- p = hlist_entry(tmp_list.first, struct mount, mnt_hash);
20633 +- hlist_del_init_rcu(&p->mnt_hash);
20634 ++ while (!list_empty(&tmp_list)) {
20635 ++ bool disconnect;
20636 ++ p = list_first_entry(&tmp_list, struct mount, mnt_list);
20637 + list_del_init(&p->mnt_expire);
20638 + list_del_init(&p->mnt_list);
20639 + __touch_mnt_namespace(p->mnt_ns);
20640 + p->mnt_ns = NULL;
20641 +- if (how < 2)
20642 ++ if (how & UMOUNT_SYNC)
20643 + p->mnt.mnt_flags |= MNT_SYNC_UMOUNT;
20644
20645 -+static inline struct exynos_drm_crtc *dp_to_crtc(struct exynos_dp_device *dp)
20646 -+{
20647 -+ return to_exynos_crtc(dp->encoder->crtc);
20648 -+}
20649 +- pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt, &unmounted);
20650 ++ disconnect = !(((how & UMOUNT_CONNECTED) &&
20651 ++ mnt_has_parent(p) &&
20652 ++ (p->mnt_parent->mnt.mnt_flags & MNT_UMOUNT)) ||
20653 ++ IS_MNT_LOCKED_AND_LAZY(p));
20654 +
20655 - static inline struct exynos_dp_device *
20656 - display_to_dp(struct exynos_drm_display *d)
20657 - {
20658 -@@ -1070,6 +1076,8 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp)
20659 ++ pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt,
20660 ++ disconnect ? &unmounted : NULL);
20661 + if (mnt_has_parent(p)) {
20662 +- hlist_del_init(&p->mnt_mp_list);
20663 +- put_mountpoint(p->mnt_mp);
20664 + mnt_add_count(p->mnt_parent, -1);
20665 +- /* old mountpoint will be dropped when we can do that */
20666 +- p->mnt_ex_mountpoint = p->mnt_mountpoint;
20667 +- p->mnt_mountpoint = p->mnt.mnt_root;
20668 +- p->mnt_parent = p;
20669 +- p->mnt_mp = NULL;
20670 ++ if (!disconnect) {
20671 ++ /* Don't forget about p */
20672 ++ list_add_tail(&p->mnt_child, &p->mnt_parent->mnt_mounts);
20673 ++ } else {
20674 ++ umount_mnt(p);
20675 ++ }
20676 }
20677 + change_mnt_propagation(p, MS_PRIVATE);
20678 }
20679 +@@ -1447,14 +1489,14 @@ static int do_umount(struct mount *mnt, int flags)
20680
20681 -+ fimd_dp_clock_enable(dp_to_crtc(dp), true);
20682 -+
20683 - clk_prepare_enable(dp->clock);
20684 - exynos_dp_phy_init(dp);
20685 - exynos_dp_init_dp(dp);
20686 -@@ -1094,6 +1102,8 @@ static void exynos_dp_poweroff(struct exynos_dp_device *dp)
20687 - exynos_dp_phy_exit(dp);
20688 - clk_disable_unprepare(dp->clock);
20689 + if (flags & MNT_DETACH) {
20690 + if (!list_empty(&mnt->mnt_list))
20691 +- umount_tree(mnt, 2);
20692 ++ umount_tree(mnt, UMOUNT_PROPAGATE);
20693 + retval = 0;
20694 + } else {
20695 + shrink_submounts(mnt);
20696 + retval = -EBUSY;
20697 + if (!propagate_mount_busy(mnt, 2)) {
20698 + if (!list_empty(&mnt->mnt_list))
20699 +- umount_tree(mnt, 1);
20700 ++ umount_tree(mnt, UMOUNT_PROPAGATE|UMOUNT_SYNC);
20701 + retval = 0;
20702 + }
20703 + }
20704 +@@ -1480,13 +1522,20 @@ void __detach_mounts(struct dentry *dentry)
20705
20706 -+ fimd_dp_clock_enable(dp_to_crtc(dp), false);
20707 -+
20708 - if (dp->panel) {
20709 - if (drm_panel_unprepare(dp->panel))
20710 - DRM_ERROR("failed to turnoff the panel\n");
20711 -diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
20712 -index 33a10ce..5d58f6c 100644
20713 ---- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
20714 -+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
20715 -@@ -32,6 +32,7 @@
20716 - #include "exynos_drm_fbdev.h"
20717 - #include "exynos_drm_crtc.h"
20718 - #include "exynos_drm_iommu.h"
20719 -+#include "exynos_drm_fimd.h"
20720 + namespace_lock();
20721 + mp = lookup_mountpoint(dentry);
20722 +- if (!mp)
20723 ++ if (IS_ERR_OR_NULL(mp))
20724 + goto out_unlock;
20725
20726 - /*
20727 - * FIMD stands for Fully Interactive Mobile Display and
20728 -@@ -1233,6 +1234,24 @@ static int fimd_remove(struct platform_device *pdev)
20729 - return 0;
20730 + lock_mount_hash();
20731 + while (!hlist_empty(&mp->m_list)) {
20732 + mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list);
20733 +- umount_tree(mnt, 2);
20734 ++ if (mnt->mnt.mnt_flags & MNT_UMOUNT) {
20735 ++ struct mount *p, *tmp;
20736 ++ list_for_each_entry_safe(p, tmp, &mnt->mnt_mounts, mnt_child) {
20737 ++ hlist_add_head(&p->mnt_umount.s_list, &unmounted);
20738 ++ umount_mnt(p);
20739 ++ }
20740 ++ }
20741 ++ else umount_tree(mnt, UMOUNT_CONNECTED);
20742 + }
20743 + unlock_mount_hash();
20744 + put_mountpoint(mp);
20745 +@@ -1648,7 +1697,7 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
20746 + out:
20747 + if (res) {
20748 + lock_mount_hash();
20749 +- umount_tree(res, 0);
20750 ++ umount_tree(res, UMOUNT_SYNC);
20751 + unlock_mount_hash();
20752 + }
20753 + return q;
20754 +@@ -1672,7 +1721,7 @@ void drop_collected_mounts(struct vfsmount *mnt)
20755 + {
20756 + namespace_lock();
20757 + lock_mount_hash();
20758 +- umount_tree(real_mount(mnt), 0);
20759 ++ umount_tree(real_mount(mnt), UMOUNT_SYNC);
20760 + unlock_mount_hash();
20761 + namespace_unlock();
20762 }
20763 +@@ -1855,7 +1904,7 @@ static int attach_recursive_mnt(struct mount *source_mnt,
20764 + out_cleanup_ids:
20765 + while (!hlist_empty(&tree_list)) {
20766 + child = hlist_entry(tree_list.first, struct mount, mnt_hash);
20767 +- umount_tree(child, 0);
20768 ++ umount_tree(child, UMOUNT_SYNC);
20769 + }
20770 + unlock_mount_hash();
20771 + cleanup_group_ids(source_mnt, NULL);
20772 +@@ -2035,7 +2084,7 @@ static int do_loopback(struct path *path, const char *old_name,
20773 + err = graft_tree(mnt, parent, mp);
20774 + if (err) {
20775 + lock_mount_hash();
20776 +- umount_tree(mnt, 0);
20777 ++ umount_tree(mnt, UMOUNT_SYNC);
20778 + unlock_mount_hash();
20779 + }
20780 + out2:
20781 +@@ -2406,7 +2455,7 @@ void mark_mounts_for_expiry(struct list_head *mounts)
20782 + while (!list_empty(&graveyard)) {
20783 + mnt = list_first_entry(&graveyard, struct mount, mnt_expire);
20784 + touch_mnt_namespace(mnt->mnt_ns);
20785 +- umount_tree(mnt, 1);
20786 ++ umount_tree(mnt, UMOUNT_PROPAGATE|UMOUNT_SYNC);
20787 + }
20788 + unlock_mount_hash();
20789 + namespace_unlock();
20790 +@@ -2477,7 +2526,7 @@ static void shrink_submounts(struct mount *mnt)
20791 + m = list_first_entry(&graveyard, struct mount,
20792 + mnt_expire);
20793 + touch_mnt_namespace(m->mnt_ns);
20794 +- umount_tree(m, 1);
20795 ++ umount_tree(m, UMOUNT_PROPAGATE|UMOUNT_SYNC);
20796 + }
20797 + }
20798 + }
20799 +diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
20800 +index 351be920..8d129bb 100644
20801 +--- a/fs/nfs/callback.c
20802 ++++ b/fs/nfs/callback.c
20803 +@@ -128,7 +128,7 @@ nfs41_callback_svc(void *vrqstp)
20804 + if (try_to_freeze())
20805 + continue;
20806
20807 -+void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable)
20808 -+{
20809 -+ struct fimd_context *ctx = crtc->ctx;
20810 -+ u32 val;
20811 -+
20812 -+ /*
20813 -+ * Only Exynos 5250, 5260, 5410 and 542x requires enabling DP/MIE
20814 -+ * clock. On these SoCs the bootloader may enable it but any
20815 -+ * power domain off/on will reset it to disable state.
20816 -+ */
20817 -+ if (ctx->driver_data != &exynos5_fimd_driver_data)
20818 -+ return;
20819 -+
20820 -+ val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE;
20821 -+ writel(DP_MIE_CLK_DP_ENABLE, ctx->regs + DP_MIE_CLKCON);
20822 -+}
20823 -+EXPORT_SYMBOL_GPL(fimd_dp_clock_enable);
20824 -+
20825 - struct platform_driver fimd_driver = {
20826 - .probe = fimd_probe,
20827 - .remove = fimd_remove,
20828 -diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.h b/drivers/gpu/drm/exynos/exynos_drm_fimd.h
20829 -new file mode 100644
20830 -index 0000000..b4fcaa5
20831 ---- /dev/null
20832 -+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.h
20833 -@@ -0,0 +1,15 @@
20834 -+/*
20835 -+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
20836 -+ *
20837 -+ * This program is free software; you can redistribute it and/or modify it
20838 -+ * under the terms of the GNU General Public License as published by the
20839 -+ * Free Software Foundation; either version 2 of the License, or (at your
20840 -+ * option) any later version.
20841 -+ */
20842 -+
20843 -+#ifndef _EXYNOS_DRM_FIMD_H_
20844 -+#define _EXYNOS_DRM_FIMD_H_
20845 -+
20846 -+extern void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable);
20847 -+
20848 -+#endif /* _EXYNOS_DRM_FIMD_H_ */
20849 -diff --git a/include/video/samsung_fimd.h b/include/video/samsung_fimd.h
20850 -index a20e4a3..847a0a2 100644
20851 ---- a/include/video/samsung_fimd.h
20852 -+++ b/include/video/samsung_fimd.h
20853 -@@ -436,6 +436,12 @@
20854 - #define BLENDCON_NEW_8BIT_ALPHA_VALUE (1 << 0)
20855 - #define BLENDCON_NEW_4BIT_ALPHA_VALUE (0 << 0)
20856 -
20857 -+/* Display port clock control */
20858 -+#define DP_MIE_CLKCON 0x27c
20859 -+#define DP_MIE_CLK_DISABLE 0x0
20860 -+#define DP_MIE_CLK_DP_ENABLE 0x2
20861 -+#define DP_MIE_CLK_MIE_ENABLE 0x3
20862 -+
20863 - /* Notes on per-window bpp settings
20864 - *
20865 - * Value Win0 Win1 Win2 Win3 Win 4
20866 ---
20867 -2.3.6
20868 -
20869 -
20870 -From 9dc473bad145b361c179c4f115ea781b8b73448d Mon Sep 17 00:00:00 2001
20871 -From: Daniel Vetter <daniel.vetter@×××××.ch>
20872 -Date: Wed, 1 Apr 2015 13:43:46 +0200
20873 -Subject: [PATCH 190/219] drm/i915: Dont enable CS_PARSER_ERROR interrupts at
20874 - all
20875 -Cc: mpagano@g.o
20876 -
20877 -commit 37ef01ab5d24d1d520dc79f6a98099d451c2a901 upstream.
20878 -
20879 -We stopped handling them in
20880 -
20881 -commit aaecdf611a05cac26a94713bad25297e60225c29
20882 -Author: Daniel Vetter <daniel.vetter@×××××.ch>
20883 -Date: Tue Nov 4 15:52:22 2014 +0100
20884 -
20885 - drm/i915: Stop gathering error states for CS error interrupts
20886 -
20887 -but just clearing is apparently not enough: A sufficiently dead gpu
20888 -left behind by firmware (*cough* coreboot *cough*) can keep the gpu in
20889 -an endless loop of such interrupts, eventually leading to the nmi
20890 -firing. And definitely to what looks like a machine hang.
20891 -
20892 -Since we don't even enable these interrupts on gen5+ let's do the same
20893 -on earlier platforms.
20894 -
20895 -Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=93171
20896 -Tested-by: Mono <mono-for-kernel-org@×××××××××××××.de>
20897 -Tested-by: info@×××××××××××.uk
20898 -Reviewed-by: Mika Kuoppala <mika.kuoppala@×××××.com>
20899 -Signed-off-by: Daniel Vetter <daniel.vetter@×××××.com>
20900 -Signed-off-by: Jani Nikula <jani.nikula@×××××.com>
20901 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
20902 -Signed-off-by: Mike Pagano <mpagano@g.o>
20903 ----
20904 - drivers/gpu/drm/i915/i915_irq.c | 8 ++------
20905 - 1 file changed, 2 insertions(+), 6 deletions(-)
20906 -
20907 -diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
20908 -index ede5bbb..07320cb 100644
20909 ---- a/drivers/gpu/drm/i915/i915_irq.c
20910 -+++ b/drivers/gpu/drm/i915/i915_irq.c
20911 -@@ -3718,14 +3718,12 @@ static int i8xx_irq_postinstall(struct drm_device *dev)
20912 - ~(I915_DISPLAY_PIPE_A_EVENT_INTERRUPT |
20913 - I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |
20914 - I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT |
20915 -- I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT |
20916 -- I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT);
20917 -+ I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT);
20918 - I915_WRITE16(IMR, dev_priv->irq_mask);
20919 +- prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_UNINTERRUPTIBLE);
20920 ++ prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRUPTIBLE);
20921 + spin_lock_bh(&serv->sv_cb_lock);
20922 + if (!list_empty(&serv->sv_cb_list)) {
20923 + req = list_first_entry(&serv->sv_cb_list,
20924 +@@ -142,10 +142,10 @@ nfs41_callback_svc(void *vrqstp)
20925 + error);
20926 + } else {
20927 + spin_unlock_bh(&serv->sv_cb_lock);
20928 +- /* schedule_timeout to game the hung task watchdog */
20929 +- schedule_timeout(60 * HZ);
20930 ++ schedule();
20931 + finish_wait(&serv->sv_cb_waitq, &wq);
20932 + }
20933 ++ flush_signals(current);
20934 + }
20935 + return 0;
20936 + }
20937 +diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
20938 +index e907c8c..ab21ef1 100644
20939 +--- a/fs/nfs/direct.c
20940 ++++ b/fs/nfs/direct.c
20941 +@@ -129,22 +129,25 @@ nfs_direct_good_bytes(struct nfs_direct_req *dreq, struct nfs_pgio_header *hdr)
20942 + int i;
20943 + ssize_t count;
20944
20945 - I915_WRITE16(IER,
20946 - I915_DISPLAY_PIPE_A_EVENT_INTERRUPT |
20947 - I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |
20948 -- I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT |
20949 - I915_USER_INTERRUPT);
20950 - POSTING_READ16(IER);
20951 +- WARN_ON_ONCE(hdr->pgio_mirror_idx >= dreq->mirror_count);
20952 +-
20953 +- count = dreq->mirrors[hdr->pgio_mirror_idx].count;
20954 +- if (count + dreq->io_start < hdr->io_start + hdr->good_bytes) {
20955 +- count = hdr->io_start + hdr->good_bytes - dreq->io_start;
20956 +- dreq->mirrors[hdr->pgio_mirror_idx].count = count;
20957 +- }
20958 +-
20959 +- /* update the dreq->count by finding the minimum agreed count from all
20960 +- * mirrors */
20961 +- count = dreq->mirrors[0].count;
20962 ++ if (dreq->mirror_count == 1) {
20963 ++ dreq->mirrors[hdr->pgio_mirror_idx].count += hdr->good_bytes;
20964 ++ dreq->count += hdr->good_bytes;
20965 ++ } else {
20966 ++ /* mirrored writes */
20967 ++ count = dreq->mirrors[hdr->pgio_mirror_idx].count;
20968 ++ if (count + dreq->io_start < hdr->io_start + hdr->good_bytes) {
20969 ++ count = hdr->io_start + hdr->good_bytes - dreq->io_start;
20970 ++ dreq->mirrors[hdr->pgio_mirror_idx].count = count;
20971 ++ }
20972 ++ /* update the dreq->count by finding the minimum agreed count from all
20973 ++ * mirrors */
20974 ++ count = dreq->mirrors[0].count;
20975
20976 -@@ -3887,14 +3885,12 @@ static int i915_irq_postinstall(struct drm_device *dev)
20977 - I915_DISPLAY_PIPE_A_EVENT_INTERRUPT |
20978 - I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |
20979 - I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT |
20980 -- I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT |
20981 -- I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT);
20982 -+ I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT);
20983 +- for (i = 1; i < dreq->mirror_count; i++)
20984 +- count = min(count, dreq->mirrors[i].count);
20985 ++ for (i = 1; i < dreq->mirror_count; i++)
20986 ++ count = min(count, dreq->mirrors[i].count);
20987
20988 - enable_mask =
20989 - I915_ASLE_INTERRUPT |
20990 - I915_DISPLAY_PIPE_A_EVENT_INTERRUPT |
20991 - I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |
20992 -- I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT |
20993 - I915_USER_INTERRUPT;
20994 +- dreq->count = count;
20995 ++ dreq->count = count;
20996 ++ }
20997 + }
20998
20999 - if (I915_HAS_HOTPLUG(dev)) {
21000 ---
21001 -2.3.6
21002 -
21003 -
21004 -From 244f81177e5bc0ecb2f5507ef4371dc4752fea94 Mon Sep 17 00:00:00 2001
21005 -From: Laurent Pinchart <laurent.pinchart+renesas@××××××××××××.com>
21006 -Date: Wed, 18 Feb 2015 15:19:33 +0200
21007 -Subject: [PATCH 191/219] drm: adv7511: Fix DDC error interrupt handling
21008 -Cc: mpagano@g.o
21009 -
21010 -commit 2e96206c4f952295e11c311fbb2a7aa2105024af upstream.
21011 -
21012 -The DDC error interrupt bit is located in REG_INT1, not REG_INT0. Update
21013 -both the interrupt wait code and the interrupt sources reset code
21014 -accordingly.
21015 -
21016 -Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@××××××××××××.com>
21017 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
21018 -Signed-off-by: Mike Pagano <mpagano@g.o>
21019 ----
21020 - drivers/gpu/drm/i2c/adv7511.c | 14 ++++++++++----
21021 - 1 file changed, 10 insertions(+), 4 deletions(-)
21022 -
21023 -diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c
21024 -index fa140e0..5109c21 100644
21025 ---- a/drivers/gpu/drm/i2c/adv7511.c
21026 -+++ b/drivers/gpu/drm/i2c/adv7511.c
21027 -@@ -467,14 +467,16 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block,
21028 - block);
21029 - ret = adv7511_wait_for_interrupt(adv7511,
21030 - ADV7511_INT0_EDID_READY |
21031 -- ADV7511_INT1_DDC_ERROR, 200);
21032 -+ (ADV7511_INT1_DDC_ERROR << 8), 200);
21033 + /*
21034 +diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
21035 +index 5c399ec..d494ea2 100644
21036 +--- a/fs/nfs/nfs4xdr.c
21037 ++++ b/fs/nfs/nfs4xdr.c
21038 +@@ -7365,6 +7365,11 @@ nfs4_stat_to_errno(int stat)
21039 + .p_name = #proc, \
21040 + }
21041
21042 - if (!(ret & ADV7511_INT0_EDID_READY))
21043 - return -EIO;
21044 - }
21045 ++#define STUB(proc) \
21046 ++[NFSPROC4_CLNT_##proc] = { \
21047 ++ .p_name = #proc, \
21048 ++}
21049 ++
21050 + struct rpc_procinfo nfs4_procedures[] = {
21051 + PROC(READ, enc_read, dec_read),
21052 + PROC(WRITE, enc_write, dec_write),
21053 +@@ -7417,6 +7422,7 @@ struct rpc_procinfo nfs4_procedures[] = {
21054 + PROC(SECINFO_NO_NAME, enc_secinfo_no_name, dec_secinfo_no_name),
21055 + PROC(TEST_STATEID, enc_test_stateid, dec_test_stateid),
21056 + PROC(FREE_STATEID, enc_free_stateid, dec_free_stateid),
21057 ++ STUB(GETDEVICELIST),
21058 + PROC(BIND_CONN_TO_SESSION,
21059 + enc_bind_conn_to_session, dec_bind_conn_to_session),
21060 + PROC(DESTROY_CLIENTID, enc_destroy_clientid, dec_destroy_clientid),
21061 +diff --git a/fs/nfs/read.c b/fs/nfs/read.c
21062 +index 568ecf0..848d8b1 100644
21063 +--- a/fs/nfs/read.c
21064 ++++ b/fs/nfs/read.c
21065 +@@ -284,7 +284,7 @@ int nfs_readpage(struct file *file, struct page *page)
21066 + dprintk("NFS: nfs_readpage (%p %ld@%lu)\n",
21067 + page, PAGE_CACHE_SIZE, page_file_index(page));
21068 + nfs_inc_stats(inode, NFSIOS_VFSREADPAGE);
21069 +- nfs_inc_stats(inode, NFSIOS_READPAGES);
21070 ++ nfs_add_stats(inode, NFSIOS_READPAGES, 1);
21071
21072 - regmap_write(adv7511->regmap, ADV7511_REG_INT(0),
21073 -- ADV7511_INT0_EDID_READY | ADV7511_INT1_DDC_ERROR);
21074 -+ ADV7511_INT0_EDID_READY);
21075 -+ regmap_write(adv7511->regmap, ADV7511_REG_INT(1),
21076 -+ ADV7511_INT1_DDC_ERROR);
21077 + /*
21078 + * Try to flush any pending writes to the file..
21079 +diff --git a/fs/nfs/write.c b/fs/nfs/write.c
21080 +index 849ed78..41b3f1096 100644
21081 +--- a/fs/nfs/write.c
21082 ++++ b/fs/nfs/write.c
21083 +@@ -580,7 +580,7 @@ static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, st
21084 + int ret;
21085
21086 - /* Break this apart, hopefully more I2C controllers will
21087 - * support 64 byte transfers than 256 byte transfers
21088 -@@ -528,7 +530,9 @@ static int adv7511_get_modes(struct drm_encoder *encoder,
21089 - /* Reading the EDID only works if the device is powered */
21090 - if (adv7511->dpms_mode != DRM_MODE_DPMS_ON) {
21091 - regmap_write(adv7511->regmap, ADV7511_REG_INT(0),
21092 -- ADV7511_INT0_EDID_READY | ADV7511_INT1_DDC_ERROR);
21093 -+ ADV7511_INT0_EDID_READY);
21094 -+ regmap_write(adv7511->regmap, ADV7511_REG_INT(1),
21095 -+ ADV7511_INT1_DDC_ERROR);
21096 - regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER,
21097 - ADV7511_POWER_POWER_DOWN, 0);
21098 - adv7511->current_edid_segment = -1;
21099 -@@ -563,7 +567,9 @@ static void adv7511_encoder_dpms(struct drm_encoder *encoder, int mode)
21100 - adv7511->current_edid_segment = -1;
21101 + nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE);
21102 +- nfs_inc_stats(inode, NFSIOS_WRITEPAGES);
21103 ++ nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1);
21104
21105 - regmap_write(adv7511->regmap, ADV7511_REG_INT(0),
21106 -- ADV7511_INT0_EDID_READY | ADV7511_INT1_DDC_ERROR);
21107 -+ ADV7511_INT0_EDID_READY);
21108 -+ regmap_write(adv7511->regmap, ADV7511_REG_INT(1),
21109 -+ ADV7511_INT1_DDC_ERROR);
21110 - regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER,
21111 - ADV7511_POWER_POWER_DOWN, 0);
21112 - /*
21113 ---
21114 -2.3.6
21115 -
21116 -
21117 -From 74ed38596ea50609c61bd10f048f97d6161e73b4 Mon Sep 17 00:00:00 2001
21118 -From: Laurent Pinchart <laurent.pinchart+renesas@××××××××××××.com>
21119 -Date: Wed, 18 Feb 2015 15:19:33 +0200
21120 -Subject: [PATCH 192/219] drm: adv7511: Fix nested sleep when reading EDID
21121 -Cc: mpagano@g.o
21122 -
21123 -commit a5241289c4139f0521b89e34a70f5f998463ae15 upstream.
21124 -
21125 -The EDID read code waits for the read completion interrupt to occur
21126 -using wait_event_interruptible(). The condition passed to the macro
21127 -reads I2C registers. This results in sleeping with the task state set
21128 -to TASK_INTERRUPTIBLE, triggering a WARN_ON() introduced in commit
21129 -8eb23b9f35aae ("sched: Debug nested sleeps").
21130 -
21131 -Fix this by reworking the EDID read code. Instead of checking whether
21132 -the read is complete through I2C reads, handle the interrupt registers
21133 -in the interrupt handler and update a new edid_read flag accordingly. As
21134 -a side effect both the IRQ and polling code paths now process the
21135 -interrupt sources through the same code path, simplifying the code.
21136 -
21137 -Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@××××××××××××.com>
21138 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
21139 -Signed-off-by: Mike Pagano <mpagano@g.o>
21140 ----
21141 - drivers/gpu/drm/i2c/adv7511.c | 96 +++++++++++++++++++++----------------------
21142 - 1 file changed, 46 insertions(+), 50 deletions(-)
21143 -
21144 -diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c
21145 -index 5109c21..60ab1f7 100644
21146 ---- a/drivers/gpu/drm/i2c/adv7511.c
21147 -+++ b/drivers/gpu/drm/i2c/adv7511.c
21148 -@@ -33,6 +33,7 @@ struct adv7511 {
21149 + nfs_pageio_cond_complete(pgio, page_file_index(page));
21150 + ret = nfs_page_async_flush(pgio, page, wbc->sync_mode == WB_SYNC_NONE);
21151 +diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
21152 +index 92b9d97..5416968 100644
21153 +--- a/fs/nfsd/nfs4proc.c
21154 ++++ b/fs/nfsd/nfs4proc.c
21155 +@@ -1030,6 +1030,8 @@ nfsd4_fallocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
21156 + dprintk("NFSD: nfsd4_fallocate: couldn't process stateid!\n");
21157 + return status;
21158 + }
21159 ++ if (!file)
21160 ++ return nfserr_bad_stateid;
21161
21162 - unsigned int current_edid_segment;
21163 - uint8_t edid_buf[256];
21164 -+ bool edid_read;
21165 + status = nfsd4_vfs_fallocate(rqstp, &cstate->current_fh, file,
21166 + fallocate->falloc_offset,
21167 +@@ -1069,6 +1071,8 @@ nfsd4_seek(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
21168 + dprintk("NFSD: nfsd4_seek: couldn't process stateid!\n");
21169 + return status;
21170 + }
21171 ++ if (!file)
21172 ++ return nfserr_bad_stateid;
21173
21174 - wait_queue_head_t wq;
21175 - struct drm_encoder *encoder;
21176 -@@ -379,69 +380,71 @@ static bool adv7511_hpd(struct adv7511 *adv7511)
21177 - return false;
21178 + switch (seek->seek_whence) {
21179 + case NFS4_CONTENT_DATA:
21180 +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
21181 +index 8ba1d88..ee1cccd 100644
21182 +--- a/fs/nfsd/nfs4state.c
21183 ++++ b/fs/nfsd/nfs4state.c
21184 +@@ -1139,7 +1139,7 @@ hash_sessionid(struct nfs4_sessionid *sessionid)
21185 + return sid->sequence % SESSION_HASH_SIZE;
21186 }
21187
21188 --static irqreturn_t adv7511_irq_handler(int irq, void *devid)
21189 --{
21190 -- struct adv7511 *adv7511 = devid;
21191 --
21192 -- if (adv7511_hpd(adv7511))
21193 -- drm_helper_hpd_irq_event(adv7511->encoder->dev);
21194 --
21195 -- wake_up_all(&adv7511->wq);
21196 --
21197 -- return IRQ_HANDLED;
21198 --}
21199 --
21200 --static unsigned int adv7511_is_interrupt_pending(struct adv7511 *adv7511,
21201 -- unsigned int irq)
21202 -+static int adv7511_irq_process(struct adv7511 *adv7511)
21203 +-#ifdef NFSD_DEBUG
21204 ++#ifdef CONFIG_SUNRPC_DEBUG
21205 + static inline void
21206 + dump_sessionid(const char *fn, struct nfs4_sessionid *sessionid)
21207 {
21208 - unsigned int irq0, irq1;
21209 -- unsigned int pending;
21210 - int ret;
21211 +diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
21212 +index 5fb7e78..5b33ce1 100644
21213 +--- a/fs/nfsd/nfs4xdr.c
21214 ++++ b/fs/nfsd/nfs4xdr.c
21215 +@@ -3422,6 +3422,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
21216 + unsigned long maxcount;
21217 + struct xdr_stream *xdr = &resp->xdr;
21218 + struct file *file = read->rd_filp;
21219 ++ struct svc_fh *fhp = read->rd_fhp;
21220 + int starting_len = xdr->buf->len;
21221 + struct raparms *ra;
21222 + __be32 *p;
21223 +@@ -3445,12 +3446,15 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
21224 + maxcount = min_t(unsigned long, maxcount, (xdr->buf->buflen - xdr->buf->len));
21225 + maxcount = min_t(unsigned long, maxcount, read->rd_length);
21226 +
21227 +- if (!read->rd_filp) {
21228 ++ if (read->rd_filp)
21229 ++ err = nfsd_permission(resp->rqstp, fhp->fh_export,
21230 ++ fhp->fh_dentry,
21231 ++ NFSD_MAY_READ|NFSD_MAY_OWNER_OVERRIDE);
21232 ++ else
21233 + err = nfsd_get_tmp_read_open(resp->rqstp, read->rd_fhp,
21234 + &file, &ra);
21235 +- if (err)
21236 +- goto err_truncate;
21237 +- }
21238 ++ if (err)
21239 ++ goto err_truncate;
21240 +
21241 + if (file->f_op->splice_read && test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags))
21242 + err = nfsd4_encode_splice_read(resp, read, file, maxcount);
21243 +diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
21244 +index aa47d75..9690cb4 100644
21245 +--- a/fs/nfsd/nfsctl.c
21246 ++++ b/fs/nfsd/nfsctl.c
21247 +@@ -1250,15 +1250,15 @@ static int __init init_nfsd(void)
21248 + int retval;
21249 + printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@×××××××××.de).\n");
21250 +
21251 +- retval = register_cld_notifier();
21252 +- if (retval)
21253 +- return retval;
21254 + retval = register_pernet_subsys(&nfsd_net_ops);
21255 + if (retval < 0)
21256 +- goto out_unregister_notifier;
21257 +- retval = nfsd4_init_slabs();
21258 ++ return retval;
21259 ++ retval = register_cld_notifier();
21260 + if (retval)
21261 + goto out_unregister_pernet;
21262 ++ retval = nfsd4_init_slabs();
21263 ++ if (retval)
21264 ++ goto out_unregister_notifier;
21265 + retval = nfsd4_init_pnfs();
21266 + if (retval)
21267 + goto out_free_slabs;
21268 +@@ -1290,10 +1290,10 @@ out_exit_pnfs:
21269 + nfsd4_exit_pnfs();
21270 + out_free_slabs:
21271 + nfsd4_free_slabs();
21272 +-out_unregister_pernet:
21273 +- unregister_pernet_subsys(&nfsd_net_ops);
21274 + out_unregister_notifier:
21275 + unregister_cld_notifier();
21276 ++out_unregister_pernet:
21277 ++ unregister_pernet_subsys(&nfsd_net_ops);
21278 + return retval;
21279 + }
21280
21281 - ret = regmap_read(adv7511->regmap, ADV7511_REG_INT(0), &irq0);
21282 - if (ret < 0)
21283 -- return 0;
21284 -+ return ret;
21285 -+
21286 - ret = regmap_read(adv7511->regmap, ADV7511_REG_INT(1), &irq1);
21287 - if (ret < 0)
21288 -- return 0;
21289 -+ return ret;
21290 -+
21291 -+ regmap_write(adv7511->regmap, ADV7511_REG_INT(0), irq0);
21292 -+ regmap_write(adv7511->regmap, ADV7511_REG_INT(1), irq1);
21293 -+
21294 -+ if (irq0 & ADV7511_INT0_HDP)
21295 -+ drm_helper_hpd_irq_event(adv7511->encoder->dev);
21296 -+
21297 -+ if (irq0 & ADV7511_INT0_EDID_READY || irq1 & ADV7511_INT1_DDC_ERROR) {
21298 -+ adv7511->edid_read = true;
21299 +@@ -1308,8 +1308,8 @@ static void __exit exit_nfsd(void)
21300 + nfsd4_exit_pnfs();
21301 + nfsd_fault_inject_cleanup();
21302 + unregister_filesystem(&nfsd_fs_type);
21303 +- unregister_pernet_subsys(&nfsd_net_ops);
21304 + unregister_cld_notifier();
21305 ++ unregister_pernet_subsys(&nfsd_net_ops);
21306 + }
21307
21308 -- pending = (irq1 << 8) | irq0;
21309 -+ if (adv7511->i2c_main->irq)
21310 -+ wake_up_all(&adv7511->wq);
21311 -+ }
21312 + MODULE_AUTHOR("Olaf Kirch <okir@×××××××××.de>");
21313 +diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
21314 +index 565c4da..cf98052 100644
21315 +--- a/fs/nfsd/nfsd.h
21316 ++++ b/fs/nfsd/nfsd.h
21317 +@@ -24,7 +24,7 @@
21318 + #include "export.h"
21319
21320 -- return pending & irq;
21321 -+ return 0;
21322 + #undef ifdebug
21323 +-#ifdef NFSD_DEBUG
21324 ++#ifdef CONFIG_SUNRPC_DEBUG
21325 + # define ifdebug(flag) if (nfsd_debug & NFSDDBG_##flag)
21326 + #else
21327 + # define ifdebug(flag) if (0)
21328 +diff --git a/fs/open.c b/fs/open.c
21329 +index 33f9cbf..44a3be1 100644
21330 +--- a/fs/open.c
21331 ++++ b/fs/open.c
21332 +@@ -570,6 +570,7 @@ static int chown_common(struct path *path, uid_t user, gid_t group)
21333 + uid = make_kuid(current_user_ns(), user);
21334 + gid = make_kgid(current_user_ns(), group);
21335 +
21336 ++retry_deleg:
21337 + newattrs.ia_valid = ATTR_CTIME;
21338 + if (user != (uid_t) -1) {
21339 + if (!uid_valid(uid))
21340 +@@ -586,7 +587,6 @@ static int chown_common(struct path *path, uid_t user, gid_t group)
21341 + if (!S_ISDIR(inode->i_mode))
21342 + newattrs.ia_valid |=
21343 + ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV;
21344 +-retry_deleg:
21345 + mutex_lock(&inode->i_mutex);
21346 + error = security_path_chown(path, uid, gid);
21347 + if (!error)
21348 +diff --git a/fs/pnode.c b/fs/pnode.c
21349 +index 260ac8f..6367e1e 100644
21350 +--- a/fs/pnode.c
21351 ++++ b/fs/pnode.c
21352 +@@ -362,6 +362,46 @@ int propagate_mount_busy(struct mount *mnt, int refcnt)
21353 }
21354
21355 --static int adv7511_wait_for_interrupt(struct adv7511 *adv7511, int irq,
21356 -- int timeout)
21357 -+static irqreturn_t adv7511_irq_handler(int irq, void *devid)
21358 + /*
21359 ++ * Clear MNT_LOCKED when it can be shown to be safe.
21360 ++ *
21361 ++ * mount_lock lock must be held for write
21362 ++ */
21363 ++void propagate_mount_unlock(struct mount *mnt)
21364 +{
21365 -+ struct adv7511 *adv7511 = devid;
21366 -+ int ret;
21367 ++ struct mount *parent = mnt->mnt_parent;
21368 ++ struct mount *m, *child;
21369 +
21370 -+ ret = adv7511_irq_process(adv7511);
21371 -+ return ret < 0 ? IRQ_NONE : IRQ_HANDLED;
21372 ++ BUG_ON(parent == mnt);
21373 ++
21374 ++ for (m = propagation_next(parent, parent); m;
21375 ++ m = propagation_next(m, parent)) {
21376 ++ child = __lookup_mnt_last(&m->mnt, mnt->mnt_mountpoint);
21377 ++ if (child)
21378 ++ child->mnt.mnt_flags &= ~MNT_LOCKED;
21379 ++ }
21380 +}
21381 +
21382 -+/* -----------------------------------------------------------------------------
21383 -+ * EDID retrieval
21384 ++/*
21385 ++ * Mark all mounts that the MNT_LOCKED logic will allow to be unmounted.
21386 + */
21387 ++static void mark_umount_candidates(struct mount *mnt)
21388 ++{
21389 ++ struct mount *parent = mnt->mnt_parent;
21390 ++ struct mount *m;
21391 +
21392 -+static int adv7511_wait_for_edid(struct adv7511 *adv7511, int timeout)
21393 - {
21394 -- unsigned int pending;
21395 - int ret;
21396 -
21397 - if (adv7511->i2c_main->irq) {
21398 - ret = wait_event_interruptible_timeout(adv7511->wq,
21399 -- adv7511_is_interrupt_pending(adv7511, irq),
21400 -- msecs_to_jiffies(timeout));
21401 -- if (ret <= 0)
21402 -- return 0;
21403 -- pending = adv7511_is_interrupt_pending(adv7511, irq);
21404 -+ adv7511->edid_read, msecs_to_jiffies(timeout));
21405 - } else {
21406 -- if (timeout < 25)
21407 -- timeout = 25;
21408 -- do {
21409 -- pending = adv7511_is_interrupt_pending(adv7511, irq);
21410 -- if (pending)
21411 -+ for (; timeout > 0; timeout -= 25) {
21412 -+ ret = adv7511_irq_process(adv7511);
21413 -+ if (ret < 0)
21414 -+ break;
21415 -+
21416 -+ if (adv7511->edid_read)
21417 - break;
21418 ++ BUG_ON(parent == mnt);
21419 +
21420 - msleep(25);
21421 -- timeout -= 25;
21422 -- } while (timeout >= 25);
21423 ++ for (m = propagation_next(parent, parent); m;
21424 ++ m = propagation_next(m, parent)) {
21425 ++ struct mount *child = __lookup_mnt_last(&m->mnt,
21426 ++ mnt->mnt_mountpoint);
21427 ++ if (child && (!IS_MNT_LOCKED(child) || IS_MNT_MARKED(m))) {
21428 ++ SET_MNT_MARK(child);
21429 + }
21430 ++ }
21431 ++}
21432 ++
21433 ++/*
21434 + * NOTE: unmounting 'mnt' naturally propagates to all other mounts its
21435 + * parent propagates to.
21436 + */
21437 +@@ -378,13 +418,16 @@ static void __propagate_umount(struct mount *mnt)
21438 + struct mount *child = __lookup_mnt_last(&m->mnt,
21439 + mnt->mnt_mountpoint);
21440 + /*
21441 +- * umount the child only if the child has no
21442 +- * other children
21443 ++ * umount the child only if the child has no children
21444 ++ * and the child is marked safe to unmount.
21445 + */
21446 +- if (child && list_empty(&child->mnt_mounts)) {
21447 ++ if (!child || !IS_MNT_MARKED(child))
21448 ++ continue;
21449 ++ CLEAR_MNT_MARK(child);
21450 ++ if (list_empty(&child->mnt_mounts)) {
21451 + list_del_init(&child->mnt_child);
21452 +- hlist_del_init_rcu(&child->mnt_hash);
21453 +- hlist_add_before_rcu(&child->mnt_hash, &mnt->mnt_hash);
21454 ++ child->mnt.mnt_flags |= MNT_UMOUNT;
21455 ++ list_move_tail(&child->mnt_list, &mnt->mnt_list);
21456 + }
21457 }
21458 + }
21459 +@@ -396,11 +439,14 @@ static void __propagate_umount(struct mount *mnt)
21460 + *
21461 + * vfsmount lock must be held for write
21462 + */
21463 +-int propagate_umount(struct hlist_head *list)
21464 ++int propagate_umount(struct list_head *list)
21465 + {
21466 + struct mount *mnt;
21467
21468 -- return pending;
21469 -+ return adv7511->edid_read ? 0 : -EIO;
21470 +- hlist_for_each_entry(mnt, list, mnt_hash)
21471 ++ list_for_each_entry_reverse(mnt, list, mnt_list)
21472 ++ mark_umount_candidates(mnt);
21473 ++
21474 ++ list_for_each_entry(mnt, list, mnt_list)
21475 + __propagate_umount(mnt);
21476 + return 0;
21477 }
21478 +diff --git a/fs/pnode.h b/fs/pnode.h
21479 +index 4a24635..7114ce6 100644
21480 +--- a/fs/pnode.h
21481 ++++ b/fs/pnode.h
21482 +@@ -19,6 +19,9 @@
21483 + #define IS_MNT_MARKED(m) ((m)->mnt.mnt_flags & MNT_MARKED)
21484 + #define SET_MNT_MARK(m) ((m)->mnt.mnt_flags |= MNT_MARKED)
21485 + #define CLEAR_MNT_MARK(m) ((m)->mnt.mnt_flags &= ~MNT_MARKED)
21486 ++#define IS_MNT_LOCKED(m) ((m)->mnt.mnt_flags & MNT_LOCKED)
21487 ++#define IS_MNT_LOCKED_AND_LAZY(m) \
21488 ++ (((m)->mnt.mnt_flags & (MNT_LOCKED|MNT_SYNC_UMOUNT)) == MNT_LOCKED)
21489
21490 --/* -----------------------------------------------------------------------------
21491 -- * EDID retrieval
21492 -- */
21493 --
21494 - static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block,
21495 - size_t len)
21496 - {
21497 -@@ -463,21 +466,14 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block,
21498 - return ret;
21499 + #define CL_EXPIRE 0x01
21500 + #define CL_SLAVE 0x02
21501 +@@ -40,14 +43,14 @@ static inline void set_mnt_shared(struct mount *mnt)
21502 + void change_mnt_propagation(struct mount *, int);
21503 + int propagate_mnt(struct mount *, struct mountpoint *, struct mount *,
21504 + struct hlist_head *);
21505 +-int propagate_umount(struct hlist_head *);
21506 ++int propagate_umount(struct list_head *);
21507 + int propagate_mount_busy(struct mount *, int);
21508 ++void propagate_mount_unlock(struct mount *);
21509 + void mnt_release_group_id(struct mount *);
21510 + int get_dominating_id(struct mount *mnt, const struct path *root);
21511 + unsigned int mnt_get_count(struct mount *mnt);
21512 + void mnt_set_mountpoint(struct mount *, struct mountpoint *,
21513 + struct mount *);
21514 +-void umount_tree(struct mount *, int);
21515 + struct mount *copy_tree(struct mount *, struct dentry *, int);
21516 + bool is_path_reachable(struct mount *, struct dentry *,
21517 + const struct path *root);
21518 +diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
21519 +index b034f10..0d58525 100644
21520 +--- a/include/acpi/actypes.h
21521 ++++ b/include/acpi/actypes.h
21522 +@@ -199,9 +199,29 @@ typedef int s32;
21523 + typedef s32 acpi_native_int;
21524
21525 - if (status != 2) {
21526 -+ adv7511->edid_read = false;
21527 - regmap_write(adv7511->regmap, ADV7511_REG_EDID_SEGMENT,
21528 - block);
21529 -- ret = adv7511_wait_for_interrupt(adv7511,
21530 -- ADV7511_INT0_EDID_READY |
21531 -- (ADV7511_INT1_DDC_ERROR << 8), 200);
21532 --
21533 -- if (!(ret & ADV7511_INT0_EDID_READY))
21534 -- return -EIO;
21535 -+ ret = adv7511_wait_for_edid(adv7511, 200);
21536 -+ if (ret < 0)
21537 -+ return ret;
21538 - }
21539 + typedef u32 acpi_size;
21540 ++
21541 ++#ifdef ACPI_32BIT_PHYSICAL_ADDRESS
21542 ++
21543 ++/*
21544 ++ * OSPMs can define this to shrink the size of the structures for 32-bit
21545 ++ * none PAE environment. ASL compiler may always define this to generate
21546 ++ * 32-bit OSPM compliant tables.
21547 ++ */
21548 + typedef u32 acpi_io_address;
21549 + typedef u32 acpi_physical_address;
21550 +
21551 ++#else /* ACPI_32BIT_PHYSICAL_ADDRESS */
21552 ++
21553 ++/*
21554 ++ * It is reported that, after some calculations, the physical addresses can
21555 ++ * wrap over the 32-bit boundary on 32-bit PAE environment.
21556 ++ * https://bugzilla.kernel.org/show_bug.cgi?id=87971
21557 ++ */
21558 ++typedef u64 acpi_io_address;
21559 ++typedef u64 acpi_physical_address;
21560 ++
21561 ++#endif /* ACPI_32BIT_PHYSICAL_ADDRESS */
21562 ++
21563 + #define ACPI_MAX_PTR ACPI_UINT32_MAX
21564 + #define ACPI_SIZE_MAX ACPI_UINT32_MAX
21565
21566 -- regmap_write(adv7511->regmap, ADV7511_REG_INT(0),
21567 -- ADV7511_INT0_EDID_READY);
21568 -- regmap_write(adv7511->regmap, ADV7511_REG_INT(1),
21569 -- ADV7511_INT1_DDC_ERROR);
21570 +@@ -736,10 +756,6 @@ typedef u32 acpi_event_status;
21571 + #define ACPI_GPE_ENABLE 0
21572 + #define ACPI_GPE_DISABLE 1
21573 + #define ACPI_GPE_CONDITIONAL_ENABLE 2
21574 +-#define ACPI_GPE_SAVE_MASK 4
21575 -
21576 - /* Break this apart, hopefully more I2C controllers will
21577 - * support 64 byte transfers than 256 byte transfers
21578 - */
21579 ---
21580 -2.3.6
21581 -
21582 -
21583 -From 959905cf28ee80f8830b717f4e1ac28a61732974 Mon Sep 17 00:00:00 2001
21584 -From: Imre Deak <imre.deak@×××××.com>
21585 -Date: Wed, 15 Apr 2015 16:52:30 -0700
21586 -Subject: [PATCH 193/219] drm/i915: vlv: fix save/restore of GFX_MAX_REQ_COUNT
21587 - reg
21588 -Cc: mpagano@g.o
21589 -
21590 -commit b5f1c97f944482e98e6e39208af356630389d1ea upstream.
21591 -
21592 -Due this typo we don't save/restore the GFX_MAX_REQ_COUNT register across
21593 -suspend/resume, so fix this.
21594 -
21595 -This was introduced in
21596 -
21597 -commit ddeea5b0c36f3665446518c609be91f9336ef674
21598 -Author: Imre Deak <imre.deak@×××××.com>
21599 -Date: Mon May 5 15:19:56 2014 +0300
21600 -
21601 - drm/i915: vlv: add runtime PM support
21602 -
21603 -I noticed this only by reading the code. To my knowledge it shouldn't
21604 -cause any real problems at the moment, since the power well backing this
21605 -register remains on across a runtime s/r. This may change once
21606 -system-wide s0ix functionality is enabled in the kernel.
21607 -
21608 -v2:
21609 -- resend after a missing git add -u :/
21610 -
21611 -Signed-off-by: Imre Deak <imre.deak@×××××.com>
21612 -Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@×××××.com)
21613 -Signed-off-by: Rodrigo Vivi <rodrigo.vivi@×××××.com>
21614 -Reviewed-by: Mika Kuoppala <mika.kuoppala@×××××.com>
21615 -Signed-off-by: Jani Nikula <jani.nikula@×××××.com>
21616 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
21617 -Signed-off-by: Mike Pagano <mpagano@g.o>
21618 ----
21619 - drivers/gpu/drm/i915/i915_drv.c | 4 ++--
21620 - 1 file changed, 2 insertions(+), 2 deletions(-)
21621 -
21622 -diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
21623 -index 5c66b56..ec4d932 100644
21624 ---- a/drivers/gpu/drm/i915/i915_drv.c
21625 -+++ b/drivers/gpu/drm/i915/i915_drv.c
21626 -@@ -1042,7 +1042,7 @@ static void vlv_save_gunit_s0ix_state(struct drm_i915_private *dev_priv)
21627 - s->lra_limits[i] = I915_READ(GEN7_LRA_LIMITS_BASE + i * 4);
21628 +-#define ACPI_GPE_ENABLE_SAVE (ACPI_GPE_ENABLE | ACPI_GPE_SAVE_MASK)
21629 +-#define ACPI_GPE_DISABLE_SAVE (ACPI_GPE_DISABLE | ACPI_GPE_SAVE_MASK)
21630
21631 - s->media_max_req_count = I915_READ(GEN7_MEDIA_MAX_REQ_COUNT);
21632 -- s->gfx_max_req_count = I915_READ(GEN7_MEDIA_MAX_REQ_COUNT);
21633 -+ s->gfx_max_req_count = I915_READ(GEN7_GFX_MAX_REQ_COUNT);
21634 + /*
21635 + * GPE info flags - Per GPE
21636 +diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
21637 +index ad74dc5..ecdf940 100644
21638 +--- a/include/acpi/platform/acenv.h
21639 ++++ b/include/acpi/platform/acenv.h
21640 +@@ -76,6 +76,7 @@
21641 + #define ACPI_LARGE_NAMESPACE_NODE
21642 + #define ACPI_DATA_TABLE_DISASSEMBLY
21643 + #define ACPI_SINGLE_THREADED
21644 ++#define ACPI_32BIT_PHYSICAL_ADDRESS
21645 + #endif
21646
21647 - s->render_hwsp = I915_READ(RENDER_HWS_PGA_GEN7);
21648 - s->ecochk = I915_READ(GAM_ECOCHK);
21649 -@@ -1124,7 +1124,7 @@ static void vlv_restore_gunit_s0ix_state(struct drm_i915_private *dev_priv)
21650 - I915_WRITE(GEN7_LRA_LIMITS_BASE + i * 4, s->lra_limits[i]);
21651 + /* acpi_exec configuration. Multithreaded with full AML debugger */
21652 +diff --git a/include/dt-bindings/clock/tegra124-car-common.h b/include/dt-bindings/clock/tegra124-car-common.h
21653 +index ae2eb17..a215609 100644
21654 +--- a/include/dt-bindings/clock/tegra124-car-common.h
21655 ++++ b/include/dt-bindings/clock/tegra124-car-common.h
21656 +@@ -297,7 +297,7 @@
21657 + #define TEGRA124_CLK_PLL_C4 270
21658 + #define TEGRA124_CLK_PLL_DP 271
21659 + #define TEGRA124_CLK_PLL_E_MUX 272
21660 +-#define TEGRA124_CLK_PLLD_DSI 273
21661 ++#define TEGRA124_CLK_PLL_D_DSI_OUT 273
21662 + /* 274 */
21663 + /* 275 */
21664 + /* 276 */
21665 +diff --git a/include/linux/bpf.h b/include/linux/bpf.h
21666 +index bbfceb7..33b52fb 100644
21667 +--- a/include/linux/bpf.h
21668 ++++ b/include/linux/bpf.h
21669 +@@ -48,7 +48,7 @@ struct bpf_map *bpf_map_get(struct fd f);
21670
21671 - I915_WRITE(GEN7_MEDIA_MAX_REQ_COUNT, s->media_max_req_count);
21672 -- I915_WRITE(GEN7_MEDIA_MAX_REQ_COUNT, s->gfx_max_req_count);
21673 -+ I915_WRITE(GEN7_GFX_MAX_REQ_COUNT, s->gfx_max_req_count);
21674 + /* function argument constraints */
21675 + enum bpf_arg_type {
21676 +- ARG_ANYTHING = 0, /* any argument is ok */
21677 ++ ARG_DONTCARE = 0, /* unused argument in helper function */
21678
21679 - I915_WRITE(RENDER_HWS_PGA_GEN7, s->render_hwsp);
21680 - I915_WRITE(GAM_ECOCHK, s->ecochk);
21681 ---
21682 -2.3.6
21683 -
21684 -
21685 -From 0f14e0aa4e606b77387e807b89a0ee8faf10accb Mon Sep 17 00:00:00 2001
21686 -From: Dmitry Torokhov <dmitry.torokhov@×××××.com>
21687 -Date: Tue, 21 Apr 2015 09:49:11 -0700
21688 -Subject: [PATCH 194/219] drm/i915: cope with large i2c transfers
21689 -Cc: mpagano@g.o
21690 -
21691 -commit 9535c4757b881e06fae72a857485ad57c422b8d2 upstream.
21692 -
21693 -The hardware, according to the specs, is limited to 256 byte transfers,
21694 -and current driver has no protections in case users attempt to do larger
21695 -transfers. The code will just stomp over status register and mayhem
21696 -ensues.
21697 -
21698 -Let's split larger transfers into digestable chunks. Doing this allows
21699 -Atmel MXT driver on Pixel 1 function properly (it hasn't since commit
21700 -9d8dc3e529a19e427fd379118acd132520935c5d "Input: atmel_mxt_ts -
21701 -implement T44 message handling" which tries to consume multiple
21702 -touchscreen/touchpad reports in a single transaction).
21703 -
21704 -Reviewed-by: Chris Wilson <chris@×××××××××××××××.uk>
21705 -Signed-off-by: Dmitry Torokhov <dmitry.torokhov@×××××.com>
21706 -Signed-off-by: Jani Nikula <jani.nikula@×××××.com>
21707 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
21708 -Signed-off-by: Mike Pagano <mpagano@g.o>
21709 ----
21710 - drivers/gpu/drm/i915/i915_reg.h | 1 +
21711 - drivers/gpu/drm/i915/intel_i2c.c | 66 ++++++++++++++++++++++++++++++++++------
21712 - 2 files changed, 57 insertions(+), 10 deletions(-)
21713 -
21714 -diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
21715 -index 33b3d0a2..f536ff2 100644
21716 ---- a/drivers/gpu/drm/i915/i915_reg.h
21717 -+++ b/drivers/gpu/drm/i915/i915_reg.h
21718 -@@ -1740,6 +1740,7 @@ enum punit_power_well {
21719 - #define GMBUS_CYCLE_INDEX (2<<25)
21720 - #define GMBUS_CYCLE_STOP (4<<25)
21721 - #define GMBUS_BYTE_COUNT_SHIFT 16
21722 -+#define GMBUS_BYTE_COUNT_MAX 256U
21723 - #define GMBUS_SLAVE_INDEX_SHIFT 8
21724 - #define GMBUS_SLAVE_ADDR_SHIFT 1
21725 - #define GMBUS_SLAVE_READ (1<<0)
21726 -diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
21727 -index b31088a..56e437e 100644
21728 ---- a/drivers/gpu/drm/i915/intel_i2c.c
21729 -+++ b/drivers/gpu/drm/i915/intel_i2c.c
21730 -@@ -270,18 +270,17 @@ gmbus_wait_idle(struct drm_i915_private *dev_priv)
21731 - }
21732 + /* the following constraints used to prototype
21733 + * bpf_map_lookup/update/delete_elem() functions
21734 +@@ -62,6 +62,8 @@ enum bpf_arg_type {
21735 + */
21736 + ARG_PTR_TO_STACK, /* any pointer to eBPF program stack */
21737 + ARG_CONST_STACK_SIZE, /* number of bytes accessed from stack */
21738 ++
21739 ++ ARG_ANYTHING, /* any (initialized) argument is ok */
21740 + };
21741
21742 - static int
21743 --gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg,
21744 -- u32 gmbus1_index)
21745 -+gmbus_xfer_read_chunk(struct drm_i915_private *dev_priv,
21746 -+ unsigned short addr, u8 *buf, unsigned int len,
21747 -+ u32 gmbus1_index)
21748 - {
21749 - int reg_offset = dev_priv->gpio_mmio_base;
21750 -- u16 len = msg->len;
21751 -- u8 *buf = msg->buf;
21752 + /* type of values returned from helper functions */
21753 +diff --git a/include/linux/mount.h b/include/linux/mount.h
21754 +index c2c561d..564beee 100644
21755 +--- a/include/linux/mount.h
21756 ++++ b/include/linux/mount.h
21757 +@@ -61,6 +61,7 @@ struct mnt_namespace;
21758 + #define MNT_DOOMED 0x1000000
21759 + #define MNT_SYNC_UMOUNT 0x2000000
21760 + #define MNT_MARKED 0x4000000
21761 ++#define MNT_UMOUNT 0x8000000
21762
21763 - I915_WRITE(GMBUS1 + reg_offset,
21764 - gmbus1_index |
21765 - GMBUS_CYCLE_WAIT |
21766 - (len << GMBUS_BYTE_COUNT_SHIFT) |
21767 -- (msg->addr << GMBUS_SLAVE_ADDR_SHIFT) |
21768 -+ (addr << GMBUS_SLAVE_ADDR_SHIFT) |
21769 - GMBUS_SLAVE_READ | GMBUS_SW_RDY);
21770 - while (len) {
21771 - int ret;
21772 -@@ -303,11 +302,35 @@ gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg,
21773 - }
21774 + struct vfsmount {
21775 + struct dentry *mnt_root; /* root of the mounted tree */
21776 +diff --git a/include/linux/sched.h b/include/linux/sched.h
21777 +index a419b65..51348f7 100644
21778 +--- a/include/linux/sched.h
21779 ++++ b/include/linux/sched.h
21780 +@@ -176,6 +176,14 @@ extern void get_iowait_load(unsigned long *nr_waiters, unsigned long *load);
21781 + extern void calc_global_load(unsigned long ticks);
21782 + extern void update_cpu_load_nohz(void);
21783
21784 - static int
21785 --gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg)
21786 -+gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg,
21787 -+ u32 gmbus1_index)
21788 - {
21789 -- int reg_offset = dev_priv->gpio_mmio_base;
21790 -- u16 len = msg->len;
21791 - u8 *buf = msg->buf;
21792 -+ unsigned int rx_size = msg->len;
21793 -+ unsigned int len;
21794 -+ int ret;
21795 -+
21796 -+ do {
21797 -+ len = min(rx_size, GMBUS_BYTE_COUNT_MAX);
21798 -+
21799 -+ ret = gmbus_xfer_read_chunk(dev_priv, msg->addr,
21800 -+ buf, len, gmbus1_index);
21801 -+ if (ret)
21802 -+ return ret;
21803 -+
21804 -+ rx_size -= len;
21805 -+ buf += len;
21806 -+ } while (rx_size != 0);
21807 -+
21808 -+ return 0;
21809 -+}
21810 ++/* Notifier for when a task gets migrated to a new CPU */
21811 ++struct task_migration_notifier {
21812 ++ struct task_struct *task;
21813 ++ int from_cpu;
21814 ++ int to_cpu;
21815 ++};
21816 ++extern void register_task_migration_notifier(struct notifier_block *n);
21817 +
21818 -+static int
21819 -+gmbus_xfer_write_chunk(struct drm_i915_private *dev_priv,
21820 -+ unsigned short addr, u8 *buf, unsigned int len)
21821 -+{
21822 -+ int reg_offset = dev_priv->gpio_mmio_base;
21823 -+ unsigned int chunk_size = len;
21824 - u32 val, loop;
21825 + extern unsigned long get_parent_ip(unsigned long addr);
21826
21827 - val = loop = 0;
21828 -@@ -319,8 +342,8 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg)
21829 - I915_WRITE(GMBUS3 + reg_offset, val);
21830 - I915_WRITE(GMBUS1 + reg_offset,
21831 - GMBUS_CYCLE_WAIT |
21832 -- (msg->len << GMBUS_BYTE_COUNT_SHIFT) |
21833 -- (msg->addr << GMBUS_SLAVE_ADDR_SHIFT) |
21834 -+ (chunk_size << GMBUS_BYTE_COUNT_SHIFT) |
21835 -+ (addr << GMBUS_SLAVE_ADDR_SHIFT) |
21836 - GMBUS_SLAVE_WRITE | GMBUS_SW_RDY);
21837 - while (len) {
21838 - int ret;
21839 -@@ -337,6 +360,29 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg)
21840 - if (ret)
21841 - return ret;
21842 - }
21843 -+
21844 -+ return 0;
21845 -+}
21846 -+
21847 -+static int
21848 -+gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg)
21849 + extern void dump_cpu_task(int cpu);
21850 +diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
21851 +index f54d665..bdccc4b 100644
21852 +--- a/include/linux/skbuff.h
21853 ++++ b/include/linux/skbuff.h
21854 +@@ -769,6 +769,7 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from,
21855 +
21856 + struct sk_buff *__alloc_skb(unsigned int size, gfp_t priority, int flags,
21857 + int node);
21858 ++struct sk_buff *__build_skb(void *data, unsigned int frag_size);
21859 + struct sk_buff *build_skb(void *data, unsigned int frag_size);
21860 + static inline struct sk_buff *alloc_skb(unsigned int size,
21861 + gfp_t priority)
21862 +@@ -3013,6 +3014,18 @@ static inline bool __skb_checksum_validate_needed(struct sk_buff *skb,
21863 + */
21864 + #define CHECKSUM_BREAK 76
21865 +
21866 ++/* Unset checksum-complete
21867 ++ *
21868 ++ * Unset checksum complete can be done when packet is being modified
21869 ++ * (uncompressed for instance) and checksum-complete value is
21870 ++ * invalidated.
21871 ++ */
21872 ++static inline void skb_checksum_complete_unset(struct sk_buff *skb)
21873 +{
21874 -+ u8 *buf = msg->buf;
21875 -+ unsigned int tx_size = msg->len;
21876 -+ unsigned int len;
21877 -+ int ret;
21878 -+
21879 -+ do {
21880 -+ len = min(tx_size, GMBUS_BYTE_COUNT_MAX);
21881 -+
21882 -+ ret = gmbus_xfer_write_chunk(dev_priv, msg->addr, buf, len);
21883 -+ if (ret)
21884 -+ return ret;
21885 ++ if (skb->ip_summed == CHECKSUM_COMPLETE)
21886 ++ skb->ip_summed = CHECKSUM_NONE;
21887 ++}
21888 +
21889 -+ buf += len;
21890 -+ tx_size -= len;
21891 -+ } while (tx_size != 0);
21892 + /* Validate (init) checksum based on checksum complete.
21893 + *
21894 + * Return values:
21895 +diff --git a/include/linux/usb.h b/include/linux/usb.h
21896 +index 7ee1b5c..447fe29 100644
21897 +--- a/include/linux/usb.h
21898 ++++ b/include/linux/usb.h
21899 +@@ -205,6 +205,32 @@ void usb_put_intf(struct usb_interface *intf);
21900 + #define USB_MAXINTERFACES 32
21901 + #define USB_MAXIADS (USB_MAXINTERFACES/2)
21902 +
21903 ++/*
21904 ++ * USB Resume Timer: Every Host controller driver should drive the resume
21905 ++ * signalling on the bus for the amount of time defined by this macro.
21906 ++ *
21907 ++ * That way we will have a 'stable' behavior among all HCDs supported by Linux.
21908 ++ *
21909 ++ * Note that the USB Specification states we should drive resume for *at least*
21910 ++ * 20 ms, but it doesn't give an upper bound. This creates two possible
21911 ++ * situations which we want to avoid:
21912 ++ *
21913 ++ * (a) sometimes an msleep(20) might expire slightly before 20 ms, which causes
21914 ++ * us to fail USB Electrical Tests, thus failing Certification
21915 ++ *
21916 ++ * (b) Some (many) devices actually need more than 20 ms of resume signalling,
21917 ++ * and while we can argue that's against the USB Specification, we don't have
21918 ++ * control over which devices a certification laboratory will be using for
21919 ++ * certification. If CertLab uses a device which was tested against Windows and
21920 ++ * that happens to have relaxed resume signalling rules, we might fall into
21921 ++ * situations where we fail interoperability and electrical tests.
21922 ++ *
21923 ++ * In order to avoid both conditions, we're using a 40 ms resume timeout, which
21924 ++ * should cope with both LPJ calibration errors and devices not following every
21925 ++ * detail of the USB Specification.
21926 ++ */
21927 ++#define USB_RESUME_TIMEOUT 40 /* ms */
21928 +
21929 - return 0;
21930 - }
21931 + /**
21932 + * struct usb_interface_cache - long-term representation of a device interface
21933 + * @num_altsetting: number of altsettings defined.
21934 +diff --git a/include/target/iscsi/iscsi_target_core.h b/include/target/iscsi/iscsi_target_core.h
21935 +index d3583d3..dd0f3ab 100644
21936 +--- a/include/target/iscsi/iscsi_target_core.h
21937 ++++ b/include/target/iscsi/iscsi_target_core.h
21938 +@@ -602,6 +602,11 @@ struct iscsi_conn {
21939 + struct iscsi_session *sess;
21940 + /* Pointer to thread_set in use for this conn's threads */
21941 + struct iscsi_thread_set *thread_set;
21942 ++ int bitmap_id;
21943 ++ int rx_thread_active;
21944 ++ struct task_struct *rx_thread;
21945 ++ int tx_thread_active;
21946 ++ struct task_struct *tx_thread;
21947 + /* list_head for session connection list */
21948 + struct list_head conn_list;
21949 + } ____cacheline_aligned;
21950 +@@ -871,10 +876,12 @@ struct iscsit_global {
21951 + /* Unique identifier used for the authentication daemon */
21952 + u32 auth_id;
21953 + u32 inactive_ts;
21954 ++#define ISCSIT_BITMAP_BITS 262144
21955 + /* Thread Set bitmap count */
21956 + int ts_bitmap_count;
21957 + /* Thread Set bitmap pointer */
21958 + unsigned long *ts_bitmap;
21959 ++ spinlock_t ts_bitmap_lock;
21960 + /* Used for iSCSI discovery session authentication */
21961 + struct iscsi_node_acl discovery_acl;
21962 + struct iscsi_portal_group *discovery_tpg;
21963 +diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
21964 +index 672150b..985ca4c 100644
21965 +--- a/include/target/target_core_base.h
21966 ++++ b/include/target/target_core_base.h
21967 +@@ -524,7 +524,7 @@ struct se_cmd {
21968 + sense_reason_t (*execute_cmd)(struct se_cmd *);
21969 + sense_reason_t (*execute_rw)(struct se_cmd *, struct scatterlist *,
21970 + u32, enum dma_data_direction);
21971 +- sense_reason_t (*transport_complete_callback)(struct se_cmd *);
21972 ++ sense_reason_t (*transport_complete_callback)(struct se_cmd *, bool);
21973
21974 ---
21975 -2.3.6
21976 -
21977 -
21978 -From f5e360ea796b5833aa7ddf281ed49d72f9eba1e3 Mon Sep 17 00:00:00 2001
21979 -From: Al Viro <viro@×××××××××××××××.uk>
21980 -Date: Fri, 24 Apr 2015 15:47:07 -0400
21981 -Subject: [PATCH 195/219] RCU pathwalk breakage when running into a symlink
21982 - overmounting something
21983 -Cc: mpagano@g.o
21984 -
21985 -commit 3cab989afd8d8d1bc3d99fef0e7ed87c31e7b647 upstream.
21986 -
21987 -Calling unlazy_walk() in walk_component() and do_last() when we find
21988 -a symlink that needs to be followed doesn't acquire a reference to vfsmount.
21989 -That's fine when the symlink is on the same vfsmount as the parent directory
21990 -(which is almost always the case), but it's not always true - one _can_
21991 -manage to bind a symlink on top of something. And in such cases we end up
21992 -with excessive mntput().
21993 -
21994 -Signed-off-by: Al Viro <viro@×××××××××××××××.uk>
21995 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
21996 -Signed-off-by: Mike Pagano <mpagano@g.o>
21997 ----
21998 - fs/namei.c | 6 ++++--
21999 - 1 file changed, 4 insertions(+), 2 deletions(-)
22000 -
22001 -diff --git a/fs/namei.c b/fs/namei.c
22002 -index c83145a..caa38a2 100644
22003 ---- a/fs/namei.c
22004 -+++ b/fs/namei.c
22005 -@@ -1591,7 +1591,8 @@ static inline int walk_component(struct nameidata *nd, struct path *path,
22006 + unsigned char *t_task_cdb;
22007 + unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
22008 +diff --git a/include/uapi/linux/nfsd/debug.h b/include/uapi/linux/nfsd/debug.h
22009 +index 0bf130a..28ec6c9 100644
22010 +--- a/include/uapi/linux/nfsd/debug.h
22011 ++++ b/include/uapi/linux/nfsd/debug.h
22012 +@@ -12,14 +12,6 @@
22013 + #include <linux/sunrpc/debug.h>
22014
22015 - if (should_follow_link(path->dentry, follow)) {
22016 - if (nd->flags & LOOKUP_RCU) {
22017 -- if (unlikely(unlazy_walk(nd, path->dentry))) {
22018 -+ if (unlikely(nd->path.mnt != path->mnt ||
22019 -+ unlazy_walk(nd, path->dentry))) {
22020 - err = -ECHILD;
22021 - goto out_err;
22022 - }
22023 -@@ -3047,7 +3048,8 @@ finish_lookup:
22024 + /*
22025 +- * Enable debugging for nfsd.
22026 +- * Requires RPC_DEBUG.
22027 +- */
22028 +-#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
22029 +-# define NFSD_DEBUG 1
22030 +-#endif
22031 +-
22032 +-/*
22033 + * knfsd debug flags
22034 + */
22035 + #define NFSDDBG_SOCK 0x0001
22036 +diff --git a/include/video/samsung_fimd.h b/include/video/samsung_fimd.h
22037 +index a20e4a3..847a0a2 100644
22038 +--- a/include/video/samsung_fimd.h
22039 ++++ b/include/video/samsung_fimd.h
22040 +@@ -436,6 +436,12 @@
22041 + #define BLENDCON_NEW_8BIT_ALPHA_VALUE (1 << 0)
22042 + #define BLENDCON_NEW_4BIT_ALPHA_VALUE (0 << 0)
22043
22044 - if (should_follow_link(path->dentry, !symlink_ok)) {
22045 - if (nd->flags & LOOKUP_RCU) {
22046 -- if (unlikely(unlazy_walk(nd, path->dentry))) {
22047 -+ if (unlikely(nd->path.mnt != path->mnt ||
22048 -+ unlazy_walk(nd, path->dentry))) {
22049 - error = -ECHILD;
22050 - goto out;
22051 - }
22052 ---
22053 -2.3.6
22054 -
22055 -
22056 -From 04dcce2b2b45c99fdaebd0baa19640674ea388f4 Mon Sep 17 00:00:00 2001
22057 -From: Nicolas Iooss <nicolas.iooss_linux@×××.org>
22058 -Date: Thu, 16 Apr 2015 18:48:39 +0800
22059 -Subject: [PATCH 196/219] Revert "nfs: replace nfs_add_stats with nfs_inc_stats
22060 - when add one"
22061 -Cc: mpagano@g.o
22062 -
22063 -commit 3708f842e107b9b79d54a75d152e666b693649e8 upstream.
22064 -
22065 -This reverts commit 5a254d08b086d80cbead2ebcee6d2a4b3a15587a.
22066 -
22067 -Since commit 5a254d08b086 ("nfs: replace nfs_add_stats with
22068 -nfs_inc_stats when add one"), nfs_readpage and nfs_do_writepage use
22069 -nfs_inc_stats to increment NFSIOS_READPAGES and NFSIOS_WRITEPAGES
22070 -instead of nfs_add_stats.
22071 -
22072 -However nfs_inc_stats does not do the same thing as nfs_add_stats with
22073 -value 1 because these functions work on distinct stats:
22074 -nfs_inc_stats increments stats from "enum nfs_stat_eventcounters" (in
22075 -server->io_stats->events) and nfs_add_stats those from "enum
22076 -nfs_stat_bytecounters" (in server->io_stats->bytes).
22077 -
22078 -Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@×××.org>
22079 -Fixes: 5a254d08b086 ("nfs: replace nfs_add_stats with nfs_inc_stats...")
22080 -Signed-off-by: Trond Myklebust <trond.myklebust@×××××××××××.com>
22081 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
22082 -Signed-off-by: Mike Pagano <mpagano@g.o>
22083 ----
22084 - fs/nfs/read.c | 2 +-
22085 - fs/nfs/write.c | 2 +-
22086 - 2 files changed, 2 insertions(+), 2 deletions(-)
22087 -
22088 -diff --git a/fs/nfs/read.c b/fs/nfs/read.c
22089 -index 568ecf0..848d8b1 100644
22090 ---- a/fs/nfs/read.c
22091 -+++ b/fs/nfs/read.c
22092 -@@ -284,7 +284,7 @@ int nfs_readpage(struct file *file, struct page *page)
22093 - dprintk("NFS: nfs_readpage (%p %ld@%lu)\n",
22094 - page, PAGE_CACHE_SIZE, page_file_index(page));
22095 - nfs_inc_stats(inode, NFSIOS_VFSREADPAGE);
22096 -- nfs_inc_stats(inode, NFSIOS_READPAGES);
22097 -+ nfs_add_stats(inode, NFSIOS_READPAGES, 1);
22098 ++/* Display port clock control */
22099 ++#define DP_MIE_CLKCON 0x27c
22100 ++#define DP_MIE_CLK_DISABLE 0x0
22101 ++#define DP_MIE_CLK_DP_ENABLE 0x2
22102 ++#define DP_MIE_CLK_MIE_ENABLE 0x3
22103 ++
22104 + /* Notes on per-window bpp settings
22105 + *
22106 + * Value Win0 Win1 Win2 Win3 Win 4
22107 +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
22108 +index 36508e6..5d8ea3d 100644
22109 +--- a/kernel/bpf/verifier.c
22110 ++++ b/kernel/bpf/verifier.c
22111 +@@ -755,7 +755,7 @@ static int check_func_arg(struct verifier_env *env, u32 regno,
22112 + enum bpf_reg_type expected_type;
22113 + int err = 0;
22114
22115 - /*
22116 - * Try to flush any pending writes to the file..
22117 -diff --git a/fs/nfs/write.c b/fs/nfs/write.c
22118 -index 849ed78..41b3f1096 100644
22119 ---- a/fs/nfs/write.c
22120 -+++ b/fs/nfs/write.c
22121 -@@ -580,7 +580,7 @@ static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, st
22122 - int ret;
22123 +- if (arg_type == ARG_ANYTHING)
22124 ++ if (arg_type == ARG_DONTCARE)
22125 + return 0;
22126
22127 - nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE);
22128 -- nfs_inc_stats(inode, NFSIOS_WRITEPAGES);
22129 -+ nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1);
22130 + if (reg->type == NOT_INIT) {
22131 +@@ -763,6 +763,9 @@ static int check_func_arg(struct verifier_env *env, u32 regno,
22132 + return -EACCES;
22133 + }
22134
22135 - nfs_pageio_cond_complete(pgio, page_file_index(page));
22136 - ret = nfs_page_async_flush(pgio, page, wbc->sync_mode == WB_SYNC_NONE);
22137 ---
22138 -2.3.6
22139 -
22140 -
22141 -From 2556cb4a63a559a09112aba49d0112bd7dc4d2d6 Mon Sep 17 00:00:00 2001
22142 -From: "J. Bruce Fields" <bfields@××××××.com>
22143 -Date: Fri, 3 Apr 2015 16:24:27 -0400
22144 -Subject: [PATCH 197/219] nfsd4: disallow ALLOCATE with special stateids
22145 -Cc: mpagano@g.o
22146 -
22147 -commit 5ba4a25ab7b13be528b23f85182f4d09cf7f71ad upstream.
22148 -
22149 -vfs_fallocate will hit a NULL dereference if the client tries an
22150 -ALLOCATE or DEALLOCATE with a special stateid. Fix that. (We also
22151 -depend on the open to have broken any conflicting leases or delegations
22152 -for us.)
22153 -
22154 -(If it turns out we need to allow special stateid's then we could do a
22155 -temporary open here in the special-stateid case, as we do for read and
22156 -write. For now I'm assuming it's not necessary.)
22157 -
22158 -Fixes: 95d871f03cae "nfsd: Add ALLOCATE support"
22159 -Cc: Anna Schumaker <Anna.Schumaker@××××××.com>
22160 -Signed-off-by: J. Bruce Fields <bfields@××××××.com>
22161 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
22162 -Signed-off-by: Mike Pagano <mpagano@g.o>
22163 ----
22164 - fs/nfsd/nfs4proc.c | 2 ++
22165 - 1 file changed, 2 insertions(+)
22166 -
22167 -diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
22168 -index 92b9d97..5912967 100644
22169 ---- a/fs/nfsd/nfs4proc.c
22170 -+++ b/fs/nfsd/nfs4proc.c
22171 -@@ -1030,6 +1030,8 @@ nfsd4_fallocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
22172 - dprintk("NFSD: nfsd4_fallocate: couldn't process stateid!\n");
22173 - return status;
22174 ++ if (arg_type == ARG_ANYTHING)
22175 ++ return 0;
22176 ++
22177 + if (arg_type == ARG_PTR_TO_STACK || arg_type == ARG_PTR_TO_MAP_KEY ||
22178 + arg_type == ARG_PTR_TO_MAP_VALUE) {
22179 + expected_type = PTR_TO_STACK;
22180 +diff --git a/kernel/ptrace.c b/kernel/ptrace.c
22181 +index 227fec3..9a34bd8 100644
22182 +--- a/kernel/ptrace.c
22183 ++++ b/kernel/ptrace.c
22184 +@@ -697,6 +697,8 @@ static int ptrace_peek_siginfo(struct task_struct *child,
22185 + static int ptrace_resume(struct task_struct *child, long request,
22186 + unsigned long data)
22187 + {
22188 ++ bool need_siglock;
22189 ++
22190 + if (!valid_signal(data))
22191 + return -EIO;
22192 +
22193 +@@ -724,8 +726,26 @@ static int ptrace_resume(struct task_struct *child, long request,
22194 + user_disable_single_step(child);
22195 }
22196 -+ if (!file)
22197 -+ return nfserr_bad_stateid;
22198
22199 - status = nfsd4_vfs_fallocate(rqstp, &cstate->current_fh, file,
22200 - fallocate->falloc_offset,
22201 ---
22202 -2.3.6
22203 -
22204 -
22205 -From e2efc21fbad9a8d055586716fad4d4baaf210b56 Mon Sep 17 00:00:00 2001
22206 -From: "J. Bruce Fields" <bfields@××××××.com>
22207 -Date: Fri, 3 Apr 2015 17:19:41 -0400
22208 -Subject: [PATCH 198/219] nfsd4: fix READ permission checking
22209 -Cc: mpagano@g.o
22210 -
22211 -commit 6e4891dc289cd191d46ab7ba1dcb29646644f9ca upstream.
22212 -
22213 -In the case we already have a struct file (derived from a stateid), we
22214 -still need to do permission-checking; otherwise an unauthorized user
22215 -could gain access to a file by sniffing or guessing somebody else's
22216 -stateid.
22217 -
22218 -Fixes: dc97618ddda9 "nfsd4: separate splice and readv cases"
22219 -Signed-off-by: J. Bruce Fields <bfields@××××××.com>
22220 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
22221 -Signed-off-by: Mike Pagano <mpagano@g.o>
22222 ----
22223 - fs/nfsd/nfs4xdr.c | 12 ++++++++----
22224 - 1 file changed, 8 insertions(+), 4 deletions(-)
22225 -
22226 -diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
22227 -index 5fb7e78..5b33ce1 100644
22228 ---- a/fs/nfsd/nfs4xdr.c
22229 -+++ b/fs/nfsd/nfs4xdr.c
22230 -@@ -3422,6 +3422,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
22231 - unsigned long maxcount;
22232 - struct xdr_stream *xdr = &resp->xdr;
22233 - struct file *file = read->rd_filp;
22234 -+ struct svc_fh *fhp = read->rd_fhp;
22235 - int starting_len = xdr->buf->len;
22236 - struct raparms *ra;
22237 - __be32 *p;
22238 -@@ -3445,12 +3446,15 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
22239 - maxcount = min_t(unsigned long, maxcount, (xdr->buf->buflen - xdr->buf->len));
22240 - maxcount = min_t(unsigned long, maxcount, read->rd_length);
22241 ++ /*
22242 ++ * Change ->exit_code and ->state under siglock to avoid the race
22243 ++ * with wait_task_stopped() in between; a non-zero ->exit_code will
22244 ++ * wrongly look like another report from tracee.
22245 ++ *
22246 ++ * Note that we need siglock even if ->exit_code == data and/or this
22247 ++ * status was not reported yet, the new status must not be cleared by
22248 ++ * wait_task_stopped() after resume.
22249 ++ *
22250 ++ * If data == 0 we do not care if wait_task_stopped() reports the old
22251 ++ * status and clears the code too; this can't race with the tracee, it
22252 ++ * takes siglock after resume.
22253 ++ */
22254 ++ need_siglock = data && !thread_group_empty(current);
22255 ++ if (need_siglock)
22256 ++ spin_lock_irq(&child->sighand->siglock);
22257 + child->exit_code = data;
22258 + wake_up_state(child, __TASK_TRACED);
22259 ++ if (need_siglock)
22260 ++ spin_unlock_irq(&child->sighand->siglock);
22261
22262 -- if (!read->rd_filp) {
22263 -+ if (read->rd_filp)
22264 -+ err = nfsd_permission(resp->rqstp, fhp->fh_export,
22265 -+ fhp->fh_dentry,
22266 -+ NFSD_MAY_READ|NFSD_MAY_OWNER_OVERRIDE);
22267 -+ else
22268 - err = nfsd_get_tmp_read_open(resp->rqstp, read->rd_fhp,
22269 - &file, &ra);
22270 -- if (err)
22271 -- goto err_truncate;
22272 -- }
22273 -+ if (err)
22274 -+ goto err_truncate;
22275 + return 0;
22276 + }
22277 +diff --git a/kernel/sched/core.c b/kernel/sched/core.c
22278 +index 62671f5..3d5f6f6 100644
22279 +--- a/kernel/sched/core.c
22280 ++++ b/kernel/sched/core.c
22281 +@@ -996,6 +996,13 @@ void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags)
22282 + rq_clock_skip_update(rq, true);
22283 + }
22284 +
22285 ++static ATOMIC_NOTIFIER_HEAD(task_migration_notifier);
22286 ++
22287 ++void register_task_migration_notifier(struct notifier_block *n)
22288 ++{
22289 ++ atomic_notifier_chain_register(&task_migration_notifier, n);
22290 ++}
22291 ++
22292 + #ifdef CONFIG_SMP
22293 + void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
22294 + {
22295 +@@ -1026,10 +1033,18 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
22296 + trace_sched_migrate_task(p, new_cpu);
22297
22298 - if (file->f_op->splice_read && test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags))
22299 - err = nfsd4_encode_splice_read(resp, read, file, maxcount);
22300 ---
22301 -2.3.6
22302 -
22303 -
22304 -From 6fd154a83b18bc81aa3f1071e74c36d9076ff4b9 Mon Sep 17 00:00:00 2001
22305 -From: "J. Bruce Fields" <bfields@××××××.com>
22306 -Date: Tue, 21 Apr 2015 15:25:39 -0400
22307 -Subject: [PATCH 199/219] nfsd4: disallow SEEK with special stateids
22308 -Cc: mpagano@g.o
22309 -
22310 -commit 980608fb50aea34993ba956b71cd4602aa42b14b upstream.
22311 -
22312 -If the client uses a special stateid then we'll pass a NULL file to
22313 -vfs_llseek.
22314 -
22315 -Fixes: 24bab491220f " NFSD: Implement SEEK"
22316 -Cc: Anna Schumaker <Anna.Schumaker@××××××.com>
22317 -Reported-by: Christoph Hellwig <hch@×××××××××.org>
22318 -Signed-off-by: J. Bruce Fields <bfields@××××××.com>
22319 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
22320 -Signed-off-by: Mike Pagano <mpagano@g.o>
22321 ----
22322 - fs/nfsd/nfs4proc.c | 2 ++
22323 - 1 file changed, 2 insertions(+)
22324 -
22325 -diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
22326 -index 5912967..5416968 100644
22327 ---- a/fs/nfsd/nfs4proc.c
22328 -+++ b/fs/nfsd/nfs4proc.c
22329 -@@ -1071,6 +1071,8 @@ nfsd4_seek(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
22330 - dprintk("NFSD: nfsd4_seek: couldn't process stateid!\n");
22331 - return status;
22332 + if (task_cpu(p) != new_cpu) {
22333 ++ struct task_migration_notifier tmn;
22334 ++
22335 + if (p->sched_class->migrate_task_rq)
22336 + p->sched_class->migrate_task_rq(p, new_cpu);
22337 + p->se.nr_migrations++;
22338 + perf_sw_event_sched(PERF_COUNT_SW_CPU_MIGRATIONS, 1, 0);
22339 ++
22340 ++ tmn.task = p;
22341 ++ tmn.from_cpu = task_cpu(p);
22342 ++ tmn.to_cpu = new_cpu;
22343 ++
22344 ++ atomic_notifier_call_chain(&task_migration_notifier, 0, &tmn);
22345 }
22346 -+ if (!file)
22347 -+ return nfserr_bad_stateid;
22348
22349 - switch (seek->seek_whence) {
22350 - case NFS4_CONTENT_DATA:
22351 ---
22352 -2.3.6
22353 -
22354 -
22355 -From 1f8303c597803d7d7c6943708dff333dbbc009a1 Mon Sep 17 00:00:00 2001
22356 -From: Mark Salter <msalter@××××××.com>
22357 -Date: Mon, 6 Apr 2015 09:46:00 -0400
22358 -Subject: [PATCH 200/219] nfsd: eliminate NFSD_DEBUG
22359 -Cc: mpagano@g.o
22360 -
22361 -commit 135dd002c23054aaa056ea3162c1e0356905c195 upstream.
22362 -
22363 -Commit f895b252d4edf ("sunrpc: eliminate RPC_DEBUG") introduced
22364 -use of IS_ENABLED() in a uapi header which leads to a build
22365 -failure for userspace apps trying to use <linux/nfsd/debug.h>:
22366 -
22367 - linux/nfsd/debug.h:18:15: error: missing binary operator before token "("
22368 - #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
22369 - ^
22370 -
22371 -Since this was only used to define NFSD_DEBUG if CONFIG_SUNRPC_DEBUG
22372 -is enabled, replace instances of NFSD_DEBUG with CONFIG_SUNRPC_DEBUG.
22373 -
22374 -Fixes: f895b252d4edf "sunrpc: eliminate RPC_DEBUG"
22375 -Signed-off-by: Mark Salter <msalter@××××××.com>
22376 -Reviewed-by: Jeff Layton <jlayton@×××××××××××.com>
22377 -Signed-off-by: J. Bruce Fields <bfields@××××××.com>
22378 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
22379 -Signed-off-by: Mike Pagano <mpagano@g.o>
22380 ----
22381 - fs/lockd/svcsubs.c | 2 +-
22382 - fs/nfsd/nfs4state.c | 2 +-
22383 - fs/nfsd/nfsd.h | 2 +-
22384 - include/uapi/linux/nfsd/debug.h | 8 --------
22385 - 4 files changed, 3 insertions(+), 11 deletions(-)
22386 -
22387 -diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
22388 -index 665ef5a..a563ddb 100644
22389 ---- a/fs/lockd/svcsubs.c
22390 -+++ b/fs/lockd/svcsubs.c
22391 -@@ -31,7 +31,7 @@
22392 - static struct hlist_head nlm_files[FILE_NRHASH];
22393 - static DEFINE_MUTEX(nlm_file_mutex);
22394 + __set_task_cpu(p, new_cpu);
22395 +diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
22396 +index 3fa8fa6..f670cbb 100644
22397 +--- a/kernel/sched/deadline.c
22398 ++++ b/kernel/sched/deadline.c
22399 +@@ -514,7 +514,7 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer *timer)
22400 + unsigned long flags;
22401 + struct rq *rq;
22402
22403 --#ifdef NFSD_DEBUG
22404 -+#ifdef CONFIG_SUNRPC_DEBUG
22405 - static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
22406 +- rq = task_rq_lock(current, &flags);
22407 ++ rq = task_rq_lock(p, &flags);
22408 +
22409 + /*
22410 + * We need to take care of several possible races here:
22411 +@@ -569,7 +569,7 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer *timer)
22412 + push_dl_task(rq);
22413 + #endif
22414 + unlock:
22415 +- task_rq_unlock(rq, current, &flags);
22416 ++ task_rq_unlock(rq, p, &flags);
22417 +
22418 + return HRTIMER_NORESTART;
22419 + }
22420 +diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
22421 +index 5040d44..922048a 100644
22422 +--- a/kernel/trace/ring_buffer.c
22423 ++++ b/kernel/trace/ring_buffer.c
22424 +@@ -2679,7 +2679,7 @@ static DEFINE_PER_CPU(unsigned int, current_context);
22425 +
22426 + static __always_inline int trace_recursive_lock(void)
22427 {
22428 - u32 *fhp = (u32*)f->data;
22429 -diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
22430 -index 8ba1d88..ee1cccd 100644
22431 ---- a/fs/nfsd/nfs4state.c
22432 -+++ b/fs/nfsd/nfs4state.c
22433 -@@ -1139,7 +1139,7 @@ hash_sessionid(struct nfs4_sessionid *sessionid)
22434 - return sid->sequence % SESSION_HASH_SIZE;
22435 +- unsigned int val = this_cpu_read(current_context);
22436 ++ unsigned int val = __this_cpu_read(current_context);
22437 + int bit;
22438 +
22439 + if (in_interrupt()) {
22440 +@@ -2696,18 +2696,17 @@ static __always_inline int trace_recursive_lock(void)
22441 + return 1;
22442 +
22443 + val |= (1 << bit);
22444 +- this_cpu_write(current_context, val);
22445 ++ __this_cpu_write(current_context, val);
22446 +
22447 + return 0;
22448 }
22449
22450 --#ifdef NFSD_DEBUG
22451 -+#ifdef CONFIG_SUNRPC_DEBUG
22452 - static inline void
22453 - dump_sessionid(const char *fn, struct nfs4_sessionid *sessionid)
22454 + static __always_inline void trace_recursive_unlock(void)
22455 {
22456 -diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
22457 -index 565c4da..cf98052 100644
22458 ---- a/fs/nfsd/nfsd.h
22459 -+++ b/fs/nfsd/nfsd.h
22460 -@@ -24,7 +24,7 @@
22461 - #include "export.h"
22462 +- unsigned int val = this_cpu_read(current_context);
22463 ++ unsigned int val = __this_cpu_read(current_context);
22464 +
22465 +- val--;
22466 +- val &= this_cpu_read(current_context);
22467 +- this_cpu_write(current_context, val);
22468 ++ val &= val & (val - 1);
22469 ++ __this_cpu_write(current_context, val);
22470 + }
22471
22472 - #undef ifdebug
22473 --#ifdef NFSD_DEBUG
22474 -+#ifdef CONFIG_SUNRPC_DEBUG
22475 - # define ifdebug(flag) if (nfsd_debug & NFSDDBG_##flag)
22476 #else
22477 - # define ifdebug(flag) if (0)
22478 -diff --git a/include/uapi/linux/nfsd/debug.h b/include/uapi/linux/nfsd/debug.h
22479 -index 0bf130a..28ec6c9 100644
22480 ---- a/include/uapi/linux/nfsd/debug.h
22481 -+++ b/include/uapi/linux/nfsd/debug.h
22482 -@@ -12,14 +12,6 @@
22483 - #include <linux/sunrpc/debug.h>
22484 +diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
22485 +index db54dda..a9c10a3 100644
22486 +--- a/kernel/trace/trace_events.c
22487 ++++ b/kernel/trace/trace_events.c
22488 +@@ -565,6 +565,7 @@ static int __ftrace_set_clr_event(struct trace_array *tr, const char *match,
22489 + static int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set)
22490 + {
22491 + char *event = NULL, *sub = NULL, *match;
22492 ++ int ret;
22493
22494 - /*
22495 -- * Enable debugging for nfsd.
22496 -- * Requires RPC_DEBUG.
22497 -- */
22498 --#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
22499 --# define NFSD_DEBUG 1
22500 --#endif
22501 --
22502 --/*
22503 - * knfsd debug flags
22504 - */
22505 - #define NFSDDBG_SOCK 0x0001
22506 ---
22507 -2.3.6
22508 -
22509 -
22510 -From d5d30089c2a59d079a074eb37c8c223b81664ceb Mon Sep 17 00:00:00 2001
22511 -From: Giuseppe Cantavenera <giuseppe.cantavenera.ext@×××××.com>
22512 -Date: Mon, 20 Apr 2015 18:00:08 +0200
22513 -Subject: [PATCH 201/219] nfsd: fix nsfd startup race triggering BUG_ON
22514 -Cc: mpagano@g.o
22515 -
22516 -commit bb7ffbf29e76b89a86ca4c3ee0d4690641f2f772 upstream.
22517 -
22518 -nfsd triggered a BUG_ON in net_generic(...) when rpc_pipefs_event(...)
22519 -in fs/nfsd/nfs4recover.c was called before assigning ntfsd_net_id.
22520 -The following was observed on a MIPS 32-core processor:
22521 -kernel: Call Trace:
22522 -kernel: [<ffffffffc00bc5e4>] rpc_pipefs_event+0x7c/0x158 [nfsd]
22523 -kernel: [<ffffffff8017a2a0>] notifier_call_chain+0x70/0xb8
22524 -kernel: [<ffffffff8017a4e4>] __blocking_notifier_call_chain+0x4c/0x70
22525 -kernel: [<ffffffff8053aff8>] rpc_fill_super+0xf8/0x1a0
22526 -kernel: [<ffffffff8022204c>] mount_ns+0xb4/0xf0
22527 -kernel: [<ffffffff80222b48>] mount_fs+0x50/0x1f8
22528 -kernel: [<ffffffff8023dc00>] vfs_kern_mount+0x58/0xf0
22529 -kernel: [<ffffffff802404ac>] do_mount+0x27c/0xa28
22530 -kernel: [<ffffffff80240cf0>] SyS_mount+0x98/0xe8
22531 -kernel: [<ffffffff80135d24>] handle_sys64+0x44/0x68
22532 -kernel:
22533 -kernel:
22534 - Code: 0040f809 00000000 2e020001 <00020336> 3c12c00d
22535 - 3c02801a de100000 6442eb98 0040f809
22536 -kernel: ---[ end trace 7471374335809536 ]---
22537 -
22538 -Fixed this behaviour by calling register_pernet_subsys(&nfsd_net_ops) before
22539 -registering rpc_pipefs_event(...) with the notifier chain.
22540 -
22541 -Signed-off-by: Giuseppe Cantavenera <giuseppe.cantavenera.ext@×××××.com>
22542 -Signed-off-by: Lorenzo Restelli <lorenzo.restelli.ext@×××××.com>
22543 -Reviewed-by: Kinlong Mee <kinglongmee@×××××.com>
22544 -Signed-off-by: J. Bruce Fields <bfields@××××××.com>
22545 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
22546 -Signed-off-by: Mike Pagano <mpagano@g.o>
22547 ----
22548 - fs/nfsd/nfsctl.c | 16 ++++++++--------
22549 - 1 file changed, 8 insertions(+), 8 deletions(-)
22550 -
22551 -diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
22552 -index aa47d75..9690cb4 100644
22553 ---- a/fs/nfsd/nfsctl.c
22554 -+++ b/fs/nfsd/nfsctl.c
22555 -@@ -1250,15 +1250,15 @@ static int __init init_nfsd(void)
22556 - int retval;
22557 - printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@×××××××××.de).\n");
22558 + /*
22559 + * The buf format can be <subsystem>:<event-name>
22560 +@@ -590,7 +591,13 @@ static int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set)
22561 + event = NULL;
22562 + }
22563
22564 -- retval = register_cld_notifier();
22565 -- if (retval)
22566 -- return retval;
22567 - retval = register_pernet_subsys(&nfsd_net_ops);
22568 - if (retval < 0)
22569 -- goto out_unregister_notifier;
22570 -- retval = nfsd4_init_slabs();
22571 -+ return retval;
22572 -+ retval = register_cld_notifier();
22573 - if (retval)
22574 - goto out_unregister_pernet;
22575 -+ retval = nfsd4_init_slabs();
22576 -+ if (retval)
22577 -+ goto out_unregister_notifier;
22578 - retval = nfsd4_init_pnfs();
22579 - if (retval)
22580 - goto out_free_slabs;
22581 -@@ -1290,10 +1290,10 @@ out_exit_pnfs:
22582 - nfsd4_exit_pnfs();
22583 - out_free_slabs:
22584 - nfsd4_free_slabs();
22585 --out_unregister_pernet:
22586 -- unregister_pernet_subsys(&nfsd_net_ops);
22587 - out_unregister_notifier:
22588 - unregister_cld_notifier();
22589 -+out_unregister_pernet:
22590 -+ unregister_pernet_subsys(&nfsd_net_ops);
22591 - return retval;
22592 +- return __ftrace_set_clr_event(tr, match, sub, event, set);
22593 ++ ret = __ftrace_set_clr_event(tr, match, sub, event, set);
22594 ++
22595 ++ /* Put back the colon to allow this to be called again */
22596 ++ if (buf)
22597 ++ *(buf - 1) = ':';
22598 ++
22599 ++ return ret;
22600 }
22601
22602 -@@ -1308,8 +1308,8 @@ static void __exit exit_nfsd(void)
22603 - nfsd4_exit_pnfs();
22604 - nfsd_fault_inject_cleanup();
22605 - unregister_filesystem(&nfsd_fs_type);
22606 -- unregister_pernet_subsys(&nfsd_net_ops);
22607 - unregister_cld_notifier();
22608 -+ unregister_pernet_subsys(&nfsd_net_ops);
22609 + /**
22610 +diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
22611 +index 2d25ad1..b6fce36 100644
22612 +--- a/kernel/trace/trace_functions_graph.c
22613 ++++ b/kernel/trace/trace_functions_graph.c
22614 +@@ -1309,15 +1309,19 @@ void graph_trace_open(struct trace_iterator *iter)
22615 + {
22616 + /* pid and depth on the last trace processed */
22617 + struct fgraph_data *data;
22618 ++ gfp_t gfpflags;
22619 + int cpu;
22620 +
22621 + iter->private = NULL;
22622 +
22623 +- data = kzalloc(sizeof(*data), GFP_KERNEL);
22624 ++ /* We can be called in atomic context via ftrace_dump() */
22625 ++ gfpflags = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL;
22626 ++
22627 ++ data = kzalloc(sizeof(*data), gfpflags);
22628 + if (!data)
22629 + goto out_err;
22630 +
22631 +- data->cpu_data = alloc_percpu(struct fgraph_cpu_data);
22632 ++ data->cpu_data = alloc_percpu_gfp(struct fgraph_cpu_data, gfpflags);
22633 + if (!data->cpu_data)
22634 + goto out_err_free;
22635 +
22636 +diff --git a/lib/string.c b/lib/string.c
22637 +index ce81aae..a579201 100644
22638 +--- a/lib/string.c
22639 ++++ b/lib/string.c
22640 +@@ -607,7 +607,7 @@ EXPORT_SYMBOL(memset);
22641 + void memzero_explicit(void *s, size_t count)
22642 + {
22643 + memset(s, 0, count);
22644 +- OPTIMIZER_HIDE_VAR(s);
22645 ++ barrier();
22646 }
22647 + EXPORT_SYMBOL(memzero_explicit);
22648
22649 - MODULE_AUTHOR("Olaf Kirch <okir@×××××××××.de>");
22650 ---
22651 -2.3.6
22652 -
22653 -
22654 -From c59908b7a9d4b76f72367f055559663e1da274fc Mon Sep 17 00:00:00 2001
22655 -From: Jeff Layton <jlayton@×××××××××××.net>
22656 -Date: Fri, 20 Mar 2015 15:15:14 -0400
22657 -Subject: [PATCH 202/219] nfs: fix high load average due to callback thread
22658 - sleeping
22659 -MIME-Version: 1.0
22660 -Content-Type: text/plain; charset=UTF-8
22661 -Content-Transfer-Encoding: 8bit
22662 -Cc: mpagano@g.o
22663 -
22664 -commit 5d05e54af3cdbb13cf19c557ff2184781b91a22c upstream.
22665 -
22666 -Chuck pointed out a problem that crept in with commit 6ffa30d3f734 (nfs:
22667 -don't call blocking operations while !TASK_RUNNING). Linux counts tasks
22668 -in uninterruptible sleep against the load average, so this caused the
22669 -system's load average to be pinned at at least 1 when there was a
22670 -NFSv4.1+ mount active.
22671 -
22672 -Not a huge problem, but it's probably worth fixing before we get too
22673 -many complaints about it. This patch converts the code back to use
22674 -TASK_INTERRUPTIBLE sleep, simply has it flush any signals on each loop
22675 -iteration. In practice no one should really be signalling this thread at
22676 -all, so I think this is reasonably safe.
22677 -
22678 -With this change, there's also no need to game the hung task watchdog so
22679 -we can also convert the schedule_timeout call back to a normal schedule.
22680 -
22681 -Reported-by: Chuck Lever <chuck.lever@××××××.com>
22682 -Signed-off-by: Jeff Layton <jeff.layton@×××××××××××.com>
22683 -Tested-by: Chuck Lever <chuck.lever@××××××.com>
22684 -Fixes: commit 6ffa30d3f734 (“nfs: don't call blocking . . .”)
22685 -Signed-off-by: Trond Myklebust <trond.myklebust@×××××××××××.com>
22686 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
22687 -Signed-off-by: Mike Pagano <mpagano@g.o>
22688 ----
22689 - fs/nfs/callback.c | 6 +++---
22690 - 1 file changed, 3 insertions(+), 3 deletions(-)
22691 -
22692 -diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
22693 -index 351be920..8d129bb 100644
22694 ---- a/fs/nfs/callback.c
22695 -+++ b/fs/nfs/callback.c
22696 -@@ -128,7 +128,7 @@ nfs41_callback_svc(void *vrqstp)
22697 - if (try_to_freeze())
22698 - continue;
22699 +diff --git a/mm/huge_memory.c b/mm/huge_memory.c
22700 +index 6817b03..956d4db 100644
22701 +--- a/mm/huge_memory.c
22702 ++++ b/mm/huge_memory.c
22703 +@@ -2316,8 +2316,14 @@ static struct page
22704 + struct vm_area_struct *vma, unsigned long address,
22705 + int node)
22706 + {
22707 ++ gfp_t flags;
22708 ++
22709 + VM_BUG_ON_PAGE(*hpage, *hpage);
22710 +
22711 ++ /* Only allocate from the target node */
22712 ++ flags = alloc_hugepage_gfpmask(khugepaged_defrag(), __GFP_OTHER_NODE) |
22713 ++ __GFP_THISNODE;
22714 ++
22715 + /*
22716 + * Before allocating the hugepage, release the mmap_sem read lock.
22717 + * The allocation can take potentially a long time if it involves
22718 +@@ -2326,8 +2332,7 @@ static struct page
22719 + */
22720 + up_read(&mm->mmap_sem);
22721
22722 -- prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_UNINTERRUPTIBLE);
22723 -+ prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRUPTIBLE);
22724 - spin_lock_bh(&serv->sv_cb_lock);
22725 - if (!list_empty(&serv->sv_cb_list)) {
22726 - req = list_first_entry(&serv->sv_cb_list,
22727 -@@ -142,10 +142,10 @@ nfs41_callback_svc(void *vrqstp)
22728 - error);
22729 - } else {
22730 - spin_unlock_bh(&serv->sv_cb_lock);
22731 -- /* schedule_timeout to game the hung task watchdog */
22732 -- schedule_timeout(60 * HZ);
22733 -+ schedule();
22734 - finish_wait(&serv->sv_cb_waitq, &wq);
22735 +- *hpage = alloc_pages_exact_node(node, alloc_hugepage_gfpmask(
22736 +- khugepaged_defrag(), __GFP_OTHER_NODE), HPAGE_PMD_ORDER);
22737 ++ *hpage = alloc_pages_exact_node(node, flags, HPAGE_PMD_ORDER);
22738 + if (unlikely(!*hpage)) {
22739 + count_vm_event(THP_COLLAPSE_ALLOC_FAILED);
22740 + *hpage = ERR_PTR(-ENOMEM);
22741 +diff --git a/mm/hugetlb.c b/mm/hugetlb.c
22742 +index c41b2a0..caad3c5 100644
22743 +--- a/mm/hugetlb.c
22744 ++++ b/mm/hugetlb.c
22745 +@@ -3735,8 +3735,7 @@ retry:
22746 + if (!pmd_huge(*pmd))
22747 + goto out;
22748 + if (pmd_present(*pmd)) {
22749 +- page = pte_page(*(pte_t *)pmd) +
22750 +- ((address & ~PMD_MASK) >> PAGE_SHIFT);
22751 ++ page = pmd_page(*pmd) + ((address & ~PMD_MASK) >> PAGE_SHIFT);
22752 + if (flags & FOLL_GET)
22753 + get_page(page);
22754 + } else {
22755 +diff --git a/mm/mempolicy.c b/mm/mempolicy.c
22756 +index 4721046..de5dc5e 100644
22757 +--- a/mm/mempolicy.c
22758 ++++ b/mm/mempolicy.c
22759 +@@ -1985,7 +1985,8 @@ retry_cpuset:
22760 + nmask = policy_nodemask(gfp, pol);
22761 + if (!nmask || node_isset(node, *nmask)) {
22762 + mpol_cond_put(pol);
22763 +- page = alloc_pages_exact_node(node, gfp, order);
22764 ++ page = alloc_pages_exact_node(node,
22765 ++ gfp | __GFP_THISNODE, order);
22766 + goto out;
22767 }
22768 -+ flush_signals(current);
22769 }
22770 - return 0;
22771 - }
22772 ---
22773 -2.3.6
22774 -
22775 -
22776 -From dcd8d0c80e86b8821c5a453b5bf782328d8580e1 Mon Sep 17 00:00:00 2001
22777 -From: Peng Tao <tao.peng@×××××××××××.com>
22778 -Date: Thu, 9 Apr 2015 23:02:16 +0800
22779 -Subject: [PATCH 203/219] nfs: fix DIO good bytes calculation
22780 -Cc: mpagano@g.o
22781 -
22782 -commit 1ccbad9f9f9bd36db26a10f0b17fbaf12b3ae93a upstream.
22783 -
22784 -For direct read that has IO size larger than rsize, we'll split
22785 -it into several READ requests and nfs_direct_good_bytes() would
22786 -count completed bytes incorrectly by eating last zero count reply.
22787 -
22788 -Fix it by handling mirror and non-mirror cases differently such that
22789 -we only count mirrored writes differently.
22790 -
22791 -This fixes 5fadeb47("nfs: count DIO good bytes correctly with mirroring").
22792 -
22793 -Reported-by: Jean Spector <jean@×××××××××××.com>
22794 -Signed-off-by: Peng Tao <tao.peng@×××××××××××.com>
22795 -Signed-off-by: Trond Myklebust <trond.myklebust@×××××××××××.com>
22796 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
22797 -Signed-off-by: Mike Pagano <mpagano@g.o>
22798 ----
22799 - fs/nfs/direct.c | 29 +++++++++++++++++------------
22800 - 1 file changed, 17 insertions(+), 12 deletions(-)
22801 -
22802 -diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
22803 -index e907c8c..5e451a7 100644
22804 ---- a/fs/nfs/direct.c
22805 -+++ b/fs/nfs/direct.c
22806 -@@ -131,20 +131,25 @@ nfs_direct_good_bytes(struct nfs_direct_req *dreq, struct nfs_pgio_header *hdr)
22807 -
22808 - WARN_ON_ONCE(hdr->pgio_mirror_idx >= dreq->mirror_count);
22809 +diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
22810 +index 0ee453f..f371cbf 100644
22811 +--- a/net/bridge/br_netfilter.c
22812 ++++ b/net/bridge/br_netfilter.c
22813 +@@ -651,6 +651,13 @@ static int br_nf_forward_finish(struct sk_buff *skb)
22814 + struct net_device *in;
22815
22816 -- count = dreq->mirrors[hdr->pgio_mirror_idx].count;
22817 -- if (count + dreq->io_start < hdr->io_start + hdr->good_bytes) {
22818 -- count = hdr->io_start + hdr->good_bytes - dreq->io_start;
22819 -- dreq->mirrors[hdr->pgio_mirror_idx].count = count;
22820 -- }
22821 --
22822 -- /* update the dreq->count by finding the minimum agreed count from all
22823 -- * mirrors */
22824 -- count = dreq->mirrors[0].count;
22825 -+ if (dreq->mirror_count == 1) {
22826 -+ dreq->mirrors[hdr->pgio_mirror_idx].count += hdr->good_bytes;
22827 -+ dreq->count += hdr->good_bytes;
22828 -+ } else {
22829 -+ /* mirrored writes */
22830 -+ count = dreq->mirrors[hdr->pgio_mirror_idx].count;
22831 -+ if (count + dreq->io_start < hdr->io_start + hdr->good_bytes) {
22832 -+ count = hdr->io_start + hdr->good_bytes - dreq->io_start;
22833 -+ dreq->mirrors[hdr->pgio_mirror_idx].count = count;
22834 + if (!IS_ARP(skb) && !IS_VLAN_ARP(skb)) {
22835 ++ int frag_max_size;
22836 ++
22837 ++ if (skb->protocol == htons(ETH_P_IP)) {
22838 ++ frag_max_size = IPCB(skb)->frag_max_size;
22839 ++ BR_INPUT_SKB_CB(skb)->frag_max_size = frag_max_size;
22840 + }
22841 -+ /* update the dreq->count by finding the minimum agreed count from all
22842 -+ * mirrors */
22843 -+ count = dreq->mirrors[0].count;
22844 -
22845 -- for (i = 1; i < dreq->mirror_count; i++)
22846 -- count = min(count, dreq->mirrors[i].count);
22847 -+ for (i = 1; i < dreq->mirror_count; i++)
22848 -+ count = min(count, dreq->mirrors[i].count);
22849 ++
22850 + in = nf_bridge->physindev;
22851 + if (nf_bridge->mask & BRNF_PKT_TYPE) {
22852 + skb->pkt_type = PACKET_OTHERHOST;
22853 +@@ -710,8 +717,14 @@ static unsigned int br_nf_forward_ip(const struct nf_hook_ops *ops,
22854 + nf_bridge->mask |= BRNF_PKT_TYPE;
22855 + }
22856
22857 -- dreq->count = count;
22858 -+ dreq->count = count;
22859 +- if (pf == NFPROTO_IPV4 && br_parse_ip_options(skb))
22860 +- return NF_DROP;
22861 ++ if (pf == NFPROTO_IPV4) {
22862 ++ int frag_max = BR_INPUT_SKB_CB(skb)->frag_max_size;
22863 ++
22864 ++ if (br_parse_ip_options(skb))
22865 ++ return NF_DROP;
22866 ++
22867 ++ IPCB(skb)->frag_max_size = frag_max;
22868 + }
22869 - }
22870
22871 - /*
22872 ---
22873 -2.3.6
22874 -
22875 -
22876 -From 5efdfc74ab7d8ccfce9f8517012e3962939c91fc Mon Sep 17 00:00:00 2001
22877 -From: Peng Tao <tao.peng@×××××××××××.com>
22878 -Date: Thu, 9 Apr 2015 23:02:17 +0800
22879 -Subject: [PATCH 204/219] nfs: remove WARN_ON_ONCE from nfs_direct_good_bytes
22880 -Cc: mpagano@g.o
22881 -
22882 -commit 05f54903d9d370a4cd302a85681304d3ec59e5c1 upstream.
22883 -
22884 -For flexfiles driver, we might choose to read from mirror index other
22885 -than 0 while mirror_count is always 1 for read.
22886 -
22887 -Reported-by: Jean Spector <jean@×××××××××××.com>
22888 -Cc: Weston Andros Adamson <dros@×××××××××××.com>
22889 -Signed-off-by: Peng Tao <tao.peng@×××××××××××.com>
22890 -Signed-off-by: Trond Myklebust <trond.myklebust@×××××××××××.com>
22891 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
22892 -Signed-off-by: Mike Pagano <mpagano@g.o>
22893 ----
22894 - fs/nfs/direct.c | 2 --
22895 - 1 file changed, 2 deletions(-)
22896 -
22897 -diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
22898 -index 5e451a7..ab21ef1 100644
22899 ---- a/fs/nfs/direct.c
22900 -+++ b/fs/nfs/direct.c
22901 -@@ -129,8 +129,6 @@ nfs_direct_good_bytes(struct nfs_direct_req *dreq, struct nfs_pgio_header *hdr)
22902 - int i;
22903 - ssize_t count;
22904 + /* The physdev module checks on this */
22905 + nf_bridge->mask |= BRNF_BRIDGED;
22906 +diff --git a/net/core/dev.c b/net/core/dev.c
22907 +index 45109b7..22a53ac 100644
22908 +--- a/net/core/dev.c
22909 ++++ b/net/core/dev.c
22910 +@@ -3041,7 +3041,7 @@ static struct rps_dev_flow *
22911 + set_rps_cpu(struct net_device *dev, struct sk_buff *skb,
22912 + struct rps_dev_flow *rflow, u16 next_cpu)
22913 + {
22914 +- if (next_cpu != RPS_NO_CPU) {
22915 ++ if (next_cpu < nr_cpu_ids) {
22916 + #ifdef CONFIG_RFS_ACCEL
22917 + struct netdev_rx_queue *rxqueue;
22918 + struct rps_dev_flow_table *flow_table;
22919 +@@ -3146,7 +3146,7 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
22920 + * If the desired CPU (where last recvmsg was done) is
22921 + * different from current CPU (one in the rx-queue flow
22922 + * table entry), switch if one of the following holds:
22923 +- * - Current CPU is unset (equal to RPS_NO_CPU).
22924 ++ * - Current CPU is unset (>= nr_cpu_ids).
22925 + * - Current CPU is offline.
22926 + * - The current CPU's queue tail has advanced beyond the
22927 + * last packet that was enqueued using this table entry.
22928 +@@ -3154,14 +3154,14 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
22929 + * have been dequeued, thus preserving in order delivery.
22930 + */
22931 + if (unlikely(tcpu != next_cpu) &&
22932 +- (tcpu == RPS_NO_CPU || !cpu_online(tcpu) ||
22933 ++ (tcpu >= nr_cpu_ids || !cpu_online(tcpu) ||
22934 + ((int)(per_cpu(softnet_data, tcpu).input_queue_head -
22935 + rflow->last_qtail)) >= 0)) {
22936 + tcpu = next_cpu;
22937 + rflow = set_rps_cpu(dev, skb, rflow, next_cpu);
22938 + }
22939
22940 -- WARN_ON_ONCE(hdr->pgio_mirror_idx >= dreq->mirror_count);
22941 --
22942 - if (dreq->mirror_count == 1) {
22943 - dreq->mirrors[hdr->pgio_mirror_idx].count += hdr->good_bytes;
22944 - dreq->count += hdr->good_bytes;
22945 ---
22946 -2.3.6
22947 -
22948 -
22949 -From ecb403f5eaf05dd7a9160fae030d55e23a5a4445 Mon Sep 17 00:00:00 2001
22950 -From: Anna Schumaker <Anna.Schumaker@××××××.com>
22951 -Date: Tue, 14 Apr 2015 10:34:20 -0400
22952 -Subject: [PATCH 205/219] NFS: Add a stub for GETDEVICELIST
22953 -Cc: mpagano@g.o
22954 -
22955 -commit 7c61f0d3897eeeff6f3294adb9f910ddefa8035a upstream.
22956 -
22957 -d4b18c3e (pnfs: remove GETDEVICELIST implementation) removed the
22958 -GETDEVICELIST operation from the NFS client, but left a "hole" in the
22959 -nfs4_procedures array. This caused /proc/self/mountstats to report an
22960 -operation named "51" where GETDEVICELIST used to be. This patch adds a
22961 -stub to fix mountstats.
22962 -
22963 -Signed-off-by: Anna Schumaker <Anna.Schumaker@××××××.com>
22964 -Fixes: d4b18c3e (pnfs: remove GETDEVICELIST implementation)
22965 -Signed-off-by: Trond Myklebust <trond.myklebust@×××××××××××.com>
22966 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
22967 -Signed-off-by: Mike Pagano <mpagano@g.o>
22968 ----
22969 - fs/nfs/nfs4xdr.c | 6 ++++++
22970 - 1 file changed, 6 insertions(+)
22971 -
22972 -diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
22973 -index 5c399ec..d494ea2 100644
22974 ---- a/fs/nfs/nfs4xdr.c
22975 -+++ b/fs/nfs/nfs4xdr.c
22976 -@@ -7365,6 +7365,11 @@ nfs4_stat_to_errno(int stat)
22977 - .p_name = #proc, \
22978 - }
22979 +- if (tcpu != RPS_NO_CPU && cpu_online(tcpu)) {
22980 ++ if (tcpu < nr_cpu_ids && cpu_online(tcpu)) {
22981 + *rflowp = rflow;
22982 + cpu = tcpu;
22983 + goto done;
22984 +@@ -3202,14 +3202,14 @@ bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index,
22985 + struct rps_dev_flow_table *flow_table;
22986 + struct rps_dev_flow *rflow;
22987 + bool expire = true;
22988 +- int cpu;
22989 ++ unsigned int cpu;
22990
22991 -+#define STUB(proc) \
22992 -+[NFSPROC4_CLNT_##proc] = { \
22993 -+ .p_name = #proc, \
22994 -+}
22995 + rcu_read_lock();
22996 + flow_table = rcu_dereference(rxqueue->rps_flow_table);
22997 + if (flow_table && flow_id <= flow_table->mask) {
22998 + rflow = &flow_table->flows[flow_id];
22999 + cpu = ACCESS_ONCE(rflow->cpu);
23000 +- if (rflow->filter == filter_id && cpu != RPS_NO_CPU &&
23001 ++ if (rflow->filter == filter_id && cpu < nr_cpu_ids &&
23002 + ((int)(per_cpu(softnet_data, cpu).input_queue_head -
23003 + rflow->last_qtail) <
23004 + (int)(10 * flow_table->mask)))
23005 +diff --git a/net/core/skbuff.c b/net/core/skbuff.c
23006 +index 98d45fe..e9f9a15 100644
23007 +--- a/net/core/skbuff.c
23008 ++++ b/net/core/skbuff.c
23009 +@@ -280,13 +280,14 @@ nodata:
23010 + EXPORT_SYMBOL(__alloc_skb);
23011 +
23012 + /**
23013 +- * build_skb - build a network buffer
23014 ++ * __build_skb - build a network buffer
23015 + * @data: data buffer provided by caller
23016 +- * @frag_size: size of fragment, or 0 if head was kmalloced
23017 ++ * @frag_size: size of data, or 0 if head was kmalloced
23018 + *
23019 + * Allocate a new &sk_buff. Caller provides space holding head and
23020 + * skb_shared_info. @data must have been allocated by kmalloc() only if
23021 +- * @frag_size is 0, otherwise data should come from the page allocator.
23022 ++ * @frag_size is 0, otherwise data should come from the page allocator
23023 ++ * or vmalloc()
23024 + * The return is the new skb buffer.
23025 + * On a failure the return is %NULL, and @data is not freed.
23026 + * Notes :
23027 +@@ -297,7 +298,7 @@ EXPORT_SYMBOL(__alloc_skb);
23028 + * before giving packet to stack.
23029 + * RX rings only contains data buffers, not full skbs.
23030 + */
23031 +-struct sk_buff *build_skb(void *data, unsigned int frag_size)
23032 ++struct sk_buff *__build_skb(void *data, unsigned int frag_size)
23033 + {
23034 + struct skb_shared_info *shinfo;
23035 + struct sk_buff *skb;
23036 +@@ -311,7 +312,6 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
23037 +
23038 + memset(skb, 0, offsetof(struct sk_buff, tail));
23039 + skb->truesize = SKB_TRUESIZE(size);
23040 +- skb->head_frag = frag_size != 0;
23041 + atomic_set(&skb->users, 1);
23042 + skb->head = data;
23043 + skb->data = data;
23044 +@@ -328,6 +328,23 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
23045 +
23046 + return skb;
23047 + }
23048 +
23049 - struct rpc_procinfo nfs4_procedures[] = {
23050 - PROC(READ, enc_read, dec_read),
23051 - PROC(WRITE, enc_write, dec_write),
23052 -@@ -7417,6 +7422,7 @@ struct rpc_procinfo nfs4_procedures[] = {
23053 - PROC(SECINFO_NO_NAME, enc_secinfo_no_name, dec_secinfo_no_name),
23054 - PROC(TEST_STATEID, enc_test_stateid, dec_test_stateid),
23055 - PROC(FREE_STATEID, enc_free_stateid, dec_free_stateid),
23056 -+ STUB(GETDEVICELIST),
23057 - PROC(BIND_CONN_TO_SESSION,
23058 - enc_bind_conn_to_session, dec_bind_conn_to_session),
23059 - PROC(DESTROY_CLIENTID, enc_destroy_clientid, dec_destroy_clientid),
23060 ---
23061 -2.3.6
23062 -
23063 -
23064 -From a0e97e698901d058b984bcf1c13693f7a33375b3 Mon Sep 17 00:00:00 2001
23065 -From: Juri Lelli <juri.lelli@×××.com>
23066 -Date: Tue, 31 Mar 2015 09:53:36 +0100
23067 -Subject: [PATCH 206/219] sched/deadline: Always enqueue on previous rq when
23068 - dl_task_timer() fires
23069 -Cc: mpagano@g.o
23070 -
23071 -commit 4cd57f97135840f637431c92380c8da3edbe44ed upstream.
23072 -
23073 -dl_task_timer() may fire on a different rq from where a task was removed
23074 -after throttling. Since the call path is:
23075 -
23076 - dl_task_timer() ->
23077 - enqueue_task_dl() ->
23078 - enqueue_dl_entity() ->
23079 - replenish_dl_entity()
23080 -
23081 -and replenish_dl_entity() uses dl_se's rq, we can't use current's rq
23082 -in dl_task_timer(), but we need to lock the task's previous one.
23083 -
23084 -Tested-by: Wanpeng Li <wanpeng.li@×××××××××××.com>
23085 -Signed-off-by: Juri Lelli <juri.lelli@×××.com>
23086 -Signed-off-by: Peter Zijlstra (Intel) <peterz@×××××××××.org>
23087 -Acked-by: Kirill Tkhai <ktkhai@×××××××××.com>
23088 -Cc: Juri Lelli <juri.lelli@×××××.com>
23089 -Fixes: 3960c8c0c789 ("sched: Make dl_task_time() use task_rq_lock()")
23090 -Link: http://lkml.kernel.org/r/1427792017-7356-1-git-send-email-juri.lelli@×××.com
23091 -Signed-off-by: Ingo Molnar <mingo@××××××.org>
23092 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
23093 -Signed-off-by: Mike Pagano <mpagano@g.o>
23094 ----
23095 - kernel/sched/deadline.c | 4 ++--
23096 - 1 file changed, 2 insertions(+), 2 deletions(-)
23097 -
23098 -diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
23099 -index 3fa8fa6..f670cbb 100644
23100 ---- a/kernel/sched/deadline.c
23101 -+++ b/kernel/sched/deadline.c
23102 -@@ -514,7 +514,7 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer *timer)
23103 - unsigned long flags;
23104 - struct rq *rq;
23105 ++/* build_skb() is wrapper over __build_skb(), that specifically
23106 ++ * takes care of skb->head and skb->pfmemalloc
23107 ++ * This means that if @frag_size is not zero, then @data must be backed
23108 ++ * by a page fragment, not kmalloc() or vmalloc()
23109 ++ */
23110 ++struct sk_buff *build_skb(void *data, unsigned int frag_size)
23111 ++{
23112 ++ struct sk_buff *skb = __build_skb(data, frag_size);
23113 ++
23114 ++ if (skb && frag_size) {
23115 ++ skb->head_frag = 1;
23116 ++ if (virt_to_head_page(data)->pfmemalloc)
23117 ++ skb->pfmemalloc = 1;
23118 ++ }
23119 ++ return skb;
23120 ++}
23121 + EXPORT_SYMBOL(build_skb);
23122
23123 -- rq = task_rq_lock(current, &flags);
23124 -+ rq = task_rq_lock(p, &flags);
23125 + struct netdev_alloc_cache {
23126 +@@ -348,7 +365,8 @@ static struct page *__page_frag_refill(struct netdev_alloc_cache *nc,
23127 + gfp_t gfp = gfp_mask;
23128
23129 - /*
23130 - * We need to take care of several possible races here:
23131 -@@ -569,7 +569,7 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer *timer)
23132 - push_dl_task(rq);
23133 - #endif
23134 - unlock:
23135 -- task_rq_unlock(rq, current, &flags);
23136 -+ task_rq_unlock(rq, p, &flags);
23137 + if (order) {
23138 +- gfp_mask |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY;
23139 ++ gfp_mask |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY |
23140 ++ __GFP_NOMEMALLOC;
23141 + page = alloc_pages_node(NUMA_NO_NODE, gfp_mask, order);
23142 + nc->frag.size = PAGE_SIZE << (page ? order : 0);
23143 + }
23144 +diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
23145 +index d9bc28a..53bd53f 100644
23146 +--- a/net/ipv4/ip_forward.c
23147 ++++ b/net/ipv4/ip_forward.c
23148 +@@ -82,6 +82,9 @@ int ip_forward(struct sk_buff *skb)
23149 + if (skb->pkt_type != PACKET_HOST)
23150 + goto drop;
23151
23152 - return HRTIMER_NORESTART;
23153 ++ if (unlikely(skb->sk))
23154 ++ goto drop;
23155 ++
23156 + if (skb_warn_if_lro(skb))
23157 + goto drop;
23158 +
23159 +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
23160 +index d520492..9d48dc4 100644
23161 +--- a/net/ipv4/tcp_output.c
23162 ++++ b/net/ipv4/tcp_output.c
23163 +@@ -2751,39 +2751,65 @@ begin_fwd:
23164 + }
23165 }
23166 ---
23167 -2.3.6
23168 -
23169 -
23170 -From 9279e1f98b13d5e5b40805114896ec33313ad019 Mon Sep 17 00:00:00 2001
23171 -From: Sabrina Dubroca <sd@×××××××××××.net>
23172 -Date: Thu, 26 Feb 2015 05:35:41 +0000
23173 -Subject: [PATCH 207/219] e1000: add dummy allocator to fix race condition
23174 - between mtu change and netpoll
23175 -Cc: mpagano@g.o
23176 -
23177 -commit 08e8331654d1d7b2c58045e549005bc356aa7810 upstream.
23178 -
23179 -There is a race condition between e1000_change_mtu's cleanups and
23180 -netpoll, when we change the MTU across jumbo size:
23181 -
23182 -Changing MTU frees all the rx buffers:
23183 - e1000_change_mtu -> e1000_down -> e1000_clean_all_rx_rings ->
23184 - e1000_clean_rx_ring
23185 -
23186 -Then, close to the end of e1000_change_mtu:
23187 - pr_info -> ... -> netpoll_poll_dev -> e1000_clean ->
23188 - e1000_clean_rx_irq -> e1000_alloc_rx_buffers -> e1000_alloc_frag
23189 -
23190 -And when we come back to do the rest of the MTU change:
23191 - e1000_up -> e1000_configure -> e1000_configure_rx ->
23192 - e1000_alloc_jumbo_rx_buffers
23193 -
23194 -alloc_jumbo finds the buffers already != NULL, since data (shared with
23195 -page in e1000_rx_buffer->rxbuf) has been re-alloc'd, but it's garbage,
23196 -or at least not what is expected when in jumbo state.
23197 -
23198 -This results in an unusable adapter (packets don't get through), and a
23199 -NULL pointer dereference on the next call to e1000_clean_rx_ring
23200 -(other mtu change, link down, shutdown):
23201 -
23202 -BUG: unable to handle kernel NULL pointer dereference at (null)
23203 -IP: [<ffffffff81194d6e>] put_compound_page+0x7e/0x330
23204 -
23205 - [...]
23206 -
23207 -Call Trace:
23208 - [<ffffffff81195445>] put_page+0x55/0x60
23209 - [<ffffffff815d9f44>] e1000_clean_rx_ring+0x134/0x200
23210 - [<ffffffff815da055>] e1000_clean_all_rx_rings+0x45/0x60
23211 - [<ffffffff815df5e0>] e1000_down+0x1c0/0x1d0
23212 - [<ffffffff811e2260>] ? deactivate_slab+0x7f0/0x840
23213 - [<ffffffff815e21bc>] e1000_change_mtu+0xdc/0x170
23214 - [<ffffffff81647050>] dev_set_mtu+0xa0/0x140
23215 - [<ffffffff81664218>] do_setlink+0x218/0xac0
23216 - [<ffffffff814459e9>] ? nla_parse+0xb9/0x120
23217 - [<ffffffff816652d0>] rtnl_newlink+0x6d0/0x890
23218 - [<ffffffff8104f000>] ? kvm_clock_read+0x20/0x40
23219 - [<ffffffff810a2068>] ? sched_clock_cpu+0xa8/0x100
23220 - [<ffffffff81663802>] rtnetlink_rcv_msg+0x92/0x260
23221 -
23222 -By setting the allocator to a dummy version, netpoll can't mess up our
23223 -rx buffers. The allocator is set back to a sane value in
23224 -e1000_configure_rx.
23225 -
23226 -Fixes: edbbb3ca1077 ("e1000: implement jumbo receive with partial descriptors")
23227 -Signed-off-by: Sabrina Dubroca <sd@×××××××××××.net>
23228 -Tested-by: Aaron Brown <aaron.f.brown@×××××.com>
23229 -Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@×××××.com>
23230 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
23231 -Signed-off-by: Mike Pagano <mpagano@g.o>
23232 ----
23233 - drivers/net/ethernet/intel/e1000/e1000_main.c | 10 +++++++++-
23234 - 1 file changed, 9 insertions(+), 1 deletion(-)
23235 -
23236 -diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
23237 -index 7f997d3..a71c446 100644
23238 ---- a/drivers/net/ethernet/intel/e1000/e1000_main.c
23239 -+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
23240 -@@ -144,6 +144,11 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
23241 - static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
23242 - struct e1000_rx_ring *rx_ring,
23243 - int *work_done, int work_to_do);
23244 -+static void e1000_alloc_dummy_rx_buffers(struct e1000_adapter *adapter,
23245 -+ struct e1000_rx_ring *rx_ring,
23246 -+ int cleaned_count)
23247 +
23248 +-/* Send a fin. The caller locks the socket for us. This cannot be
23249 +- * allowed to fail queueing a FIN frame under any circumstances.
23250 ++/* We allow to exceed memory limits for FIN packets to expedite
23251 ++ * connection tear down and (memory) recovery.
23252 ++ * Otherwise tcp_send_fin() could be tempted to either delay FIN
23253 ++ * or even be forced to close flow without any FIN.
23254 ++ */
23255 ++static void sk_forced_wmem_schedule(struct sock *sk, int size)
23256 +{
23257 ++ int amt, status;
23258 ++
23259 ++ if (size <= sk->sk_forward_alloc)
23260 ++ return;
23261 ++ amt = sk_mem_pages(size);
23262 ++ sk->sk_forward_alloc += amt * SK_MEM_QUANTUM;
23263 ++ sk_memory_allocated_add(sk, amt, &status);
23264 +}
23265 - static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
23266 - struct e1000_rx_ring *rx_ring,
23267 - int cleaned_count);
23268 -@@ -3552,8 +3557,11 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
23269 - msleep(1);
23270 - /* e1000_down has a dependency on max_frame_size */
23271 - hw->max_frame_size = max_frame;
23272 -- if (netif_running(netdev))
23273 -+ if (netif_running(netdev)) {
23274 -+ /* prevent buffers from being reallocated */
23275 -+ adapter->alloc_rx_buf = e1000_alloc_dummy_rx_buffers;
23276 - e1000_down(adapter);
23277 -+ }
23278 ++
23279 ++/* Send a FIN. The caller locks the socket for us.
23280 ++ * We should try to send a FIN packet really hard, but eventually give up.
23281 + */
23282 + void tcp_send_fin(struct sock *sk)
23283 + {
23284 ++ struct sk_buff *skb, *tskb = tcp_write_queue_tail(sk);
23285 + struct tcp_sock *tp = tcp_sk(sk);
23286 +- struct sk_buff *skb = tcp_write_queue_tail(sk);
23287 +- int mss_now;
23288
23289 - /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN
23290 - * means we reserve 2 more, this pushes us to allocate from the next
23291 ---
23292 -2.3.6
23293 -
23294 -
23295 -From dada7797e4595606cf730600d8c9a03955a8264b Mon Sep 17 00:00:00 2001
23296 -From: Johannes Berg <johannes.berg@×××××.com>
23297 -Date: Sat, 21 Mar 2015 07:41:04 +0100
23298 -Subject: [PATCH 208/219] mac80211: send AP probe as unicast again
23299 -Cc: mpagano@g.o
23300 -
23301 -commit a73f8e21f3f93159bc19e154e8f50891c22c11db upstream.
23302 -
23303 -Louis reported that a static checker was complaining that
23304 -the 'dst' variable was set (multiple times) but not used.
23305 -This is due to a previous commit having removed the usage
23306 -(apparently erroneously), so add it back.
23307 -
23308 -Fixes: a344d6778a98 ("mac80211: allow drivers to support NL80211_SCAN_FLAG_RANDOM_ADDR")
23309 -Reported-by: Louis Langholtz <lou_langholtz@××.com>
23310 -Signed-off-by: Johannes Berg <johannes.berg@×××××.com>
23311 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
23312 -Signed-off-by: Mike Pagano <mpagano@g.o>
23313 ----
23314 - net/mac80211/mlme.c | 2 +-
23315 - 1 file changed, 1 insertion(+), 1 deletion(-)
23316 -
23317 +- /* Optimization, tack on the FIN if we have a queue of
23318 +- * unsent frames. But be careful about outgoing SACKS
23319 +- * and IP options.
23320 ++ /* Optimization, tack on the FIN if we have one skb in write queue and
23321 ++ * this skb was not yet sent, or we are under memory pressure.
23322 ++ * Note: in the latter case, FIN packet will be sent after a timeout,
23323 ++ * as TCP stack thinks it has already been transmitted.
23324 + */
23325 +- mss_now = tcp_current_mss(sk);
23326 +-
23327 +- if (tcp_send_head(sk) != NULL) {
23328 +- TCP_SKB_CB(skb)->tcp_flags |= TCPHDR_FIN;
23329 +- TCP_SKB_CB(skb)->end_seq++;
23330 ++ if (tskb && (tcp_send_head(sk) || sk_under_memory_pressure(sk))) {
23331 ++coalesce:
23332 ++ TCP_SKB_CB(tskb)->tcp_flags |= TCPHDR_FIN;
23333 ++ TCP_SKB_CB(tskb)->end_seq++;
23334 + tp->write_seq++;
23335 ++ if (!tcp_send_head(sk)) {
23336 ++ /* This means tskb was already sent.
23337 ++ * Pretend we included the FIN on previous transmit.
23338 ++ * We need to set tp->snd_nxt to the value it would have
23339 ++ * if FIN had been sent. This is because retransmit path
23340 ++ * does not change tp->snd_nxt.
23341 ++ */
23342 ++ tp->snd_nxt++;
23343 ++ return;
23344 ++ }
23345 + } else {
23346 +- /* Socket is locked, keep trying until memory is available. */
23347 +- for (;;) {
23348 +- skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation);
23349 +- if (skb)
23350 +- break;
23351 +- yield();
23352 ++ skb = alloc_skb_fclone(MAX_TCP_HEADER, sk->sk_allocation);
23353 ++ if (unlikely(!skb)) {
23354 ++ if (tskb)
23355 ++ goto coalesce;
23356 ++ return;
23357 + }
23358 ++ skb_reserve(skb, MAX_TCP_HEADER);
23359 ++ sk_forced_wmem_schedule(sk, skb->truesize);
23360 + /* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */
23361 + tcp_init_nondata_skb(skb, tp->write_seq,
23362 + TCPHDR_ACK | TCPHDR_FIN);
23363 + tcp_queue_skb(sk, skb);
23364 + }
23365 +- __tcp_push_pending_frames(sk, mss_now, TCP_NAGLE_OFF);
23366 ++ __tcp_push_pending_frames(sk, tcp_current_mss(sk), TCP_NAGLE_OFF);
23367 + }
23368 +
23369 + /* We get here when a process closes a file descriptor (either due to
23370 diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
23371 index 142f66a..0ca013d 100644
23372 --- a/net/mac80211/mlme.c
23373 @@ -16114,744 +8177,411 @@ index 142f66a..0ca013d 100644
23374 ssid + 2, ssid_len, NULL,
23375 0, (u32) -1, true, 0,
23376 ifmgd->associated->channel, false);
23377 ---
23378 -2.3.6
23379 -
23380 -
23381 -From e86ecd8a7bbc590987b4046c523d8caaef8f8b5f Mon Sep 17 00:00:00 2001
23382 -From: Daniel Borkmann <daniel@×××××××××.net>
23383 -Date: Thu, 12 Mar 2015 17:21:42 +0100
23384 -Subject: [PATCH 209/219] ebpf: verifier: check that call reg with ARG_ANYTHING
23385 - is initialized
23386 -Cc: mpagano@g.o
23387 -
23388 -commit 80f1d68ccba70b1060c9c7360ca83da430f66bed upstream.
23389 -
23390 -I noticed that a helper function with argument type ARG_ANYTHING does
23391 -not need to have an initialized value (register).
23392 -
23393 -This can worst case lead to unintented stack memory leakage in future
23394 -helper functions if they are not carefully designed, or unintended
23395 -application behaviour in case the application developer was not careful
23396 -enough to match a correct helper function signature in the API.
23397 -
23398 -The underlying issue is that ARG_ANYTHING should actually be split
23399 -into two different semantics:
23400 -
23401 - 1) ARG_DONTCARE for function arguments that the helper function
23402 - does not care about (in other words: the default for unused
23403 - function arguments), and
23404 -
23405 - 2) ARG_ANYTHING that is an argument actually being used by a
23406 - helper function and *guaranteed* to be an initialized register.
23407 -
23408 -The current risk is low: ARG_ANYTHING is only used for the 'flags'
23409 -argument (r4) in bpf_map_update_elem() that internally does strict
23410 -checking.
23411 -
23412 -Fixes: 17a5267067f3 ("bpf: verifier (add verifier core)")
23413 -Signed-off-by: Daniel Borkmann <daniel@×××××××××.net>
23414 -Acked-by: Alexei Starovoitov <ast@××××××××.com>
23415 -Signed-off-by: David S. Miller <davem@×××××××××.net>
23416 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
23417 -Signed-off-by: Mike Pagano <mpagano@g.o>
23418 ----
23419 - include/linux/bpf.h | 4 +++-
23420 - kernel/bpf/verifier.c | 5 ++++-
23421 - 2 files changed, 7 insertions(+), 2 deletions(-)
23422 -
23423 -diff --git a/include/linux/bpf.h b/include/linux/bpf.h
23424 -index bbfceb7..33b52fb 100644
23425 ---- a/include/linux/bpf.h
23426 -+++ b/include/linux/bpf.h
23427 -@@ -48,7 +48,7 @@ struct bpf_map *bpf_map_get(struct fd f);
23428 +diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
23429 +index 05919bf..d1d7a81 100644
23430 +--- a/net/netlink/af_netlink.c
23431 ++++ b/net/netlink/af_netlink.c
23432 +@@ -1616,13 +1616,11 @@ static struct sk_buff *netlink_alloc_large_skb(unsigned int size,
23433 + if (data == NULL)
23434 + return NULL;
23435
23436 - /* function argument constraints */
23437 - enum bpf_arg_type {
23438 -- ARG_ANYTHING = 0, /* any argument is ok */
23439 -+ ARG_DONTCARE = 0, /* unused argument in helper function */
23440 +- skb = build_skb(data, size);
23441 ++ skb = __build_skb(data, size);
23442 + if (skb == NULL)
23443 + vfree(data);
23444 +- else {
23445 +- skb->head_frag = 0;
23446 ++ else
23447 + skb->destructor = netlink_skb_destructor;
23448 +- }
23449
23450 - /* the following constraints used to prototype
23451 - * bpf_map_lookup/update/delete_elem() functions
23452 -@@ -62,6 +62,8 @@ enum bpf_arg_type {
23453 - */
23454 - ARG_PTR_TO_STACK, /* any pointer to eBPF program stack */
23455 - ARG_CONST_STACK_SIZE, /* number of bytes accessed from stack */
23456 + return skb;
23457 + }
23458 +diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c
23459 +index 2ca9f2e..53745f4 100644
23460 +--- a/sound/pci/emu10k1/emuproc.c
23461 ++++ b/sound/pci/emu10k1/emuproc.c
23462 +@@ -241,31 +241,22 @@ static void snd_emu10k1_proc_spdif_read(struct snd_info_entry *entry,
23463 + struct snd_emu10k1 *emu = entry->private_data;
23464 + u32 value;
23465 + u32 value2;
23466 +- unsigned long flags;
23467 + u32 rate;
23468 +
23469 + if (emu->card_capabilities->emu_model) {
23470 +- spin_lock_irqsave(&emu->emu_lock, flags);
23471 + snd_emu1010_fpga_read(emu, 0x38, &value);
23472 +- spin_unlock_irqrestore(&emu->emu_lock, flags);
23473 + if ((value & 0x1) == 0) {
23474 +- spin_lock_irqsave(&emu->emu_lock, flags);
23475 + snd_emu1010_fpga_read(emu, 0x2a, &value);
23476 + snd_emu1010_fpga_read(emu, 0x2b, &value2);
23477 +- spin_unlock_irqrestore(&emu->emu_lock, flags);
23478 + rate = 0x1770000 / (((value << 5) | value2)+1);
23479 + snd_iprintf(buffer, "ADAT Locked : %u\n", rate);
23480 + } else {
23481 + snd_iprintf(buffer, "ADAT Unlocked\n");
23482 + }
23483 +- spin_lock_irqsave(&emu->emu_lock, flags);
23484 + snd_emu1010_fpga_read(emu, 0x20, &value);
23485 +- spin_unlock_irqrestore(&emu->emu_lock, flags);
23486 + if ((value & 0x4) == 0) {
23487 +- spin_lock_irqsave(&emu->emu_lock, flags);
23488 + snd_emu1010_fpga_read(emu, 0x28, &value);
23489 + snd_emu1010_fpga_read(emu, 0x29, &value2);
23490 +- spin_unlock_irqrestore(&emu->emu_lock, flags);
23491 + rate = 0x1770000 / (((value << 5) | value2)+1);
23492 + snd_iprintf(buffer, "SPDIF Locked : %d\n", rate);
23493 + } else {
23494 +@@ -410,14 +401,11 @@ static void snd_emu_proc_emu1010_reg_read(struct snd_info_entry *entry,
23495 + {
23496 + struct snd_emu10k1 *emu = entry->private_data;
23497 + u32 value;
23498 +- unsigned long flags;
23499 + int i;
23500 + snd_iprintf(buffer, "EMU1010 Registers:\n\n");
23501 +
23502 + for(i = 0; i < 0x40; i+=1) {
23503 +- spin_lock_irqsave(&emu->emu_lock, flags);
23504 + snd_emu1010_fpga_read(emu, i, &value);
23505 +- spin_unlock_irqrestore(&emu->emu_lock, flags);
23506 + snd_iprintf(buffer, "%02X: %08X, %02X\n", i, value, (value >> 8) & 0x7f);
23507 + }
23508 + }
23509 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
23510 +index f9d12c0..2fd490b 100644
23511 +--- a/sound/pci/hda/patch_realtek.c
23512 ++++ b/sound/pci/hda/patch_realtek.c
23513 +@@ -5047,12 +5047,14 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
23514 + SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
23515 + SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
23516 + SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
23517 ++ SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
23518 + SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
23519 + SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
23520 + SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
23521 + SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
23522 + SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
23523 + SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
23524 ++ SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
23525 + SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
23526 + SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
23527 + SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
23528 +@@ -5142,6 +5144,16 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
23529 + {0x1b, 0x411111f0}, \
23530 + {0x1e, 0x411111f0}
23531 +
23532 ++#define ALC256_STANDARD_PINS \
23533 ++ {0x12, 0x90a60140}, \
23534 ++ {0x14, 0x90170110}, \
23535 ++ {0x19, 0x411111f0}, \
23536 ++ {0x1a, 0x411111f0}, \
23537 ++ {0x1b, 0x411111f0}, \
23538 ++ {0x1d, 0x40700001}, \
23539 ++ {0x1e, 0x411111f0}, \
23540 ++ {0x21, 0x02211020}
23541 +
23542 -+ ARG_ANYTHING, /* any (initialized) argument is ok */
23543 - };
23544 + #define ALC282_STANDARD_PINS \
23545 + {0x14, 0x90170110}, \
23546 + {0x18, 0x411111f0}, \
23547 +@@ -5235,15 +5247,11 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
23548 + {0x1d, 0x40700001},
23549 + {0x21, 0x02211050}),
23550 + SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
23551 +- {0x12, 0x90a60140},
23552 +- {0x13, 0x40000000},
23553 +- {0x14, 0x90170110},
23554 +- {0x19, 0x411111f0},
23555 +- {0x1a, 0x411111f0},
23556 +- {0x1b, 0x411111f0},
23557 +- {0x1d, 0x40700001},
23558 +- {0x1e, 0x411111f0},
23559 +- {0x21, 0x02211020}),
23560 ++ ALC256_STANDARD_PINS,
23561 ++ {0x13, 0x40000000}),
23562 ++ SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
23563 ++ ALC256_STANDARD_PINS,
23564 ++ {0x13, 0x411111f0}),
23565 + SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
23566 + {0x12, 0x90a60130},
23567 + {0x13, 0x40000000},
23568 +@@ -5563,6 +5571,8 @@ static int patch_alc269(struct hda_codec *codec)
23569 + break;
23570 + case 0x10ec0256:
23571 + spec->codec_variant = ALC269_TYPE_ALC256;
23572 ++ spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
23573 ++ alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
23574 + break;
23575 + }
23576
23577 - /* type of values returned from helper functions */
23578 -diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
23579 -index 36508e6..5d8ea3d 100644
23580 ---- a/kernel/bpf/verifier.c
23581 -+++ b/kernel/bpf/verifier.c
23582 -@@ -755,7 +755,7 @@ static int check_func_arg(struct verifier_env *env, u32 regno,
23583 - enum bpf_reg_type expected_type;
23584 - int err = 0;
23585 +@@ -5576,8 +5586,8 @@ static int patch_alc269(struct hda_codec *codec)
23586 + if (err < 0)
23587 + goto error;
23588
23589 -- if (arg_type == ARG_ANYTHING)
23590 -+ if (arg_type == ARG_DONTCARE)
23591 - return 0;
23592 +- if (!spec->gen.no_analog && spec->gen.beep_nid)
23593 +- set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
23594 ++ if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid)
23595 ++ set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
23596
23597 - if (reg->type == NOT_INIT) {
23598 -@@ -763,6 +763,9 @@ static int check_func_arg(struct verifier_env *env, u32 regno,
23599 - return -EACCES;
23600 + codec->patch_ops = alc_patch_ops;
23601 + #ifdef CONFIG_PM
23602 +diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
23603 +index 7d3a6ac..e770ee6 100644
23604 +--- a/sound/soc/codecs/cs4271.c
23605 ++++ b/sound/soc/codecs/cs4271.c
23606 +@@ -561,10 +561,10 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec)
23607 + if (gpio_is_valid(cs4271->gpio_nreset)) {
23608 + /* Reset codec */
23609 + gpio_direction_output(cs4271->gpio_nreset, 0);
23610 +- udelay(1);
23611 ++ mdelay(1);
23612 + gpio_set_value(cs4271->gpio_nreset, 1);
23613 + /* Give the codec time to wake up */
23614 +- udelay(1);
23615 ++ mdelay(1);
23616 }
23617
23618 -+ if (arg_type == ARG_ANYTHING)
23619 -+ return 0;
23620 -+
23621 - if (arg_type == ARG_PTR_TO_STACK || arg_type == ARG_PTR_TO_MAP_KEY ||
23622 - arg_type == ARG_PTR_TO_MAP_VALUE) {
23623 - expected_type = PTR_TO_STACK;
23624 ---
23625 -2.3.6
23626 -
23627 -
23628 -From 0b97a15f6fedf422d276245866319990c2c771c5 Mon Sep 17 00:00:00 2001
23629 -From: David Rientjes <rientjes@××××××.com>
23630 -Date: Tue, 14 Apr 2015 15:46:58 -0700
23631 -Subject: [PATCH 210/219] mm, thp: really limit transparent hugepage allocation
23632 - to local node
23633 -Cc: mpagano@g.o
23634 -
23635 -commit 5265047ac30191ea24b16503165000c225f54feb upstream.
23636 -
23637 -Commit 077fcf116c8c ("mm/thp: allocate transparent hugepages on local
23638 -node") restructured alloc_hugepage_vma() with the intent of only
23639 -allocating transparent hugepages locally when there was not an effective
23640 -interleave mempolicy.
23641 -
23642 -alloc_pages_exact_node() does not limit the allocation to the single node,
23643 -however, but rather prefers it. This is because __GFP_THISNODE is not set
23644 -which would cause the node-local nodemask to be passed. Without it, only
23645 -a nodemask that prefers the local node is passed.
23646 -
23647 -Fix this by passing __GFP_THISNODE and falling back to small pages when
23648 -the allocation fails.
23649 -
23650 -Commit 9f1b868a13ac ("mm: thp: khugepaged: add policy for finding target
23651 -node") suffers from a similar problem for khugepaged, which is also fixed.
23652 -
23653 -Fixes: 077fcf116c8c ("mm/thp: allocate transparent hugepages on local node")
23654 -Fixes: 9f1b868a13ac ("mm: thp: khugepaged: add policy for finding target node")
23655 -Signed-off-by: David Rientjes <rientjes@××××××.com>
23656 -Acked-by: Vlastimil Babka <vbabka@××××.cz>
23657 -Cc: Christoph Lameter <cl@×××××.com>
23658 -Cc: Pekka Enberg <penberg@××××××.org>
23659 -Cc: Joonsoo Kim <iamjoonsoo.kim@×××.com>
23660 -Cc: Johannes Weiner <hannes@×××××××.org>
23661 -Cc: Mel Gorman <mgorman@××××.de>
23662 -Cc: Pravin Shelar <pshelar@××××××.com>
23663 -Cc: Jarno Rajahalme <jrajahalme@××××××.com>
23664 -Cc: Li Zefan <lizefan@××××××.com>
23665 -Cc: Greg Thelen <gthelen@××××××.com>
23666 -Cc: Tejun Heo <tj@××××××.org>
23667 -Signed-off-by: Andrew Morton <akpm@××××××××××××××××.org>
23668 -Signed-off-by: Linus Torvalds <torvalds@××××××××××××××××.org>
23669 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
23670 -Signed-off-by: Mike Pagano <mpagano@g.o>
23671 ----
23672 - mm/huge_memory.c | 9 +++++++--
23673 - mm/mempolicy.c | 3 ++-
23674 - 2 files changed, 9 insertions(+), 3 deletions(-)
23675 -
23676 -diff --git a/mm/huge_memory.c b/mm/huge_memory.c
23677 -index 6817b03..956d4db 100644
23678 ---- a/mm/huge_memory.c
23679 -+++ b/mm/huge_memory.c
23680 -@@ -2316,8 +2316,14 @@ static struct page
23681 - struct vm_area_struct *vma, unsigned long address,
23682 - int node)
23683 - {
23684 -+ gfp_t flags;
23685 -+
23686 - VM_BUG_ON_PAGE(*hpage, *hpage);
23687 -
23688 -+ /* Only allocate from the target node */
23689 -+ flags = alloc_hugepage_gfpmask(khugepaged_defrag(), __GFP_OTHER_NODE) |
23690 -+ __GFP_THISNODE;
23691 -+
23692 - /*
23693 - * Before allocating the hugepage, release the mmap_sem read lock.
23694 - * The allocation can take potentially a long time if it involves
23695 -@@ -2326,8 +2332,7 @@ static struct page
23696 - */
23697 - up_read(&mm->mmap_sem);
23698 + ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2,
23699 +diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
23700 +index 474cae8..8c09e3f 100644
23701 +--- a/sound/soc/codecs/pcm512x.c
23702 ++++ b/sound/soc/codecs/pcm512x.c
23703 +@@ -304,9 +304,9 @@ static const struct soc_enum pcm512x_veds =
23704 + static const struct snd_kcontrol_new pcm512x_controls[] = {
23705 + SOC_DOUBLE_R_TLV("Digital Playback Volume", PCM512x_DIGITAL_VOLUME_2,
23706 + PCM512x_DIGITAL_VOLUME_3, 0, 255, 1, digital_tlv),
23707 +-SOC_DOUBLE_TLV("Playback Volume", PCM512x_ANALOG_GAIN_CTRL,
23708 ++SOC_DOUBLE_TLV("Analogue Playback Volume", PCM512x_ANALOG_GAIN_CTRL,
23709 + PCM512x_LAGN_SHIFT, PCM512x_RAGN_SHIFT, 1, 1, analog_tlv),
23710 +-SOC_DOUBLE_TLV("Playback Boost Volume", PCM512x_ANALOG_GAIN_BOOST,
23711 ++SOC_DOUBLE_TLV("Analogue Playback Boost Volume", PCM512x_ANALOG_GAIN_BOOST,
23712 + PCM512x_AGBL_SHIFT, PCM512x_AGBR_SHIFT, 1, 0, boost_tlv),
23713 + SOC_DOUBLE("Digital Playback Switch", PCM512x_MUTE, PCM512x_RQML_SHIFT,
23714 + PCM512x_RQMR_SHIFT, 1, 1),
23715 +@@ -576,8 +576,8 @@ static int pcm512x_find_pll_coeff(struct snd_soc_dai *dai,
23716
23717 -- *hpage = alloc_pages_exact_node(node, alloc_hugepage_gfpmask(
23718 -- khugepaged_defrag(), __GFP_OTHER_NODE), HPAGE_PMD_ORDER);
23719 -+ *hpage = alloc_pages_exact_node(node, flags, HPAGE_PMD_ORDER);
23720 - if (unlikely(!*hpage)) {
23721 - count_vm_event(THP_COLLAPSE_ALLOC_FAILED);
23722 - *hpage = ERR_PTR(-ENOMEM);
23723 -diff --git a/mm/mempolicy.c b/mm/mempolicy.c
23724 -index 4721046..de5dc5e 100644
23725 ---- a/mm/mempolicy.c
23726 -+++ b/mm/mempolicy.c
23727 -@@ -1985,7 +1985,8 @@ retry_cpuset:
23728 - nmask = policy_nodemask(gfp, pol);
23729 - if (!nmask || node_isset(node, *nmask)) {
23730 - mpol_cond_put(pol);
23731 -- page = alloc_pages_exact_node(node, gfp, order);
23732 -+ page = alloc_pages_exact_node(node,
23733 -+ gfp | __GFP_THISNODE, order);
23734 - goto out;
23735 - }
23736 + /* pllin_rate / P (or here, den) cannot be greater than 20 MHz */
23737 + if (pllin_rate / den > 20000000 && num < 8) {
23738 +- num *= 20000000 / (pllin_rate / den);
23739 +- den *= 20000000 / (pllin_rate / den);
23740 ++ num *= DIV_ROUND_UP(pllin_rate / den, 20000000);
23741 ++ den *= DIV_ROUND_UP(pllin_rate / den, 20000000);
23742 }
23743 ---
23744 -2.3.6
23745 -
23746 -
23747 -From 2649caa31cc3143b2ad3039ac581dacd7529a631 Mon Sep 17 00:00:00 2001
23748 -From: mancha security <mancha1@××××.com>
23749 -Date: Wed, 18 Mar 2015 18:47:25 +0100
23750 -Subject: [PATCH 211/219] lib: memzero_explicit: use barrier instead of
23751 - OPTIMIZER_HIDE_VAR
23752 -Cc: mpagano@g.o
23753 -
23754 -commit 0b053c9518292705736329a8fe20ef4686ffc8e9 upstream.
23755 -
23756 -OPTIMIZER_HIDE_VAR(), as defined when using gcc, is insufficient to
23757 -ensure protection from dead store optimization.
23758 -
23759 -For the random driver and crypto drivers, calls are emitted ...
23760 -
23761 - $ gdb vmlinux
23762 - (gdb) disassemble memzero_explicit
23763 - Dump of assembler code for function memzero_explicit:
23764 - 0xffffffff813a18b0 <+0>: push %rbp
23765 - 0xffffffff813a18b1 <+1>: mov %rsi,%rdx
23766 - 0xffffffff813a18b4 <+4>: xor %esi,%esi
23767 - 0xffffffff813a18b6 <+6>: mov %rsp,%rbp
23768 - 0xffffffff813a18b9 <+9>: callq 0xffffffff813a7120 <memset>
23769 - 0xffffffff813a18be <+14>: pop %rbp
23770 - 0xffffffff813a18bf <+15>: retq
23771 - End of assembler dump.
23772 -
23773 - (gdb) disassemble extract_entropy
23774 - [...]
23775 - 0xffffffff814a5009 <+313>: mov %r12,%rdi
23776 - 0xffffffff814a500c <+316>: mov $0xa,%esi
23777 - 0xffffffff814a5011 <+321>: callq 0xffffffff813a18b0 <memzero_explicit>
23778 - 0xffffffff814a5016 <+326>: mov -0x48(%rbp),%rax
23779 - [...]
23780 -
23781 -... but in case in future we might use facilities such as LTO, then
23782 -OPTIMIZER_HIDE_VAR() is not sufficient to protect gcc from a possible
23783 -eviction of the memset(). We have to use a compiler barrier instead.
23784 -
23785 -Minimal test example when we assume memzero_explicit() would *not* be
23786 -a call, but would have been *inlined* instead:
23787 -
23788 - static inline void memzero_explicit(void *s, size_t count)
23789 - {
23790 - memset(s, 0, count);
23791 - <foo>
23792 - }
23793 -
23794 - int main(void)
23795 - {
23796 - char buff[20];
23797 -
23798 - snprintf(buff, sizeof(buff) - 1, "test");
23799 - printf("%s", buff);
23800 -
23801 - memzero_explicit(buff, sizeof(buff));
23802 - return 0;
23803 - }
23804 -
23805 -With <foo> := OPTIMIZER_HIDE_VAR():
23806 -
23807 - (gdb) disassemble main
23808 - Dump of assembler code for function main:
23809 - [...]
23810 - 0x0000000000400464 <+36>: callq 0x400410 <printf@plt>
23811 - 0x0000000000400469 <+41>: xor %eax,%eax
23812 - 0x000000000040046b <+43>: add $0x28,%rsp
23813 - 0x000000000040046f <+47>: retq
23814 - End of assembler dump.
23815 -
23816 -With <foo> := barrier():
23817 -
23818 - (gdb) disassemble main
23819 - Dump of assembler code for function main:
23820 - [...]
23821 - 0x0000000000400464 <+36>: callq 0x400410 <printf@plt>
23822 - 0x0000000000400469 <+41>: movq $0x0,(%rsp)
23823 - 0x0000000000400471 <+49>: movq $0x0,0x8(%rsp)
23824 - 0x000000000040047a <+58>: movl $0x0,0x10(%rsp)
23825 - 0x0000000000400482 <+66>: xor %eax,%eax
23826 - 0x0000000000400484 <+68>: add $0x28,%rsp
23827 - 0x0000000000400488 <+72>: retq
23828 - End of assembler dump.
23829 -
23830 -As can be seen, movq, movq, movl are being emitted inlined
23831 -via memset().
23832 -
23833 -Reference: http://thread.gmane.org/gmane.linux.kernel.cryptoapi/13764/
23834 -Fixes: d4c5efdb9777 ("random: add and use memzero_explicit() for clearing data")
23835 -Cc: Theodore Ts'o <tytso@×××.edu>
23836 -Signed-off-by: mancha security <mancha1@××××.com>
23837 -Signed-off-by: Daniel Borkmann <daniel@×××××××××.net>
23838 -Acked-by: Hannes Frederic Sowa <hannes@×××××××××××××××.org>
23839 -Acked-by: Stephan Mueller <smueller@×××××××.de>
23840 -Signed-off-by: Herbert Xu <herbert@××××××××××××××××.au>
23841 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
23842 -Signed-off-by: Mike Pagano <mpagano@g.o>
23843 ----
23844 - lib/string.c | 2 +-
23845 - 1 file changed, 1 insertion(+), 1 deletion(-)
23846 -
23847 -diff --git a/lib/string.c b/lib/string.c
23848 -index ce81aae..a579201 100644
23849 ---- a/lib/string.c
23850 -+++ b/lib/string.c
23851 -@@ -607,7 +607,7 @@ EXPORT_SYMBOL(memset);
23852 - void memzero_explicit(void *s, size_t count)
23853 - {
23854 - memset(s, 0, count);
23855 -- OPTIMIZER_HIDE_VAR(s);
23856 -+ barrier();
23857 - }
23858 - EXPORT_SYMBOL(memzero_explicit);
23859 + dev_dbg(dev, "num / den = %lu / %lu\n", num, den);
23860
23861 ---
23862 -2.3.6
23863 -
23864 -
23865 -From 1cd176dfd9e5e4d0cae0545fa8c56ecd582b2e9a Mon Sep 17 00:00:00 2001
23866 -From: Nicolas Iooss <nicolas.iooss_linux@×××.org>
23867 -Date: Fri, 13 Mar 2015 15:17:14 +0800
23868 -Subject: [PATCH 212/219] wl18xx: show rx_frames_per_rates as an array as it
23869 - really is
23870 -Cc: mpagano@g.o
23871 -
23872 -commit a3fa71c40f1853d0c27e8f5bc01a722a705d9682 upstream.
23873 -
23874 -In struct wl18xx_acx_rx_rate_stat, rx_frames_per_rates field is an
23875 -array, not a number. This means WL18XX_DEBUGFS_FWSTATS_FILE can't be
23876 -used to display this field in debugfs (it would display a pointer, not
23877 -the actual data). Use WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY instead.
23878 -
23879 -This bug has been found by adding a __printf attribute to
23880 -wl1271_format_buffer. gcc complained about "format '%u' expects
23881 -argument of type 'unsigned int', but argument 5 has type 'u32 *'".
23882 -
23883 -Fixes: c5d94169e818 ("wl18xx: use new fw stats structures")
23884 -Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@×××.org>
23885 -Signed-off-by: Kalle Valo <kvalo@××××××××××.org>
23886 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
23887 -Signed-off-by: Mike Pagano <mpagano@g.o>
23888 ----
23889 - drivers/net/wireless/ti/wl18xx/debugfs.c | 2 +-
23890 - drivers/net/wireless/ti/wlcore/debugfs.h | 4 ++--
23891 - 2 files changed, 3 insertions(+), 3 deletions(-)
23892 -
23893 -diff --git a/drivers/net/wireless/ti/wl18xx/debugfs.c b/drivers/net/wireless/ti/wl18xx/debugfs.c
23894 -index c93fae9..5fbd223 100644
23895 ---- a/drivers/net/wireless/ti/wl18xx/debugfs.c
23896 -+++ b/drivers/net/wireless/ti/wl18xx/debugfs.c
23897 -@@ -139,7 +139,7 @@ WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, protection_filter, "%u");
23898 - WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, accum_arp_pend_requests, "%u");
23899 - WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, max_arp_queue_dep, "%u");
23900 +diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c
23901 +index 31bb480..9e71c76 100644
23902 +--- a/sound/soc/codecs/wm8741.c
23903 ++++ b/sound/soc/codecs/wm8741.c
23904 +@@ -123,7 +123,7 @@ static struct {
23905 + };
23906
23907 --WL18XX_DEBUGFS_FWSTATS_FILE(rx_rate, rx_frames_per_rates, "%u");
23908 -+WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(rx_rate, rx_frames_per_rates, 50);
23909 + static const unsigned int rates_11289[] = {
23910 +- 44100, 88235,
23911 ++ 44100, 88200,
23912 + };
23913
23914 - WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, tx_agg_vs_rate,
23915 - AGGR_STATS_TX_AGG*AGGR_STATS_TX_RATE);
23916 -diff --git a/drivers/net/wireless/ti/wlcore/debugfs.h b/drivers/net/wireless/ti/wlcore/debugfs.h
23917 -index 0f2cfb0..bf14676 100644
23918 ---- a/drivers/net/wireless/ti/wlcore/debugfs.h
23919 -+++ b/drivers/net/wireless/ti/wlcore/debugfs.h
23920 -@@ -26,8 +26,8 @@
23921 + static const struct snd_pcm_hw_constraint_list constraints_11289 = {
23922 +@@ -150,7 +150,7 @@ static const struct snd_pcm_hw_constraint_list constraints_16384 = {
23923 + };
23924
23925 - #include "wlcore.h"
23926 + static const unsigned int rates_16934[] = {
23927 +- 44100, 88235,
23928 ++ 44100, 88200,
23929 + };
23930
23931 --int wl1271_format_buffer(char __user *userbuf, size_t count,
23932 -- loff_t *ppos, char *fmt, ...);
23933 -+__printf(4, 5) int wl1271_format_buffer(char __user *userbuf, size_t count,
23934 -+ loff_t *ppos, char *fmt, ...);
23935 + static const struct snd_pcm_hw_constraint_list constraints_16934 = {
23936 +@@ -168,7 +168,7 @@ static const struct snd_pcm_hw_constraint_list constraints_18432 = {
23937 + };
23938
23939 - int wl1271_debugfs_init(struct wl1271 *wl);
23940 - void wl1271_debugfs_exit(struct wl1271 *wl);
23941 ---
23942 -2.3.6
23943 -
23944 -
23945 -From 8a7e1640e89ee191d677e2d994476ce68e2160ea Mon Sep 17 00:00:00 2001
23946 -From: "Vutla, Lokesh" <lokeshvutla@××.com>
23947 -Date: Tue, 31 Mar 2015 09:52:25 +0530
23948 -Subject: [PATCH 213/219] crypto: omap-aes - Fix support for unequal lengths
23949 -Cc: mpagano@g.o
23950 -
23951 -commit 6d7e7e02a044025237b6f62a20521170b794537f upstream.
23952 -
23953 -For cases where total length of an input SGs is not same as
23954 -length of the input data for encryption, omap-aes driver
23955 -crashes. This happens in the case when IPsec is trying to use
23956 -omap-aes driver.
23957 -
23958 -To avoid this, we copy all the pages from the input SG list
23959 -into a contiguous buffer and prepare a single element SG list
23960 -for this buffer with length as the total bytes to crypt, which is
23961 -similar thing that is done in case of unaligned lengths.
23962 -
23963 -Fixes: 6242332ff2f3 ("crypto: omap-aes - Add support for cases of unaligned lengths")
23964 -Signed-off-by: Lokesh Vutla <lokeshvutla@××.com>
23965 -Signed-off-by: Herbert Xu <herbert@××××××××××××××××.au>
23966 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
23967 -Signed-off-by: Mike Pagano <mpagano@g.o>
23968 ----
23969 - drivers/crypto/omap-aes.c | 14 +++++++++++---
23970 - 1 file changed, 11 insertions(+), 3 deletions(-)
23971 -
23972 -diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
23973 -index 42f95a4..9a28b7e 100644
23974 ---- a/drivers/crypto/omap-aes.c
23975 -+++ b/drivers/crypto/omap-aes.c
23976 -@@ -554,15 +554,23 @@ static int omap_aes_crypt_dma_stop(struct omap_aes_dev *dd)
23977 - return err;
23978 - }
23979 + static const unsigned int rates_22579[] = {
23980 +- 44100, 88235, 1764000
23981 ++ 44100, 88200, 176400
23982 + };
23983
23984 --static int omap_aes_check_aligned(struct scatterlist *sg)
23985 -+static int omap_aes_check_aligned(struct scatterlist *sg, int total)
23986 - {
23987 -+ int len = 0;
23988 -+
23989 - while (sg) {
23990 - if (!IS_ALIGNED(sg->offset, 4))
23991 - return -1;
23992 - if (!IS_ALIGNED(sg->length, AES_BLOCK_SIZE))
23993 - return -1;
23994 -+
23995 -+ len += sg->length;
23996 - sg = sg_next(sg);
23997 - }
23998 -+
23999 -+ if (len != total)
24000 -+ return -1;
24001 -+
24002 - return 0;
24003 - }
24004 + static const struct snd_pcm_hw_constraint_list constraints_22579 = {
24005 +@@ -186,7 +186,7 @@ static const struct snd_pcm_hw_constraint_list constraints_24576 = {
24006 + };
24007
24008 -@@ -633,8 +641,8 @@ static int omap_aes_handle_queue(struct omap_aes_dev *dd,
24009 - dd->in_sg = req->src;
24010 - dd->out_sg = req->dst;
24011 + static const unsigned int rates_36864[] = {
24012 +- 48000, 96000, 19200
24013 ++ 48000, 96000, 192000
24014 + };
24015
24016 -- if (omap_aes_check_aligned(dd->in_sg) ||
24017 -- omap_aes_check_aligned(dd->out_sg)) {
24018 -+ if (omap_aes_check_aligned(dd->in_sg, dd->total) ||
24019 -+ omap_aes_check_aligned(dd->out_sg, dd->total)) {
24020 - if (omap_aes_copy_sgs(dd))
24021 - pr_err("Failed to copy SGs for unaligned cases\n");
24022 - dd->sgs_copied = 1;
24023 ---
24024 -2.3.6
24025 -
24026 -
24027 -From 78775b31ea25fc6d25f2444c634b2eec0ed90bca Mon Sep 17 00:00:00 2001
24028 -From: Nishanth Menon <nm@××.com>
24029 -Date: Sat, 7 Mar 2015 03:39:05 -0600
24030 -Subject: [PATCH 214/219] C6x: time: Ensure consistency in __init
24031 -Cc: mpagano@g.o
24032 -
24033 -commit f4831605f2dacd12730fe73961c77253cc2ea425 upstream.
24034 -
24035 -time_init invokes timer64_init (which is __init annotation)
24036 -since all of these are invoked at init time, lets maintain
24037 -consistency by ensuring time_init is marked appropriately
24038 -as well.
24039 -
24040 -This fixes the following warning with CONFIG_DEBUG_SECTION_MISMATCH=y
24041 -
24042 -WARNING: vmlinux.o(.text+0x3bfc): Section mismatch in reference from the function time_init() to the function .init.text:timer64_init()
24043 -The function time_init() references
24044 -the function __init timer64_init().
24045 -This is often because time_init lacks a __init
24046 -annotation or the annotation of timer64_init is wrong.
24047 -
24048 -Fixes: 546a39546c64 ("C6X: time management")
24049 -Signed-off-by: Nishanth Menon <nm@××.com>
24050 -Signed-off-by: Mark Salter <msalter@××××××.com>
24051 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
24052 -Signed-off-by: Mike Pagano <mpagano@g.o>
24053 ----
24054 - arch/c6x/kernel/time.c | 2 +-
24055 - 1 file changed, 1 insertion(+), 1 deletion(-)
24056 -
24057 -diff --git a/arch/c6x/kernel/time.c b/arch/c6x/kernel/time.c
24058 -index 356ee84..04845aa 100644
24059 ---- a/arch/c6x/kernel/time.c
24060 -+++ b/arch/c6x/kernel/time.c
24061 -@@ -49,7 +49,7 @@ u64 sched_clock(void)
24062 - return (tsc * sched_clock_multiplier) >> SCHED_CLOCK_SHIFT;
24063 + static const struct snd_pcm_hw_constraint_list constraints_36864 = {
24064 +diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
24065 +index b6bb594..8c2b9be 100644
24066 +--- a/sound/soc/davinci/davinci-evm.c
24067 ++++ b/sound/soc/davinci/davinci-evm.c
24068 +@@ -425,18 +425,8 @@ static int davinci_evm_probe(struct platform_device *pdev)
24069 + return ret;
24070 }
24071
24072 --void time_init(void)
24073 -+void __init time_init(void)
24074 +-static int davinci_evm_remove(struct platform_device *pdev)
24075 +-{
24076 +- struct snd_soc_card *card = platform_get_drvdata(pdev);
24077 +-
24078 +- snd_soc_unregister_card(card);
24079 +-
24080 +- return 0;
24081 +-}
24082 +-
24083 + static struct platform_driver davinci_evm_driver = {
24084 + .probe = davinci_evm_probe,
24085 +- .remove = davinci_evm_remove,
24086 + .driver = {
24087 + .name = "davinci_evm",
24088 + .pm = &snd_soc_pm_ops,
24089 +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
24090 +index 9a28365..32631a8 100644
24091 +--- a/sound/usb/quirks.c
24092 ++++ b/sound/usb/quirks.c
24093 +@@ -1115,6 +1115,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)
24094 {
24095 - u64 tmp = (u64)NSEC_PER_SEC << SCHED_CLOCK_SHIFT;
24096 + /* devices which do not support reading the sample rate. */
24097 + switch (chip->usb_id) {
24098 ++ case USB_ID(0x045E, 0x075D): /* MS Lifecam Cinema */
24099 + case USB_ID(0x045E, 0x076D): /* MS Lifecam HD-5000 */
24100 + case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */
24101 + return true;
24102 +diff --git a/tools/lib/traceevent/kbuffer-parse.c b/tools/lib/traceevent/kbuffer-parse.c
24103 +index dcc6652..deb3569 100644
24104 +--- a/tools/lib/traceevent/kbuffer-parse.c
24105 ++++ b/tools/lib/traceevent/kbuffer-parse.c
24106 +@@ -372,7 +372,6 @@ translate_data(struct kbuffer *kbuf, void *data, void **rptr,
24107 + switch (type_len) {
24108 + case KBUFFER_TYPE_PADDING:
24109 + *length = read_4(kbuf, data);
24110 +- data += *length;
24111 + break;
24112
24113 ---
24114 -2.3.6
24115 -
24116 -
24117 -From df0bffebd40ba332f01193e2b6694042a0a2f56c Mon Sep 17 00:00:00 2001
24118 -From: Dan Carpenter <dan.carpenter@××××××.com>
24119 -Date: Thu, 16 Apr 2015 12:48:35 -0700
24120 -Subject: [PATCH 215/219] memstick: mspro_block: add missing curly braces
24121 -Cc: mpagano@g.o
24122 -
24123 -commit 13f6b191aaa11c7fd718d35a0c565f3c16bc1d99 upstream.
24124 -
24125 -Using the indenting we can see the curly braces were obviously intended.
24126 -This is a static checker fix, but my guess is that we don't read enough
24127 -bytes, because we don't calculate "t_len" correctly.
24128 -
24129 -Fixes: f1d82698029b ('memstick: use fully asynchronous request processing')
24130 -Signed-off-by: Dan Carpenter <dan.carpenter@××××××.com>
24131 -Cc: Alex Dubov <oakad@×××××.com>
24132 -Signed-off-by: Andrew Morton <akpm@××××××××××××××××.org>
24133 -Signed-off-by: Linus Torvalds <torvalds@××××××××××××××××.org>
24134 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
24135 -Signed-off-by: Mike Pagano <mpagano@g.o>
24136 ----
24137 - drivers/memstick/core/mspro_block.c | 3 ++-
24138 - 1 file changed, 2 insertions(+), 1 deletion(-)
24139 -
24140 -diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
24141 -index fc145d2..922a750 100644
24142 ---- a/drivers/memstick/core/mspro_block.c
24143 -+++ b/drivers/memstick/core/mspro_block.c
24144 -@@ -758,7 +758,7 @@ static int mspro_block_complete_req(struct memstick_dev *card, int error)
24145 + case KBUFFER_TYPE_TIME_EXTEND:
24146 +diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
24147 +index cc22408..0884d31 100644
24148 +--- a/tools/perf/config/Makefile
24149 ++++ b/tools/perf/config/Makefile
24150 +@@ -651,7 +651,7 @@ ifeq (${IS_64_BIT}, 1)
24151 + NO_PERF_READ_VDSO32 := 1
24152 + endif
24153 + endif
24154 +- ifneq (${IS_X86_64}, 1)
24155 ++ ifneq ($(ARCH), x86)
24156 + NO_PERF_READ_VDSOX32 := 1
24157 + endif
24158 + ifndef NO_PERF_READ_VDSOX32
24159 +@@ -699,7 +699,7 @@ sysconfdir = $(prefix)/etc
24160 + ETC_PERFCONFIG = etc/perfconfig
24161 + endif
24162 + ifndef lib
24163 +-ifeq ($(IS_X86_64),1)
24164 ++ifeq ($(ARCH)$(IS_64_BIT), x861)
24165 + lib = lib64
24166 + else
24167 + lib = lib
24168 +diff --git a/tools/perf/tests/make b/tools/perf/tests/make
24169 +index 75709d2..bff8532 100644
24170 +--- a/tools/perf/tests/make
24171 ++++ b/tools/perf/tests/make
24172 +@@ -5,7 +5,7 @@ include config/Makefile.arch
24173
24174 - if (error || (card->current_mrq.tpc == MSPRO_CMD_STOP)) {
24175 - if (msb->data_dir == READ) {
24176 -- for (cnt = 0; cnt < msb->current_seg; cnt++)
24177 -+ for (cnt = 0; cnt < msb->current_seg; cnt++) {
24178 - t_len += msb->req_sg[cnt].length
24179 - / msb->page_size;
24180 + # FIXME looks like x86 is the only arch running tests ;-)
24181 + # we need some IS_(32/64) flag to make this generic
24182 +-ifeq ($(IS_X86_64),1)
24183 ++ifeq ($(ARCH)$(IS_64_BIT), x861)
24184 + lib = lib64
24185 + else
24186 + lib = lib
24187 +diff --git a/tools/perf/util/cloexec.c b/tools/perf/util/cloexec.c
24188 +index 6da965b..85b5238 100644
24189 +--- a/tools/perf/util/cloexec.c
24190 ++++ b/tools/perf/util/cloexec.c
24191 +@@ -7,6 +7,12 @@
24192
24193 -@@ -766,6 +766,7 @@ static int mspro_block_complete_req(struct memstick_dev *card, int error)
24194 - t_len += msb->current_page - 1;
24195 + static unsigned long flag = PERF_FLAG_FD_CLOEXEC;
24196
24197 - t_len *= msb->page_size;
24198 -+ }
24199 - }
24200 - } else
24201 - t_len = blk_rq_bytes(msb->block_req);
24202 ---
24203 -2.3.6
24204 -
24205 -
24206 -From 6361409a1274060993b246c688c24a7c863c7eeb Mon Sep 17 00:00:00 2001
24207 -From: Linus Walleij <linus.walleij@××××××.org>
24208 -Date: Wed, 18 Feb 2015 17:12:18 +0100
24209 -Subject: [PATCH 216/219] drivers: platform: parse IRQ flags from resources
24210 -Cc: mpagano@g.o
24211 -
24212 -commit 7085a7401ba54e92bbb5aa24d6f428071e18e509 upstream.
24213 -
24214 -This fixes a regression from the net subsystem:
24215 -After commit d52fdbb735c36a209f36a628d40ca9185b349ba7
24216 -"smc91x: retrieve IRQ and trigger flags in a modern way"
24217 -a regression would appear on some legacy platforms such
24218 -as the ARM PXA Zylonite that specify IRQ resources like
24219 -this:
24220 -
24221 -static struct resource r = {
24222 - .start = X,
24223 - .end = X,
24224 - .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
24225 -};
24226 -
24227 -The previous code would retrieve the resource and parse
24228 -the high edge setting in the SMC91x driver, a use pattern
24229 -that means every driver specifying an IRQ flag from a
24230 -static resource need to parse resource flags and apply
24231 -them at runtime.
24232 -
24233 -As we switched the code to use IRQ descriptors to retrieve
24234 -the the trigger type like this:
24235 -
24236 - irqd_get_trigger_type(irq_get_irq_data(...));
24237 -
24238 -the code would work for new platforms using e.g. device
24239 -tree as the backing irq descriptor would have its flags
24240 -properly set, whereas this kind of oldstyle static
24241 -resources at no point assign the trigger flags to the
24242 -corresponding IRQ descriptor.
24243 -
24244 -To make the behaviour identical on modern device tree
24245 -and legacy static platform data platforms, modify
24246 -platform_get_irq() to assign the trigger flags to the
24247 -irq descriptor when a client looks up an IRQ from static
24248 -resources.
24249 -
24250 -Fixes: d52fdbb735c3 ("smc91x: retrieve IRQ and trigger flags in a modern way")
24251 -Tested-by: Robert Jarzmik <robert.jarzmik@××××.fr>
24252 -Signed-off-by: Linus Walleij <linus.walleij@××××××.org>
24253 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
24254 -Signed-off-by: Mike Pagano <mpagano@g.o>
24255 ----
24256 - drivers/base/platform.c | 9 +++++++++
24257 - 1 file changed, 9 insertions(+)
24258 -
24259 -diff --git a/drivers/base/platform.c b/drivers/base/platform.c
24260 -index 9421fed..e68ab79 100644
24261 ---- a/drivers/base/platform.c
24262 -+++ b/drivers/base/platform.c
24263 -@@ -101,6 +101,15 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
24264 - }
24265 ++int __weak sched_getcpu(void)
24266 ++{
24267 ++ errno = ENOSYS;
24268 ++ return -1;
24269 ++}
24270 ++
24271 + static int perf_flag_probe(void)
24272 + {
24273 + /* use 'safest' configuration as used in perf_evsel__fallback() */
24274 +diff --git a/tools/perf/util/cloexec.h b/tools/perf/util/cloexec.h
24275 +index 94a5a7d..68888c2 100644
24276 +--- a/tools/perf/util/cloexec.h
24277 ++++ b/tools/perf/util/cloexec.h
24278 +@@ -3,4 +3,10 @@
24279
24280 - r = platform_get_resource(dev, IORESOURCE_IRQ, num);
24281 -+ /*
24282 -+ * The resources may pass trigger flags to the irqs that need
24283 -+ * to be set up. It so happens that the trigger flags for
24284 -+ * IORESOURCE_BITS correspond 1-to-1 to the IRQF_TRIGGER*
24285 -+ * settings.
24286 -+ */
24287 -+ if (r && r->flags & IORESOURCE_BITS)
24288 -+ irqd_set_trigger_type(irq_get_irq_data(r->start),
24289 -+ r->flags & IORESOURCE_BITS);
24290 + unsigned long perf_event_open_cloexec_flag(void);
24291
24292 - return r ? r->start : -ENXIO;
24293 - #endif
24294 ---
24295 -2.3.6
24296 -
24297 -
24298 -From 4c0a56b2ee7b3a3741339e943acd2692c146fcb1 Mon Sep 17 00:00:00 2001
24299 -From: Junjie Mao <junjie_mao@××××.net>
24300 -Date: Wed, 28 Jan 2015 10:02:44 +0800
24301 -Subject: [PATCH 217/219] driver core: bus: Goto appropriate labels on failure
24302 - in bus_add_device
24303 -Cc: mpagano@g.o
24304 -
24305 -commit 1c34203a1496d1849ba978021b878b3447d433c8 upstream.
24306 -
24307 -It is not necessary to call device_remove_groups() when device_add_groups()
24308 -fails.
24309 -
24310 -The group added by device_add_groups() should be removed if sysfs_create_link()
24311 -fails.
24312 -
24313 -Fixes: fa6fdb33b486 ("driver core: bus_type: add dev_groups")
24314 -Signed-off-by: Junjie Mao <junjie_mao@××××.net>
24315 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
24316 -Signed-off-by: Mike Pagano <mpagano@g.o>
24317 ----
24318 - drivers/base/bus.c | 4 ++--
24319 - 1 file changed, 2 insertions(+), 2 deletions(-)
24320 -
24321 -diff --git a/drivers/base/bus.c b/drivers/base/bus.c
24322 -index 876bae5..79bc203 100644
24323 ---- a/drivers/base/bus.c
24324 -+++ b/drivers/base/bus.c
24325 -@@ -515,11 +515,11 @@ int bus_add_device(struct device *dev)
24326 - goto out_put;
24327 - error = device_add_groups(dev, bus->dev_groups);
24328 - if (error)
24329 -- goto out_groups;
24330 -+ goto out_id;
24331 - error = sysfs_create_link(&bus->p->devices_kset->kobj,
24332 - &dev->kobj, dev_name(dev));
24333 - if (error)
24334 -- goto out_id;
24335 -+ goto out_groups;
24336 - error = sysfs_create_link(&dev->kobj,
24337 - &dev->bus->p->subsys.kobj, "subsystem");
24338 - if (error)
24339 ---
24340 -2.3.6
24341 -
24342 -
24343 -From cf1cab07a20abcfa17f0cf431d103471ebd7b33c Mon Sep 17 00:00:00 2001
24344 -From: Florian Westphal <fw@××××××.de>
24345 -Date: Wed, 1 Apr 2015 22:36:27 +0200
24346 -Subject: [PATCH 218/219] netfilter: bridge: really save frag_max_size between
24347 - PRE and POST_ROUTING
24348 -Cc: mpagano@g.o
24349 -
24350 -commit 0b67c43ce36a9964f1d5e3f973ee19eefd3f9f8f upstream.
24351 -
24352 -We also need to save/store in forward, else br_parse_ip_options call
24353 -will zero frag_max_size as well.
24354 -
24355 -Fixes: 93fdd47e5 ('bridge: Save frag_max_size between PRE_ROUTING and POST_ROUTING')
24356 -Signed-off-by: Florian Westphal <fw@××××××.de>
24357 -Signed-off-by: Pablo Neira Ayuso <pablo@×××××××××.org>
24358 -Signed-off-by: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
24359 -Signed-off-by: Mike Pagano <mpagano@g.o>
24360 ----
24361 - net/bridge/br_netfilter.c | 17 +++++++++++++++--
24362 - 1 file changed, 15 insertions(+), 2 deletions(-)
24363 -
24364 -diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
24365 -index 0ee453f..f371cbf 100644
24366 ---- a/net/bridge/br_netfilter.c
24367 -+++ b/net/bridge/br_netfilter.c
24368 -@@ -651,6 +651,13 @@ static int br_nf_forward_finish(struct sk_buff *skb)
24369 - struct net_device *in;
24370 ++#ifdef __GLIBC_PREREQ
24371 ++#if !__GLIBC_PREREQ(2, 6)
24372 ++extern int sched_getcpu(void) __THROW;
24373 ++#endif
24374 ++#endif
24375 ++
24376 + #endif /* __PERF_CLOEXEC_H */
24377 +diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
24378 +index 33b7a2a..9bdf007 100644
24379 +--- a/tools/perf/util/symbol-elf.c
24380 ++++ b/tools/perf/util/symbol-elf.c
24381 +@@ -74,6 +74,10 @@ static inline uint8_t elf_sym__type(const GElf_Sym *sym)
24382 + return GELF_ST_TYPE(sym->st_info);
24383 + }
24384
24385 - if (!IS_ARP(skb) && !IS_VLAN_ARP(skb)) {
24386 -+ int frag_max_size;
24387 ++#ifndef STT_GNU_IFUNC
24388 ++#define STT_GNU_IFUNC 10
24389 ++#endif
24390 +
24391 -+ if (skb->protocol == htons(ETH_P_IP)) {
24392 -+ frag_max_size = IPCB(skb)->frag_max_size;
24393 -+ BR_INPUT_SKB_CB(skb)->frag_max_size = frag_max_size;
24394 -+ }
24395 + static inline int elf_sym__is_function(const GElf_Sym *sym)
24396 + {
24397 + return (elf_sym__type(sym) == STT_FUNC ||
24398 +diff --git a/tools/power/x86/turbostat/Makefile b/tools/power/x86/turbostat/Makefile
24399 +index d1b3a36..4039854 100644
24400 +--- a/tools/power/x86/turbostat/Makefile
24401 ++++ b/tools/power/x86/turbostat/Makefile
24402 +@@ -1,8 +1,12 @@
24403 + CC = $(CROSS_COMPILE)gcc
24404 +-BUILD_OUTPUT := $(PWD)
24405 ++BUILD_OUTPUT := $(CURDIR)
24406 + PREFIX := /usr
24407 + DESTDIR :=
24408 +
24409 ++ifeq ("$(origin O)", "command line")
24410 ++ BUILD_OUTPUT := $(O)
24411 ++endif
24412 +
24413 - in = nf_bridge->physindev;
24414 - if (nf_bridge->mask & BRNF_PKT_TYPE) {
24415 - skb->pkt_type = PACKET_OTHERHOST;
24416 -@@ -710,8 +717,14 @@ static unsigned int br_nf_forward_ip(const struct nf_hook_ops *ops,
24417 - nf_bridge->mask |= BRNF_PKT_TYPE;
24418 + turbostat : turbostat.c
24419 + CFLAGS += -Wall
24420 + CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/uapi/asm/msr-index.h"'
24421 +diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
24422 +index c9f60f5..e5abe7c 100644
24423 +--- a/virt/kvm/arm/vgic.c
24424 ++++ b/virt/kvm/arm/vgic.c
24425 +@@ -1371,6 +1371,9 @@ int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num,
24426 + goto out;
24427 }
24428
24429 -- if (pf == NFPROTO_IPV4 && br_parse_ip_options(skb))
24430 -- return NF_DROP;
24431 -+ if (pf == NFPROTO_IPV4) {
24432 -+ int frag_max = BR_INPUT_SKB_CB(skb)->frag_max_size;
24433 -+
24434 -+ if (br_parse_ip_options(skb))
24435 -+ return NF_DROP;
24436 ++ if (irq_num >= kvm->arch.vgic.nr_irqs)
24437 ++ return -EINVAL;
24438 +
24439 -+ IPCB(skb)->frag_max_size = frag_max;
24440 -+ }
24441 -
24442 - /* The physdev module checks on this */
24443 - nf_bridge->mask |= BRNF_BRIDGED;
24444 ---
24445 -2.3.6
24446 -
24447 -
24448 -From 072cab659c9368586d6417cfd6ec2d2c68469c67 Mon Sep 17 00:00:00 2001
24449 -From: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
24450 -Date: Wed, 6 May 2015 22:04:23 +0200
24451 -Subject: [PATCH 219/219] Linux 4.0.2
24452 -Cc: mpagano@g.o
24453 -
24454 -Signed-off-by: Mike Pagano <mpagano@g.o>
24455 ----
24456 - Makefile | 2 +-
24457 - 1 file changed, 1 insertion(+), 1 deletion(-)
24458 -
24459 -diff --git a/Makefile b/Makefile
24460 -index f499cd2..0649a60 100644
24461 ---- a/Makefile
24462 -+++ b/Makefile
24463 -@@ -1,6 +1,6 @@
24464 - VERSION = 4
24465 - PATCHLEVEL = 0
24466 --SUBLEVEL = 1
24467 -+SUBLEVEL = 2
24468 - EXTRAVERSION =
24469 - NAME = Hurr durr I'ma sheep
24470 -
24471 ---
24472 -2.3.6
24473 -
24474 + vcpu_id = vgic_update_irq_pending(kvm, cpuid, irq_num, level);
24475 + if (vcpu_id >= 0) {
24476 + /* kick the specified vcpu */
24477 +diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
24478 +index cc6a25d..f8f3f5f 100644
24479 +--- a/virt/kvm/kvm_main.c
24480 ++++ b/virt/kvm/kvm_main.c
24481 +@@ -1653,8 +1653,8 @@ int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
24482 + ghc->generation = slots->generation;
24483 + ghc->len = len;
24484 + ghc->memslot = gfn_to_memslot(kvm, start_gfn);
24485 +- ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, &nr_pages_avail);
24486 +- if (!kvm_is_error_hva(ghc->hva) && nr_pages_avail >= nr_pages_needed) {
24487 ++ ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, NULL);
24488 ++ if (!kvm_is_error_hva(ghc->hva) && nr_pages_needed <= 1) {
24489 + ghc->hva += offset;
24490 + } else {
24491 + /*