/[linux-patches]/genpatches-2.6/tags/3.0-30/1015_linux-3.0.16.patch
Gentoo

Contents of /genpatches-2.6/tags/3.0-30/1015_linux-3.0.16.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2206 - (show annotations) (download)
Mon Sep 17 18:58:14 2012 UTC (2 years, 8 months ago) by mpagano
File size: 112318 byte(s)
3.0-30 release
1 diff --git a/Makefile b/Makefile
2 index 5b8c185..7f0d8e2 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 3
7 PATCHLEVEL = 0
8 -SUBLEVEL = 15
9 +SUBLEVEL = 16
10 EXTRAVERSION =
11 NAME = Sneaky Weasel
12
13 diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
14 index 88bd6f7..c565971 100644
15 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c
16 +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
17 @@ -133,7 +133,7 @@ static struct platform_device rx51_charger_device = {
18 static void __init rx51_charger_init(void)
19 {
20 WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO,
21 - GPIOF_OUT_INIT_LOW, "isp1704_reset"));
22 + GPIOF_OUT_INIT_HIGH, "isp1704_reset"));
23
24 platform_device_register(&rx51_charger_device);
25 }
26 diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
27 index c074e66..4e0a371 100644
28 --- a/arch/arm/oprofile/common.c
29 +++ b/arch/arm/oprofile/common.c
30 @@ -116,7 +116,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
31 return oprofile_perf_init(ops);
32 }
33
34 -void __exit oprofile_arch_exit(void)
35 +void oprofile_arch_exit(void)
36 {
37 oprofile_perf_exit();
38 }
39 diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
40 index 7a61ef8..f4b68be 100644
41 --- a/arch/arm/plat-mxc/pwm.c
42 +++ b/arch/arm/plat-mxc/pwm.c
43 @@ -32,6 +32,9 @@
44 #define MX3_PWMSAR 0x0C /* PWM Sample Register */
45 #define MX3_PWMPR 0x10 /* PWM Period Register */
46 #define MX3_PWMCR_PRESCALER(x) (((x - 1) & 0xFFF) << 4)
47 +#define MX3_PWMCR_DOZEEN (1 << 24)
48 +#define MX3_PWMCR_WAITEN (1 << 23)
49 +#define MX3_PWMCR_DBGEN (1 << 22)
50 #define MX3_PWMCR_CLKSRC_IPG_HIGH (2 << 16)
51 #define MX3_PWMCR_CLKSRC_IPG (1 << 16)
52 #define MX3_PWMCR_EN (1 << 0)
53 @@ -74,10 +77,21 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
54 do_div(c, period_ns);
55 duty_cycles = c;
56
57 + /*
58 + * according to imx pwm RM, the real period value should be
59 + * PERIOD value in PWMPR plus 2.
60 + */
61 + if (period_cycles > 2)
62 + period_cycles -= 2;
63 + else
64 + period_cycles = 0;
65 +
66 writel(duty_cycles, pwm->mmio_base + MX3_PWMSAR);
67 writel(period_cycles, pwm->mmio_base + MX3_PWMPR);
68
69 - cr = MX3_PWMCR_PRESCALER(prescale) | MX3_PWMCR_EN;
70 + cr = MX3_PWMCR_PRESCALER(prescale) |
71 + MX3_PWMCR_DOZEEN | MX3_PWMCR_WAITEN |
72 + MX3_PWMCR_DBGEN | MX3_PWMCR_EN;
73
74 if (cpu_is_mx25())
75 cr |= MX3_PWMCR_CLKSRC_IPG;
76 diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c
77 index 0e358c2..422110a 100644
78 --- a/arch/s390/oprofile/init.c
79 +++ b/arch/s390/oprofile/init.c
80 @@ -90,7 +90,7 @@ static ssize_t hwsampler_write(struct file *file, char const __user *buf,
81 return -EINVAL;
82
83 retval = oprofilefs_ulong_from_user(&val, buf, count);
84 - if (retval)
85 + if (retval <= 0)
86 return retval;
87
88 if (oprofile_started)
89 diff --git a/arch/sh/oprofile/common.c b/arch/sh/oprofile/common.c
90 index b4c2d2b..e4dd5d5 100644
91 --- a/arch/sh/oprofile/common.c
92 +++ b/arch/sh/oprofile/common.c
93 @@ -49,7 +49,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
94 return oprofile_perf_init(ops);
95 }
96
97 -void __exit oprofile_arch_exit(void)
98 +void oprofile_arch_exit(void)
99 {
100 oprofile_perf_exit();
101 kfree(sh_pmu_op_name);
102 @@ -60,5 +60,5 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
103 ops->backtrace = sh_backtrace;
104 return -ENODEV;
105 }
106 -void __exit oprofile_arch_exit(void) {}
107 +void oprofile_arch_exit(void) {}
108 #endif /* CONFIG_HW_PERF_EVENTS */
109 diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
110 index 5b31a8e..a790cc6 100644
111 --- a/arch/sparc/include/asm/pgtable_32.h
112 +++ b/arch/sparc/include/asm/pgtable_32.h
113 @@ -431,10 +431,6 @@ extern unsigned long *sparc_valid_addr_bitmap;
114 #define kern_addr_valid(addr) \
115 (test_bit(__pa((unsigned long)(addr))>>20, sparc_valid_addr_bitmap))
116
117 -extern int io_remap_pfn_range(struct vm_area_struct *vma,
118 - unsigned long from, unsigned long pfn,
119 - unsigned long size, pgprot_t prot);
120 -
121 /*
122 * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in
123 * its high 4 bits. These macros/functions put it there or get it from there.
124 @@ -443,6 +439,22 @@ extern int io_remap_pfn_range(struct vm_area_struct *vma,
125 #define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4))
126 #define GET_PFN(pfn) (pfn & 0x0fffffffUL)
127
128 +extern int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long,
129 + unsigned long, pgprot_t);
130 +
131 +static inline int io_remap_pfn_range(struct vm_area_struct *vma,
132 + unsigned long from, unsigned long pfn,
133 + unsigned long size, pgprot_t prot)
134 +{
135 + unsigned long long offset, space, phys_base;
136 +
137 + offset = ((unsigned long long) GET_PFN(pfn)) << PAGE_SHIFT;
138 + space = GET_IOSPACE(pfn);
139 + phys_base = offset | (space << 32ULL);
140 +
141 + return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot);
142 +}
143 +
144 #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
145 #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
146 ({ \
147 diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
148 index 1e03c5a..9822628 100644
149 --- a/arch/sparc/include/asm/pgtable_64.h
150 +++ b/arch/sparc/include/asm/pgtable_64.h
151 @@ -750,10 +750,6 @@ static inline bool kern_addr_valid(unsigned long addr)
152
153 extern int page_in_phys_avail(unsigned long paddr);
154
155 -extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
156 - unsigned long pfn,
157 - unsigned long size, pgprot_t prot);
158 -
159 /*
160 * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in
161 * its high 4 bits. These macros/functions put it there or get it from there.
162 @@ -762,6 +758,22 @@ extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
163 #define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4))
164 #define GET_PFN(pfn) (pfn & 0x0fffffffffffffffUL)
165
166 +extern int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long,
167 + unsigned long, pgprot_t);
168 +
169 +static inline int io_remap_pfn_range(struct vm_area_struct *vma,
170 + unsigned long from, unsigned long pfn,
171 + unsigned long size, pgprot_t prot)
172 +{
173 + unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT;
174 + int space = GET_IOSPACE(pfn);
175 + unsigned long phys_base;
176 +
177 + phys_base = offset | (((unsigned long) space) << 32UL);
178 +
179 + return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot);
180 +}
181 +
182 #include <asm-generic/pgtable.h>
183
184 /* We provide our own get_unmapped_area to cope with VA holes and
185 diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h
186 index e27f8ea..0c218e4 100644
187 --- a/arch/sparc/kernel/entry.h
188 +++ b/arch/sparc/kernel/entry.h
189 @@ -42,6 +42,9 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
190 extern void fpload(unsigned long *fpregs, unsigned long *fsr);
191
192 #else /* CONFIG_SPARC32 */
193 +
194 +#include <asm/trap_block.h>
195 +
196 struct popc_3insn_patch_entry {
197 unsigned int addr;
198 unsigned int insns[3];
199 @@ -57,6 +60,10 @@ extern struct popc_6insn_patch_entry __popc_6insn_patch,
200 __popc_6insn_patch_end;
201
202 extern void __init per_cpu_patch(void);
203 +extern void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *,
204 + struct sun4v_1insn_patch_entry *);
205 +extern void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *,
206 + struct sun4v_2insn_patch_entry *);
207 extern void __init sun4v_patch(void);
208 extern void __init boot_cpu_id_too_large(int cpu);
209 extern unsigned int dcache_parity_tl1_occurred;
210 diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
211 index 99ba5ba..8172c18 100644
212 --- a/arch/sparc/kernel/module.c
213 +++ b/arch/sparc/kernel/module.c
214 @@ -17,6 +17,8 @@
215 #include <asm/processor.h>
216 #include <asm/spitfire.h>
217
218 +#include "entry.h"
219 +
220 #ifdef CONFIG_SPARC64
221
222 #include <linux/jump_label.h>
223 @@ -220,6 +222,29 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
224 }
225
226 #ifdef CONFIG_SPARC64
227 +static void do_patch_sections(const Elf_Ehdr *hdr,
228 + const Elf_Shdr *sechdrs)
229 +{
230 + const Elf_Shdr *s, *sun4v_1insn = NULL, *sun4v_2insn = NULL;
231 + char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
232 +
233 + for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) {
234 + if (!strcmp(".sun4v_1insn_patch", secstrings + s->sh_name))
235 + sun4v_1insn = s;
236 + if (!strcmp(".sun4v_2insn_patch", secstrings + s->sh_name))
237 + sun4v_2insn = s;
238 + }
239 +
240 + if (sun4v_1insn && tlb_type == hypervisor) {
241 + void *p = (void *) sun4v_1insn->sh_addr;
242 + sun4v_patch_1insn_range(p, p + sun4v_1insn->sh_size);
243 + }
244 + if (sun4v_2insn && tlb_type == hypervisor) {
245 + void *p = (void *) sun4v_2insn->sh_addr;
246 + sun4v_patch_2insn_range(p, p + sun4v_2insn->sh_size);
247 + }
248 +}
249 +
250 int module_finalize(const Elf_Ehdr *hdr,
251 const Elf_Shdr *sechdrs,
252 struct module *me)
253 @@ -227,6 +252,8 @@ int module_finalize(const Elf_Ehdr *hdr,
254 /* make jump label nops */
255 jump_label_apply_nops(me);
256
257 + do_patch_sections(hdr, sechdrs);
258 +
259 /* Cheetah's I-cache is fully coherent. */
260 if (tlb_type == spitfire) {
261 unsigned long va;
262 diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
263 index b01a06e..9e73c4a 100644
264 --- a/arch/sparc/kernel/pci_sun4v.c
265 +++ b/arch/sparc/kernel/pci_sun4v.c
266 @@ -848,10 +848,10 @@ static int pci_sun4v_msiq_build_irq(struct pci_pbm_info *pbm,
267 if (!irq)
268 return -ENOMEM;
269
270 - if (pci_sun4v_msiq_setstate(pbm->devhandle, msiqid, HV_MSIQSTATE_IDLE))
271 - return -EINVAL;
272 if (pci_sun4v_msiq_setvalid(pbm->devhandle, msiqid, HV_MSIQ_VALID))
273 return -EINVAL;
274 + if (pci_sun4v_msiq_setstate(pbm->devhandle, msiqid, HV_MSIQSTATE_IDLE))
275 + return -EINVAL;
276
277 return irq;
278 }
279 diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
280 index 3c5bb78..4e7d3ff 100644
281 --- a/arch/sparc/kernel/setup_64.c
282 +++ b/arch/sparc/kernel/setup_64.c
283 @@ -234,40 +234,50 @@ void __init per_cpu_patch(void)
284 }
285 }
286
287 -void __init sun4v_patch(void)
288 +void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *start,
289 + struct sun4v_1insn_patch_entry *end)
290 {
291 - extern void sun4v_hvapi_init(void);
292 - struct sun4v_1insn_patch_entry *p1;
293 - struct sun4v_2insn_patch_entry *p2;
294 -
295 - if (tlb_type != hypervisor)
296 - return;
297 + while (start < end) {
298 + unsigned long addr = start->addr;
299
300 - p1 = &__sun4v_1insn_patch;
301 - while (p1 < &__sun4v_1insn_patch_end) {
302 - unsigned long addr = p1->addr;
303 -
304 - *(unsigned int *) (addr + 0) = p1->insn;
305 + *(unsigned int *) (addr + 0) = start->insn;
306 wmb();
307 __asm__ __volatile__("flush %0" : : "r" (addr + 0));
308
309 - p1++;
310 + start++;
311 }
312 +}
313
314 - p2 = &__sun4v_2insn_patch;
315 - while (p2 < &__sun4v_2insn_patch_end) {
316 - unsigned long addr = p2->addr;
317 +void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *start,
318 + struct sun4v_2insn_patch_entry *end)
319 +{
320 + while (start < end) {
321 + unsigned long addr = start->addr;
322
323 - *(unsigned int *) (addr + 0) = p2->insns[0];
324 + *(unsigned int *) (addr + 0) = start->insns[0];
325 wmb();
326 __asm__ __volatile__("flush %0" : : "r" (addr + 0));
327
328 - *(unsigned int *) (addr + 4) = p2->insns[1];
329 + *(unsigned int *) (addr + 4) = start->insns[1];
330 wmb();
331 __asm__ __volatile__("flush %0" : : "r" (addr + 4));
332
333 - p2++;
334 + start++;
335 }
336 +}
337 +
338 +void __init sun4v_patch(void)
339 +{
340 + extern void sun4v_hvapi_init(void);
341 +
342 + if (tlb_type != hypervisor)
343 + return;
344 +
345 + sun4v_patch_1insn_range(&__sun4v_1insn_patch,
346 + &__sun4v_1insn_patch_end);
347 +
348 + sun4v_patch_2insn_range(&__sun4v_2insn_patch,
349 + &__sun4v_2insn_patch_end);
350
351 sun4v_hvapi_init();
352 }
353 diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
354 index 5d92488..2e58328 100644
355 --- a/arch/sparc/kernel/signal32.c
356 +++ b/arch/sparc/kernel/signal32.c
357 @@ -829,21 +829,23 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs
358 * want to handle. Thus you cannot kill init even with a SIGKILL even by
359 * mistake.
360 */
361 -void do_signal32(sigset_t *oldset, struct pt_regs * regs,
362 - int restart_syscall, unsigned long orig_i0)
363 +void do_signal32(sigset_t *oldset, struct pt_regs * regs)
364 {
365 struct k_sigaction ka;
366 + unsigned long orig_i0;
367 + int restart_syscall;
368 siginfo_t info;
369 int signr;
370
371 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
372
373 - /* If the debugger messes with the program counter, it clears
374 - * the "in syscall" bit, directing us to not perform a syscall
375 - * restart.
376 - */
377 - if (restart_syscall && !pt_regs_is_syscall(regs))
378 - restart_syscall = 0;
379 + restart_syscall = 0;
380 + orig_i0 = 0;
381 + if (pt_regs_is_syscall(regs) &&
382 + (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) {
383 + restart_syscall = 1;
384 + orig_i0 = regs->u_regs[UREG_G6];
385 + }
386
387 if (signr > 0) {
388 if (restart_syscall)
389 diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c
390 index 04ede8f..2302567 100644
391 --- a/arch/sparc/kernel/signal_32.c
392 +++ b/arch/sparc/kernel/signal_32.c
393 @@ -525,10 +525,26 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
394 siginfo_t info;
395 int signr;
396
397 + /* It's a lot of work and synchronization to add a new ptrace
398 + * register for GDB to save and restore in order to get
399 + * orig_i0 correct for syscall restarts when debugging.
400 + *
401 + * Although it should be the case that most of the global
402 + * registers are volatile across a system call, glibc already
403 + * depends upon that fact that we preserve them. So we can't
404 + * just use any global register to save away the orig_i0 value.
405 + *
406 + * In particular %g2, %g3, %g4, and %g5 are all assumed to be
407 + * preserved across a system call trap by various pieces of
408 + * code in glibc.
409 + *
410 + * %g7 is used as the "thread register". %g6 is not used in
411 + * any fixed manner. %g6 is used as a scratch register and
412 + * a compiler temporary, but it's value is never used across
413 + * a system call. Therefore %g6 is usable for orig_i0 storage.
414 + */
415 if (pt_regs_is_syscall(regs) && (regs->psr & PSR_C))
416 - restart_syscall = 1;
417 - else
418 - restart_syscall = 0;
419 + regs->u_regs[UREG_G6] = orig_i0;
420
421 if (test_thread_flag(TIF_RESTORE_SIGMASK))
422 oldset = &current->saved_sigmask;
423 @@ -541,8 +557,12 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
424 * the software "in syscall" bit, directing us to not perform
425 * a syscall restart.
426 */
427 - if (restart_syscall && !pt_regs_is_syscall(regs))
428 - restart_syscall = 0;
429 + restart_syscall = 0;
430 + if (pt_regs_is_syscall(regs) && (regs->psr & PSR_C)) {
431 + restart_syscall = 1;
432 + orig_i0 = regs->u_regs[UREG_G6];
433 + }
434 +
435
436 if (signr > 0) {
437 if (restart_syscall)
438 diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
439 index 47509df..d58260b 100644
440 --- a/arch/sparc/kernel/signal_64.c
441 +++ b/arch/sparc/kernel/signal_64.c
442 @@ -535,11 +535,27 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
443 siginfo_t info;
444 int signr;
445
446 + /* It's a lot of work and synchronization to add a new ptrace
447 + * register for GDB to save and restore in order to get
448 + * orig_i0 correct for syscall restarts when debugging.
449 + *
450 + * Although it should be the case that most of the global
451 + * registers are volatile across a system call, glibc already
452 + * depends upon that fact that we preserve them. So we can't
453 + * just use any global register to save away the orig_i0 value.
454 + *
455 + * In particular %g2, %g3, %g4, and %g5 are all assumed to be
456 + * preserved across a system call trap by various pieces of
457 + * code in glibc.
458 + *
459 + * %g7 is used as the "thread register". %g6 is not used in
460 + * any fixed manner. %g6 is used as a scratch register and
461 + * a compiler temporary, but it's value is never used across
462 + * a system call. Therefore %g6 is usable for orig_i0 storage.
463 + */
464 if (pt_regs_is_syscall(regs) &&
465 - (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) {
466 - restart_syscall = 1;
467 - } else
468 - restart_syscall = 0;
469 + (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY)))
470 + regs->u_regs[UREG_G6] = orig_i0;
471
472 if (current_thread_info()->status & TS_RESTORE_SIGMASK)
473 oldset = &current->saved_sigmask;
474 @@ -548,22 +564,20 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
475
476 #ifdef CONFIG_COMPAT
477 if (test_thread_flag(TIF_32BIT)) {
478 - extern void do_signal32(sigset_t *, struct pt_regs *,
479 - int restart_syscall,
480 - unsigned long orig_i0);
481 - do_signal32(oldset, regs, restart_syscall, orig_i0);
482 + extern void do_signal32(sigset_t *, struct pt_regs *);
483 + do_signal32(oldset, regs);
484 return;
485 }
486 #endif
487
488 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
489
490 - /* If the debugger messes with the program counter, it clears
491 - * the software "in syscall" bit, directing us to not perform
492 - * a syscall restart.
493 - */
494 - if (restart_syscall && !pt_regs_is_syscall(regs))
495 - restart_syscall = 0;
496 + restart_syscall = 0;
497 + if (pt_regs_is_syscall(regs) &&
498 + (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) {
499 + restart_syscall = 1;
500 + orig_i0 = regs->u_regs[UREG_G6];
501 + }
502
503 if (signr > 0) {
504 if (restart_syscall)
505 diff --git a/arch/sparc/kernel/visemul.c b/arch/sparc/kernel/visemul.c
506 index 3635771..9384a0c 100644
507 --- a/arch/sparc/kernel/visemul.c
508 +++ b/arch/sparc/kernel/visemul.c
509 @@ -713,17 +713,17 @@ static void pcmp(struct pt_regs *regs, unsigned int insn, unsigned int opf)
510 s16 b = (rs2 >> (i * 16)) & 0xffff;
511
512 if (a > b)
513 - rd_val |= 1 << i;
514 + rd_val |= 8 >> i;
515 }
516 break;
517
518 case FCMPGT32_OPF:
519 for (i = 0; i < 2; i++) {
520 - s32 a = (rs1 >> (i * 32)) & 0xffff;
521 - s32 b = (rs2 >> (i * 32)) & 0xffff;
522 + s32 a = (rs1 >> (i * 32)) & 0xffffffff;
523 + s32 b = (rs2 >> (i * 32)) & 0xffffffff;
524
525 if (a > b)
526 - rd_val |= 1 << i;
527 + rd_val |= 2 >> i;
528 }
529 break;
530
531 @@ -733,17 +733,17 @@ static void pcmp(struct pt_regs *regs, unsigned int insn, unsigned int opf)
532 s16 b = (rs2 >> (i * 16)) & 0xffff;
533
534 if (a <= b)
535 - rd_val |= 1 << i;
536 + rd_val |= 8 >> i;
537 }
538 break;
539
540 case FCMPLE32_OPF:
541 for (i = 0; i < 2; i++) {
542 - s32 a = (rs1 >> (i * 32)) & 0xffff;
543 - s32 b = (rs2 >> (i * 32)) & 0xffff;
544 + s32 a = (rs1 >> (i * 32)) & 0xffffffff;
545 + s32 b = (rs2 >> (i * 32)) & 0xffffffff;
546
547 if (a <= b)
548 - rd_val |= 1 << i;
549 + rd_val |= 2 >> i;
550 }
551 break;
552
553 @@ -753,17 +753,17 @@ static void pcmp(struct pt_regs *regs, unsigned int insn, unsigned int opf)
554 s16 b = (rs2 >> (i * 16)) & 0xffff;
555
556 if (a != b)
557 - rd_val |= 1 << i;
558 + rd_val |= 8 >> i;
559 }
560 break;
561
562 case FCMPNE32_OPF:
563 for (i = 0; i < 2; i++) {
564 - s32 a = (rs1 >> (i * 32)) & 0xffff;
565 - s32 b = (rs2 >> (i * 32)) & 0xffff;
566 + s32 a = (rs1 >> (i * 32)) & 0xffffffff;
567 + s32 b = (rs2 >> (i * 32)) & 0xffffffff;
568
569 if (a != b)
570 - rd_val |= 1 << i;
571 + rd_val |= 2 >> i;
572 }
573 break;
574
575 @@ -773,17 +773,17 @@ static void pcmp(struct pt_regs *regs, unsigned int insn, unsigned int opf)
576 s16 b = (rs2 >> (i * 16)) & 0xffff;
577
578 if (a == b)
579 - rd_val |= 1 << i;
580 + rd_val |= 8 >> i;
581 }
582 break;
583
584 case FCMPEQ32_OPF:
585 for (i = 0; i < 2; i++) {
586 - s32 a = (rs1 >> (i * 32)) & 0xffff;
587 - s32 b = (rs2 >> (i * 32)) & 0xffff;
588 + s32 a = (rs1 >> (i * 32)) & 0xffffffff;
589 + s32 b = (rs2 >> (i * 32)) & 0xffffffff;
590
591 if (a == b)
592 - rd_val |= 1 << i;
593 + rd_val |= 2 >> i;
594 }
595 break;
596 }
597 diff --git a/arch/sparc/lib/memcpy.S b/arch/sparc/lib/memcpy.S
598 index 34fe657..4d8c497 100644
599 --- a/arch/sparc/lib/memcpy.S
600 +++ b/arch/sparc/lib/memcpy.S
601 @@ -7,40 +7,12 @@
602 * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
603 */
604
605 -#ifdef __KERNEL__
606 -
607 -#define FUNC(x) \
608 +#define FUNC(x) \
609 .globl x; \
610 .type x,@function; \
611 - .align 4; \
612 + .align 4; \
613 x:
614
615 -#undef FASTER_REVERSE
616 -#undef FASTER_NONALIGNED
617 -#define FASTER_ALIGNED
618 -
619 -/* In kernel these functions don't return a value.
620 - * One should use macros in asm/string.h for that purpose.
621 - * We return 0, so that bugs are more apparent.
622 - */
623 -#define SETUP_RETL
624 -#define RETL_INSN clr %o0
625 -
626 -#else
627 -
628 -/* libc */
629 -
630 -#include "DEFS.h"
631 -
632 -#define FASTER_REVERSE
633 -#define FASTER_NONALIGNED
634 -#define FASTER_ALIGNED
635 -
636 -#define SETUP_RETL mov %o0, %g6
637 -#define RETL_INSN mov %g6, %o0
638 -
639 -#endif
640 -
641 /* Both these macros have to start with exactly the same insn */
642 #define MOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \
643 ldd [%src + (offset) + 0x00], %t0; \
644 @@ -164,30 +136,6 @@ x:
645 .text
646 .align 4
647
648 -#ifdef FASTER_REVERSE
649 -
650 -70: /* rdword_align */
651 -
652 - andcc %o1, 1, %g0
653 - be 4f
654 - andcc %o1, 2, %g0
655 -
656 - ldub [%o1 - 1], %g2
657 - sub %o1, 1, %o1
658 - stb %g2, [%o0 - 1]
659 - sub %o2, 1, %o2
660 - be 3f
661 - sub %o0, 1, %o0
662 -4:
663 - lduh [%o1 - 2], %g2
664 - sub %o1, 2, %o1
665 - sth %g2, [%o0 - 2]
666 - sub %o2, 2, %o2
667 - b 3f
668 - sub %o0, 2, %o0
669 -
670 -#endif /* FASTER_REVERSE */
671 -
672 0:
673 retl
674 nop ! Only bcopy returns here and it retuns void...
675 @@ -198,7 +146,7 @@ FUNC(__memmove)
676 #endif
677 FUNC(memmove)
678 cmp %o0, %o1
679 - SETUP_RETL
680 + mov %o0, %g7
681 bleu 9f
682 sub %o0, %o1, %o4
683
684 @@ -207,8 +155,6 @@ FUNC(memmove)
685 bleu 0f
686 andcc %o4, 3, %o5
687
688 -#ifndef FASTER_REVERSE
689 -
690 add %o1, %o2, %o1
691 add %o0, %o2, %o0
692 sub %o1, 1, %o1
693 @@ -224,295 +170,7 @@ FUNC(memmove)
694 sub %o0, 1, %o0
695
696 retl
697 - RETL_INSN
698 -
699 -#else /* FASTER_REVERSE */
700 -
701 - add %o1, %o2, %o1
702 - add %o0, %o2, %o0
703 - bne 77f
704 - cmp %o2, 15
705 - bleu 91f
706 - andcc %o1, 3, %g0
707 - bne 70b
708 -3:
709 - andcc %o1, 4, %g0
710 -
711 - be 2f
712 - mov %o2, %g1
713 -
714 - ld [%o1 - 4], %o4
715 - sub %g1, 4, %g1
716 - st %o4, [%o0 - 4]
717 - sub %o1, 4, %o1
718 - sub %o0, 4, %o0
719 -2:
720 - andcc %g1, 0xffffff80, %g7
721 - be 3f
722 - andcc %o0, 4, %g0
723 -
724 - be 74f + 4
725 -5:
726 - RMOVE_BIGCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5)
727 - RMOVE_BIGCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5)
728 - RMOVE_BIGCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5)
729 - RMOVE_BIGCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5)
730 - subcc %g7, 128, %g7
731 - sub %o1, 128, %o1
732 - bne 5b
733 - sub %o0, 128, %o0
734 -3:
735 - andcc %g1, 0x70, %g7
736 - be 72f
737 - andcc %g1, 8, %g0
738 -
739 - sethi %hi(72f), %o5
740 - srl %g7, 1, %o4
741 - add %g7, %o4, %o4
742 - sub %o1, %g7, %o1
743 - sub %o5, %o4, %o5
744 - jmpl %o5 + %lo(72f), %g0
745 - sub %o0, %g7, %o0
746 -
747 -71: /* rmemcpy_table */
748 - RMOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g4, g5)
749 - RMOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g4, g5)
750 - RMOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g4, g5)
751 - RMOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g4, g5)
752 - RMOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g4, g5)
753 - RMOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g4, g5)
754 - RMOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g4, g5)
755 -
756 -72: /* rmemcpy_table_end */
757 -
758 - be 73f
759 - andcc %g1, 4, %g0
760 -
761 - ldd [%o1 - 0x08], %g2
762 - sub %o0, 8, %o0
763 - sub %o1, 8, %o1
764 - st %g2, [%o0]
765 - st %g3, [%o0 + 0x04]
766 -
767 -73: /* rmemcpy_last7 */
768 -
769 - be 1f
770 - andcc %g1, 2, %g0
771 -
772 - ld [%o1 - 4], %g2
773 - sub %o1, 4, %o1
774 - st %g2, [%o0 - 4]
775 - sub %o0, 4, %o0
776 -1:
777 - be 1f
778 - andcc %g1, 1, %g0
779 -
780 - lduh [%o1 - 2], %g2
781 - sub %o1, 2, %o1
782 - sth %g2, [%o0 - 2]
783 - sub %o0, 2, %o0
784 -1:
785 - be 1f
786 - nop
787 -
788 - ldub [%o1 - 1], %g2
789 - stb %g2, [%o0 - 1]
790 -1:
791 - retl
792 - RETL_INSN
793 -
794 -74: /* rldd_std */
795 - RMOVE_BIGALIGNCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5)
796 - RMOVE_BIGALIGNCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5)
797 - RMOVE_BIGALIGNCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5)
798 - RMOVE_BIGALIGNCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5)
799 - subcc %g7, 128, %g7
800 - sub %o1, 128, %o1
801 - bne 74b
802 - sub %o0, 128, %o0
803 -
804 - andcc %g1, 0x70, %g7
805 - be 72b
806 - andcc %g1, 8, %g0
807 -
808 - sethi %hi(72b), %o5
809 - srl %g7, 1, %o4
810 - add %g7, %o4, %o4
811 - sub %o1, %g7, %o1
812 - sub %o5, %o4, %o5
813 - jmpl %o5 + %lo(72b), %g0
814 - sub %o0, %g7, %o0
815 -
816 -75: /* rshort_end */
817 -
818 - and %o2, 0xe, %o3
819 -2:
820 - sethi %hi(76f), %o5
821 - sll %o3, 3, %o4
822 - sub %o0, %o3, %o0
823 - sub %o5, %o4, %o5
824 - sub %o1, %o3, %o1
825 - jmpl %o5 + %lo(76f), %g0
826 - andcc %o2, 1, %g0
827 -
828 - RMOVE_SHORTCHUNK(o1, o0, 0x0c, g2, g3)
829 - RMOVE_SHORTCHUNK(o1, o0, 0x0a, g2, g3)
830 - RMOVE_SHORTCHUNK(o1, o0, 0x08, g2, g3)
831 - RMOVE_SHORTCHUNK(o1, o0, 0x06, g2, g3)
832 - RMOVE_SHORTCHUNK(o1, o0, 0x04, g2, g3)
833 - RMOVE_SHORTCHUNK(o1, o0, 0x02, g2, g3)
834 - RMOVE_SHORTCHUNK(o1, o0, 0x00, g2, g3)
835 -
836 -76: /* rshort_table_end */
837 -
838 - be 1f
839 - nop
840 - ldub [%o1 - 1], %g2
841 - stb %g2, [%o0 - 1]
842 -1:
843 - retl
844 - RETL_INSN
845 -
846 -91: /* rshort_aligned_end */
847 -
848 - bne 75b
849 - andcc %o2, 8, %g0
850 -
851 - be 1f
852 - andcc %o2, 4, %g0
853 -
854 - ld [%o1 - 0x08], %g2
855 - ld [%o1 - 0x04], %g3
856 - sub %o1, 8, %o1
857 - st %g2, [%o0 - 0x08]
858 - st %g3, [%o0 - 0x04]
859 - sub %o0, 8, %o0
860 -1:
861 - b 73b
862 - mov %o2, %g1
863 -
864 -77: /* rnon_aligned */
865 - cmp %o2, 15
866 - bleu 75b
867 - andcc %o0, 3, %g0
868 - be 64f
869 - andcc %o0, 1, %g0
870 - be 63f
871 - andcc %o0, 2, %g0
872 - ldub [%o1 - 1], %g5
873 - sub %o1, 1, %o1
874 - stb %g5, [%o0 - 1]
875 - sub %o0, 1, %o0
876 - be 64f
877 - sub %o2, 1, %o2
878 -63:
879 - ldub [%o1 - 1], %g5
880 - sub %o1, 2, %o1
881 - stb %g5, [%o0 - 1]
882 - sub %o0, 2, %o0
883 - ldub [%o1], %g5
884 - sub %o2, 2, %o2
885 - stb %g5, [%o0]
886 -64:
887 - and %o1, 3, %g2
888 - and %o1, -4, %o1
889 - and %o2, 0xc, %g3
890 - add %o1, 4, %o1
891 - cmp %g3, 4
892 - sll %g2, 3, %g4
893 - mov 32, %g2
894 - be 4f
895 - sub %g2, %g4, %g7
896 -
897 - blu 3f
898 - cmp %g3, 8
899 -
900 - be 2f
901 - srl %o2, 2, %g3
902 -
903 - ld [%o1 - 4], %o3
904 - add %o0, -8, %o0
905 - ld [%o1 - 8], %o4
906 - add %o1, -16, %o1
907 - b 7f
908 - add %g3, 1, %g3
909 -2:
910 - ld [%o1 - 4], %o4
911 - add %o0, -4, %o0
912 - ld [%o1 - 8], %g1
913 - add %o1, -12, %o1
914 - b 8f
915 - add %g3, 2, %g3
916 -3:
917 - ld [%o1 - 4], %o5
918 - add %o0, -12, %o0
919 - ld [%o1 - 8], %o3
920 - add %o1, -20, %o1
921 - b 6f
922 - srl %o2, 2, %g3
923 -4:
924 - ld [%o1 - 4], %g1
925 - srl %o2, 2, %g3
926 - ld [%o1 - 8], %o5
927 - add %o1, -24, %o1
928 - add %o0, -16, %o0
929 - add %g3, -1, %g3
930 -
931 - ld [%o1 + 12], %o3
932 -5:
933 - sll %o5, %g4, %g2
934 - srl %g1, %g7, %g5
935 - or %g2, %g5, %g2
936 - st %g2, [%o0 + 12]
937 -6:
938 - ld [%o1 + 8], %o4
939 - sll %o3, %g4, %g2
940 - srl %o5, %g7, %g5
941 - or %g2, %g5, %g2
942 - st %g2, [%o0 + 8]
943 -7:
944 - ld [%o1 + 4], %g1
945 - sll %o4, %g4, %g2
946 - srl %o3, %g7, %g5
947 - or %g2, %g5, %g2
948 - st %g2, [%o0 + 4]
949 -8:
950 - ld [%o1], %o5
951 - sll %g1, %g4, %g2
952 - srl %o4, %g7, %g5
953 - addcc %g3, -4, %g3
954 - or %g2, %g5, %g2
955 - add %o1, -16, %o1
956 - st %g2, [%o0]
957 - add %o0, -16, %o0
958 - bne,a 5b
959 - ld [%o1 + 12], %o3
960 - sll %o5, %g4, %g2
961 - srl %g1, %g7, %g5
962 - srl %g4, 3, %g3
963 - or %g2, %g5, %g2
964 - add %o1, %g3, %o1
965 - andcc %o2, 2, %g0
966 - st %g2, [%o0 + 12]
967 - be 1f
968 - andcc %o2, 1, %g0
969 -
970 - ldub [%o1 + 15], %g5
971 - add %o1, -2, %o1
972 - stb %g5, [%o0 + 11]
973 - add %o0, -2, %o0
974 - ldub [%o1 + 16], %g5
975 - stb %g5, [%o0 + 12]
976 -1:
977 - be 1f
978 - nop
979 - ldub [%o1 + 15], %g5
980 - stb %g5, [%o0 + 11]
981 -1:
982 - retl
983 - RETL_INSN
984 -
985 -#endif /* FASTER_REVERSE */
986 + mov %g7, %o0
987
988 /* NOTE: This code is executed just for the cases,
989 where %src (=%o1) & 3 is != 0.
990 @@ -546,7 +204,7 @@ FUNC(memmove)
991 FUNC(memcpy) /* %o0=dst %o1=src %o2=len */
992
993 sub %o0, %o1, %o4
994 - SETUP_RETL
995 + mov %o0, %g7
996 9:
997 andcc %o4, 3, %o5
998 0:
999 @@ -569,7 +227,7 @@ FUNC(memcpy) /* %o0=dst %o1=src %o2=len */
1000 add %o1, 4, %o1
1001 add %o0, 4, %o0
1002 2:
1003 - andcc %g1, 0xffffff80, %g7
1004 + andcc %g1, 0xffffff80, %g0
1005 be 3f
1006 andcc %o0, 4, %g0
1007
1008 @@ -579,22 +237,23 @@ FUNC(memcpy) /* %o0=dst %o1=src %o2=len */
1009 MOVE_BIGCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5)
1010 MOVE_BIGCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5)
1011 MOVE_BIGCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5)
1012 - subcc %g7, 128, %g7
1013 + sub %g1, 128, %g1
1014 add %o1, 128, %o1
1015 - bne 5b
1016 + cmp %g1, 128
1017 + bge 5b
1018 add %o0, 128, %o0
1019 3:
1020 - andcc %g1, 0x70, %g7
1021 + andcc %g1, 0x70, %g4
1022 be 80f
1023 andcc %g1, 8, %g0
1024
1025 sethi %hi(80f), %o5
1026 - srl %g7, 1, %o4
1027 - add %g7, %o4, %o4
1028 - add %o1, %g7, %o1
1029 + srl %g4, 1, %o4
1030 + add %g4, %o4, %o4
1031 + add %o1, %g4, %o1
1032 sub %o5, %o4, %o5
1033 jmpl %o5 + %lo(80f), %g0
1034 - add %o0, %g7, %o0
1035 + add %o0, %g4, %o0
1036
1037 79: /* memcpy_table */
1038
1039 @@ -641,43 +300,28 @@ FUNC(memcpy) /* %o0=dst %o1=src %o2=len */
1040 stb %g2, [%o0]
1041 1:
1042 retl
1043 - RETL_INSN
1044 + mov %g7, %o0
1045
1046 82: /* ldd_std */
1047 MOVE_BIGALIGNCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5)
1048 MOVE_BIGALIGNCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5)
1049 MOVE_BIGALIGNCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5)
1050 MOVE_BIGALIGNCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5)
1051 - subcc %g7, 128, %g7
1052 + subcc %g1, 128, %g1
1053 add %o1, 128, %o1
1054 - bne 82b
1055 + cmp %g1, 128
1056 + bge 82b
1057 add %o0, 128, %o0
1058
1059 -#ifndef FASTER_ALIGNED
1060 -
1061 - andcc %g1, 0x70, %g7
1062 - be 80b
1063 - andcc %g1, 8, %g0
1064 -
1065 - sethi %hi(80b), %o5
1066 - srl %g7, 1, %o4
1067 - add %g7, %o4, %o4
1068 - add %o1, %g7, %o1
1069 - sub %o5, %o4, %o5
1070 - jmpl %o5 + %lo(80b), %g0
1071 - add %o0, %g7, %o0
1072 -
1073 -#else /* FASTER_ALIGNED */
1074 -
1075 - andcc %g1, 0x70, %g7
1076 + andcc %g1, 0x70, %g4
1077 be 84f
1078 andcc %g1, 8, %g0
1079
1080 sethi %hi(84f), %o5
1081 - add %o1, %g7, %o1
1082 - sub %o5, %g7, %o5
1083 + add %o1, %g4, %o1
1084 + sub %o5, %g4, %o5
1085 jmpl %o5 + %lo(84f), %g0
1086 - add %o0, %g7, %o0
1087 + add %o0, %g4, %o0
1088
1089 83: /* amemcpy_table */
1090
1091 @@ -721,382 +365,132 @@ FUNC(memcpy) /* %o0=dst %o1=src %o2=len */
1092 stb %g2, [%o0]
1093 1:
1094 retl
1095 - RETL_INSN
1096 -
1097 -#endif /* FASTER_ALIGNED */
1098 + mov %g7, %o0
1099
1100 86: /* non_aligned */
1101 cmp %o2, 6
1102 bleu 88f
1103 + nop
1104
1105 -#ifdef FASTER_NONALIGNED
1106 -
1107 - cmp %o2, 256
1108 - bcc 87f
1109 -
1110 -#endif /* FASTER_NONALIGNED */
1111 -
1112 - andcc %o0, 3, %g0
1113 + save %sp, -96, %sp
1114 + andcc %i0, 3, %g0
1115 be 61f
1116 - andcc %o0, 1, %g0
1117 + andcc %i0, 1, %g0
1118 be 60f
1119 - andcc %o0, 2, %g0
1120 + andcc %i0, 2, %g0
1121
1122 - ldub [%o1], %g5
1123 - add %o1, 1, %o1
1124 - stb %g5, [%o0]
1125 - sub %o2, 1, %o2
1126 + ldub [%i1], %g5
1127 + add %i1, 1, %i1
1128 + stb %g5, [%i0]
1129 + sub %i2, 1, %i2
1130 bne 61f
1131 - add %o0, 1, %o0
1132 + add %i0, 1, %i0
1133 60:
1134 - ldub [%o1], %g3
1135 - add %o1, 2, %o1
1136 - stb %g3, [%o0]
1137 - sub %o2, 2, %o2
1138 - ldub [%o1 - 1], %g3
1139 - add %o0, 2, %o0
1140 - stb %g3, [%o0 - 1]
1141 + ldub [%i1], %g3
1142 + add %i1, 2, %i1
1143 + stb %g3, [%i0]
1144 + sub %i2, 2, %i2
1145 + ldub [%i1 - 1], %g3
1146 + add %i0, 2, %i0
1147 + stb %g3, [%i0 - 1]
1148 61:
1149 - and %o1, 3, %g2
1150 - and %o2, 0xc, %g3
1151 - and %o1, -4, %o1
1152 + and %i1, 3, %g2
1153 + and %i2, 0xc, %g3
1154 + and %i1, -4, %i1
1155 cmp %g3, 4
1156 sll %g2, 3, %g4
1157 mov 32, %g2
1158 be 4f
1159 - sub %g2, %g4, %g7
1160 + sub %g2, %g4, %l0
1161
1162 blu 3f
1163 cmp %g3, 0x8
1164
1165 be 2f
1166 - srl %o2, 2, %g3
1167 + srl %i2, 2, %g3
1168
1169 - ld [%o1], %o3
1170 - add %o0, -8, %o0
1171 - ld [%o1 + 4], %o4
1172 + ld [%i1], %i3
1173 + add %i0, -8, %i0
1174 + ld [%i1 + 4], %i4
1175 b 8f
1176 add %g3, 1, %g3
1177 2:
1178 - ld [%o1], %o4
1179 - add %o0, -12, %o0
1180 - ld [%o1 + 4], %o5
1181 + ld [%i1], %i4
1182 + add %i0, -12, %i0
1183 + ld [%i1 + 4], %i5
1184 add %g3, 2, %g3
1185 b 9f
1186 - add %o1, -4, %o1
1187 + add %i1, -4, %i1
1188 3:
1189 - ld [%o1], %g1
1190 - add %o0, -4, %o0
1191 - ld [%o1 + 4], %o3
1192 - srl %o2, 2, %g3
1193 + ld [%i1], %g1
1194 + add %i0, -4, %i0
1195 + ld [%i1 + 4], %i3
1196 + srl %i2, 2, %g3
1197 b 7f
1198 - add %o1, 4, %o1
1199 + add %i1, 4, %i1
1200 4:
1201 - ld [%o1], %o5
1202 - cmp %o2, 7
1203 - ld [%o1 + 4], %g1
1204 - srl %o2, 2, %g3
1205 + ld [%i1], %i5
1206 + cmp %i2, 7
1207 + ld [%i1 + 4], %g1
1208 + srl %i2, 2, %g3
1209 bleu 10f
1210 - add %o1, 8, %o1
1211 + add %i1, 8, %i1
1212
1213 - ld [%o1], %o3
1214 + ld [%i1], %i3
1215 add %g3, -1, %g3
1216 5:
1217 - sll %o5, %g4, %g2
1218 - srl %g1, %g7, %g5
1219 + sll %i5, %g4, %g2
1220 + srl %g1, %l0, %g5
1221 or %g2, %g5, %g2
1222 - st %g2, [%o0]
1223 + st %g2, [%i0]
1224 7:
1225 - ld [%o1 + 4], %o4
1226 + ld [%i1 + 4], %i4
1227 sll %g1, %g4, %g2
1228 - srl %o3, %g7, %g5
1229 + srl %i3, %l0, %g5
1230 or %g2, %g5, %g2
1231 - st %g2, [%o0 + 4]
1232 + st %g2, [%i0 + 4]
1233 8:
1234 - ld [%o1 + 8], %o5
1235 - sll %o3, %g4, %g2
1236 - srl %o4, %g7, %g5
1237 + ld [%i1 + 8], %i5
1238 + sll %i3, %g4, %g2
1239 + srl %i4, %l0, %g5
1240 or %g2, %g5, %g2
1241 - st %g2, [%o0 + 8]
1242 + st %g2, [%i0 + 8]
1243 9:
1244 - ld [%o1 + 12], %g1
1245 - sll %o4, %g4, %g2
1246 - srl %o5, %g7, %g5
1247 + ld [%i1 + 12], %g1
1248 + sll %i4, %g4, %g2
1249 + srl %i5, %l0, %g5
1250 addcc %g3, -4, %g3
1251 or %g2, %g5, %g2
1252 - add %o1, 16, %o1
1253 - st %g2, [%o0 + 12]
1254 - add %o0, 16, %o0
1255 + add %i1, 16, %i1
1256 + st %g2, [%i0 + 12]
1257 + add %i0, 16, %i0
1258 bne,a 5b
1259 - ld [%o1], %o3
1260 + ld [%i1], %i3
1261 10:
1262 - sll %o5, %g4, %g2
1263 - srl %g1, %g7, %g5
1264 - srl %g7, 3, %g3
1265 + sll %i5, %g4, %g2
1266 + srl %g1, %l0, %g5
1267 + srl %l0, 3, %g3
1268 or %g2, %g5, %g2
1269 - sub %o1, %g3, %o1
1270 - andcc %o2, 2, %g0
1271 - st %g2, [%o0]
1272 + sub %i1, %g3, %i1
1273 + andcc %i2, 2, %g0
1274 + st %g2, [%i0]
1275 be 1f
1276 - andcc %o2, 1, %g0
1277 -
1278 - ldub [%o1], %g2
1279 - add %o1, 2, %o1
1280 - stb %g2, [%o0 + 4]
1281 - add %o0, 2, %o0
1282 - ldub [%o1 - 1], %g2
1283 - stb %g2, [%o0 + 3]
1284 + andcc %i2, 1, %g0
1285 +
1286 + ldub [%i1], %g2
1287 + add %i1, 2, %i1
1288 + stb %g2, [%i0 + 4]
1289 + add %i0, 2, %i0
1290 + ldub [%i1 - 1], %g2
1291 + stb %g2, [%i0 + 3]
1292 1:
1293 be 1f
1294 nop
1295 - ldub [%o1], %g2
1296 - stb %g2, [%o0 + 4]
1297 -1:
1298 - retl
1299 - RETL_INSN
1300 -
1301 -#ifdef FASTER_NONALIGNED
1302 -
1303 -87: /* faster_nonaligned */
1304 -
1305 - andcc %o1, 3, %g0
1306 - be 3f
1307 - andcc %o1, 1, %g0
1308 -
1309 - be 4f
1310 - andcc %o1, 2, %g0
1311 -
1312 - ldub [%o1], %g2
1313 - add %o1, 1, %o1
1314 - stb %g2, [%o0]
1315 - sub %o2, 1, %o2
1316 - bne 3f
1317 - add %o0, 1, %o0
1318 -4:
1319 - lduh [%o1], %g2
1320 - add %o1, 2, %o1
1321 - srl %g2, 8, %g3
1322 - sub %o2, 2, %o2
1323 - stb %g3, [%o0]
1324 - add %o0, 2, %o0
1325 - stb %g2, [%o0 - 1]
1326 -3:
1327 - andcc %o1, 4, %g0
1328 -
1329 - bne 2f
1330 - cmp %o5, 1
1331 -
1332 - ld [%o1], %o4
1333 - srl %o4, 24, %g2
1334 - stb %g2, [%o0]
1335 - srl %o4, 16, %g3
1336 - stb %g3, [%o0 + 1]
1337 - srl %o4, 8, %g2
1338 - stb %g2, [%o0 + 2]
1339 - sub %o2, 4, %o2
1340 - stb %o4, [%o0 + 3]
1341 - add %o1, 4, %o1
1342 - add %o0, 4, %o0
1343 -2:
1344 - be 33f
1345 - cmp %o5, 2
1346 - be 32f
1347 - sub %o2, 4, %o2
1348 -31:
1349 - ld [%o1], %g2
1350 - add %o1, 4, %o1
1351 - srl %g2, 24, %g3
1352 - and %o0, 7, %g5
1353 - stb %g3, [%o0]
1354 - cmp %g5, 7
1355 - sll %g2, 8, %g1
1356 - add %o0, 4, %o0
1357 - be 41f
1358 - and %o2, 0xffffffc0, %o3
1359 - ld [%o0 - 7], %o4
1360 -4:
1361 - SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3)
1362 - SMOVE_CHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3)
1363 - SMOVE_CHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3)
1364 - SMOVE_CHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3)
1365 - subcc %o3, 64, %o3
1366 - add %o1, 64, %o1
1367 - bne 4b
1368 - add %o0, 64, %o0
1369 -
1370 - andcc %o2, 0x30, %o3
1371 - be,a 1f
1372 - srl %g1, 16, %g2
1373 -4:
1374 - SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3)
1375 - subcc %o3, 16, %o3
1376 - add %o1, 16, %o1
1377 - bne 4b
1378 - add %o0, 16, %o0
1379 -
1380 - srl %g1, 16, %g2
1381 -1:
1382 - st %o4, [%o0 - 7]
1383 - sth %g2, [%o0 - 3]
1384 - srl %g1, 8, %g4
1385 - b 88f
1386 - stb %g4, [%o0 - 1]
1387 -32:
1388 - ld [%o1], %g2
1389 - add %o1, 4, %o1
1390 - srl %g2, 16, %g3
1391 - and %o0, 7, %g5
1392 - sth %g3, [%o0]
1393 - cmp %g5, 6
1394 - sll %g2, 16, %g1
1395 - add %o0, 4, %o0
1396 - be 42f
1397 - and %o2, 0xffffffc0, %o3
1398 - ld [%o0 - 6], %o4
1399 -4:
1400 - SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2)
1401 - SMOVE_CHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2)
1402 - SMOVE_CHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2)
1403 - SMOVE_CHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2)
1404 - subcc %o3, 64, %o3
1405 - add %o1, 64, %o1
1406 - bne 4b
1407 - add %o0, 64, %o0
1408 -
1409 - andcc %o2, 0x30, %o3
1410 - be,a 1f
1411 - srl %g1, 16, %g2
1412 -4:
1413 - SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2)
1414 - subcc %o3, 16, %o3
1415 - add %o1, 16, %o1
1416 - bne 4b
1417 - add %o0, 16, %o0
1418 -
1419 - srl %g1, 16, %g2
1420 -1:
1421 - st %o4, [%o0 - 6]
1422 - b 88f
1423 - sth %g2, [%o0 - 2]
1424 -33:
1425 - ld [%o1], %g2
1426 - sub %o2, 4, %o2
1427 - srl %g2, 24, %g3
1428 - and %o0, 7, %g5
1429 - stb %g3, [%o0]
1430 - cmp %g5, 5
1431 - srl %g2, 8, %g4
1432 - sll %g2, 24, %g1
1433 - sth %g4, [%o0 + 1]
1434 - add %o1, 4, %o1
1435 - be 43f
1436 - and %o2, 0xffffffc0, %o3
1437 -
1438 - ld [%o0 - 1], %o4
1439 - add %o0, 4, %o0
1440 -4:
1441 - SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, -1)
1442 - SMOVE_CHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, -1)
1443 - SMOVE_CHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, -1)
1444 - SMOVE_CHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, -1)
1445 - subcc %o3, 64, %o3
1446 - add %o1, 64, %o1
1447 - bne 4b
1448 - add %o0, 64, %o0
1449 -
1450 - andcc %o2, 0x30, %o3
1451 - be,a 1f
1452 - srl %g1, 24, %g2
1453 -4:
1454 - SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, -1)
1455 - subcc %o3, 16, %o3
1456 - add %o1, 16, %o1
1457 - bne 4b
1458 - add %o0, 16, %o0
1459 -
1460 - srl %g1, 24, %g2
1461 -1:
1462 - st %o4, [%o0 - 5]
1463 - b 88f
1464 - stb %g2, [%o0 - 1]
1465 -41:
1466 - SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3)
1467 - SMOVE_ALIGNCHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3)
1468 - SMOVE_ALIGNCHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3)
1469 - SMOVE_ALIGNCHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3)
1470 - subcc %o3, 64, %o3
1471 - add %o1, 64, %o1
1472 - bne 41b
1473 - add %o0, 64, %o0
1474 -
1475 - andcc %o2, 0x30, %o3
1476 - be,a 1f
1477 - srl %g1, 16, %g2
1478 -4:
1479 - SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3)
1480 - subcc %o3, 16, %o3
1481 - add %o1, 16, %o1
1482 - bne 4b
1483 - add %o0, 16, %o0
1484 -
1485 - srl %g1, 16, %g2
1486 + ldub [%i1], %g2
1487 + stb %g2, [%i0 + 4]
1488 1:
1489 - sth %g2, [%o0 - 3]
1490 - srl %g1, 8, %g4
1491 - b 88f
1492 - stb %g4, [%o0 - 1]
1493 -43:
1494 - SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, 3)
1495 - SMOVE_ALIGNCHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, 3)
1496 - SMOVE_ALIGNCHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, 3)
1497 - SMOVE_ALIGNCHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, 3)
1498 - subcc %o3, 64, %o3
1499 - add %o1, 64, %o1
1500 - bne 43b
1501 - add %o0, 64, %o0
1502 -
1503 - andcc %o2, 0x30, %o3
1504 - be,a 1f
1505 - srl %g1, 24, %g2
1506 -4:
1507 - SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, 3)
1508 - subcc %o3, 16, %o3
1509 - add %o1, 16, %o1
1510 - bne 4b
1511 - add %o0, 16, %o0
1512 -
1513 - srl %g1, 24, %g2
1514 -1:
1515 - stb %g2, [%o0 + 3]
1516 - b 88f
1517 - add %o0, 4, %o0
1518 -42:
1519 - SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2)
1520 - SMOVE_ALIGNCHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2)
1521 - SMOVE_ALIGNCHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2)
1522 - SMOVE_ALIGNCHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2)
1523 - subcc %o3, 64, %o3
1524 - add %o1, 64, %o1
1525 - bne 42b
1526 - add %o0, 64, %o0
1527 -
1528 - andcc %o2, 0x30, %o3
1529 - be,a 1f
1530 - srl %g1, 16, %g2
1531 -4:
1532 - SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2)
1533 - subcc %o3, 16, %o3
1534 - add %o1, 16, %o1
1535 - bne 4b
1536 - add %o0, 16, %o0
1537 -
1538 - srl %g1, 16, %g2
1539 -1:
1540 - sth %g2, [%o0 - 2]
1541 -
1542 - /* Fall through */
1543 -
1544 -#endif /* FASTER_NONALIGNED */
1545 + ret
1546 + restore %g7, %g0, %o0
1547
1548 88: /* short_end */
1549
1550 @@ -1127,7 +521,7 @@ FUNC(memcpy) /* %o0=dst %o1=src %o2=len */
1551 stb %g2, [%o0]
1552 1:
1553 retl
1554 - RETL_INSN
1555 + mov %g7, %o0
1556
1557 90: /* short_aligned_end */
1558 bne 88b
1559 diff --git a/arch/sparc/mm/Makefile b/arch/sparc/mm/Makefile
1560 index 79836a7..3b6e248 100644
1561 --- a/arch/sparc/mm/Makefile
1562 +++ b/arch/sparc/mm/Makefile
1563 @@ -8,7 +8,6 @@ obj-$(CONFIG_SPARC64) += ultra.o tlb.o tsb.o
1564 obj-y += fault_$(BITS).o
1565 obj-y += init_$(BITS).o
1566 obj-$(CONFIG_SPARC32) += loadmmu.o
1567 -obj-y += generic_$(BITS).o
1568 obj-$(CONFIG_SPARC32) += extable.o btfixup.o srmmu.o iommu.o io-unit.o
1569 obj-$(CONFIG_SPARC32) += hypersparc.o viking.o tsunami.o swift.o
1570 obj-$(CONFIG_SPARC_LEON)+= leon_mm.o
1571 diff --git a/arch/sparc/mm/btfixup.c b/arch/sparc/mm/btfixup.c
1572 index 5175ac2..8a7f817 100644
1573 --- a/arch/sparc/mm/btfixup.c
1574 +++ b/arch/sparc/mm/btfixup.c
1575 @@ -302,8 +302,7 @@ void __init btfixup(void)
1576 case 'i': /* INT */
1577 if ((insn & 0xc1c00000) == 0x01000000) /* %HI */
1578 set_addr(addr, q[1], fmangled, (insn & 0xffc00000) | (p[1] >> 10));
1579 - else if ((insn & 0x80002000) == 0x80002000 &&
1580 - (insn & 0x01800000) != 0x01800000) /* %LO */
1581 + else if ((insn & 0x80002000) == 0x80002000) /* %LO */
1582 set_addr(addr, q[1], fmangled, (insn & 0xffffe000) | (p[1] & 0x3ff));
1583 else {
1584 prom_printf(insn_i, p, addr, insn);
1585 diff --git a/arch/sparc/mm/generic_32.c b/arch/sparc/mm/generic_32.c
1586 deleted file mode 100644
1587 index e6067b7..0000000
1588 --- a/arch/sparc/mm/generic_32.c
1589 +++ /dev/null
1590 @@ -1,98 +0,0 @@
1591 -/*
1592 - * generic.c: Generic Sparc mm routines that are not dependent upon
1593 - * MMU type but are Sparc specific.
1594 - *
1595 - * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
1596 - */
1597 -
1598 -#include <linux/kernel.h>
1599 -#include <linux/mm.h>
1600 -#include <linux/swap.h>
1601 -#include <linux/pagemap.h>
1602 -
1603 -#include <asm/pgalloc.h>
1604 -#include <asm/pgtable.h>
1605 -#include <asm/page.h>
1606 -#include <asm/cacheflush.h>
1607 -#include <asm/tlbflush.h>
1608 -
1609 -/* Remap IO memory, the same way as remap_pfn_range(), but use
1610 - * the obio memory space.
1611 - *
1612 - * They use a pgprot that sets PAGE_IO and does not check the
1613 - * mem_map table as this is independent of normal memory.
1614 - */
1615 -static inline void io_remap_pte_range(struct mm_struct *mm, pte_t * pte, unsigned long address, unsigned long size,
1616 - unsigned long offset, pgprot_t prot, int space)
1617 -{
1618 - unsigned long end;
1619 -
1620 - address &= ~PMD_MASK;
1621 - end = address + size;
1622 - if (end > PMD_SIZE)
1623 - end = PMD_SIZE;
1624 - do {
1625 - set_pte_at(mm, address, pte, mk_pte_io(offset, prot, space));
1626 - address += PAGE_SIZE;
1627 - offset += PAGE_SIZE;
1628 - pte++;
1629 - } while (address < end);
1630 -}
1631 -
1632 -static inline int io_remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address, unsigned long size,
1633 - unsigned long offset, pgprot_t prot, int space)
1634 -{
1635 - unsigned long end;
1636 -
1637 - address &= ~PGDIR_MASK;
1638 - end = address + size;
1639 - if (end > PGDIR_SIZE)
1640 - end = PGDIR_SIZE;
1641 - offset -= address;
1642 - do {
1643 - pte_t *pte = pte_alloc_map(mm, NULL, pmd, address);
1644 - if (!pte)
1645 - return -ENOMEM;
1646 - io_remap_pte_range(mm, pte, address, end - address, address + offset, prot, space);
1647 - address = (address + PMD_SIZE) & PMD_MASK;
1648 - pmd++;
1649 - } while (address < end);
1650 - return 0;
1651 -}
1652 -
1653 -int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
1654 - unsigned long pfn, unsigned long size, pgprot_t prot)
1655 -{
1656 - int error = 0;
1657 - pgd_t * dir;
1658 - unsigned long beg = from;
1659 - unsigned long end = from + size;
1660 - struct mm_struct *mm = vma->vm_mm;
1661 - int space = GET_IOSPACE(pfn);
1662 - unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT;
1663 -
1664 - /* See comment in mm/memory.c remap_pfn_range */
1665 - vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
1666 - vma->vm_pgoff = (offset >> PAGE_SHIFT) |
1667 - ((unsigned long)space << 28UL);
1668 -
1669 - offset -= from;
1670 - dir = pgd_offset(mm, from);
1671 - flush_cache_range(vma, beg, end);
1672 -
1673 - while (from < end) {
1674 - pmd_t *pmd = pmd_alloc(mm, dir, from);
1675 - error = -ENOMEM;
1676 - if (!pmd)
1677 - break;
1678 - error = io_remap_pmd_range(mm, pmd, from, end - from, offset + from, prot, space);
1679 - if (error)
1680 - break;
1681 - from = (from + PGDIR_SIZE) & PGDIR_MASK;
1682 - dir++;
1683 - }
1684 -
1685 - flush_tlb_range(vma, beg, end);
1686 - return error;
1687 -}
1688 -EXPORT_SYMBOL(io_remap_pfn_range);
1689 diff --git a/arch/sparc/mm/generic_64.c b/arch/sparc/mm/generic_64.c
1690 deleted file mode 100644
1691 index 3cb00df..0000000
1692 --- a/arch/sparc/mm/generic_64.c
1693 +++ /dev/null
1694 @@ -1,164 +0,0 @@
1695 -/*
1696 - * generic.c: Generic Sparc mm routines that are not dependent upon
1697 - * MMU type but are Sparc specific.
1698 - *
1699 - * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
1700 - */
1701 -
1702 -#include <linux/kernel.h>
1703 -#include <linux/mm.h>
1704 -#include <linux/swap.h>
1705 -#include <linux/pagemap.h>
1706 -
1707 -#include <asm/pgalloc.h>
1708 -#include <asm/pgtable.h>
1709 -#include <asm/page.h>
1710 -#include <asm/tlbflush.h>
1711 -
1712 -/* Remap IO memory, the same way as remap_pfn_range(), but use
1713 - * the obio memory space.
1714 - *
1715 - * They use a pgprot that sets PAGE_IO and does not check the
1716 - * mem_map table as this is independent of normal memory.
1717 - */
1718 -static inline void io_remap_pte_range(struct mm_struct *mm, pte_t * pte,
1719 - unsigned long address,
1720 - unsigned long size,
1721 - unsigned long offset, pgprot_t prot,
1722 - int space)
1723 -{
1724 - unsigned long end;
1725 -
1726 - /* clear hack bit that was used as a write_combine side-effect flag */
1727 - offset &= ~0x1UL;
1728 - address &= ~PMD_MASK;
1729 - end = address + size;
1730 - if (end > PMD_SIZE)
1731 - end = PMD_SIZE;
1732 - do {
1733 - pte_t entry;
1734 - unsigned long curend = address + PAGE_SIZE;
1735 -
1736 - entry = mk_pte_io(offset, prot, space, PAGE_SIZE);
1737 - if (!(address & 0xffff)) {
1738 - if (PAGE_SIZE < (4 * 1024 * 1024) &&
1739 - !(address & 0x3fffff) &&
1740 - !(offset & 0x3ffffe) &&
1741 - end >= address + 0x400000) {
1742 - entry = mk_pte_io(offset, prot, space,
1743 - 4 * 1024 * 1024);
1744 - curend = address + 0x400000;
1745 - offset += 0x400000;
1746 - } else if (PAGE_SIZE < (512 * 1024) &&
1747 - !(address & 0x7ffff) &&
1748 - !(offset & 0x7fffe) &&
1749 - end >= address + 0x80000) {
1750 - entry = mk_pte_io(offset, prot, space,
1751 - 512 * 1024 * 1024);
1752 - curend = address + 0x80000;
1753 - offset += 0x80000;
1754 - } else if (PAGE_SIZE < (64 * 1024) &&
1755 - !(offset & 0xfffe) &&
1756 - end >= address + 0x10000) {
1757 - entry = mk_pte_io(offset, prot, space,
1758 - 64 * 1024);
1759 - curend = address + 0x10000;
1760 - offset += 0x10000;
1761 - } else
1762 - offset += PAGE_SIZE;
1763 - } else
1764 - offset += PAGE_SIZE;
1765 -
1766 - if (pte_write(entry))
1767 - entry = pte_mkdirty(entry);
1768 - do {
1769 - BUG_ON(!pte_none(*pte));
1770 - set_pte_at(mm, address, pte, entry);
1771 - address += PAGE_SIZE;
1772 - pte_val(entry) += PAGE_SIZE;
1773 - pte++;
1774 - } while (address < curend);
1775 - } while (address < end);
1776 -}
1777 -
1778 -static inline int io_remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address, unsigned long size,
1779 - unsigned long offset, pgprot_t prot, int space)
1780 -{
1781 - unsigned long end;
1782 -
1783 - address &= ~PGDIR_MASK;
1784 - end = address + size;
1785 - if (end > PGDIR_SIZE)
1786 - end = PGDIR_SIZE;
1787 - offset -= address;
1788 - do {
1789 - pte_t *pte = pte_alloc_map(mm, NULL, pmd, address);
1790 - if (!pte)
1791 - return -ENOMEM;
1792 - io_remap_pte_range(mm, pte, address, end - address, address + offset, prot, space);
1793 - pte_unmap(pte);
1794 - address = (address + PMD_SIZE) & PMD_MASK;
1795 - pmd++;
1796 - } while (address < end);
1797 - return 0;
1798 -}
1799 -
1800 -static inline int io_remap_pud_range(struct mm_struct *mm, pud_t * pud, unsigned long address, unsigned long size,
1801 - unsigned long offset, pgprot_t prot, int space)
1802 -{
1803 - unsigned long end;
1804 -
1805 - address &= ~PUD_MASK;
1806 - end = address + size;
1807 - if (end > PUD_SIZE)
1808 - end = PUD_SIZE;
1809 - offset -= address;
1810 - do {
1811 - pmd_t *pmd = pmd_alloc(mm, pud, address);
1812 - if (!pud)
1813 - return -ENOMEM;
1814 - io_remap_pmd_range(mm, pmd, address, end - address, address + offset, prot, space);
1815 - address = (address + PUD_SIZE) & PUD_MASK;
1816 - pud++;
1817 - } while (address < end);
1818 - return 0;
1819 -}
1820 -
1821 -int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
1822 - unsigned long pfn, unsigned long size, pgprot_t prot)
1823 -{
1824 - int error = 0;
1825 - pgd_t * dir;
1826 - unsigned long beg = from;
1827 - unsigned long end = from + size;
1828 - struct mm_struct *mm = vma->vm_mm;
1829 - int space = GET_IOSPACE(pfn);
1830 - unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT;
1831 - unsigned long phys_base;
1832 -
1833 - phys_base = offset | (((unsigned long) space) << 32UL);
1834 -
1835 - /* See comment in mm/memory.c remap_pfn_range */
1836 - vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
1837 - vma->vm_pgoff = phys_base >> PAGE_SHIFT;
1838 -
1839 - offset -= from;
1840 - dir = pgd_offset(mm, from);
1841 - flush_cache_range(vma, beg, end);
1842 -
1843 - while (from < end) {
1844 - pud_t *pud = pud_alloc(mm, dir, from);
1845 - error = -ENOMEM;
1846 - if (!pud)
1847 - break;
1848 - error = io_remap_pud_range(mm, pud, from, end - from, offset + from, prot, space);
1849 - if (error)
1850 - break;
1851 - from = (from + PGDIR_SIZE) & PGDIR_MASK;
1852 - dir++;
1853 - }
1854 -
1855 - flush_tlb_range(vma, beg, end);
1856 - return error;
1857 -}
1858 -EXPORT_SYMBOL(io_remap_pfn_range);
1859 diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
1860 index bfab3fa..7b65f75 100644
1861 --- a/arch/x86/net/bpf_jit_comp.c
1862 +++ b/arch/x86/net/bpf_jit_comp.c
1863 @@ -568,8 +568,8 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
1864 break;
1865 }
1866 if (filter[i].jt != 0) {
1867 - if (filter[i].jf)
1868 - t_offset += is_near(f_offset) ? 2 : 6;
1869 + if (filter[i].jf && f_offset)
1870 + t_offset += is_near(f_offset) ? 2 : 5;
1871 EMIT_COND_JMP(t_op, t_offset);
1872 if (filter[i].jf)
1873 EMIT_JMP(f_offset);
1874 diff --git a/block/blk-core.c b/block/blk-core.c
1875 index 847d04e..35ae52d 100644
1876 --- a/block/blk-core.c
1877 +++ b/block/blk-core.c
1878 @@ -418,6 +418,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
1879 q->backing_dev_info.state = 0;
1880 q->backing_dev_info.capabilities = BDI_CAP_MAP_COPY;
1881 q->backing_dev_info.name = "block";
1882 + q->node = node_id;
1883
1884 err = bdi_init(&q->backing_dev_info);
1885 if (err) {
1886 @@ -502,7 +503,7 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
1887 if (!uninit_q)
1888 return NULL;
1889
1890 - q = blk_init_allocated_queue_node(uninit_q, rfn, lock, node_id);
1891 + q = blk_init_allocated_queue(uninit_q, rfn, lock);
1892 if (!q)
1893 blk_cleanup_queue(uninit_q);
1894
1895 @@ -514,18 +515,9 @@ struct request_queue *
1896 blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn,
1897 spinlock_t *lock)
1898 {
1899 - return blk_init_allocated_queue_node(q, rfn, lock, -1);
1900 -}
1901 -EXPORT_SYMBOL(blk_init_allocated_queue);
1902 -
1903 -struct request_queue *
1904 -blk_init_allocated_queue_node(struct request_queue *q, request_fn_proc *rfn,
1905 - spinlock_t *lock, int node_id)
1906 -{
1907 if (!q)
1908 return NULL;
1909
1910 - q->node = node_id;
1911 if (blk_init_free_list(q))
1912 return NULL;
1913
1914 @@ -555,7 +547,7 @@ blk_init_allocated_queue_node(struct request_queue *q, request_fn_proc *rfn,
1915
1916 return NULL;
1917 }
1918 -EXPORT_SYMBOL(blk_init_allocated_queue_node);
1919 +EXPORT_SYMBOL(blk_init_allocated_queue);
1920
1921 int blk_get_queue(struct request_queue *q)
1922 {
1923 diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
1924 index ae21919..23500ac 100644
1925 --- a/block/cfq-iosched.c
1926 +++ b/block/cfq-iosched.c
1927 @@ -3169,7 +3169,7 @@ static int cfq_cic_link(struct cfq_data *cfqd, struct io_context *ioc,
1928 }
1929 }
1930
1931 - if (ret)
1932 + if (ret && ret != -EEXIST)
1933 printk(KERN_ERR "cfq: cic link failed!\n");
1934
1935 return ret;
1936 @@ -3185,6 +3185,7 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
1937 {
1938 struct io_context *ioc = NULL;
1939 struct cfq_io_context *cic;
1940 + int ret;
1941
1942 might_sleep_if(gfp_mask & __GFP_WAIT);
1943
1944 @@ -3192,6 +3193,7 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
1945 if (!ioc)
1946 return NULL;
1947
1948 +retry:
1949 cic = cfq_cic_lookup(cfqd, ioc);
1950 if (cic)
1951 goto out;
1952 @@ -3200,7 +3202,12 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
1953 if (cic == NULL)
1954 goto err;
1955
1956 - if (cfq_cic_link(cfqd, ioc, cic, gfp_mask))
1957 + ret = cfq_cic_link(cfqd, ioc, cic, gfp_mask);
1958 + if (ret == -EEXIST) {
1959 + /* someone has linked cic to ioc already */
1960 + cfq_cic_free(cic);
1961 + goto retry;
1962 + } else if (ret)
1963 goto err_free;
1964
1965 out:
1966 @@ -4015,6 +4022,11 @@ static void *cfq_init_queue(struct request_queue *q)
1967
1968 if (blkio_alloc_blkg_stats(&cfqg->blkg)) {
1969 kfree(cfqg);
1970 +
1971 + spin_lock(&cic_index_lock);
1972 + ida_remove(&cic_index_ida, cfqd->cic_index);
1973 + spin_unlock(&cic_index_lock);
1974 +
1975 kfree(cfqd);
1976 return NULL;
1977 }
1978 diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
1979 index 7eef6e1..ef16443 100644
1980 --- a/drivers/gpu/drm/i915/i915_dma.c
1981 +++ b/drivers/gpu/drm/i915/i915_dma.c
1982 @@ -1451,6 +1451,14 @@ unsigned long i915_chipset_val(struct drm_i915_private *dev_priv)
1983
1984 diff1 = now - dev_priv->last_time1;
1985
1986 + /* Prevent division-by-zero if we are asking too fast.
1987 + * Also, we don't get interesting results if we are polling
1988 + * faster than once in 10ms, so just return the saved value
1989 + * in such cases.
1990 + */
1991 + if (diff1 <= 10)
1992 + return dev_priv->chipset_power;
1993 +
1994 count1 = I915_READ(DMIEC);
1995 count2 = I915_READ(DDREC);
1996 count3 = I915_READ(CSIEC);
1997 @@ -1481,6 +1489,8 @@ unsigned long i915_chipset_val(struct drm_i915_private *dev_priv)
1998 dev_priv->last_count1 = total_count;
1999 dev_priv->last_time1 = now;
2000
2001 + dev_priv->chipset_power = ret;
2002 +
2003 return ret;
2004 }
2005
2006 diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
2007 index e0d0e27..335564e 100644
2008 --- a/drivers/gpu/drm/i915/i915_drv.h
2009 +++ b/drivers/gpu/drm/i915/i915_drv.h
2010 @@ -702,6 +702,7 @@ typedef struct drm_i915_private {
2011
2012 u64 last_count1;
2013 unsigned long last_time1;
2014 + unsigned long chipset_power;
2015 u64 last_count2;
2016 struct timespec last_time2;
2017 unsigned long gfx_power;
2018 diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
2019 index 21c5aa0..fe052c6 100644
2020 --- a/drivers/gpu/drm/radeon/evergreen.c
2021 +++ b/drivers/gpu/drm/radeon/evergreen.c
2022 @@ -3257,6 +3257,18 @@ int evergreen_init(struct radeon_device *rdev)
2023 rdev->accel_working = false;
2024 }
2025 }
2026 +
2027 + /* Don't start up if the MC ucode is missing on BTC parts.
2028 + * The default clocks and voltages before the MC ucode
2029 + * is loaded are not suffient for advanced operations.
2030 + */
2031 + if (ASIC_IS_DCE5(rdev)) {
2032 + if (!rdev->mc_fw && !(rdev->flags & RADEON_IS_IGP)) {
2033 + DRM_ERROR("radeon: MC ucode required for NI+.\n");
2034 + return -EINVAL;
2035 + }
2036 + }
2037 +
2038 return 0;
2039 }
2040
2041 diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
2042 index 285acc4..a098edc 100644
2043 --- a/drivers/gpu/drm/radeon/radeon_atombios.c
2044 +++ b/drivers/gpu/drm/radeon/radeon_atombios.c
2045 @@ -2568,7 +2568,11 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
2046
2047 rdev->pm.current_power_state_index = rdev->pm.default_power_state_index;
2048 rdev->pm.current_clock_mode_index = 0;
2049 - rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage;
2050 + if (rdev->pm.default_power_state_index >= 0)
2051 + rdev->pm.current_vddc =
2052 + rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage;
2053 + else
2054 + rdev->pm.current_vddc = 0;
2055 }
2056
2057 void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable)
2058 diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
2059 index e06e045..6ad728f 100644
2060 --- a/drivers/input/mouse/synaptics.c
2061 +++ b/drivers/input/mouse/synaptics.c
2062 @@ -24,6 +24,7 @@
2063 */
2064
2065 #include <linux/module.h>
2066 +#include <linux/delay.h>
2067 #include <linux/dmi.h>
2068 #include <linux/input/mt.h>
2069 #include <linux/serio.h>
2070 @@ -760,6 +761,16 @@ static int synaptics_reconnect(struct psmouse *psmouse)
2071
2072 do {
2073 psmouse_reset(psmouse);
2074 + if (retry) {
2075 + /*
2076 + * On some boxes, right after resuming, the touchpad
2077 + * needs some time to finish initializing (I assume
2078 + * it needs time to calibrate) and start responding
2079 + * to Synaptics-specific queries, so let's wait a
2080 + * bit.
2081 + */
2082 + ssleep(1);
2083 + }
2084 error = synaptics_detect(psmouse, 0);
2085 } while (error && ++retry < 3);
2086
2087 diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c
2088 index bdf19ad..e9babcb 100644
2089 --- a/drivers/media/video/s5p-fimc/fimc-core.c
2090 +++ b/drivers/media/video/s5p-fimc/fimc-core.c
2091 @@ -36,7 +36,7 @@ static char *fimc_clocks[MAX_FIMC_CLOCKS] = {
2092 static struct fimc_fmt fimc_formats[] = {
2093 {
2094 .name = "RGB565",
2095 - .fourcc = V4L2_PIX_FMT_RGB565X,
2096 + .fourcc = V4L2_PIX_FMT_RGB565,
2097 .depth = { 16 },
2098 .color = S5P_FIMC_RGB565,
2099 .memplanes = 1,
2100 diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
2101 index b8f2a4e..f82413a 100644
2102 --- a/drivers/mfd/twl-core.c
2103 +++ b/drivers/mfd/twl-core.c
2104 @@ -362,13 +362,13 @@ int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
2105 pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no);
2106 return -EPERM;
2107 }
2108 - sid = twl_map[mod_no].sid;
2109 - twl = &twl_modules[sid];
2110 -
2111 if (unlikely(!inuse)) {
2112 - pr_err("%s: client %d is not initialized\n", DRIVER_NAME, sid);
2113 + pr_err("%s: not initialized\n", DRIVER_NAME);
2114 return -EPERM;
2115 }
2116 + sid = twl_map[mod_no].sid;
2117 + twl = &twl_modules[sid];
2118 +
2119 mutex_lock(&twl->xfer_lock);
2120 /*
2121 * [MSG1]: fill the register address data
2122 @@ -419,13 +419,13 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
2123 pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no);
2124 return -EPERM;
2125 }
2126 - sid = twl_map[mod_no].sid;
2127 - twl = &twl_modules[sid];
2128 -
2129 if (unlikely(!inuse)) {
2130 - pr_err("%s: client %d is not initialized\n", DRIVER_NAME, sid);
2131 + pr_err("%s: not initialized\n", DRIVER_NAME);
2132 return -EPERM;
2133 }
2134 + sid = twl_map[mod_no].sid;
2135 + twl = &twl_modules[sid];
2136 +
2137 mutex_lock(&twl->xfer_lock);
2138 /* [MSG1] fill the register address data */
2139 msg = &twl->xfer_msg[0];
2140 diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
2141 index 3941ddc..834f824 100644
2142 --- a/drivers/mfd/twl4030-madc.c
2143 +++ b/drivers/mfd/twl4030-madc.c
2144 @@ -510,8 +510,9 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
2145 u8 ch_msb, ch_lsb;
2146 int ret;
2147
2148 - if (!req)
2149 + if (!req || !twl4030_madc)
2150 return -EINVAL;
2151 +
2152 mutex_lock(&twl4030_madc->lock);
2153 if (req->method < TWL4030_MADC_RT || req->method > TWL4030_MADC_SW2) {
2154 ret = -EINVAL;
2155 @@ -530,13 +531,13 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
2156 if (ret) {
2157 dev_err(twl4030_madc->dev,
2158 "unable to write sel register 0x%X\n", method->sel + 1);
2159 - return ret;
2160 + goto out;
2161 }
2162 ret = twl_i2c_write_u8(TWL4030_MODULE_MADC, ch_lsb, method->sel);
2163 if (ret) {
2164 dev_err(twl4030_madc->dev,
2165 "unable to write sel register 0x%X\n", method->sel + 1);
2166 - return ret;
2167 + goto out;
2168 }
2169 /* Select averaging for all channels if do_avg is set */
2170 if (req->do_avg) {
2171 @@ -546,7 +547,7 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
2172 dev_err(twl4030_madc->dev,
2173 "unable to write avg register 0x%X\n",
2174 method->avg + 1);
2175 - return ret;
2176 + goto out;
2177 }
2178 ret = twl_i2c_write_u8(TWL4030_MODULE_MADC,
2179 ch_lsb, method->avg);
2180 @@ -554,7 +555,7 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
2181 dev_err(twl4030_madc->dev,
2182 "unable to write sel reg 0x%X\n",
2183 method->sel + 1);
2184 - return ret;
2185 + goto out;
2186 }
2187 }
2188 if (req->type == TWL4030_MADC_IRQ_ONESHOT && req->func_cb != NULL) {
2189 @@ -706,6 +707,8 @@ static int __devinit twl4030_madc_probe(struct platform_device *pdev)
2190 if (!madc)
2191 return -ENOMEM;
2192
2193 + madc->dev = &pdev->dev;
2194 +
2195 /*
2196 * Phoenix provides 2 interrupt lines. The first one is connected to
2197 * the OMAP. The other one can be connected to the other processor such
2198 @@ -737,6 +740,28 @@ static int __devinit twl4030_madc_probe(struct platform_device *pdev)
2199 TWL4030_BCI_BCICTL1);
2200 goto err_i2c;
2201 }
2202 +
2203 + /* Check that MADC clock is on */
2204 + ret = twl_i2c_read_u8(TWL4030_MODULE_INTBR, &regval, TWL4030_REG_GPBR1);
2205 + if (ret) {
2206 + dev_err(&pdev->dev, "unable to read reg GPBR1 0x%X\n",
2207 + TWL4030_REG_GPBR1);
2208 + goto err_i2c;
2209 + }
2210 +
2211 + /* If MADC clk is not on, turn it on */
2212 + if (!(regval & TWL4030_GPBR1_MADC_HFCLK_EN)) {
2213 + dev_info(&pdev->dev, "clk disabled, enabling\n");
2214 + regval |= TWL4030_GPBR1_MADC_HFCLK_EN;
2215 + ret = twl_i2c_write_u8(TWL4030_MODULE_INTBR, regval,
2216 + TWL4030_REG_GPBR1);
2217 + if (ret) {
2218 + dev_err(&pdev->dev, "unable to write reg GPBR1 0x%X\n",
2219 + TWL4030_REG_GPBR1);
2220 + goto err_i2c;
2221 + }
2222 + }
2223 +
2224 platform_set_drvdata(pdev, madc);
2225 mutex_init(&madc->lock);
2226 ret = request_threaded_irq(platform_get_irq(pdev, 0), NULL,
2227 diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
2228 index fe14072..9394d0b 100644
2229 --- a/drivers/mmc/host/mmci.c
2230 +++ b/drivers/mmc/host/mmci.c
2231 @@ -557,7 +557,8 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
2232 unsigned int status)
2233 {
2234 /* First check for errors */
2235 - if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|MCI_RXOVERRUN)) {
2236 + if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_STARTBITERR|
2237 + MCI_TXUNDERRUN|MCI_RXOVERRUN)) {
2238 u32 remain, success;
2239
2240 /* Terminate the DMA transfer */
2241 @@ -636,8 +637,12 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd,
2242 }
2243
2244 if (!cmd->data || cmd->error) {
2245 - if (host->data)
2246 + if (host->data) {
2247 + /* Terminate the DMA transfer */
2248 + if (dma_inprogress(host))
2249 + mmci_dma_data_error(host);
2250 mmci_stop_data(host);
2251 + }
2252 mmci_request_end(host, cmd->mrq);
2253 } else if (!(cmd->data->flags & MMC_DATA_READ)) {
2254 mmci_start_data(host, cmd->data);
2255 @@ -837,8 +842,9 @@ static irqreturn_t mmci_irq(int irq, void *dev_id)
2256 dev_dbg(mmc_dev(host->mmc), "irq0 (data+cmd) %08x\n", status);
2257
2258 data = host->data;
2259 - if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|
2260 - MCI_RXOVERRUN|MCI_DATAEND|MCI_DATABLOCKEND) && data)
2261 + if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_STARTBITERR|
2262 + MCI_TXUNDERRUN|MCI_RXOVERRUN|MCI_DATAEND|
2263 + MCI_DATABLOCKEND) && data)
2264 mmci_data_irq(host, data, status);
2265
2266 cmd = host->cmd;
2267 diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
2268 index d4455ff..52f4b64 100644
2269 --- a/drivers/mmc/host/vub300.c
2270 +++ b/drivers/mmc/host/vub300.c
2271 @@ -259,7 +259,7 @@ static int firmware_rom_wait_states = 0x04;
2272 static int firmware_rom_wait_states = 0x1C;
2273 #endif
2274
2275 -module_param(firmware_rom_wait_states, bool, 0644);
2276 +module_param(firmware_rom_wait_states, int, 0644);
2277 MODULE_PARM_DESC(firmware_rom_wait_states,
2278 "ROM wait states byte=RRRIIEEE (Reserved Internal External)");
2279
2280 diff --git a/drivers/net/pptp.c b/drivers/net/pptp.c
2281 index 1286fe2..4b3a68b 100644
2282 --- a/drivers/net/pptp.c
2283 +++ b/drivers/net/pptp.c
2284 @@ -418,10 +418,8 @@ static int pptp_bind(struct socket *sock, struct sockaddr *uservaddr,
2285 lock_sock(sk);
2286
2287 opt->src_addr = sp->sa_addr.pptp;
2288 - if (add_chan(po)) {
2289 - release_sock(sk);
2290 + if (add_chan(po))
2291 error = -EBUSY;
2292 - }
2293
2294 release_sock(sk);
2295 return error;
2296 diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
2297 index 5362306..a126a3e 100644
2298 --- a/drivers/net/wireless/ath/ath9k/main.c
2299 +++ b/drivers/net/wireless/ath/ath9k/main.c
2300 @@ -1828,6 +1828,9 @@ static void ath9k_sta_notify(struct ieee80211_hw *hw,
2301 struct ath_softc *sc = hw->priv;
2302 struct ath_node *an = (struct ath_node *) sta->drv_priv;
2303
2304 + if (!(sc->sc_flags & SC_OP_TXAGGR))
2305 + return;
2306 +
2307 switch (cmd) {
2308 case STA_NOTIFY_SLEEP:
2309 an->sleeping = true;
2310 diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
2311 index ba7f36a..ea35843 100644
2312 --- a/drivers/net/wireless/ath/ath9k/rc.c
2313 +++ b/drivers/net/wireless/ath/ath9k/rc.c
2314 @@ -1252,7 +1252,9 @@ static void ath_rc_init(struct ath_softc *sc,
2315
2316 ath_rc_priv->max_valid_rate = k;
2317 ath_rc_sort_validrates(rate_table, ath_rc_priv);
2318 - ath_rc_priv->rate_max_phy = ath_rc_priv->valid_rate_index[k-4];
2319 + ath_rc_priv->rate_max_phy = (k > 4) ?
2320 + ath_rc_priv->valid_rate_index[k-4] :
2321 + ath_rc_priv->valid_rate_index[k-1];
2322 ath_rc_priv->rate_table = rate_table;
2323
2324 ath_dbg(common, ATH_DBG_CONFIG,
2325 diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
2326 index b849ad7..39a3c9c 100644
2327 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
2328 +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
2329 @@ -490,8 +490,8 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
2330 if (ctx->ht.enabled) {
2331 /* if HT40 is used, it should not change
2332 * after associated except channel switch */
2333 - if (iwl_is_associated_ctx(ctx) &&
2334 - !ctx->ht.is_40mhz)
2335 + if (!ctx->ht.is_40mhz ||
2336 + !iwl_is_associated_ctx(ctx))
2337 iwlagn_config_ht40(conf, ctx);
2338 } else
2339 ctx->ht.is_40mhz = false;
2340 diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
2341 index 4974cd7..67cd2e3 100644
2342 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
2343 +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
2344 @@ -385,7 +385,10 @@ static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv,
2345 tx_cmd->tid_tspec = qc[0] & 0xf;
2346 tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK;
2347 } else {
2348 - tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
2349 + if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)
2350 + tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
2351 + else
2352 + tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK;
2353 }
2354
2355 priv->cfg->ops->utils->tx_cmd_protection(priv, info, fc, &tx_flags);
2356 @@ -775,10 +778,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
2357 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd));
2358 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len);
2359
2360 - /* Set up entry for this TFD in Tx byte-count array */
2361 - if (info->flags & IEEE80211_TX_CTL_AMPDU)
2362 - iwlagn_txq_update_byte_cnt_tbl(priv, txq,
2363 - le16_to_cpu(tx_cmd->len));
2364 + iwlagn_txq_update_byte_cnt_tbl(priv, txq, le16_to_cpu(tx_cmd->len));
2365
2366 pci_dma_sync_single_for_device(priv->pci_dev, txcmd_phys,
2367 firstlen, PCI_DMA_BIDIRECTIONAL);
2368 diff --git a/drivers/oprofile/oprofile_files.c b/drivers/oprofile/oprofile_files.c
2369 index 89f6345..84a208d 100644
2370 --- a/drivers/oprofile/oprofile_files.c
2371 +++ b/drivers/oprofile/oprofile_files.c
2372 @@ -45,7 +45,7 @@ static ssize_t timeout_write(struct file *file, char const __user *buf,
2373 return -EINVAL;
2374
2375 retval = oprofilefs_ulong_from_user(&val, buf, count);
2376 - if (retval)
2377 + if (retval <= 0)
2378 return retval;
2379
2380 retval = oprofile_set_timeout(val);
2381 @@ -84,7 +84,7 @@ static ssize_t depth_write(struct file *file, char const __user *buf, size_t cou
2382 return -EINVAL;
2383
2384 retval = oprofilefs_ulong_from_user(&val, buf, count);
2385 - if (retval)
2386 + if (retval <= 0)
2387 return retval;
2388
2389 retval = oprofile_set_ulong(&oprofile_backtrace_depth, val);
2390 @@ -141,9 +141,10 @@ static ssize_t enable_write(struct file *file, char const __user *buf, size_t co
2391 return -EINVAL;
2392
2393 retval = oprofilefs_ulong_from_user(&val, buf, count);
2394 - if (retval)
2395 + if (retval <= 0)
2396 return retval;
2397
2398 + retval = 0;
2399 if (val)
2400 retval = oprofile_start();
2401 else
2402 diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
2403 index e9ff6f7..1c0b799 100644
2404 --- a/drivers/oprofile/oprofilefs.c
2405 +++ b/drivers/oprofile/oprofilefs.c
2406 @@ -60,6 +60,13 @@ ssize_t oprofilefs_ulong_to_user(unsigned long val, char __user *buf, size_t cou
2407 }
2408
2409
2410 +/*
2411 + * Note: If oprofilefs_ulong_from_user() returns 0, then *val remains
2412 + * unchanged and might be uninitialized. This follows write syscall
2413 + * implementation when count is zero: "If count is zero ... [and if]
2414 + * no errors are detected, 0 will be returned without causing any
2415 + * other effect." (man 2 write)
2416 + */
2417 int oprofilefs_ulong_from_user(unsigned long *val, char const __user *buf, size_t count)
2418 {
2419 char tmpbuf[TMPBUFSIZE];
2420 @@ -79,7 +86,7 @@ int oprofilefs_ulong_from_user(unsigned long *val, char const __user *buf, size_
2421 spin_lock_irqsave(&oprofilefs_lock, flags);
2422 *val = simple_strtoul(tmpbuf, NULL, 0);
2423 spin_unlock_irqrestore(&oprofilefs_lock, flags);
2424 - return 0;
2425 + return count;
2426 }
2427
2428
2429 @@ -99,7 +106,7 @@ static ssize_t ulong_write_file(struct file *file, char const __user *buf, size_
2430 return -EINVAL;
2431
2432 retval = oprofilefs_ulong_from_user(&value, buf, count);
2433 - if (retval)
2434 + if (retval <= 0)
2435 return retval;
2436
2437 retval = oprofile_set_ulong(file->private_data, value);
2438 diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
2439 index bbb6f85..eb4c883 100644
2440 --- a/drivers/rtc/interface.c
2441 +++ b/drivers/rtc/interface.c
2442 @@ -318,20 +318,6 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
2443 }
2444 EXPORT_SYMBOL_GPL(rtc_read_alarm);
2445
2446 -static int ___rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
2447 -{
2448 - int err;
2449 -
2450 - if (!rtc->ops)
2451 - err = -ENODEV;
2452 - else if (!rtc->ops->set_alarm)
2453 - err = -EINVAL;
2454 - else
2455 - err = rtc->ops->set_alarm(rtc->dev.parent, alarm);
2456 -
2457 - return err;
2458 -}
2459 -
2460 static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
2461 {
2462 struct rtc_time tm;
2463 @@ -355,7 +341,14 @@ static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
2464 * over right here, before we set the alarm.
2465 */
2466
2467 - return ___rtc_set_alarm(rtc, alarm);
2468 + if (!rtc->ops)
2469 + err = -ENODEV;
2470 + else if (!rtc->ops->set_alarm)
2471 + err = -EINVAL;
2472 + else
2473 + err = rtc->ops->set_alarm(rtc->dev.parent, alarm);
2474 +
2475 + return err;
2476 }
2477
2478 int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
2479 @@ -769,20 +762,6 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer)
2480 return 0;
2481 }
2482
2483 -static void rtc_alarm_disable(struct rtc_device *rtc)
2484 -{
2485 - struct rtc_wkalrm alarm;
2486 - struct rtc_time tm;
2487 -
2488 - __rtc_read_time(rtc, &tm);
2489 -
2490 - alarm.time = rtc_ktime_to_tm(ktime_add(rtc_tm_to_ktime(tm),
2491 - ktime_set(300, 0)));
2492 - alarm.enabled = 0;
2493 -
2494 - ___rtc_set_alarm(rtc, &alarm);
2495 -}
2496 -
2497 /**
2498 * rtc_timer_remove - Removes a rtc_timer from the rtc_device timerqueue
2499 * @rtc rtc device
2500 @@ -804,10 +783,8 @@ static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer)
2501 struct rtc_wkalrm alarm;
2502 int err;
2503 next = timerqueue_getnext(&rtc->timerqueue);
2504 - if (!next) {
2505 - rtc_alarm_disable(rtc);
2506 + if (!next)
2507 return;
2508 - }
2509 alarm.time = rtc_ktime_to_tm(next->expires);
2510 alarm.enabled = 1;
2511 err = __rtc_set_alarm(rtc, &alarm);
2512 @@ -869,8 +846,7 @@ again:
2513 err = __rtc_set_alarm(rtc, &alarm);
2514 if (err == -ETIME)
2515 goto again;
2516 - } else
2517 - rtc_alarm_disable(rtc);
2518 + }
2519
2520 mutex_unlock(&rtc->ops_lock);
2521 }
2522 diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
2523 index eda128f..64aedd8 100644
2524 --- a/drivers/rtc/rtc-m41t80.c
2525 +++ b/drivers/rtc/rtc-m41t80.c
2526 @@ -357,10 +357,19 @@ static int m41t80_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *t)
2527 static struct rtc_class_ops m41t80_rtc_ops = {
2528 .read_time = m41t80_rtc_read_time,
2529 .set_time = m41t80_rtc_set_time,
2530 + /*
2531 + * XXX - m41t80 alarm functionality is reported broken.
2532 + * until it is fixed, don't register alarm functions.
2533 + *
2534 .read_alarm = m41t80_rtc_read_alarm,
2535 .set_alarm = m41t80_rtc_set_alarm,
2536 + */
2537 .proc = m41t80_rtc_proc,
2538 + /*
2539 + * See above comment on broken alarm
2540 + *
2541 .alarm_irq_enable = m41t80_rtc_alarm_irq_enable,
2542 + */
2543 };
2544
2545 #if defined(CONFIG_RTC_INTF_SYSFS) || defined(CONFIG_RTC_INTF_SYSFS_MODULE)
2546 diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
2547 index 2a4991d..3a417df 100644
2548 --- a/drivers/s390/scsi/zfcp_scsi.c
2549 +++ b/drivers/s390/scsi/zfcp_scsi.c
2550 @@ -57,6 +57,10 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdev)
2551 {
2552 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
2553
2554 + /* if previous slave_alloc returned early, there is nothing to do */
2555 + if (!zfcp_sdev->port)
2556 + return;
2557 +
2558 zfcp_erp_lun_shutdown_wait(sdev, "scssd_1");
2559 put_device(&zfcp_sdev->port->dev);
2560 }
2561 diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
2562 index 8885b3e..f829adc 100644
2563 --- a/drivers/scsi/fcoe/fcoe.c
2564 +++ b/drivers/scsi/fcoe/fcoe.c
2565 @@ -1561,6 +1561,7 @@ static inline int fcoe_filter_frames(struct fc_lport *lport,
2566 stats->InvalidCRCCount++;
2567 if (stats->InvalidCRCCount < 5)
2568 printk(KERN_WARNING "fcoe: dropping frame with CRC error\n");
2569 + put_cpu();
2570 return -EINVAL;
2571 }
2572
2573 diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
2574 index 83035bd..39e81cd 100644
2575 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c
2576 +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
2577 @@ -1082,41 +1082,6 @@ _base_config_dma_addressing(struct MPT2SAS_ADAPTER *ioc, struct pci_dev *pdev)
2578 }
2579
2580 /**
2581 - * _base_save_msix_table - backup msix vector table
2582 - * @ioc: per adapter object
2583 - *
2584 - * This address an errata where diag reset clears out the table
2585 - */
2586 -static void
2587 -_base_save_msix_table(struct MPT2SAS_ADAPTER *ioc)
2588 -{
2589 - int i;
2590 -
2591 - if (!ioc->msix_enable || ioc->msix_table_backup == NULL)
2592 - return;
2593 -
2594 - for (i = 0; i < ioc->msix_vector_count; i++)
2595 - ioc->msix_table_backup[i] = ioc->msix_table[i];
2596 -}
2597 -
2598 -/**
2599 - * _base_restore_msix_table - this restores the msix vector table
2600 - * @ioc: per adapter object
2601 - *
2602 - */
2603 -static void
2604 -_base_restore_msix_table(struct MPT2SAS_ADAPTER *ioc)
2605 -{
2606 - int i;
2607 -
2608 - if (!ioc->msix_enable || ioc->msix_table_backup == NULL)
2609 - return;
2610 -
2611 - for (i = 0; i < ioc->msix_vector_count; i++)
2612 - ioc->msix_table[i] = ioc->msix_table_backup[i];
2613 -}
2614 -
2615 -/**
2616 * _base_check_enable_msix - checks MSIX capabable.
2617 * @ioc: per adapter object
2618 *
2619 @@ -1128,7 +1093,7 @@ _base_check_enable_msix(struct MPT2SAS_ADAPTER *ioc)
2620 {
2621 int base;
2622 u16 message_control;
2623 - u32 msix_table_offset;
2624 +
2625
2626 base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX);
2627 if (!base) {
2628 @@ -1141,14 +1106,8 @@ _base_check_enable_msix(struct MPT2SAS_ADAPTER *ioc)
2629 pci_read_config_word(ioc->pdev, base + 2, &message_control);
2630 ioc->msix_vector_count = (message_control & 0x3FF) + 1;
2631
2632 - /* get msix table */
2633 - pci_read_config_dword(ioc->pdev, base + 4, &msix_table_offset);
2634 - msix_table_offset &= 0xFFFFFFF8;
2635 - ioc->msix_table = (u32 *)((void *)ioc->chip + msix_table_offset);
2636 -
2637 dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "msix is supported, "
2638 - "vector_count(%d), table_offset(0x%08x), table(%p)\n", ioc->name,
2639 - ioc->msix_vector_count, msix_table_offset, ioc->msix_table));
2640 + "vector_count(%d)\n", ioc->name, ioc->msix_vector_count));
2641 return 0;
2642 }
2643
2644 @@ -1162,8 +1121,6 @@ _base_disable_msix(struct MPT2SAS_ADAPTER *ioc)
2645 {
2646 if (ioc->msix_enable) {
2647 pci_disable_msix(ioc->pdev);
2648 - kfree(ioc->msix_table_backup);
2649 - ioc->msix_table_backup = NULL;
2650 ioc->msix_enable = 0;
2651 }
2652 }
2653 @@ -1189,14 +1146,6 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc)
2654 if (_base_check_enable_msix(ioc) != 0)
2655 goto try_ioapic;
2656
2657 - ioc->msix_table_backup = kcalloc(ioc->msix_vector_count,
2658 - sizeof(u32), GFP_KERNEL);
2659 - if (!ioc->msix_table_backup) {
2660 - dfailprintk(ioc, printk(MPT2SAS_INFO_FMT "allocation for "
2661 - "msix_table_backup failed!!!\n", ioc->name));
2662 - goto try_ioapic;
2663 - }
2664 -
2665 memset(&entries, 0, sizeof(struct msix_entry));
2666 r = pci_enable_msix(ioc->pdev, &entries, 1);
2667 if (r) {
2668 @@ -3513,9 +3462,6 @@ _base_diag_reset(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
2669 u32 hcb_size;
2670
2671 printk(MPT2SAS_INFO_FMT "sending diag reset !!\n", ioc->name);
2672 -
2673 - _base_save_msix_table(ioc);
2674 -
2675 drsprintk(ioc, printk(MPT2SAS_INFO_FMT "clear interrupts\n",
2676 ioc->name));
2677
2678 @@ -3611,7 +3557,6 @@ _base_diag_reset(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
2679 goto out;
2680 }
2681
2682 - _base_restore_msix_table(ioc);
2683 printk(MPT2SAS_INFO_FMT "diag reset: SUCCESS\n", ioc->name);
2684 return 0;
2685
2686 diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h
2687 index 41a57a7..e1735f9 100644
2688 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h
2689 +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
2690 @@ -626,8 +626,6 @@ struct mpt2sas_port_facts {
2691 * @wait_for_port_enable_to_complete:
2692 * @msix_enable: flag indicating msix is enabled
2693 * @msix_vector_count: number msix vectors
2694 - * @msix_table: virt address to the msix table
2695 - * @msix_table_backup: backup msix table
2696 * @scsi_io_cb_idx: shost generated commands
2697 * @tm_cb_idx: task management commands
2698 * @scsih_cb_idx: scsih internal commands
2699 @@ -768,8 +766,6 @@ struct MPT2SAS_ADAPTER {
2700
2701 u8 msix_enable;
2702 u16 msix_vector_count;
2703 - u32 *msix_table;
2704 - u32 *msix_table_backup;
2705 u32 ioc_reset_count;
2706
2707 /* internal commands, callback index */
2708 diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
2709 index 5690f09..f88e52a 100644
2710 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
2711 +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
2712 @@ -4145,7 +4145,7 @@ _scsih_smart_predicted_fault(struct MPT2SAS_ADAPTER *ioc, u16 handle)
2713 /* insert into event log */
2714 sz = offsetof(Mpi2EventNotificationReply_t, EventData) +
2715 sizeof(Mpi2EventDataSasDeviceStatusChange_t);
2716 - event_reply = kzalloc(sz, GFP_KERNEL);
2717 + event_reply = kzalloc(sz, GFP_ATOMIC);
2718 if (!event_reply) {
2719 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
2720 ioc->name, __FILE__, __LINE__, __func__);
2721 diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c
2722 index d6620ad..c828151 100644
2723 --- a/drivers/ssb/driver_pcicore.c
2724 +++ b/drivers/ssb/driver_pcicore.c
2725 @@ -516,10 +516,14 @@ static void ssb_pcicore_pcie_setup_workarounds(struct ssb_pcicore *pc)
2726
2727 static void ssb_pcicore_init_clientmode(struct ssb_pcicore *pc)
2728 {
2729 - ssb_pcicore_fix_sprom_core_index(pc);
2730 + struct ssb_device *pdev = pc->dev;
2731 + struct ssb_bus *bus = pdev->bus;
2732 +
2733 + if (bus->bustype == SSB_BUSTYPE_PCI)
2734 + ssb_pcicore_fix_sprom_core_index(pc);
2735
2736 /* Disable PCI interrupts. */
2737 - ssb_write32(pc->dev, SSB_INTVEC, 0);
2738 + ssb_write32(pdev, SSB_INTVEC, 0);
2739
2740 /* Additional PCIe always once-executed workarounds */
2741 if (pc->dev->id.coreid == SSB_DEV_PCIE) {
2742 diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
2743 index 8cb2685..9cb60df 100644
2744 --- a/drivers/watchdog/hpwdt.c
2745 +++ b/drivers/watchdog/hpwdt.c
2746 @@ -216,6 +216,7 @@ static int __devinit cru_detect(unsigned long map_entry,
2747
2748 cmn_regs.u1.reax = CRU_BIOS_SIGNATURE_VALUE;
2749
2750 + set_memory_x((unsigned long)bios32_entrypoint, (2 * PAGE_SIZE));
2751 asminline_call(&cmn_regs, bios32_entrypoint);
2752
2753 if (cmn_regs.u1.ral != 0) {
2754 @@ -233,8 +234,10 @@ static int __devinit cru_detect(unsigned long map_entry,
2755 if ((physical_bios_base + physical_bios_offset)) {
2756 cru_rom_addr =
2757 ioremap(cru_physical_address, cru_length);
2758 - if (cru_rom_addr)
2759 + if (cru_rom_addr) {
2760 + set_memory_x((unsigned long)cru_rom_addr, cru_length);
2761 retval = 0;
2762 + }
2763 }
2764
2765 printk(KERN_DEBUG "hpwdt: CRU Base Address: 0x%lx\n",
2766 diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
2767 index 84f317e..fd60dff 100644
2768 --- a/drivers/xen/swiotlb-xen.c
2769 +++ b/drivers/xen/swiotlb-xen.c
2770 @@ -162,7 +162,7 @@ void __init xen_swiotlb_init(int verbose)
2771 /*
2772 * Get IO TLB memory from any location.
2773 */
2774 - xen_io_tlb_start = alloc_bootmem(bytes);
2775 + xen_io_tlb_start = alloc_bootmem_pages(PAGE_ALIGN(bytes));
2776 if (!xen_io_tlb_start)
2777 panic("Cannot allocate SWIOTLB buffer");
2778
2779 diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
2780 index e97dd21..87822a3 100644
2781 --- a/fs/nfs/nfs4state.c
2782 +++ b/fs/nfs/nfs4state.c
2783 @@ -1519,16 +1519,16 @@ void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags)
2784 {
2785 if (!flags)
2786 return;
2787 - else if (flags & SEQ4_STATUS_RESTART_RECLAIM_NEEDED)
2788 + if (flags & SEQ4_STATUS_RESTART_RECLAIM_NEEDED)
2789 nfs41_handle_server_reboot(clp);
2790 - else if (flags & (SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED |
2791 + if (flags & (SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED |
2792 SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED |
2793 SEQ4_STATUS_ADMIN_STATE_REVOKED |
2794 SEQ4_STATUS_LEASE_MOVED))
2795 nfs41_handle_state_revoked(clp);
2796 - else if (flags & SEQ4_STATUS_RECALLABLE_STATE_REVOKED)
2797 + if (flags & SEQ4_STATUS_RECALLABLE_STATE_REVOKED)
2798 nfs41_handle_recallable_state_revoked(clp);
2799 - else if (flags & (SEQ4_STATUS_CB_PATH_DOWN |
2800 + if (flags & (SEQ4_STATUS_CB_PATH_DOWN |
2801 SEQ4_STATUS_BACKCHANNEL_FAULT |
2802 SEQ4_STATUS_CB_PATH_DOWN_SESSION))
2803 nfs41_handle_cb_path_down(clp);
2804 diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
2805 index 41d6743..3e65427 100644
2806 --- a/fs/nilfs2/ioctl.c
2807 +++ b/fs/nilfs2/ioctl.c
2808 @@ -842,6 +842,19 @@ long nilfs_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
2809 case FS_IOC32_GETVERSION:
2810 cmd = FS_IOC_GETVERSION;
2811 break;
2812 + case NILFS_IOCTL_CHANGE_CPMODE:
2813 + case NILFS_IOCTL_DELETE_CHECKPOINT:
2814 + case NILFS_IOCTL_GET_CPINFO:
2815 + case NILFS_IOCTL_GET_CPSTAT:
2816 + case NILFS_IOCTL_GET_SUINFO:
2817 + case NILFS_IOCTL_GET_SUSTAT:
2818 + case NILFS_IOCTL_GET_VINFO:
2819 + case NILFS_IOCTL_GET_BDESCS:
2820 + case NILFS_IOCTL_CLEAN_SEGMENTS:
2821 + case NILFS_IOCTL_SYNC:
2822 + case NILFS_IOCTL_RESIZE:
2823 + case NILFS_IOCTL_SET_ALLOC_RANGE:
2824 + break;
2825 default:
2826 return -ENOIOCTLCMD;
2827 }
2828 diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
2829 index 28de70b..e6ac98c 100644
2830 --- a/fs/xfs/linux-2.6/xfs_super.c
2831 +++ b/fs/xfs/linux-2.6/xfs_super.c
2832 @@ -871,27 +871,6 @@ xfs_fs_dirty_inode(
2833 }
2834
2835 STATIC int
2836 -xfs_log_inode(
2837 - struct xfs_inode *ip)
2838 -{
2839 - struct xfs_mount *mp = ip->i_mount;
2840 - struct xfs_trans *tp;
2841 - int error;
2842 -
2843 - tp = xfs_trans_alloc(mp, XFS_TRANS_FSYNC_TS);
2844 - error = xfs_trans_reserve(tp, 0, XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0);
2845 - if (error) {
2846 - xfs_trans_cancel(tp, 0);
2847 - return error;
2848 - }
2849 -
2850 - xfs_ilock(ip, XFS_ILOCK_EXCL);
2851 - xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL);
2852 - xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
2853 - return xfs_trans_commit(tp, 0);
2854 -}
2855 -
2856 -STATIC int
2857 xfs_fs_write_inode(
2858 struct inode *inode,
2859 struct writeback_control *wbc)
2860 @@ -904,10 +883,8 @@ xfs_fs_write_inode(
2861
2862 if (XFS_FORCED_SHUTDOWN(mp))
2863 return -XFS_ERROR(EIO);
2864 - if (!ip->i_update_core)
2865 - return 0;
2866
2867 - if (wbc->sync_mode == WB_SYNC_ALL) {
2868 + if (wbc->sync_mode == WB_SYNC_ALL || wbc->for_kupdate) {
2869 /*
2870 * Make sure the inode has made it it into the log. Instead
2871 * of forcing it all the way to stable storage using a
2872 @@ -916,11 +893,14 @@ xfs_fs_write_inode(
2873 * of synchronous log foces dramatically.
2874 */
2875 xfs_ioend_wait(ip);
2876 - error = xfs_log_inode(ip);
2877 + error = xfs_log_dirty_inode(ip, NULL, 0);
2878 if (error)
2879 goto out;
2880 return 0;
2881 } else {
2882 + if (!ip->i_update_core)
2883 + return 0;
2884 +
2885 /*
2886 * We make this non-blocking if the inode is contended, return
2887 * EAGAIN to indicate to the caller that they did not succeed.
2888 diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
2889 index b69688d..2f277a0 100644
2890 --- a/fs/xfs/linux-2.6/xfs_sync.c
2891 +++ b/fs/xfs/linux-2.6/xfs_sync.c
2892 @@ -336,6 +336,32 @@ xfs_sync_fsdata(
2893 return xfs_bwrite(mp, bp);
2894 }
2895
2896 +int
2897 +xfs_log_dirty_inode(
2898 + struct xfs_inode *ip,
2899 + struct xfs_perag *pag,
2900 + int flags)
2901 +{
2902 + struct xfs_mount *mp = ip->i_mount;
2903 + struct xfs_trans *tp;
2904 + int error;
2905 +
2906 + if (!ip->i_update_core)
2907 + return 0;
2908 +
2909 + tp = xfs_trans_alloc(mp, XFS_TRANS_FSYNC_TS);
2910 + error = xfs_trans_reserve(tp, 0, XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0);
2911 + if (error) {
2912 + xfs_trans_cancel(tp, 0);
2913 + return error;
2914 + }
2915 +
2916 + xfs_ilock(ip, XFS_ILOCK_EXCL);
2917 + xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL);
2918 + xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
2919 + return xfs_trans_commit(tp, 0);
2920 +}
2921 +
2922 /*
2923 * When remounting a filesystem read-only or freezing the filesystem, we have
2924 * two phases to execute. This first phase is syncing the data before we
2925 @@ -365,6 +391,17 @@ xfs_quiesce_data(
2926
2927 /* push and block till complete */
2928 xfs_sync_data(mp, SYNC_WAIT);
2929 +
2930 + /*
2931 + * Log all pending size and timestamp updates. The vfs writeback
2932 + * code is supposed to do this, but due to its overagressive
2933 + * livelock detection it will skip inodes where appending writes
2934 + * were written out in the first non-blocking sync phase if their
2935 + * completion took long enough that it happened after taking the
2936 + * timestamp for the cut-off in the blocking phase.
2937 + */
2938 + xfs_inode_ag_iterator(mp, xfs_log_dirty_inode, 0);
2939 +
2940 xfs_qm_sync(mp, SYNC_WAIT);
2941
2942 /* write superblock and hoover up shutdown errors */
2943 diff --git a/fs/xfs/linux-2.6/xfs_sync.h b/fs/xfs/linux-2.6/xfs_sync.h
2944 index e3a6ad2..ef5b2ce 100644
2945 --- a/fs/xfs/linux-2.6/xfs_sync.h
2946 +++ b/fs/xfs/linux-2.6/xfs_sync.h
2947 @@ -42,6 +42,8 @@ void xfs_quiesce_attr(struct xfs_mount *mp);
2948
2949 void xfs_flush_inodes(struct xfs_inode *ip);
2950
2951 +int xfs_log_dirty_inode(struct xfs_inode *ip, struct xfs_perag *pag, int flags);
2952 +
2953 int xfs_reclaim_inodes(struct xfs_mount *mp, int mode);
2954
2955 void xfs_inode_set_reclaim_tag(struct xfs_inode *ip);
2956 diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
2957 index 1a23722..cd93f99 100644
2958 --- a/include/linux/blkdev.h
2959 +++ b/include/linux/blkdev.h
2960 @@ -798,9 +798,6 @@ extern void blk_unprep_request(struct request *);
2961 */
2962 extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn,
2963 spinlock_t *lock, int node_id);
2964 -extern struct request_queue *blk_init_allocated_queue_node(struct request_queue *,
2965 - request_fn_proc *,
2966 - spinlock_t *, int node_id);
2967 extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *);
2968 extern struct request_queue *blk_init_allocated_queue(struct request_queue *,
2969 request_fn_proc *, spinlock_t *);
2970 diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
2971 index 6427d29..530e11b 100644
2972 --- a/include/linux/i2c/twl4030-madc.h
2973 +++ b/include/linux/i2c/twl4030-madc.h
2974 @@ -129,6 +129,10 @@ enum sample_type {
2975 #define REG_BCICTL2 0x024
2976 #define TWL4030_BCI_ITHSENS 0x007
2977
2978 +/* Register and bits for GPBR1 register */
2979 +#define TWL4030_REG_GPBR1 0x0c
2980 +#define TWL4030_GPBR1_MADC_HFCLK_EN (1 << 7)
2981 +
2982 struct twl4030_madc_user_parms {
2983 int channel;
2984 int average;
2985 diff --git a/include/linux/lglock.h b/include/linux/lglock.h
2986 index f549056..87f402c 100644
2987 --- a/include/linux/lglock.h
2988 +++ b/include/linux/lglock.h
2989 @@ -22,6 +22,7 @@
2990 #include <linux/spinlock.h>
2991 #include <linux/lockdep.h>
2992 #include <linux/percpu.h>
2993 +#include <linux/cpu.h>
2994
2995 /* can make br locks by using local lock for read side, global lock for write */
2996 #define br_lock_init(name) name##_lock_init()
2997 @@ -72,9 +73,31 @@
2998
2999 #define DEFINE_LGLOCK(name) \
3000 \
3001 + DEFINE_SPINLOCK(name##_cpu_lock); \
3002 + cpumask_t name##_cpus __read_mostly; \
3003 DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \
3004 DEFINE_LGLOCK_LOCKDEP(name); \
3005 \
3006 + static int \
3007 + name##_lg_cpu_callback(struct notifier_block *nb, \
3008 + unsigned long action, void *hcpu) \
3009 + { \
3010 + switch (action & ~CPU_TASKS_FROZEN) { \
3011 + case CPU_UP_PREPARE: \
3012 + spin_lock(&name##_cpu_lock); \
3013 + cpu_set((unsigned long)hcpu, name##_cpus); \
3014 + spin_unlock(&name##_cpu_lock); \
3015 + break; \
3016 + case CPU_UP_CANCELED: case CPU_DEAD: \
3017 + spin_lock(&name##_cpu_lock); \
3018 + cpu_clear((unsigned long)hcpu, name##_cpus); \
3019 + spin_unlock(&name##_cpu_lock); \
3020 + } \
3021 + return NOTIFY_OK; \
3022 + } \
3023 + static struct notifier_block name##_lg_cpu_notifier = { \
3024 + .notifier_call = name##_lg_cpu_callback, \
3025 + }; \
3026 void name##_lock_init(void) { \
3027 int i; \
3028 LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \
3029 @@ -83,6 +106,11 @@
3030 lock = &per_cpu(name##_lock, i); \
3031 *lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \
3032 } \
3033 + register_hotcpu_notifier(&name##_lg_cpu_notifier); \
3034 + get_online_cpus(); \
3035 + for_each_online_cpu(i) \
3036 + cpu_set(i, name##_cpus); \
3037 + put_online_cpus(); \
3038 } \
3039 EXPORT_SYMBOL(name##_lock_init); \
3040 \
3041 @@ -124,9 +152,9 @@
3042 \
3043 void name##_global_lock_online(void) { \
3044 int i; \
3045 - preempt_disable(); \
3046 + spin_lock(&name##_cpu_lock); \
3047 rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \
3048 - for_each_online_cpu(i) { \
3049 + for_each_cpu(i, &name##_cpus) { \
3050 arch_spinlock_t *lock; \
3051 lock = &per_cpu(name##_lock, i); \
3052 arch_spin_lock(lock); \
3053 @@ -137,12 +165,12 @@
3054 void name##_global_unlock_online(void) { \
3055 int i; \
3056 rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \
3057 - for_each_online_cpu(i) { \
3058 + for_each_cpu(i, &name##_cpus) { \
3059 arch_spinlock_t *lock; \
3060 lock = &per_cpu(name##_lock, i); \
3061 arch_spin_unlock(lock); \
3062 } \
3063 - preempt_enable(); \
3064 + spin_unlock(&name##_cpu_lock); \
3065 } \
3066 EXPORT_SYMBOL(name##_global_unlock_online); \
3067 \
3068 diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
3069 index 7df327a..c388421 100644
3070 --- a/include/net/sctp/structs.h
3071 +++ b/include/net/sctp/structs.h
3072 @@ -236,6 +236,9 @@ extern struct sctp_globals {
3073 * bits is an indicator of when to send and window update SACK.
3074 */
3075 int rwnd_update_shift;
3076 +
3077 + /* Threshold for autoclose timeout, in seconds. */
3078 + unsigned long max_autoclose;
3079 } sctp_globals;
3080
3081 #define sctp_rto_initial (sctp_globals.rto_initial)
3082 @@ -271,6 +274,7 @@ extern struct sctp_globals {
3083 #define sctp_auth_enable (sctp_globals.auth_enable)
3084 #define sctp_checksum_disable (sctp_globals.checksum_disable)
3085 #define sctp_rwnd_upd_shift (sctp_globals.rwnd_update_shift)
3086 +#define sctp_max_autoclose (sctp_globals.max_autoclose)
3087
3088 /* SCTP Socket type: UDP or TCP style. */
3089 typedef enum {
3090 diff --git a/kernel/cgroup.c b/kernel/cgroup.c
3091 index 2731d11..575a5e7 100644
3092 --- a/kernel/cgroup.c
3093 +++ b/kernel/cgroup.c
3094 @@ -2095,11 +2095,6 @@ int cgroup_attach_proc(struct cgroup *cgrp, struct task_struct *leader)
3095 continue;
3096 /* get old css_set pointer */
3097 task_lock(tsk);
3098 - if (tsk->flags & PF_EXITING) {
3099 - /* ignore this task if it's going away */
3100 - task_unlock(tsk);
3101 - continue;
3102 - }
3103 oldcg = tsk->cgroups;
3104 get_css_set(oldcg);
3105 task_unlock(tsk);
3106 diff --git a/kernel/exit.c b/kernel/exit.c
3107 index f2b321b..303bed2 100644
3108 --- a/kernel/exit.c
3109 +++ b/kernel/exit.c
3110 @@ -1553,8 +1553,15 @@ static int wait_consider_task(struct wait_opts *wo, int ptrace,
3111 }
3112
3113 /* dead body doesn't have much to contribute */
3114 - if (p->exit_state == EXIT_DEAD)
3115 + if (unlikely(p->exit_state == EXIT_DEAD)) {
3116 + /*
3117 + * But do not ignore this task until the tracer does
3118 + * wait_task_zombie()->do_notify_parent().
3119 + */
3120 + if (likely(!ptrace) && unlikely(ptrace_reparented(p)))
3121 + wo->notask_error = 0;
3122 return 0;
3123 + }
3124
3125 /* slay zombie? */
3126 if (p->exit_state == EXIT_ZOMBIE) {
3127 diff --git a/kernel/futex.c b/kernel/futex.c
3128 index 8b6da25..6487e4c 100644
3129 --- a/kernel/futex.c
3130 +++ b/kernel/futex.c
3131 @@ -314,17 +314,29 @@ again:
3132 #endif
3133
3134 lock_page(page_head);
3135 +
3136 + /*
3137 + * If page_head->mapping is NULL, then it cannot be a PageAnon
3138 + * page; but it might be the ZERO_PAGE or in the gate area or
3139 + * in a special mapping (all cases which we are happy to fail);
3140 + * or it may have been a good file page when get_user_pages_fast
3141 + * found it, but truncated or holepunched or subjected to
3142 + * invalidate_complete_page2 before we got the page lock (also
3143 + * cases which we are happy to fail). And we hold a reference,
3144 + * so refcount care in invalidate_complete_page's remove_mapping
3145 + * prevents drop_caches from setting mapping to NULL beneath us.
3146 + *
3147 + * The case we do have to guard against is when memory pressure made
3148 + * shmem_writepage move it from filecache to swapcache beneath us:
3149 + * an unlikely race, but we do need to retry for page_head->mapping.
3150 + */
3151 if (!page_head->mapping) {
3152 + int shmem_swizzled = PageSwapCache(page_head);
3153 unlock_page(page_head);
3154 put_page(page_head);
3155 - /*
3156 - * ZERO_PAGE pages don't have a mapping. Avoid a busy loop
3157 - * trying to find one. RW mapping would have COW'd (and thus
3158 - * have a mapping) so this page is RO and won't ever change.
3159 - */
3160 - if ((page_head == ZERO_PAGE(address)))
3161 - return -EFAULT;
3162 - goto again;
3163 + if (shmem_swizzled)
3164 + goto again;
3165 + return -EFAULT;
3166 }
3167
3168 /*
3169 diff --git a/kernel/hung_task.c b/kernel/hung_task.c
3170 index ea64012..e972276 100644
3171 --- a/kernel/hung_task.c
3172 +++ b/kernel/hung_task.c
3173 @@ -74,11 +74,17 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
3174
3175 /*
3176 * Ensure the task is not frozen.
3177 - * Also, when a freshly created task is scheduled once, changes
3178 - * its state to TASK_UNINTERRUPTIBLE without having ever been
3179 - * switched out once, it musn't be checked.
3180 + * Also, skip vfork and any other user process that freezer should skip.
3181 */
3182 - if (unlikely(t->flags & PF_FROZEN || !switch_count))
3183 + if (unlikely(t->flags & (PF_FROZEN | PF_FREEZER_SKIP)))
3184 + return;
3185 +
3186 + /*
3187 + * When a freshly created task is scheduled once, changes its state to
3188 + * TASK_UNINTERRUPTIBLE without having ever been switched out once, it
3189 + * musn't be checked.
3190 + */
3191 + if (unlikely(!switch_count))
3192 return;
3193
3194 if (switch_count != t->last_switch_count) {
3195 diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
3196 index 3b8e028..e055e8b 100644
3197 --- a/kernel/sysctl_binary.c
3198 +++ b/kernel/sysctl_binary.c
3199 @@ -1354,7 +1354,7 @@ static ssize_t binary_sysctl(const int *name, int nlen,
3200
3201 fput(file);
3202 out_putname:
3203 - putname(pathname);
3204 + __putname(pathname);
3205 out:
3206 return result;
3207 }
3208 diff --git a/mm/filemap.c b/mm/filemap.c
3209 index a8251a8..dd828ea 100644
3210 --- a/mm/filemap.c
3211 +++ b/mm/filemap.c
3212 @@ -1807,7 +1807,7 @@ repeat:
3213 page = __page_cache_alloc(gfp | __GFP_COLD);
3214 if (!page)
3215 return ERR_PTR(-ENOMEM);
3216 - err = add_to_page_cache_lru(page, mapping, index, GFP_KERNEL);
3217 + err = add_to_page_cache_lru(page, mapping, index, gfp);
3218 if (unlikely(err)) {
3219 page_cache_release(page);
3220 if (err == -EEXIST)
3221 @@ -1904,10 +1904,7 @@ static struct page *wait_on_page_read(struct page *page)
3222 * @gfp: the page allocator flags to use if allocating
3223 *
3224 * This is the same as "read_mapping_page(mapping, index, NULL)", but with
3225 - * any new page allocations done using the specified allocation flags. Note
3226 - * that the Radix tree operations will still use GFP_KERNEL, so you can't
3227 - * expect to do this atomically or anything like that - but you can pass in
3228 - * other page requirements.
3229 + * any new page allocations done using the specified allocation flags.
3230 *
3231 * If the page does not get brought uptodate, return -EIO.
3232 */
3233 diff --git a/mm/hugetlb.c b/mm/hugetlb.c
3234 index 80936a1..f9c5849 100644
3235 --- a/mm/hugetlb.c
3236 +++ b/mm/hugetlb.c
3237 @@ -901,7 +901,6 @@ retry:
3238 h->resv_huge_pages += delta;
3239 ret = 0;
3240
3241 - spin_unlock(&hugetlb_lock);
3242 /* Free the needed pages to the hugetlb pool */
3243 list_for_each_entry_safe(page, tmp, &surplus_list, lru) {
3244 if ((--needed) < 0)
3245 @@ -915,6 +914,7 @@ retry:
3246 VM_BUG_ON(page_count(page));
3247 enqueue_huge_page(h, page);
3248 }
3249 + spin_unlock(&hugetlb_lock);
3250
3251 /* Free unnecessary surplus pages to the buddy allocator */
3252 free:
3253 diff --git a/mm/memcontrol.c b/mm/memcontrol.c
3254 index 59ac5d6..d99217b 100644
3255 --- a/mm/memcontrol.c
3256 +++ b/mm/memcontrol.c
3257 @@ -4963,9 +4963,9 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
3258 int cpu;
3259 enable_swap_cgroup();
3260 parent = NULL;
3261 - root_mem_cgroup = mem;
3262 if (mem_cgroup_soft_limit_tree_init())
3263 goto free_out;
3264 + root_mem_cgroup = mem;
3265 for_each_possible_cpu(cpu) {
3266 struct memcg_stock_pcp *stock =
3267 &per_cpu(memcg_stock, cpu);
3268 @@ -5004,7 +5004,6 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
3269 return &mem->css;
3270 free_out:
3271 __mem_cgroup_free(mem);
3272 - root_mem_cgroup = NULL;
3273 return ERR_PTR(error);
3274 }
3275
3276 diff --git a/mm/oom_kill.c b/mm/oom_kill.c
3277 index 8093fc7..7c72487 100644
3278 --- a/mm/oom_kill.c
3279 +++ b/mm/oom_kill.c
3280 @@ -162,7 +162,7 @@ static bool oom_unkillable_task(struct task_struct *p,
3281 unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem,
3282 const nodemask_t *nodemask, unsigned long totalpages)
3283 {
3284 - int points;
3285 + long points;
3286
3287 if (oom_unkillable_task(p, mem, nodemask))
3288 return 0;
3289 diff --git a/mm/percpu.c b/mm/percpu.c
3290 index 93b5a7c..0ae7a09 100644
3291 --- a/mm/percpu.c
3292 +++ b/mm/percpu.c
3293 @@ -1011,9 +1011,11 @@ phys_addr_t per_cpu_ptr_to_phys(void *addr)
3294 if (!is_vmalloc_addr(addr))
3295 return __pa(addr);
3296 else
3297 - return page_to_phys(vmalloc_to_page(addr));
3298 + return page_to_phys(vmalloc_to_page(addr)) +
3299 + offset_in_page(addr);
3300 } else
3301 - return page_to_phys(pcpu_addr_to_page(addr));
3302 + return page_to_phys(pcpu_addr_to_page(addr)) +
3303 + offset_in_page(addr);
3304 }
3305
3306 /**
3307 diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
3308 index 4155abc..7d7fb20 100644
3309 --- a/net/ipv4/devinet.c
3310 +++ b/net/ipv4/devinet.c
3311 @@ -1490,7 +1490,9 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
3312 void __user *buffer,
3313 size_t *lenp, loff_t *ppos)
3314 {
3315 + int old_value = *(int *)ctl->data;
3316 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
3317 + int new_value = *(int *)ctl->data;
3318
3319 if (write) {
3320 struct ipv4_devconf *cnf = ctl->extra1;
3321 @@ -1501,6 +1503,9 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
3322
3323 if (cnf == net->ipv4.devconf_dflt)
3324 devinet_copy_dflt_conf(net, i);
3325 + if (i == IPV4_DEVCONF_ACCEPT_LOCAL - 1)
3326 + if ((new_value == 0) && (old_value != 0))
3327 + rt_cache_flush(net, 0);
3328 }
3329
3330 return ret;
3331 diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
3332 index ab7e554..7fbcaba 100644
3333 --- a/net/ipv4/ipconfig.c
3334 +++ b/net/ipv4/ipconfig.c
3335 @@ -252,6 +252,10 @@ static int __init ic_open_devs(void)
3336 }
3337 }
3338
3339 + /* no point in waiting if we could not bring up at least one device */
3340 + if (!ic_first_dev)
3341 + goto have_carrier;
3342 +
3343 /* wait for a carrier on at least one device */
3344 start = jiffies;
3345 while (jiffies - start < msecs_to_jiffies(CONF_CARRIER_TIMEOUT)) {
3346 diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
3347 index 378b20b..6f06f7f 100644
3348 --- a/net/ipv4/ipip.c
3349 +++ b/net/ipv4/ipip.c
3350 @@ -285,6 +285,8 @@ static struct ip_tunnel * ipip_tunnel_locate(struct net *net,
3351 if (register_netdevice(dev) < 0)
3352 goto failed_free;
3353
3354 + strcpy(nt->parms.name, dev->name);
3355 +
3356 dev_hold(dev);
3357 ipip_tunnel_link(ipn, nt);
3358 return nt;
3359 @@ -759,7 +761,6 @@ static int ipip_tunnel_init(struct net_device *dev)
3360 struct ip_tunnel *tunnel = netdev_priv(dev);
3361
3362 tunnel->dev = dev;
3363 - strcpy(tunnel->parms.name, dev->name);
3364
3365 memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4);
3366 memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
3367 @@ -825,6 +826,7 @@ static void ipip_destroy_tunnels(struct ipip_net *ipn, struct list_head *head)
3368 static int __net_init ipip_init_net(struct net *net)
3369 {
3370 struct ipip_net *ipn = net_generic(net, ipip_net_id);
3371 + struct ip_tunnel *t;
3372 int err;
3373
3374 ipn->tunnels[0] = ipn->tunnels_wc;
3375 @@ -848,6 +850,9 @@ static int __net_init ipip_init_net(struct net *net)
3376 if ((err = register_netdev(ipn->fb_tunnel_dev)))
3377 goto err_reg_dev;
3378
3379 + t = netdev_priv(ipn->fb_tunnel_dev);
3380 +
3381 + strcpy(t->parms.name, ipn->fb_tunnel_dev->name);
3382 return 0;
3383
3384 err_reg_dev:
3385 diff --git a/net/ipv4/route.c b/net/ipv4/route.c
3386 index 75ef66f..4845bfe 100644
3387 --- a/net/ipv4/route.c
3388 +++ b/net/ipv4/route.c
3389 @@ -91,6 +91,7 @@
3390 #include <linux/rcupdate.h>
3391 #include <linux/times.h>
3392 #include <linux/slab.h>
3393 +#include <linux/prefetch.h>
3394 #include <net/dst.h>
3395 #include <net/net_namespace.h>
3396 #include <net/protocol.h>
3397 @@ -132,6 +133,9 @@ static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20;
3398 static int ip_rt_min_advmss __read_mostly = 256;
3399 static int rt_chain_length_max __read_mostly = 20;
3400
3401 +static struct delayed_work expires_work;
3402 +static unsigned long expires_ljiffies;
3403 +
3404 /*
3405 * Interface to generic destination cache.
3406 */
3407 @@ -821,6 +825,97 @@ static int has_noalias(const struct rtable *head, const struct rtable *rth)
3408 return ONE;
3409 }
3410
3411 +static void rt_check_expire(void)
3412 +{
3413 + static unsigned int rover;
3414 + unsigned int i = rover, goal;
3415 + struct rtable *rth;
3416 + struct rtable __rcu **rthp;
3417 + unsigned long samples = 0;
3418 + unsigned long sum = 0, sum2 = 0;
3419 + unsigned long delta;
3420 + u64 mult;
3421 +
3422 + delta = jiffies - expires_ljiffies;
3423 + expires_ljiffies = jiffies;
3424 + mult = ((u64)delta) << rt_hash_log;
3425 + if (ip_rt_gc_timeout > 1)
3426 + do_div(mult, ip_rt_gc_timeout);
3427 + goal = (unsigned int)mult;
3428 + if (goal > rt_hash_mask)
3429 + goal = rt_hash_mask + 1;
3430 + for (; goal > 0; goal--) {
3431 + unsigned long tmo = ip_rt_gc_timeout;
3432 + unsigned long length;
3433 +
3434 + i = (i + 1) & rt_hash_mask;
3435 + rthp = &rt_hash_table[i].chain;
3436 +
3437 + if (need_resched())
3438 + cond_resched();
3439 +
3440 + samples++;
3441 +
3442 + if (rcu_dereference_raw(*rthp) == NULL)
3443 + continue;
3444 + length = 0;
3445 + spin_lock_bh(rt_hash_lock_addr(i));
3446 + while ((rth = rcu_dereference_protected(*rthp,
3447 + lockdep_is_held(rt_hash_lock_addr(i)))) != NULL) {
3448 + prefetch(rth->dst.rt_next);
3449 + if (rt_is_expired(rth)) {
3450 + *rthp = rth->dst.rt_next;
3451 + rt_free(rth);
3452 + continue;
3453 + }
3454 + if (rth->dst.expires) {
3455 + /* Entry is expired even if it is in use */
3456 + if (time_before_eq(jiffies, rth->dst.expires)) {
3457 +nofree:
3458 + tmo >>= 1;
3459 + rthp = &rth->dst.rt_next;
3460 + /*
3461 + * We only count entries on
3462 + * a chain with equal hash inputs once
3463 + * so that entries for different QOS
3464 + * levels, and other non-hash input
3465 + * attributes don't unfairly skew
3466 + * the length computation
3467 + */
3468 + length += has_noalias(rt_hash_table[i].chain, rth);
3469 + continue;
3470 + }
3471 + } else if (!rt_may_expire(rth, tmo, ip_rt_gc_timeout))
3472 + goto nofree;
3473 +
3474 + /* Cleanup aged off entries. */
3475 + *rthp = rth->dst.rt_next;
3476 + rt_free(rth);
3477 + }
3478 + spin_unlock_bh(rt_hash_lock_addr(i));
3479 + sum += length;
3480 + sum2 += length*length;
3481 + }
3482 + if (samples) {
3483 + unsigned long avg = sum / samples;
3484 + unsigned long sd = int_sqrt(sum2 / samples - avg*avg);
3485 + rt_chain_length_max = max_t(unsigned long,
3486 + ip_rt_gc_elasticity,
3487 + (avg + 4*sd) >> FRACT_BITS);
3488 + }
3489 + rover = i;
3490 +}
3491 +
3492 +/*
3493 + * rt_worker_func() is run in process context.
3494 + * we call rt_check_expire() to scan part of the hash table
3495 + */
3496 +static void rt_worker_func(struct work_struct *work)
3497 +{
3498 + rt_check_expire();
3499 + schedule_delayed_work(&expires_work, ip_rt_gc_interval);
3500 +}
3501 +
3502 /*
3503 * Perturbation of rt_genid by a small quantity [1..256]
3504 * Using 8 bits of shuffling ensure we can call rt_cache_invalidate()
3505 @@ -3088,6 +3183,13 @@ static ctl_table ipv4_route_table[] = {
3506 .proc_handler = proc_dointvec_jiffies,
3507 },
3508 {
3509 + .procname = "gc_interval",
3510 + .data = &ip_rt_gc_interval,
3511 + .maxlen = sizeof(int),
3512 + .mode = 0644,
3513 + .proc_handler = proc_dointvec_jiffies,
3514 + },
3515 + {
3516 .procname = "redirect_load",
3517 .data = &ip_rt_redirect_load,
3518 .maxlen = sizeof(int),
3519 @@ -3297,6 +3399,11 @@ int __init ip_rt_init(void)
3520 devinet_init();
3521 ip_fib_init();
3522
3523 + INIT_DELAYED_WORK_DEFERRABLE(&expires_work, rt_worker_func);
3524 + expires_ljiffies = jiffies;
3525 + schedule_delayed_work(&expires_work,
3526 + net_random() % ip_rt_gc_interval + ip_rt_gc_interval);
3527 +
3528 if (ip_rt_proc_init())
3529 printk(KERN_ERR "Unable to create route proc files\n");
3530 #ifdef CONFIG_XFRM
3531 diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
3532 index 1cca576..38490d5 100644
3533 --- a/net/ipv6/sit.c
3534 +++ b/net/ipv6/sit.c
3535 @@ -263,6 +263,8 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net,
3536 if (register_netdevice(dev) < 0)
3537 goto failed_free;
3538
3539 + strcpy(nt->parms.name, dev->name);
3540 +
3541 dev_hold(dev);
3542
3543 ipip6_tunnel_link(sitn, nt);
3544 @@ -1141,7 +1143,6 @@ static int ipip6_tunnel_init(struct net_device *dev)
3545 struct ip_tunnel *tunnel = netdev_priv(dev);
3546
3547 tunnel->dev = dev;
3548 - strcpy(tunnel->parms.name, dev->name);
3549
3550 memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4);
3551 memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
3552 @@ -1204,6 +1205,7 @@ static void __net_exit sit_destroy_tunnels(struct sit_net *sitn, struct list_hea
3553 static int __net_init sit_init_net(struct net *net)
3554 {
3555 struct sit_net *sitn = net_generic(net, sit_net_id);
3556 + struct ip_tunnel *t;
3557 int err;
3558
3559 sitn->tunnels[0] = sitn->tunnels_wc;
3560 @@ -1228,6 +1230,9 @@ static int __net_init sit_init_net(struct net *net)
3561 if ((err = register_netdev(sitn->fb_tunnel_dev)))
3562 goto err_reg_dev;
3563
3564 + t = netdev_priv(sitn->fb_tunnel_dev);
3565 +
3566 + strcpy(t->parms.name, sitn->fb_tunnel_dev->name);
3567 return 0;
3568
3569 err_reg_dev:
3570 diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
3571 index dfd3a64..a18e6c3 100644
3572 --- a/net/llc/af_llc.c
3573 +++ b/net/llc/af_llc.c
3574 @@ -833,15 +833,15 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
3575 copied += used;
3576 len -= used;
3577
3578 + /* For non stream protcols we get one packet per recvmsg call */
3579 + if (sk->sk_type != SOCK_STREAM)
3580 + goto copy_uaddr;
3581 +
3582 if (!(flags & MSG_PEEK)) {
3583 sk_eat_skb(sk, skb, 0);
3584 *seq = 0;
3585 }
3586
3587 - /* For non stream protcols we get one packet per recvmsg call */
3588 - if (sk->sk_type != SOCK_STREAM)
3589 - goto copy_uaddr;
3590 -
3591 /* Partial read */
3592 if (used + offset < skb->len)
3593 continue;
3594 @@ -857,6 +857,12 @@ copy_uaddr:
3595 }
3596 if (llc_sk(sk)->cmsg_flags)
3597 llc_cmsg_rcv(msg, skb);
3598 +
3599 + if (!(flags & MSG_PEEK)) {
3600 + sk_eat_skb(sk, skb, 0);
3601 + *seq = 0;
3602 + }
3603 +
3604 goto out;
3605 }
3606
3607 diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
3608 index db7db43..b7f4f5c 100644
3609 --- a/net/mac80211/agg-tx.c
3610 +++ b/net/mac80211/agg-tx.c
3611 @@ -304,6 +304,38 @@ ieee80211_wake_queue_agg(struct ieee80211_local *local, int tid)
3612 __release(agg_queue);
3613 }
3614
3615 +/*
3616 + * splice packets from the STA's pending to the local pending,
3617 + * requires a call to ieee80211_agg_splice_finish later
3618 + */
3619 +static void __acquires(agg_queue)
3620 +ieee80211_agg_splice_packets(struct ieee80211_local *local,
3621 + struct tid_ampdu_tx *tid_tx, u16 tid)
3622 +{
3623 + int queue = ieee80211_ac_from_tid(tid);
3624 + unsigned long flags;
3625 +
3626 + ieee80211_stop_queue_agg(local, tid);
3627 +
3628 + if (WARN(!tid_tx, "TID %d gone but expected when splicing aggregates"
3629 + " from the pending queue\n", tid))
3630 + return;
3631 +
3632 + if (!skb_queue_empty(&tid_tx->pending)) {
3633 + spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
3634 + /* copy over remaining packets */
3635 + skb_queue_splice_tail_init(&tid_tx->pending,
3636 + &local->pending[queue]);
3637 + spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
3638 + }
3639 +}
3640 +
3641 +static void __releases(agg_queue)
3642 +ieee80211_agg_splice_finish(struct ieee80211_local *local, u16 tid)
3643 +{
3644 + ieee80211_wake_queue_agg(local, tid);
3645 +}
3646 +
3647 void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
3648 {
3649 struct tid_ampdu_tx *tid_tx;
3650 @@ -315,19 +347,17 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
3651 tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
3652
3653 /*
3654 - * While we're asking the driver about the aggregation,
3655 - * stop the AC queue so that we don't have to worry
3656 - * about frames that came in while we were doing that,
3657 - * which would require us to put them to the AC pending
3658 - * afterwards which just makes the code more complex.
3659 + * Start queuing up packets for this aggregation session.
3660 + * We're going to release them once the driver is OK with
3661 + * that.
3662 */
3663 - ieee80211_stop_queue_agg(local, tid);
3664 -
3665 clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state);
3666
3667 /*
3668 - * make sure no packets are being processed to get
3669 - * valid starting sequence number
3670 + * Make sure no packets are being processed. This ensures that
3671 + * we have a valid starting sequence number and that in-flight
3672 + * packets have been flushed out and no packets for this TID
3673 + * will go into the driver during the ampdu_action call.
3674 */
3675 synchronize_net();
3676
3677 @@ -341,17 +371,15 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
3678 " tid %d\n", tid);
3679 #endif
3680 spin_lock_bh(&sta->lock);
3681 + ieee80211_agg_splice_packets(local, tid_tx, tid);
3682 ieee80211_assign_tid_tx(sta, tid, NULL);
3683 + ieee80211_agg_splice_finish(local, tid);
3684 spin_unlock_bh(&sta->lock);
3685
3686 - ieee80211_wake_queue_agg(local, tid);
3687 kfree_rcu(tid_tx, rcu_head);
3688 return;
3689 }
3690
3691 - /* we can take packets again now */
3692 - ieee80211_wake_queue_agg(local, tid);
3693 -
3694 /* activate the timer for the recipient's addBA response */
3695 mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL);
3696 #ifdef CONFIG_MAC80211_HT_DEBUG
3697 @@ -471,38 +499,6 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
3698 }
3699 EXPORT_SYMBOL(ieee80211_start_tx_ba_session);
3700
3701 -/*
3702 - * splice packets from the STA's pending to the local pending,
3703 - * requires a call to ieee80211_agg_splice_finish later
3704 - */
3705 -static void __acquires(agg_queue)
3706 -ieee80211_agg_splice_packets(struct ieee80211_local *local,
3707 - struct tid_ampdu_tx *tid_tx, u16 tid)
3708 -{
3709 - int queue = ieee80211_ac_from_tid(tid);
3710 - unsigned long flags;
3711 -
3712 - ieee80211_stop_queue_agg(local, tid);
3713 -
3714 - if (WARN(!tid_tx, "TID %d gone but expected when splicing aggregates"
3715 - " from the pending queue\n", tid))
3716 - return;
3717 -
3718 - if (!skb_queue_empty(&tid_tx->pending)) {
3719 - spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
3720 - /* copy over remaining packets */
3721 - skb_queue_splice_tail_init(&tid_tx->pending,
3722 - &local->pending[queue]);
3723 - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
3724 - }
3725 -}
3726 -
3727 -static void __releases(agg_queue)
3728 -ieee80211_agg_splice_finish(struct ieee80211_local *local, u16 tid)
3729 -{
3730 - ieee80211_wake_queue_agg(local, tid);
3731 -}
3732 -
3733 static void ieee80211_agg_tx_operational(struct ieee80211_local *local,
3734 struct sta_info *sta, u16 tid)
3735 {
3736 diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
3737 index b9493a0..6cd8ddf 100644
3738 --- a/net/sched/sch_gred.c
3739 +++ b/net/sched/sch_gred.c
3740 @@ -385,7 +385,7 @@ static inline int gred_change_vq(struct Qdisc *sch, int dp,
3741 struct gred_sched_data *q;
3742
3743 if (table->tab[dp] == NULL) {
3744 - table->tab[dp] = kzalloc(sizeof(*q), GFP_KERNEL);
3745 + table->tab[dp] = kzalloc(sizeof(*q), GFP_ATOMIC);
3746 if (table->tab[dp] == NULL)
3747 return -ENOMEM;
3748 }
3749 diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c
3750 index ea17cbe..59b26b8 100644
3751 --- a/net/sched/sch_mqprio.c
3752 +++ b/net/sched/sch_mqprio.c
3753 @@ -106,7 +106,7 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt)
3754 if (!netif_is_multiqueue(dev))
3755 return -EOPNOTSUPP;
3756
3757 - if (nla_len(opt) < sizeof(*qopt))
3758 + if (!opt || nla_len(opt) < sizeof(*qopt))
3759 return -EINVAL;
3760
3761 qopt = nla_data(opt);
3762 diff --git a/net/sctp/associola.c b/net/sctp/associola.c
3763 index 4a62888..17a6e65 100644
3764 --- a/net/sctp/associola.c
3765 +++ b/net/sctp/associola.c
3766 @@ -173,7 +173,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
3767 asoc->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0;
3768 asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay;
3769 asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] =
3770 - (unsigned long)sp->autoclose * HZ;
3771 + min_t(unsigned long, sp->autoclose, sctp_max_autoclose) * HZ;
3772
3773 /* Initializes the timers */
3774 for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i)
3775 diff --git a/net/sctp/output.c b/net/sctp/output.c
3776 index 08b3cea..817174e 100644
3777 --- a/net/sctp/output.c
3778 +++ b/net/sctp/output.c
3779 @@ -697,13 +697,7 @@ static void sctp_packet_append_data(struct sctp_packet *packet,
3780 /* Keep track of how many bytes are in flight to the receiver. */
3781 asoc->outqueue.outstanding_bytes += datasize;
3782
3783 - /* Update our view of the receiver's rwnd. Include sk_buff overhead
3784 - * while updating peer.rwnd so that it reduces the chances of a
3785 - * receiver running out of receive buffer space even when receive
3786 - * window is still open. This can happen when a sender is sending
3787 - * sending small messages.
3788 - */
3789 - datasize += sizeof(struct sk_buff);
3790 + /* Update our view of the receiver's rwnd. */
3791 if (datasize < rwnd)
3792 rwnd -= datasize;
3793 else
3794 diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
3795 index d036821..1f2938f 100644
3796 --- a/net/sctp/outqueue.c
3797 +++ b/net/sctp/outqueue.c
3798 @@ -411,8 +411,7 @@ void sctp_retransmit_mark(struct sctp_outq *q,
3799 chunk->transport->flight_size -=
3800 sctp_data_size(chunk);
3801 q->outstanding_bytes -= sctp_data_size(chunk);
3802 - q->asoc->peer.rwnd += (sctp_data_size(chunk) +
3803 - sizeof(struct sk_buff));
3804 + q->asoc->peer.rwnd += sctp_data_size(chunk);
3805 }
3806 continue;
3807 }
3808 @@ -432,8 +431,7 @@ void sctp_retransmit_mark(struct sctp_outq *q,
3809 * (Section 7.2.4)), add the data size of those
3810 * chunks to the rwnd.
3811 */
3812 - q->asoc->peer.rwnd += (sctp_data_size(chunk) +
3813 - sizeof(struct sk_buff));
3814 + q->asoc->peer.rwnd += sctp_data_size(chunk);
3815 q->outstanding_bytes -= sctp_data_size(chunk);
3816 if (chunk->transport)
3817 transport->flight_size -= sctp_data_size(chunk);
3818 diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
3819 index 207175b..946afd6 100644
3820 --- a/net/sctp/protocol.c
3821 +++ b/net/sctp/protocol.c
3822 @@ -1144,6 +1144,9 @@ SCTP_STATIC __init int sctp_init(void)
3823 sctp_max_instreams = SCTP_DEFAULT_INSTREAMS;
3824 sctp_max_outstreams = SCTP_DEFAULT_OUTSTREAMS;
3825
3826 + /* Initialize maximum autoclose timeout. */
3827 + sctp_max_autoclose = INT_MAX / HZ;
3828 +
3829 /* Initialize handle used for association ids. */
3830 idr_init(&sctp_assocs_id);
3831
3832 diff --git a/net/sctp/socket.c b/net/sctp/socket.c
3833 index d3ccf79..fa9b5c7 100644
3834 --- a/net/sctp/socket.c
3835 +++ b/net/sctp/socket.c
3836 @@ -2129,8 +2129,6 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval,
3837 return -EINVAL;
3838 if (copy_from_user(&sp->autoclose, optval, optlen))
3839 return -EFAULT;
3840 - /* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */
3841 - sp->autoclose = min_t(long, sp->autoclose, MAX_SCHEDULE_TIMEOUT / HZ);
3842
3843 return 0;
3844 }
3845 diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
3846 index 50cb57f..6752f48 100644
3847 --- a/net/sctp/sysctl.c
3848 +++ b/net/sctp/sysctl.c
3849 @@ -53,6 +53,10 @@ static int sack_timer_min = 1;
3850 static int sack_timer_max = 500;
3851 static int addr_scope_max = 3; /* check sctp_scope_policy_t in include/net/sctp/constants.h for max entries */
3852 static int rwnd_scale_max = 16;
3853 +static unsigned long max_autoclose_min = 0;
3854 +static unsigned long max_autoclose_max =
3855 + (MAX_SCHEDULE_TIMEOUT / HZ > UINT_MAX)
3856 + ? UINT_MAX : MAX_SCHEDULE_TIMEOUT / HZ;
3857
3858 extern long sysctl_sctp_mem[3];
3859 extern int sysctl_sctp_rmem[3];
3860 @@ -251,6 +255,15 @@ static ctl_table sctp_table[] = {
3861 .extra1 = &one,
3862 .extra2 = &rwnd_scale_max,
3863 },
3864 + {
3865 + .procname = "max_autoclose",
3866 + .data = &sctp_max_autoclose,
3867 + .maxlen = sizeof(unsigned long),
3868 + .mode = 0644,
3869 + .proc_handler = &proc_doulongvec_minmax,
3870 + .extra1 = &max_autoclose_min,
3871 + .extra2 = &max_autoclose_max,
3872 + },
3873
3874 { /* sentinel */ }
3875 };
3876 diff --git a/security/selinux/netport.c b/security/selinux/netport.c
3877 index cfe2d72..e2b74eb 100644
3878 --- a/security/selinux/netport.c
3879 +++ b/security/selinux/netport.c
3880 @@ -139,7 +139,9 @@ static void sel_netport_insert(struct sel_netport *port)
3881 if (sel_netport_hash[idx].size == SEL_NETPORT_HASH_BKT_LIMIT) {
3882 struct sel_netport *tail;
3883 tail = list_entry(
3884 - rcu_dereference(sel_netport_hash[idx].list.prev),
3885 + rcu_dereference_protected(
3886 + sel_netport_hash[idx].list.prev,
3887 + lockdep_is_held(&sel_netport_lock)),
3888 struct sel_netport, list);
3889 list_del_rcu(&tail->list);
3890 call_rcu(&tail->rcu, sel_netport_free);

  ViewVC Help
Powered by ViewVC 1.1.20