Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86: always define DECLARE_PCI_UNMAP* macros
x86: fixup config space size of CPU functions for AMD family 11h
x86, bts: fix wrmsr and spinlock over kmalloc
x86, pebs: fix PEBS record size configuration
x86, bts: turn macro into static inline function
x86, bts: exclude ds.c from build when disabled
arch/x86/kernel/pci-calgary_64.c: change simple_strtol to simple_strtoul
x86: use limited register constraint for setnz
xen: pin correct PGD on suspend
x86: revert irq number limitation
x86: fixing __cpuinit/__init tangle, xsave_cntxt_init()
x86: fix __cpuinit/__init tangle in init_thread_xstate()
oprofile: fix an overflow in ppro code

+90 -104
+1 -1
arch/x86/boot/tty.c
··· 74 74 { 75 75 u8 pending; 76 76 asm volatile("int $0x16; setnz %0" 77 - : "=rm" (pending) 77 + : "=qm" (pending) 78 78 : "a" (0x0100)); 79 79 return pending; 80 80 }
+4 -2
arch/x86/include/asm/ds.h
··· 23 23 #ifndef _ASM_X86_DS_H 24 24 #define _ASM_X86_DS_H 25 25 26 - #ifdef CONFIG_X86_DS 27 26 28 27 #include <linux/types.h> 29 28 #include <linux/init.h> 30 29 30 + 31 + #ifdef CONFIG_X86_DS 31 32 32 33 struct task_struct; 33 34 ··· 233 232 234 233 #else /* CONFIG_X86_DS */ 235 234 236 - #define ds_init_intel(config) do {} while (0) 235 + struct cpuinfo_x86; 236 + static inline void __cpuinit ds_init_intel(struct cpuinfo_x86 *ignored) {} 237 237 238 238 #endif /* CONFIG_X86_DS */ 239 239 #endif /* _ASM_X86_DS_H */
-14
arch/x86/include/asm/pci_64.h
··· 34 34 */ 35 35 #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) 36 36 37 - #if defined(CONFIG_GART_IOMMU) || defined(CONFIG_CALGARY_IOMMU) 38 - 39 37 #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ 40 38 dma_addr_t ADDR_NAME; 41 39 #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \ ··· 46 48 ((PTR)->LEN_NAME) 47 49 #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ 48 50 (((PTR)->LEN_NAME) = (VAL)) 49 - 50 - #else 51 - /* No IOMMU */ 52 - 53 - #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) 54 - #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) 55 - #define pci_unmap_addr(PTR, ADDR_NAME) (0) 56 - #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) 57 - #define pci_unmap_len(PTR, LEN_NAME) (0) 58 - #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 59 - 60 - #endif 61 51 62 52 #endif /* __KERNEL__ */ 63 53
+1 -1
arch/x86/kernel/Makefile
··· 41 41 obj-y += process.o 42 42 obj-y += i387.o xsave.o 43 43 obj-y += ptrace.o 44 - obj-y += ds.o 44 + obj-$(CONFIG_X86_DS) += ds.o 45 45 obj-$(CONFIG_X86_32) += tls.o 46 46 obj-$(CONFIG_IA32_EMULATION) += tls.o 47 47 obj-y += step.o
+51 -43
arch/x86/kernel/ds.c
··· 21 21 */ 22 22 23 23 24 - #ifdef CONFIG_X86_DS 25 - 26 24 #include <asm/ds.h> 27 25 28 26 #include <linux/errno.h> ··· 209 211 static inline struct ds_context *ds_get_context(struct task_struct *task) 210 212 { 211 213 struct ds_context *context; 214 + unsigned long irq; 212 215 213 - spin_lock(&ds_lock); 216 + spin_lock_irqsave(&ds_lock, irq); 214 217 215 218 context = (task ? task->thread.ds_ctx : this_system_context); 216 219 if (context) 217 220 context->count++; 218 221 219 - spin_unlock(&ds_lock); 222 + spin_unlock_irqrestore(&ds_lock, irq); 220 223 221 224 return context; 222 225 } ··· 225 226 /* 226 227 * Same as ds_get_context, but allocates the context and it's DS 227 228 * structure, if necessary; returns NULL; if out of memory. 228 - * 229 - * pre: requires ds_lock to be held 230 229 */ 231 230 static inline struct ds_context *ds_alloc_context(struct task_struct *task) 232 231 { 233 232 struct ds_context **p_context = 234 233 (task ? &task->thread.ds_ctx : &this_system_context); 235 234 struct ds_context *context = *p_context; 235 + unsigned long irq; 236 236 237 237 if (!context) { 238 - spin_unlock(&ds_lock); 239 - 240 238 context = kzalloc(sizeof(*context), GFP_KERNEL); 241 - 242 - if (!context) { 243 - spin_lock(&ds_lock); 239 + if (!context) 244 240 return NULL; 245 - } 246 241 247 242 context->ds = kzalloc(ds_cfg.sizeof_ds, GFP_KERNEL); 248 243 if (!context->ds) { 249 244 kfree(context); 250 - spin_lock(&ds_lock); 251 245 return NULL; 252 246 } 253 247 254 - spin_lock(&ds_lock); 255 - /* 256 - * Check for race - another CPU could have allocated 257 - * it meanwhile: 258 - */ 248 + spin_lock_irqsave(&ds_lock, irq); 249 + 259 250 if (*p_context) { 260 251 kfree(context->ds); 261 252 kfree(context); 262 - return *p_context; 253 + 254 + context = *p_context; 255 + } else { 256 + *p_context = context; 257 + 258 + context->this = p_context; 259 + context->task = task; 260 + 261 + if (task) 262 + set_tsk_thread_flag(task, TIF_DS_AREA_MSR); 263 + 264 + if (!task || (task == current)) 265 + wrmsrl(MSR_IA32_DS_AREA, 266 + (unsigned long)context->ds); 263 267 } 264 - 265 - *p_context = context; 266 - 267 - context->this = p_context; 268 - context->task = task; 269 - 270 - if (task) 271 - set_tsk_thread_flag(task, TIF_DS_AREA_MSR); 272 - 273 - if (!task || (task == current)) 274 - wrmsr(MSR_IA32_DS_AREA, (unsigned long)context->ds, 0); 275 - 276 - get_tracer(task); 268 + spin_unlock_irqrestore(&ds_lock, irq); 277 269 } 278 270 279 271 context->count++; ··· 278 288 */ 279 289 static inline void ds_put_context(struct ds_context *context) 280 290 { 291 + unsigned long irq; 292 + 281 293 if (!context) 282 294 return; 283 295 284 - spin_lock(&ds_lock); 296 + spin_lock_irqsave(&ds_lock, irq); 285 297 286 298 if (--context->count) 287 299 goto out; ··· 305 313 kfree(context->ds); 306 314 kfree(context); 307 315 out: 308 - spin_unlock(&ds_lock); 316 + spin_unlock_irqrestore(&ds_lock, irq); 309 317 } 310 318 311 319 ··· 376 384 struct ds_context *context; 377 385 unsigned long buffer, adj; 378 386 const unsigned long alignment = (1 << 3); 387 + unsigned long irq; 379 388 int error = 0; 380 389 381 390 if (!ds_cfg.sizeof_ds) ··· 391 398 return -EOPNOTSUPP; 392 399 393 400 394 - spin_lock(&ds_lock); 395 - 396 - error = -ENOMEM; 397 401 context = ds_alloc_context(task); 398 402 if (!context) 399 - goto out_unlock; 403 + return -ENOMEM; 404 + 405 + spin_lock_irqsave(&ds_lock, irq); 400 406 401 407 error = -EPERM; 402 408 if (!check_tracer(task)) 403 409 goto out_unlock; 404 410 411 + get_tracer(task); 412 + 405 413 error = -EALREADY; 406 414 if (context->owner[qual] == current) 407 - goto out_unlock; 415 + goto out_put_tracer; 408 416 error = -EPERM; 409 417 if (context->owner[qual] != NULL) 410 - goto out_unlock; 418 + goto out_put_tracer; 411 419 context->owner[qual] = current; 412 420 413 - spin_unlock(&ds_lock); 421 + spin_unlock_irqrestore(&ds_lock, irq); 414 422 415 423 416 424 error = -ENOMEM; ··· 459 465 out_release: 460 466 context->owner[qual] = NULL; 461 467 ds_put_context(context); 468 + put_tracer(task); 469 + return error; 470 + 471 + out_put_tracer: 472 + spin_unlock_irqrestore(&ds_lock, irq); 473 + ds_put_context(context); 474 + put_tracer(task); 462 475 return error; 463 476 464 477 out_unlock: 465 - spin_unlock(&ds_lock); 478 + spin_unlock_irqrestore(&ds_lock, irq); 466 479 ds_put_context(context); 467 480 return error; 468 481 } ··· 819 818 .sizeof_ds = sizeof(long) * 12, 820 819 .sizeof_field = sizeof(long), 821 820 .sizeof_rec[ds_bts] = sizeof(long) * 3, 821 + #ifdef __i386__ 822 822 .sizeof_rec[ds_pebs] = sizeof(long) * 10 823 + #else 824 + .sizeof_rec[ds_pebs] = sizeof(long) * 18 825 + #endif 823 826 }; 824 827 static const struct ds_configuration ds_cfg_64 = { 825 828 .sizeof_ds = 8 * 12, 826 829 .sizeof_field = 8, 827 830 .sizeof_rec[ds_bts] = 8 * 3, 831 + #ifdef __i386__ 828 832 .sizeof_rec[ds_pebs] = 8 * 10 833 + #else 834 + .sizeof_rec[ds_pebs] = 8 * 18 835 + #endif 829 836 }; 830 837 831 838 static inline void ··· 887 878 while (leftovers--) 888 879 ds_put_context(context); 889 880 } 890 - #endif /* CONFIG_X86_DS */
+1 -1
arch/x86/kernel/i387.c
··· 58 58 stts(); 59 59 } 60 60 61 - void __init init_thread_xstate(void) 61 + void __cpuinit init_thread_xstate(void) 62 62 { 63 63 if (!HAVE_HWFP) { 64 64 xstate_size = sizeof(struct i387_soft_struct);
+1 -21
arch/x86/kernel/io_apic.c
··· 3608 3608 3609 3609 int __init probe_nr_irqs(void) 3610 3610 { 3611 - int idx; 3612 - int nr = 0; 3613 - #ifndef CONFIG_XEN 3614 - int nr_min = 32; 3615 - #else 3616 - int nr_min = NR_IRQS; 3617 - #endif 3618 - 3619 - for (idx = 0; idx < nr_ioapics; idx++) 3620 - nr += io_apic_get_redir_entries(idx) + 1; 3621 - 3622 - /* double it for hotplug and msi and nmi */ 3623 - nr <<= 1; 3624 - 3625 - /* something wrong ? */ 3626 - if (nr < nr_min) 3627 - nr = nr_min; 3628 - if (WARN_ON(nr > NR_IRQS)) 3629 - nr = NR_IRQS; 3630 - 3631 - return nr; 3611 + return NR_IRQS; 3632 3612 } 3633 3613 3634 3614 /* --------------------------------------------------------------------------
+1 -1
arch/x86/kernel/pci-calgary_64.c
··· 1567 1567 ++p; 1568 1568 if (*p == '\0') 1569 1569 break; 1570 - bridge = simple_strtol(p, &endp, 0); 1570 + bridge = simple_strtoul(p, &endp, 0); 1571 1571 if (p == endp) 1572 1572 break; 1573 1573
+1 -1
arch/x86/kernel/xsave.c
··· 310 310 /* 311 311 * Enable and initialize the xsave feature. 312 312 */ 313 - void __init xsave_cntxt_init(void) 313 + void __ref xsave_cntxt_init(void) 314 314 { 315 315 unsigned int eax, ebx, ecx, edx; 316 316
+1 -1
arch/x86/oprofile/op_model_ppro.c
··· 69 69 int i; 70 70 71 71 if (!reset_value) { 72 - reset_value = kmalloc(sizeof(unsigned) * num_counters, 72 + reset_value = kmalloc(sizeof(reset_value[0]) * num_counters, 73 73 GFP_ATOMIC); 74 74 if (!reset_value) 75 75 return;
+14 -11
arch/x86/pci/fixup.c
··· 496 496 pci_siemens_interrupt_controller); 497 497 498 498 /* 499 - * Regular PCI devices have 256 bytes, but AMD Family 10h Opteron ext config 500 - * have 4096 bytes. Even if the device is capable, that doesn't mean we can 501 - * access it. Maybe we don't have a way to generate extended config space 502 - * accesses. So check it 499 + * Regular PCI devices have 256 bytes, but AMD Family 10h/11h CPUs have 500 + * 4096 bytes configuration space for each function of their processor 501 + * configuration space. 503 502 */ 504 - static void fam10h_pci_cfg_space_size(struct pci_dev *dev) 503 + static void amd_cpu_pci_cfg_space_size(struct pci_dev *dev) 505 504 { 506 505 dev->cfg_size = pci_cfg_space_size_ext(dev); 507 506 } 508 - 509 - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1200, fam10h_pci_cfg_space_size); 510 - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1201, fam10h_pci_cfg_space_size); 511 - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1202, fam10h_pci_cfg_space_size); 512 - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1203, fam10h_pci_cfg_space_size); 513 - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1204, fam10h_pci_cfg_space_size); 507 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1200, amd_cpu_pci_cfg_space_size); 508 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1201, amd_cpu_pci_cfg_space_size); 509 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1202, amd_cpu_pci_cfg_space_size); 510 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1203, amd_cpu_pci_cfg_space_size); 511 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1204, amd_cpu_pci_cfg_space_size); 512 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1300, amd_cpu_pci_cfg_space_size); 513 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1301, amd_cpu_pci_cfg_space_size); 514 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1302, amd_cpu_pci_cfg_space_size); 515 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1303, amd_cpu_pci_cfg_space_size); 516 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1304, amd_cpu_pci_cfg_space_size); 514 517 515 518 /* 516 519 * SB600: Disable BAR1 on device 14.0 to avoid HPET resources from
+14 -7
arch/x86/xen/mmu.c
··· 661 661 * For 64-bit, we must skip the Xen hole in the middle of the address 662 662 * space, just after the big x86-64 virtual hole. 663 663 */ 664 - static int xen_pgd_walk(struct mm_struct *mm, 665 - int (*func)(struct mm_struct *mm, struct page *, 666 - enum pt_level), 667 - unsigned long limit) 664 + static int __xen_pgd_walk(struct mm_struct *mm, pgd_t *pgd, 665 + int (*func)(struct mm_struct *mm, struct page *, 666 + enum pt_level), 667 + unsigned long limit) 668 668 { 669 - pgd_t *pgd = mm->pgd; 670 669 int flush = 0; 671 670 unsigned hole_low, hole_high; 672 671 unsigned pgdidx_limit, pudidx_limit, pmdidx_limit; ··· 750 751 flush |= (*func)(mm, virt_to_page(pgd), PT_PGD); 751 752 752 753 return flush; 754 + } 755 + 756 + static int xen_pgd_walk(struct mm_struct *mm, 757 + int (*func)(struct mm_struct *mm, struct page *, 758 + enum pt_level), 759 + unsigned long limit) 760 + { 761 + return __xen_pgd_walk(mm, mm->pgd, func, limit); 753 762 } 754 763 755 764 /* If we're using split pte locks, then take the page's lock and ··· 861 854 862 855 xen_mc_batch(); 863 856 864 - if (xen_pgd_walk(mm, xen_pin_page, USER_LIMIT)) { 857 + if (__xen_pgd_walk(mm, pgd, xen_pin_page, USER_LIMIT)) { 865 858 /* re-enable interrupts for flushing */ 866 859 xen_mc_issue(0); 867 860 ··· 1005 998 PT_PMD); 1006 999 #endif 1007 1000 1008 - xen_pgd_walk(mm, xen_unpin_page, USER_LIMIT); 1001 + __xen_pgd_walk(mm, pgd, xen_unpin_page, USER_LIMIT); 1009 1002 1010 1003 xen_mc_issue(0); 1011 1004 }