aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/kernel')
-rw-r--r--arch/x86_64/kernel/Makefile2
-rw-r--r--arch/x86_64/kernel/aperture.c2
-rw-r--r--arch/x86_64/kernel/apic.c9
-rw-r--r--arch/x86_64/kernel/io_apic.c48
-rw-r--r--arch/x86_64/kernel/pci-gart.c22
-rw-r--r--arch/x86_64/kernel/setup.c6
-rw-r--r--arch/x86_64/kernel/smpboot.c4
-rw-r--r--arch/x86_64/kernel/time.c22
8 files changed, 63 insertions, 52 deletions
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
index 72fe60c20d39..a098a11e7755 100644
--- a/arch/x86_64/kernel/Makefile
+++ b/arch/x86_64/kernel/Makefile
@@ -43,7 +43,7 @@ CFLAGS_vsyscall.o := $(PROFILING) -g0
43 43
44bootflag-y += ../../i386/kernel/bootflag.o 44bootflag-y += ../../i386/kernel/bootflag.o
45cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o 45cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o
46topology-y += ../../i386/mach-default/topology.o 46topology-y += ../../i386/kernel/topology.o
47microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o 47microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o
48intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o 48intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o
49quirks-y += ../../i386/kernel/quirks.o 49quirks-y += ../../i386/kernel/quirks.o
diff --git a/arch/x86_64/kernel/aperture.c b/arch/x86_64/kernel/aperture.c
index e4e2b7d01f89..a0f955b9995f 100644
--- a/arch/x86_64/kernel/aperture.c
+++ b/arch/x86_64/kernel/aperture.c
@@ -248,7 +248,7 @@ void __init iommu_hole_init(void)
248 /* Got the aperture from the AGP bridge */ 248 /* Got the aperture from the AGP bridge */
249 } else if (swiotlb && !valid_agp) { 249 } else if (swiotlb && !valid_agp) {
250 /* Do nothing */ 250 /* Do nothing */
251 } else if ((!no_iommu && end_pfn >= MAX_DMA32_PFN) || 251 } else if ((!no_iommu && end_pfn > MAX_DMA32_PFN) ||
252 force_iommu || 252 force_iommu ||
253 valid_agp || 253 valid_agp ||
254 fallback_aper_force) { 254 fallback_aper_force) {
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index e5b14c57eaa0..d70605eda333 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -962,12 +962,14 @@ void smp_apic_timer_interrupt(struct pt_regs *regs)
962 irq_exit(); 962 irq_exit();
963} 963}
964 964
965int __initdata unsync_tsc_on_multicluster;
966
965/* 967/*
966 * oem_force_hpet_timer -- force HPET mode for some boxes. 968 * oem_force_hpet_timer -- force HPET mode for some boxes.
967 * 969 *
968 * Thus far, the major user of this is IBM's Summit2 series: 970 * Thus far, the major user of this is IBM's Summit2 series:
969 * 971 *
970 * Clustered boxes may have unsynced TSC problems if they are 972 * Some clustered boxes may have unsynced TSC problems if they are
971 * multi-chassis. Use available data to take a good guess. 973 * multi-chassis. Use available data to take a good guess.
972 * If in doubt, go HPET. 974 * If in doubt, go HPET.
973 */ 975 */
@@ -977,6 +979,11 @@ __cpuinit int oem_force_hpet_timer(void)
977 unsigned id; 979 unsigned id;
978 DECLARE_BITMAP(clustermap, NUM_APIC_CLUSTERS); 980 DECLARE_BITMAP(clustermap, NUM_APIC_CLUSTERS);
979 981
982 /* Only do this check on IBM machines - big Unisys systems
983 use multiple clusters too, but have synchronized TSC */
984 if (!unsync_tsc_on_multicluster)
985 return 0;
986
980 bitmap_zero(clustermap, NUM_APIC_CLUSTERS); 987 bitmap_zero(clustermap, NUM_APIC_CLUSTERS);
981 988
982 for (i = 0; i < NR_CPUS; i++) { 989 for (i = 0; i < NR_CPUS; i++) {
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 2585c1d92b26..ffed464e6b12 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -50,6 +50,8 @@ static int no_timer_check;
50 50
51int disable_timer_pin_1 __initdata; 51int disable_timer_pin_1 __initdata;
52 52
53int timer_over_8254 __initdata = 1;
54
53/* Where if anywhere is the i8259 connect in external int mode */ 55/* Where if anywhere is the i8259 connect in external int mode */
54static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; 56static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
55 57
@@ -251,6 +253,20 @@ static int __init enable_ioapic_setup(char *str)
251__setup("noapic", disable_ioapic_setup); 253__setup("noapic", disable_ioapic_setup);
252__setup("apic", enable_ioapic_setup); 254__setup("apic", enable_ioapic_setup);
253 255
256static int __init setup_disable_8254_timer(char *s)
257{
258 timer_over_8254 = -1;
259 return 1;
260}
261static int __init setup_enable_8254_timer(char *s)
262{
263 timer_over_8254 = 2;
264 return 1;
265}
266
267__setup("disable_8254_timer", setup_disable_8254_timer);
268__setup("enable_8254_timer", setup_enable_8254_timer);
269
254#include <asm/pci-direct.h> 270#include <asm/pci-direct.h>
255#include <linux/pci_ids.h> 271#include <linux/pci_ids.h>
256#include <linux/pci.h> 272#include <linux/pci.h>
@@ -309,27 +325,20 @@ void __init check_ioapic(void)
309#endif 325#endif
310 /* RED-PEN skip them on mptables too? */ 326 /* RED-PEN skip them on mptables too? */
311 return; 327 return;
328
329 /* This should be actually default, but
330 for 2.6.16 let's do it for ATI only where
331 it's really needed. */
312 case PCI_VENDOR_ID_ATI: 332 case PCI_VENDOR_ID_ATI:
313 if (apic_runs_main_timer != 0) 333 if (timer_over_8254 == 1) {
314 break; 334 timer_over_8254 = 0;
315#ifdef CONFIG_ACPI
316 /* Don't do this for laptops right
317 right now because their timer
318 doesn't necessarily tick in C2/3 */
319 if (acpi_fadt.revision >= 3 &&
320 (acpi_fadt.plvl2_lat + acpi_fadt.plvl3_lat) < 1100) {
321 printk(KERN_INFO
322"ATI board detected, but seems to be a laptop. Timer might be shakey, sorry\n");
323 break;
324 }
325#endif
326 printk(KERN_INFO 335 printk(KERN_INFO
327 "ATI board detected. Using APIC/PM timer.\n"); 336 "ATI board detected. Disabling timer routing over 8254.\n");
328 apic_runs_main_timer = 1; 337 }
329 nohpet = 1;
330 return; 338 return;
331 } 339 }
332 340
341
333 /* No multi-function device? */ 342 /* No multi-function device? */
334 type = read_pci_config_byte(num,slot,func, 343 type = read_pci_config_byte(num,slot,func,
335 PCI_HEADER_TYPE); 344 PCI_HEADER_TYPE);
@@ -1773,6 +1782,8 @@ static inline void unlock_ExtINT_logic(void)
1773 * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ 1782 * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ
1774 * is so screwy. Thanks to Brian Perkins for testing/hacking this beast 1783 * is so screwy. Thanks to Brian Perkins for testing/hacking this beast
1775 * fanatically on his truly buggy board. 1784 * fanatically on his truly buggy board.
1785 *
1786 * FIXME: really need to revamp this for modern platforms only.
1776 */ 1787 */
1777static inline void check_timer(void) 1788static inline void check_timer(void)
1778{ 1789{
@@ -1795,7 +1806,8 @@ static inline void check_timer(void)
1795 */ 1806 */
1796 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); 1807 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
1797 init_8259A(1); 1808 init_8259A(1);
1798 enable_8259A_irq(0); 1809 if (timer_over_8254 > 0)
1810 enable_8259A_irq(0);
1799 1811
1800 pin1 = find_isa_irq_pin(0, mp_INT); 1812 pin1 = find_isa_irq_pin(0, mp_INT);
1801 apic1 = find_isa_irq_apic(0, mp_INT); 1813 apic1 = find_isa_irq_apic(0, mp_INT);
@@ -1850,7 +1862,7 @@ static inline void check_timer(void)
1850 } 1862 }
1851 printk(" failed.\n"); 1863 printk(" failed.\n");
1852 1864
1853 if (nmi_watchdog) { 1865 if (nmi_watchdog == NMI_IO_APIC) {
1854 printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n"); 1866 printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
1855 nmi_watchdog = 0; 1867 nmi_watchdog = 0;
1856 } 1868 }
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index dd0718dc178b..0c3f052ba6ce 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -228,11 +228,6 @@ static inline int need_iommu(struct device *dev, unsigned long addr, size_t size
228 int mmu = high; 228 int mmu = high;
229 if (force_iommu) 229 if (force_iommu)
230 mmu = 1; 230 mmu = 1;
231 if (no_iommu) {
232 if (high)
233 panic("PCI-DMA: high address but no IOMMU.\n");
234 mmu = 0;
235 }
236 return mmu; 231 return mmu;
237} 232}
238 233
@@ -241,11 +236,6 @@ static inline int nonforced_iommu(struct device *dev, unsigned long addr, size_t
241 u64 mask = *dev->dma_mask; 236 u64 mask = *dev->dma_mask;
242 int high = addr + size >= mask; 237 int high = addr + size >= mask;
243 int mmu = high; 238 int mmu = high;
244 if (no_iommu) {
245 if (high)
246 panic("PCI-DMA: high address but no IOMMU.\n");
247 mmu = 0;
248 }
249 return mmu; 239 return mmu;
250} 240}
251 241
@@ -310,7 +300,7 @@ void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int di
310 300
311 for (i = 0; i < nents; i++) { 301 for (i = 0; i < nents; i++) {
312 struct scatterlist *s = &sg[i]; 302 struct scatterlist *s = &sg[i];
313 if (!s->dma_length) 303 if (!s->dma_length || !s->length)
314 break; 304 break;
315 dma_unmap_single(dev, s->dma_address, s->dma_length, dir); 305 dma_unmap_single(dev, s->dma_address, s->dma_length, dir);
316 } 306 }
@@ -364,6 +354,7 @@ static int __dma_map_cont(struct scatterlist *sg, int start, int stopat,
364 354
365 BUG_ON(i > start && s->offset); 355 BUG_ON(i > start && s->offset);
366 if (i == start) { 356 if (i == start) {
357 *sout = *s;
367 sout->dma_address = iommu_bus_base; 358 sout->dma_address = iommu_bus_base;
368 sout->dma_address += iommu_page*PAGE_SIZE + s->offset; 359 sout->dma_address += iommu_page*PAGE_SIZE + s->offset;
369 sout->dma_length = s->length; 360 sout->dma_length = s->length;
@@ -390,6 +381,7 @@ static inline int dma_map_cont(struct scatterlist *sg, int start, int stopat,
390{ 381{
391 if (!need) { 382 if (!need) {
392 BUG_ON(stopat - start != 1); 383 BUG_ON(stopat - start != 1);
384 *sout = sg[start];
393 sout->dma_length = sg[start].length; 385 sout->dma_length = sg[start].length;
394 return 0; 386 return 0;
395 } 387 }
@@ -632,17 +624,13 @@ static int __init pci_iommu_init(void)
632 (agp_copy_info(agp_bridge, &info) < 0); 624 (agp_copy_info(agp_bridge, &info) < 0);
633#endif 625#endif
634 626
635 if (swiotlb) { 627 if (swiotlb)
636 no_iommu = 1;
637 return -1; 628 return -1;
638 } 629
639
640 if (no_iommu || 630 if (no_iommu ||
641 (!force_iommu && end_pfn <= MAX_DMA32_PFN) || 631 (!force_iommu && end_pfn <= MAX_DMA32_PFN) ||
642 !iommu_aperture || 632 !iommu_aperture ||
643 (no_agp && init_k8_gatt(&info) < 0)) { 633 (no_agp && init_k8_gatt(&info) < 0)) {
644 no_iommu = 1;
645 no_iommu_init();
646 printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n"); 634 printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n");
647 if (end_pfn > MAX_DMA32_PFN) { 635 if (end_pfn > MAX_DMA32_PFN) {
648 printk(KERN_ERR "WARNING more than 4GB of memory " 636 printk(KERN_ERR "WARNING more than 4GB of memory "
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 9435ab7d6fb8..aa55e3cec665 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -423,6 +423,12 @@ static __init void parse_cmdline_early (char ** cmdline_p)
423 else if(!memcmp(from, "elfcorehdr=", 11)) 423 else if(!memcmp(from, "elfcorehdr=", 11))
424 elfcorehdr_addr = memparse(from+11, &from); 424 elfcorehdr_addr = memparse(from+11, &from);
425#endif 425#endif
426
427#ifdef CONFIG_HOTPLUG_CPU
428 else if (!memcmp(from, "additional_cpus=", 16))
429 setup_additional_cpus(from+16);
430#endif
431
426 next_char: 432 next_char:
427 c = *(from++); 433 c = *(from++);
428 if (!c) 434 if (!c)
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index 67e4e28f4df8..66e98659d077 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -1152,8 +1152,6 @@ void __init smp_cpus_done(unsigned int max_cpus)
1152 setup_ioapic_dest(); 1152 setup_ioapic_dest();
1153#endif 1153#endif
1154 1154
1155 time_init_gtod();
1156
1157 check_nmi_watchdog(); 1155 check_nmi_watchdog();
1158} 1156}
1159 1157
@@ -1244,7 +1242,7 @@ void __cpu_die(unsigned int cpu)
1244 printk(KERN_ERR "CPU %u didn't die...\n", cpu); 1242 printk(KERN_ERR "CPU %u didn't die...\n", cpu);
1245} 1243}
1246 1244
1247static __init int setup_additional_cpus(char *s) 1245__init int setup_additional_cpus(char *s)
1248{ 1246{
1249 return get_option(&s, &additional_cpus); 1247 return get_option(&s, &additional_cpus);
1250} 1248}
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 67841d11ed1f..3080f84bf7b7 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -48,6 +48,8 @@ static void cpufreq_delayed_get(void);
48extern void i8254_timer_resume(void); 48extern void i8254_timer_resume(void);
49extern int using_apic_timer; 49extern int using_apic_timer;
50 50
51static char *time_init_gtod(void);
52
51DEFINE_SPINLOCK(rtc_lock); 53DEFINE_SPINLOCK(rtc_lock);
52DEFINE_SPINLOCK(i8253_lock); 54DEFINE_SPINLOCK(i8253_lock);
53 55
@@ -901,6 +903,7 @@ static struct irqaction irq0 = {
901void __init time_init(void) 903void __init time_init(void)
902{ 904{
903 char *timename; 905 char *timename;
906 char *gtod;
904 907
905#ifdef HPET_HACK_ENABLE_DANGEROUS 908#ifdef HPET_HACK_ENABLE_DANGEROUS
906 if (!vxtime.hpet_address) { 909 if (!vxtime.hpet_address) {
@@ -945,21 +948,19 @@ void __init time_init(void)
945 timename = "PIT"; 948 timename = "PIT";
946 } 949 }
947 950
948 printk(KERN_INFO "time.c: Using %ld.%06ld MHz %s timer.\n", 951 vxtime.mode = VXTIME_TSC;
949 vxtime_hz / 1000000, vxtime_hz % 1000000, timename); 952 gtod = time_init_gtod();
953
954 printk(KERN_INFO "time.c: Using %ld.%06ld MHz WALL %s GTOD %s timer.\n",
955 vxtime_hz / 1000000, vxtime_hz % 1000000, timename, gtod);
950 printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n", 956 printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n",
951 cpu_khz / 1000, cpu_khz % 1000); 957 cpu_khz / 1000, cpu_khz % 1000);
952 vxtime.mode = VXTIME_TSC;
953 vxtime.quot = (1000000L << 32) / vxtime_hz; 958 vxtime.quot = (1000000L << 32) / vxtime_hz;
954 vxtime.tsc_quot = (1000L << 32) / cpu_khz; 959 vxtime.tsc_quot = (1000L << 32) / cpu_khz;
955 vxtime.last_tsc = get_cycles_sync(); 960 vxtime.last_tsc = get_cycles_sync();
956 setup_irq(0, &irq0); 961 setup_irq(0, &irq0);
957 962
958 set_cyc2ns_scale(cpu_khz); 963 set_cyc2ns_scale(cpu_khz);
959
960#ifndef CONFIG_SMP
961 time_init_gtod();
962#endif
963} 964}
964 965
965/* 966/*
@@ -981,9 +982,9 @@ __cpuinit int unsynchronized_tsc(void)
981} 982}
982 983
983/* 984/*
984 * Decide after all CPUs are booted what mode gettimeofday should use. 985 * Decide what mode gettimeofday should use.
985 */ 986 */
986void __init time_init_gtod(void) 987__init static char *time_init_gtod(void)
987{ 988{
988 char *timetype; 989 char *timetype;
989 990
@@ -1011,8 +1012,7 @@ void __init time_init_gtod(void)
1011 timetype = hpet_use_timer ? "HPET/TSC" : "PIT/TSC"; 1012 timetype = hpet_use_timer ? "HPET/TSC" : "PIT/TSC";
1012 vxtime.mode = VXTIME_TSC; 1013 vxtime.mode = VXTIME_TSC;
1013 } 1014 }
1014 1015 return timetype;
1015 printk(KERN_INFO "time.c: Using %s based timekeeping.\n", timetype);
1016} 1016}
1017 1017
1018__setup("report_lost_ticks", time_setup); 1018__setup("report_lost_ticks", time_setup);