1 |
commit: e7455da9070ebec0d5c0d59fe2445fa9a5bd4b7d |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Apr 8 13:56:24 2017 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Apr 8 13:56:24 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=e7455da9 |
7 |
|
8 |
Linux patch 4.4.60 |
9 |
|
10 |
0000_README | 4 + |
11 |
1059_linux-4.4.60.patch | 1175 +++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 1179 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index 1be1dd6..6cc653c 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -279,6 +279,10 @@ Patch: 1058_linux-4.4.59.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.4.59 |
21 |
|
22 |
+Patch: 1059_linux-4.4.60.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.4.60 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1059_linux-4.4.60.patch b/1059_linux-4.4.60.patch |
31 |
new file mode 100644 |
32 |
index 0000000..ad96b85 |
33 |
--- /dev/null |
34 |
+++ b/1059_linux-4.4.60.patch |
35 |
@@ -0,0 +1,1175 @@ |
36 |
+diff --git a/Makefile b/Makefile |
37 |
+index 083724c6ca4d..fb7c2b40753d 100644 |
38 |
+--- a/Makefile |
39 |
++++ b/Makefile |
40 |
+@@ -1,6 +1,6 @@ |
41 |
+ VERSION = 4 |
42 |
+ PATCHLEVEL = 4 |
43 |
+-SUBLEVEL = 59 |
44 |
++SUBLEVEL = 60 |
45 |
+ EXTRAVERSION = |
46 |
+ NAME = Blurry Fish Butt |
47 |
+ |
48 |
+diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c |
49 |
+index 2e7f60c9fc5d..51cdc46a87e2 100644 |
50 |
+--- a/arch/mips/lantiq/irq.c |
51 |
++++ b/arch/mips/lantiq/irq.c |
52 |
+@@ -269,6 +269,11 @@ static void ltq_hw5_irqdispatch(void) |
53 |
+ DEFINE_HWx_IRQDISPATCH(5) |
54 |
+ #endif |
55 |
+ |
56 |
++static void ltq_hw_irq_handler(struct irq_desc *desc) |
57 |
++{ |
58 |
++ ltq_hw_irqdispatch(irq_desc_get_irq(desc) - 2); |
59 |
++} |
60 |
++ |
61 |
+ #ifdef CONFIG_MIPS_MT_SMP |
62 |
+ void __init arch_init_ipiirq(int irq, struct irqaction *action) |
63 |
+ { |
64 |
+@@ -313,23 +318,19 @@ static struct irqaction irq_call = { |
65 |
+ asmlinkage void plat_irq_dispatch(void) |
66 |
+ { |
67 |
+ unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; |
68 |
+- unsigned int i; |
69 |
+- |
70 |
+- if ((MIPS_CPU_TIMER_IRQ == 7) && (pending & CAUSEF_IP7)) { |
71 |
+- do_IRQ(MIPS_CPU_TIMER_IRQ); |
72 |
+- goto out; |
73 |
+- } else { |
74 |
+- for (i = 0; i < MAX_IM; i++) { |
75 |
+- if (pending & (CAUSEF_IP2 << i)) { |
76 |
+- ltq_hw_irqdispatch(i); |
77 |
+- goto out; |
78 |
+- } |
79 |
+- } |
80 |
++ int irq; |
81 |
++ |
82 |
++ if (!pending) { |
83 |
++ spurious_interrupt(); |
84 |
++ return; |
85 |
+ } |
86 |
+- pr_alert("Spurious IRQ: CAUSE=0x%08x\n", read_c0_status()); |
87 |
+ |
88 |
+-out: |
89 |
+- return; |
90 |
++ pending >>= CAUSEB_IP; |
91 |
++ while (pending) { |
92 |
++ irq = fls(pending) - 1; |
93 |
++ do_IRQ(MIPS_CPU_IRQ_BASE + irq); |
94 |
++ pending &= ~BIT(irq); |
95 |
++ } |
96 |
+ } |
97 |
+ |
98 |
+ static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) |
99 |
+@@ -354,11 +355,6 @@ static const struct irq_domain_ops irq_domain_ops = { |
100 |
+ .map = icu_map, |
101 |
+ }; |
102 |
+ |
103 |
+-static struct irqaction cascade = { |
104 |
+- .handler = no_action, |
105 |
+- .name = "cascade", |
106 |
+-}; |
107 |
+- |
108 |
+ int __init icu_of_init(struct device_node *node, struct device_node *parent) |
109 |
+ { |
110 |
+ struct device_node *eiu_node; |
111 |
+@@ -390,7 +386,7 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent) |
112 |
+ mips_cpu_irq_init(); |
113 |
+ |
114 |
+ for (i = 0; i < MAX_IM; i++) |
115 |
+- setup_irq(i + 2, &cascade); |
116 |
++ irq_set_chained_handler(i + 2, ltq_hw_irq_handler); |
117 |
+ |
118 |
+ if (cpu_has_vint) { |
119 |
+ pr_info("Setting up vectored interrupts\n"); |
120 |
+diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c |
121 |
+index e345891450c3..df8844a1853a 100644 |
122 |
+--- a/arch/x86/xen/setup.c |
123 |
++++ b/arch/x86/xen/setup.c |
124 |
+@@ -713,10 +713,9 @@ static void __init xen_reserve_xen_mfnlist(void) |
125 |
+ size = PFN_PHYS(xen_start_info->nr_p2m_frames); |
126 |
+ } |
127 |
+ |
128 |
+- if (!xen_is_e820_reserved(start, size)) { |
129 |
+- memblock_reserve(start, size); |
130 |
++ memblock_reserve(start, size); |
131 |
++ if (!xen_is_e820_reserved(start, size)) |
132 |
+ return; |
133 |
+- } |
134 |
+ |
135 |
+ #ifdef CONFIG_X86_32 |
136 |
+ /* |
137 |
+@@ -727,6 +726,7 @@ static void __init xen_reserve_xen_mfnlist(void) |
138 |
+ BUG(); |
139 |
+ #else |
140 |
+ xen_relocate_p2m(); |
141 |
++ memblock_free(start, size); |
142 |
+ #endif |
143 |
+ } |
144 |
+ |
145 |
+diff --git a/block/bio.c b/block/bio.c |
146 |
+index 46e2cc1d4016..14263fab94d3 100644 |
147 |
+--- a/block/bio.c |
148 |
++++ b/block/bio.c |
149 |
+@@ -373,10 +373,14 @@ static void punt_bios_to_rescuer(struct bio_set *bs) |
150 |
+ bio_list_init(&punt); |
151 |
+ bio_list_init(&nopunt); |
152 |
+ |
153 |
+- while ((bio = bio_list_pop(current->bio_list))) |
154 |
++ while ((bio = bio_list_pop(¤t->bio_list[0]))) |
155 |
+ bio_list_add(bio->bi_pool == bs ? &punt : &nopunt, bio); |
156 |
++ current->bio_list[0] = nopunt; |
157 |
+ |
158 |
+- *current->bio_list = nopunt; |
159 |
++ bio_list_init(&nopunt); |
160 |
++ while ((bio = bio_list_pop(¤t->bio_list[1]))) |
161 |
++ bio_list_add(bio->bi_pool == bs ? &punt : &nopunt, bio); |
162 |
++ current->bio_list[1] = nopunt; |
163 |
+ |
164 |
+ spin_lock(&bs->rescue_lock); |
165 |
+ bio_list_merge(&bs->rescue_list, &punt); |
166 |
+@@ -464,7 +468,9 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) |
167 |
+ * we retry with the original gfp_flags. |
168 |
+ */ |
169 |
+ |
170 |
+- if (current->bio_list && !bio_list_empty(current->bio_list)) |
171 |
++ if (current->bio_list && |
172 |
++ (!bio_list_empty(¤t->bio_list[0]) || |
173 |
++ !bio_list_empty(¤t->bio_list[1]))) |
174 |
+ gfp_mask &= ~__GFP_DIRECT_RECLAIM; |
175 |
+ |
176 |
+ p = mempool_alloc(bs->bio_pool, gfp_mask); |
177 |
+diff --git a/block/blk-core.c b/block/blk-core.c |
178 |
+index 4fab5d610805..ef083e7a37c5 100644 |
179 |
+--- a/block/blk-core.c |
180 |
++++ b/block/blk-core.c |
181 |
+@@ -2021,7 +2021,14 @@ end_io: |
182 |
+ */ |
183 |
+ blk_qc_t generic_make_request(struct bio *bio) |
184 |
+ { |
185 |
+- struct bio_list bio_list_on_stack; |
186 |
++ /* |
187 |
++ * bio_list_on_stack[0] contains bios submitted by the current |
188 |
++ * make_request_fn. |
189 |
++ * bio_list_on_stack[1] contains bios that were submitted before |
190 |
++ * the current make_request_fn, but that haven't been processed |
191 |
++ * yet. |
192 |
++ */ |
193 |
++ struct bio_list bio_list_on_stack[2]; |
194 |
+ blk_qc_t ret = BLK_QC_T_NONE; |
195 |
+ |
196 |
+ if (!generic_make_request_checks(bio)) |
197 |
+@@ -2038,7 +2045,7 @@ blk_qc_t generic_make_request(struct bio *bio) |
198 |
+ * should be added at the tail |
199 |
+ */ |
200 |
+ if (current->bio_list) { |
201 |
+- bio_list_add(current->bio_list, bio); |
202 |
++ bio_list_add(¤t->bio_list[0], bio); |
203 |
+ goto out; |
204 |
+ } |
205 |
+ |
206 |
+@@ -2057,24 +2064,39 @@ blk_qc_t generic_make_request(struct bio *bio) |
207 |
+ * bio_list, and call into ->make_request() again. |
208 |
+ */ |
209 |
+ BUG_ON(bio->bi_next); |
210 |
+- bio_list_init(&bio_list_on_stack); |
211 |
+- current->bio_list = &bio_list_on_stack; |
212 |
++ bio_list_init(&bio_list_on_stack[0]); |
213 |
++ current->bio_list = bio_list_on_stack; |
214 |
+ do { |
215 |
+ struct request_queue *q = bdev_get_queue(bio->bi_bdev); |
216 |
+ |
217 |
+ if (likely(blk_queue_enter(q, __GFP_DIRECT_RECLAIM) == 0)) { |
218 |
++ struct bio_list lower, same; |
219 |
++ |
220 |
++ /* Create a fresh bio_list for all subordinate requests */ |
221 |
++ bio_list_on_stack[1] = bio_list_on_stack[0]; |
222 |
++ bio_list_init(&bio_list_on_stack[0]); |
223 |
+ |
224 |
+ ret = q->make_request_fn(q, bio); |
225 |
+ |
226 |
+ blk_queue_exit(q); |
227 |
+- |
228 |
+- bio = bio_list_pop(current->bio_list); |
229 |
++ /* sort new bios into those for a lower level |
230 |
++ * and those for the same level |
231 |
++ */ |
232 |
++ bio_list_init(&lower); |
233 |
++ bio_list_init(&same); |
234 |
++ while ((bio = bio_list_pop(&bio_list_on_stack[0])) != NULL) |
235 |
++ if (q == bdev_get_queue(bio->bi_bdev)) |
236 |
++ bio_list_add(&same, bio); |
237 |
++ else |
238 |
++ bio_list_add(&lower, bio); |
239 |
++ /* now assemble so we handle the lowest level first */ |
240 |
++ bio_list_merge(&bio_list_on_stack[0], &lower); |
241 |
++ bio_list_merge(&bio_list_on_stack[0], &same); |
242 |
++ bio_list_merge(&bio_list_on_stack[0], &bio_list_on_stack[1]); |
243 |
+ } else { |
244 |
+- struct bio *bio_next = bio_list_pop(current->bio_list); |
245 |
+- |
246 |
+ bio_io_error(bio); |
247 |
+- bio = bio_next; |
248 |
+ } |
249 |
++ bio = bio_list_pop(&bio_list_on_stack[0]); |
250 |
+ } while (bio); |
251 |
+ current->bio_list = NULL; /* deactivate */ |
252 |
+ |
253 |
+diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile |
254 |
+index 675eaf337178..b9cebca376f9 100644 |
255 |
+--- a/drivers/acpi/Makefile |
256 |
++++ b/drivers/acpi/Makefile |
257 |
+@@ -2,7 +2,6 @@ |
258 |
+ # Makefile for the Linux ACPI interpreter |
259 |
+ # |
260 |
+ |
261 |
+-ccflags-y := -Os |
262 |
+ ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT |
263 |
+ |
264 |
+ # |
265 |
+diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c |
266 |
+index 296b7a14893a..5365ff6e69c1 100644 |
267 |
+--- a/drivers/acpi/acpi_platform.c |
268 |
++++ b/drivers/acpi/acpi_platform.c |
269 |
+@@ -24,9 +24,11 @@ |
270 |
+ ACPI_MODULE_NAME("platform"); |
271 |
+ |
272 |
+ static const struct acpi_device_id forbidden_id_list[] = { |
273 |
+- {"PNP0000", 0}, /* PIC */ |
274 |
+- {"PNP0100", 0}, /* Timer */ |
275 |
+- {"PNP0200", 0}, /* AT DMA Controller */ |
276 |
++ {"PNP0000", 0}, /* PIC */ |
277 |
++ {"PNP0100", 0}, /* Timer */ |
278 |
++ {"PNP0200", 0}, /* AT DMA Controller */ |
279 |
++ {"ACPI0009", 0}, /* IOxAPIC */ |
280 |
++ {"ACPI000A", 0}, /* IOAPIC */ |
281 |
+ {"", 0}, |
282 |
+ }; |
283 |
+ |
284 |
+diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c |
285 |
+index 35310336dd0a..d684e2b79d2b 100644 |
286 |
+--- a/drivers/gpu/drm/radeon/radeon_ttm.c |
287 |
++++ b/drivers/gpu/drm/radeon/radeon_ttm.c |
288 |
+@@ -213,8 +213,8 @@ static void radeon_evict_flags(struct ttm_buffer_object *bo, |
289 |
+ rbo->placement.num_busy_placement = 0; |
290 |
+ for (i = 0; i < rbo->placement.num_placement; i++) { |
291 |
+ if (rbo->placements[i].flags & TTM_PL_FLAG_VRAM) { |
292 |
+- if (rbo->placements[0].fpfn < fpfn) |
293 |
+- rbo->placements[0].fpfn = fpfn; |
294 |
++ if (rbo->placements[i].fpfn < fpfn) |
295 |
++ rbo->placements[i].fpfn = fpfn; |
296 |
+ } else { |
297 |
+ rbo->placement.busy_placement = |
298 |
+ &rbo->placements[i]; |
299 |
+diff --git a/drivers/md/dm.c b/drivers/md/dm.c |
300 |
+index 397f0454100b..320eb3c4bb6b 100644 |
301 |
+--- a/drivers/md/dm.c |
302 |
++++ b/drivers/md/dm.c |
303 |
+@@ -1481,26 +1481,29 @@ static void flush_current_bio_list(struct blk_plug_cb *cb, bool from_schedule) |
304 |
+ struct dm_offload *o = container_of(cb, struct dm_offload, cb); |
305 |
+ struct bio_list list; |
306 |
+ struct bio *bio; |
307 |
++ int i; |
308 |
+ |
309 |
+ INIT_LIST_HEAD(&o->cb.list); |
310 |
+ |
311 |
+ if (unlikely(!current->bio_list)) |
312 |
+ return; |
313 |
+ |
314 |
+- list = *current->bio_list; |
315 |
+- bio_list_init(current->bio_list); |
316 |
+- |
317 |
+- while ((bio = bio_list_pop(&list))) { |
318 |
+- struct bio_set *bs = bio->bi_pool; |
319 |
+- if (unlikely(!bs) || bs == fs_bio_set) { |
320 |
+- bio_list_add(current->bio_list, bio); |
321 |
+- continue; |
322 |
++ for (i = 0; i < 2; i++) { |
323 |
++ list = current->bio_list[i]; |
324 |
++ bio_list_init(¤t->bio_list[i]); |
325 |
++ |
326 |
++ while ((bio = bio_list_pop(&list))) { |
327 |
++ struct bio_set *bs = bio->bi_pool; |
328 |
++ if (unlikely(!bs) || bs == fs_bio_set) { |
329 |
++ bio_list_add(¤t->bio_list[i], bio); |
330 |
++ continue; |
331 |
++ } |
332 |
++ |
333 |
++ spin_lock(&bs->rescue_lock); |
334 |
++ bio_list_add(&bs->rescue_list, bio); |
335 |
++ queue_work(bs->rescue_workqueue, &bs->rescue_work); |
336 |
++ spin_unlock(&bs->rescue_lock); |
337 |
+ } |
338 |
+- |
339 |
+- spin_lock(&bs->rescue_lock); |
340 |
+- bio_list_add(&bs->rescue_list, bio); |
341 |
+- queue_work(bs->rescue_workqueue, &bs->rescue_work); |
342 |
+- spin_unlock(&bs->rescue_lock); |
343 |
+ } |
344 |
+ } |
345 |
+ |
346 |
+diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c |
347 |
+index 515554c7365b..9be39988bf06 100644 |
348 |
+--- a/drivers/md/raid1.c |
349 |
++++ b/drivers/md/raid1.c |
350 |
+@@ -877,7 +877,8 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio) |
351 |
+ ((conf->start_next_window < |
352 |
+ conf->next_resync + RESYNC_SECTORS) && |
353 |
+ current->bio_list && |
354 |
+- !bio_list_empty(current->bio_list))), |
355 |
++ (!bio_list_empty(¤t->bio_list[0]) || |
356 |
++ !bio_list_empty(¤t->bio_list[1])))), |
357 |
+ conf->resync_lock); |
358 |
+ conf->nr_waiting--; |
359 |
+ } |
360 |
+diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c |
361 |
+index a92979e704e3..e5ee4e9e0ea5 100644 |
362 |
+--- a/drivers/md/raid10.c |
363 |
++++ b/drivers/md/raid10.c |
364 |
+@@ -946,7 +946,8 @@ static void wait_barrier(struct r10conf *conf) |
365 |
+ !conf->barrier || |
366 |
+ (conf->nr_pending && |
367 |
+ current->bio_list && |
368 |
+- !bio_list_empty(current->bio_list)), |
369 |
++ (!bio_list_empty(¤t->bio_list[0]) || |
370 |
++ !bio_list_empty(¤t->bio_list[1]))), |
371 |
+ conf->resync_lock); |
372 |
+ conf->nr_waiting--; |
373 |
+ } |
374 |
+diff --git a/drivers/power/reset/at91-poweroff.c b/drivers/power/reset/at91-poweroff.c |
375 |
+index e9e24df35f26..2579f025b90b 100644 |
376 |
+--- a/drivers/power/reset/at91-poweroff.c |
377 |
++++ b/drivers/power/reset/at91-poweroff.c |
378 |
+@@ -14,9 +14,12 @@ |
379 |
+ #include <linux/io.h> |
380 |
+ #include <linux/module.h> |
381 |
+ #include <linux/of.h> |
382 |
++#include <linux/of_address.h> |
383 |
+ #include <linux/platform_device.h> |
384 |
+ #include <linux/printk.h> |
385 |
+ |
386 |
++#include <soc/at91/at91sam9_ddrsdr.h> |
387 |
++ |
388 |
+ #define AT91_SHDW_CR 0x00 /* Shut Down Control Register */ |
389 |
+ #define AT91_SHDW_SHDW BIT(0) /* Shut Down command */ |
390 |
+ #define AT91_SHDW_KEY (0xa5 << 24) /* KEY Password */ |
391 |
+@@ -50,6 +53,7 @@ static const char *shdwc_wakeup_modes[] = { |
392 |
+ |
393 |
+ static void __iomem *at91_shdwc_base; |
394 |
+ static struct clk *sclk; |
395 |
++static void __iomem *mpddrc_base; |
396 |
+ |
397 |
+ static void __init at91_wakeup_status(void) |
398 |
+ { |
399 |
+@@ -73,6 +77,29 @@ static void at91_poweroff(void) |
400 |
+ writel(AT91_SHDW_KEY | AT91_SHDW_SHDW, at91_shdwc_base + AT91_SHDW_CR); |
401 |
+ } |
402 |
+ |
403 |
++static void at91_lpddr_poweroff(void) |
404 |
++{ |
405 |
++ asm volatile( |
406 |
++ /* Align to cache lines */ |
407 |
++ ".balign 32\n\t" |
408 |
++ |
409 |
++ /* Ensure AT91_SHDW_CR is in the TLB by reading it */ |
410 |
++ " ldr r6, [%2, #" __stringify(AT91_SHDW_CR) "]\n\t" |
411 |
++ |
412 |
++ /* Power down SDRAM0 */ |
413 |
++ " str %1, [%0, #" __stringify(AT91_DDRSDRC_LPR) "]\n\t" |
414 |
++ /* Shutdown CPU */ |
415 |
++ " str %3, [%2, #" __stringify(AT91_SHDW_CR) "]\n\t" |
416 |
++ |
417 |
++ " b .\n\t" |
418 |
++ : |
419 |
++ : "r" (mpddrc_base), |
420 |
++ "r" cpu_to_le32(AT91_DDRSDRC_LPDDR2_PWOFF), |
421 |
++ "r" (at91_shdwc_base), |
422 |
++ "r" cpu_to_le32(AT91_SHDW_KEY | AT91_SHDW_SHDW) |
423 |
++ : "r0"); |
424 |
++} |
425 |
++ |
426 |
+ static int at91_poweroff_get_wakeup_mode(struct device_node *np) |
427 |
+ { |
428 |
+ const char *pm; |
429 |
+@@ -124,6 +151,8 @@ static void at91_poweroff_dt_set_wakeup_mode(struct platform_device *pdev) |
430 |
+ static int __init at91_poweroff_probe(struct platform_device *pdev) |
431 |
+ { |
432 |
+ struct resource *res; |
433 |
++ struct device_node *np; |
434 |
++ u32 ddr_type; |
435 |
+ int ret; |
436 |
+ |
437 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
438 |
+@@ -150,12 +179,30 @@ static int __init at91_poweroff_probe(struct platform_device *pdev) |
439 |
+ |
440 |
+ pm_power_off = at91_poweroff; |
441 |
+ |
442 |
++ np = of_find_compatible_node(NULL, NULL, "atmel,sama5d3-ddramc"); |
443 |
++ if (!np) |
444 |
++ return 0; |
445 |
++ |
446 |
++ mpddrc_base = of_iomap(np, 0); |
447 |
++ of_node_put(np); |
448 |
++ |
449 |
++ if (!mpddrc_base) |
450 |
++ return 0; |
451 |
++ |
452 |
++ ddr_type = readl(mpddrc_base + AT91_DDRSDRC_MDR) & AT91_DDRSDRC_MD; |
453 |
++ if ((ddr_type == AT91_DDRSDRC_MD_LPDDR2) || |
454 |
++ (ddr_type == AT91_DDRSDRC_MD_LPDDR3)) |
455 |
++ pm_power_off = at91_lpddr_poweroff; |
456 |
++ else |
457 |
++ iounmap(mpddrc_base); |
458 |
++ |
459 |
+ return 0; |
460 |
+ } |
461 |
+ |
462 |
+ static int __exit at91_poweroff_remove(struct platform_device *pdev) |
463 |
+ { |
464 |
+- if (pm_power_off == at91_poweroff) |
465 |
++ if (pm_power_off == at91_poweroff || |
466 |
++ pm_power_off == at91_lpddr_poweroff) |
467 |
+ pm_power_off = NULL; |
468 |
+ |
469 |
+ clk_disable_unprepare(sclk); |
470 |
+@@ -163,6 +210,11 @@ static int __exit at91_poweroff_remove(struct platform_device *pdev) |
471 |
+ return 0; |
472 |
+ } |
473 |
+ |
474 |
++static const struct of_device_id at91_ramc_of_match[] = { |
475 |
++ { .compatible = "atmel,sama5d3-ddramc", }, |
476 |
++ { /* sentinel */ } |
477 |
++}; |
478 |
++ |
479 |
+ static const struct of_device_id at91_poweroff_of_match[] = { |
480 |
+ { .compatible = "atmel,at91sam9260-shdwc", }, |
481 |
+ { .compatible = "atmel,at91sam9rl-shdwc", }, |
482 |
+diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c |
483 |
+index f40afdd0e5f5..00662dd28d66 100644 |
484 |
+--- a/drivers/rtc/rtc-s35390a.c |
485 |
++++ b/drivers/rtc/rtc-s35390a.c |
486 |
+@@ -15,6 +15,7 @@ |
487 |
+ #include <linux/bitrev.h> |
488 |
+ #include <linux/bcd.h> |
489 |
+ #include <linux/slab.h> |
490 |
++#include <linux/delay.h> |
491 |
+ |
492 |
+ #define S35390A_CMD_STATUS1 0 |
493 |
+ #define S35390A_CMD_STATUS2 1 |
494 |
+@@ -34,10 +35,14 @@ |
495 |
+ #define S35390A_ALRM_BYTE_HOURS 1 |
496 |
+ #define S35390A_ALRM_BYTE_MINS 2 |
497 |
+ |
498 |
++/* flags for STATUS1 */ |
499 |
+ #define S35390A_FLAG_POC 0x01 |
500 |
+ #define S35390A_FLAG_BLD 0x02 |
501 |
++#define S35390A_FLAG_INT2 0x04 |
502 |
+ #define S35390A_FLAG_24H 0x40 |
503 |
+ #define S35390A_FLAG_RESET 0x80 |
504 |
++ |
505 |
++/* flag for STATUS2 */ |
506 |
+ #define S35390A_FLAG_TEST 0x01 |
507 |
+ |
508 |
+ #define S35390A_INT2_MODE_MASK 0xF0 |
509 |
+@@ -94,19 +99,63 @@ static int s35390a_get_reg(struct s35390a *s35390a, int reg, char *buf, int len) |
510 |
+ return 0; |
511 |
+ } |
512 |
+ |
513 |
+-static int s35390a_reset(struct s35390a *s35390a) |
514 |
++/* |
515 |
++ * Returns <0 on error, 0 if rtc is setup fine and 1 if the chip was reset. |
516 |
++ * To keep the information if an irq is pending, pass the value read from |
517 |
++ * STATUS1 to the caller. |
518 |
++ */ |
519 |
++static int s35390a_reset(struct s35390a *s35390a, char *status1) |
520 |
+ { |
521 |
+- char buf[1]; |
522 |
+- |
523 |
+- if (s35390a_get_reg(s35390a, S35390A_CMD_STATUS1, buf, sizeof(buf)) < 0) |
524 |
+- return -EIO; |
525 |
+- |
526 |
+- if (!(buf[0] & (S35390A_FLAG_POC | S35390A_FLAG_BLD))) |
527 |
++ char buf; |
528 |
++ int ret; |
529 |
++ unsigned initcount = 0; |
530 |
++ |
531 |
++ ret = s35390a_get_reg(s35390a, S35390A_CMD_STATUS1, status1, 1); |
532 |
++ if (ret < 0) |
533 |
++ return ret; |
534 |
++ |
535 |
++ if (*status1 & S35390A_FLAG_POC) |
536 |
++ /* |
537 |
++ * Do not communicate for 0.5 seconds since the power-on |
538 |
++ * detection circuit is in operation. |
539 |
++ */ |
540 |
++ msleep(500); |
541 |
++ else if (!(*status1 & S35390A_FLAG_BLD)) |
542 |
++ /* |
543 |
++ * If both POC and BLD are unset everything is fine. |
544 |
++ */ |
545 |
+ return 0; |
546 |
+ |
547 |
+- buf[0] |= (S35390A_FLAG_RESET | S35390A_FLAG_24H); |
548 |
+- buf[0] &= 0xf0; |
549 |
+- return s35390a_set_reg(s35390a, S35390A_CMD_STATUS1, buf, sizeof(buf)); |
550 |
++ /* |
551 |
++ * At least one of POC and BLD are set, so reinitialise chip. Keeping |
552 |
++ * this information in the hardware to know later that the time isn't |
553 |
++ * valid is unfortunately not possible because POC and BLD are cleared |
554 |
++ * on read. So the reset is best done now. |
555 |
++ * |
556 |
++ * The 24H bit is kept over reset, so set it already here. |
557 |
++ */ |
558 |
++initialize: |
559 |
++ *status1 = S35390A_FLAG_24H; |
560 |
++ buf = S35390A_FLAG_RESET | S35390A_FLAG_24H; |
561 |
++ ret = s35390a_set_reg(s35390a, S35390A_CMD_STATUS1, &buf, 1); |
562 |
++ |
563 |
++ if (ret < 0) |
564 |
++ return ret; |
565 |
++ |
566 |
++ ret = s35390a_get_reg(s35390a, S35390A_CMD_STATUS1, &buf, 1); |
567 |
++ if (ret < 0) |
568 |
++ return ret; |
569 |
++ |
570 |
++ if (buf & (S35390A_FLAG_POC | S35390A_FLAG_BLD)) { |
571 |
++ /* Try up to five times to reset the chip */ |
572 |
++ if (initcount < 5) { |
573 |
++ ++initcount; |
574 |
++ goto initialize; |
575 |
++ } else |
576 |
++ return -EIO; |
577 |
++ } |
578 |
++ |
579 |
++ return 1; |
580 |
+ } |
581 |
+ |
582 |
+ static int s35390a_disable_test_mode(struct s35390a *s35390a) |
583 |
+@@ -242,6 +291,8 @@ static int s35390a_set_alarm(struct i2c_client *client, struct rtc_wkalrm *alm) |
584 |
+ |
585 |
+ if (alm->time.tm_wday != -1) |
586 |
+ buf[S35390A_ALRM_BYTE_WDAY] = bin2bcd(alm->time.tm_wday) | 0x80; |
587 |
++ else |
588 |
++ buf[S35390A_ALRM_BYTE_WDAY] = 0; |
589 |
+ |
590 |
+ buf[S35390A_ALRM_BYTE_HOURS] = s35390a_hr2reg(s35390a, |
591 |
+ alm->time.tm_hour) | 0x80; |
592 |
+@@ -265,27 +316,61 @@ static int s35390a_read_alarm(struct i2c_client *client, struct rtc_wkalrm *alm) |
593 |
+ char buf[3], sts; |
594 |
+ int i, err; |
595 |
+ |
596 |
++ /* |
597 |
++ * initialize all members to -1 to signal the core that they are not |
598 |
++ * defined by the hardware. |
599 |
++ */ |
600 |
++ alm->time.tm_sec = -1; |
601 |
++ alm->time.tm_min = -1; |
602 |
++ alm->time.tm_hour = -1; |
603 |
++ alm->time.tm_mday = -1; |
604 |
++ alm->time.tm_mon = -1; |
605 |
++ alm->time.tm_year = -1; |
606 |
++ alm->time.tm_wday = -1; |
607 |
++ alm->time.tm_yday = -1; |
608 |
++ alm->time.tm_isdst = -1; |
609 |
++ |
610 |
+ err = s35390a_get_reg(s35390a, S35390A_CMD_STATUS2, &sts, sizeof(sts)); |
611 |
+ if (err < 0) |
612 |
+ return err; |
613 |
+ |
614 |
+- if (bitrev8(sts) != S35390A_INT2_MODE_ALARM) |
615 |
+- return -EINVAL; |
616 |
++ if ((bitrev8(sts) & S35390A_INT2_MODE_MASK) != S35390A_INT2_MODE_ALARM) { |
617 |
++ /* |
618 |
++ * When the alarm isn't enabled, the register to configure |
619 |
++ * the alarm time isn't accessible. |
620 |
++ */ |
621 |
++ alm->enabled = 0; |
622 |
++ return 0; |
623 |
++ } else { |
624 |
++ alm->enabled = 1; |
625 |
++ } |
626 |
+ |
627 |
+ err = s35390a_get_reg(s35390a, S35390A_CMD_INT2_REG1, buf, sizeof(buf)); |
628 |
+ if (err < 0) |
629 |
+ return err; |
630 |
+ |
631 |
+ /* This chip returns the bits of each byte in reverse order */ |
632 |
+- for (i = 0; i < 3; ++i) { |
633 |
++ for (i = 0; i < 3; ++i) |
634 |
+ buf[i] = bitrev8(buf[i]); |
635 |
+- buf[i] &= ~0x80; |
636 |
+- } |
637 |
+ |
638 |
+- alm->time.tm_wday = bcd2bin(buf[S35390A_ALRM_BYTE_WDAY]); |
639 |
+- alm->time.tm_hour = s35390a_reg2hr(s35390a, |
640 |
+- buf[S35390A_ALRM_BYTE_HOURS]); |
641 |
+- alm->time.tm_min = bcd2bin(buf[S35390A_ALRM_BYTE_MINS]); |
642 |
++ /* |
643 |
++ * B0 of the three matching registers is an enable flag. Iff it is set |
644 |
++ * the configured value is used for matching. |
645 |
++ */ |
646 |
++ if (buf[S35390A_ALRM_BYTE_WDAY] & 0x80) |
647 |
++ alm->time.tm_wday = |
648 |
++ bcd2bin(buf[S35390A_ALRM_BYTE_WDAY] & ~0x80); |
649 |
++ |
650 |
++ if (buf[S35390A_ALRM_BYTE_HOURS] & 0x80) |
651 |
++ alm->time.tm_hour = |
652 |
++ s35390a_reg2hr(s35390a, |
653 |
++ buf[S35390A_ALRM_BYTE_HOURS] & ~0x80); |
654 |
++ |
655 |
++ if (buf[S35390A_ALRM_BYTE_MINS] & 0x80) |
656 |
++ alm->time.tm_min = bcd2bin(buf[S35390A_ALRM_BYTE_MINS] & ~0x80); |
657 |
++ |
658 |
++ /* alarm triggers always at s=0 */ |
659 |
++ alm->time.tm_sec = 0; |
660 |
+ |
661 |
+ dev_dbg(&client->dev, "%s: alm is mins=%d, hours=%d, wday=%d\n", |
662 |
+ __func__, alm->time.tm_min, alm->time.tm_hour, |
663 |
+@@ -327,11 +412,11 @@ static struct i2c_driver s35390a_driver; |
664 |
+ static int s35390a_probe(struct i2c_client *client, |
665 |
+ const struct i2c_device_id *id) |
666 |
+ { |
667 |
+- int err; |
668 |
++ int err, err_reset; |
669 |
+ unsigned int i; |
670 |
+ struct s35390a *s35390a; |
671 |
+ struct rtc_time tm; |
672 |
+- char buf[1]; |
673 |
++ char buf, status1; |
674 |
+ |
675 |
+ if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { |
676 |
+ err = -ENODEV; |
677 |
+@@ -360,29 +445,35 @@ static int s35390a_probe(struct i2c_client *client, |
678 |
+ } |
679 |
+ } |
680 |
+ |
681 |
+- err = s35390a_reset(s35390a); |
682 |
+- if (err < 0) { |
683 |
++ err_reset = s35390a_reset(s35390a, &status1); |
684 |
++ if (err_reset < 0) { |
685 |
++ err = err_reset; |
686 |
+ dev_err(&client->dev, "error resetting chip\n"); |
687 |
+ goto exit_dummy; |
688 |
+ } |
689 |
+ |
690 |
+- err = s35390a_disable_test_mode(s35390a); |
691 |
+- if (err < 0) { |
692 |
+- dev_err(&client->dev, "error disabling test mode\n"); |
693 |
+- goto exit_dummy; |
694 |
+- } |
695 |
+- |
696 |
+- err = s35390a_get_reg(s35390a, S35390A_CMD_STATUS1, buf, sizeof(buf)); |
697 |
+- if (err < 0) { |
698 |
+- dev_err(&client->dev, "error checking 12/24 hour mode\n"); |
699 |
+- goto exit_dummy; |
700 |
+- } |
701 |
+- if (buf[0] & S35390A_FLAG_24H) |
702 |
++ if (status1 & S35390A_FLAG_24H) |
703 |
+ s35390a->twentyfourhour = 1; |
704 |
+ else |
705 |
+ s35390a->twentyfourhour = 0; |
706 |
+ |
707 |
+- if (s35390a_get_datetime(client, &tm) < 0) |
708 |
++ if (status1 & S35390A_FLAG_INT2) { |
709 |
++ /* disable alarm (and maybe test mode) */ |
710 |
++ buf = 0; |
711 |
++ err = s35390a_set_reg(s35390a, S35390A_CMD_STATUS2, &buf, 1); |
712 |
++ if (err < 0) { |
713 |
++ dev_err(&client->dev, "error disabling alarm"); |
714 |
++ goto exit_dummy; |
715 |
++ } |
716 |
++ } else { |
717 |
++ err = s35390a_disable_test_mode(s35390a); |
718 |
++ if (err < 0) { |
719 |
++ dev_err(&client->dev, "error disabling test mode\n"); |
720 |
++ goto exit_dummy; |
721 |
++ } |
722 |
++ } |
723 |
++ |
724 |
++ if (err_reset > 0 || s35390a_get_datetime(client, &tm) < 0) |
725 |
+ dev_warn(&client->dev, "clock needs to be set\n"); |
726 |
+ |
727 |
+ device_set_wakeup_capable(&client->dev, 1); |
728 |
+@@ -395,6 +486,10 @@ static int s35390a_probe(struct i2c_client *client, |
729 |
+ err = PTR_ERR(s35390a->rtc); |
730 |
+ goto exit_dummy; |
731 |
+ } |
732 |
++ |
733 |
++ if (status1 & S35390A_FLAG_INT2) |
734 |
++ rtc_update_irq(s35390a->rtc, 1, RTC_AF); |
735 |
++ |
736 |
+ return 0; |
737 |
+ |
738 |
+ exit_dummy: |
739 |
+diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c |
740 |
+index 9c706d8c1441..6f5e2720ffad 100644 |
741 |
+--- a/drivers/scsi/libsas/sas_ata.c |
742 |
++++ b/drivers/scsi/libsas/sas_ata.c |
743 |
+@@ -218,7 +218,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) |
744 |
+ task->num_scatter = qc->n_elem; |
745 |
+ } else { |
746 |
+ for_each_sg(qc->sg, sg, qc->n_elem, si) |
747 |
+- xfer += sg->length; |
748 |
++ xfer += sg_dma_len(sg); |
749 |
+ |
750 |
+ task->total_xfer_len = xfer; |
751 |
+ task->num_scatter = si; |
752 |
+diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h |
753 |
+index 92648a5ea2d2..63f5965acc89 100644 |
754 |
+--- a/drivers/scsi/mpt3sas/mpt3sas_base.h |
755 |
++++ b/drivers/scsi/mpt3sas/mpt3sas_base.h |
756 |
+@@ -390,6 +390,7 @@ struct MPT3SAS_TARGET { |
757 |
+ * @eedp_enable: eedp support enable bit |
758 |
+ * @eedp_type: 0(type_1), 1(type_2), 2(type_3) |
759 |
+ * @eedp_block_length: block size |
760 |
++ * @ata_command_pending: SATL passthrough outstanding for device |
761 |
+ */ |
762 |
+ struct MPT3SAS_DEVICE { |
763 |
+ struct MPT3SAS_TARGET *sas_target; |
764 |
+@@ -398,6 +399,17 @@ struct MPT3SAS_DEVICE { |
765 |
+ u8 configured_lun; |
766 |
+ u8 block; |
767 |
+ u8 tlr_snoop_check; |
768 |
++ /* |
769 |
++ * Bug workaround for SATL handling: the mpt2/3sas firmware |
770 |
++ * doesn't return BUSY or TASK_SET_FULL for subsequent |
771 |
++ * commands while a SATL pass through is in operation as the |
772 |
++ * spec requires, it simply does nothing with them until the |
773 |
++ * pass through completes, causing them possibly to timeout if |
774 |
++ * the passthrough is a long executing command (like format or |
775 |
++ * secure erase). This variable allows us to do the right |
776 |
++ * thing while a SATL command is pending. |
777 |
++ */ |
778 |
++ unsigned long ata_command_pending; |
779 |
+ }; |
780 |
+ |
781 |
+ #define MPT3_CMD_NOT_USED 0x8000 /* free */ |
782 |
+diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
783 |
+index f6a8e9958e75..8a5fbdb45cfd 100644 |
784 |
+--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
785 |
++++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
786 |
+@@ -3707,9 +3707,18 @@ _scsih_temp_threshold_events(struct MPT3SAS_ADAPTER *ioc, |
787 |
+ } |
788 |
+ } |
789 |
+ |
790 |
+-static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd) |
791 |
++static int _scsih_set_satl_pending(struct scsi_cmnd *scmd, bool pending) |
792 |
+ { |
793 |
+- return (scmd->cmnd[0] == ATA_12 || scmd->cmnd[0] == ATA_16); |
794 |
++ struct MPT3SAS_DEVICE *priv = scmd->device->hostdata; |
795 |
++ |
796 |
++ if (scmd->cmnd[0] != ATA_12 && scmd->cmnd[0] != ATA_16) |
797 |
++ return 0; |
798 |
++ |
799 |
++ if (pending) |
800 |
++ return test_and_set_bit(0, &priv->ata_command_pending); |
801 |
++ |
802 |
++ clear_bit(0, &priv->ata_command_pending); |
803 |
++ return 0; |
804 |
+ } |
805 |
+ |
806 |
+ /** |
807 |
+@@ -3733,9 +3742,7 @@ _scsih_flush_running_cmds(struct MPT3SAS_ADAPTER *ioc) |
808 |
+ if (!scmd) |
809 |
+ continue; |
810 |
+ count++; |
811 |
+- if (ata_12_16_cmd(scmd)) |
812 |
+- scsi_internal_device_unblock(scmd->device, |
813 |
+- SDEV_RUNNING); |
814 |
++ _scsih_set_satl_pending(scmd, false); |
815 |
+ mpt3sas_base_free_smid(ioc, smid); |
816 |
+ scsi_dma_unmap(scmd); |
817 |
+ if (ioc->pci_error_recovery) |
818 |
+@@ -3866,13 +3873,6 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) |
819 |
+ if (ioc->logging_level & MPT_DEBUG_SCSI) |
820 |
+ scsi_print_command(scmd); |
821 |
+ |
822 |
+- /* |
823 |
+- * Lock the device for any subsequent command until command is |
824 |
+- * done. |
825 |
+- */ |
826 |
+- if (ata_12_16_cmd(scmd)) |
827 |
+- scsi_internal_device_block(scmd->device); |
828 |
+- |
829 |
+ sas_device_priv_data = scmd->device->hostdata; |
830 |
+ if (!sas_device_priv_data || !sas_device_priv_data->sas_target) { |
831 |
+ scmd->result = DID_NO_CONNECT << 16; |
832 |
+@@ -3886,6 +3886,19 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) |
833 |
+ return 0; |
834 |
+ } |
835 |
+ |
836 |
++ /* |
837 |
++ * Bug work around for firmware SATL handling. The loop |
838 |
++ * is based on atomic operations and ensures consistency |
839 |
++ * since we're lockless at this point |
840 |
++ */ |
841 |
++ do { |
842 |
++ if (test_bit(0, &sas_device_priv_data->ata_command_pending)) { |
843 |
++ scmd->result = SAM_STAT_BUSY; |
844 |
++ scmd->scsi_done(scmd); |
845 |
++ return 0; |
846 |
++ } |
847 |
++ } while (_scsih_set_satl_pending(scmd, true)); |
848 |
++ |
849 |
+ sas_target_priv_data = sas_device_priv_data->sas_target; |
850 |
+ |
851 |
+ /* invalid device handle */ |
852 |
+@@ -4445,8 +4458,7 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) |
853 |
+ if (scmd == NULL) |
854 |
+ return 1; |
855 |
+ |
856 |
+- if (ata_12_16_cmd(scmd)) |
857 |
+- scsi_internal_device_unblock(scmd->device, SDEV_RUNNING); |
858 |
++ _scsih_set_satl_pending(scmd, false); |
859 |
+ |
860 |
+ mpi_request = mpt3sas_base_get_msg_frame(ioc, smid); |
861 |
+ |
862 |
+diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c |
863 |
+index dedcff9cabb5..6514636431ab 100644 |
864 |
+--- a/drivers/scsi/sg.c |
865 |
++++ b/drivers/scsi/sg.c |
866 |
+@@ -1008,6 +1008,8 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg) |
867 |
+ result = get_user(val, ip); |
868 |
+ if (result) |
869 |
+ return result; |
870 |
++ if (val > SG_MAX_CDB_SIZE) |
871 |
++ return -ENOMEM; |
872 |
+ sfp->next_cmd_len = (val > 0) ? val : 0; |
873 |
+ return 0; |
874 |
+ case SG_GET_VERSION_NUM: |
875 |
+diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c |
876 |
+index a0f911641b04..a15070a7fcd6 100644 |
877 |
+--- a/drivers/tty/serial/atmel_serial.c |
878 |
++++ b/drivers/tty/serial/atmel_serial.c |
879 |
+@@ -1987,6 +1987,11 @@ static void atmel_flush_buffer(struct uart_port *port) |
880 |
+ atmel_uart_writel(port, ATMEL_PDC_TCR, 0); |
881 |
+ atmel_port->pdc_tx.ofs = 0; |
882 |
+ } |
883 |
++ /* |
884 |
++ * in uart_flush_buffer(), the xmit circular buffer has just |
885 |
++ * been cleared, so we have to reset tx_len accordingly. |
886 |
++ */ |
887 |
++ atmel_port->tx_len = 0; |
888 |
+ } |
889 |
+ |
890 |
+ /* |
891 |
+@@ -2499,6 +2504,9 @@ static void atmel_console_write(struct console *co, const char *s, u_int count) |
892 |
+ pdc_tx = atmel_uart_readl(port, ATMEL_PDC_PTSR) & ATMEL_PDC_TXTEN; |
893 |
+ atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_TXTDIS); |
894 |
+ |
895 |
++ /* Make sure that tx path is actually able to send characters */ |
896 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN); |
897 |
++ |
898 |
+ uart_console_write(port, s, count, atmel_console_putchar); |
899 |
+ |
900 |
+ /* |
901 |
+diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c |
902 |
+index 5724d7c41e29..ca2cbdb3aa67 100644 |
903 |
+--- a/drivers/usb/core/hcd.c |
904 |
++++ b/drivers/usb/core/hcd.c |
905 |
+@@ -499,8 +499,10 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb) |
906 |
+ */ |
907 |
+ tbuf_size = max_t(u16, sizeof(struct usb_hub_descriptor), wLength); |
908 |
+ tbuf = kzalloc(tbuf_size, GFP_KERNEL); |
909 |
+- if (!tbuf) |
910 |
+- return -ENOMEM; |
911 |
++ if (!tbuf) { |
912 |
++ status = -ENOMEM; |
913 |
++ goto err_alloc; |
914 |
++ } |
915 |
+ |
916 |
+ bufp = tbuf; |
917 |
+ |
918 |
+@@ -705,6 +707,7 @@ error: |
919 |
+ } |
920 |
+ |
921 |
+ kfree(tbuf); |
922 |
++ err_alloc: |
923 |
+ |
924 |
+ /* any errors get returned through the urb completion */ |
925 |
+ spin_lock_irq(&hcd_root_hub_lock); |
926 |
+diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h |
927 |
+index c923350ca20a..d7ce4e3280db 100644 |
928 |
+--- a/include/linux/kvm_host.h |
929 |
++++ b/include/linux/kvm_host.h |
930 |
+@@ -182,8 +182,8 @@ int kvm_io_bus_read(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr, |
931 |
+ int len, void *val); |
932 |
+ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, |
933 |
+ int len, struct kvm_io_device *dev); |
934 |
+-int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, |
935 |
+- struct kvm_io_device *dev); |
936 |
++void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, |
937 |
++ struct kvm_io_device *dev); |
938 |
+ |
939 |
+ #ifdef CONFIG_KVM_ASYNC_PF |
940 |
+ struct kvm_async_pf { |
941 |
+diff --git a/kernel/padata.c b/kernel/padata.c |
942 |
+index b38bea9c466a..401227e3967c 100644 |
943 |
+--- a/kernel/padata.c |
944 |
++++ b/kernel/padata.c |
945 |
+@@ -189,19 +189,20 @@ static struct padata_priv *padata_get_next(struct parallel_data *pd) |
946 |
+ |
947 |
+ reorder = &next_queue->reorder; |
948 |
+ |
949 |
++ spin_lock(&reorder->lock); |
950 |
+ if (!list_empty(&reorder->list)) { |
951 |
+ padata = list_entry(reorder->list.next, |
952 |
+ struct padata_priv, list); |
953 |
+ |
954 |
+- spin_lock(&reorder->lock); |
955 |
+ list_del_init(&padata->list); |
956 |
+ atomic_dec(&pd->reorder_objects); |
957 |
+- spin_unlock(&reorder->lock); |
958 |
+ |
959 |
+ pd->processed++; |
960 |
+ |
961 |
++ spin_unlock(&reorder->lock); |
962 |
+ goto out; |
963 |
+ } |
964 |
++ spin_unlock(&reorder->lock); |
965 |
+ |
966 |
+ if (__this_cpu_read(pd->pqueue->cpu_index) == next_queue->cpu_index) { |
967 |
+ padata = ERR_PTR(-ENODATA); |
968 |
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
969 |
+index ea11123a9249..7294301d8495 100644 |
970 |
+--- a/mm/hugetlb.c |
971 |
++++ b/mm/hugetlb.c |
972 |
+@@ -4362,6 +4362,7 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address, |
973 |
+ { |
974 |
+ struct page *page = NULL; |
975 |
+ spinlock_t *ptl; |
976 |
++ pte_t pte; |
977 |
+ retry: |
978 |
+ ptl = pmd_lockptr(mm, pmd); |
979 |
+ spin_lock(ptl); |
980 |
+@@ -4371,12 +4372,13 @@ retry: |
981 |
+ */ |
982 |
+ if (!pmd_huge(*pmd)) |
983 |
+ goto out; |
984 |
+- if (pmd_present(*pmd)) { |
985 |
++ pte = huge_ptep_get((pte_t *)pmd); |
986 |
++ if (pte_present(pte)) { |
987 |
+ page = pmd_page(*pmd) + ((address & ~PMD_MASK) >> PAGE_SHIFT); |
988 |
+ if (flags & FOLL_GET) |
989 |
+ get_page(page); |
990 |
+ } else { |
991 |
+- if (is_hugetlb_entry_migration(huge_ptep_get((pte_t *)pmd))) { |
992 |
++ if (is_hugetlb_entry_migration(pte)) { |
993 |
+ spin_unlock(ptl); |
994 |
+ __migration_entry_wait(mm, (pte_t *)pmd, ptl); |
995 |
+ goto retry; |
996 |
+diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c |
997 |
+index b8d927c56494..a6b2f2138c9d 100644 |
998 |
+--- a/net/ceph/messenger.c |
999 |
++++ b/net/ceph/messenger.c |
1000 |
+@@ -7,6 +7,7 @@ |
1001 |
+ #include <linux/kthread.h> |
1002 |
+ #include <linux/net.h> |
1003 |
+ #include <linux/nsproxy.h> |
1004 |
++#include <linux/sched.h> |
1005 |
+ #include <linux/slab.h> |
1006 |
+ #include <linux/socket.h> |
1007 |
+ #include <linux/string.h> |
1008 |
+@@ -478,11 +479,16 @@ static int ceph_tcp_connect(struct ceph_connection *con) |
1009 |
+ { |
1010 |
+ struct sockaddr_storage *paddr = &con->peer_addr.in_addr; |
1011 |
+ struct socket *sock; |
1012 |
++ unsigned int noio_flag; |
1013 |
+ int ret; |
1014 |
+ |
1015 |
+ BUG_ON(con->sock); |
1016 |
++ |
1017 |
++ /* sock_create_kern() allocates with GFP_KERNEL */ |
1018 |
++ noio_flag = memalloc_noio_save(); |
1019 |
+ ret = sock_create_kern(read_pnet(&con->msgr->net), paddr->ss_family, |
1020 |
+ SOCK_STREAM, IPPROTO_TCP, &sock); |
1021 |
++ memalloc_noio_restore(noio_flag); |
1022 |
+ if (ret) |
1023 |
+ return ret; |
1024 |
+ sock->sk->sk_allocation = GFP_NOFS; |
1025 |
+diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c |
1026 |
+index 3f4efcb85df5..3490d21ab9e7 100644 |
1027 |
+--- a/sound/core/seq/seq_fifo.c |
1028 |
++++ b/sound/core/seq/seq_fifo.c |
1029 |
+@@ -265,6 +265,10 @@ int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize) |
1030 |
+ /* NOTE: overflow flag is not cleared */ |
1031 |
+ spin_unlock_irqrestore(&f->lock, flags); |
1032 |
+ |
1033 |
++ /* close the old pool and wait until all users are gone */ |
1034 |
++ snd_seq_pool_mark_closing(oldpool); |
1035 |
++ snd_use_lock_sync(&f->use_lock); |
1036 |
++ |
1037 |
+ /* release cells in old pool */ |
1038 |
+ for (cell = oldhead; cell; cell = next) { |
1039 |
+ next = cell->next; |
1040 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
1041 |
+index 1d4f34379f56..46a34039ecdc 100644 |
1042 |
+--- a/sound/pci/hda/patch_realtek.c |
1043 |
++++ b/sound/pci/hda/patch_realtek.c |
1044 |
+@@ -4831,6 +4831,7 @@ enum { |
1045 |
+ ALC292_FIXUP_DISABLE_AAMIX, |
1046 |
+ ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, |
1047 |
+ ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, |
1048 |
++ ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, |
1049 |
+ ALC275_FIXUP_DELL_XPS, |
1050 |
+ ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE, |
1051 |
+ ALC293_FIXUP_LENOVO_SPK_NOISE, |
1052 |
+@@ -5429,6 +5430,15 @@ static const struct hda_fixup alc269_fixups[] = { |
1053 |
+ .chained = true, |
1054 |
+ .chain_id = ALC269_FIXUP_HEADSET_MODE |
1055 |
+ }, |
1056 |
++ [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = { |
1057 |
++ .type = HDA_FIXUP_PINS, |
1058 |
++ .v.pins = (const struct hda_pintbl[]) { |
1059 |
++ { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */ |
1060 |
++ { } |
1061 |
++ }, |
1062 |
++ .chained = true, |
1063 |
++ .chain_id = ALC269_FIXUP_HEADSET_MODE |
1064 |
++ }, |
1065 |
+ [ALC275_FIXUP_DELL_XPS] = { |
1066 |
+ .type = HDA_FIXUP_VERBS, |
1067 |
+ .v.verbs = (const struct hda_verb[]) { |
1068 |
+@@ -5501,7 +5511,7 @@ static const struct hda_fixup alc269_fixups[] = { |
1069 |
+ .type = HDA_FIXUP_FUNC, |
1070 |
+ .v.func = alc298_fixup_speaker_volume, |
1071 |
+ .chained = true, |
1072 |
+- .chain_id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, |
1073 |
++ .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, |
1074 |
+ }, |
1075 |
+ [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = { |
1076 |
+ .type = HDA_FIXUP_PINS, |
1077 |
+diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c |
1078 |
+index 8276675730ef..78a985629607 100644 |
1079 |
+--- a/sound/soc/atmel/atmel-classd.c |
1080 |
++++ b/sound/soc/atmel/atmel-classd.c |
1081 |
+@@ -343,7 +343,7 @@ static int atmel_classd_codec_dai_digital_mute(struct snd_soc_dai *codec_dai, |
1082 |
+ } |
1083 |
+ |
1084 |
+ #define CLASSD_ACLK_RATE_11M2896_MPY_8 (112896 * 100 * 8) |
1085 |
+-#define CLASSD_ACLK_RATE_12M288_MPY_8 (12228 * 1000 * 8) |
1086 |
++#define CLASSD_ACLK_RATE_12M288_MPY_8 (12288 * 1000 * 8) |
1087 |
+ |
1088 |
+ static struct { |
1089 |
+ int rate; |
1090 |
+diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c |
1091 |
+index 46dbc0a7dfc1..49001fa84ead 100644 |
1092 |
+--- a/virt/kvm/eventfd.c |
1093 |
++++ b/virt/kvm/eventfd.c |
1094 |
+@@ -868,7 +868,8 @@ kvm_deassign_ioeventfd_idx(struct kvm *kvm, enum kvm_bus bus_idx, |
1095 |
+ continue; |
1096 |
+ |
1097 |
+ kvm_io_bus_unregister_dev(kvm, bus_idx, &p->dev); |
1098 |
+- kvm->buses[bus_idx]->ioeventfd_count--; |
1099 |
++ if (kvm->buses[bus_idx]) |
1100 |
++ kvm->buses[bus_idx]->ioeventfd_count--; |
1101 |
+ ioeventfd_release(p); |
1102 |
+ ret = 0; |
1103 |
+ break; |
1104 |
+diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c |
1105 |
+index 336ed267c407..cb092bd9965b 100644 |
1106 |
+--- a/virt/kvm/kvm_main.c |
1107 |
++++ b/virt/kvm/kvm_main.c |
1108 |
+@@ -654,8 +654,11 @@ static void kvm_destroy_vm(struct kvm *kvm) |
1109 |
+ list_del(&kvm->vm_list); |
1110 |
+ spin_unlock(&kvm_lock); |
1111 |
+ kvm_free_irq_routing(kvm); |
1112 |
+- for (i = 0; i < KVM_NR_BUSES; i++) |
1113 |
+- kvm_io_bus_destroy(kvm->buses[i]); |
1114 |
++ for (i = 0; i < KVM_NR_BUSES; i++) { |
1115 |
++ if (kvm->buses[i]) |
1116 |
++ kvm_io_bus_destroy(kvm->buses[i]); |
1117 |
++ kvm->buses[i] = NULL; |
1118 |
++ } |
1119 |
+ kvm_coalesced_mmio_free(kvm); |
1120 |
+ #if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER) |
1121 |
+ mmu_notifier_unregister(&kvm->mmu_notifier, kvm->mm); |
1122 |
+@@ -3271,6 +3274,8 @@ int kvm_io_bus_write(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr, |
1123 |
+ }; |
1124 |
+ |
1125 |
+ bus = srcu_dereference(vcpu->kvm->buses[bus_idx], &vcpu->kvm->srcu); |
1126 |
++ if (!bus) |
1127 |
++ return -ENOMEM; |
1128 |
+ r = __kvm_io_bus_write(vcpu, bus, &range, val); |
1129 |
+ return r < 0 ? r : 0; |
1130 |
+ } |
1131 |
+@@ -3288,6 +3293,8 @@ int kvm_io_bus_write_cookie(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, |
1132 |
+ }; |
1133 |
+ |
1134 |
+ bus = srcu_dereference(vcpu->kvm->buses[bus_idx], &vcpu->kvm->srcu); |
1135 |
++ if (!bus) |
1136 |
++ return -ENOMEM; |
1137 |
+ |
1138 |
+ /* First try the device referenced by cookie. */ |
1139 |
+ if ((cookie >= 0) && (cookie < bus->dev_count) && |
1140 |
+@@ -3338,6 +3345,8 @@ int kvm_io_bus_read(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr, |
1141 |
+ }; |
1142 |
+ |
1143 |
+ bus = srcu_dereference(vcpu->kvm->buses[bus_idx], &vcpu->kvm->srcu); |
1144 |
++ if (!bus) |
1145 |
++ return -ENOMEM; |
1146 |
+ r = __kvm_io_bus_read(vcpu, bus, &range, val); |
1147 |
+ return r < 0 ? r : 0; |
1148 |
+ } |
1149 |
+@@ -3350,6 +3359,9 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, |
1150 |
+ struct kvm_io_bus *new_bus, *bus; |
1151 |
+ |
1152 |
+ bus = kvm->buses[bus_idx]; |
1153 |
++ if (!bus) |
1154 |
++ return -ENOMEM; |
1155 |
++ |
1156 |
+ /* exclude ioeventfd which is limited by maximum fd */ |
1157 |
+ if (bus->dev_count - bus->ioeventfd_count > NR_IOBUS_DEVS - 1) |
1158 |
+ return -ENOSPC; |
1159 |
+@@ -3369,37 +3381,41 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, |
1160 |
+ } |
1161 |
+ |
1162 |
+ /* Caller must hold slots_lock. */ |
1163 |
+-int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, |
1164 |
+- struct kvm_io_device *dev) |
1165 |
++void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, |
1166 |
++ struct kvm_io_device *dev) |
1167 |
+ { |
1168 |
+- int i, r; |
1169 |
++ int i; |
1170 |
+ struct kvm_io_bus *new_bus, *bus; |
1171 |
+ |
1172 |
+ bus = kvm->buses[bus_idx]; |
1173 |
+- r = -ENOENT; |
1174 |
++ if (!bus) |
1175 |
++ return; |
1176 |
++ |
1177 |
+ for (i = 0; i < bus->dev_count; i++) |
1178 |
+ if (bus->range[i].dev == dev) { |
1179 |
+- r = 0; |
1180 |
+ break; |
1181 |
+ } |
1182 |
+ |
1183 |
+- if (r) |
1184 |
+- return r; |
1185 |
++ if (i == bus->dev_count) |
1186 |
++ return; |
1187 |
+ |
1188 |
+ new_bus = kmalloc(sizeof(*bus) + ((bus->dev_count - 1) * |
1189 |
+ sizeof(struct kvm_io_range)), GFP_KERNEL); |
1190 |
+- if (!new_bus) |
1191 |
+- return -ENOMEM; |
1192 |
++ if (!new_bus) { |
1193 |
++ pr_err("kvm: failed to shrink bus, removing it completely\n"); |
1194 |
++ goto broken; |
1195 |
++ } |
1196 |
+ |
1197 |
+ memcpy(new_bus, bus, sizeof(*bus) + i * sizeof(struct kvm_io_range)); |
1198 |
+ new_bus->dev_count--; |
1199 |
+ memcpy(new_bus->range + i, bus->range + i + 1, |
1200 |
+ (new_bus->dev_count - i) * sizeof(struct kvm_io_range)); |
1201 |
+ |
1202 |
++broken: |
1203 |
+ rcu_assign_pointer(kvm->buses[bus_idx], new_bus); |
1204 |
+ synchronize_srcu_expedited(&kvm->srcu); |
1205 |
+ kfree(bus); |
1206 |
+- return r; |
1207 |
++ return; |
1208 |
+ } |
1209 |
+ |
1210 |
+ static struct notifier_block kvm_cpu_notifier = { |