aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2006-02-28 12:25:22 -0500
committerKumar Gala <galak@kernel.crashing.org>2006-02-28 12:25:22 -0500
commit9585da3729e7e27bf22818625c10ac6c64ebb609 (patch)
tree8c8d46f7f2cc933fdf75a6a75cf593a63f7b8717 /arch/x86_64/kernel
parent8080d5497146d5d27d9e8e78229d1adc7fe280cf (diff)
parent6749c5507388f3fc3719f57a54b540ee83f6661a (diff)
Merge branch 'master' of git+ssh://galak@master.kernel.org/pub/scm/linux/kernel/git/galak/powerpc
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.c3
-rw-r--r--arch/x86_64/kernel/entry.S1
-rw-r--r--arch/x86_64/kernel/head.S7
-rw-r--r--arch/x86_64/kernel/io_apic.c42
-rw-r--r--arch/x86_64/kernel/mpparse.c4
-rw-r--r--arch/x86_64/kernel/nmi.c19
-rw-r--r--arch/x86_64/kernel/pci-gart.c20
-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.c37
-rw-r--r--arch/x86_64/kernel/traps.c18
13 files changed, 108 insertions, 57 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 6147770b4347..e5b14c57eaa0 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -708,7 +708,7 @@ static void setup_APIC_timer(unsigned int clocks)
708 local_irq_save(flags); 708 local_irq_save(flags);
709 709
710 /* wait for irq slice */ 710 /* wait for irq slice */
711 if (vxtime.hpet_address) { 711 if (vxtime.hpet_address && hpet_use_timer) {
712 int trigger = hpet_readl(HPET_T0_CMP); 712 int trigger = hpet_readl(HPET_T0_CMP);
713 while (hpet_readl(HPET_COUNTER) >= trigger) 713 while (hpet_readl(HPET_COUNTER) >= trigger)
714 /* do nothing */ ; 714 /* do nothing */ ;
@@ -1152,6 +1152,7 @@ __setup("noapicmaintimer", setup_noapicmaintimer);
1152static __init int setup_apicpmtimer(char *s) 1152static __init int setup_apicpmtimer(char *s)
1153{ 1153{
1154 apic_calibrate_pmtmr = 1; 1154 apic_calibrate_pmtmr = 1;
1155 notsc_setup(NULL);
1155 return setup_apicmaintimer(NULL); 1156 return setup_apicmaintimer(NULL);
1156} 1157}
1157__setup("apicpmtimer", setup_apicpmtimer); 1158__setup("apicpmtimer", setup_apicpmtimer);
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index b150c87a08c6..7c10e9009d61 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -554,6 +554,7 @@ iret_label:
554 /* running with kernel gs */ 554 /* running with kernel gs */
555bad_iret: 555bad_iret:
556 movq $-9999,%rdi /* better code? */ 556 movq $-9999,%rdi /* better code? */
557 sti
557 jmp do_exit 558 jmp do_exit
558 .previous 559 .previous
559 560
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S
index 692c737feddb..02fc7fa0ea28 100644
--- a/arch/x86_64/kernel/head.S
+++ b/arch/x86_64/kernel/head.S
@@ -213,6 +213,11 @@ ENTRY(early_idt_handler)
213 cmpl $2,early_recursion_flag(%rip) 213 cmpl $2,early_recursion_flag(%rip)
214 jz 1f 214 jz 1f
215 call dump_stack 215 call dump_stack
216#ifdef CONFIG_KALLSYMS
217 leaq early_idt_ripmsg(%rip),%rdi
218 movq 8(%rsp),%rsi # get rip again
219 call __print_symbol
220#endif
2161: hlt 2211: hlt
217 jmp 1b 222 jmp 1b
218early_recursion_flag: 223early_recursion_flag:
@@ -220,6 +225,8 @@ early_recursion_flag:
220 225
221early_idt_msg: 226early_idt_msg:
222 .asciz "PANIC: early exception rip %lx error %lx cr2 %lx\n" 227 .asciz "PANIC: early exception rip %lx error %lx cr2 %lx\n"
228early_idt_ripmsg:
229 .asciz "RIP %s\n"
223 230
224.code32 231.code32
225ENTRY(no_long_mode) 232ENTRY(no_long_mode)
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 4282d72b2a26..ffed464e6b12 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -30,6 +30,9 @@
30#include <linux/mc146818rtc.h> 30#include <linux/mc146818rtc.h>
31#include <linux/acpi.h> 31#include <linux/acpi.h>
32#include <linux/sysdev.h> 32#include <linux/sysdev.h>
33#ifdef CONFIG_ACPI
34#include <acpi/acpi_bus.h>
35#endif
33 36
34#include <asm/io.h> 37#include <asm/io.h>
35#include <asm/smp.h> 38#include <asm/smp.h>
@@ -47,6 +50,8 @@ static int no_timer_check;
47 50
48int disable_timer_pin_1 __initdata; 51int disable_timer_pin_1 __initdata;
49 52
53int timer_over_8254 __initdata = 1;
54
50/* Where if anywhere is the i8259 connect in external int mode */ 55/* Where if anywhere is the i8259 connect in external int mode */
51static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; 56static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
52 57
@@ -248,6 +253,20 @@ static int __init enable_ioapic_setup(char *str)
248__setup("noapic", disable_ioapic_setup); 253__setup("noapic", disable_ioapic_setup);
249__setup("apic", enable_ioapic_setup); 254__setup("apic", enable_ioapic_setup);
250 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
251#include <asm/pci-direct.h> 270#include <asm/pci-direct.h>
252#include <linux/pci_ids.h> 271#include <linux/pci_ids.h>
253#include <linux/pci.h> 272#include <linux/pci.h>
@@ -260,6 +279,8 @@ __setup("apic", enable_ioapic_setup);
260 279
261 And another hack to disable the IOMMU on VIA chipsets. 280 And another hack to disable the IOMMU on VIA chipsets.
262 281
282 ... and others. Really should move this somewhere else.
283
263 Kludge-O-Rama. */ 284 Kludge-O-Rama. */
264void __init check_ioapic(void) 285void __init check_ioapic(void)
265{ 286{
@@ -304,16 +325,20 @@ void __init check_ioapic(void)
304#endif 325#endif
305 /* RED-PEN skip them on mptables too? */ 326 /* RED-PEN skip them on mptables too? */
306 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. */
307 case PCI_VENDOR_ID_ATI: 332 case PCI_VENDOR_ID_ATI:
308 if (apic_runs_main_timer != 0) 333 if (timer_over_8254 == 1) {
309 break; 334 timer_over_8254 = 0;
310 printk(KERN_INFO 335 printk(KERN_INFO
311 "ATI board detected. Using APIC/PM timer.\n"); 336 "ATI board detected. Disabling timer routing over 8254.\n");
312 apic_runs_main_timer = 1; 337 }
313 nohpet = 1;
314 return; 338 return;
315 } 339 }
316 340
341
317 /* No multi-function device? */ 342 /* No multi-function device? */
318 type = read_pci_config_byte(num,slot,func, 343 type = read_pci_config_byte(num,slot,func,
319 PCI_HEADER_TYPE); 344 PCI_HEADER_TYPE);
@@ -1757,6 +1782,8 @@ static inline void unlock_ExtINT_logic(void)
1757 * 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
1758 * 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
1759 * 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.
1760 */ 1787 */
1761static inline void check_timer(void) 1788static inline void check_timer(void)
1762{ 1789{
@@ -1779,7 +1806,8 @@ static inline void check_timer(void)
1779 */ 1806 */
1780 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); 1807 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
1781 init_8259A(1); 1808 init_8259A(1);
1782 enable_8259A_irq(0); 1809 if (timer_over_8254 > 0)
1810 enable_8259A_irq(0);
1783 1811
1784 pin1 = find_isa_irq_pin(0, mp_INT); 1812 pin1 = find_isa_irq_pin(0, mp_INT);
1785 apic1 = find_isa_irq_apic(0, mp_INT); 1813 apic1 = find_isa_irq_apic(0, mp_INT);
@@ -1834,7 +1862,7 @@ static inline void check_timer(void)
1834 } 1862 }
1835 printk(" failed.\n"); 1863 printk(" failed.\n");
1836 1864
1837 if (nmi_watchdog) { 1865 if (nmi_watchdog == NMI_IO_APIC) {
1838 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");
1839 nmi_watchdog = 0; 1867 nmi_watchdog = 0;
1840 } 1868 }
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
index dc49bfb6db0a..9013a90b5c2e 100644
--- a/arch/x86_64/kernel/mpparse.c
+++ b/arch/x86_64/kernel/mpparse.c
@@ -288,9 +288,9 @@ static int __init smp_read_mpc(struct mp_config_table *mpc)
288 288
289 memcpy(str,mpc->mpc_productid,12); 289 memcpy(str,mpc->mpc_productid,12);
290 str[12]=0; 290 str[12]=0;
291 printk(KERN_INFO "Product ID: %s ",str); 291 printk("Product ID: %s ",str);
292 292
293 printk(KERN_INFO "APIC at: 0x%X\n",mpc->mpc_lapic); 293 printk("APIC at: 0x%X\n",mpc->mpc_lapic);
294 294
295 /* save the local APIC address, it might be non-default */ 295 /* save the local APIC address, it might be non-default */
296 if (!acpi_lapic) 296 if (!acpi_lapic)
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index 8be407a1f62d..5bf17e41cd2d 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -236,6 +236,7 @@ static void enable_lapic_nmi_watchdog(void)
236{ 236{
237 if (nmi_active < 0) { 237 if (nmi_active < 0) {
238 nmi_watchdog = NMI_LOCAL_APIC; 238 nmi_watchdog = NMI_LOCAL_APIC;
239 touch_nmi_watchdog();
239 setup_apic_nmi_watchdog(); 240 setup_apic_nmi_watchdog();
240 } 241 }
241} 242}
@@ -456,15 +457,17 @@ static DEFINE_PER_CPU(int, nmi_touch);
456 457
457void touch_nmi_watchdog (void) 458void touch_nmi_watchdog (void)
458{ 459{
459 int i; 460 if (nmi_watchdog > 0) {
461 unsigned cpu;
460 462
461 /* 463 /*
462 * Tell other CPUs to reset their alert counters. We cannot 464 * Tell other CPUs to reset their alert counters. We cannot
463 * do it ourselves because the alert count increase is not 465 * do it ourselves because the alert count increase is not
464 * atomic. 466 * atomic.
465 */ 467 */
466 for (i = 0; i < NR_CPUS; i++) 468 for_each_present_cpu (cpu)
467 per_cpu(nmi_touch, i) = 1; 469 per_cpu(nmi_touch, cpu) = 1;
470 }
468 471
469 touch_softlockup_watchdog(); 472 touch_softlockup_watchdog();
470} 473}
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index 2fe23a6c361b..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
@@ -379,7 +369,7 @@ static int __dma_map_cont(struct scatterlist *sg, int start, int stopat,
379 SET_LEAK(iommu_page); 369 SET_LEAK(iommu_page);
380 addr += PAGE_SIZE; 370 addr += PAGE_SIZE;
381 iommu_page++; 371 iommu_page++;
382 } 372 }
383 } 373 }
384 BUG_ON(iommu_page - iommu_start != pages); 374 BUG_ON(iommu_page - iommu_start != pages);
385 return 0; 375 return 0;
@@ -634,17 +624,13 @@ static int __init pci_iommu_init(void)
634 (agp_copy_info(agp_bridge, &info) < 0); 624 (agp_copy_info(agp_bridge, &info) < 0);
635#endif 625#endif
636 626
637 if (swiotlb) { 627 if (swiotlb)
638 no_iommu = 1;
639 return -1; 628 return -1;
640 } 629
641
642 if (no_iommu || 630 if (no_iommu ||
643 (!force_iommu && end_pfn <= MAX_DMA32_PFN) || 631 (!force_iommu && end_pfn <= MAX_DMA32_PFN) ||
644 !iommu_aperture || 632 !iommu_aperture ||
645 (no_agp && init_k8_gatt(&info) < 0)) { 633 (no_agp && init_k8_gatt(&info) < 0)) {
646 no_iommu = 1;
647 no_iommu_init();
648 printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n"); 634 printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n");
649 if (end_pfn > MAX_DMA32_PFN) { 635 if (end_pfn > MAX_DMA32_PFN) {
650 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 dba7237be5c1..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
@@ -59,7 +61,7 @@ static int notsc __initdata = 0;
59unsigned int cpu_khz; /* TSC clocks / usec, not used here */ 61unsigned int cpu_khz; /* TSC clocks / usec, not used here */
60static unsigned long hpet_period; /* fsecs / HPET clock */ 62static unsigned long hpet_period; /* fsecs / HPET clock */
61unsigned long hpet_tick; /* HPET clocks / interrupt */ 63unsigned long hpet_tick; /* HPET clocks / interrupt */
62static int hpet_use_timer; /* Use counter of hpet for time keeping, otherwise PIT */ 64int hpet_use_timer; /* Use counter of hpet for time keeping, otherwise PIT */
63unsigned long vxtime_hz = PIT_TICK_RATE; 65unsigned long vxtime_hz = PIT_TICK_RATE;
64int report_lost_ticks; /* command line option */ 66int report_lost_ticks; /* command line option */
65unsigned long long monotonic_base; 67unsigned long long monotonic_base;
@@ -326,7 +328,10 @@ static noinline void handle_lost_ticks(int lost, struct pt_regs *regs)
326 print_symbol("rip %s\n", regs->rip); 328 print_symbol("rip %s\n", regs->rip);
327 if (vxtime.mode == VXTIME_TSC && vxtime.hpet_address) { 329 if (vxtime.mode == VXTIME_TSC && vxtime.hpet_address) {
328 printk(KERN_WARNING "Falling back to HPET\n"); 330 printk(KERN_WARNING "Falling back to HPET\n");
329 vxtime.last = hpet_readl(HPET_T0_CMP) - hpet_tick; 331 if (hpet_use_timer)
332 vxtime.last = hpet_readl(HPET_T0_CMP) - hpet_tick;
333 else
334 vxtime.last = hpet_readl(HPET_COUNTER);
330 vxtime.mode = VXTIME_HPET; 335 vxtime.mode = VXTIME_HPET;
331 do_gettimeoffset = do_gettimeoffset_hpet; 336 do_gettimeoffset = do_gettimeoffset_hpet;
332 } 337 }
@@ -898,6 +903,7 @@ static struct irqaction irq0 = {
898void __init time_init(void) 903void __init time_init(void)
899{ 904{
900 char *timename; 905 char *timename;
906 char *gtod;
901 907
902#ifdef HPET_HACK_ENABLE_DANGEROUS 908#ifdef HPET_HACK_ENABLE_DANGEROUS
903 if (!vxtime.hpet_address) { 909 if (!vxtime.hpet_address) {
@@ -942,21 +948,19 @@ void __init time_init(void)
942 timename = "PIT"; 948 timename = "PIT";
943 } 949 }
944 950
945 printk(KERN_INFO "time.c: Using %ld.%06ld MHz %s timer.\n", 951 vxtime.mode = VXTIME_TSC;
946 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);
947 printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n", 956 printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n",
948 cpu_khz / 1000, cpu_khz % 1000); 957 cpu_khz / 1000, cpu_khz % 1000);
949 vxtime.mode = VXTIME_TSC;
950 vxtime.quot = (1000000L << 32) / vxtime_hz; 958 vxtime.quot = (1000000L << 32) / vxtime_hz;
951 vxtime.tsc_quot = (1000L << 32) / cpu_khz; 959 vxtime.tsc_quot = (1000L << 32) / cpu_khz;
952 vxtime.last_tsc = get_cycles_sync(); 960 vxtime.last_tsc = get_cycles_sync();
953 setup_irq(0, &irq0); 961 setup_irq(0, &irq0);
954 962
955 set_cyc2ns_scale(cpu_khz); 963 set_cyc2ns_scale(cpu_khz);
956
957#ifndef CONFIG_SMP
958 time_init_gtod();
959#endif
960} 964}
961 965
962/* 966/*
@@ -978,9 +982,9 @@ __cpuinit int unsynchronized_tsc(void)
978} 982}
979 983
980/* 984/*
981 * Decide after all CPUs are booted what mode gettimeofday should use. 985 * Decide what mode gettimeofday should use.
982 */ 986 */
983void __init time_init_gtod(void) 987__init static char *time_init_gtod(void)
984{ 988{
985 char *timetype; 989 char *timetype;
986 990
@@ -988,7 +992,10 @@ void __init time_init_gtod(void)
988 notsc = 1; 992 notsc = 1;
989 if (vxtime.hpet_address && notsc) { 993 if (vxtime.hpet_address && notsc) {
990 timetype = hpet_use_timer ? "HPET" : "PIT/HPET"; 994 timetype = hpet_use_timer ? "HPET" : "PIT/HPET";
991 vxtime.last = hpet_readl(HPET_T0_CMP) - hpet_tick; 995 if (hpet_use_timer)
996 vxtime.last = hpet_readl(HPET_T0_CMP) - hpet_tick;
997 else
998 vxtime.last = hpet_readl(HPET_COUNTER);
992 vxtime.mode = VXTIME_HPET; 999 vxtime.mode = VXTIME_HPET;
993 do_gettimeoffset = do_gettimeoffset_hpet; 1000 do_gettimeoffset = do_gettimeoffset_hpet;
994#ifdef CONFIG_X86_PM_TIMER 1001#ifdef CONFIG_X86_PM_TIMER
@@ -1005,8 +1012,7 @@ void __init time_init_gtod(void)
1005 timetype = hpet_use_timer ? "HPET/TSC" : "PIT/TSC"; 1012 timetype = hpet_use_timer ? "HPET/TSC" : "PIT/TSC";
1006 vxtime.mode = VXTIME_TSC; 1013 vxtime.mode = VXTIME_TSC;
1007 } 1014 }
1008 1015 return timetype;
1009 printk(KERN_INFO "time.c: Using %s based timekeeping.\n", timetype);
1010} 1016}
1011 1017
1012__setup("report_lost_ticks", time_setup); 1018__setup("report_lost_ticks", time_setup);
@@ -1321,8 +1327,7 @@ static int __init nohpet_setup(char *s)
1321 1327
1322__setup("nohpet", nohpet_setup); 1328__setup("nohpet", nohpet_setup);
1323 1329
1324 1330int __init notsc_setup(char *s)
1325static int __init notsc_setup(char *s)
1326{ 1331{
1327 notsc = 1; 1332 notsc = 1;
1328 return 0; 1333 return 0;
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index ee1b2da9e5e7..28d50dc540e8 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -90,6 +90,20 @@ static inline void conditional_sti(struct pt_regs *regs)
90 local_irq_enable(); 90 local_irq_enable();
91} 91}
92 92
93static inline void preempt_conditional_sti(struct pt_regs *regs)
94{
95 preempt_disable();
96 if (regs->eflags & X86_EFLAGS_IF)
97 local_irq_enable();
98}
99
100static inline void preempt_conditional_cli(struct pt_regs *regs)
101{
102 if (regs->eflags & X86_EFLAGS_IF)
103 local_irq_disable();
104 preempt_enable_no_resched();
105}
106
93static int kstack_depth_to_print = 10; 107static int kstack_depth_to_print = 10;
94 108
95#ifdef CONFIG_KALLSYMS 109#ifdef CONFIG_KALLSYMS
@@ -693,7 +707,7 @@ asmlinkage void __kprobes do_debug(struct pt_regs * regs,
693 SIGTRAP) == NOTIFY_STOP) 707 SIGTRAP) == NOTIFY_STOP)
694 return; 708 return;
695 709
696 conditional_sti(regs); 710 preempt_conditional_sti(regs);
697 711
698 /* Mask out spurious debug traps due to lazy DR7 setting */ 712 /* Mask out spurious debug traps due to lazy DR7 setting */
699 if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) { 713 if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) {
@@ -738,11 +752,13 @@ asmlinkage void __kprobes do_debug(struct pt_regs * regs,
738 752
739clear_dr7: 753clear_dr7:
740 set_debugreg(0UL, 7); 754 set_debugreg(0UL, 7);
755 preempt_conditional_cli(regs);
741 return; 756 return;
742 757
743clear_TF_reenable: 758clear_TF_reenable:
744 set_tsk_thread_flag(tsk, TIF_SINGLESTEP); 759 set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
745 regs->eflags &= ~TF_MASK; 760 regs->eflags &= ~TF_MASK;
761 preempt_conditional_cli(regs);
746} 762}
747 763
748static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr) 764static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr)