/[linux-patches]/genpatches-2.6/tags/2.6.32-15/1001_linux-2.6.32.2.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.32-15/1001_linux-2.6.32.2.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1735 - (show annotations) (download)
Wed Aug 4 11:25:09 2010 UTC (4 years, 4 months ago) by mpagano
File size: 182817 byte(s)
2.6.32-15 release
1 diff --git a/Documentation/Changes b/Documentation/Changes
2 index 6d0f1ef..f08b313 100644
3 --- a/Documentation/Changes
4 +++ b/Documentation/Changes
5 @@ -49,6 +49,8 @@ o oprofile 0.9 # oprofiled --version
6 o udev 081 # udevinfo -V
7 o grub 0.93 # grub --version
8 o mcelog 0.6
9 +o iptables 1.4.1 # iptables -V
10 +
11
12 Kernel compilation
13 ==================
14 diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
15 index 9107b38..5bc4eaa 100644
16 --- a/Documentation/kernel-parameters.txt
17 +++ b/Documentation/kernel-parameters.txt
18 @@ -2645,6 +2645,8 @@ and is between 256 and 4096 characters. It is defined in the file
19 to a common usb-storage quirk flag as follows:
20 a = SANE_SENSE (collect more than 18 bytes
21 of sense data);
22 + b = BAD_SENSE (don't collect more than 18
23 + bytes of sense data);
24 c = FIX_CAPACITY (decrease the reported
25 device capacity by one sector);
26 h = CAPACITY_HEURISTICS (decrease the
27 diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt
28 index 3f61825..90e85a8 100644
29 --- a/Documentation/video4linux/gspca.txt
30 +++ b/Documentation/video4linux/gspca.txt
31 @@ -37,6 +37,7 @@ ov519 041e:405f Creative Live! VISTA VF0330
32 ov519 041e:4060 Creative Live! VISTA VF0350
33 ov519 041e:4061 Creative Live! VISTA VF0400
34 ov519 041e:4064 Creative Live! VISTA VF0420
35 +ov519 041e:4067 Creative Live! Cam Video IM (VF0350)
36 ov519 041e:4068 Creative Live! VISTA VF0470
37 spca561 0458:7004 Genius VideoCAM Express V2
38 sunplus 0458:7006 Genius Dsc 1.3 Smart
39 diff --git a/MAINTAINERS b/MAINTAINERS
40 index 4f96ac8..c57d396 100644
41 --- a/MAINTAINERS
42 +++ b/MAINTAINERS
43 @@ -5594,9 +5594,11 @@ S: Maintained
44 F: drivers/net/wireless/rndis_wlan.c
45
46 USB XHCI DRIVER
47 -M: Sarah Sharp <sarah.a.sharp@intel.com>
48 +M: Sarah Sharp <sarah.a.sharp@linux.intel.com>
49 L: linux-usb@vger.kernel.org
50 S: Supported
51 +F: drivers/usb/host/xhci*
52 +F: drivers/usb/host/pci-quirks*
53
54 USB ZC0301 DRIVER
55 M: Luca Risolia <luca.risolia@studio.unibo.it>
56 diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
57 index aec7f42..86a8732 100644
58 --- a/arch/arm/mach-pxa/em-x270.c
59 +++ b/arch/arm/mach-pxa/em-x270.c
60 @@ -497,16 +497,15 @@ static int em_x270_usb_hub_init(void)
61 goto err_free_vbus_gpio;
62
63 /* USB Hub power-on and reset */
64 - gpio_direction_output(usb_hub_reset, 0);
65 + gpio_direction_output(usb_hub_reset, 1);
66 + gpio_direction_output(GPIO9_USB_VBUS_EN, 0);
67 regulator_enable(em_x270_usb_ldo);
68 - gpio_set_value(usb_hub_reset, 1);
69 gpio_set_value(usb_hub_reset, 0);
70 + gpio_set_value(usb_hub_reset, 1);
71 regulator_disable(em_x270_usb_ldo);
72 regulator_enable(em_x270_usb_ldo);
73 - gpio_set_value(usb_hub_reset, 1);
74 -
75 - /* enable VBUS */
76 - gpio_direction_output(GPIO9_USB_VBUS_EN, 1);
77 + gpio_set_value(usb_hub_reset, 0);
78 + gpio_set_value(GPIO9_USB_VBUS_EN, 1);
79
80 return 0;
81
82 diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
83 index 0d9d16e..cc8335e 100644
84 --- a/arch/ia64/include/asm/io.h
85 +++ b/arch/ia64/include/asm/io.h
86 @@ -424,6 +424,8 @@ __writeq (unsigned long val, volatile void __iomem *addr)
87 extern void __iomem * ioremap(unsigned long offset, unsigned long size);
88 extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size);
89 extern void iounmap (volatile void __iomem *addr);
90 +extern void __iomem * early_ioremap (unsigned long phys_addr, unsigned long size);
91 +extern void early_iounmap (volatile void __iomem *addr, unsigned long size);
92
93 /*
94 * String version of IO memory access ops:
95 diff --git a/arch/ia64/mm/ioremap.c b/arch/ia64/mm/ioremap.c
96 index 2a14062..3dccdd8 100644
97 --- a/arch/ia64/mm/ioremap.c
98 +++ b/arch/ia64/mm/ioremap.c
99 @@ -22,6 +22,12 @@ __ioremap (unsigned long phys_addr)
100 }
101
102 void __iomem *
103 +early_ioremap (unsigned long phys_addr, unsigned long size)
104 +{
105 + return __ioremap(phys_addr);
106 +}
107 +
108 +void __iomem *
109 ioremap (unsigned long phys_addr, unsigned long size)
110 {
111 void __iomem *addr;
112 @@ -102,6 +108,11 @@ ioremap_nocache (unsigned long phys_addr, unsigned long size)
113 EXPORT_SYMBOL(ioremap_nocache);
114
115 void
116 +early_iounmap (volatile void __iomem *addr, unsigned long size)
117 +{
118 +}
119 +
120 +void
121 iounmap (volatile void __iomem *addr)
122 {
123 if (REGION_NUMBER(addr) == RGN_GATE)
124 diff --git a/arch/powerpc/kernel/vector.S b/arch/powerpc/kernel/vector.S
125 index 67b6916..fe46048 100644
126 --- a/arch/powerpc/kernel/vector.S
127 +++ b/arch/powerpc/kernel/vector.S
128 @@ -58,7 +58,7 @@ _GLOBAL(load_up_altivec)
129 * all 1's
130 */
131 mfspr r4,SPRN_VRSAVE
132 - cmpdi 0,r4,0
133 + cmpwi 0,r4,0
134 bne+ 1f
135 li r4,-1
136 mtspr SPRN_VRSAVE,r4
137 diff --git a/arch/s390/include/asm/kvm.h b/arch/s390/include/asm/kvm.h
138 index 3dfcaeb..82b32a1 100644
139 --- a/arch/s390/include/asm/kvm.h
140 +++ b/arch/s390/include/asm/kvm.h
141 @@ -1,6 +1,5 @@
142 #ifndef __LINUX_KVM_S390_H
143 #define __LINUX_KVM_S390_H
144 -
145 /*
146 * asm-s390/kvm.h - KVM s390 specific structures and definitions
147 *
148 @@ -15,6 +14,8 @@
149 */
150 #include <linux/types.h>
151
152 +#define __KVM_S390
153 +
154 /* for KVM_GET_REGS and KVM_SET_REGS */
155 struct kvm_regs {
156 /* general purpose regs for s390 */
157 diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
158 index 6a25080..d984a2a 100644
159 --- a/arch/s390/kernel/head64.S
160 +++ b/arch/s390/kernel/head64.S
161 @@ -83,6 +83,8 @@ startup_continue:
162 slr %r0,%r0 # set cpuid to zero
163 sigp %r1,%r0,0x12 # switch to esame mode
164 sam64 # switch to 64 bit mode
165 + llgfr %r13,%r13 # clear high-order half of base reg
166 + lmh %r0,%r15,.Lzero64-.LPG1(%r13) # clear high-order half
167 lctlg %c0,%c15,.Lctl-.LPG1(%r13) # load control registers
168 lg %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area
169 # move IPL device to lowcore
170 @@ -127,6 +129,7 @@ startup_continue:
171 .L4malign:.quad 0xffffffffffc00000
172 .Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8
173 .Lnop: .long 0x07000700
174 +.Lzero64:.fill 16,4,0x0
175 #ifdef CONFIG_ZFCPDUMP
176 .Lcurrent_cpu:
177 .long 0x0
178 diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
179 index 07ced89..ca2d312 100644
180 --- a/arch/s390/kvm/kvm-s390.c
181 +++ b/arch/s390/kvm/kvm-s390.c
182 @@ -116,10 +116,16 @@ long kvm_arch_dev_ioctl(struct file *filp,
183
184 int kvm_dev_ioctl_check_extension(long ext)
185 {
186 + int r;
187 +
188 switch (ext) {
189 + case KVM_CAP_S390_PSW:
190 + r = 1;
191 + break;
192 default:
193 - return 0;
194 + r = 0;
195 }
196 + return r;
197 }
198
199 /* Section: vm related */
200 @@ -419,8 +425,10 @@ static int kvm_arch_vcpu_ioctl_set_initial_psw(struct kvm_vcpu *vcpu, psw_t psw)
201 vcpu_load(vcpu);
202 if (atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_RUNNING)
203 rc = -EBUSY;
204 - else
205 - vcpu->arch.sie_block->gpsw = psw;
206 + else {
207 + vcpu->run->psw_mask = psw.mask;
208 + vcpu->run->psw_addr = psw.addr;
209 + }
210 vcpu_put(vcpu);
211 return rc;
212 }
213 @@ -508,9 +516,6 @@ rerun_vcpu:
214
215 switch (kvm_run->exit_reason) {
216 case KVM_EXIT_S390_SIEIC:
217 - vcpu->arch.sie_block->gpsw.mask = kvm_run->s390_sieic.mask;
218 - vcpu->arch.sie_block->gpsw.addr = kvm_run->s390_sieic.addr;
219 - break;
220 case KVM_EXIT_UNKNOWN:
221 case KVM_EXIT_INTR:
222 case KVM_EXIT_S390_RESET:
223 @@ -519,6 +524,9 @@ rerun_vcpu:
224 BUG();
225 }
226
227 + vcpu->arch.sie_block->gpsw.mask = kvm_run->psw_mask;
228 + vcpu->arch.sie_block->gpsw.addr = kvm_run->psw_addr;
229 +
230 might_fault();
231
232 do {
233 @@ -538,8 +546,6 @@ rerun_vcpu:
234 /* intercept cannot be handled in-kernel, prepare kvm-run */
235 kvm_run->exit_reason = KVM_EXIT_S390_SIEIC;
236 kvm_run->s390_sieic.icptcode = vcpu->arch.sie_block->icptcode;
237 - kvm_run->s390_sieic.mask = vcpu->arch.sie_block->gpsw.mask;
238 - kvm_run->s390_sieic.addr = vcpu->arch.sie_block->gpsw.addr;
239 kvm_run->s390_sieic.ipa = vcpu->arch.sie_block->ipa;
240 kvm_run->s390_sieic.ipb = vcpu->arch.sie_block->ipb;
241 rc = 0;
242 @@ -551,6 +557,9 @@ rerun_vcpu:
243 rc = 0;
244 }
245
246 + kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask;
247 + kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr;
248 +
249 if (vcpu->sigset_active)
250 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
251
252 diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
253 index 40c8c67..15ee111 100644
254 --- a/arch/s390/kvm/sigp.c
255 +++ b/arch/s390/kvm/sigp.c
256 @@ -188,9 +188,9 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address,
257
258 /* make sure that the new value is valid memory */
259 address = address & 0x7fffe000u;
260 - if ((copy_from_guest(vcpu, &tmp,
261 - (u64) (address + vcpu->arch.sie_block->gmsor) , 1)) ||
262 - (copy_from_guest(vcpu, &tmp, (u64) (address +
263 + if ((copy_from_user(&tmp, (void __user *)
264 + (address + vcpu->arch.sie_block->gmsor) , 1)) ||
265 + (copy_from_user(&tmp, (void __user *)(address +
266 vcpu->arch.sie_block->gmsor + PAGE_SIZE), 1))) {
267 *reg |= SIGP_STAT_INVALID_PARAMETER;
268 return 1; /* invalid parameter */
269 diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
270 index dfe272d..113225b 100644
271 --- a/arch/sparc/Makefile
272 +++ b/arch/sparc/Makefile
273 @@ -27,6 +27,7 @@ AS := $(AS) -32
274 LDFLAGS := -m elf32_sparc
275 CHECKFLAGS += -D__sparc__
276 export BITS := 32
277 +UTS_MACHINE := sparc
278
279 #KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7
280 KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
281 @@ -46,6 +47,7 @@ CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64
282
283 LDFLAGS := -m elf64_sparc
284 export BITS := 64
285 +UTS_MACHINE := sparc64
286
287 KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \
288 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \
289 diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c
290 index cb3c72c..e0ba898 100644
291 --- a/arch/sparc/kernel/ldc.c
292 +++ b/arch/sparc/kernel/ldc.c
293 @@ -1242,13 +1242,13 @@ int ldc_bind(struct ldc_channel *lp, const char *name)
294 snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name);
295
296 err = request_irq(lp->cfg.rx_irq, ldc_rx,
297 - IRQF_SAMPLE_RANDOM | IRQF_DISABLED | IRQF_SHARED,
298 + IRQF_SAMPLE_RANDOM | IRQF_DISABLED,
299 lp->rx_irq_name, lp);
300 if (err)
301 return err;
302
303 err = request_irq(lp->cfg.tx_irq, ldc_tx,
304 - IRQF_SAMPLE_RANDOM | IRQF_DISABLED | IRQF_SHARED,
305 + IRQF_SAMPLE_RANDOM | IRQF_DISABLED,
306 lp->tx_irq_name, lp);
307 if (err) {
308 free_irq(lp->cfg.rx_irq, lp);
309 diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
310 index 881947e..0a6f2d1 100644
311 --- a/arch/sparc/kernel/of_device_64.c
312 +++ b/arch/sparc/kernel/of_device_64.c
313 @@ -104,9 +104,19 @@ static int of_bus_pci_map(u32 *addr, const u32 *range,
314 int i;
315
316 /* Check address type match */
317 - if ((addr[0] ^ range[0]) & 0x03000000)
318 - return -EINVAL;
319 + if (!((addr[0] ^ range[0]) & 0x03000000))
320 + goto type_match;
321 +
322 + /* Special exception, we can map a 64-bit address into
323 + * a 32-bit range.
324 + */
325 + if ((addr[0] & 0x03000000) == 0x03000000 &&
326 + (range[0] & 0x03000000) == 0x02000000)
327 + goto type_match;
328 +
329 + return -EINVAL;
330
331 +type_match:
332 if (of_out_of_range(addr + 1, range + 1, range + na + pna,
333 na - 1, ns))
334 return -EINVAL;
335 diff --git a/arch/sparc/lib/mcount.S b/arch/sparc/lib/mcount.S
336 index 7ce9c65..24b8b12 100644
337 --- a/arch/sparc/lib/mcount.S
338 +++ b/arch/sparc/lib/mcount.S
339 @@ -64,8 +64,9 @@ mcount:
340 2: sethi %hi(softirq_stack), %g3
341 or %g3, %lo(softirq_stack), %g3
342 ldx [%g3 + %g1], %g7
343 + sub %g7, STACK_BIAS, %g7
344 cmp %sp, %g7
345 - bleu,pt %xcc, 2f
346 + bleu,pt %xcc, 3f
347 sethi %hi(THREAD_SIZE), %g3
348 add %g7, %g3, %g7
349 cmp %sp, %g7
350 @@ -75,7 +76,7 @@ mcount:
351 * again, we are already trying to output the stack overflow
352 * message.
353 */
354 - sethi %hi(ovstack), %g7 ! cant move to panic stack fast enough
355 +3: sethi %hi(ovstack), %g7 ! cant move to panic stack fast enough
356 or %g7, %lo(ovstack), %g7
357 add %g7, OVSTACKSIZE, %g3
358 sub %g3, STACK_BIAS + 192, %g3
359 diff --git a/arch/x86/Makefile_32.cpu b/arch/x86/Makefile_32.cpu
360 index 30e9a26..1937226 100644
361 --- a/arch/x86/Makefile_32.cpu
362 +++ b/arch/x86/Makefile_32.cpu
363 @@ -46,6 +46,13 @@ cflags-$(CONFIG_MGEODEGX1) += -march=pentium-mmx
364 # cpu entries
365 cflags-$(CONFIG_X86_GENERIC) += $(call tune,generic,$(call tune,i686))
366
367 +# Work around the pentium-mmx code generator madness of gcc4.4.x which
368 +# does stack alignment by generating horrible code _before_ the mcount
369 +# prologue (push %ebp, mov %esp, %ebp) which breaks the function graph
370 +# tracer assumptions. For i686, generic, core2 this is set by the
371 +# compiler anyway
372 +cflags-$(CONFIG_FUNCTION_GRAPH_TRACER) += $(call cc-option,-maccumulate-outgoing-args)
373 +
374 # Bug fix for binutils: this option is required in order to keep
375 # binutils from generating NOPL instructions against our will.
376 ifneq ($(CONFIG_X86_P6_NOP),y)
377 diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
378 index 5b21f0e..6e90a04 100644
379 --- a/arch/x86/include/asm/irq_vectors.h
380 +++ b/arch/x86/include/asm/irq_vectors.h
381 @@ -113,7 +113,7 @@
382 */
383 #define LOCAL_PENDING_VECTOR 0xec
384
385 -#define UV_BAU_MESSAGE 0xec
386 +#define UV_BAU_MESSAGE 0xea
387
388 /*
389 * Self IPI vector for machine checks
390 diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h
391 index b7ed2c4..7c18e12 100644
392 --- a/arch/x86/include/asm/kvm_emulate.h
393 +++ b/arch/x86/include/asm/kvm_emulate.h
394 @@ -129,7 +129,7 @@ struct decode_cache {
395 u8 seg_override;
396 unsigned int d;
397 unsigned long regs[NR_VCPU_REGS];
398 - unsigned long eip;
399 + unsigned long eip, eip_orig;
400 /* modrm */
401 u8 modrm;
402 u8 modrm_mod;
403 diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
404 index f1363b7..a479023 100644
405 --- a/arch/x86/include/asm/mce.h
406 +++ b/arch/x86/include/asm/mce.h
407 @@ -214,5 +214,11 @@ void intel_init_thermal(struct cpuinfo_x86 *c);
408
409 void mce_log_therm_throt_event(__u64 status);
410
411 +#ifdef CONFIG_X86_THERMAL_VECTOR
412 +extern void mcheck_intel_therm_init(void);
413 +#else
414 +static inline void mcheck_intel_therm_init(void) { }
415 +#endif
416 +
417 #endif /* __KERNEL__ */
418 #endif /* _ASM_X86_MCE_H */
419 diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
420 index 59cdfa4..2e837f5 100644
421 --- a/arch/x86/kernel/acpi/cstate.c
422 +++ b/arch/x86/kernel/acpi/cstate.c
423 @@ -48,7 +48,7 @@ void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
424 * P4, Core and beyond CPUs
425 */
426 if (c->x86_vendor == X86_VENDOR_INTEL &&
427 - (c->x86 > 0xf || (c->x86 == 6 && c->x86_model >= 14)))
428 + (c->x86 > 0xf || (c->x86 == 6 && c->x86_model >= 0x0f)))
429 flags->bm_control = 0;
430 }
431 EXPORT_SYMBOL(acpi_processor_power_init_bm_check);
432 diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
433 index 0285521..90b9b55 100644
434 --- a/arch/x86/kernel/amd_iommu.c
435 +++ b/arch/x86/kernel/amd_iommu.c
436 @@ -2047,10 +2047,10 @@ static void prealloc_protection_domains(void)
437 struct pci_dev *dev = NULL;
438 struct dma_ops_domain *dma_dom;
439 struct amd_iommu *iommu;
440 - u16 devid;
441 + u16 devid, __devid;
442
443 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
444 - devid = calc_devid(dev->bus->number, dev->devfn);
445 + __devid = devid = calc_devid(dev->bus->number, dev->devfn);
446 if (devid > amd_iommu_last_bdf)
447 continue;
448 devid = amd_iommu_alias_table[devid];
449 @@ -2065,6 +2065,10 @@ static void prealloc_protection_domains(void)
450 init_unity_mappings_for_device(dma_dom, devid);
451 dma_dom->target_dev = devid;
452
453 + attach_device(iommu, &dma_dom->domain, devid);
454 + if (__devid != devid)
455 + attach_device(iommu, &dma_dom->domain, __devid);
456 +
457 list_add_tail(&dma_dom->list, &iommu_pd_list);
458 }
459 }
460 diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
461 index c20001e..e0b3130 100644
462 --- a/arch/x86/kernel/amd_iommu_init.c
463 +++ b/arch/x86/kernel/amd_iommu_init.c
464 @@ -925,7 +925,7 @@ static int __init init_iommu_all(struct acpi_table_header *table)
465 *
466 ****************************************************************************/
467
468 -static int __init iommu_setup_msi(struct amd_iommu *iommu)
469 +static int iommu_setup_msi(struct amd_iommu *iommu)
470 {
471 int r;
472
473 diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
474 index 894aa97..c86dbcf 100644
475 --- a/arch/x86/kernel/apic/apic.c
476 +++ b/arch/x86/kernel/apic/apic.c
477 @@ -246,7 +246,7 @@ static int modern_apic(void)
478 */
479 static void native_apic_write_dummy(u32 reg, u32 v)
480 {
481 - WARN_ON_ONCE((cpu_has_apic || !disable_apic));
482 + WARN_ON_ONCE(cpu_has_apic && !disable_apic);
483 }
484
485 static u32 native_apic_read_dummy(u32 reg)
486 diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
487 index 804c40e..8178d03 100644
488 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c
489 +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
490 @@ -94,7 +94,7 @@ static const struct _cache_table __cpuinitconst cache_table[] =
491 { 0xd1, LVL_3, 1024 }, /* 4-way set assoc, 64 byte line size */
492 { 0xd2, LVL_3, 2048 }, /* 4-way set assoc, 64 byte line size */
493 { 0xd6, LVL_3, 1024 }, /* 8-way set assoc, 64 byte line size */
494 - { 0xd7, LVL_3, 2038 }, /* 8-way set assoc, 64 byte line size */
495 + { 0xd7, LVL_3, 2048 }, /* 8-way set assoc, 64 byte line size */
496 { 0xd8, LVL_3, 4096 }, /* 12-way set assoc, 64 byte line size */
497 { 0xdc, LVL_3, 2048 }, /* 12-way set assoc, 64 byte line size */
498 { 0xdd, LVL_3, 4096 }, /* 12-way set assoc, 64 byte line size */
499 @@ -102,6 +102,9 @@ static const struct _cache_table __cpuinitconst cache_table[] =
500 { 0xe2, LVL_3, 2048 }, /* 16-way set assoc, 64 byte line size */
501 { 0xe3, LVL_3, 4096 }, /* 16-way set assoc, 64 byte line size */
502 { 0xe4, LVL_3, 8192 }, /* 16-way set assoc, 64 byte line size */
503 + { 0xea, LVL_3, 12288 }, /* 24-way set assoc, 64 byte line size */
504 + { 0xeb, LVL_3, 18432 }, /* 24-way set assoc, 64 byte line size */
505 + { 0xec, LVL_3, 24576 }, /* 24-way set assoc, 64 byte line size */
506 { 0x00, 0, 0}
507 };
508
509 diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
510 index 721a77c..0f16a2b 100644
511 --- a/arch/x86/kernel/cpu/mcheck/mce.c
512 +++ b/arch/x86/kernel/cpu/mcheck/mce.c
513 @@ -1374,13 +1374,14 @@ static void mce_init_timer(void)
514 struct timer_list *t = &__get_cpu_var(mce_timer);
515 int *n = &__get_cpu_var(mce_next_interval);
516
517 + setup_timer(t, mcheck_timer, smp_processor_id());
518 +
519 if (mce_ignore_ce)
520 return;
521
522 *n = check_interval * HZ;
523 if (!*n)
524 return;
525 - setup_timer(t, mcheck_timer, smp_processor_id());
526 t->expires = round_jiffies(jiffies + *n);
527 add_timer_on(t, smp_processor_id());
528 }
529 @@ -1991,9 +1992,11 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
530 break;
531 case CPU_DOWN_FAILED:
532 case CPU_DOWN_FAILED_FROZEN:
533 - t->expires = round_jiffies(jiffies +
534 + if (!mce_ignore_ce && check_interval) {
535 + t->expires = round_jiffies(jiffies +
536 __get_cpu_var(mce_next_interval));
537 - add_timer_on(t, cpu);
538 + add_timer_on(t, cpu);
539 + }
540 smp_call_function_single(cpu, mce_reenable_cpu, &action, 1);
541 break;
542 case CPU_POST_DEAD:
543 diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
544 index b3a1dba..4fef985 100644
545 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
546 +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
547 @@ -49,6 +49,8 @@ static DEFINE_PER_CPU(struct thermal_state, thermal_state);
548
549 static atomic_t therm_throt_en = ATOMIC_INIT(0);
550
551 +static u32 lvtthmr_init __read_mostly;
552 +
553 #ifdef CONFIG_SYSFS
554 #define define_therm_throt_sysdev_one_ro(_name) \
555 static SYSDEV_ATTR(_name, 0444, therm_throt_sysdev_show_##_name, NULL)
556 @@ -254,6 +256,18 @@ asmlinkage void smp_thermal_interrupt(struct pt_regs *regs)
557 ack_APIC_irq();
558 }
559
560 +void __init mcheck_intel_therm_init(void)
561 +{
562 + /*
563 + * This function is only called on boot CPU. Save the init thermal
564 + * LVT value on BSP and use that value to restore APs' thermal LVT
565 + * entry BIOS programmed later
566 + */
567 + if (cpu_has(&boot_cpu_data, X86_FEATURE_ACPI) &&
568 + cpu_has(&boot_cpu_data, X86_FEATURE_ACC))
569 + lvtthmr_init = apic_read(APIC_LVTTHMR);
570 +}
571 +
572 void intel_init_thermal(struct cpuinfo_x86 *c)
573 {
574 unsigned int cpu = smp_processor_id();
575 @@ -270,7 +284,20 @@ void intel_init_thermal(struct cpuinfo_x86 *c)
576 * since it might be delivered via SMI already:
577 */
578 rdmsr(MSR_IA32_MISC_ENABLE, l, h);
579 - h = apic_read(APIC_LVTTHMR);
580 +
581 + /*
582 + * The initial value of thermal LVT entries on all APs always reads
583 + * 0x10000 because APs are woken up by BSP issuing INIT-SIPI-SIPI
584 + * sequence to them and LVT registers are reset to 0s except for
585 + * the mask bits which are set to 1s when APs receive INIT IPI.
586 + * Always restore the value that BIOS has programmed on AP based on
587 + * BSP's info we saved since BIOS is always setting the same value
588 + * for all threads/cores
589 + */
590 + apic_write(APIC_LVTTHMR, lvtthmr_init);
591 +
592 + h = lvtthmr_init;
593 +
594 if ((l & MSR_IA32_MISC_ENABLE_TM1) && (h & APIC_DM_SMI)) {
595 printk(KERN_DEBUG
596 "CPU%d: Thermal monitoring handled by SMI\n", cpu);
597 diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c
598 index fab786f..898df97 100644
599 --- a/arch/x86/kernel/cpu/perfctr-watchdog.c
600 +++ b/arch/x86/kernel/cpu/perfctr-watchdog.c
601 @@ -712,7 +712,7 @@ static void probe_nmi_watchdog(void)
602 switch (boot_cpu_data.x86_vendor) {
603 case X86_VENDOR_AMD:
604 if (boot_cpu_data.x86 != 6 && boot_cpu_data.x86 != 15 &&
605 - boot_cpu_data.x86 != 16)
606 + boot_cpu_data.x86 != 16 && boot_cpu_data.x86 != 17)
607 return;
608 wd_ops = &k7_wd_ops;
609 break;
610 diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
611 index 971a3be..e6ec8a2 100644
612 --- a/arch/x86/kernel/pci-calgary_64.c
613 +++ b/arch/x86/kernel/pci-calgary_64.c
614 @@ -318,13 +318,15 @@ static inline struct iommu_table *find_iommu_table(struct device *dev)
615
616 pdev = to_pci_dev(dev);
617
618 + /* search up the device tree for an iommu */
619 pbus = pdev->bus;
620 -
621 - /* is the device behind a bridge? Look for the root bus */
622 - while (pbus->parent)
623 + do {
624 + tbl = pci_iommu(pbus);
625 + if (tbl && tbl->it_busno == pbus->number)
626 + break;
627 + tbl = NULL;
628 pbus = pbus->parent;
629 -
630 - tbl = pci_iommu(pbus);
631 + } while (pbus);
632
633 BUG_ON(tbl && (tbl->it_busno != pbus->number));
634
635 diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
636 index a6e804d..6ac3931 100644
637 --- a/arch/x86/kernel/pci-dma.c
638 +++ b/arch/x86/kernel/pci-dma.c
639 @@ -214,7 +214,7 @@ static __init int iommu_setup(char *p)
640 if (!strncmp(p, "allowdac", 8))
641 forbid_dac = 0;
642 if (!strncmp(p, "nodac", 5))
643 - forbid_dac = -1;
644 + forbid_dac = 1;
645 if (!strncmp(p, "usedac", 6)) {
646 forbid_dac = -1;
647 return 1;
648 diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
649 index a7f1b64..fcc0b5c 100644
650 --- a/arch/x86/kernel/pci-gart_64.c
651 +++ b/arch/x86/kernel/pci-gart_64.c
652 @@ -856,7 +856,7 @@ void __init gart_parse_options(char *p)
653 #endif
654 if (isdigit(*p) && get_option(&p, &arg))
655 iommu_size = arg;
656 - if (!strncmp(p, "fullflush", 8))
657 + if (!strncmp(p, "fullflush", 9))
658 iommu_fullflush = 1;
659 if (!strncmp(p, "nofullflush", 11))
660 iommu_fullflush = 0;
661 diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
662 index f930787..6caf260 100644
663 --- a/arch/x86/kernel/reboot.c
664 +++ b/arch/x86/kernel/reboot.c
665 @@ -259,6 +259,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
666 DMI_MATCH(DMI_PRODUCT_NAME, "SBC-FITPC2"),
667 },
668 },
669 + { /* Handle problems with rebooting on ASUS P4S800 */
670 + .callback = set_bios_reboot,
671 + .ident = "ASUS P4S800",
672 + .matches = {
673 + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
674 + DMI_MATCH(DMI_BOARD_NAME, "P4S800"),
675 + },
676 + },
677 { }
678 };
679
680 diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
681 index 2a34f9c..51aa5b2 100644
682 --- a/arch/x86/kernel/setup.c
683 +++ b/arch/x86/kernel/setup.c
684 @@ -109,6 +109,7 @@
685 #ifdef CONFIG_X86_64
686 #include <asm/numa_64.h>
687 #endif
688 +#include <asm/mce.h>
689
690 /*
691 * end_pfn only includes RAM, while max_pfn_mapped includes all e820 entries.
692 @@ -1031,6 +1032,8 @@ void __init setup_arch(char **cmdline_p)
693 #endif
694 #endif
695 x86_init.oem.banner();
696 +
697 + mcheck_intel_therm_init();
698 }
699
700 #ifdef CONFIG_X86_32
701 diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
702 index 1740c85..364d015 100644
703 --- a/arch/x86/kernel/tlb_uv.c
704 +++ b/arch/x86/kernel/tlb_uv.c
705 @@ -817,10 +817,8 @@ static int __init uv_init_blade(int blade)
706 */
707 apicid = blade_to_first_apicid(blade);
708 pa = uv_read_global_mmr64(pnode, UVH_BAU_DATA_CONFIG);
709 - if ((pa & 0xff) != UV_BAU_MESSAGE) {
710 - uv_write_global_mmr64(pnode, UVH_BAU_DATA_CONFIG,
711 + uv_write_global_mmr64(pnode, UVH_BAU_DATA_CONFIG,
712 ((apicid << 32) | UV_BAU_MESSAGE));
713 - }
714 return 0;
715 }
716
717 diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
718 index 1be5cd6..e02dbb6 100644
719 --- a/arch/x86/kvm/emulate.c
720 +++ b/arch/x86/kvm/emulate.c
721 @@ -613,6 +613,9 @@ static int do_insn_fetch(struct x86_emulate_ctxt *ctxt,
722 {
723 int rc = 0;
724
725 + /* x86 instructions are limited to 15 bytes. */
726 + if (eip + size - ctxt->decode.eip_orig > 15)
727 + return X86EMUL_UNHANDLEABLE;
728 eip += ctxt->cs_base;
729 while (size--) {
730 rc = do_fetch_insn_byte(ctxt, ops, eip++, dest++);
731 @@ -871,7 +874,7 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
732 /* Shadow copy of register state. Committed on successful emulation. */
733
734 memset(c, 0, sizeof(struct decode_cache));
735 - c->eip = kvm_rip_read(ctxt->vcpu);
736 + c->eip = c->eip_orig = kvm_rip_read(ctxt->vcpu);
737 ctxt->cs_base = seg_base(ctxt, VCPU_SREG_CS);
738 memcpy(c->regs, ctxt->vcpu->arch.regs, sizeof c->regs);
739
740 diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
741 index ae07d26..97b31fa 100644
742 --- a/arch/x86/kvm/x86.c
743 +++ b/arch/x86/kvm/x86.c
744 @@ -484,16 +484,19 @@ static inline u32 bit(int bitno)
745 * and KVM_SET_MSRS, and KVM_GET_MSR_INDEX_LIST.
746 *
747 * This list is modified at module load time to reflect the
748 - * capabilities of the host cpu.
749 + * capabilities of the host cpu. This capabilities test skips MSRs that are
750 + * kvm-specific. Those are put in the beginning of the list.
751 */
752 +
753 +#define KVM_SAVE_MSRS_BEGIN 2
754 static u32 msrs_to_save[] = {
755 + MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
756 MSR_IA32_SYSENTER_CS, MSR_IA32_SYSENTER_ESP, MSR_IA32_SYSENTER_EIP,
757 MSR_K6_STAR,
758 #ifdef CONFIG_X86_64
759 MSR_CSTAR, MSR_KERNEL_GS_BASE, MSR_SYSCALL_MASK, MSR_LSTAR,
760 #endif
761 - MSR_IA32_TSC, MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
762 - MSR_IA32_PERF_STATUS, MSR_IA32_CR_PAT, MSR_VM_HSAVE_PA
763 + MSR_IA32_TSC, MSR_IA32_PERF_STATUS, MSR_IA32_CR_PAT, MSR_VM_HSAVE_PA
764 };
765
766 static unsigned num_msrs_to_save;
767 @@ -2433,7 +2436,8 @@ static void kvm_init_msr_list(void)
768 u32 dummy[2];
769 unsigned i, j;
770
771 - for (i = j = 0; i < ARRAY_SIZE(msrs_to_save); i++) {
772 + /* skip the first msrs in the list. KVM-specific */
773 + for (i = j = KVM_SAVE_MSRS_BEGIN; i < ARRAY_SIZE(msrs_to_save); i++) {
774 if (rdmsr_safe(msrs_to_save[i], &dummy[0], &dummy[1]) < 0)
775 continue;
776 if (j < i)
777 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
778 index dfbf70e..79f9738 100644
779 --- a/arch/x86/xen/enlighten.c
780 +++ b/arch/x86/xen/enlighten.c
781 @@ -138,24 +138,23 @@ static void xen_vcpu_setup(int cpu)
782 */
783 void xen_vcpu_restore(void)
784 {
785 - if (have_vcpu_info_placement) {
786 - int cpu;
787 + int cpu;
788
789 - for_each_online_cpu(cpu) {
790 - bool other_cpu = (cpu != smp_processor_id());
791 + for_each_online_cpu(cpu) {
792 + bool other_cpu = (cpu != smp_processor_id());
793
794 - if (other_cpu &&
795 - HYPERVISOR_vcpu_op(VCPUOP_down, cpu, NULL))
796 - BUG();
797 + if (other_cpu &&
798 + HYPERVISOR_vcpu_op(VCPUOP_down, cpu, NULL))
799 + BUG();
800
801 - xen_vcpu_setup(cpu);
802 + xen_setup_runstate_info(cpu);
803
804 - if (other_cpu &&
805 - HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL))
806 - BUG();
807 - }
808 + if (have_vcpu_info_placement)
809 + xen_vcpu_setup(cpu);
810
811 - BUG_ON(!have_vcpu_info_placement);
812 + if (other_cpu &&
813 + HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL))
814 + BUG();
815 }
816 }
817
818 @@ -1182,6 +1181,8 @@ asmlinkage void __init xen_start_kernel(void)
819
820 xen_raw_console_write("about to get started...\n");
821
822 + xen_setup_runstate_info(0);
823 +
824 /* Start the world */
825 #ifdef CONFIG_X86_32
826 i386_start_kernel();
827 diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
828 index 3bf7b1d..bf4cd6b 100644
829 --- a/arch/x86/xen/mmu.c
830 +++ b/arch/x86/xen/mmu.c
831 @@ -185,7 +185,7 @@ static inline unsigned p2m_index(unsigned long pfn)
832 }
833
834 /* Build the parallel p2m_top_mfn structures */
835 -static void __init xen_build_mfn_list_list(void)
836 +void xen_build_mfn_list_list(void)
837 {
838 unsigned pfn, idx;
839
840 diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
841 index fe03eee..360f8d8 100644
842 --- a/arch/x86/xen/smp.c
843 +++ b/arch/x86/xen/smp.c
844 @@ -295,6 +295,7 @@ static int __cpuinit xen_cpu_up(unsigned int cpu)
845 (unsigned long)task_stack_page(idle) -
846 KERNEL_STACK_OFFSET + THREAD_SIZE;
847 #endif
848 + xen_setup_runstate_info(cpu);
849 xen_setup_timer(cpu);
850 xen_init_lock_cpu(cpu);
851
852 diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c
853 index 95be7b4..987267f 100644
854 --- a/arch/x86/xen/suspend.c
855 +++ b/arch/x86/xen/suspend.c
856 @@ -1,4 +1,5 @@
857 #include <linux/types.h>
858 +#include <linux/clockchips.h>
859
860 #include <xen/interface/xen.h>
861 #include <xen/grant_table.h>
862 @@ -27,6 +28,8 @@ void xen_pre_suspend(void)
863
864 void xen_post_suspend(int suspend_cancelled)
865 {
866 + xen_build_mfn_list_list();
867 +
868 xen_setup_shared_info();
869
870 if (suspend_cancelled) {
871 @@ -44,7 +47,19 @@ void xen_post_suspend(int suspend_cancelled)
872
873 }
874
875 +static void xen_vcpu_notify_restore(void *data)
876 +{
877 + unsigned long reason = (unsigned long)data;
878 +
879 + /* Boot processor notified via generic timekeeping_resume() */
880 + if ( smp_processor_id() == 0)
881 + return;
882 +
883 + clockevents_notify(reason, NULL);
884 +}
885 +
886 void xen_arch_resume(void)
887 {
888 - /* nothing */
889 + smp_call_function(xen_vcpu_notify_restore,
890 + (void *)CLOCK_EVT_NOTIFY_RESUME, 1);
891 }
892 diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
893 index 0a5aa44..9d1f853 100644
894 --- a/arch/x86/xen/time.c
895 +++ b/arch/x86/xen/time.c
896 @@ -100,7 +100,7 @@ bool xen_vcpu_stolen(int vcpu)
897 return per_cpu(runstate, vcpu).state == RUNSTATE_runnable;
898 }
899
900 -static void setup_runstate_info(int cpu)
901 +void xen_setup_runstate_info(int cpu)
902 {
903 struct vcpu_register_runstate_memory_area area;
904
905 @@ -434,7 +434,7 @@ void xen_setup_timer(int cpu)
906 name = "<timer kasprintf failed>";
907
908 irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt,
909 - IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING,
910 + IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER,
911 name, NULL);
912
913 evt = &per_cpu(xen_clock_events, cpu);
914 @@ -442,8 +442,6 @@ void xen_setup_timer(int cpu)
915
916 evt->cpumask = cpumask_of(cpu);
917 evt->irq = irq;
918 -
919 - setup_runstate_info(cpu);
920 }
921
922 void xen_teardown_timer(int cpu)
923 @@ -494,6 +492,7 @@ __init void xen_time_init(void)
924
925 setup_force_cpu_cap(X86_FEATURE_TSC);
926
927 + xen_setup_runstate_info(cpu);
928 xen_setup_timer(cpu);
929 xen_setup_cpu_clockevents();
930 }
931 diff --git a/arch/x86/xen/xen-asm_64.S b/arch/x86/xen/xen-asm_64.S
932 index 02f496a..53adefd 100644
933 --- a/arch/x86/xen/xen-asm_64.S
934 +++ b/arch/x86/xen/xen-asm_64.S
935 @@ -96,7 +96,7 @@ ENTRY(xen_sysret32)
936 pushq $__USER32_CS
937 pushq %rcx
938
939 - pushq $VGCF_in_syscall
940 + pushq $0
941 1: jmp hypercall_iret
942 ENDPATCH(xen_sysret32)
943 RELOC(xen_sysret32, 1b+1)
944 @@ -151,7 +151,7 @@ ENTRY(xen_syscall32_target)
945 ENTRY(xen_sysenter_target)
946 lea 16(%rsp), %rsp /* strip %rcx, %r11 */
947 mov $-ENOSYS, %rax
948 - pushq $VGCF_in_syscall
949 + pushq $0
950 jmp hypercall_iret
951 ENDPROC(xen_syscall32_target)
952 ENDPROC(xen_sysenter_target)
953 diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
954 index 355fa6b..f9153a3 100644
955 --- a/arch/x86/xen/xen-ops.h
956 +++ b/arch/x86/xen/xen-ops.h
957 @@ -25,6 +25,7 @@ extern struct shared_info *HYPERVISOR_shared_info;
958
959 void xen_setup_mfn_list_list(void);
960 void xen_setup_shared_info(void);
961 +void xen_build_mfn_list_list(void);
962 void xen_setup_machphys_mapping(void);
963 pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn);
964 void xen_ident_map_ISA(void);
965 @@ -41,6 +42,7 @@ void __init xen_build_dynamic_phys_to_machine(void);
966
967 void xen_init_irq_ops(void);
968 void xen_setup_timer(int cpu);
969 +void xen_setup_runstate_info(int cpu);
970 void xen_teardown_timer(int cpu);
971 cycle_t xen_clocksource_read(void);
972 void xen_setup_cpu_clockevents(void);
973 diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
974 index d0a7df2..ec07c53 100644
975 --- a/drivers/ata/pata_hpt37x.c
976 +++ b/drivers/ata/pata_hpt37x.c
977 @@ -24,7 +24,7 @@
978 #include <linux/libata.h>
979
980 #define DRV_NAME "pata_hpt37x"
981 -#define DRV_VERSION "0.6.12"
982 +#define DRV_VERSION "0.6.14"
983
984 struct hpt_clock {
985 u8 xfer_speed;
986 @@ -404,9 +404,8 @@ static void hpt370_set_piomode(struct ata_port *ap, struct ata_device *adev)
987
988 pci_read_config_dword(pdev, addr1, &reg);
989 mode = hpt37x_find_mode(ap, adev->pio_mode);
990 - mode &= ~0x8000000; /* No FIFO in PIO */
991 - mode &= ~0x30070000; /* Leave config bits alone */
992 - reg &= 0x30070000; /* Strip timing bits */
993 + mode &= 0xCFC3FFFF; /* Leave DMA bits alone */
994 + reg &= ~0xCFC3FFFF; /* Strip timing bits */
995 pci_write_config_dword(pdev, addr1, reg | mode);
996 }
997
998 @@ -423,8 +422,7 @@ static void hpt370_set_dmamode(struct ata_port *ap, struct ata_device *adev)
999 {
1000 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
1001 u32 addr1, addr2;
1002 - u32 reg;
1003 - u32 mode;
1004 + u32 reg, mode, mask;
1005 u8 fast;
1006
1007 addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no);
1008 @@ -436,11 +434,12 @@ static void hpt370_set_dmamode(struct ata_port *ap, struct ata_device *adev)
1009 fast |= 0x01;
1010 pci_write_config_byte(pdev, addr2, fast);
1011
1012 + mask = adev->dma_mode < XFER_UDMA_0 ? 0x31C001FF : 0x303C0000;
1013 +
1014 pci_read_config_dword(pdev, addr1, &reg);
1015 mode = hpt37x_find_mode(ap, adev->dma_mode);
1016 - mode |= 0x8000000; /* FIFO in MWDMA or UDMA */
1017 - mode &= ~0xC0000000; /* Leave config bits alone */
1018 - reg &= 0xC0000000; /* Strip timing bits */
1019 + mode &= mask;
1020 + reg &= ~mask;
1021 pci_write_config_dword(pdev, addr1, reg | mode);
1022 }
1023
1024 @@ -508,9 +507,8 @@ static void hpt372_set_piomode(struct ata_port *ap, struct ata_device *adev)
1025 mode = hpt37x_find_mode(ap, adev->pio_mode);
1026
1027 printk("Find mode for %d reports %X\n", adev->pio_mode, mode);
1028 - mode &= ~0x80000000; /* No FIFO in PIO */
1029 - mode &= ~0x30070000; /* Leave config bits alone */
1030 - reg &= 0x30070000; /* Strip timing bits */
1031 + mode &= 0xCFC3FFFF; /* Leave DMA bits alone */
1032 + reg &= ~0xCFC3FFFF; /* Strip timing bits */
1033 pci_write_config_dword(pdev, addr1, reg | mode);
1034 }
1035
1036 @@ -527,8 +525,7 @@ static void hpt372_set_dmamode(struct ata_port *ap, struct ata_device *adev)
1037 {
1038 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
1039 u32 addr1, addr2;
1040 - u32 reg;
1041 - u32 mode;
1042 + u32 reg, mode, mask;
1043 u8 fast;
1044
1045 addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no);
1046 @@ -539,12 +536,13 @@ static void hpt372_set_dmamode(struct ata_port *ap, struct ata_device *adev)
1047 fast &= ~0x07;
1048 pci_write_config_byte(pdev, addr2, fast);
1049
1050 + mask = adev->dma_mode < XFER_UDMA_0 ? 0x31C001FF : 0x303C0000;
1051 +
1052 pci_read_config_dword(pdev, addr1, &reg);
1053 mode = hpt37x_find_mode(ap, adev->dma_mode);
1054 printk("Find mode for DMA %d reports %X\n", adev->dma_mode, mode);
1055 - mode &= ~0xC0000000; /* Leave config bits alone */
1056 - mode |= 0x80000000; /* FIFO in MWDMA or UDMA */
1057 - reg &= 0xC0000000; /* Strip timing bits */
1058 + mode &= mask;
1059 + reg &= ~mask;
1060 pci_write_config_dword(pdev, addr1, reg | mode);
1061 }
1062
1063 diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
1064 index 3d59fe0..21c5bd6 100644
1065 --- a/drivers/ata/pata_hpt3x2n.c
1066 +++ b/drivers/ata/pata_hpt3x2n.c
1067 @@ -25,7 +25,7 @@
1068 #include <linux/libata.h>
1069
1070 #define DRV_NAME "pata_hpt3x2n"
1071 -#define DRV_VERSION "0.3.4"
1072 +#define DRV_VERSION "0.3.7"
1073
1074 enum {
1075 HPT_PCI_FAST = (1 << 31),
1076 @@ -185,9 +185,8 @@ static void hpt3x2n_set_piomode(struct ata_port *ap, struct ata_device *adev)
1077
1078 pci_read_config_dword(pdev, addr1, &reg);
1079 mode = hpt3x2n_find_mode(ap, adev->pio_mode);
1080 - mode &= ~0x8000000; /* No FIFO in PIO */
1081 - mode &= ~0x30070000; /* Leave config bits alone */
1082 - reg &= 0x30070000; /* Strip timing bits */
1083 + mode &= 0xCFC3FFFF; /* Leave DMA bits alone */
1084 + reg &= ~0xCFC3FFFF; /* Strip timing bits */
1085 pci_write_config_dword(pdev, addr1, reg | mode);
1086 }
1087
1088 @@ -204,8 +203,7 @@ static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev)
1089 {
1090 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
1091 u32 addr1, addr2;
1092 - u32 reg;
1093 - u32 mode;
1094 + u32 reg, mode, mask;
1095 u8 fast;
1096
1097 addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no);
1098 @@ -216,11 +214,12 @@ static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev)
1099 fast &= ~0x07;
1100 pci_write_config_byte(pdev, addr2, fast);
1101
1102 + mask = adev->dma_mode < XFER_UDMA_0 ? 0x31C001FF : 0x303C0000;
1103 +
1104 pci_read_config_dword(pdev, addr1, &reg);
1105 mode = hpt3x2n_find_mode(ap, adev->dma_mode);
1106 - mode |= 0x8000000; /* FIFO in MWDMA or UDMA */
1107 - mode &= ~0xC0000000; /* Leave config bits alone */
1108 - reg &= 0xC0000000; /* Strip timing bits */
1109 + mode &= mask;
1110 + reg &= ~mask;
1111 pci_write_config_dword(pdev, addr1, reg | mode);
1112 }
1113
1114 diff --git a/drivers/base/core.c b/drivers/base/core.c
1115 index 6bee6af..1093179 100644
1116 --- a/drivers/base/core.c
1117 +++ b/drivers/base/core.c
1118 @@ -56,7 +56,14 @@ static inline int device_is_not_partition(struct device *dev)
1119 */
1120 const char *dev_driver_string(const struct device *dev)
1121 {
1122 - return dev->driver ? dev->driver->name :
1123 + struct device_driver *drv;
1124 +
1125 + /* dev->driver can change to NULL underneath us because of unbinding,
1126 + * so be careful about accessing it. dev->bus and dev->class should
1127 + * never change once they are set, so they don't need special care.
1128 + */
1129 + drv = ACCESS_ONCE(dev->driver);
1130 + return drv ? drv->name :
1131 (dev->bus ? dev->bus->name :
1132 (dev->class ? dev->class->name : ""));
1133 }
1134 diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
1135 index 846d89e..0a4b75f 100644
1136 --- a/drivers/base/power/runtime.c
1137 +++ b/drivers/base/power/runtime.c
1138 @@ -777,7 +777,7 @@ int __pm_runtime_set_status(struct device *dev, unsigned int status)
1139 }
1140
1141 if (parent) {
1142 - spin_lock(&parent->power.lock);
1143 + spin_lock_nested(&parent->power.lock, SINGLE_DEPTH_NESTING);
1144
1145 /*
1146 * It is invalid to put an active child under a parent that is
1147 diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
1148 index 94260aa..1e504de 100644
1149 --- a/drivers/firewire/ohci.c
1150 +++ b/drivers/firewire/ohci.c
1151 @@ -2209,6 +2209,13 @@ static int ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base,
1152 page = payload >> PAGE_SHIFT;
1153 offset = payload & ~PAGE_MASK;
1154 rest = p->payload_length;
1155 + /*
1156 + * The controllers I've tested have not worked correctly when
1157 + * second_req_count is zero. Rather than do something we know won't
1158 + * work, return an error
1159 + */
1160 + if (rest == 0)
1161 + return -EINVAL;
1162
1163 /* FIXME: make packet-per-buffer/dual-buffer a context option */
1164 while (rest > 0) {
1165 @@ -2262,7 +2269,7 @@ static int ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base,
1166 unsigned long payload)
1167 {
1168 struct iso_context *ctx = container_of(base, struct iso_context, base);
1169 - struct descriptor *d = NULL, *pd = NULL;
1170 + struct descriptor *d, *pd;
1171 struct fw_iso_packet *p = packet;
1172 dma_addr_t d_bus, page_bus;
1173 u32 z, header_z, rest;
1174 @@ -2300,8 +2307,9 @@ static int ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base,
1175 d->data_address = cpu_to_le32(d_bus + (z * sizeof(*d)));
1176
1177 rest = payload_per_buffer;
1178 + pd = d;
1179 for (j = 1; j < z; j++) {
1180 - pd = d + j;
1181 + pd++;
1182 pd->control = cpu_to_le16(DESCRIPTOR_STATUS |
1183 DESCRIPTOR_INPUT_MORE);
1184
1185 diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
1186 index 0a6f0b3..332d743 100644
1187 --- a/drivers/gpu/drm/drm_irq.c
1188 +++ b/drivers/gpu/drm/drm_irq.c
1189 @@ -429,15 +429,21 @@ int drm_vblank_get(struct drm_device *dev, int crtc)
1190
1191 spin_lock_irqsave(&dev->vbl_lock, irqflags);
1192 /* Going from 0->1 means we have to enable interrupts again */
1193 - if (atomic_add_return(1, &dev->vblank_refcount[crtc]) == 1 &&
1194 - !dev->vblank_enabled[crtc]) {
1195 - ret = dev->driver->enable_vblank(dev, crtc);
1196 - DRM_DEBUG("enabling vblank on crtc %d, ret: %d\n", crtc, ret);
1197 - if (ret)
1198 + if (atomic_add_return(1, &dev->vblank_refcount[crtc]) == 1) {
1199 + if (!dev->vblank_enabled[crtc]) {
1200 + ret = dev->driver->enable_vblank(dev, crtc);
1201 + DRM_DEBUG("enabling vblank on crtc %d, ret: %d\n", crtc, ret);
1202 + if (ret)
1203 + atomic_dec(&dev->vblank_refcount[crtc]);
1204 + else {
1205 + dev->vblank_enabled[crtc] = 1;
1206 + drm_update_vblank_count(dev, crtc);
1207 + }
1208 + }
1209 + } else {
1210 + if (!dev->vblank_enabled[crtc]) {
1211 atomic_dec(&dev->vblank_refcount[crtc]);
1212 - else {
1213 - dev->vblank_enabled[crtc] = 1;
1214 - drm_update_vblank_count(dev, crtc);
1215 + ret = -EINVAL;
1216 }
1217 }
1218 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
1219 @@ -464,6 +470,18 @@ void drm_vblank_put(struct drm_device *dev, int crtc)
1220 }
1221 EXPORT_SYMBOL(drm_vblank_put);
1222
1223 +void drm_vblank_off(struct drm_device *dev, int crtc)
1224 +{
1225 + unsigned long irqflags;
1226 +
1227 + spin_lock_irqsave(&dev->vbl_lock, irqflags);
1228 + DRM_WAKEUP(&dev->vbl_queue[crtc]);
1229 + dev->vblank_enabled[crtc] = 0;
1230 + dev->last_vblank[crtc] = dev->driver->get_vblank_counter(dev, crtc);
1231 + spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
1232 +}
1233 +EXPORT_SYMBOL(drm_vblank_off);
1234 +
1235 /**
1236 * drm_vblank_pre_modeset - account for vblanks across mode sets
1237 * @dev: DRM device
1238 diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
1239 index a725f65..ecbafd0 100644
1240 --- a/drivers/gpu/drm/i915/i915_drv.h
1241 +++ b/drivers/gpu/drm/i915/i915_drv.h
1242 @@ -957,6 +957,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1243 #define IS_I85X(dev) ((dev)->pci_device == 0x3582)
1244 #define IS_I855(dev) ((dev)->pci_device == 0x3582)
1245 #define IS_I865G(dev) ((dev)->pci_device == 0x2572)
1246 +#define IS_I8XX(dev) (IS_I830(dev) || IS_845G(dev) || IS_I85X(dev) || IS_I865G(dev))
1247
1248 #define IS_I915G(dev) ((dev)->pci_device == 0x2582 || (dev)->pci_device == 0x258a)
1249 #define IS_I915GM(dev) ((dev)->pci_device == 0x2592)
1250 @@ -1018,9 +1019,12 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1251 */
1252 #define HAS_128_BYTE_Y_TILING(dev) (IS_I9XX(dev) && !(IS_I915G(dev) || \
1253 IS_I915GM(dev)))
1254 +#define SUPPORTS_DIGITAL_OUTPUTS(dev) (IS_I9XX(dev) && !IS_IGD(dev))
1255 #define SUPPORTS_INTEGRATED_HDMI(dev) (IS_G4X(dev) || IS_IGDNG(dev))
1256 #define SUPPORTS_INTEGRATED_DP(dev) (IS_G4X(dev) || IS_IGDNG(dev))
1257 #define SUPPORTS_EDP(dev) (IS_IGDNG_M(dev))
1258 +#define SUPPORTS_TV(dev) (IS_I9XX(dev) && IS_MOBILE(dev) && \
1259 + !IS_IGDNG(dev) && !IS_IGD(dev))
1260 #define I915_HAS_HOTPLUG(dev) (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev) || IS_I965G(dev))
1261 /* dsparb controlled by hw only */
1262 #define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IGDNG(dev))
1263 diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
1264 index abfc27b..5ddbd38 100644
1265 --- a/drivers/gpu/drm/i915/i915_gem.c
1266 +++ b/drivers/gpu/drm/i915/i915_gem.c
1267 @@ -1288,6 +1288,7 @@ i915_gem_create_mmap_offset(struct drm_gem_object *obj)
1268 list->hash.key = list->file_offset_node->start;
1269 if (drm_ht_insert_item(&mm->offset_hash, &list->hash)) {
1270 DRM_ERROR("failed to add to map hash\n");
1271 + ret = -ENOMEM;
1272 goto out_free_mm;
1273 }
1274
1275 diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
1276 index 099f420..f1de53b 100644
1277 --- a/drivers/gpu/drm/i915/intel_display.c
1278 +++ b/drivers/gpu/drm/i915/intel_display.c
1279 @@ -1482,6 +1482,15 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
1280 case DRM_MODE_DPMS_STANDBY:
1281 case DRM_MODE_DPMS_SUSPEND:
1282 DRM_DEBUG("crtc %d dpms on\n", pipe);
1283 +
1284 + if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
1285 + temp = I915_READ(PCH_LVDS);
1286 + if ((temp & LVDS_PORT_EN) == 0) {
1287 + I915_WRITE(PCH_LVDS, temp | LVDS_PORT_EN);
1288 + POSTING_READ(PCH_LVDS);
1289 + }
1290 + }
1291 +
1292 if (HAS_eDP) {
1293 /* enable eDP PLL */
1294 igdng_enable_pll_edp(crtc);
1295 @@ -1666,8 +1675,6 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
1296 case DRM_MODE_DPMS_OFF:
1297 DRM_DEBUG("crtc %d dpms off\n", pipe);
1298
1299 - i915_disable_vga(dev);
1300 -
1301 /* Disable display plane */
1302 temp = I915_READ(dspcntr_reg);
1303 if ((temp & DISPLAY_PLANE_ENABLE) != 0) {
1304 @@ -1677,6 +1684,8 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
1305 I915_READ(dspbase_reg);
1306 }
1307
1308 + i915_disable_vga(dev);
1309 +
1310 /* disable cpu pipe, disable after all planes disabled */
1311 temp = I915_READ(pipeconf_reg);
1312 if ((temp & PIPEACONF_ENABLE) != 0) {
1313 @@ -1697,9 +1706,15 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
1314 } else
1315 DRM_DEBUG("crtc %d is disabled\n", pipe);
1316
1317 - if (HAS_eDP) {
1318 - igdng_disable_pll_edp(crtc);
1319 + udelay(100);
1320 +
1321 + /* Disable PF */
1322 + temp = I915_READ(pf_ctl_reg);
1323 + if ((temp & PF_ENABLE) != 0) {
1324 + I915_WRITE(pf_ctl_reg, temp & ~PF_ENABLE);
1325 + I915_READ(pf_ctl_reg);
1326 }
1327 + I915_WRITE(pf_win_size, 0);
1328
1329 /* disable CPU FDI tx and PCH FDI rx */
1330 temp = I915_READ(fdi_tx_reg);
1331 @@ -1725,6 +1740,13 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
1332
1333 udelay(100);
1334
1335 + if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
1336 + temp = I915_READ(PCH_LVDS);
1337 + I915_WRITE(PCH_LVDS, temp & ~LVDS_PORT_EN);
1338 + I915_READ(PCH_LVDS);
1339 + udelay(100);
1340 + }
1341 +
1342 /* disable PCH transcoder */
1343 temp = I915_READ(transconf_reg);
1344 if ((temp & TRANS_ENABLE) != 0) {
1345 @@ -1744,6 +1766,8 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
1346 }
1347 }
1348
1349 + udelay(100);
1350 +
1351 /* disable PCH DPLL */
1352 temp = I915_READ(pch_dpll_reg);
1353 if ((temp & DPLL_VCO_ENABLE) != 0) {
1354 @@ -1751,14 +1775,20 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
1355 I915_READ(pch_dpll_reg);
1356 }
1357
1358 - temp = I915_READ(fdi_rx_reg);
1359 - if ((temp & FDI_RX_PLL_ENABLE) != 0) {
1360 - temp &= ~FDI_SEL_PCDCLK;
1361 - temp &= ~FDI_RX_PLL_ENABLE;
1362 - I915_WRITE(fdi_rx_reg, temp);
1363 - I915_READ(fdi_rx_reg);
1364 + if (HAS_eDP) {
1365 + igdng_disable_pll_edp(crtc);
1366 }
1367
1368 + temp = I915_READ(fdi_rx_reg);
1369 + temp &= ~FDI_SEL_PCDCLK;
1370 + I915_WRITE(fdi_rx_reg, temp);
1371 + I915_READ(fdi_rx_reg);
1372 +
1373 + temp = I915_READ(fdi_rx_reg);
1374 + temp &= ~FDI_RX_PLL_ENABLE;
1375 + I915_WRITE(fdi_rx_reg, temp);
1376 + I915_READ(fdi_rx_reg);
1377 +
1378 /* Disable CPU FDI TX PLL */
1379 temp = I915_READ(fdi_tx_reg);
1380 if ((temp & FDI_TX_PLL_ENABLE) != 0) {
1381 @@ -1767,16 +1797,8 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
1382 udelay(100);
1383 }
1384
1385 - /* Disable PF */
1386 - temp = I915_READ(pf_ctl_reg);
1387 - if ((temp & PF_ENABLE) != 0) {
1388 - I915_WRITE(pf_ctl_reg, temp & ~PF_ENABLE);
1389 - I915_READ(pf_ctl_reg);
1390 - }
1391 - I915_WRITE(pf_win_size, 0);
1392 -
1393 /* Wait for the clocks to turn off. */
1394 - udelay(150);
1395 + udelay(100);
1396 break;
1397 }
1398 }
1399 @@ -1845,6 +1867,7 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode)
1400 intel_update_watermarks(dev);
1401 /* Give the overlay scaler a chance to disable if it's on this pipe */
1402 //intel_crtc_dpms_video(crtc, FALSE); TODO
1403 + drm_vblank_off(dev, pipe);
1404
1405 if (dev_priv->cfb_plane == plane &&
1406 dev_priv->display.disable_fbc)
1407 @@ -4118,7 +4141,7 @@ static void intel_setup_outputs(struct drm_device *dev)
1408 if (I915_READ(PCH_DP_D) & DP_DETECTED)
1409 intel_dp_init(dev, PCH_DP_D);
1410
1411 - } else if (IS_I9XX(dev)) {
1412 + } else if (SUPPORTS_DIGITAL_OUTPUTS(dev)) {
1413 bool found = false;
1414
1415 if (I915_READ(SDVOB) & SDVO_DETECTED) {
1416 @@ -4145,10 +4168,10 @@ static void intel_setup_outputs(struct drm_device *dev)
1417
1418 if (SUPPORTS_INTEGRATED_DP(dev) && (I915_READ(DP_D) & DP_DETECTED))
1419 intel_dp_init(dev, DP_D);
1420 - } else
1421 + } else if (IS_I8XX(dev))
1422 intel_dvo_init(dev);
1423
1424 - if (IS_I9XX(dev) && IS_MOBILE(dev) && !IS_IGDNG(dev))
1425 + if (SUPPORTS_TV(dev))
1426 intel_tv_init(dev);
1427
1428 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
1429 diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
1430 index d834475..92a3d7b 100644
1431 --- a/drivers/gpu/drm/i915/intel_dp.c
1432 +++ b/drivers/gpu/drm/i915/intel_dp.c
1433 @@ -1254,11 +1254,11 @@ intel_dp_init(struct drm_device *dev, int output_reg)
1434 else
1435 intel_output->type = INTEL_OUTPUT_DISPLAYPORT;
1436
1437 - if (output_reg == DP_B)
1438 + if (output_reg == DP_B || output_reg == PCH_DP_B)
1439 intel_output->clone_mask = (1 << INTEL_DP_B_CLONE_BIT);
1440 - else if (output_reg == DP_C)
1441 + else if (output_reg == DP_C || output_reg == PCH_DP_C)
1442 intel_output->clone_mask = (1 << INTEL_DP_C_CLONE_BIT);
1443 - else if (output_reg == DP_D)
1444 + else if (output_reg == DP_D || output_reg == PCH_DP_D)
1445 intel_output->clone_mask = (1 << INTEL_DP_D_CLONE_BIT);
1446
1447 if (IS_eDP(intel_output)) {
1448 diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
1449 index 9ca9179..5b28b4e 100644
1450 --- a/drivers/gpu/drm/i915/intel_tv.c
1451 +++ b/drivers/gpu/drm/i915/intel_tv.c
1452 @@ -1213,20 +1213,17 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
1453 tv_ctl |= TV_TRILEVEL_SYNC;
1454 if (tv_mode->pal_burst)
1455 tv_ctl |= TV_PAL_BURST;
1456 +
1457 scctl1 = 0;
1458 - /* dda1 implies valid video levels */
1459 - if (tv_mode->dda1_inc) {
1460 + if (tv_mode->dda1_inc)
1461 scctl1 |= TV_SC_DDA1_EN;
1462 - }
1463 -
1464 if (tv_mode->dda2_inc)
1465 scctl1 |= TV_SC_DDA2_EN;
1466 -
1467 if (tv_mode->dda3_inc)
1468 scctl1 |= TV_SC_DDA3_EN;
1469 -
1470 scctl1 |= tv_mode->sc_reset;
1471 - scctl1 |= video_levels->burst << TV_BURST_LEVEL_SHIFT;
1472 + if (video_levels)
1473 + scctl1 |= video_levels->burst << TV_BURST_LEVEL_SHIFT;
1474 scctl1 |= tv_mode->dda1_inc << TV_SCDDA1_INC_SHIFT;
1475
1476 scctl2 = tv_mode->dda2_size << TV_SCDDA2_SIZE_SHIFT |
1477 diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
1478 index c15287a..c6777cb 100644
1479 --- a/drivers/gpu/drm/radeon/atombios_crtc.c
1480 +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
1481 @@ -241,6 +241,7 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
1482 {
1483 struct drm_device *dev = crtc->dev;
1484 struct radeon_device *rdev = dev->dev_private;
1485 + struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
1486
1487 switch (mode) {
1488 case DRM_MODE_DPMS_ON:
1489 @@ -248,20 +249,19 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
1490 if (ASIC_IS_DCE3(rdev))
1491 atombios_enable_crtc_memreq(crtc, 1);
1492 atombios_blank_crtc(crtc, 0);
1493 + drm_vblank_post_modeset(dev, radeon_crtc->crtc_id);
1494 + radeon_crtc_load_lut(crtc);
1495 break;
1496 case DRM_MODE_DPMS_STANDBY:
1497 case DRM_MODE_DPMS_SUSPEND:
1498 case DRM_MODE_DPMS_OFF:
1499 + drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id);
1500 atombios_blank_crtc(crtc, 1);
1501 if (ASIC_IS_DCE3(rdev))
1502 atombios_enable_crtc_memreq(crtc, 0);
1503 atombios_enable_crtc(crtc, 0);
1504 break;
1505 }
1506 -
1507 - if (mode != DRM_MODE_DPMS_OFF) {
1508 - radeon_crtc_load_lut(crtc);
1509 - }
1510 }
1511
1512 static void
1513 diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
1514 index 2ed88a8..969502a 100644
1515 --- a/drivers/gpu/drm/radeon/radeon_atombios.c
1516 +++ b/drivers/gpu/drm/radeon/radeon_atombios.c
1517 @@ -135,6 +135,14 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
1518 }
1519 }
1520
1521 + /* HIS X1300 is DVI+VGA, not DVI+DVI */
1522 + if ((dev->pdev->device == 0x7146) &&
1523 + (dev->pdev->subsystem_vendor == 0x17af) &&
1524 + (dev->pdev->subsystem_device == 0x2058)) {
1525 + if (supported_device == ATOM_DEVICE_DFP1_SUPPORT)
1526 + return false;
1527 + }
1528 +
1529 /* Funky macbooks */
1530 if ((dev->pdev->device == 0x71C5) &&
1531 (dev->pdev->subsystem_vendor == 0x106b) &&
1532 diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
1533 index 8d0b7aa..22ce4d6 100644
1534 --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
1535 +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
1536 @@ -292,8 +292,7 @@ void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
1537 uint32_t mask;
1538
1539 if (radeon_crtc->crtc_id)
1540 - mask = (RADEON_CRTC2_EN |
1541 - RADEON_CRTC2_DISP_DIS |
1542 + mask = (RADEON_CRTC2_DISP_DIS |
1543 RADEON_CRTC2_VSYNC_DIS |
1544 RADEON_CRTC2_HSYNC_DIS |
1545 RADEON_CRTC2_DISP_REQ_EN_B);
1546 @@ -305,7 +304,7 @@ void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
1547 switch (mode) {
1548 case DRM_MODE_DPMS_ON:
1549 if (radeon_crtc->crtc_id)
1550 - WREG32_P(RADEON_CRTC2_GEN_CNTL, RADEON_CRTC2_EN, ~mask);
1551 + WREG32_P(RADEON_CRTC2_GEN_CNTL, RADEON_CRTC2_EN, ~(RADEON_CRTC2_EN | mask));
1552 else {
1553 WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_EN, ~(RADEON_CRTC_EN |
1554 RADEON_CRTC_DISP_REQ_EN_B));
1555 @@ -319,7 +318,7 @@ void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
1556 case DRM_MODE_DPMS_OFF:
1557 drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id);
1558 if (radeon_crtc->crtc_id)
1559 - WREG32_P(RADEON_CRTC2_GEN_CNTL, mask, ~mask);
1560 + WREG32_P(RADEON_CRTC2_GEN_CNTL, mask, ~(RADEON_CRTC2_EN | mask));
1561 else {
1562 WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_DISP_REQ_EN_B, ~(RADEON_CRTC_EN |
1563 RADEON_CRTC_DISP_REQ_EN_B));
1564 diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
1565 index 5f117cd..4444f48 100644
1566 --- a/drivers/gpu/drm/radeon/rs600.c
1567 +++ b/drivers/gpu/drm/radeon/rs600.c
1568 @@ -301,9 +301,7 @@ int rs600_mc_wait_for_idle(struct radeon_device *rdev)
1569
1570 void rs600_gpu_init(struct radeon_device *rdev)
1571 {
1572 - /* FIXME: HDP same place on rs600 ? */
1573 r100_hdp_reset(rdev);
1574 - /* FIXME: is this correct ? */
1575 r420_pipes_init(rdev);
1576 /* Wait for mc idle */
1577 if (rs600_mc_wait_for_idle(rdev))
1578 @@ -312,9 +310,20 @@ void rs600_gpu_init(struct radeon_device *rdev)
1579
1580 void rs600_vram_info(struct radeon_device *rdev)
1581 {
1582 - /* FIXME: to do or is these values sane ? */
1583 rdev->mc.vram_is_ddr = true;
1584 rdev->mc.vram_width = 128;
1585 +
1586 + rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE);
1587 + rdev->mc.mc_vram_size = rdev->mc.real_vram_size;
1588 +
1589 + rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0);
1590 + rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0);
1591 +
1592 + if (rdev->mc.mc_vram_size > rdev->mc.aper_size)
1593 + rdev->mc.mc_vram_size = rdev->mc.aper_size;
1594 +
1595 + if (rdev->mc.real_vram_size > rdev->mc.aper_size)
1596 + rdev->mc.real_vram_size = rdev->mc.aper_size;
1597 }
1598
1599 void rs600_bandwidth_update(struct radeon_device *rdev)
1600 diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
1601 index 2754717..b12ff76 100644
1602 --- a/drivers/gpu/drm/radeon/rs690.c
1603 +++ b/drivers/gpu/drm/radeon/rs690.c
1604 @@ -131,24 +131,25 @@ void rs690_pm_info(struct radeon_device *rdev)
1605
1606 void rs690_vram_info(struct radeon_device *rdev)
1607 {
1608 - uint32_t tmp;
1609 fixed20_12 a;
1610
1611 rs400_gart_adjust_size(rdev);
1612 - /* DDR for all card after R300 & IGP */
1613 +
1614 rdev->mc.vram_is_ddr = true;
1615 - /* FIXME: is this correct for RS690/RS740 ? */
1616 - tmp = RREG32(RADEON_MEM_CNTL);
1617 - if (tmp & R300_MEM_NUM_CHANNELS_MASK) {
1618 - rdev->mc.vram_width = 128;
1619 - } else {
1620 - rdev->mc.vram_width = 64;
1621 - }
1622 + rdev->mc.vram_width = 128;
1623 +
1624 rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE);
1625 rdev->mc.mc_vram_size = rdev->mc.real_vram_size;
1626
1627 rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0);
1628 rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0);
1629 +
1630 + if (rdev->mc.mc_vram_size > rdev->mc.aper_size)
1631 + rdev->mc.mc_vram_size = rdev->mc.aper_size;
1632 +
1633 + if (rdev->mc.real_vram_size > rdev->mc.aper_size)
1634 + rdev->mc.real_vram_size = rdev->mc.aper_size;
1635 +
1636 rs690_pm_info(rdev);
1637 /* FIXME: we should enforce default clock in case GPU is not in
1638 * default setup
1639 diff --git a/drivers/ide/slc90e66.c b/drivers/ide/slc90e66.c
1640 index 9aec78d..1ccfb40 100644
1641 --- a/drivers/ide/slc90e66.c
1642 +++ b/drivers/ide/slc90e66.c
1643 @@ -91,8 +91,7 @@ static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed)
1644
1645 if (!(reg48 & u_flag))
1646 pci_write_config_word(dev, 0x48, reg48|u_flag);
1647 - /* FIXME: (reg4a & a_speed) ? */
1648 - if ((reg4a & u_speed) != u_speed) {
1649 + if ((reg4a & a_speed) != u_speed) {
1650 pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
1651 pci_read_config_word(dev, 0x4a, &reg4a);
1652 pci_write_config_word(dev, 0x4a, reg4a|u_speed);
1653 diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c
1654 index 556f0fe..386a797 100644
1655 --- a/drivers/macintosh/therm_adt746x.c
1656 +++ b/drivers/macintosh/therm_adt746x.c
1657 @@ -79,6 +79,7 @@ struct thermostat {
1658 u8 limits[3];
1659 int last_speed[2];
1660 int last_var[2];
1661 + int pwm_inv[2];
1662 };
1663
1664 static enum {ADT7460, ADT7467} therm_type;
1665 @@ -229,19 +230,23 @@ static void write_fan_speed(struct thermostat *th, int speed, int fan)
1666
1667 if (speed >= 0) {
1668 manual = read_reg(th, MANUAL_MODE[fan]);
1669 + manual &= ~INVERT_MASK;
1670 write_reg(th, MANUAL_MODE[fan],
1671 - (manual|MANUAL_MASK) & (~INVERT_MASK));
1672 + manual | MANUAL_MASK | th->pwm_inv[fan]);
1673 write_reg(th, FAN_SPD_SET[fan], speed);
1674 } else {
1675 /* back to automatic */
1676 if(therm_type == ADT7460) {
1677 manual = read_reg(th,
1678 MANUAL_MODE[fan]) & (~MANUAL_MASK);
1679 -
1680 + manual &= ~INVERT_MASK;
1681 + manual |= th->pwm_inv[fan];
1682 write_reg(th,
1683 MANUAL_MODE[fan], manual|REM_CONTROL[fan]);
1684 } else {
1685 manual = read_reg(th, MANUAL_MODE[fan]);
1686 + manual &= ~INVERT_MASK;
1687 + manual |= th->pwm_inv[fan];
1688 write_reg(th, MANUAL_MODE[fan], manual&(~AUTO_MASK));
1689 }
1690 }
1691 @@ -418,6 +423,10 @@ static int probe_thermostat(struct i2c_client *client,
1692
1693 thermostat = th;
1694
1695 + /* record invert bit status because fw can corrupt it after suspend */
1696 + th->pwm_inv[0] = read_reg(th, MANUAL_MODE[0]) & INVERT_MASK;
1697 + th->pwm_inv[1] = read_reg(th, MANUAL_MODE[1]) & INVERT_MASK;
1698 +
1699 /* be sure to really write fan speed the first time */
1700 th->last_speed[0] = -2;
1701 th->last_speed[1] = -2;
1702 diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c
1703 index 961fa0e..6c68b9e 100644
1704 --- a/drivers/macintosh/windfarm_smu_controls.c
1705 +++ b/drivers/macintosh/windfarm_smu_controls.c
1706 @@ -202,6 +202,8 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node,
1707 fct->ctrl.name = "cpu-front-fan-1";
1708 else if (!strcmp(l, "CPU A PUMP"))
1709 fct->ctrl.name = "cpu-pump-0";
1710 + else if (!strcmp(l, "CPU B PUMP"))
1711 + fct->ctrl.name = "cpu-pump-1";
1712 else if (!strcmp(l, "Slots Fan") || !strcmp(l, "Slots fan") ||
1713 !strcmp(l, "EXPANSION SLOTS INTAKE"))
1714 fct->ctrl.name = "slots-fan";
1715 diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
1716 index 60e2b32..a5e5f2f 100644
1717 --- a/drivers/md/bitmap.c
1718 +++ b/drivers/md/bitmap.c
1719 @@ -1078,23 +1078,31 @@ static bitmap_counter_t *bitmap_get_counter(struct bitmap *bitmap,
1720 * out to disk
1721 */
1722
1723 -void bitmap_daemon_work(struct bitmap *bitmap)
1724 +void bitmap_daemon_work(mddev_t *mddev)
1725 {
1726 + struct bitmap *bitmap;
1727 unsigned long j;
1728 unsigned long flags;
1729 struct page *page = NULL, *lastpage = NULL;
1730 int blocks;
1731 void *paddr;
1732
1733 - if (bitmap == NULL)
1734 + /* Use a mutex to guard daemon_work against
1735 + * bitmap_destroy.
1736 + */
1737 + mutex_lock(&mddev->bitmap_mutex);
1738 + bitmap = mddev->bitmap;
1739 + if (bitmap == NULL) {
1740 + mutex_unlock(&mddev->bitmap_mutex);
1741 return;
1742 + }
1743 if (time_before(jiffies, bitmap->daemon_lastrun + bitmap->daemon_sleep*HZ))
1744 goto done;
1745
1746 bitmap->daemon_lastrun = jiffies;
1747 if (bitmap->allclean) {
1748 bitmap->mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
1749 - return;
1750 + goto done;
1751 }
1752 bitmap->allclean = 1;
1753
1754 @@ -1203,6 +1211,7 @@ void bitmap_daemon_work(struct bitmap *bitmap)
1755 done:
1756 if (bitmap->allclean == 0)
1757 bitmap->mddev->thread->timeout = bitmap->daemon_sleep * HZ;
1758 + mutex_unlock(&mddev->bitmap_mutex);
1759 }
1760
1761 static bitmap_counter_t *bitmap_get_counter(struct bitmap *bitmap,
1762 @@ -1541,9 +1550,9 @@ void bitmap_flush(mddev_t *mddev)
1763 */
1764 sleep = bitmap->daemon_sleep;
1765 bitmap->daemon_sleep = 0;
1766 - bitmap_daemon_work(bitmap);
1767 - bitmap_daemon_work(bitmap);
1768 - bitmap_daemon_work(bitmap);
1769 + bitmap_daemon_work(mddev);
1770 + bitmap_daemon_work(mddev);
1771 + bitmap_daemon_work(mddev);
1772 bitmap->daemon_sleep = sleep;
1773 bitmap_update_sb(bitmap);
1774 }
1775 @@ -1574,6 +1583,7 @@ static void bitmap_free(struct bitmap *bitmap)
1776 kfree(bp);
1777 kfree(bitmap);
1778 }
1779 +
1780 void bitmap_destroy(mddev_t *mddev)
1781 {
1782 struct bitmap *bitmap = mddev->bitmap;
1783 @@ -1581,7 +1591,9 @@ void bitmap_destroy(mddev_t *mddev)
1784 if (!bitmap) /* there was no bitmap */
1785 return;
1786
1787 + mutex_lock(&mddev->bitmap_mutex);
1788 mddev->bitmap = NULL; /* disconnect from the md device */
1789 + mutex_unlock(&mddev->bitmap_mutex);
1790 if (mddev->thread)
1791 mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
1792
1793 diff --git a/drivers/md/bitmap.h b/drivers/md/bitmap.h
1794 index e989006..7e38d13 100644
1795 --- a/drivers/md/bitmap.h
1796 +++ b/drivers/md/bitmap.h
1797 @@ -282,7 +282,7 @@ void bitmap_close_sync(struct bitmap *bitmap);
1798 void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector);
1799
1800 void bitmap_unplug(struct bitmap *bitmap);
1801 -void bitmap_daemon_work(struct bitmap *bitmap);
1802 +void bitmap_daemon_work(mddev_t *mddev);
1803 #endif
1804
1805 #endif
1806 diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
1807 index ed10381..959d6d1 100644
1808 --- a/drivers/md/dm-crypt.c
1809 +++ b/drivers/md/dm-crypt.c
1810 @@ -1,7 +1,7 @@
1811 /*
1812 * Copyright (C) 2003 Christophe Saout <christophe@saout.de>
1813 * Copyright (C) 2004 Clemens Fruhwirth <clemens@endorphin.org>
1814 - * Copyright (C) 2006-2008 Red Hat, Inc. All rights reserved.
1815 + * Copyright (C) 2006-2009 Red Hat, Inc. All rights reserved.
1816 *
1817 * This file is released under the GPL.
1818 */
1819 @@ -71,10 +71,21 @@ struct crypt_iv_operations {
1820 int (*ctr)(struct crypt_config *cc, struct dm_target *ti,
1821 const char *opts);
1822 void (*dtr)(struct crypt_config *cc);
1823 - const char *(*status)(struct crypt_config *cc);
1824 + int (*init)(struct crypt_config *cc);
1825 + int (*wipe)(struct crypt_config *cc);
1826 int (*generator)(struct crypt_config *cc, u8 *iv, sector_t sector);
1827 };
1828
1829 +struct iv_essiv_private {
1830 + struct crypto_cipher *tfm;
1831 + struct crypto_hash *hash_tfm;
1832 + u8 *salt;
1833 +};
1834 +
1835 +struct iv_benbi_private {
1836 + int shift;
1837 +};
1838 +
1839 /*
1840 * Crypt: maps a linear range of a block device
1841 * and encrypts / decrypts at the same time.
1842 @@ -102,8 +113,8 @@ struct crypt_config {
1843 struct crypt_iv_operations *iv_gen_ops;
1844 char *iv_mode;
1845 union {
1846 - struct crypto_cipher *essiv_tfm;
1847 - int benbi_shift;
1848 + struct iv_essiv_private essiv;
1849 + struct iv_benbi_private benbi;
1850 } iv_gen_private;
1851 sector_t iv_offset;
1852 unsigned int iv_size;
1853 @@ -169,88 +180,114 @@ static int crypt_iv_plain_gen(struct crypt_config *cc, u8 *iv, sector_t sector)
1854 return 0;
1855 }
1856
1857 -static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,
1858 - const char *opts)
1859 +/* Initialise ESSIV - compute salt but no local memory allocations */
1860 +static int crypt_iv_essiv_init(struct crypt_config *cc)
1861 {
1862 - struct crypto_cipher *essiv_tfm;
1863 - struct crypto_hash *hash_tfm;
1864 + struct iv_essiv_private *essiv = &cc->iv_gen_private.essiv;
1865 struct hash_desc desc;
1866 struct scatterlist sg;
1867 - unsigned int saltsize;
1868 - u8 *salt;
1869 int err;
1870
1871 - if (opts == NULL) {
1872 + sg_init_one(&sg, cc->key, cc->key_size);
1873 + desc.tfm = essiv->hash_tfm;
1874 + desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
1875 +
1876 + err = crypto_hash_digest(&desc, &sg, cc->key_size, essiv->salt);
1877 + if (err)
1878 + return err;
1879 +
1880 + return crypto_cipher_setkey(essiv->tfm, essiv->salt,
1881 + crypto_hash_digestsize(essiv->hash_tfm));
1882 +}
1883 +
1884 +/* Wipe salt and reset key derived from volume key */
1885 +static int crypt_iv_essiv_wipe(struct crypt_config *cc)
1886 +{
1887 + struct iv_essiv_private *essiv = &cc->iv_gen_private.essiv;
1888 + unsigned salt_size = crypto_hash_digestsize(essiv->hash_tfm);
1889 +
1890 + memset(essiv->salt, 0, salt_size);
1891 +
1892 + return crypto_cipher_setkey(essiv->tfm, essiv->salt, salt_size);
1893 +}
1894 +
1895 +static void crypt_iv_essiv_dtr(struct crypt_config *cc)
1896 +{
1897 + struct iv_essiv_private *essiv = &cc->iv_gen_private.essiv;
1898 +
1899 + crypto_free_cipher(essiv->tfm);
1900 + essiv->tfm = NULL;
1901 +
1902 + crypto_free_hash(essiv->hash_tfm);
1903 + essiv->hash_tfm = NULL;
1904 +
1905 + kzfree(essiv->salt);
1906 + essiv->salt = NULL;
1907 +}
1908 +
1909 +static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,
1910 + const char *opts)
1911 +{
1912 + struct crypto_cipher *essiv_tfm = NULL;
1913 + struct crypto_hash *hash_tfm = NULL;
1914 + u8 *salt = NULL;
1915 + int err;
1916 +
1917 + if (!opts) {
1918 ti->error = "Digest algorithm missing for ESSIV mode";
1919 return -EINVAL;
1920 }
1921
1922 - /* Hash the cipher key with the given hash algorithm */
1923 + /* Allocate hash algorithm */
1924 hash_tfm = crypto_alloc_hash(opts, 0, CRYPTO_ALG_ASYNC);
1925 if (IS_ERR(hash_tfm)) {
1926 ti->error = "Error initializing ESSIV hash";
1927 - return PTR_ERR(hash_tfm);
1928 + err = PTR_ERR(hash_tfm);
1929 + goto bad;
1930 }
1931
1932 - saltsize = crypto_hash_digestsize(hash_tfm);
1933 - salt = kmalloc(saltsize, GFP_KERNEL);
1934 - if (salt == NULL) {
1935 + salt = kzalloc(crypto_hash_digestsize(hash_tfm), GFP_KERNEL);
1936 + if (!salt) {
1937 ti->error = "Error kmallocing salt storage in ESSIV";
1938 - crypto_free_hash(hash_tfm);
1939 - return -ENOMEM;
1940 + err = -ENOMEM;
1941 + goto bad;
1942 }
1943
1944 - sg_init_one(&sg, cc->key, cc->key_size);
1945 - desc.tfm = hash_tfm;
1946 - desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
1947 - err = crypto_hash_digest(&desc, &sg, cc->key_size, salt);
1948 - crypto_free_hash(hash_tfm);
1949 -
1950 - if (err) {
1951 - ti->error = "Error calculating hash in ESSIV";
1952 - kfree(salt);
1953 - return err;
1954 - }
1955 -
1956 - /* Setup the essiv_tfm with the given salt */
1957 + /* Allocate essiv_tfm */
1958 essiv_tfm = crypto_alloc_cipher(cc->cipher, 0, CRYPTO_ALG_ASYNC);
1959 if (IS_ERR(essiv_tfm)) {
1960 ti->error = "Error allocating crypto tfm for ESSIV";
1961 - kfree(salt);
1962 - return PTR_ERR(essiv_tfm);
1963 + err = PTR_ERR(essiv_tfm);
1964 + goto bad;
1965 }
1966 if (crypto_cipher_blocksize(essiv_tfm) !=
1967 crypto_ablkcipher_ivsize(cc->tfm)) {
1968 ti->error = "Block size of ESSIV cipher does "
1969 "not match IV size of block cipher";
1970 - crypto_free_cipher(essiv_tfm);
1971 - kfree(salt);
1972 - return -EINVAL;
1973 - }
1974 - err = crypto_cipher_setkey(essiv_tfm, salt, saltsize);
1975 - if (err) {
1976 - ti->error = "Failed to set key for ESSIV cipher";
1977 - crypto_free_cipher(essiv_tfm);
1978 - kfree(salt);
1979 - return err;
1980 + err = -EINVAL;
1981 + goto bad;
1982 }
1983 - kfree(salt);
1984
1985 - cc->iv_gen_private.essiv_tfm = essiv_tfm;
1986 + cc->iv_gen_private.essiv.salt = salt;
1987 + cc->iv_gen_private.essiv.tfm = essiv_tfm;
1988 + cc->iv_gen_private.essiv.hash_tfm = hash_tfm;
1989 +
1990 return 0;
1991 -}
1992
1993 -static void crypt_iv_essiv_dtr(struct crypt_config *cc)
1994 -{
1995 - crypto_free_cipher(cc->iv_gen_private.essiv_tfm);
1996 - cc->iv_gen_private.essiv_tfm = NULL;
1997 +bad:
1998 + if (essiv_tfm && !IS_ERR(essiv_tfm))
1999 + crypto_free_cipher(essiv_tfm);
2000 + if (hash_tfm && !IS_ERR(hash_tfm))
2001 + crypto_free_hash(hash_tfm);
2002 + kfree(salt);
2003 + return err;
2004 }
2005
2006 static int crypt_iv_essiv_gen(struct crypt_config *cc, u8 *iv, sector_t sector)
2007 {
2008 memset(iv, 0, cc->iv_size);
2009 *(u64 *)iv = cpu_to_le64(sector);
2010 - crypto_cipher_encrypt_one(cc->iv_gen_private.essiv_tfm, iv, iv);
2011 + crypto_cipher_encrypt_one(cc->iv_gen_private.essiv.tfm, iv, iv);
2012 return 0;
2013 }
2014
2015 @@ -273,7 +310,7 @@ static int crypt_iv_benbi_ctr(struct crypt_config *cc, struct dm_target *ti,
2016 return -EINVAL;
2017 }
2018
2019 - cc->iv_gen_private.benbi_shift = 9 - log;
2020 + cc->iv_gen_private.benbi.shift = 9 - log;
2021
2022 return 0;
2023 }
2024 @@ -288,7 +325,7 @@ static int crypt_iv_benbi_gen(struct crypt_config *cc, u8 *iv, sector_t sector)
2025
2026 memset(iv, 0, cc->iv_size - sizeof(u64)); /* rest is cleared below */
2027
2028 - val = cpu_to_be64(((u64)sector << cc->iv_gen_private.benbi_shift) + 1);
2029 + val = cpu_to_be64(((u64)sector << cc->iv_gen_private.benbi.shift) + 1);
2030 put_unaligned(val, (__be64 *)(iv + cc->iv_size - sizeof(u64)));
2031
2032 return 0;
2033 @@ -308,6 +345,8 @@ static struct crypt_iv_operations crypt_iv_plain_ops = {
2034 static struct crypt_iv_operations crypt_iv_essiv_ops = {
2035 .ctr = crypt_iv_essiv_ctr,
2036 .dtr = crypt_iv_essiv_dtr,
2037 + .init = crypt_iv_essiv_init,
2038 + .wipe = crypt_iv_essiv_wipe,
2039 .generator = crypt_iv_essiv_gen
2040 };
2041
2042 @@ -1039,6 +1078,12 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
2043 cc->iv_gen_ops->ctr(cc, ti, ivopts) < 0)
2044 goto bad_ivmode;
2045
2046 + if (cc->iv_gen_ops && cc->iv_gen_ops->init &&
2047 + cc->iv_gen_ops->init(cc) < 0) {
2048 + ti->error = "Error initialising IV";
2049 + goto bad_slab_pool;
2050 + }
2051 +
2052 cc->iv_size = crypto_ablkcipher_ivsize(tfm);
2053 if (cc->iv_size)
2054 /* at least a 64 bit sector number should fit in our buffer */
2055 @@ -1278,6 +1323,7 @@ static void crypt_resume(struct dm_target *ti)
2056 static int crypt_message(struct dm_target *ti, unsigned argc, char **argv)
2057 {
2058 struct crypt_config *cc = ti->private;
2059 + int ret = -EINVAL;
2060
2061 if (argc < 2)
2062 goto error;
2063 @@ -1287,10 +1333,22 @@ static int crypt_message(struct dm_target *ti, unsigned argc, char **argv)
2064 DMWARN("not suspended during key manipulation.");
2065 return -EINVAL;
2066 }
2067 - if (argc == 3 && !strnicmp(argv[1], MESG_STR("set")))
2068 - return crypt_set_key(cc, argv[2]);
2069 - if (argc == 2 && !strnicmp(argv[1], MESG_STR("wipe")))
2070 + if (argc == 3 && !strnicmp(argv[1], MESG_STR("set"))) {
2071 + ret = crypt_set_key(cc, argv[2]);
2072 + if (ret)
2073 + return ret;
2074 + if (cc->iv_gen_ops && cc->iv_gen_ops->init)
2075 + ret = cc->iv_gen_ops->init(cc);
2076 + return ret;
2077 + }
2078 + if (argc == 2 && !strnicmp(argv[1], MESG_STR("wipe"))) {
2079 + if (cc->iv_gen_ops && cc->iv_gen_ops->wipe) {
2080 + ret = cc->iv_gen_ops->wipe(cc);
2081 + if (ret)
2082 + return ret;
2083 + }
2084 return crypt_wipe_key(cc);
2085 + }
2086 }
2087
2088 error:
2089 diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
2090 index 7dbe652..2052159 100644
2091 --- a/drivers/md/dm-exception-store.c
2092 +++ b/drivers/md/dm-exception-store.c
2093 @@ -216,7 +216,8 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
2094 type = get_type("N");
2095 else {
2096 ti->error = "Persistent flag is not P or N";
2097 - return -EINVAL;
2098 + r = -EINVAL;
2099 + goto bad_type;
2100 }
2101
2102 if (!type) {
2103 diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
2104 index a679429..d19854c 100644
2105 --- a/drivers/md/dm-ioctl.c
2106 +++ b/drivers/md/dm-ioctl.c
2107 @@ -56,6 +56,11 @@ static void dm_hash_remove_all(int keep_open_devices);
2108 */
2109 static DECLARE_RWSEM(_hash_lock);
2110
2111 +/*
2112 + * Protects use of mdptr to obtain hash cell name and uuid from mapped device.
2113 + */
2114 +static DEFINE_MUTEX(dm_hash_cells_mutex);
2115 +
2116 static void init_buckets(struct list_head *buckets)
2117 {
2118 unsigned int i;
2119 @@ -206,7 +211,9 @@ static int dm_hash_insert(const char *name, const char *uuid, struct mapped_devi
2120 list_add(&cell->uuid_list, _uuid_buckets + hash_str(uuid));
2121 }
2122 dm_get(md);
2123 + mutex_lock(&dm_hash_cells_mutex);
2124 dm_set_mdptr(md, cell);
2125 + mutex_unlock(&dm_hash_cells_mutex);
2126 up_write(&_hash_lock);
2127
2128 return 0;
2129 @@ -224,7 +231,9 @@ static void __hash_remove(struct hash_cell *hc)
2130 /* remove from the dev hash */
2131 list_del(&hc->uuid_list);
2132 list_del(&hc->name_list);
2133 + mutex_lock(&dm_hash_cells_mutex);
2134 dm_set_mdptr(hc->md, NULL);
2135 + mutex_unlock(&dm_hash_cells_mutex);
2136
2137 table = dm_get_table(hc->md);
2138 if (table) {
2139 @@ -321,7 +330,9 @@ static int dm_hash_rename(uint32_t cookie, const char *old, const char *new)
2140 */
2141 list_del(&hc->name_list);
2142 old_name = hc->name;
2143 + mutex_lock(&dm_hash_cells_mutex);
2144 hc->name = new_name;
2145 + mutex_unlock(&dm_hash_cells_mutex);
2146 list_add(&hc->name_list, _name_buckets + hash_str(new_name));
2147
2148 /*
2149 @@ -1582,8 +1593,7 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid)
2150 if (!md)
2151 return -ENXIO;
2152
2153 - dm_get(md);
2154 - down_read(&_hash_lock);
2155 + mutex_lock(&dm_hash_cells_mutex);
2156 hc = dm_get_mdptr(md);
2157 if (!hc || hc->md != md) {
2158 r = -ENXIO;
2159 @@ -1596,8 +1606,7 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid)
2160 strcpy(uuid, hc->uuid ? : "");
2161
2162 out:
2163 - up_read(&_hash_lock);
2164 - dm_put(md);
2165 + mutex_unlock(&dm_hash_cells_mutex);
2166
2167 return r;
2168 }
2169 diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
2170 index 3a3ba46..8a4a9c8 100644
2171 --- a/drivers/md/dm-snap.c
2172 +++ b/drivers/md/dm-snap.c
2173 @@ -553,6 +553,8 @@ static int init_hash_tables(struct dm_snapshot *s)
2174 hash_size = min(origin_dev_size, cow_dev_size) >> s->store->chunk_shift;
2175 hash_size = min(hash_size, max_buckets);
2176
2177 + if (hash_size < 64)
2178 + hash_size = 64;
2179 hash_size = rounddown_pow_of_two(hash_size);
2180 if (init_exception_table(&s->complete, hash_size,
2181 DM_CHUNK_CONSECUTIVE_BITS))
2182 @@ -1152,10 +1154,11 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
2183 unsigned sz = 0;
2184 struct dm_snapshot *snap = ti->private;
2185
2186 - down_write(&snap->lock);
2187 -
2188 switch (type) {
2189 case STATUSTYPE_INFO:
2190 +
2191 + down_write(&snap->lock);
2192 +
2193 if (!snap->valid)
2194 DMEMIT("Invalid");
2195 else {
2196 @@ -1171,6 +1174,9 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
2197 else
2198 DMEMIT("Unknown");
2199 }
2200 +
2201 + up_write(&snap->lock);
2202 +
2203 break;
2204
2205 case STATUSTYPE_TABLE:
2206 @@ -1185,8 +1191,6 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
2207 break;
2208 }
2209
2210 - up_write(&snap->lock);
2211 -
2212 return 0;
2213 }
2214
2215 diff --git a/drivers/md/dm-uevent.c b/drivers/md/dm-uevent.c
2216 index 6f65883..c7c555a 100644
2217 --- a/drivers/md/dm-uevent.c
2218 +++ b/drivers/md/dm-uevent.c
2219 @@ -139,14 +139,13 @@ void dm_send_uevents(struct list_head *events, struct kobject *kobj)
2220 list_del_init(&event->elist);
2221
2222 /*
2223 - * Need to call dm_copy_name_and_uuid from here for now.
2224 - * Context of previous var adds and locking used for
2225 - * hash_cell not compatable.
2226 + * When a device is being removed this copy fails and we
2227 + * discard these unsent events.
2228 */
2229 if (dm_copy_name_and_uuid(event->md, event->name,
2230 event->uuid)) {
2231 - DMERR("%s: dm_copy_name_and_uuid() failed",
2232 - __func__);
2233 + DMINFO("%s: skipping sending uevent for lost device",
2234 + __func__);
2235 goto uevent_free;
2236 }
2237
2238 diff --git a/drivers/md/md.c b/drivers/md/md.c
2239 index b182f86..02e4551 100644
2240 --- a/drivers/md/md.c
2241 +++ b/drivers/md/md.c
2242 @@ -367,6 +367,7 @@ static mddev_t * mddev_find(dev_t unit)
2243
2244 mutex_init(&new->open_mutex);
2245 mutex_init(&new->reconfig_mutex);
2246 + mutex_init(&new->bitmap_mutex);
2247 INIT_LIST_HEAD(&new->disks);
2248 INIT_LIST_HEAD(&new->all_mddevs);
2249 init_timer(&new->safemode_timer);
2250 @@ -6629,7 +6630,7 @@ void md_check_recovery(mddev_t *mddev)
2251
2252
2253 if (mddev->bitmap)
2254 - bitmap_daemon_work(mddev->bitmap);
2255 + bitmap_daemon_work(mddev);
2256
2257 if (mddev->ro)
2258 return;
2259 diff --git a/drivers/md/md.h b/drivers/md/md.h
2260 index f184b69..87430fe 100644
2261 --- a/drivers/md/md.h
2262 +++ b/drivers/md/md.h
2263 @@ -289,6 +289,7 @@ struct mddev_s
2264 * hot-adding a bitmap. It should
2265 * eventually be settable by sysfs.
2266 */
2267 + struct mutex bitmap_mutex;
2268
2269 struct list_head all_mddevs;
2270 };
2271 diff --git a/drivers/media/common/tuners/mxl5007t.c b/drivers/media/common/tuners/mxl5007t.c
2272 index 2d02698..7eb1bf7 100644
2273 --- a/drivers/media/common/tuners/mxl5007t.c
2274 +++ b/drivers/media/common/tuners/mxl5007t.c
2275 @@ -196,7 +196,7 @@ static void copy_reg_bits(struct reg_pair_t *reg_pair1,
2276 i = j = 0;
2277
2278 while (reg_pair1[i].reg || reg_pair1[i].val) {
2279 - while (reg_pair2[j].reg || reg_pair2[j].reg) {
2280 + while (reg_pair2[j].reg || reg_pair2[j].val) {
2281 if (reg_pair1[i].reg != reg_pair2[j].reg) {
2282 j++;
2283 continue;
2284 diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c
2285 index a5c190e..e165578 100644
2286 --- a/drivers/media/video/gspca/ov519.c
2287 +++ b/drivers/media/video/gspca/ov519.c
2288 @@ -3364,6 +3364,7 @@ static const __devinitdata struct usb_device_id device_table[] = {
2289 {USB_DEVICE(0x041e, 0x4061), .driver_info = BRIDGE_OV519 },
2290 {USB_DEVICE(0x041e, 0x4064),
2291 .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED },
2292 + {USB_DEVICE(0x041e, 0x4067), .driver_info = BRIDGE_OV519 },
2293 {USB_DEVICE(0x041e, 0x4068),
2294 .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED },
2295 {USB_DEVICE(0x045e, 0x028c), .driver_info = BRIDGE_OV519 },
2296 diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c
2297 index 74fdc40..c1d7b88 100644
2298 --- a/drivers/mtd/ubi/upd.c
2299 +++ b/drivers/mtd/ubi/upd.c
2300 @@ -147,12 +147,14 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol,
2301 }
2302
2303 if (bytes == 0) {
2304 + err = ubi_wl_flush(ubi);
2305 + if (err)
2306 + return err;
2307 +
2308 err = clear_update_marker(ubi, vol, 0);
2309 if (err)
2310 return err;
2311 - err = ubi_wl_flush(ubi);
2312 - if (!err)
2313 - vol->updating = 0;
2314 + vol->updating = 0;
2315 }
2316
2317 vol->upd_buf = vmalloc(ubi->leb_size);
2318 @@ -362,16 +364,16 @@ int ubi_more_update_data(struct ubi_device *ubi, struct ubi_volume *vol,
2319
2320 ubi_assert(vol->upd_received <= vol->upd_bytes);
2321 if (vol->upd_received == vol->upd_bytes) {
2322 + err = ubi_wl_flush(ubi);
2323 + if (err)
2324 + return err;
2325 /* The update is finished, clear the update marker */
2326 err = clear_update_marker(ubi, vol, vol->upd_bytes);
2327 if (err)
2328 return err;
2329 - err = ubi_wl_flush(ubi);
2330 - if (err == 0) {
2331 - vol->updating = 0;
2332 - err = to_write;
2333 - vfree(vol->upd_buf);
2334 - }
2335 + vol->updating = 0;
2336 + err = to_write;
2337 + vfree(vol->upd_buf);
2338 }
2339
2340 return err;
2341 diff --git a/drivers/net/b44.c b/drivers/net/b44.c
2342 index 2a91323..4869adb 100644
2343 --- a/drivers/net/b44.c
2344 +++ b/drivers/net/b44.c
2345 @@ -1505,8 +1505,7 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset)
2346 for (k = 0; k< ethaddr_bytes; k++) {
2347 ppattern[offset + magicsync +
2348 (j * ETH_ALEN) + k] = macaddr[k];
2349 - len++;
2350 - set_bit(len, (unsigned long *) pmask);
2351 + set_bit(len++, (unsigned long *) pmask);
2352 }
2353 }
2354 return len - 1;
2355 diff --git a/drivers/net/bcm63xx_enet.c b/drivers/net/bcm63xx_enet.c
2356 index ba29dc3..d110c1b 100644
2357 --- a/drivers/net/bcm63xx_enet.c
2358 +++ b/drivers/net/bcm63xx_enet.c
2359 @@ -1248,9 +1248,15 @@ static void bcm_enet_get_drvinfo(struct net_device *netdev,
2360 drvinfo->n_stats = BCM_ENET_STATS_LEN;
2361 }
2362
2363 -static int bcm_enet_get_stats_count(struct net_device *netdev)
2364 +static int bcm_enet_get_sset_count(struct net_device *netdev,
2365 + int string_set)
2366 {
2367 - return BCM_ENET_STATS_LEN;
2368 + switch (string_set) {
2369 + case ETH_SS_STATS:
2370 + return BCM_ENET_STATS_LEN;
2371 + default:
2372 + return -EINVAL;
2373 + }
2374 }
2375
2376 static void bcm_enet_get_strings(struct net_device *netdev,
2377 @@ -1476,7 +1482,7 @@ static int bcm_enet_set_pauseparam(struct net_device *dev,
2378
2379 static struct ethtool_ops bcm_enet_ethtool_ops = {
2380 .get_strings = bcm_enet_get_strings,
2381 - .get_stats_count = bcm_enet_get_stats_count,
2382 + .get_sset_count = bcm_enet_get_sset_count,
2383 .get_ethtool_stats = bcm_enet_get_ethtool_stats,
2384 .get_settings = bcm_enet_get_settings,
2385 .set_settings = bcm_enet_set_settings,
2386 diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c
2387 index 644962a..7918852 100644
2388 --- a/drivers/net/wireless/ath/ath5k/eeprom.c
2389 +++ b/drivers/net/wireless/ath/ath5k/eeprom.c
2390 @@ -97,6 +97,7 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
2391 struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
2392 int ret;
2393 u16 val;
2394 + u32 cksum, offset;
2395
2396 /*
2397 * Read values from EEPROM and store them in the capability structure
2398 @@ -111,7 +112,6 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
2399 if (ah->ah_ee_version < AR5K_EEPROM_VERSION_3_0)
2400 return 0;
2401
2402 -#ifdef notyet
2403 /*
2404 * Validate the checksum of the EEPROM date. There are some
2405 * devices with invalid EEPROMs.
2406 @@ -124,7 +124,6 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
2407 ATH5K_ERR(ah->ah_sc, "Invalid EEPROM checksum 0x%04x\n", cksum);
2408 return -EIO;
2409 }
2410 -#endif
2411
2412 AR5K_EEPROM_READ_HDR(AR5K_EEPROM_ANT_GAIN(ah->ah_ee_version),
2413 ee_ant_gain);
2414 diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
2415 index 1a039f2..9d67647 100644
2416 --- a/drivers/net/wireless/ath/ath5k/phy.c
2417 +++ b/drivers/net/wireless/ath/ath5k/phy.c
2418 @@ -2954,8 +2954,6 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
2419 ATH5K_ERR(ah->ah_sc, "invalid tx power: %u\n", txpower);
2420 return -EINVAL;
2421 }
2422 - if (txpower == 0)
2423 - txpower = AR5K_TUNE_DEFAULT_TXPOWER;
2424
2425 /* Reset TX power values */
2426 memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));
2427 diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
2428 index 1d59f10..cdb90c5 100644
2429 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
2430 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
2431 @@ -139,6 +139,7 @@ struct ath_buf {
2432 dma_addr_t bf_daddr; /* physical addr of desc */
2433 dma_addr_t bf_buf_addr; /* physical addr of data buffer */
2434 bool bf_stale;
2435 + bool bf_isnullfunc;
2436 u16 bf_flags;
2437 struct ath_buf_state bf_state;
2438 dma_addr_t bf_dmacontext;
2439 @@ -524,6 +525,8 @@ struct ath_led {
2440 #define SC_OP_BEACON_SYNC BIT(19)
2441 #define SC_OP_BTCOEX_ENABLED BIT(20)
2442 #define SC_OP_BT_PRIORITY_DETECTED BIT(21)
2443 +#define SC_OP_NULLFUNC_COMPLETED BIT(22)
2444 +#define SC_OP_PS_ENABLED BIT(23)
2445
2446 struct ath_bus_ops {
2447 void (*read_cachesize)(struct ath_softc *sc, int *csz);
2448 diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
2449 index ca7694c..c7aa05a 100644
2450 --- a/drivers/net/wireless/ath/ath9k/hw.c
2451 +++ b/drivers/net/wireless/ath/ath9k/hw.c
2452 @@ -937,6 +937,11 @@ int ath9k_hw_init(struct ath_hw *ah)
2453 DPRINTF(ah->ah_sc, ATH_DBG_RESET, "serialize_regmode is %d\n",
2454 ah->config.serialize_regmode);
2455
2456 + if (AR_SREV_9285(ah) || AR_SREV_9271(ah))
2457 + ah->config.max_txtrig_level = MAX_TX_FIFO_THRESHOLD >> 1;
2458 + else
2459 + ah->config.max_txtrig_level = MAX_TX_FIFO_THRESHOLD;
2460 +
2461 if (!ath9k_hw_macversion_supported(ah->hw_version.macVersion)) {
2462 DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
2463 "Mac Chip Rev 0x%02x.%x is not supported by "
2464 @@ -3670,7 +3675,11 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah)
2465 pCap->keycache_size = AR_KEYTABLE_SIZE;
2466
2467 pCap->hw_caps |= ATH9K_HW_CAP_FASTCC;
2468 - pCap->tx_triglevel_max = MAX_TX_FIFO_THRESHOLD;
2469 +
2470 + if (AR_SREV_9285(ah) || AR_SREV_9271(ah))
2471 + pCap->tx_triglevel_max = MAX_TX_FIFO_THRESHOLD >> 1;
2472 + else
2473 + pCap->tx_triglevel_max = MAX_TX_FIFO_THRESHOLD;
2474
2475 if (AR_SREV_9285_10_OR_LATER(ah))
2476 pCap->num_gpio_pins = AR9285_NUM_GPIO;
2477 diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
2478 index b892345..57f1463 100644
2479 --- a/drivers/net/wireless/ath/ath9k/hw.h
2480 +++ b/drivers/net/wireless/ath/ath9k/hw.h
2481 @@ -218,6 +218,7 @@ struct ath9k_ops_config {
2482 #define AR_SPUR_FEEQ_BOUND_HT20 10
2483 int spurmode;
2484 u16 spurchans[AR_EEPROM_MODAL_SPURS][2];
2485 + u8 max_txtrig_level;
2486 };
2487
2488 enum ath9k_int {
2489 diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
2490 index 800bfab..d4d9d82 100644
2491 --- a/drivers/net/wireless/ath/ath9k/mac.c
2492 +++ b/drivers/net/wireless/ath/ath9k/mac.c
2493 @@ -70,7 +70,7 @@ bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel)
2494 u32 txcfg, curLevel, newLevel;
2495 enum ath9k_int omask;
2496
2497 - if (ah->tx_trig_level >= MAX_TX_FIFO_THRESHOLD)
2498 + if (ah->tx_trig_level >= ah->config.max_txtrig_level)
2499 return false;
2500
2501 omask = ath9k_hw_set_interrupts(ah, ah->mask_reg & ~ATH9K_INT_GLOBAL);
2502 @@ -79,7 +79,7 @@ bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel)
2503 curLevel = MS(txcfg, AR_FTRIG);
2504 newLevel = curLevel;
2505 if (bIncTrigLevel) {
2506 - if (curLevel < MAX_TX_FIFO_THRESHOLD)
2507 + if (curLevel < ah->config.max_txtrig_level)
2508 newLevel++;
2509 } else if (curLevel > MIN_TX_FIFO_THRESHOLD)
2510 newLevel--;
2511 @@ -222,6 +222,8 @@ int ath9k_hw_txprocdesc(struct ath_hw *ah, struct ath_desc *ds)
2512 ds->ds_txstat.ts_status = 0;
2513 ds->ds_txstat.ts_flags = 0;
2514
2515 + if (ads->ds_txstatus1 & AR_FrmXmitOK)
2516 + ds->ds_txstat.ts_status |= ATH9K_TX_ACKED;
2517 if (ads->ds_txstatus1 & AR_ExcessiveRetries)
2518 ds->ds_txstat.ts_status |= ATH9K_TXERR_XRETRY;
2519 if (ads->ds_txstatus1 & AR_Filtered)
2520 diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h
2521 index f56e77d..ff65f85 100644
2522 --- a/drivers/net/wireless/ath/ath9k/mac.h
2523 +++ b/drivers/net/wireless/ath/ath9k/mac.h
2524 @@ -76,6 +76,7 @@
2525 #define ATH9K_TXERR_FIFO 0x04
2526 #define ATH9K_TXERR_XTXOP 0x08
2527 #define ATH9K_TXERR_TIMER_EXPIRED 0x10
2528 +#define ATH9K_TX_ACKED 0x20
2529
2530 #define ATH9K_TX_BA 0x01
2531 #define ATH9K_TX_PWRMGMT 0x02
2532 diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
2533 index 43d2be9..59359e3 100644
2534 --- a/drivers/net/wireless/ath/ath9k/main.c
2535 +++ b/drivers/net/wireless/ath/ath9k/main.c
2536 @@ -2327,6 +2327,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
2537
2538 if (changed & IEEE80211_CONF_CHANGE_PS) {
2539 if (conf->flags & IEEE80211_CONF_PS) {
2540 + sc->sc_flags |= SC_OP_PS_ENABLED;
2541 if (!(ah->caps.hw_caps &
2542 ATH9K_HW_CAP_AUTOSLEEP)) {
2543 if ((sc->imask & ATH9K_INT_TIM_TIMER) == 0) {
2544 @@ -2334,11 +2335,17 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
2545 ath9k_hw_set_interrupts(sc->sc_ah,
2546 sc->imask);
2547 }
2548 - ath9k_hw_setrxabort(sc->sc_ah, 1);
2549 }
2550 sc->ps_enabled = true;
2551 + if ((sc->sc_flags & SC_OP_NULLFUNC_COMPLETED)) {
2552 + sc->sc_flags &= ~SC_OP_NULLFUNC_COMPLETED;
2553 + sc->ps_enabled = true;
2554 + ath9k_hw_setrxabort(sc->sc_ah, 1);
2555 + }
2556 } else {
2557 sc->ps_enabled = false;
2558 + sc->sc_flags &= ~(SC_OP_PS_ENABLED |
2559 + SC_OP_NULLFUNC_COMPLETED);
2560 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
2561 if (!(ah->caps.hw_caps &
2562 ATH9K_HW_CAP_AUTOSLEEP)) {
2563 diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
2564 index 42551a4..4753909 100644
2565 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2566 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
2567 @@ -1592,6 +1592,13 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf,
2568 }
2569
2570 bf->bf_buf_addr = bf->bf_dmacontext;
2571 +
2572 + if (ieee80211_is_nullfunc(fc) && ieee80211_has_pm(fc)) {
2573 + bf->bf_isnullfunc = true;
2574 + sc->sc_flags &= ~SC_OP_NULLFUNC_COMPLETED;
2575 + } else
2576 + bf->bf_isnullfunc = false;
2577 +
2578 return 0;
2579 }
2580
2581 @@ -1989,6 +1996,15 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
2582 if (ds == txq->axq_gatingds)
2583 txq->axq_gatingds = NULL;
2584
2585 + if (bf->bf_isnullfunc &&
2586 + (ds->ds_txstat.ts_status & ATH9K_TX_ACKED)) {
2587 + if ((sc->sc_flags & SC_OP_PS_ENABLED)) {
2588 + sc->ps_enabled = true;
2589 + ath9k_hw_setrxabort(sc->sc_ah, 1);
2590 + } else
2591 + sc->sc_flags |= SC_OP_NULLFUNC_COMPLETED;
2592 + }
2593 +
2594 /*
2595 * Remove ath_buf's of the same transmit unit from txq,
2596 * however leave the last descriptor back as the holding
2597 @@ -2004,7 +2020,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
2598 if (bf_isaggr(bf))
2599 txq->axq_aggr_depth--;
2600
2601 - txok = (ds->ds_txstat.ts_status == 0);
2602 + txok = !(ds->ds_txstat.ts_status & ATH9K_TXERR_FILT);
2603 txq->axq_tx_inprogress = false;
2604 spin_unlock_bh(&txq->axq_lock);
2605
2606 @@ -2065,7 +2081,9 @@ static void ath_tx_complete_poll_work(struct work_struct *work)
2607
2608 if (needreset) {
2609 DPRINTF(sc, ATH_DBG_RESET, "tx hung, resetting the chip\n");
2610 + ath9k_ps_wakeup(sc);
2611 ath_reset(sc, false);
2612 + ath9k_ps_restore(sc);
2613 }
2614
2615 ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work,
2616 diff --git a/drivers/net/wireless/b43legacy/rfkill.c b/drivers/net/wireless/b43legacy/rfkill.c
2617 index 8783022..d579df7 100644
2618 --- a/drivers/net/wireless/b43legacy/rfkill.c
2619 +++ b/drivers/net/wireless/b43legacy/rfkill.c
2620 @@ -34,6 +34,13 @@ bool b43legacy_is_hw_radio_enabled(struct b43legacy_wldev *dev)
2621 & B43legacy_MMIO_RADIO_HWENABLED_HI_MASK))
2622 return 1;
2623 } else {
2624 + /* To prevent CPU fault on PPC, do not read a register
2625 + * unless the interface is started; however, on resume
2626 + * for hibernation, this routine is entered early. When
2627 + * that happens, unconditionally return TRUE.
2628 + */
2629 + if (b43legacy_status(dev) < B43legacy_STAT_STARTED)
2630 + return 1;
2631 if (b43legacy_read16(dev, B43legacy_MMIO_RADIO_HWENABLED_LO)
2632 & B43legacy_MMIO_RADIO_HWENABLED_LO_MASK)
2633 return 1;
2634 diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
2635 index 6e2fc0c..43102bf 100644
2636 --- a/drivers/net/wireless/ipw2x00/ipw2100.c
2637 +++ b/drivers/net/wireless/ipw2x00/ipw2100.c
2638 @@ -6487,6 +6487,16 @@ static int ipw2100_resume(struct pci_dev *pci_dev)
2639 }
2640 #endif
2641
2642 +static void ipw2100_shutdown(struct pci_dev *pci_dev)
2643 +{
2644 + struct ipw2100_priv *priv = pci_get_drvdata(pci_dev);
2645 +
2646 + /* Take down the device; powers it off, etc. */
2647 + ipw2100_down(priv);
2648 +
2649 + pci_disable_device(pci_dev);
2650 +}
2651 +
2652 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x }
2653
2654 static struct pci_device_id ipw2100_pci_id_table[] __devinitdata = {
2655 @@ -6550,6 +6560,7 @@ static struct pci_driver ipw2100_pci_driver = {
2656 .suspend = ipw2100_suspend,
2657 .resume = ipw2100_resume,
2658 #endif
2659 + .shutdown = ipw2100_shutdown,
2660 };
2661
2662 /**
2663 diff --git a/drivers/net/wireless/rtl818x/rtl8187.h b/drivers/net/wireless/rtl818x/rtl8187.h
2664 index bf9175a..99406bf 100644
2665 --- a/drivers/net/wireless/rtl818x/rtl8187.h
2666 +++ b/drivers/net/wireless/rtl818x/rtl8187.h
2667 @@ -23,6 +23,7 @@
2668 #define RTL8187_EEPROM_TXPWR_CHAN_1 0x16 /* 3 channels */
2669 #define RTL8187_EEPROM_TXPWR_CHAN_6 0x1B /* 2 channels */
2670 #define RTL8187_EEPROM_TXPWR_CHAN_4 0x3D /* 2 channels */
2671 +#define RTL8187_EEPROM_SELECT_GPIO 0x3B
2672
2673 #define RTL8187_REQT_READ 0xC0
2674 #define RTL8187_REQT_WRITE 0x40
2675 @@ -31,6 +32,9 @@
2676
2677 #define RTL8187_MAX_RX 0x9C4
2678
2679 +#define RFKILL_MASK_8187_89_97 0x2
2680 +#define RFKILL_MASK_8198 0x4
2681 +
2682 struct rtl8187_rx_info {
2683 struct urb *urb;
2684 struct ieee80211_hw *dev;
2685 @@ -123,6 +127,7 @@ struct rtl8187_priv {
2686 u8 noise;
2687 u8 slot_time;
2688 u8 aifsn[4];
2689 + u8 rfkill_mask;
2690 struct {
2691 __le64 buf;
2692 struct sk_buff_head queue;
2693 diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
2694 index 2017ccc..ea49918 100644
2695 --- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
2696 +++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
2697 @@ -1329,6 +1329,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
2698 struct ieee80211_channel *channel;
2699 const char *chip_name;
2700 u16 txpwr, reg;
2701 + u16 product_id = le16_to_cpu(udev->descriptor.idProduct);
2702 int err, i;
2703
2704 dev = ieee80211_alloc_hw(sizeof(*priv), &rtl8187_ops);
2705 @@ -1488,6 +1489,13 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
2706 (*channel++).hw_value = txpwr & 0xFF;
2707 (*channel++).hw_value = txpwr >> 8;
2708 }
2709 + /* Handle the differing rfkill GPIO bit in different models */
2710 + priv->rfkill_mask = RFKILL_MASK_8187_89_97;
2711 + if (product_id == 0x8197 || product_id == 0x8198) {
2712 + eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_SELECT_GPIO, &reg);
2713 + if (reg & 0xFF00)
2714 + priv->rfkill_mask = RFKILL_MASK_8198;
2715 + }
2716
2717 /*
2718 * XXX: Once this driver supports anything that requires
2719 @@ -1516,9 +1524,9 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
2720 mutex_init(&priv->conf_mutex);
2721 skb_queue_head_init(&priv->b_tx_status.queue);
2722
2723 - printk(KERN_INFO "%s: hwaddr %pM, %s V%d + %s\n",
2724 + printk(KERN_INFO "%s: hwaddr %pM, %s V%d + %s, rfkill mask %d\n",
2725 wiphy_name(dev->wiphy), dev->wiphy->perm_addr,
2726 - chip_name, priv->asic_rev, priv->rf->name);
2727 + chip_name, priv->asic_rev, priv->rf->name, priv->rfkill_mask);
2728
2729 #ifdef CONFIG_RTL8187_LEDS
2730 eeprom_93cx6_read(&eeprom, 0x3F, &reg);
2731 diff --git a/drivers/net/wireless/rtl818x/rtl8187_rfkill.c b/drivers/net/wireless/rtl818x/rtl8187_rfkill.c
2732 index cad8037..03555e1 100644
2733 --- a/drivers/net/wireless/rtl818x/rtl8187_rfkill.c
2734 +++ b/drivers/net/wireless/rtl818x/rtl8187_rfkill.c
2735 @@ -25,10 +25,10 @@ static bool rtl8187_is_radio_enabled(struct rtl8187_priv *priv)
2736 u8 gpio;
2737
2738 gpio = rtl818x_ioread8(priv, &priv->map->GPIO0);
2739 - rtl818x_iowrite8(priv, &priv->map->GPIO0, gpio & ~0x02);
2740 + rtl818x_iowrite8(priv, &priv->map->GPIO0, gpio & ~priv->rfkill_mask);
2741 gpio = rtl818x_ioread8(priv, &priv->map->GPIO1);
2742
2743 - return gpio & 0x02;
2744 + return gpio & priv->rfkill_mask;
2745 }
2746
2747 void rtl8187_rfkill_init(struct ieee80211_hw *hw)
2748 diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
2749 index b952ebc..5753036 100644
2750 --- a/drivers/pci/dmar.c
2751 +++ b/drivers/pci/dmar.c
2752 @@ -582,6 +582,8 @@ int __init dmar_table_init(void)
2753 return 0;
2754 }
2755
2756 +static int bios_warned;
2757 +
2758 int __init check_zero_address(void)
2759 {
2760 struct acpi_table_dmar *dmar;
2761 @@ -601,6 +603,9 @@ int __init check_zero_address(void)
2762 }
2763
2764 if (entry_header->type == ACPI_DMAR_TYPE_HARDWARE_UNIT) {
2765 + void __iomem *addr;
2766 + u64 cap, ecap;
2767 +
2768 drhd = (void *)entry_header;
2769 if (!drhd->address) {
2770 /* Promote an attitude of violence to a BIOS engineer today */
2771 @@ -609,17 +614,40 @@ int __init check_zero_address(void)
2772 dmi_get_system_info(DMI_BIOS_VENDOR),
2773 dmi_get_system_info(DMI_BIOS_VERSION),
2774 dmi_get_system_info(DMI_PRODUCT_VERSION));
2775 -#ifdef CONFIG_DMAR
2776 - dmar_disabled = 1;
2777 -#endif
2778 - return 0;
2779 + bios_warned = 1;
2780 + goto failed;
2781 + }
2782 +
2783 + addr = early_ioremap(drhd->address, VTD_PAGE_SIZE);
2784 + if (!addr ) {
2785 + printk("IOMMU: can't validate: %llx\n", drhd->address);
2786 + goto failed;
2787 + }
2788 + cap = dmar_readq(addr + DMAR_CAP_REG);
2789 + ecap = dmar_readq(addr + DMAR_ECAP_REG);
2790 + early_iounmap(addr, VTD_PAGE_SIZE);
2791 + if (cap == (uint64_t)-1 && ecap == (uint64_t)-1) {
2792 + /* Promote an attitude of violence to a BIOS engineer today */
2793 + WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n"
2794 + "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
2795 + drhd->address,
2796 + dmi_get_system_info(DMI_BIOS_VENDOR),
2797 + dmi_get_system_info(DMI_BIOS_VERSION),
2798 + dmi_get_system_info(DMI_PRODUCT_VERSION));
2799 + bios_warned = 1;
2800 + goto failed;
2801 }
2802 - break;
2803 }
2804
2805 entry_header = ((void *)entry_header + entry_header->length);
2806 }
2807 return 1;
2808 +
2809 +failed:
2810 +#ifdef CONFIG_DMAR
2811 + dmar_disabled = 1;
2812 +#endif
2813 + return 0;
2814 }
2815
2816 void __init detect_intel_iommu(void)
2817 @@ -664,6 +692,18 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
2818 int agaw = 0;
2819 int msagaw = 0;
2820
2821 + if (!drhd->reg_base_addr) {
2822 + if (!bios_warned) {
2823 + WARN(1, "Your BIOS is broken; DMAR reported at address zero!\n"
2824 + "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
2825 + dmi_get_system_info(DMI_BIOS_VENDOR),
2826 + dmi_get_system_info(DMI_BIOS_VERSION),
2827 + dmi_get_system_info(DMI_PRODUCT_VERSION));
2828 + bios_warned = 1;
2829 + }
2830 + return -EINVAL;
2831 + }
2832 +
2833 iommu = kzalloc(sizeof(*iommu), GFP_KERNEL);
2834 if (!iommu)
2835 return -ENOMEM;
2836 @@ -680,13 +720,16 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
2837 iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG);
2838
2839 if (iommu->cap == (uint64_t)-1 && iommu->ecap == (uint64_t)-1) {
2840 - /* Promote an attitude of violence to a BIOS engineer today */
2841 - WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n"
2842 - "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
2843 - drhd->reg_base_addr,
2844 - dmi_get_system_info(DMI_BIOS_VENDOR),
2845 - dmi_get_system_info(DMI_BIOS_VERSION),
2846 - dmi_get_system_info(DMI_PRODUCT_VERSION));
2847 + if (!bios_warned) {
2848 + /* Promote an attitude of violence to a BIOS engineer today */
2849 + WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n"
2850 + "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
2851 + drhd->reg_base_addr,
2852 + dmi_get_system_info(DMI_BIOS_VENDOR),
2853 + dmi_get_system_info(DMI_BIOS_VERSION),
2854 + dmi_get_system_info(DMI_PRODUCT_VERSION));
2855 + bios_warned = 1;
2856 + }
2857 goto err_unmap;
2858 }
2859
2860 diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
2861 index 1840a05..2498602 100644
2862 --- a/drivers/pci/intel-iommu.c
2863 +++ b/drivers/pci/intel-iommu.c
2864 @@ -1523,12 +1523,15 @@ static int domain_context_mapping_one(struct dmar_domain *domain, int segment,
2865
2866 /* Skip top levels of page tables for
2867 * iommu which has less agaw than default.
2868 + * Unnecessary for PT mode.
2869 */
2870 - for (agaw = domain->agaw; agaw != iommu->agaw; agaw--) {
2871 - pgd = phys_to_virt(dma_pte_addr(pgd));
2872 - if (!dma_pte_present(pgd)) {
2873 - spin_unlock_irqrestore(&iommu->lock, flags);
2874 - return -ENOMEM;
2875 + if (translation != CONTEXT_TT_PASS_THROUGH) {
2876 + for (agaw = domain->agaw; agaw != iommu->agaw; agaw--) {
2877 + pgd = phys_to_virt(dma_pte_addr(pgd));
2878 + if (!dma_pte_present(pgd)) {
2879 + spin_unlock_irqrestore(&iommu->lock, flags);
2880 + return -ENOMEM;
2881 + }
2882 }
2883 }
2884 }
2885 @@ -1991,6 +1994,16 @@ static int iommu_prepare_identity_map(struct pci_dev *pdev,
2886 "IOMMU: Setting identity map for device %s [0x%Lx - 0x%Lx]\n",
2887 pci_name(pdev), start, end);
2888
2889 + if (end < start) {
2890 + WARN(1, "Your BIOS is broken; RMRR ends before it starts!\n"
2891 + "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
2892 + dmi_get_system_info(DMI_BIOS_VENDOR),
2893 + dmi_get_system_info(DMI_BIOS_VERSION),
2894 + dmi_get_system_info(DMI_PRODUCT_VERSION));
2895 + ret = -EIO;
2896 + goto error;
2897 + }
2898 +
2899 if (end >> agaw_to_width(domain->agaw)) {
2900 WARN(1, "Your BIOS is broken; RMRR exceeds permitted address width (%d bits)\n"
2901 "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
2902 @@ -3228,6 +3241,9 @@ static int device_notifier(struct notifier_block *nb,
2903 struct pci_dev *pdev = to_pci_dev(dev);
2904 struct dmar_domain *domain;
2905
2906 + if (iommu_no_mapping(dev))
2907 + return 0;
2908 +
2909 domain = find_domain(pdev);
2910 if (!domain)
2911 return 0;
2912 diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
2913 index ab64522..d8b4229 100644
2914 --- a/drivers/platform/x86/acerhdf.c
2915 +++ b/drivers/platform/x86/acerhdf.c
2916 @@ -52,7 +52,7 @@
2917 */
2918 #undef START_IN_KERNEL_MODE
2919
2920 -#define DRV_VER "0.5.18"
2921 +#define DRV_VER "0.5.20"
2922
2923 /*
2924 * According to the Atom N270 datasheet,
2925 @@ -112,12 +112,14 @@ module_param_string(force_product, force_product, 16, 0);
2926 MODULE_PARM_DESC(force_product, "Force BIOS product and omit BIOS check");
2927
2928 /*
2929 - * cmd_off: to switch the fan completely off / to check if the fan is off
2930 + * cmd_off: to switch the fan completely off
2931 + * chk_off: to check if the fan is off
2932 * cmd_auto: to set the BIOS in control of the fan. The BIOS regulates then
2933 * the fan speed depending on the temperature
2934 */
2935 struct fancmd {
2936 u8 cmd_off;
2937 + u8 chk_off;
2938 u8 cmd_auto;
2939 };
2940
2941 @@ -134,32 +136,41 @@ struct bios_settings_t {
2942 /* Register addresses and values for different BIOS versions */
2943 static const struct bios_settings_t bios_tbl[] = {
2944 /* AOA110 */
2945 - {"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00} },
2946 - {"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
2947 - {"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00} },
2948 - {"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00} },
2949 - {"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00} },
2950 - {"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00} },
2951 - {"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00} },
2952 - {"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00} },
2953 - {"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00} },
2954 + {"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x1f, 0x00} },
2955 + {"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x1f, 0x00} },
2956 + {"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0xaf, 0x00} },
2957 + {"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0xaf, 0x00} },
2958 + {"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0xaf, 0x00} },
2959 + {"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0xaf, 0x00} },
2960 + {"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x21, 0x00} },
2961 + {"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x21, 0x00} },
2962 + {"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x21, 0x00} },
2963 /* AOA150 */
2964 - {"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x20, 0x00} },
2965 - {"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00} },
2966 - {"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
2967 - {"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00} },
2968 - {"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00} },
2969 - {"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} },
2970 - {"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} },
2971 - {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
2972 + {"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x20, 0x20, 0x00} },
2973 + {"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x20, 0x00} },
2974 + {"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x20, 0x00} },
2975 + {"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x20, 0x00} },
2976 + {"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x20, 0x00} },
2977 + {"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x20, 0x00} },
2978 + {"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x20, 0x00} },
2979 + {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x20, 0x00} },
2980 + /* Acer 1410 */
2981 + {"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
2982 /* special BIOS / other */
2983 - {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x00} },
2984 - {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x00} },
2985 - {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00} },
2986 - {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x00} },
2987 - {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} },
2988 + {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x21, 0x00} },
2989 + {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x20, 0x00} },
2990 + {"Gateway ", "LT31 ", "v1.3103 ", 0x55, 0x58,
2991 + {0x10, 0x0f, 0x00} },
2992 + {"Gateway ", "LT31 ", "v1.3201 ", 0x55, 0x58,
2993 + {0x10, 0x0f, 0x00} },
2994 + {"Gateway ", "LT31 ", "v1.3302 ", 0x55, 0x58,
2995 + {0x10, 0x0f, 0x00} },
2996 + {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x21, 0x00} },
2997 + {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} },
2998 + {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x21, 0x00} },
2999 + {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} },
3000 /* pewpew-terminator */
3001 - {"", "", "", 0, 0, {0, 0} }
3002 + {"", "", "", 0, 0, {0, 0, 0} }
3003 };
3004
3005 static const struct bios_settings_t *bios_cfg __read_mostly;
3006 @@ -183,7 +194,7 @@ static int acerhdf_get_fanstate(int *state)
3007 if (ec_read(bios_cfg->fanreg, &fan))
3008 return -EINVAL;
3009
3010 - if (fan != bios_cfg->cmd.cmd_off)
3011 + if (fan != bios_cfg->cmd.chk_off)
3012 *state = ACERHDF_FAN_AUTO;
3013 else
3014 *state = ACERHDF_FAN_OFF;
3015 diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
3016 index b39d2bb..849359a 100644
3017 --- a/drivers/platform/x86/asus-laptop.c
3018 +++ b/drivers/platform/x86/asus-laptop.c
3019 @@ -1283,8 +1283,8 @@ static int asus_hotk_add(struct acpi_device *device)
3020 hotk->ledd_status = 0xFFF;
3021
3022 /* Set initial values of light sensor and level */
3023 - hotk->light_switch = 1; /* Default to light sensor disabled */
3024 - hotk->light_level = 0; /* level 5 for sensor sensitivity */
3025 + hotk->light_switch = 0; /* Default to light sensor disabled */
3026 + hotk->light_level = 5; /* level 5 for sensor sensitivity */
3027
3028 if (ls_switch_handle)
3029 set_light_sens_switch(hotk->light_switch);
3030 diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
3031 index a848c7e..1ee734c 100644
3032 --- a/drivers/platform/x86/thinkpad_acpi.c
3033 +++ b/drivers/platform/x86/thinkpad_acpi.c
3034 @@ -3866,15 +3866,6 @@ enum {
3035
3036 #define TPACPI_RFK_BLUETOOTH_SW_NAME "tpacpi_bluetooth_sw"
3037
3038 -static void bluetooth_suspend(pm_message_t state)
3039 -{
3040 - /* Try to make sure radio will resume powered off */
3041 - if (!acpi_evalf(NULL, NULL, "\\BLTH", "vd",
3042 - TP_ACPI_BLTH_PWR_OFF_ON_RESUME))
3043 - vdbg_printk(TPACPI_DBG_RFKILL,
3044 - "bluetooth power down on resume request failed\n");
3045 -}
3046 -
3047 static int bluetooth_get_status(void)
3048 {
3049 int status;
3050 @@ -3908,10 +3899,9 @@ static int bluetooth_set_status(enum tpacpi_rfkill_state state)
3051 #endif
3052
3053 /* We make sure to keep TP_ACPI_BLUETOOTH_RESUMECTRL off */
3054 + status = TP_ACPI_BLUETOOTH_RESUMECTRL;
3055 if (state == TPACPI_RFK_RADIO_ON)
3056 - status = TP_ACPI_BLUETOOTH_RADIOSSW;
3057 - else
3058 - status = 0;
3059 + status |= TP_ACPI_BLUETOOTH_RADIOSSW;
3060
3061 if (!acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status))
3062 return -EIO;
3063 @@ -4050,7 +4040,6 @@ static struct ibm_struct bluetooth_driver_data = {
3064 .read = bluetooth_read,
3065 .write = bluetooth_write,
3066 .exit = bluetooth_exit,
3067 - .suspend = bluetooth_suspend,
3068 .shutdown = bluetooth_shutdown,
3069 };
3070
3071 @@ -4068,15 +4057,6 @@ enum {
3072
3073 #define TPACPI_RFK_WWAN_SW_NAME "tpacpi_wwan_sw"
3074
3075 -static void wan_suspend(pm_message_t state)
3076 -{
3077 - /* Try to make sure radio will resume powered off */
3078 - if (!acpi_evalf(NULL, NULL, "\\WGSV", "qvd",
3079 - TP_ACPI_WGSV_PWR_OFF_ON_RESUME))
3080 - vdbg_printk(TPACPI_DBG_RFKILL,
3081 - "WWAN power down on resume request failed\n");
3082 -}
3083 -
3084 static int wan_get_status(void)
3085 {
3086 int status;
3087 @@ -4109,11 +4089,10 @@ static int wan_set_status(enum tpacpi_rfkill_state state)
3088 }
3089 #endif
3090
3091 - /* We make sure to keep TP_ACPI_WANCARD_RESUMECTRL off */
3092 + /* We make sure to set TP_ACPI_WANCARD_RESUMECTRL */
3093 + status = TP_ACPI_WANCARD_RESUMECTRL;
3094 if (state == TPACPI_RFK_RADIO_ON)
3095 - status = TP_ACPI_WANCARD_RADIOSSW;
3096 - else
3097 - status = 0;
3098 + status |= TP_ACPI_WANCARD_RADIOSSW;
3099
3100 if (!acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status))
3101 return -EIO;
3102 @@ -4251,7 +4230,6 @@ static struct ibm_struct wan_driver_data = {
3103 .read = wan_read,
3104 .write = wan_write,
3105 .exit = wan_exit,
3106 - .suspend = wan_suspend,
3107 .shutdown = wan_shutdown,
3108 };
3109
3110 @@ -6123,8 +6101,8 @@ static const struct tpacpi_quirk brightness_quirk_table[] __initconst = {
3111
3112 /* Models with Intel Extreme Graphics 2 */
3113 TPACPI_Q_IBM('1', 'U', TPACPI_BRGHT_Q_NOEC),
3114 - TPACPI_Q_IBM('1', 'V', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_NOEC),
3115 - TPACPI_Q_IBM('1', 'W', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_NOEC),
3116 + TPACPI_Q_IBM('1', 'V', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_EC),
3117 + TPACPI_Q_IBM('1', 'W', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_EC),
3118
3119 /* Models with Intel GMA900 */
3120 TPACPI_Q_IBM('7', '0', TPACPI_BRGHT_Q_NOEC), /* T43, R52 */
3121 diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
3122 index 737b4c9..807042b 100644
3123 --- a/drivers/serial/8250.c
3124 +++ b/drivers/serial/8250.c
3125 @@ -1339,14 +1339,12 @@ static void serial8250_start_tx(struct uart_port *port)
3126 serial_out(up, UART_IER, up->ier);
3127
3128 if (up->bugs & UART_BUG_TXEN) {
3129 - unsigned char lsr, iir;
3130 + unsigned char lsr;
3131 lsr = serial_in(up, UART_LSR);
3132 up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;
3133 - iir = serial_in(up, UART_IIR) & 0x0f;
3134 if ((up->port.type == PORT_RM9000) ?
3135 - (lsr & UART_LSR_THRE &&
3136 - (iir == UART_IIR_NO_INT || iir == UART_IIR_THRI)) :
3137 - (lsr & UART_LSR_TEMT && iir & UART_IIR_NO_INT))
3138 + (lsr & UART_LSR_THRE) :
3139 + (lsr & UART_LSR_TEMT))
3140 transmit_chars(up);
3141 }
3142 }
3143 diff --git a/drivers/ssb/sprom.c b/drivers/ssb/sprom.c
3144 index 8943015..eb70843 100644
3145 --- a/drivers/ssb/sprom.c
3146 +++ b/drivers/ssb/sprom.c
3147 @@ -13,6 +13,8 @@
3148
3149 #include "ssb_private.h"
3150
3151 +#include <linux/ctype.h>
3152 +
3153
3154 static const struct ssb_sprom *fallback_sprom;
3155
3156 @@ -33,17 +35,27 @@ static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len,
3157 static int hex2sprom(u16 *sprom, const char *dump, size_t len,
3158 size_t sprom_size_words)
3159 {
3160 - char tmp[5] = { 0 };
3161 - int cnt = 0;
3162 + char c, tmp[5] = { 0 };
3163 + int err, cnt = 0;
3164 unsigned long parsed;
3165
3166 - if (len < sprom_size_words * 2)
3167 + /* Strip whitespace at the end. */
3168 + while (len) {
3169 + c = dump[len - 1];
3170 + if (!isspace(c) && c != '\0')
3171 + break;
3172 + len--;
3173 + }
3174 + /* Length must match exactly. */
3175 + if (len != sprom_size_words * 4)
3176 return -EINVAL;
3177
3178 while (cnt < sprom_size_words) {
3179 memcpy(tmp, dump, 4);
3180 dump += 4;
3181 - parsed = simple_strtoul(tmp, NULL, 16);
3182 + err = strict_strtoul(tmp, 16, &parsed);
3183 + if (err)
3184 + return err;
3185 sprom[cnt++] = swab16((u16)parsed);
3186 }
3187
3188 diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
3189 index 2473cf0..d9461c9 100644
3190 --- a/drivers/usb/class/usbtmc.c
3191 +++ b/drivers/usb/class/usbtmc.c
3192 @@ -562,10 +562,16 @@ static ssize_t usbtmc_write(struct file *filp, const char __user *buf,
3193 n_bytes = roundup(12 + this_part, 4);
3194 memset(buffer + 12 + this_part, 0, n_bytes - (12 + this_part));
3195
3196 - retval = usb_bulk_msg(data->usb_dev,
3197 - usb_sndbulkpipe(data->usb_dev,
3198 - data->bulk_out),
3199 - buffer, n_bytes, &actual, USBTMC_TIMEOUT);
3200 + do {
3201 + retval = usb_bulk_msg(data->usb_dev,
3202 + usb_sndbulkpipe(data->usb_dev,
3203 + data->bulk_out),
3204 + buffer, n_bytes,
3205 + &actual, USBTMC_TIMEOUT);
3206 + if (retval != 0)
3207 + break;
3208 + n_bytes -= actual;
3209 + } while (n_bytes);
3210
3211 data->bTag_last_write = data->bTag;
3212 data->bTag++;
3213 diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
3214 index b1b85ab..52e5e31 100644
3215 --- a/drivers/usb/core/usb.c
3216 +++ b/drivers/usb/core/usb.c
3217 @@ -132,7 +132,7 @@ EXPORT_SYMBOL_GPL(usb_altnum_to_altsetting);
3218
3219 struct find_interface_arg {
3220 int minor;
3221 - struct usb_interface *interface;
3222 + struct device_driver *drv;
3223 };
3224
3225 static int __find_interface(struct device *dev, void *data)
3226 @@ -143,12 +143,10 @@ static int __find_interface(struct device *dev, void *data)
3227 if (!is_usb_interface(dev))
3228 return 0;
3229
3230 + if (dev->driver != arg->drv)
3231 + return 0;
3232 intf = to_usb_interface(dev);
3233 - if (intf->minor != -1 && intf->minor == arg->minor) {
3234 - arg->interface = intf;
3235 - return 1;
3236 - }
3237 - return 0;
3238 + return intf->minor == arg->minor;
3239 }
3240
3241 /**
3242 @@ -156,21 +154,24 @@ static int __find_interface(struct device *dev, void *data)
3243 * @drv: the driver whose current configuration is considered
3244 * @minor: the minor number of the desired device
3245 *
3246 - * This walks the driver device list and returns a pointer to the interface
3247 - * with the matching minor. Note, this only works for devices that share the
3248 - * USB major number.
3249 + * This walks the bus device list and returns a pointer to the interface
3250 + * with the matching minor and driver. Note, this only works for devices
3251 + * that share the USB major number.
3252 */
3253 struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor)
3254 {
3255 struct find_interface_arg argb;
3256 - int retval;
3257 + struct device *dev;
3258
3259 argb.minor = minor;
3260 - argb.interface = NULL;
3261 - /* eat the error, it will be in argb.interface */
3262 - retval = driver_for_each_device(&drv->drvwrap.driver, NULL, &argb,
3263 - __find_interface);
3264 - return argb.interface;
3265 + argb.drv = &drv->drvwrap.driver;
3266 +
3267 + dev = bus_find_device(&usb_bus_type, NULL, &argb, __find_interface);
3268 +
3269 + /* Drop reference count from bus_find_device */
3270 + put_device(dev);
3271 +
3272 + return dev ? to_usb_interface(dev) : NULL;
3273 }
3274 EXPORT_SYMBOL_GPL(usb_find_interface);
3275
3276 diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c
3277 index 522efb3..1c44b97 100644
3278 --- a/drivers/usb/musb/musb_gadget_ep0.c
3279 +++ b/drivers/usb/musb/musb_gadget_ep0.c
3280 @@ -199,7 +199,6 @@ service_in_request(struct musb *musb, const struct usb_ctrlrequest *ctrlrequest)
3281 static void musb_g_ep0_giveback(struct musb *musb, struct usb_request *req)
3282 {
3283 musb_g_giveback(&musb->endpoints[0].ep_in, req, 0);
3284 - musb->ep0_state = MUSB_EP0_STAGE_SETUP;
3285 }
3286
3287 /*
3288 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
3289 index 0577e4b..dffc8a1 100644
3290 --- a/drivers/usb/serial/option.c
3291 +++ b/drivers/usb/serial/option.c
3292 @@ -580,12 +580,48 @@ static struct usb_device_id option_ids[] = {
3293 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) },
3294 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 0xff, 0xff) },
3295 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
3296 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff) },
3297 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0106, 0xff, 0xff, 0xff) },
3298 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0108, 0xff, 0xff, 0xff) },
3299 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff) },
3300 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0117, 0xff, 0xff, 0xff) },
3301 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0118, 0xff, 0xff, 0xff) },
3302 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0121, 0xff, 0xff, 0xff) },
3303 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0122, 0xff, 0xff, 0xff) },
3304 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0123, 0xff, 0xff, 0xff) },
3305 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0124, 0xff, 0xff, 0xff) },
3306 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0125, 0xff, 0xff, 0xff) },
3307 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0126, 0xff, 0xff, 0xff) },
3308 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0128, 0xff, 0xff, 0xff) },
3309 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0142, 0xff, 0xff, 0xff) },
3310 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0143, 0xff, 0xff, 0xff) },
3311 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0144, 0xff, 0xff, 0xff) },
3312 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0145, 0xff, 0xff, 0xff) },
3313 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0146, 0xff, 0xff, 0xff) },
3314 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0147, 0xff, 0xff, 0xff) },
3315 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0148, 0xff, 0xff, 0xff) },
3316 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0149, 0xff, 0xff, 0xff) },
3317 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0150, 0xff, 0xff, 0xff) },
3318 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0151, 0xff, 0xff, 0xff) },
3319 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0152, 0xff, 0xff, 0xff) },
3320 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0153, 0xff, 0xff, 0xff) },
3321 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0154, 0xff, 0xff, 0xff) },
3322 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0155, 0xff, 0xff, 0xff) },
3323 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) },
3324 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff) },
3325 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0158, 0xff, 0xff, 0xff) },
3326 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0159, 0xff, 0xff, 0xff) },
3327 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0160, 0xff, 0xff, 0xff) },
3328 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) },
3329 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) },
3330 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) }, /* ZTE CDMA products */
3331 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0027, 0xff, 0xff, 0xff) },
3332 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) },
3333 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0060, 0xff, 0xff, 0xff) },
3334 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) },
3335 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) },
3336 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) },
3337 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) },
3338 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
3339 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
3340 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
3341 @@ -599,6 +635,7 @@ static struct usb_device_id option_ids[] = {
3342 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) },
3343 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */
3344 { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) },
3345 + { USB_DEVICE(ALINK_VENDOR_ID, 0xce16) },
3346 { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) },
3347 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) },
3348 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
3349 diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
3350 index 589f6b4..cc313d1 100644
3351 --- a/drivers/usb/storage/transport.c
3352 +++ b/drivers/usb/storage/transport.c
3353 @@ -666,10 +666,11 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
3354 * to wait for at least one CHECK_CONDITION to determine
3355 * SANE_SENSE support
3356 */
3357 - if ((srb->cmnd[0] == ATA_16 || srb->cmnd[0] == ATA_12) &&
3358 + if (unlikely((srb->cmnd[0] == ATA_16 || srb->cmnd[0] == ATA_12) &&
3359 result == USB_STOR_TRANSPORT_GOOD &&
3360 !(us->fflags & US_FL_SANE_SENSE) &&
3361 - !(srb->cmnd[2] & 0x20)) {
3362 + !(us->fflags & US_FL_BAD_SENSE) &&
3363 + !(srb->cmnd[2] & 0x20))) {
3364 US_DEBUGP("-- SAT supported, increasing auto-sense\n");
3365 us->fflags |= US_FL_SANE_SENSE;
3366 }
3367 @@ -718,6 +719,12 @@ Retry_Sense:
3368 if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) {
3369 US_DEBUGP("-- auto-sense aborted\n");
3370 srb->result = DID_ABORT << 16;
3371 +
3372 + /* If SANE_SENSE caused this problem, disable it */
3373 + if (sense_size != US_SENSE_SIZE) {
3374 + us->fflags &= ~US_FL_SANE_SENSE;
3375 + us->fflags |= US_FL_BAD_SENSE;
3376 + }
3377 goto Handle_Errors;
3378 }
3379
3380 @@ -727,10 +734,11 @@ Retry_Sense:
3381 * (small) sense request. This fixes some USB GSM modems
3382 */
3383 if (temp_result == USB_STOR_TRANSPORT_FAILED &&
3384 - (us->fflags & US_FL_SANE_SENSE) &&
3385 - sense_size != US_SENSE_SIZE) {
3386 + sense_size != US_SENSE_SIZE) {
3387 US_DEBUGP("-- auto-sense failure, retry small sense\n");
3388 sense_size = US_SENSE_SIZE;
3389 + us->fflags &= ~US_FL_SANE_SENSE;
3390 + us->fflags |= US_FL_BAD_SENSE;
3391 goto Retry_Sense;
3392 }
3393
3394 @@ -754,6 +762,7 @@ Retry_Sense:
3395 */
3396 if (srb->sense_buffer[7] > (US_SENSE_SIZE - 8) &&
3397 !(us->fflags & US_FL_SANE_SENSE) &&
3398 + !(us->fflags & US_FL_BAD_SENSE) &&
3399 (srb->sense_buffer[0] & 0x7C) == 0x70) {
3400 US_DEBUGP("-- SANE_SENSE support enabled\n");
3401 us->fflags |= US_FL_SANE_SENSE;
3402 diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
3403 index d4f034e..64a0a2c 100644
3404 --- a/drivers/usb/storage/unusual_devs.h
3405 +++ b/drivers/usb/storage/unusual_devs.h
3406 @@ -818,6 +818,13 @@ UNUSUAL_DEV( 0x066f, 0x8000, 0x0001, 0x0001,
3407 US_SC_DEVICE, US_PR_DEVICE, NULL,
3408 US_FL_FIX_CAPACITY ),
3409
3410 +/* Reported by Daniel Kukula <daniel.kuku@gmail.com> */
3411 +UNUSUAL_DEV( 0x067b, 0x1063, 0x0100, 0x0100,
3412 + "Prolific Technology, Inc.",
3413 + "Prolific Storage Gadget",
3414 + US_SC_DEVICE, US_PR_DEVICE, NULL,
3415 + US_FL_BAD_SENSE ),
3416 +
3417 /* Reported by Rogerio Brito <rbrito@ime.usp.br> */
3418 UNUSUAL_DEV( 0x067b, 0x2317, 0x0001, 0x001,
3419 "Prolific Technology, Inc.",
3420 diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
3421 index 8060b85..716c8d7 100644
3422 --- a/drivers/usb/storage/usb.c
3423 +++ b/drivers/usb/storage/usb.c
3424 @@ -228,6 +228,7 @@ void fill_inquiry_response(struct us_data *us, unsigned char *data,
3425 if (data_len<36) // You lose.
3426 return;
3427
3428 + memset(data+8, ' ', 28);
3429 if(data[0]&0x20) { /* USB device currently not connected. Return
3430 peripheral qualifier 001b ("...however, the
3431 physical device is not currently connected
3432 @@ -237,15 +238,15 @@ void fill_inquiry_response(struct us_data *us, unsigned char *data,
3433 device, it may return zeros or ASCII spaces
3434 (20h) in those fields until the data is
3435 available from the device."). */
3436 - memset(data+8,0,28);
3437 } else {
3438 u16 bcdDevice = le16_to_cpu(us->pusb_dev->descriptor.bcdDevice);
3439 - memcpy(data+8, us->unusual_dev->vendorName,
3440 - strlen(us->unusual_dev->vendorName) > 8 ? 8 :
3441 - strlen(us->unusual_dev->vendorName));
3442 - memcpy(data+16, us->unusual_dev->productName,
3443 - strlen(us->unusual_dev->productName) > 16 ? 16 :
3444 - strlen(us->unusual_dev->productName));
3445 + int n;
3446 +
3447 + n = strlen(us->unusual_dev->vendorName);
3448 + memcpy(data+8, us->unusual_dev->vendorName, min(8, n));
3449 + n = strlen(us->unusual_dev->productName);
3450 + memcpy(data+16, us->unusual_dev->productName, min(16, n));
3451 +
3452 data[32] = 0x30 + ((bcdDevice>>12) & 0x0F);
3453 data[33] = 0x30 + ((bcdDevice>>8) & 0x0F);
3454 data[34] = 0x30 + ((bcdDevice>>4) & 0x0F);
3455 @@ -459,6 +460,9 @@ static void adjust_quirks(struct us_data *us)
3456 case 'a':
3457 f |= US_FL_SANE_SENSE;
3458 break;
3459 + case 'b':
3460 + f |= US_FL_BAD_SENSE;
3461 + break;
3462 case 'c':
3463 f |= US_FL_FIX_CAPACITY;
3464 break;
3465 diff --git a/drivers/video/matrox/g450_pll.c b/drivers/video/matrox/g450_pll.c
3466 index 09f6e04..c15f8a5 100644
3467 --- a/drivers/video/matrox/g450_pll.c
3468 +++ b/drivers/video/matrox/g450_pll.c
3469 @@ -368,7 +368,8 @@ static int __g450_setclk(struct matrox_fb_info *minfo, unsigned int fout,
3470 M1064_XDVICLKCTRL_C1DVICLKEN |
3471 M1064_XDVICLKCTRL_DVILOOPCTL |
3472 M1064_XDVICLKCTRL_P1LOOPBWDTCTL;
3473 - matroxfb_DAC_out(minfo, M1064_XDVICLKCTRL, tmp);
3474 + /* Setting this breaks PC systems so don't do it */
3475 + /* matroxfb_DAC_out(minfo, M1064_XDVICLKCTRL, tmp); */
3476 matroxfb_DAC_out(minfo, M1064_XPWRCTRL,
3477 xpwrctrl);
3478
3479 diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
3480 index d31505b..4204336 100644
3481 --- a/drivers/xen/balloon.c
3482 +++ b/drivers/xen/balloon.c
3483 @@ -66,8 +66,6 @@ struct balloon_stats {
3484 /* We aim for 'current allocation' == 'target allocation'. */
3485 unsigned long current_pages;
3486 unsigned long target_pages;
3487 - /* We may hit the hard limit in Xen. If we do then we remember it. */
3488 - unsigned long hard_limit;
3489 /*
3490 * Drivers may alter the memory reservation independently, but they
3491 * must inform the balloon driver so we avoid hitting the hard limit.
3492 @@ -136,6 +134,8 @@ static void balloon_append(struct page *page)
3493 list_add(&page->lru, &ballooned_pages);
3494 balloon_stats.balloon_low++;
3495 }
3496 +
3497 + totalram_pages--;
3498 }
3499
3500 /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */
3501 @@ -156,6 +156,8 @@ static struct page *balloon_retrieve(void)
3502 else
3503 balloon_stats.balloon_low--;
3504
3505 + totalram_pages++;
3506 +
3507 return page;
3508 }
3509
3510 @@ -181,7 +183,7 @@ static void balloon_alarm(unsigned long unused)
3511
3512 static unsigned long current_target(void)
3513 {
3514 - unsigned long target = min(balloon_stats.target_pages, balloon_stats.hard_limit);
3515 + unsigned long target = balloon_stats.target_pages;
3516
3517 target = min(target,
3518 balloon_stats.current_pages +
3519 @@ -217,23 +219,10 @@ static int increase_reservation(unsigned long nr_pages)
3520 set_xen_guest_handle(reservation.extent_start, frame_list);
3521 reservation.nr_extents = nr_pages;
3522 rc = HYPERVISOR_memory_op(XENMEM_populate_physmap, &reservation);
3523 - if (rc < nr_pages) {
3524 - if (rc > 0) {
3525 - int ret;
3526 -
3527 - /* We hit the Xen hard limit: reprobe. */
3528 - reservation.nr_extents = rc;
3529 - ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation,
3530 - &reservation);
3531 - BUG_ON(ret != rc);
3532 - }
3533 - if (rc >= 0)
3534 - balloon_stats.hard_limit = (balloon_stats.current_pages + rc -
3535 - balloon_stats.driver_pages);
3536 + if (rc < 0)
3537 goto out;
3538 - }
3539
3540 - for (i = 0; i < nr_pages; i++) {
3541 + for (i = 0; i < rc; i++) {
3542 page = balloon_retrieve();
3543 BUG_ON(page == NULL);
3544
3545 @@ -259,13 +248,12 @@ static int increase_reservation(unsigned long nr_pages)
3546 __free_page(page);
3547 }
3548
3549 - balloon_stats.current_pages += nr_pages;
3550 - totalram_pages = balloon_stats.current_pages;
3551 + balloon_stats.current_pages += rc;
3552
3553 out:
3554 spin_unlock_irqrestore(&balloon_lock, flags);
3555
3556 - return 0;
3557 + return rc < 0 ? rc : rc != nr_pages;
3558 }
3559
3560 static int decrease_reservation(unsigned long nr_pages)
3561 @@ -323,7 +311,6 @@ static int decrease_reservation(unsigned long nr_pages)
3562 BUG_ON(ret != nr_pages);
3563
3564 balloon_stats.current_pages -= nr_pages;
3565 - totalram_pages = balloon_stats.current_pages;
3566
3567 spin_unlock_irqrestore(&balloon_lock, flags);
3568
3569 @@ -367,7 +354,6 @@ static void balloon_process(struct work_struct *work)
3570 static void balloon_set_new_target(unsigned long target)
3571 {
3572 /* No need for lock. Not read-modify-write updates. */
3573 - balloon_stats.hard_limit = ~0UL;
3574 balloon_stats.target_pages = target;
3575 schedule_work(&balloon_worker);
3576 }
3577 @@ -422,12 +408,10 @@ static int __init balloon_init(void)
3578 pr_info("xen_balloon: Initialising balloon driver.\n");
3579
3580 balloon_stats.current_pages = min(xen_start_info->nr_pages, max_pfn);
3581 - totalram_pages = balloon_stats.current_pages;
3582 balloon_stats.target_pages = balloon_stats.current_pages;
3583 balloon_stats.balloon_low = 0;
3584 balloon_stats.balloon_high = 0;
3585 balloon_stats.driver_pages = 0UL;
3586 - balloon_stats.hard_limit = ~0UL;
3587
3588 init_timer(&balloon_timer);
3589 balloon_timer.data = 0;
3590 @@ -472,9 +456,6 @@ module_exit(balloon_exit);
3591 BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages));
3592 BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low));
3593 BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high));
3594 -BALLOON_SHOW(hard_limit_kb,
3595 - (balloon_stats.hard_limit!=~0UL) ? "%lu\n" : "???\n",
3596 - (balloon_stats.hard_limit!=~0UL) ? PAGES2KB(balloon_stats.hard_limit) : 0);
3597 BALLOON_SHOW(driver_kb, "%lu\n", PAGES2KB(balloon_stats.driver_pages));
3598
3599 static ssize_t show_target_kb(struct sys_device *dev, struct sysdev_attribute *attr,
3600 @@ -544,7 +525,6 @@ static struct attribute *balloon_info_attrs[] = {
3601 &attr_current_kb.attr,
3602 &attr_low_kb.attr,
3603 &attr_high_kb.attr,
3604 - &attr_hard_limit_kb.attr,
3605 &attr_driver_kb.attr,
3606 NULL
3607 };
3608 diff --git a/drivers/xen/events.c b/drivers/xen/events.c
3609 index 2f57276..ce602dd 100644
3610 --- a/drivers/xen/events.c
3611 +++ b/drivers/xen/events.c
3612 @@ -474,6 +474,9 @@ static void unbind_from_irq(unsigned int irq)
3613 bind_evtchn_to_cpu(evtchn, 0);
3614
3615 evtchn_to_irq[evtchn] = -1;
3616 + }
3617 +
3618 + if (irq_info[irq].type != IRQT_UNBOUND) {
3619 irq_info[irq] = mk_unbound_info();
3620
3621 dynamic_irq_cleanup(irq);
3622 diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
3623 index 10d03d7..c499793 100644
3624 --- a/drivers/xen/manage.c
3625 +++ b/drivers/xen/manage.c
3626 @@ -43,7 +43,6 @@ static int xen_suspend(void *data)
3627 if (err) {
3628 printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n",
3629 err);
3630 - dpm_resume_noirq(PMSG_RESUME);
3631 return err;
3632 }
3633
3634 @@ -69,7 +68,6 @@ static int xen_suspend(void *data)
3635 }
3636
3637 sysdev_resume();
3638 - dpm_resume_noirq(PMSG_RESUME);
3639
3640 return 0;
3641 }
3642 @@ -81,6 +79,12 @@ static void do_suspend(void)
3643
3644 shutting_down = SHUTDOWN_SUSPEND;
3645
3646 + err = stop_machine_create();
3647 + if (err) {
3648 + printk(KERN_ERR "xen suspend: failed to setup stop_machine %d\n", err);
3649 + goto out;
3650 + }
3651 +
3652 #ifdef CONFIG_PREEMPT
3653 /* If the kernel is preemptible, we need to freeze all the processes
3654 to prevent them from being in the middle of a pagetable update
3655 @@ -88,29 +92,32 @@ static void do_suspend(void)
3656 err = freeze_processes();
3657 if (err) {
3658 printk(KERN_ERR "xen suspend: freeze failed %d\n", err);
3659 - return;
3660 + goto out_destroy_sm;
3661 }
3662 #endif
3663
3664 err = dpm_suspend_start(PMSG_SUSPEND);
3665 if (err) {
3666 printk(KERN_ERR "xen suspend: dpm_suspend_start %d\n", err);
3667 - goto out;
3668 + goto out_thaw;
3669 }
3670
3671 - printk(KERN_DEBUG "suspending xenstore...\n");
3672 - xs_suspend();
3673 -
3674 err = dpm_suspend_noirq(PMSG_SUSPEND);
3675 if (err) {
3676 printk(KERN_ERR "dpm_suspend_noirq failed: %d\n", err);
3677 - goto resume_devices;
3678 + goto out_resume;
3679 }
3680
3681 + printk(KERN_DEBUG "suspending xenstore...\n");
3682 + xs_suspend();
3683 +
3684 err = stop_machine(xen_suspend, &cancelled, cpumask_of(0));
3685 +
3686 + dpm_resume_noirq(PMSG_RESUME);
3687 +
3688 if (err) {
3689 printk(KERN_ERR "failed to start xen_suspend: %d\n", err);
3690 - goto out;
3691 + cancelled = 1;
3692 }
3693
3694 if (!cancelled) {
3695 @@ -119,17 +126,21 @@ static void do_suspend(void)
3696 } else
3697 xs_suspend_cancel();
3698
3699 - dpm_resume_noirq(PMSG_RESUME);
3700 -
3701 -resume_devices:
3702 +out_resume:
3703 dpm_resume_end(PMSG_RESUME);
3704
3705 /* Make sure timer events get retriggered on all CPUs */
3706 clock_was_set();
3707 -out:
3708 +
3709 +out_thaw:
3710 #ifdef CONFIG_PREEMPT
3711 thaw_processes();
3712 +
3713 +out_destroy_sm:
3714 #endif
3715 + stop_machine_destroy();
3716 +
3717 +out:
3718 shutting_down = SHUTDOWN_INVALID;
3719 }
3720 #endif /* CONFIG_PM_SLEEP */
3721 diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
3722 index d42e25d..3800da7 100644
3723 --- a/drivers/xen/xenbus/xenbus_probe.c
3724 +++ b/drivers/xen/xenbus/xenbus_probe.c
3725 @@ -454,21 +454,21 @@ static ssize_t xendev_show_nodename(struct device *dev,
3726 {
3727 return sprintf(buf, "%s\n", to_xenbus_device(dev)->nodename);
3728 }
3729 -DEVICE_ATTR(nodename, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_nodename, NULL);
3730 +static DEVICE_ATTR(nodename, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_nodename, NULL);
3731
3732 static ssize_t xendev_show_devtype(struct device *dev,
3733 struct device_attribute *attr, char *buf)
3734 {
3735 return sprintf(buf, "%s\n", to_xenbus_device(dev)->devicetype);
3736 }
3737 -DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL);
3738 +static DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL);
3739
3740 static ssize_t xendev_show_modalias(struct device *dev,
3741 struct device_attribute *attr, char *buf)
3742 {
3743 return sprintf(buf, "xen:%s\n", to_xenbus_device(dev)->devicetype);
3744 }
3745 -DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_modalias, NULL);
3746 +static DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_modalias, NULL);
3747
3748 int xenbus_probe_node(struct xen_bus_type *bus,
3749 const char *type,
3750 diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
3751 index d22438e..39c6ee8 100644
3752 --- a/fs/debugfs/inode.c
3753 +++ b/fs/debugfs/inode.c
3754 @@ -32,7 +32,9 @@ static struct vfsmount *debugfs_mount;
3755 static int debugfs_mount_count;
3756 static bool debugfs_registered;
3757
3758 -static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t dev)
3759 +static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t dev,
3760 + void *data, const struct file_operations *fops)
3761 +
3762 {
3763 struct inode *inode = new_inode(sb);
3764
3765 @@ -44,14 +46,18 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
3766 init_special_inode(inode, mode, dev);
3767 break;
3768 case S_IFREG:
3769 - inode->i_fop = &debugfs_file_operations;
3770 + inode->i_fop = fops ? fops : &debugfs_file_operations;
3771 + inode->i_private = data;
3772 break;
3773 case S_IFLNK:
3774 inode->i_op = &debugfs_link_operations;
3775 + inode->i_fop = fops;
3776 + inode->i_private = data;
3777 break;
3778 case S_IFDIR:
3779 inode->i_op = &simple_dir_inode_operations;
3780 - inode->i_fop = &simple_dir_operations;
3781 + inode->i_fop = fops ? fops : &simple_dir_operations;
3782 + inode->i_private = data;
3783
3784 /* directory inodes start off with i_nlink == 2
3785 * (for "." entry) */
3786 @@ -64,7 +70,8 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
3787
3788 /* SMP-safe */
3789 static int debugfs_mknod(struct inode *dir, struct dentry *dentry,
3790 - int mode, dev_t dev)
3791 + int mode, dev_t dev, void *data,
3792 + const struct file_operations *fops)
3793 {
3794 struct inode *inode;
3795 int error = -EPERM;
3796 @@ -72,7 +79,7 @@ static int debugfs_mknod(struct inode *dir, struct dentry *dentry,
3797 if (dentry->d_inode)
3798 return -EEXIST;
3799
3800 - inode = debugfs_get_inode(dir->i_sb, mode, dev);
3801 + inode = debugfs_get_inode(dir->i_sb, mode, dev, data, fops);
3802 if (inode) {
3803 d_instantiate(dentry, inode);
3804 dget(dentry);
3805 @@ -81,12 +88,13 @@ static int debugfs_mknod(struct inode *dir, struct dentry *dentry,
3806 return error;
3807 }
3808
3809 -static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
3810 +static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, int mode,
3811 + void *data, const struct file_operations *fops)
3812 {
3813 int res;
3814
3815 mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR;
3816 - res = debugfs_mknod(dir, dentry, mode, 0);
3817 + res = debugfs_mknod(dir, dentry, mode, 0, data, fops);
3818 if (!res) {
3819 inc_nlink(dir);
3820 fsnotify_mkdir(dir, dentry);
3821 @@ -94,18 +102,20 @@ static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
3822 return res;
3823 }
3824
3825 -static int debugfs_link(struct inode *dir, struct dentry *dentry, int mode)
3826 +static int debugfs_link(struct inode *dir, struct dentry *dentry, int mode,
3827 + void *data, const struct file_operations *fops)
3828 {
3829 mode = (mode & S_IALLUGO) | S_IFLNK;
3830 - return debugfs_mknod(dir, dentry, mode, 0);
3831 + return debugfs_mknod(dir, dentry, mode, 0, data, fops);
3832 }
3833
3834 -static int debugfs_create(struct inode *dir, struct dentry *dentry, int mode)
3835 +static int debugfs_create(struct inode *dir, struct dentry *dentry, int mode,
3836 + void *data, const struct file_operations *fops)
3837 {
3838 int res;
3839
3840 mode = (mode & S_IALLUGO) | S_IFREG;
3841 - res = debugfs_mknod(dir, dentry, mode, 0);
3842 + res = debugfs_mknod(dir, dentry, mode, 0, data, fops);
3843 if (!res)
3844 fsnotify_create(dir, dentry);
3845 return res;
3846 @@ -139,7 +149,9 @@ static struct file_system_type debug_fs_type = {
3847
3848 static int debugfs_create_by_name(const char *name, mode_t mode,
3849 struct dentry *parent,
3850 - struct dentry **dentry)
3851 + struct dentry **dentry,
3852 + void *data,
3853 + const struct file_operations *fops)
3854 {
3855 int error = 0;
3856
3857 @@ -164,13 +176,16 @@ static int debugfs_create_by_name(const char *name, mode_t mode,
3858 if (!IS_ERR(*dentry)) {
3859 switch (mode & S_IFMT) {
3860 case S_IFDIR:
3861 - error = debugfs_mkdir(parent->d_inode, *dentry, mode);
3862 + error = debugfs_mkdir(parent->d_inode, *dentry, mode,
3863 + data, fops);
3864 break;
3865 case S_IFLNK:
3866 - error = debugfs_link(parent->d_inode, *dentry, mode);
3867 + error = debugfs_link(parent->d_inode, *dentry, mode,
3868 + data, fops);
3869 break;
3870 default:
3871 - error = debugfs_create(parent->d_inode, *dentry, mode);
3872 + error = debugfs_create(parent->d_inode, *dentry, mode,
3873 + data, fops);
3874 break;
3875 }
3876 dput(*dentry);
3877 @@ -221,19 +236,13 @@ struct dentry *debugfs_create_file(const char *name, mode_t mode,
3878 if (error)
3879 goto exit;
3880
3881 - error = debugfs_create_by_name(name, mode, parent, &dentry);
3882 + error = debugfs_create_by_name(name, mode, parent, &dentry,
3883 + data, fops);
3884 if (error) {
3885 dentry = NULL;
3886 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
3887 goto exit;
3888 }
3889 -
3890 - if (dentry->d_inode) {
3891 - if (data)
3892 - dentry->d_inode->i_private = data;
3893 - if (fops)
3894 - dentry->d_inode->i_fop = fops;
3895 - }
3896 exit:
3897 return dentry;
3898 }
3899 diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
3900 index d5f8c96..8882ecc 100644
3901 --- a/fs/devpts/inode.c
3902 +++ b/fs/devpts/inode.c
3903 @@ -517,11 +517,23 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
3904
3905 struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
3906 {
3907 + struct dentry *dentry;
3908 + struct tty_struct *tty;
3909 +
3910 BUG_ON(pts_inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR));
3911
3912 + /* Ensure dentry has not been deleted by devpts_pty_kill() */
3913 + dentry = d_find_alias(pts_inode);
3914 + if (!dentry)
3915 + return NULL;
3916 +
3917 + tty = NULL;
3918 if (pts_inode->i_sb->s_magic == DEVPTS_SUPER_MAGIC)
3919 - return (struct tty_struct *)pts_inode->i_private;
3920 - return NULL;
3921 + tty = (struct tty_struct *)pts_inode->i_private;
3922 +
3923 + dput(dentry);
3924 +
3925 + return tty;
3926 }
3927
3928 void devpts_pty_kill(struct tty_struct *tty)
3929 diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
3930 index 354ed3b..f9d6937 100644
3931 --- a/fs/ext3/inode.c
3932 +++ b/fs/ext3/inode.c
3933 @@ -1151,6 +1151,16 @@ static int do_journal_get_write_access(handle_t *handle,
3934 return ext3_journal_get_write_access(handle, bh);
3935 }
3936
3937 +/*
3938 + * Truncate blocks that were not used by write. We have to truncate the
3939 + * pagecache as well so that corresponding buffers get properly unmapped.
3940 + */
3941 +static void ext3_truncate_failed_write(struct inode *inode)
3942 +{
3943 + truncate_inode_pages(inode->i_mapping, inode->i_size);
3944 + ext3_truncate(inode);
3945 +}
3946 +
3947 static int ext3_write_begin(struct file *file, struct address_space *mapping,
3948 loff_t pos, unsigned len, unsigned flags,
3949 struct page **pagep, void **fsdata)
3950 @@ -1209,7 +1219,7 @@ write_begin_failed:
3951 unlock_page(page);
3952 page_cache_release(page);
3953 if (pos + len > inode->i_size)
3954 - ext3_truncate(inode);
3955 + ext3_truncate_failed_write(inode);
3956 }
3957 if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries))
3958 goto retry;
3959 @@ -1304,7 +1314,7 @@ static int ext3_ordered_write_end(struct file *file,
3960 page_cache_release(page);
3961
3962 if (pos + len > inode->i_size)
3963 - ext3_truncate(inode);
3964 + ext3_truncate_failed_write(inode);
3965 return ret ? ret : copied;
3966 }
3967
3968 @@ -1330,7 +1340,7 @@ static int ext3_writeback_write_end(struct file *file,
3969 page_cache_release(page);
3970
3971 if (pos + len > inode->i_size)
3972 - ext3_truncate(inode);
3973 + ext3_truncate_failed_write(inode);
3974 return ret ? ret : copied;
3975 }
3976
3977 @@ -1383,7 +1393,7 @@ static int ext3_journalled_write_end(struct file *file,
3978 page_cache_release(page);
3979
3980 if (pos + len > inode->i_size)
3981 - ext3_truncate(inode);
3982 + ext3_truncate_failed_write(inode);
3983 return ret ? ret : copied;
3984 }
3985
3986 diff --git a/fs/hfs/catalog.c b/fs/hfs/catalog.c
3987 index 6d98f11..424b033 100644
3988 --- a/fs/hfs/catalog.c
3989 +++ b/fs/hfs/catalog.c
3990 @@ -289,6 +289,10 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, struct qstr *src_name,
3991 err = hfs_brec_find(&src_fd);
3992 if (err)
3993 goto out;
3994 + if (src_fd.entrylength > sizeof(entry) || src_fd.entrylength < 0) {
3995 + err = -EIO;
3996 + goto out;
3997 + }
3998
3999 hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset,
4000 src_fd.entrylength);
4001 diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
4002 index 7c69b98..2b3b861 100644
4003 --- a/fs/hfs/dir.c
4004 +++ b/fs/hfs/dir.c
4005 @@ -79,6 +79,11 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
4006 filp->f_pos++;
4007 /* fall through */
4008 case 1:
4009 + if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
4010 + err = -EIO;
4011 + goto out;
4012 + }
4013 +
4014 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength);
4015 if (entry.type != HFS_CDR_THD) {
4016 printk(KERN_ERR "hfs: bad catalog folder thread\n");
4017 @@ -109,6 +114,12 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
4018 err = -EIO;
4019 goto out;
4020 }
4021 +
4022 + if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
4023 + err = -EIO;
4024 + goto out;
4025 + }
4026 +
4027 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength);
4028 type = entry.type;
4029 len = hfs_mac2asc(sb, strbuf, &fd.key->cat.CName);
4030 diff --git a/fs/hfs/super.c b/fs/hfs/super.c
4031 index f7fcbe4..5ed7252 100644
4032 --- a/fs/hfs/super.c
4033 +++ b/fs/hfs/super.c
4034 @@ -409,8 +409,13 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
4035 /* try to get the root inode */
4036 hfs_find_init(HFS_SB(sb)->cat_tree, &fd);
4037 res = hfs_cat_find_brec(sb, HFS_ROOT_CNID, &fd);
4038 - if (!res)
4039 + if (!res) {
4040 + if (fd.entrylength > sizeof(rec) || fd.entrylength < 0) {
4041 + res = -EIO;
4042 + goto bail;
4043 + }
4044 hfs_bnode_read(fd.bnode, &rec, fd.entryoffset, fd.entrylength);
4045 + }
4046 if (res) {
4047 hfs_find_exit(&fd);
4048 goto bail_no_root;
4049 diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
4050 index 82c295d..b7ca3a9 100644
4051 --- a/fs/jbd2/journal.c
4052 +++ b/fs/jbd2/journal.c
4053 @@ -1253,6 +1253,13 @@ int jbd2_journal_load(journal_t *journal)
4054 if (jbd2_journal_recover(journal))
4055 goto recovery_error;
4056
4057 + if (journal->j_failed_commit) {
4058 + printk(KERN_ERR "JBD2: journal transaction %u on %s "
4059 + "is corrupt.\n", journal->j_failed_commit,
4060 + journal->j_devname);
4061 + return -EIO;
4062 + }
4063 +
4064 /* OK, we've finished with the dynamic journal bits:
4065 * reinitialise the dynamic contents of the superblock in memory
4066 * and reset them on disk. */
4067 diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c
4068 index 090c556..3b6f2fa 100644
4069 --- a/fs/jffs2/gc.c
4070 +++ b/fs/jffs2/gc.c
4071 @@ -700,7 +700,8 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_
4072 struct jffs2_raw_inode ri;
4073 struct jffs2_node_frag *last_frag;
4074 union jffs2_device_node dev;
4075 - char *mdata = NULL, mdatalen = 0;
4076 + char *mdata = NULL;
4077 + int mdatalen = 0;
4078 uint32_t alloclen, ilen;
4079 int ret;
4080
4081 diff --git a/fs/nfs/write.c b/fs/nfs/write.c
4082 index 53eb26c..6fc3776 100644
4083 --- a/fs/nfs/write.c
4084 +++ b/fs/nfs/write.c
4085 @@ -1612,15 +1612,16 @@ int nfs_migrate_page(struct address_space *mapping, struct page *newpage,
4086 if (ret)
4087 goto out_unlock;
4088 page_cache_get(newpage);
4089 + spin_lock(&mapping->host->i_lock);
4090 req->wb_page = newpage;
4091 SetPagePrivate(newpage);
4092 - set_page_private(newpage, page_private(page));
4093 + set_page_private(newpage, (unsigned long)req);
4094 ClearPagePrivate(page);
4095 set_page_private(page, 0);
4096 + spin_unlock(&mapping->host->i_lock);
4097 page_cache_release(page);
4098 out_unlock:
4099 nfs_clear_page_tag_locked(req);
4100 - nfs_release_request(req);
4101 out:
4102 return ret;
4103 }
4104 diff --git a/include/drm/drmP.h b/include/drm/drmP.h
4105 index c8e64bb..9d3d684 100644
4106 --- a/include/drm/drmP.h
4107 +++ b/include/drm/drmP.h
4108 @@ -1295,6 +1295,7 @@ extern u32 drm_vblank_count(struct drm_device *dev, int crtc);
4109 extern void drm_handle_vblank(struct drm_device *dev, int crtc);
4110 extern int drm_vblank_get(struct drm_device *dev, int crtc);
4111 extern void drm_vblank_put(struct drm_device *dev, int crtc);
4112 +extern void drm_vblank_off(struct drm_device *dev, int crtc);
4113 extern void drm_vblank_cleanup(struct drm_device *dev);
4114 /* Modesetting support */
4115 extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
4116 diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h
4117 index 6983a7c..b199170 100644
4118 --- a/include/drm/ttm/ttm_memory.h
4119 +++ b/include/drm/ttm/ttm_memory.h
4120 @@ -33,6 +33,7 @@
4121 #include <linux/wait.h>
4122 #include <linux/errno.h>
4123 #include <linux/kobject.h>
4124 +#include <linux/mm.h>
4125
4126 /**
4127 * struct ttm_mem_shrink - callback to shrink TTM memory usage.
4128 diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
4129 index ff037f0..9bace4b 100644
4130 --- a/include/linux/hrtimer.h
4131 +++ b/include/linux/hrtimer.h
4132 @@ -446,7 +446,7 @@ extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
4133
4134 static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
4135 {
4136 - if (likely(!timer->start_site))
4137 + if (likely(!timer_stats_active))
4138 return;
4139 timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
4140 timer->function, timer->start_comm, 0);
4141 @@ -457,8 +457,6 @@ extern void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer,
4142
4143 static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer)
4144 {
4145 - if (likely(!timer_stats_active))
4146 - return;
4147 __timer_stats_hrtimer_set_start_info(timer, __builtin_return_address(0));
4148 }
4149
4150 diff --git a/include/linux/kvm.h b/include/linux/kvm.h
4151 index f8f8900..8908dd6 100644
4152 --- a/include/linux/kvm.h
4153 +++ b/include/linux/kvm.h
4154 @@ -116,6 +116,11 @@ struct kvm_run {
4155 __u64 cr8;
4156 __u64 apic_base;
4157
4158 +#ifdef __KVM_S390
4159 + /* the processor status word for s390 */
4160 + __u64 psw_mask; /* psw upper half */
4161 + __u64 psw_addr; /* psw lower half */
4162 +#endif
4163 union {
4164 /* KVM_EXIT_UNKNOWN */
4165 struct {
4166 @@ -167,8 +172,6 @@ struct kvm_run {
4167 /* KVM_EXIT_S390_SIEIC */
4168 struct {
4169 __u8 icptcode;
4170 - __u64 mask; /* psw upper half */
4171 - __u64 addr; /* psw lower half */
4172 __u16 ipa;
4173 __u32 ipb;
4174 } s390_sieic;
4175 @@ -474,6 +477,7 @@ struct kvm_irq_routing {
4176 };
4177
4178 #endif
4179 +#define KVM_CAP_S390_PSW 42
4180
4181 #ifdef KVM_CAP_MCE
4182 /* x86 MCE */
4183 diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
4184 index 9e70126..81c9689 100644
4185 --- a/include/linux/perf_event.h
4186 +++ b/include/linux/perf_event.h
4187 @@ -219,7 +219,7 @@ struct perf_event_attr {
4188 #define PERF_EVENT_IOC_DISABLE _IO ('$', 1)
4189 #define PERF_EVENT_IOC_REFRESH _IO ('$', 2)
4190 #define PERF_EVENT_IOC_RESET _IO ('$', 3)
4191 -#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, u64)
4192 +#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64)
4193 #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5)
4194
4195 enum perf_event_ioc_flags {
4196 diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
4197 index 3d15fb9..a4b947e 100644
4198 --- a/include/linux/usb_usual.h
4199 +++ b/include/linux/usb_usual.h
4200 @@ -56,7 +56,9 @@
4201 US_FLAG(SANE_SENSE, 0x00008000) \
4202 /* Sane Sense (> 18 bytes) */ \
4203 US_FLAG(CAPACITY_OK, 0x00010000) \
4204 - /* READ CAPACITY response is correct */
4205 + /* READ CAPACITY response is correct */ \
4206 + US_FLAG(BAD_SENSE, 0x00020000) \
4207 + /* Bad Sense (never more than 18 bytes) */
4208
4209 #define US_FLAG(name, value) US_FL_##name = value ,
4210 enum { US_DO_ALL_FLAGS };
4211 diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
4212 index 227c2a5..3c123c3 100644
4213 --- a/include/linux/vmalloc.h
4214 +++ b/include/linux/vmalloc.h
4215 @@ -115,9 +115,11 @@ extern rwlock_t vmlist_lock;
4216 extern struct vm_struct *vmlist;
4217 extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
4218
4219 +#ifndef CONFIG_HAVE_LEGACY_PER_CPU_AREA
4220 struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
4221 const size_t *sizes, int nr_vms,
4222 size_t align, gfp_t gfp_mask);
4223 +#endif
4224
4225 void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms);
4226
4227 diff --git a/include/net/tcp.h b/include/net/tcp.h
4228 index 03a49c7..842ac4d 100644
4229 --- a/include/net/tcp.h
4230 +++ b/include/net/tcp.h
4231 @@ -1263,14 +1263,20 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu
4232 * TCP connection after "boundary" unsucessful, exponentially backed-off
4233 * retransmissions with an initial RTO of TCP_RTO_MIN.
4234 */
4235 -static inline bool retransmits_timed_out(const struct sock *sk,
4236 +static inline bool retransmits_timed_out(struct sock *sk,
4237 unsigned int boundary)
4238 {
4239 unsigned int timeout, linear_backoff_thresh;
4240 + unsigned int start_ts;
4241
4242 if (!inet_csk(sk)->icsk_retransmits)
4243 return false;
4244
4245 + if (unlikely(!tcp_sk(sk)->retrans_stamp))
4246 + start_ts = TCP_SKB_CB(tcp_write_queue_head(sk))->when;
4247 + else
4248 + start_ts = tcp_sk(sk)->retrans_stamp;
4249 +
4250 linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN);
4251
4252 if (boundary <= linear_backoff_thresh)
4253 @@ -1279,7 +1285,7 @@ static inline bool retransmits_timed_out(const struct sock *sk,
4254 timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN +
4255 (boundary - linear_backoff_thresh) * TCP_RTO_MAX;
4256
4257 - return (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= timeout;
4258 + return (tcp_time_stamp - start_ts) >= timeout;
4259 }
4260
4261 static inline struct sk_buff *tcp_send_head(struct sock *sk)
4262 diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
4263 index cc0d966..dacb8ef 100644
4264 --- a/include/trace/ftrace.h
4265 +++ b/include/trace/ftrace.h
4266 @@ -159,7 +159,7 @@
4267 #undef __get_str
4268
4269 #undef TP_printk
4270 -#define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)
4271 +#define TP_printk(fmt, args...) "\"%s\", %s\n", fmt, __stringify(args)
4272
4273 #undef TP_fast_assign
4274 #define TP_fast_assign(args...) args
4275 diff --git a/kernel/acct.c b/kernel/acct.c
4276 index 9a4715a..a6605ca 100644
4277 --- a/kernel/acct.c
4278 +++ b/kernel/acct.c
4279 @@ -536,7 +536,8 @@ static void do_acct_process(struct bsd_acct_struct *acct,
4280 do_div(elapsed, AHZ);
4281 ac.ac_btime = get_seconds() - elapsed;
4282 /* we really need to bite the bullet and change layout */
4283 - current_uid_gid(&ac.ac_uid, &ac.ac_gid);
4284 + ac.ac_uid = orig_cred->uid;
4285 + ac.ac_gid = orig_cred->gid;
4286 #if ACCT_VERSION==2
4287 ac.ac_ahz = AHZ;
4288 #endif
4289 diff --git a/kernel/futex.c b/kernel/futex.c
4290 index fb65e82..d73ef1f 100644
4291 --- a/kernel/futex.c
4292 +++ b/kernel/futex.c
4293 @@ -304,8 +304,14 @@ void put_futex_key(int fshared, union futex_key *key)
4294 */
4295 static int fault_in_user_writeable(u32 __user *uaddr)
4296 {
4297 - int ret = get_user_pages(current, current->mm, (unsigned long)uaddr,
4298 - 1, 1, 0, NULL, NULL);
4299 + struct mm_struct *mm = current->mm;
4300 + int ret;
4301 +
4302 + down_read(&mm->mmap_sem);
4303 + ret = get_user_pages(current, mm, (unsigned long)uaddr,
4304 + 1, 1, 0, NULL, NULL);
4305 + up_read(&mm->mmap_sem);
4306 +
4307 return ret < 0 ? ret : 0;
4308 }
4309
4310 diff --git a/kernel/perf_event.c b/kernel/perf_event.c
4311 index 7f29643..6eee915 100644
4312 --- a/kernel/perf_event.c
4313 +++ b/kernel/perf_event.c
4314 @@ -1583,7 +1583,7 @@ static struct perf_event_context *find_get_context(pid_t pid, int cpu)
4315 if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN))
4316 return ERR_PTR(-EACCES);
4317
4318 - if (cpu < 0 || cpu > num_possible_cpus())
4319 + if (cpu < 0 || cpu >= nr_cpumask_bits)
4320 return ERR_PTR(-EINVAL);
4321
4322 /*
4323 @@ -2174,6 +2174,7 @@ static void perf_mmap_data_free(struct perf_mmap_data *data)
4324 perf_mmap_free_page((unsigned long)data->user_page);
4325 for (i = 0; i < data->nr_pages; i++)
4326 perf_mmap_free_page((unsigned long)data->data_pages[i]);
4327 + kfree(data);
4328 }
4329
4330 #else
4331 @@ -2214,6 +2215,7 @@ static void perf_mmap_data_free_work(struct work_struct *work)
4332 perf_mmap_unmark_page(base + (i * PAGE_SIZE));
4333
4334 vfree(base);
4335 + kfree(data);
4336 }
4337
4338 static void perf_mmap_data_free(struct perf_mmap_data *data)
4339 @@ -2319,7 +2321,6 @@ static void perf_mmap_data_free_rcu(struct rcu_head *rcu_head)
4340
4341 data = container_of(rcu_head, struct perf_mmap_data, rcu_head);
4342 perf_mmap_data_free(data);
4343 - kfree(data);
4344 }
4345
4346 static void perf_mmap_data_release(struct perf_event *event)
4347 @@ -3949,6 +3950,7 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
4348 event->pmu->read(event);
4349
4350 data.addr = 0;
4351 + data.period = event->hw.last_period;
4352 regs = get_irq_regs();
4353 /*
4354 * In case we exclude kernel IPs or are somehow not in interrupt
4355 diff --git a/kernel/rcutree.c b/kernel/rcutree.c
4356 index f3077c0..683c4f3 100644
4357 --- a/kernel/rcutree.c
4358 +++ b/kernel/rcutree.c
4359 @@ -176,9 +176,29 @@ static struct rcu_node *rcu_get_root(struct rcu_state *rsp)
4360 return &rsp->node[0];
4361 }
4362
4363 +/*
4364 + * Record the specified "completed" value, which is later used to validate
4365 + * dynticks counter manipulations and CPU-offline checks. Specify
4366 + * "rsp->completed - 1" to unconditionally invalidate any future dynticks
4367 + * manipulations and CPU-offline checks. Such invalidation is useful at
4368 + * the beginning of a grace period.
4369 + */
4370 +static void dyntick_record_completed(struct rcu_state *rsp, long comp)
4371 +{
4372 + rsp->dynticks_completed = comp;
4373 +}
4374 +
4375 #ifdef CONFIG_SMP
4376
4377 /*
4378 + * Recall the previously recorded value of the completion for dynticks.
4379 + */
4380 +static long dyntick_recall_completed(struct rcu_state *rsp)
4381 +{
4382 + return rsp->dynticks_completed;
4383 +}
4384 +
4385 +/*
4386 * If the specified CPU is offline, tell the caller that it is in
4387 * a quiescent state. Otherwise, whack it with a reschedule IPI.
4388 * Grace periods can end up waiting on an offline CPU when that
4389 @@ -335,28 +355,9 @@ void rcu_irq_exit(void)
4390 set_need_resched();
4391 }
4392
4393 -/*
4394 - * Record the specified "completed" value, which is later used to validate
4395 - * dynticks counter manipulations. Specify "rsp->completed - 1" to
4396 - * unconditionally invalidate any future dynticks manipulations (which is
4397 - * useful at the beginning of a grace period).
4398 - */
4399 -static void dyntick_record_completed(struct rcu_state *rsp, long comp)
4400 -{
4401 - rsp->dynticks_completed = comp;
4402 -}
4403 -
4404 #ifdef CONFIG_SMP
4405
4406 /*
4407 - * Recall the previously recorded value of the completion for dynticks.
4408 - */
4409 -static long dyntick_recall_completed(struct rcu_state *rsp)
4410 -{
4411 - return rsp->dynticks_completed;
4412 -}
4413 -
4414 -/*
4415 * Snapshot the specified CPU's dynticks counter so that we can later
4416 * credit them with an implicit quiescent state. Return 1 if this CPU
4417 * is in dynticks idle mode, which is an extended quiescent state.
4418 @@ -419,24 +420,8 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp)
4419
4420 #else /* #ifdef CONFIG_NO_HZ */
4421
4422 -static void dyntick_record_completed(struct rcu_state *rsp, long comp)
4423 -{
4424 -}
4425 -
4426 #ifdef CONFIG_SMP
4427
4428 -/*
4429 - * If there are no dynticks, then the only way that a CPU can passively
4430 - * be in a quiescent state is to be offline. Unlike dynticks idle, which
4431 - * is a point in time during the prior (already finished) grace period,
4432 - * an offline CPU is always in a quiescent state, and thus can be
4433 - * unconditionally applied. So just return the current value of completed.
4434 - */
4435 -static long dyntick_recall_completed(struct rcu_state *rsp)
4436 -{
4437 - return rsp->completed;
4438 -}
4439 -
4440 static int dyntick_save_progress_counter(struct rcu_data *rdp)
4441 {
4442 return 0;
4443 @@ -553,13 +538,33 @@ static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
4444 /*
4445 * Update CPU-local rcu_data state to record the newly noticed grace period.
4446 * This is used both when we started the grace period and when we notice
4447 - * that someone else started the grace period.
4448 + * that someone else started the grace period. The caller must hold the
4449 + * ->lock of the leaf rcu_node structure corresponding to the current CPU,
4450 + * and must have irqs disabled.
4451 */
4452 +static void __note_new_gpnum(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_data *rdp)
4453 +{
4454 + if (rdp->gpnum != rnp->gpnum) {
4455 + rdp->qs_pending = 1;
4456 + rdp->passed_quiesc = 0;
4457 + rdp->gpnum = rnp->gpnum;
4458 + }
4459 +}
4460 +
4461 static void note_new_gpnum(struct rcu_state *rsp, struct rcu_data *rdp)
4462 {
4463 - rdp->qs_pending = 1;
4464 - rdp->passed_quiesc = 0;
4465 - rdp->gpnum = rsp->gpnum;
4466 + unsigned long flags;
4467 + struct rcu_node *rnp;
4468 +
4469 + local_irq_save(flags);
4470 + rnp = rdp->mynode;
4471 + if (rdp->gpnum == ACCESS_ONCE(rnp->gpnum) || /* outside lock. */
4472 + !spin_trylock(&rnp->lock)) { /* irqs already off, retry later. */
4473 + local_irq_restore(flags);
4474 + return;
4475 + }
4476 + __note_new_gpnum(rsp, rnp, rdp);
4477 + spin_unlock_irqrestore(&rnp->lock, flags);
4478 }
4479
4480 /*
4481 @@ -583,6 +588,79 @@ check_for_new_grace_period(struct rcu_state *rsp, struct rcu_data *rdp)
4482 }
4483
4484 /*
4485 + * Advance this CPU's callbacks, but only if the current grace period
4486 + * has ended. This may be called only from the CPU to whom the rdp
4487 + * belongs. In addition, the corresponding leaf rcu_node structure's
4488 + * ->lock must be held by the caller, with irqs disabled.
4489 + */
4490 +static void
4491 +__rcu_process_gp_end(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_data *rdp)
4492 +{
4493 + /* Did another grace period end? */
4494 + if (rdp->completed != rnp->completed) {
4495 +
4496 + /* Advance callbacks. No harm if list empty. */
4497 + rdp->nxttail[RCU_DONE_TAIL] = rdp->nxttail[RCU_WAIT_TAIL];
4498 + rdp->nxttail[RCU_WAIT_TAIL] = rdp->nxttail[RCU_NEXT_READY_TAIL];
4499 + rdp->nxttail[RCU_NEXT_READY_TAIL] = rdp->nxttail[RCU_NEXT_TAIL];
4500 +
4501 + /* Remember that we saw this grace-period completion. */
4502 + rdp->completed = rnp->completed;
4503 + }
4504 +}
4505 +
4506 +/*
4507 + * Advance this CPU's callbacks, but only if the current grace period
4508 + * has ended. This may be called only from the CPU to whom the rdp
4509 + * belongs.
4510 + */
4511 +static void
4512 +rcu_process_gp_end(struct rcu_state *rsp, struct rcu_data *rdp)
4513 +{
4514 + unsigned long flags;
4515 + struct rcu_node *rnp;
4516 +
4517 + local_irq_save(flags);
4518 + rnp = rdp->mynode;
4519 + if (rdp->completed == ACCESS_ONCE(rnp->completed) || /* outside lock. */
4520 + !spin_trylock(&rnp->lock)) { /* irqs already off, retry later. */
4521 + local_irq_restore(flags);
4522 + return;
4523 + }
4524 + __rcu_process_gp_end(rsp, rnp, rdp);
4525 + spin_unlock_irqrestore(&rnp->lock, flags);
4526 +}
4527 +
4528 +/*
4529 + * Do per-CPU grace-period initialization for running CPU. The caller
4530 + * must hold the lock of the leaf rcu_node structure corresponding to
4531 + * this CPU.
4532 + */
4533 +static void
4534 +rcu_start_gp_per_cpu(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_data *rdp)
4535 +{
4536 + /* Prior grace period ended, so advance callbacks for current CPU. */
4537 + __rcu_process_gp_end(rsp, rnp, rdp);
4538 +
4539 + /*
4540 + * Because this CPU just now started the new grace period, we know
4541 + * that all of its callbacks will be covered by this upcoming grace
4542 + * period, even the ones that were registered arbitrarily recently.
4543 + * Therefore, advance all outstanding callbacks to RCU_WAIT_TAIL.
4544 + *
4545 + * Other CPUs cannot be sure exactly when the grace period started.
4546 + * Therefore, their recently registered callbacks must pass through
4547 + * an additional RCU_NEXT_READY stage, so that they will be handled
4548 + * by the next RCU grace period.
4549 + */
4550 + rdp->nxttail[RCU_NEXT_READY_TAIL] = rdp->nxttail[RCU_NEXT_TAIL];
4551 + rdp->nxttail[RCU_WAIT_TAIL] = rdp->nxttail[RCU_NEXT_TAIL];
4552 +
4553 + /* Set state so that this CPU will detect the next quiescent state. */
4554 + __note_new_gpnum(rsp, rnp, rdp);
4555 +}
4556 +
4557 +/*
4558 * Start a new RCU grace period if warranted, re-initializing the hierarchy
4559 * in preparation for detecting the next grace period. The caller must hold
4560 * the root node's ->lock, which is released before return. Hard irqs must
4561 @@ -607,28 +685,15 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags)
4562 rsp->jiffies_force_qs = jiffies + RCU_JIFFIES_TILL_FORCE_QS;
4563 record_gp_stall_check_time(rsp);
4564 dyntick_record_completed(rsp, rsp->completed - 1);
4565 - note_new_gpnum(rsp, rdp);
4566 -
4567 - /*
4568 - * Because this CPU just now started the new grace period, we know
4569 - * that all of its callbacks will be covered by this upcoming grace
4570 - * period, even the ones that were registered arbitrarily recently.
4571 - * Therefore, advance all outstanding callbacks to RCU_WAIT_TAIL.
4572 - *
4573 - * Other CPUs cannot be sure exactly when the grace period started.
4574 - * Therefore, their recently registered callbacks must pass through
4575 - * an additional RCU_NEXT_READY stage, so that they will be handled
4576 - * by the next RCU grace period.
4577 - */
4578 - rdp->nxttail[RCU_NEXT_READY_TAIL] = rdp->nxttail[RCU_NEXT_TAIL];
4579 - rdp->nxttail[RCU_WAIT_TAIL] = rdp->nxttail[RCU_NEXT_TAIL];
4580
4581 /* Special-case the common single-level case. */
4582 if (NUM_RCU_NODES == 1) {
4583 rcu_preempt_check_blocked_tasks(rnp);
4584 rnp->qsmask = rnp->qsmaskinit;
4585 rnp->gpnum = rsp->gpnum;
4586 + rnp->completed = rsp->completed;
4587 rsp->signaled = RCU_SIGNAL_INIT; /* force_quiescent_state OK. */
4588 + rcu_start_gp_per_cpu(rsp, rnp, rdp);
4589 spin_unlock_irqrestore(&rnp->lock, flags);
4590 return;
4591 }
4592 @@ -661,6 +726,9 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags)
4593 rcu_preempt_check_blocked_tasks(rnp);
4594 rnp->qsmask = rnp->qsmaskinit;
4595 rnp->gpnum = rsp->gpnum;
4596 + rnp->completed = rsp->completed;
4597 + if (rnp == rdp->mynode)
4598 + rcu_start_gp_per_cpu(rsp, rnp, rdp);
4599 spin_unlock(&rnp->lock); /* irqs remain disabled. */
4600 }
4601
4602 @@ -672,34 +740,6 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags)
4603 }
4604
4605 /*
4606 - * Advance this CPU's callbacks, but only if the current grace period
4607 - * has ended. This may be called only from the CPU to whom the rdp
4608 - * belongs.
4609 - */
4610 -static void
4611 -rcu_process_gp_end(struct rcu_state *rsp, struct rcu_data *rdp)
4612 -{
4613 - long completed_snap;
4614 - unsigned long flags;
4615 -
4616 - local_irq_save(flags);
4617 - completed_snap = ACCESS_ONCE(rsp->completed); /* outside of lock. */
4618 -
4619 - /* Did another grace period end? */
4620 - if (rdp->completed != completed_snap) {
4621 -
4622 - /* Advance callbacks. No harm if list empty. */
4623 - rdp->nxttail[RCU_DONE_TAIL] = rdp->nxttail[RCU_WAIT_TAIL];
4624 - rdp->nxttail[RCU_WAIT_TAIL] = rdp->nxttail[RCU_NEXT_READY_TAIL];
4625 - rdp->nxttail[RCU_NEXT_READY_TAIL] = rdp->nxttail[RCU_NEXT_TAIL];
4626 -
4627 - /* Remember that we saw this grace-period completion. */
4628 - rdp->completed = completed_snap;
4629 - }
4630 - local_irq_restore(flags);
4631 -}
4632 -
4633 -/*
4634 * Clean up after the prior grace period and let rcu_start_gp() start up
4635 * the next grace period if one is needed. Note that the caller must
4636 * hold rnp->lock, as required by rcu_start_gp(), which will release it.
4637 @@ -710,7 +750,6 @@ static void cpu_quiet_msk_finish(struct rcu_state *rsp, unsigned long flags)
4638 WARN_ON_ONCE(!rcu_gp_in_progress(rsp));
4639 rsp->completed = rsp->gpnum;
4640 rsp->signaled = RCU_GP_IDLE;
4641 - rcu_process_gp_end(rsp, rsp->rda[smp_processor_id()]);
4642 rcu_start_gp(rsp, flags); /* releases root node's rnp->lock. */
4643 }
4644
4645 @@ -1144,6 +1183,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
4646 long lastcomp;
4647 struct rcu_node *rnp = rcu_get_root(rsp);
4648 u8 signaled;
4649 + u8 forcenow;
4650
4651 if (!rcu_gp_in_progress(rsp))
4652 return; /* No grace period in progress, nothing to force. */
4653 @@ -1180,16 +1220,23 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
4654 if (rcu_process_dyntick(rsp, lastcomp,
4655 dyntick_save_progress_counter))
4656 goto unlock_ret;
4657 + /* fall into next case. */
4658 +
4659 + case RCU_SAVE_COMPLETED:
4660
4661 /* Update state, record completion counter. */
4662 + forcenow = 0;
4663 spin_lock(&rnp->lock);
4664 if (lastcomp == rsp->completed &&
4665 - rsp->signaled == RCU_SAVE_DYNTICK) {
4666 + rsp->signaled == signaled) {
4667 rsp->signaled = RCU_FORCE_QS;
4668 dyntick_record_completed(rsp, lastcomp);
4669 + forcenow = signaled == RCU_SAVE_COMPLETED;
4670 }
4671 spin_unlock(&rnp->lock);
4672 - break;
4673 + if (!forcenow)
4674 + break;
4675 + /* fall into next case. */
4676
4677 case RCU_FORCE_QS:
4678
4679 @@ -1544,21 +1591,16 @@ static void __cpuinit
4680 rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptable)
4681 {
4682 unsigned long flags;
4683 - long lastcomp;
4684 unsigned long mask;
4685 struct rcu_data *rdp = rsp->rda[cpu];
4686 struct rcu_node *rnp = rcu_get_root(rsp);
4687
4688 /* Set up local state, ensuring consistent view of global state. */
4689 spin_lock_irqsave(&rnp->lock, flags);
4690 - lastcomp = rsp->completed;
4691 - rdp->completed = lastcomp;
4692 - rdp->gpnum = lastcomp;
4693 rdp->passed_quiesc = 0; /* We could be racing with new GP, */
4694 rdp->qs_pending = 1; /* so set up to respond to current GP. */
4695 rdp->beenonline = 1; /* We have now been online. */
4696 rdp->preemptable = preemptable;
4697 - rdp->passed_quiesc_completed = lastcomp - 1;
4698 rdp->qlen_last_fqs_check = 0;
4699 rdp->n_force_qs_snap = rsp->n_force_qs;
4700 rdp->blimit = blimit;
4701 @@ -1580,6 +1622,11 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptable)
4702 spin_lock(&rnp->lock); /* irqs already disabled. */
4703 rnp->qsmaskinit |= mask;
4704 mask = rnp->grpmask;
4705 + if (rnp == rdp->mynode) {
4706 + rdp->gpnum = rnp->completed; /* if GP in progress... */
4707 + rdp->completed = rnp->completed;
4708 + rdp->passed_quiesc_completed = rnp->completed - 1;
4709 + }
4710 spin_unlock(&rnp->lock); /* irqs already disabled. */
4711 rnp = rnp->parent;
4712 } while (rnp != NULL && !(rnp->qsmaskinit & mask));
4713 diff --git a/kernel/rcutree.h b/kernel/rcutree.h
4714 index 1899023..ddb79ec 100644
4715 --- a/kernel/rcutree.h
4716 +++ b/kernel/rcutree.h
4717 @@ -84,6 +84,9 @@ struct rcu_node {
4718 long gpnum; /* Current grace period for this node. */
4719 /* This will either be equal to or one */
4720 /* behind the root rcu_node's gpnum. */
4721 + long completed; /* Last grace period completed for this node. */
4722 + /* This will either be equal to or one */
4723 + /* behind the root rcu_node's gpnum. */
4724 unsigned long qsmask; /* CPUs or groups that need to switch in */
4725 /* order for current grace period to proceed.*/
4726 /* In leaf rcu_node, each bit corresponds to */
4727 @@ -204,11 +207,12 @@ struct rcu_data {
4728 #define RCU_GP_IDLE 0 /* No grace period in progress. */
4729 #define RCU_GP_INIT 1 /* Grace period being initialized. */
4730 #define RCU_SAVE_DYNTICK 2 /* Need to scan dyntick state. */
4731 -#define RCU_FORCE_QS 3 /* Need to force quiescent state. */
4732 +#define RCU_SAVE_COMPLETED 3 /* Need to save rsp->completed. */
4733 +#define RCU_FORCE_QS 4 /* Need to force quiescent state. */
4734 #ifdef CONFIG_NO_HZ
4735 #define RCU_SIGNAL_INIT RCU_SAVE_DYNTICK
4736 #else /* #ifdef CONFIG_NO_HZ */
4737 -#define RCU_SIGNAL_INIT RCU_FORCE_QS
4738 +#define RCU_SIGNAL_INIT RCU_SAVE_COMPLETED
4739 #endif /* #else #ifdef CONFIG_NO_HZ */
4740
4741 #define RCU_JIFFIES_TILL_FORCE_QS 3 /* for rsp->jiffies_force_qs */
4742 @@ -274,9 +278,8 @@ struct rcu_state {
4743 unsigned long jiffies_stall; /* Time at which to check */
4744 /* for CPU stalls. */
4745 #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
4746 -#ifdef CONFIG_NO_HZ
4747 long dynticks_completed; /* Value of completed @ snap. */
4748 -#endif /* #ifdef CONFIG_NO_HZ */
4749 + /* Protected by fqslock. */
4750 };
4751
4752 #ifdef RCU_TREE_NONCORE
4753 @@ -298,7 +301,7 @@ DECLARE_PER_CPU(struct rcu_data, rcu_preempt_data);
4754 #else /* #ifdef RCU_TREE_NONCORE */
4755
4756 /* Forward declarations for rcutree_plugin.h */
4757 -static inline void rcu_bootup_announce(void);
4758 +static void rcu_bootup_announce(void);
4759 long rcu_batches_completed(void);
4760 static void rcu_preempt_note_context_switch(int cpu);
4761 static int rcu_preempted_readers(struct rcu_node *rnp);
4762 diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
4763 index ef2a58c..c03edf7 100644
4764 --- a/kernel/rcutree_plugin.h
4765 +++ b/kernel/rcutree_plugin.h
4766 @@ -33,7 +33,7 @@ DEFINE_PER_CPU(struct rcu_data, rcu_preempt_data);
4767 /*
4768 * Tell them what RCU they are running.
4769 */
4770 -static inline void rcu_bootup_announce(void)
4771 +static void rcu_bootup_announce(void)
4772 {
4773 printk(KERN_INFO
4774 "Experimental preemptable hierarchical RCU implementation.\n");
4775 @@ -481,7 +481,7 @@ void exit_rcu(void)
4776 /*
4777 * Tell them what RCU they are running.
4778 */
4779 -static inline void rcu_bootup_announce(void)
4780 +static void rcu_bootup_announce(void)
4781 {
4782 printk(KERN_INFO "Hierarchical RCU implementation.\n");
4783 }
4784 diff --git a/kernel/sched.c b/kernel/sched.c
4785 index 3c11ae0..d079a9f 100644
4786 --- a/kernel/sched.c
4787 +++ b/kernel/sched.c
4788 @@ -591,6 +591,8 @@ struct rq {
4789
4790 u64 rt_avg;
4791 u64 age_stamp;
4792 + u64 idle_stamp;
4793 + u64 avg_idle;
4794 #endif
4795
4796 /* calc_load related fields */
4797 @@ -2440,6 +2442,17 @@ out_running:
4798 #ifdef CONFIG_SMP
4799 if (p->sched_class->task_wake_up)
4800 p->sched_class->task_wake_up(rq, p);
4801 +
4802 + if (unlikely(rq->idle_stamp)) {
4803 + u64 delta = rq->clock - rq->idle_stamp;
4804 + u64 max = 2*sysctl_sched_migration_cost;
4805 +
4806 + if (delta > max)
4807 + rq->avg_idle = max;
4808 + else
4809 + update_avg(&rq->avg_idle, delta);
4810 + rq->idle_stamp = 0;
4811 + }
4812 #endif
4813 out:
4814 task_rq_unlock(rq, &flags);
4815 @@ -4126,7 +4139,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
4816 unsigned long flags;
4817 struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
4818
4819 - cpumask_setall(cpus);
4820 + cpumask_copy(cpus, cpu_online_mask);
4821
4822 /*
4823 * When power savings policy is enabled for the parent domain, idle
4824 @@ -4289,7 +4302,7 @@ load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd)
4825 int all_pinned = 0;
4826 struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
4827
4828 - cpumask_setall(cpus);
4829 + cpumask_copy(cpus, cpu_online_mask);
4830
4831 /*
4832 * When power savings policy is enabled for the parent domain, idle
4833 @@ -4429,6 +4442,11 @@ static void idle_balance(int this_cpu, struct rq *this_rq)
4834 int pulled_task = 0;
4835 unsigned long next_balance = jiffies + HZ;
4836
4837 + this_rq->idle_stamp = this_rq->clock;
4838 +
4839 + if (this_rq->avg_idle < sysctl_sched_migration_cost)
4840 + return;
4841 +
4842 for_each_domain(this_cpu, sd) {
4843 unsigned long interval;
4844
4845 @@ -4443,8 +4461,10 @@ static void idle_balance(int this_cpu, struct rq *this_rq)
4846 interval = msecs_to_jiffies(sd->balance_interval);
4847 if (time_after(next_balance, sd->last_balance + interval))
4848 next_balance = sd->last_balance + interval;
4849 - if (pulled_task)
4850 + if (pulled_task) {
4851 + this_rq->idle_stamp = 0;
4852 break;
4853 + }
4854 }
4855 if (pulled_task || time_after(jiffies, this_rq->next_balance)) {
4856 /*
4857 @@ -9522,6 +9542,8 @@ void __init sched_init(void)
4858 rq->cpu = i;
4859 rq->online = 0;
4860 rq->migration_thread = NULL;
4861 + rq->idle_stamp = 0;
4862 + rq->avg_idle = 2*sysctl_sched_migration_cost;
4863 INIT_LIST_HEAD(&rq->migration_queue);
4864 rq_attach_root(rq, &def_root_domain);
4865 #endif
4866 diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
4867 index efb8440..6988cf0 100644
4868 --- a/kernel/sched_debug.c
4869 +++ b/kernel/sched_debug.c
4870 @@ -285,12 +285,16 @@ static void print_cpu(struct seq_file *m, int cpu)
4871
4872 #ifdef CONFIG_SCHEDSTATS
4873 #define P(n) SEQ_printf(m, " .%-30s: %d\n", #n, rq->n);
4874 +#define P64(n) SEQ_printf(m, " .%-30s: %Ld\n", #n, rq->n);
4875
4876 P(yld_count);
4877
4878 P(sched_switch);
4879 P(sched_count);
4880 P(sched_goidle);
4881 +#ifdef CONFIG_SMP
4882 + P64(avg_idle);
4883 +#endif
4884
4885 P(ttwu_count);
4886 P(ttwu_local);
4887 diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
4888 index 37087a7..5488a5d 100644
4889 --- a/kernel/sched_fair.c
4890 +++ b/kernel/sched_fair.c
4891 @@ -1398,11 +1398,38 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag
4892 want_sd = 0;
4893 }
4894
4895 - if (want_affine && (tmp->flags & SD_WAKE_AFFINE) &&
4896 - cpumask_test_cpu(prev_cpu, sched_domain_span(tmp))) {
4897 + if (want_affine && (tmp->flags & SD_WAKE_AFFINE)) {
4898 + int candidate = -1, i;
4899
4900 - affine_sd = tmp;
4901 - want_affine = 0;
4902 + if (cpumask_test_cpu(prev_cpu, sched_domain_span(tmp)))
4903 + candidate = cpu;
4904 +
4905 + /*
4906 + * Check for an idle shared cache.
4907 + */
4908 + if (tmp->flags & SD_PREFER_SIBLING) {
4909 + if (candidate == cpu) {
4910 + if (!cpu_rq(prev_cpu)->cfs.nr_running)
4911 + candidate = prev_cpu;
4912 + }
4913 +
4914 + if (candidate == -1 || candidate == cpu) {
4915 + for_each_cpu(i, sched_domain_span(tmp)) {
4916 + if (!cpumask_test_cpu(i, &p->cpus_allowed))
4917 + continue;
4918 + if (!cpu_rq(i)->cfs.nr_running) {
4919 + candidate = i;
4920 + break;
4921 + }
4922 + }
4923 + }
4924 + }
4925 +
4926 + if (candidate >= 0) {
4927 + affine_sd = tmp;
4928 + want_affine = 0;
4929 + cpu = candidate;
4930 + }
4931 }
4932
4933 if (!want_sd && !want_affine)
4934 diff --git a/mm/memcontrol.c b/mm/memcontrol.c
4935 index f99f599..6314015 100644
4936 --- a/mm/memcontrol.c
4937 +++ b/mm/memcontrol.c
4938 @@ -2541,6 +2541,7 @@ static u64 mem_cgroup_read(struct cgroup *cont, struct cftype *cft)
4939 val += idx_val;
4940 mem_cgroup_get_recursive_idx_stat(mem,
4941 MEM_CGROUP_STAT_SWAPOUT, &idx_val);
4942 + val += idx_val;
4943 val <<= PAGE_SHIFT;
4944 } else
4945 val = res_counter_read_u64(&mem->memsw, name);
4946 diff --git a/mm/memory.c b/mm/memory.c
4947 index 6ab19dd..4e59455 100644
4948 --- a/mm/memory.c
4949 +++ b/mm/memory.c
4950 @@ -2514,7 +2514,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
4951 ret = VM_FAULT_HWPOISON;
4952 } else {
4953 print_bad_pte(vma, address, orig_pte, NULL);
4954 - ret = VM_FAULT_OOM;
4955 + ret = VM_FAULT_SIGBUS;
4956 }
4957 goto out;
4958 }
4959 @@ -2910,7 +2910,7 @@ static int do_nonlinear_fault(struct mm_struct *mm, struct vm_area_struct *vma,
4960 * Page table corrupted: show pte and kill process.
4961 */
4962 print_bad_pte(vma, address, orig_pte, NULL);
4963 - return VM_FAULT_OOM;
4964 + return VM_FAULT_SIGBUS;
4965 }
4966
4967 pgoff = pte_to_pgoff(orig_pte);
4968 diff --git a/mm/mincore.c b/mm/mincore.c
4969 index 8cb508f..7a3436e 100644
4970 --- a/mm/mincore.c
4971 +++ b/mm/mincore.c
4972 @@ -14,6 +14,7 @@
4973 #include <linux/syscalls.h>
4974 #include <linux/swap.h>
4975 #include <linux/swapops.h>
4976 +#include <linux/hugetlb.h>
4977
4978 #include <asm/uaccess.h>
4979 #include <asm/pgtable.h>
4980 @@ -72,6 +73,42 @@ static long do_mincore(unsigned long addr, unsigned char *vec, unsigned long pag
4981 if (!vma || addr < vma->vm_start)
4982 return -ENOMEM;
4983
4984 +#ifdef CONFIG_HUGETLB_PAGE
4985 + if (is_vm_hugetlb_page(vma)) {
4986 + struct hstate *h;
4987 + unsigned long nr_huge;
4988 + unsigned char present;
4989 +
4990 + i = 0;
4991 + nr = min(pages, (vma->vm_end - addr) >> PAGE_SHIFT);
4992 + h = hstate_vma(vma);
4993 + nr_huge = ((addr + pages * PAGE_SIZE - 1) >> huge_page_shift(h))
4994 + - (addr >> huge_page_shift(h)) + 1;
4995 + nr_huge = min(nr_huge,
4996 + (vma->vm_end - addr) >> huge_page_shift(h));
4997 + while (1) {
4998 + /* hugepage always in RAM for now,
4999 + * but generally it needs to be check */
5000 + ptep = huge_pte_offset(current->mm,
5001 + addr & huge_page_mask(h));
5002 + present = !!(ptep &&
5003 + !huge_pte_none(huge_ptep_get(ptep)));
5004 + while (1) {
5005 + vec[i++] = present;
5006 + addr += PAGE_SIZE;
5007 + /* reach buffer limit */
5008 + if (i == nr)
5009 + return nr;
5010 + /* check hugepage border */
5011 + if (!((addr & ~huge_page_mask(h))
5012 + >> PAGE_SHIFT))
5013 + break;
5014 + }
5015 + }
5016 + return nr;
5017 + }
5018 +#endif
5019 +
5020 /*
5021 * Calculate how many pages there are left in the last level of the
5022 * PTE array for our address.
5023 diff --git a/mm/pagewalk.c b/mm/pagewalk.c
5024 index d5878be..a286915 100644
5025 --- a/mm/pagewalk.c
5026 +++ b/mm/pagewalk.c
5027 @@ -1,6 +1,7 @@
5028 #include <linux/mm.h>
5029 #include <linux/highmem.h>
5030 #include <linux/sched.h>
5031 +#include <linux/hugetlb.h>
5032
5033 static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
5034 struct mm_walk *walk)
5035 @@ -107,6 +108,7 @@ int walk_page_range(unsigned long addr, unsigned long end,
5036 pgd_t *pgd;
5037 unsigned long next;
5038 int err = 0;
5039 + struct vm_area_struct *vma;
5040
5041 if (addr >= end)
5042 return err;
5043 @@ -117,11 +119,22 @@ int walk_page_range(unsigned long addr, unsigned long end,
5044 pgd = pgd_offset(walk->mm, addr);
5045 do {
5046 next = pgd_addr_end(addr, end);
5047 +
5048 + /* skip hugetlb vma to avoid hugepage PMD being cleared
5049 + * in pmd_none_or_clear_bad(). */
5050 + vma = find_vma(walk->mm, addr);
5051 + if (vma && is_vm_hugetlb_page(vma)) {
5052 + if (vma->vm_end < next)
5053 + next = vma->vm_end;
5054 + continue;
5055 + }
5056 +
5057 if (pgd_none_or_clear_bad(pgd)) {
5058 if (walk->pte_hole)
5059 err = walk->pte_hole(addr, next, walk);
5060 if (err)
5061 break;
5062 + pgd++;
5063 continue;
5064 }
5065 if (walk->pgd_entry)
5066 @@ -131,7 +144,8 @@ int walk_page_range(unsigned long addr, unsigned long end,
5067 err = walk_pud_range(pgd, addr, next, walk);
5068 if (err)
5069 break;
5070 - } while (pgd++, addr = next, addr != end);
5071 + pgd++;
5072 + } while (addr = next, addr != end);
5073
5074 return err;
5075 }
5076 diff --git a/mm/vmalloc.c b/mm/vmalloc.c
5077 index 0f551a4..7758726 100644
5078 --- a/mm/vmalloc.c
5079 +++ b/mm/vmalloc.c
5080 @@ -1993,6 +1993,7 @@ void free_vm_area(struct vm_struct *area)
5081 }
5082 EXPORT_SYMBOL_GPL(free_vm_area);
5083
5084 +#ifndef CONFIG_HAVE_LEGACY_PER_CPU_AREA
5085 static struct vmap_area *node_to_va(struct rb_node *n)
5086 {
5087 return n ? rb_entry(n, struct vmap_area, rb_node) : NULL;
5088 @@ -2257,6 +2258,7 @@ err_free:
5089 kfree(vms);
5090 return NULL;
5091 }
5092 +#endif
5093
5094 /**
5095 * pcpu_free_vm_areas - free vmalloc areas for percpu allocator
5096 diff --git a/net/core/dev.c b/net/core/dev.c
5097 index fe10551..584046e 100644
5098 --- a/net/core/dev.c
5099 +++ b/net/core/dev.c
5100 @@ -4860,6 +4860,11 @@ int register_netdevice(struct net_device *dev)
5101 rollback_registered(dev);
5102 dev->reg_state = NETREG_UNREGISTERED;
5103 }
5104 + /*
5105 + * Prevent userspace races by waiting until the network
5106 + * device is fully setup before sending notifications.
5107 + */
5108 + rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U);
5109
5110 out:
5111 return ret;
5112 @@ -5398,6 +5403,12 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
5113 /* Notify protocols, that a new device appeared. */
5114 call_netdevice_notifiers(NETDEV_REGISTER, dev);
5115
5116 + /*
5117 + * Prevent userspace races by waiting until the network
5118 + * device is fully setup before sending notifications.
5119 + */
5120 + rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U);
5121 +
5122 synchronize_net();
5123 err = 0;
5124 out:
5125 diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
5126 index eb42873..d4fd895 100644
5127 --- a/net/core/rtnetlink.c
5128 +++ b/net/core/rtnetlink.c
5129 @@ -1334,13 +1334,11 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
5130 case NETDEV_UNREGISTER:
5131 rtmsg_ifinfo(RTM_DELLINK, dev, ~0U);
5132 break;
5133 - case NETDEV_REGISTER:
5134 - rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U);
5135 - break;
5136 case NETDEV_UP:
5137 case NETDEV_DOWN:
5138 rtmsg_ifinfo(RTM_NEWLINK, dev, IFF_UP|IFF_RUNNING);
5139 break;
5140 + case NETDEV_REGISTER:
5141 case NETDEV_CHANGE:
5142 case NETDEV_GOING_DOWN:
5143 break;
5144 diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
5145 index f989518..4d50daa 100644
5146 --- a/net/ipv4/ip_output.c
5147 +++ b/net/ipv4/ip_output.c
5148 @@ -501,8 +501,8 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
5149 if (skb->sk) {
5150 frag->sk = skb->sk;
5151 frag->destructor = sock_wfree;
5152 - truesizes += frag->truesize;
5153 }
5154 + truesizes += frag->truesize;
5155 }
5156
5157 /* Everything is OK. Generate! */
5158 diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
5159 index 7b5131b..cca675e 100644
5160 --- a/net/mac80211/cfg.c
5161 +++ b/net/mac80211/cfg.c
5162 @@ -338,7 +338,8 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
5163 sinfo->rx_packets = sta->rx_packets;
5164 sinfo->tx_packets = sta->tx_packets;
5165
5166 - if (sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
5167 + if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
5168 + (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
5169 sinfo->filled |= STATION_INFO_SIGNAL;
5170 sinfo->signal = (s8)sta->last_signal;
5171 }
5172 diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
5173 index 10d316e..5a46164 100644
5174 --- a/net/mac80211/ieee80211_i.h
5175 +++ b/net/mac80211/ieee80211_i.h
5176 @@ -808,6 +808,7 @@ struct ieee80211_local {
5177 unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
5178
5179 bool pspolling;
5180 + bool scan_ps_enabled;
5181 /*
5182 * PS can only be enabled when we have exactly one managed
5183 * interface (and monitors) in PS, this then points there.
5184 diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
5185 index dd1c193..010ff2f 100644
5186 --- a/net/mac80211/mesh.h
5187 +++ b/net/mac80211/mesh.h
5188 @@ -186,8 +186,9 @@ struct mesh_rmc {
5189 */
5190 #define MESH_PREQ_MIN_INT 10
5191 #define MESH_DIAM_TRAVERSAL_TIME 50
5192 -/* Paths will be refreshed if they are closer than PATH_REFRESH_TIME to their
5193 - * expiration
5194 +/* A path will be refreshed if it is used PATH_REFRESH_TIME milliseconds before
5195 + * timing out. This way it will remain ACTIVE and no data frames will be
5196 + * unnecesarily held in the pending queue.
5197 */
5198 #define MESH_PATH_REFRESH_TIME 1000
5199 #define MESH_MIN_DISCOVERY_TIMEOUT (2 * MESH_DIAM_TRAVERSAL_TIME)
5200 diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
5201 index 29b82e9..93c49fc 100644
5202 --- a/net/mac80211/mesh_hwmp.c
5203 +++ b/net/mac80211/mesh_hwmp.c
5204 @@ -813,7 +813,7 @@ int mesh_nexthop_lookup(struct sk_buff *skb,
5205 }
5206
5207 if (mpath->flags & MESH_PATH_ACTIVE) {
5208 - if (time_after(jiffies, mpath->exp_time +
5209 + if (time_after(jiffies, mpath->exp_time -
5210 msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time))
5211 && !memcmp(sdata->dev->dev_addr, hdr->addr4,
5212 ETH_ALEN)
5213 diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
5214 index 7170bf4..4e14754 100644
5215 --- a/net/mac80211/rx.c
5216 +++ b/net/mac80211/rx.c
5217 @@ -1514,7 +1514,6 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
5218 mpp_path_add(mesh_hdr->eaddr2, hdr->addr4, sdata);
5219 } else {
5220 spin_lock_bh(&mppath->state_lock);
5221 - mppath->exp_time = jiffies;
5222 if (compare_ether_addr(mppath->mpp, hdr->addr4) != 0)
5223 memcpy(mppath->mpp, hdr->addr4, ETH_ALEN);
5224 spin_unlock_bh(&mppath->state_lock);
5225 diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
5226 index 71e10ca..1a41909 100644
5227 --- a/net/mac80211/scan.c
5228 +++ b/net/mac80211/scan.c
5229 @@ -196,7 +196,8 @@ ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
5230 static void ieee80211_scan_ps_enable(struct ieee80211_sub_if_data *sdata)
5231 {
5232 struct ieee80211_local *local = sdata->local;
5233 - bool ps = false;
5234 +
5235 + local->scan_ps_enabled = false;
5236
5237 /* FIXME: what to do when local->pspolling is true? */
5238
5239 @@ -204,12 +205,13 @@ static void ieee80211_scan_ps_enable(struct ieee80211_sub_if_data *sdata)
5240 cancel_work_sync(&local->dynamic_ps_enable_work);
5241
5242 if (local->hw.conf.flags & IEEE80211_CONF_PS) {
5243 - ps = true;
5244 + local->scan_ps_enabled = true;
5245 local->hw.conf.flags &= ~IEEE80211_CONF_PS;
5246 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
5247 }
5248
5249 - if (!ps || !(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK))
5250 + if (!(local->scan_ps_enabled) ||
5251 + !(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK))
5252 /*
5253 * If power save was enabled, no need to send a nullfunc
5254 * frame because AP knows that we are sleeping. But if the
5255 @@ -230,7 +232,7 @@ static void ieee80211_scan_ps_disable(struct ieee80211_sub_if_data *sdata)
5256
5257 if (!local->ps_sdata)
5258 ieee80211_send_nullfunc(local, sdata, 0);
5259 - else {
5260 + else if (local->scan_ps_enabled) {
5261 /*
5262 * In !IEEE80211_HW_PS_NULLFUNC_STACK case the hardware
5263 * will send a nullfunc frame with the powersave bit set
5264 @@ -246,6 +248,16 @@ static void ieee80211_scan_ps_disable(struct ieee80211_sub_if_data *sdata)
5265 */
5266 local->hw.conf.flags |= IEEE80211_CONF_PS;
5267 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
5268 + } else if (local->hw.conf.dynamic_ps_timeout > 0) {
5269 + /*
5270 + * If IEEE80211_CONF_PS was not set and the dynamic_ps_timer
5271 + * had been running before leaving the operating channel,
5272 + * restart the timer now and send a nullfunc frame to inform
5273 + * the AP that we are awake.
5274 + */
5275 + ieee80211_send_nullfunc(local, sdata, 0);
5276 + mod_timer(&local->dynamic_ps_timer, jiffies +
5277 + msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout));
5278 }
5279 }
5280
5281 @@ -264,10 +276,14 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
5282
5283 mutex_lock(&local->scan_mtx);
5284
5285 - if (WARN_ON(!local->scanning)) {
5286 - mutex_unlock(&local->scan_mtx);
5287 - return;
5288 - }
5289 + /*
5290 + * It's ok to abort a not-yet-running scan (that
5291 + * we have one at all will be verified by checking
5292 + * local->scan_req next), but not to complete it
5293 + * successfully.
5294 + */
5295 + if (WARN_ON(!local->scanning && !aborted))
5296 + aborted = true;
5297
5298 if (WARN_ON(!local->scan_req)) {
5299 mutex_unlock(&local->scan_mtx);
5300 diff --git a/net/mac80211/util.c b/net/mac80211/util.c
5301 index e6c08da..cbc5d20 100644
5302 --- a/net/mac80211/util.c
5303 +++ b/net/mac80211/util.c
5304 @@ -579,7 +579,7 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
5305 if (elen > left)
5306 break;
5307
5308 - if (calc_crc && id < 64 && (filter & BIT(id)))
5309 + if (calc_crc && id < 64 && (filter & (1ULL << id)))
5310 crc = crc32_be(crc, pos - 2, elen + 2);
5311
5312 switch (id) {
5313 diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
5314 index 446e9bd..02b2610 100644
5315 --- a/net/netfilter/ipvs/ip_vs_ctl.c
5316 +++ b/net/netfilter/ipvs/ip_vs_ctl.c
5317 @@ -2714,6 +2714,8 @@ static int ip_vs_genl_parse_service(struct ip_vs_service_user_kern *usvc,
5318 if (!(nla_af && (nla_fwmark || (nla_port && nla_protocol && nla_addr))))
5319 return -EINVAL;
5320
5321 + memset(usvc, 0, sizeof(*usvc));
5322 +
5323 usvc->af = nla_get_u16(nla_af);
5324 #ifdef CONFIG_IP_VS_IPV6
5325 if (usvc->af != AF_INET && usvc->af != AF_INET6)
5326 @@ -2901,6 +2903,8 @@ static int ip_vs_genl_parse_dest(struct ip_vs_dest_user_kern *udest,
5327 if (!(nla_addr && nla_port))
5328 return -EINVAL;
5329
5330 + memset(udest, 0, sizeof(*udest));
5331 +
5332 nla_memcpy(&udest->addr, nla_addr, sizeof(udest->addr));
5333 udest->port = nla_get_u16(nla_port);
5334
5335 diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
5336 index fc6a43c..129d75e 100644
5337 --- a/net/sunrpc/auth_gss/auth_gss.c
5338 +++ b/net/sunrpc/auth_gss/auth_gss.c
5339 @@ -485,7 +485,7 @@ gss_refresh_upcall(struct rpc_task *task)
5340 dprintk("RPC: %5u gss_refresh_upcall for uid %u\n", task->tk_pid,
5341 cred->cr_uid);
5342 gss_msg = gss_setup_upcall(task->tk_client, gss_auth, cred);
5343 - if (IS_ERR(gss_msg) == -EAGAIN) {
5344 + if (PTR_ERR(gss_msg) == -EAGAIN) {
5345 /* XXX: warning on the first, under the assumption we
5346 * shouldn't normally hit this case on a refresh. */
5347 warn_gssd();
5348 diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c
5349 index 34c7d48..7f4d744 100644
5350 --- a/sound/core/hrtimer.c
5351 +++ b/sound/core/hrtimer.c
5352 @@ -37,14 +37,22 @@ static unsigned int resolution;
5353 struct snd_hrtimer {
5354 struct snd_timer *timer;
5355 struct hrtimer hrt;
5356 + atomic_t running;
5357 };
5358
5359 static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
5360 {
5361 struct snd_hrtimer *stime = container_of(hrt, struct snd_hrtimer, hrt);
5362 struct snd_timer *t = stime->timer;
5363 +
5364 + if (!atomic_read(&stime->running))
5365 + return HRTIMER_NORESTART;
5366 +
5367 hrtimer_forward_now(hrt, ns_to_ktime(t->sticks * resolution));
5368 snd_timer_interrupt(stime->timer, t->sticks);
5369 +
5370 + if (!atomic_read(&stime->running))
5371 + return HRTIMER_NORESTART;
5372 return HRTIMER_RESTART;
5373 }
5374
5375 @@ -58,6 +66,7 @@ static int snd_hrtimer_open(struct snd_timer *t)
5376 hrtimer_init(&stime->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
5377 stime->timer = t;
5378 stime->hrt.function = snd_hrtimer_callback;
5379 + atomic_set(&stime->running, 0);
5380 t->private_data = stime;
5381 return 0;
5382 }
5383 @@ -78,16 +87,18 @@ static int snd_hrtimer_start(struct snd_timer *t)
5384 {
5385 struct snd_hrtimer *stime = t->private_data;
5386
5387 + atomic_set(&stime->running, 0);
5388 + hrtimer_cancel(&stime->hrt);
5389 hrtimer_start(&stime->hrt, ns_to_ktime(t->sticks * resolution),
5390 HRTIMER_MODE_REL);
5391 + atomic_set(&stime->running, 1);
5392 return 0;
5393 }
5394
5395 static int snd_hrtimer_stop(struct snd_timer *t)
5396 {
5397 struct snd_hrtimer *stime = t->private_data;
5398 -
5399 - hrtimer_cancel(&stime->hrt);
5400 + atomic_set(&stime->running, 0);
5401 return 0;
5402 }
5403
5404 diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
5405 index 6517f58..7e4ee4e 100644
5406 --- a/sound/pci/hda/hda_intel.c
5407 +++ b/sound/pci/hda/hda_intel.c
5408 @@ -2436,6 +2436,11 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
5409 }
5410 }
5411
5412 + /* disable 64bit DMA address for Teradici */
5413 + /* it does not work with device 6549:1200 subsys e4a2:040b */
5414 + if (chip->driver_type == AZX_DRIVER_TERA)
5415 + gcap &= ~ICH6_GCAP_64OK;
5416 +
5417 /* allow 64bit DMA address if supported by H/W */
5418 if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64)))
5419 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64));
5420 diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
5421 index 001663f..03e5b21 100644
5422 --- a/virt/kvm/irq_comm.c
5423 +++ b/virt/kvm/irq_comm.c
5424 @@ -205,10 +205,9 @@ int kvm_request_irq_source_id(struct kvm *kvm)
5425 int irq_source_id;
5426
5427 mutex_lock(&kvm->irq_lock);
5428 - irq_source_id = find_first_zero_bit(bitmap,
5429 - sizeof(kvm->arch.irq_sources_bitmap));
5430 + irq_source_id = find_first_zero_bit(bitmap, BITS_PER_LONG);
5431
5432 - if (irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) {
5433 + if (irq_source_id >= BITS_PER_LONG) {
5434 printk(KERN_WARNING "kvm: exhaust allocatable IRQ sources!\n");
5435 return -EFAULT;
5436 }
5437 @@ -228,7 +227,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id)
5438
5439 mutex_lock(&kvm->irq_lock);
5440 if (irq_source_id < 0 ||
5441 - irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) {
5442 + irq_source_id >= BITS_PER_LONG) {
5443 printk(KERN_ERR "kvm: IRQ source ID out of range!\n");
5444 return;
5445 }

  ViewVC Help
Powered by ViewVC 1.1.20