aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-02-27 19:43:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-02-27 19:43:05 -0500
commit535d8e8f19376518e52e64f511440e502acda150 (patch)
tree06c1ab74b5e7b319a2474cae73cb1a6e77d281e0
parent6febf65b2965858507e4d55afad20b24b2ad9a91 (diff)
parentf6be37fdc62d0c0214bc49815d1180ebfbd716e2 (diff)
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: enable DMAR by default xen: disable interrupts early, as start_kernel expects gpu/drm, x86, PAT: io_mapping_create_wc and resource_size_t gpu/drm, x86, PAT: Handle io_mapping_create_wc() errors in a clean way x86, Voyager: fix compile by lifting the degeneracy of phys_cpu_present_map x86, doc: fix references to Documentation/x86/i386/boot.txt
-rw-r--r--Documentation/kernel-parameters.txt4
-rw-r--r--arch/x86/Kconfig2
-rw-r--r--arch/x86/include/asm/iomap.h3
-rw-r--r--arch/x86/mach-voyager/voyager_smp.c24
-rw-r--r--arch/x86/mm/iomap_32.c18
-rw-r--r--arch/x86/xen/enlighten.c3
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c9
-rw-r--r--include/linux/io-mapping.h46
8 files changed, 82 insertions, 27 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 0ed3234125e3..54f21a5c262b 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -114,7 +114,7 @@ In addition, the following text indicates that the option:
114Parameters denoted with BOOT are actually interpreted by the boot 114Parameters denoted with BOOT are actually interpreted by the boot
115loader, and have no meaning to the kernel directly. 115loader, and have no meaning to the kernel directly.
116Do not modify the syntax of boot loader parameters without extreme 116Do not modify the syntax of boot loader parameters without extreme
117need or coordination with <Documentation/x86/i386/boot.txt>. 117need or coordination with <Documentation/x86/boot.txt>.
118 118
119There are also arch-specific kernel-parameters not documented here. 119There are also arch-specific kernel-parameters not documented here.
120See for example <Documentation/x86/x86_64/boot-options.txt>. 120See for example <Documentation/x86/x86_64/boot-options.txt>.
@@ -2451,7 +2451,7 @@ and is between 256 and 4096 characters. It is defined in the file
2451 See Documentation/fb/modedb.txt. 2451 See Documentation/fb/modedb.txt.
2452 2452
2453 vga= [BOOT,X86-32] Select a particular video mode 2453 vga= [BOOT,X86-32] Select a particular video mode
2454 See Documentation/x86/i386/boot.txt and 2454 See Documentation/x86/boot.txt and
2455 Documentation/svga.txt. 2455 Documentation/svga.txt.
2456 Use vga=ask for menu. 2456 Use vga=ask for menu.
2457 This is actually a boot loader parameter; the value is 2457 This is actually a boot loader parameter; the value is
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 9c39095b33fc..bc2fbadff9f9 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1803,7 +1803,7 @@ config DMAR
1803 remapping devices. 1803 remapping devices.
1804 1804
1805config DMAR_DEFAULT_ON 1805config DMAR_DEFAULT_ON
1806 def_bool n 1806 def_bool y
1807 prompt "Enable DMA Remapping Devices by default" 1807 prompt "Enable DMA Remapping Devices by default"
1808 depends on DMAR 1808 depends on DMAR
1809 help 1809 help
diff --git a/arch/x86/include/asm/iomap.h b/arch/x86/include/asm/iomap.h
index c1f06289b14b..86af26091d6c 100644
--- a/arch/x86/include/asm/iomap.h
+++ b/arch/x86/include/asm/iomap.h
@@ -23,6 +23,9 @@
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/tlbflush.h> 24#include <asm/tlbflush.h>
25 25
26int
27is_io_mapping_possible(resource_size_t base, unsigned long size);
28
26void * 29void *
27iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot); 30iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot);
28 31
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index 7ffcdeec4631..b9cc84a2a4fc 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -65,7 +65,7 @@ static volatile unsigned long smp_invalidate_needed;
65 65
66/* Bitmask of CPUs present in the system - exported by i386_syms.c, used 66/* Bitmask of CPUs present in the system - exported by i386_syms.c, used
67 * by scheduler but indexed physically */ 67 * by scheduler but indexed physically */
68cpumask_t phys_cpu_present_map = CPU_MASK_NONE; 68static cpumask_t voyager_phys_cpu_present_map = CPU_MASK_NONE;
69 69
70/* The internal functions */ 70/* The internal functions */
71static void send_CPI(__u32 cpuset, __u8 cpi); 71static void send_CPI(__u32 cpuset, __u8 cpi);
@@ -366,19 +366,19 @@ void __init find_smp_config(void)
366 /* set up everything for just this CPU, we can alter 366 /* set up everything for just this CPU, we can alter
367 * this as we start the other CPUs later */ 367 * this as we start the other CPUs later */
368 /* now get the CPU disposition from the extended CMOS */ 368 /* now get the CPU disposition from the extended CMOS */
369 cpus_addr(phys_cpu_present_map)[0] = 369 cpus_addr(voyager_phys_cpu_present_map)[0] =
370 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK); 370 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK);
371 cpus_addr(phys_cpu_present_map)[0] |= 371 cpus_addr(voyager_phys_cpu_present_map)[0] |=
372 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8; 372 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8;
373 cpus_addr(phys_cpu_present_map)[0] |= 373 cpus_addr(voyager_phys_cpu_present_map)[0] |=
374 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 374 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK +
375 2) << 16; 375 2) << 16;
376 cpus_addr(phys_cpu_present_map)[0] |= 376 cpus_addr(voyager_phys_cpu_present_map)[0] |=
377 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 377 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK +
378 3) << 24; 378 3) << 24;
379 init_cpu_possible(&phys_cpu_present_map); 379 init_cpu_possible(&voyager_phys_cpu_present_map);
380 printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n", 380 printk("VOYAGER SMP: voyager_phys_cpu_present_map = 0x%lx\n",
381 cpus_addr(phys_cpu_present_map)[0]); 381 cpus_addr(voyager_phys_cpu_present_map)[0]);
382 /* Here we set up the VIC to enable SMP */ 382 /* Here we set up the VIC to enable SMP */
383 /* enable the CPIs by writing the base vector to their register */ 383 /* enable the CPIs by writing the base vector to their register */
384 outb(VIC_DEFAULT_CPI_BASE, VIC_CPI_BASE_REGISTER); 384 outb(VIC_DEFAULT_CPI_BASE, VIC_CPI_BASE_REGISTER);
@@ -628,15 +628,15 @@ void __init smp_boot_cpus(void)
628 /* now that the cat has probed the Voyager System Bus, sanity 628 /* now that the cat has probed the Voyager System Bus, sanity
629 * check the cpu map */ 629 * check the cpu map */
630 if (((voyager_quad_processors | voyager_extended_vic_processors) 630 if (((voyager_quad_processors | voyager_extended_vic_processors)
631 & cpus_addr(phys_cpu_present_map)[0]) != 631 & cpus_addr(voyager_phys_cpu_present_map)[0]) !=
632 cpus_addr(phys_cpu_present_map)[0]) { 632 cpus_addr(voyager_phys_cpu_present_map)[0]) {
633 /* should panic */ 633 /* should panic */
634 printk("\n\n***WARNING*** " 634 printk("\n\n***WARNING*** "
635 "Sanity check of CPU present map FAILED\n"); 635 "Sanity check of CPU present map FAILED\n");
636 } 636 }
637 } else if (voyager_level == 4) 637 } else if (voyager_level == 4)
638 voyager_extended_vic_processors = 638 voyager_extended_vic_processors =
639 cpus_addr(phys_cpu_present_map)[0]; 639 cpus_addr(voyager_phys_cpu_present_map)[0];
640 640
641 /* this sets up the idle task to run on the current cpu */ 641 /* this sets up the idle task to run on the current cpu */
642 voyager_extended_cpus = 1; 642 voyager_extended_cpus = 1;
@@ -670,7 +670,7 @@ void __init smp_boot_cpus(void)
670 /* loop over all the extended VIC CPUs and boot them. The 670 /* loop over all the extended VIC CPUs and boot them. The
671 * Quad CPUs must be bootstrapped by their extended VIC cpu */ 671 * Quad CPUs must be bootstrapped by their extended VIC cpu */
672 for (i = 0; i < nr_cpu_ids; i++) { 672 for (i = 0; i < nr_cpu_ids; i++) {
673 if (i == boot_cpu_id || !cpu_isset(i, phys_cpu_present_map)) 673 if (i == boot_cpu_id || !cpu_isset(i, voyager_phys_cpu_present_map))
674 continue; 674 continue;
675 do_boot_cpu(i); 675 do_boot_cpu(i);
676 /* This udelay seems to be needed for the Quad boots 676 /* This udelay seems to be needed for the Quad boots
diff --git a/arch/x86/mm/iomap_32.c b/arch/x86/mm/iomap_32.c
index ca53224fc56c..6c2b1af16926 100644
--- a/arch/x86/mm/iomap_32.c
+++ b/arch/x86/mm/iomap_32.c
@@ -20,6 +20,24 @@
20#include <asm/pat.h> 20#include <asm/pat.h>
21#include <linux/module.h> 21#include <linux/module.h>
22 22
23#ifdef CONFIG_X86_PAE
24int
25is_io_mapping_possible(resource_size_t base, unsigned long size)
26{
27 return 1;
28}
29#else
30int
31is_io_mapping_possible(resource_size_t base, unsigned long size)
32{
33 /* There is no way to map greater than 1 << 32 address without PAE */
34 if (base + size > 0x100000000ULL)
35 return 0;
36
37 return 1;
38}
39#endif
40
23/* Map 'pfn' using fixed map 'type' and protections 'prot' 41/* Map 'pfn' using fixed map 'type' and protections 'prot'
24 */ 42 */
25void * 43void *
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index bea215230b20..b58e96338149 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1672,6 +1672,9 @@ asmlinkage void __init xen_start_kernel(void)
1672 possible map and a non-dummy shared_info. */ 1672 possible map and a non-dummy shared_info. */
1673 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; 1673 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
1674 1674
1675 local_irq_disable();
1676 early_boot_irqs_off();
1677
1675 xen_raw_console_write("mapping kernel into physical memory\n"); 1678 xen_raw_console_write("mapping kernel into physical memory\n");
1676 pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages); 1679 pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages);
1677 1680
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index cc4649577a61..6dab63bdc4c1 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1090,6 +1090,11 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1090 dev_priv->mm.gtt_mapping = 1090 dev_priv->mm.gtt_mapping =
1091 io_mapping_create_wc(dev->agp->base, 1091 io_mapping_create_wc(dev->agp->base,
1092 dev->agp->agp_info.aper_size * 1024*1024); 1092 dev->agp->agp_info.aper_size * 1024*1024);
1093 if (dev_priv->mm.gtt_mapping == NULL) {
1094 ret = -EIO;
1095 goto out_rmmap;
1096 }
1097
1093 /* Set up a WC MTRR for non-PAT systems. This is more common than 1098 /* Set up a WC MTRR for non-PAT systems. This is more common than
1094 * one would think, because the kernel disables PAT on first 1099 * one would think, because the kernel disables PAT on first
1095 * generation Core chips because WC PAT gets overridden by a UC 1100 * generation Core chips because WC PAT gets overridden by a UC
@@ -1122,7 +1127,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1122 if (!I915_NEED_GFX_HWS(dev)) { 1127 if (!I915_NEED_GFX_HWS(dev)) {
1123 ret = i915_init_phys_hws(dev); 1128 ret = i915_init_phys_hws(dev);
1124 if (ret != 0) 1129 if (ret != 0)
1125 goto out_rmmap; 1130 goto out_iomapfree;
1126 } 1131 }
1127 1132
1128 /* On the 945G/GM, the chipset reports the MSI capability on the 1133 /* On the 945G/GM, the chipset reports the MSI capability on the
@@ -1161,6 +1166,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1161 1166
1162 return 0; 1167 return 0;
1163 1168
1169out_iomapfree:
1170 io_mapping_free(dev_priv->mm.gtt_mapping);
1164out_rmmap: 1171out_rmmap:
1165 iounmap(dev_priv->regs); 1172 iounmap(dev_priv->regs);
1166free_priv: 1173free_priv:
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index 82df31726a54..cbc2f0cd631b 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -30,11 +30,14 @@
30 * See Documentation/io_mapping.txt 30 * See Documentation/io_mapping.txt
31 */ 31 */
32 32
33/* this struct isn't actually defined anywhere */
34struct io_mapping;
35
36#ifdef CONFIG_HAVE_ATOMIC_IOMAP 33#ifdef CONFIG_HAVE_ATOMIC_IOMAP
37 34
35struct io_mapping {
36 resource_size_t base;
37 unsigned long size;
38 pgprot_t prot;
39};
40
38/* 41/*
39 * For small address space machines, mapping large objects 42 * For small address space machines, mapping large objects
40 * into the kernel virtual space isn't practical. Where 43 * into the kernel virtual space isn't practical. Where
@@ -43,23 +46,40 @@ struct io_mapping;
43 */ 46 */
44 47
45static inline struct io_mapping * 48static inline struct io_mapping *
46io_mapping_create_wc(unsigned long base, unsigned long size) 49io_mapping_create_wc(resource_size_t base, unsigned long size)
47{ 50{
48 return (struct io_mapping *) base; 51 struct io_mapping *iomap;
52
53 if (!is_io_mapping_possible(base, size))
54 return NULL;
55
56 iomap = kmalloc(sizeof(*iomap), GFP_KERNEL);
57 if (!iomap)
58 return NULL;
59
60 iomap->base = base;
61 iomap->size = size;
62 iomap->prot = pgprot_writecombine(__pgprot(__PAGE_KERNEL));
63 return iomap;
49} 64}
50 65
51static inline void 66static inline void
52io_mapping_free(struct io_mapping *mapping) 67io_mapping_free(struct io_mapping *mapping)
53{ 68{
69 kfree(mapping);
54} 70}
55 71
56/* Atomic map/unmap */ 72/* Atomic map/unmap */
57static inline void * 73static inline void *
58io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) 74io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset)
59{ 75{
60 offset += (unsigned long) mapping; 76 resource_size_t phys_addr;
61 return iomap_atomic_prot_pfn(offset >> PAGE_SHIFT, KM_USER0, 77 unsigned long pfn;
62 __pgprot(__PAGE_KERNEL_WC)); 78
79 BUG_ON(offset >= mapping->size);
80 phys_addr = mapping->base + offset;
81 pfn = (unsigned long) (phys_addr >> PAGE_SHIFT);
82 return iomap_atomic_prot_pfn(pfn, KM_USER0, mapping->prot);
63} 83}
64 84
65static inline void 85static inline void
@@ -71,8 +91,9 @@ io_mapping_unmap_atomic(void *vaddr)
71static inline void * 91static inline void *
72io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) 92io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset)
73{ 93{
74 offset += (unsigned long) mapping; 94 BUG_ON(offset >= mapping->size);
75 return ioremap_wc(offset, PAGE_SIZE); 95 resource_size_t phys_addr = mapping->base + offset;
96 return ioremap_wc(phys_addr, PAGE_SIZE);
76} 97}
77 98
78static inline void 99static inline void
@@ -83,9 +104,12 @@ io_mapping_unmap(void *vaddr)
83 104
84#else 105#else
85 106
107/* this struct isn't actually defined anywhere */
108struct io_mapping;
109
86/* Create the io_mapping object*/ 110/* Create the io_mapping object*/
87static inline struct io_mapping * 111static inline struct io_mapping *
88io_mapping_create_wc(unsigned long base, unsigned long size) 112io_mapping_create_wc(resource_size_t base, unsigned long size)
89{ 113{
90 return (struct io_mapping *) ioremap_wc(base, size); 114 return (struct io_mapping *) ioremap_wc(base, size);
91} 115}