new timeofday i386 arch specific changes (v. B0)
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 new timeofday i386 arch specific changes (v. B0)
Forgot to CC lkml. Resending.
Andrew, All,
This patch converts the i386 arch to use the new timeofday
infrastructure. It applies on top of my timeofday-core_B0 patch. This is a full conversion, so most of this patch is subtractions removing the existing arch specific time keeping code. This patch does not provide any i386 timesources, so using this patch alone on top of the timeofday- core patch will only give you the jiffies timesource. To get full replacements for the code being removed here, the following timeofday- timesources-i386 patch will need to be applied.
Andrew, please consider for inclusion for testing into your tree (I'd like to target around end of July for possible inclusion into mainline).
thanks
-john
linux-2.6.12-rc5_timeofday-arch-i386_B0.patch
=============================================
arch/i386/Kconfig (mode:100644) +4 -0
@@ -14,6 +14,10 @@ 486, 586, Pentiums, and various instruction-set-compatible chips by AMD, Cyrix, and others. +config NEWTOD + bool + default y + config MMU bool default y
arch/i386/kernel/Makefile (mode:100644) +1 -2
@@ -7,10 +7,9 @@ obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \ ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \ pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \ - doublefault.o quirks.o + doublefault.o quirks.o tsc.o obj-y += cpu/ -obj-y += timers/ obj-$(CONFIG_ACPI_BOOT) += acpi/ obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o obj-$(CONFIG_MCA) += mca.o
arch/i386/kernel/i8259.c (mode:100644) +42 -0
48 lines not on this page · raw message
arch/i386/kernel/setup.c (mode:100644) +1 -0
@@ -1523,6 +1523,7 @@ conswitchp = &dummy_con; #endif #endif + tsc_init(); } #include "setup_arch_post.h"
arch/i386/kernel/time.c (mode:100644) +34 -180
307 lines not on this page · raw message
dev/null (tree:6510fa520bd81763aadda4ba1d3c399aec279e36) renamed from arch/i386/kernel/timers/Makefile (mode:100644) +0 -9
@@ -1,9 +0,0 @@ -# -# Makefile for x86 timers -# - -obj-y := timer.o timer_none.o timer_tsc.o timer_pit.o common.o - -obj-$(CONFIG_X86_CYCLONE_TIMER) += timer_cyclone.o -obj-$(CONFIG_HPET_TIMER) += timer_hpet.o -obj-$(CONFIG_X86_PM_TIMER) += timer_pm.o
dev/null (tree:6510fa520bd81763aadda4ba1d3c399aec279e36) renamed from arch/i386/kernel/timers/common.c (mode:100644) +0 -160
160 lines not on this page · raw message
dev/null (tree:6510fa520bd81763aadda4ba1d3c399aec279e36) renamed from arch/i386/kernel/timers/timer.c (mode:100644) +0 -66
66 lines not on this page · raw message
dev/null (tree:6510fa520bd81763aadda4ba1d3c399aec279e36) renamed from arch/i386/kernel/timers/timer_cyclone.c (mode:100644) +0 -259
259 lines not on this page · raw message
dev/null (tree:6510fa520bd81763aadda4ba1d3c399aec279e36) renamed from arch/i386/kernel/timers/timer_hpet.c (mode:100644) +0 -194
194 lines not on this page · raw message
dev/null (tree:6510fa520bd81763aadda4ba1d3c399aec279e36) renamed from arch/i386/kernel/timers/timer_none.c (mode:100644) +0 -39
@@ -1,39 +0,0 @@ -#include <linux/init.h> -#include <asm/timer.h> - -static void mark_offset_none(void) -{ - /* nothing needed */ -} - -static unsigned long get_offset_none(void) -{ - return 0; -} - -static unsigned long long monotonic_clock_none(void) -{ - return 0; -} - -static void delay_none(unsigned long loops) -{ - int d0; - __asm__ __volatile__( - "\tjmp 1f\n" - ".align 16\n" - "1:\tjmp 2f\n" - ".align 16\n" - "2:\tdecl %0\n\tjns 2b" - :"=&a" (d0) - :"0" (loops)); -} - -/* none timer_opts struct */ -struct timer_opts timer_none = { - .name = "none", - .mark_offset = mark_offset_none, - .get_offset = get_offset_none, - .monotonic_clock = monotonic_clock_none, - .delay = delay_none, -};
dev/null (tree:6510fa520bd81763aadda4ba1d3c399aec279e36) renamed from arch/i386/kernel/timers/timer_pit.c (mode:100644) +0 -206
206 lines not on this page · raw message
dev/null (tree:6510fa520bd81763aadda4ba1d3c399aec279e36) renamed from arch/i386/kernel/timers/timer_pm.c (mode:100644) +0 -258
258 lines not on this page · raw message
dev/null (tree:6510fa520bd81763aadda4ba1d3c399aec279e36) renamed from arch/i386/kernel/timers/timer_tsc.c (mode:100644) +0 -560
560 lines not on this page · raw message
arch/i386/kernel/tsc.c (mode:100644) renamed from dev/null (tree:6e3d9e6298413e0aed3157cd848724bb12c42554) +163 -0
163 lines not on this page · raw message
arch/i386/lib/delay.c (mode:100644) +13 -3
@@ -13,6 +13,7 @@ #include <linux/config.h> #include <linux/sched.h> #include <linux/delay.h> +#include <linux/timeofday.h> #include <asm/processor.h> #include <asm/delay.h> #include <asm/timer.h>
@@ -21,11 +22,20 @@ #include <asm/smp.h> #endif -extern struct timer_opts* timer; - +/* XXX - For now just use a simple loop delay + * This has cpufreq issues, but so did the old method. + */ void __delay(unsigned long loops) { - cur_timer->delay(loops); + int d0; + __asm__ __volatile__( + "\tjmp 1f\n" + ".align 16\n" + "1:\tjmp 2f\n" + ".align 16\n" + "2:\tdecl %0\n\tjns 2b" + :"=&a" (d0) + :"0" (loops)); } inline void __const_udelay(unsigned long xloops)
include/asm-generic/timeofday.h (mode:100644) +1 -1
@@ -20,7 +20,7 @@ struct timesource_t* timesource, int ntp_adj); #else #define arch_update_vsyscall_gtod(x,y,z,w) {} -#endif +#endif /* CONFIG_NEWTOD_VSYSCALL */ #endif /* CONFIG_NEWTOD */ #endif
include/asm-i386/mach-default/mach_timer.h (mode:100644) +5 -1
@@ -14,8 +14,12 @@ */ #ifndef _MACH_TIMER_H #define _MACH_TIMER_H +#include <linux/jiffies.h> +#include <asm/io.h> -#define CALIBRATE_LATCH (5 * LATCH) +#define CALIBRATE_ITERATION 50 +#define CALIBRATE_LATCH (CALIBRATE_ITERATION * LATCH) +#define CALIBRATE_TIME (CALIBRATE_ITERATION * 1000020/HZ) static inline void mach_prepare_counter(void) {
include/asm-i386/timeofday.h (mode:100644) renamed from dev/null (tree:6e3d9e6298413e0aed3157cd848724bb12c42554) +4 -0
@@ -0,0 +1,4 @@ +#ifndef _ASM_I386_TIMEOFDAY_H +#define _ASM_I386_TIMEOFDAY_H +#include <asm-generic/timeofday.h> +#endif
include/asm-i386/timer.h (mode:100644) +0 -53
63 lines not on this page · raw message
include/asm-i386/timex.h (mode:100644) +3 -0
@@ -16,6 +16,8 @@ #endif +/* XXX - All of this should likely move elsewhere [email protected]*/ + /* * Standard way to access the cycle counter on i586+ CPUs. * Currently only used on SMP.
@@ -48,5 +50,6 @@ } extern unsigned long cpu_khz; +extern void tsc_init(void); #endif
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 new timeofday x86-64 arch specific changes (v. B0)
Forgot to CC lkml. Resending.
Andi, All,
This patch converts the x86-64 arch to use the new timeofday
infrastructure. It applies on top of my timeofday-core_B0 patch. This is a full conversion, so most of this patch is subtractions removing the existing arch specific time keeping code. This patch does not provide any x86-64 timesources, so using this patch alone on top of the timeofday-core patch will only give you the jiffies timesource. To get full replacements for the code being removed here, the following timeofday-timesources-i386 patch (x86-64 shares the same timesources as i386) will need to be applied.
Andi: I'd like to submit this to Andrew for inclusion into his tree for testing, however I'd like to get an ACK from you first. Please let me know if you have any feedback or suggestions.
thanks
-john
linux-2.6.12-rc5_timeofday-arch-x86-64_B0.patch
===============================================
arch/i386/kernel/acpi/boot.c (mode:100644) +3 -9
@@ -547,7 +547,7 @@ #ifdef CONFIG_HPET_TIMER - +#include <asm/hpet.h> static int __init acpi_parse_hpet(unsigned long phys, unsigned long size) { struct acpi_table_hpet *hpet_tbl;
@@ -570,18 +570,12 @@ #ifdef CONFIG_X86_64 vxtime.hpet_address = hpet_tbl->addr.addrl | ((long) hpet_tbl->addr.addrh << 32); - - printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", - hpet_tbl->id, vxtime.hpet_address); + hpet_address = vxtime.hpet_address; #else /* X86 */ - { - extern unsigned long hpet_address; - hpet_address = hpet_tbl->addr.addrl; +#endif /* X86 */ printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", hpet_tbl->id, hpet_address); - } -#endif /* X86 */ return 0; }
arch/x86_64/Kconfig (mode:100644) +8 -0
@@ -24,6 +24,14 @@ bool default y +config NEWTOD + bool + default y + +config NEWTOD_VSYSCALL + bool + default y + config MMU bool default y
arch/x86_64/kernel/Makefile (mode:100644) +0 -1
@@ -28,7 +28,6 @@ obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o pci-dma.o obj-$(CONFIG_SWIOTLB) += swiotlb.o obj-$(CONFIG_KPROBES) += kprobes.o -obj-$(CONFIG_X86_PM_TIMER) += pmtimer.o obj-$(CONFIG_MODULES) += module.o
dev/null (tree:cc17e2e072235a76e4c04af23ef7cb1bc7c4c787) renamed from arch/x86_64/kernel/pmtimer.c (mode:100644) +0 -101
101 lines not on this page · raw message
arch/x86_64/kernel/time.c (mode:100644) +26 -309
423 lines not on this page · raw message
arch/x86_64/kernel/vmlinux.lds.S (mode:100644) +7 -0
@@ -71,6 +71,13 @@ . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); .jiffies : AT CACHE_ALIGN(AFTER(.xtime)) { *(.jiffies) } jiffies = LOADADDR(.jiffies); + + .vsyscall_gtod_data : AT AFTER(.jiffies) { *(.vsyscall_gtod_data) } + vsyscall_gtod_data = LOADADDR(.vsyscall_gtod_data); + .vsyscall_gtod_lock : AT AFTER(.vsyscall_gtod_data) { *(.vsyscall_gtod_lock) } + vsyscall_gtod_lock = LOADADDR(.vsyscall_gtod_lock); + + .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT (LOADADDR(.vsyscall_0) + 1024) { *(.vsyscall_1) } . = LOADADDR(.vsyscall_0) + 4096;
arch/x86_64/kernel/vsyscall.c (mode:100644) +104 -30
183 lines not on this page · raw message
include/asm-generic/div64.h (mode:100644) +9 -0
@@ -55,4 +55,13 @@ #endif /* BITS_PER_LONG */ +#ifndef div_long_long_rem +#define div_long_long_rem(dividend,divisor,remainder) \ +({ \ + u64 result = dividend; \ + *remainder = do_div(result,divisor); \ + result; \ +}) +#endif + #endif /* _ASM_GENERIC_DIV64_H */
include/asm-x86_64/hpet.h (mode:100644) +2 -1
@@ -1,6 +1,6 @@ #ifndef _ASM_X8664_HPET_H #define _ASM_X8664_HPET_H 1 - +#include <asm/fixmap.h> /* * Documentation on HPET can be found at: * http://www.intel.com/ial/home/sp/pcmmspec.htm
@@ -44,6 +44,7 @@ #define HPET_TN_SETVAL 0x040 #define HPET_TN_32BIT 0x100 +extern unsigned long hpet_address; /* hpet memory map physical address */ extern int is_hpet_enabled(void); extern int hpet_rtc_timer_init(void); extern int oem_force_hpet_timer(void);
include/asm-x86_64/timeofday.h (mode:100644) renamed from dev/null (tree:6e3d9e6298413e0aed3157cd848724bb12c42554) +4 -0
@@ -0,0 +1,4 @@ +#ifndef _ASM_X86_64_TIMEOFDAY_H +#define _ASM_X86_64_TIMEOFDAY_H +#include <asm-generic/timeofday.h> +#endif
include/asm-x86_64/vsyscall.h (mode:100644) +2 -0
@@ -22,6 +22,8 @@ #define __section_sysctl_vsyscall __attribute__ ((unused, __section__ (".sysctl_vsyscall"), aligned(16))) #define __section_xtime __attribute__ ((unused, __section__ (".xtime"), aligned(16))) #define __section_xtime_lock __attribute__ ((unused, __section__ (".xtime_lock"), aligned(16))) +#define __section_vsyscall_gtod_data __attribute__ ((unused, __section__ (".vsyscall_gtod_data"),aligned(16))) +#define __section_vsyscall_gtod_lock __attribute__ ((unused, __section__ (".vsyscall_gtod_lock"),aligned(16))) #define VXTIME_TSC 1 #define VXTIME_HPET 2
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 new timeofday i386 and x86-64 timesources (v. B0)
Forgot to CC lkml. Resending.
Andrew, All,
This patch implements the time sources shared between i386 and x86-64
(acpi_pm, cyclone, hpet, pit, tsc and tsc-interp). The patch should apply on top of the timeofday-arch-i386_B0.patch as well as the arch- x86-64_B0.patch.
The patch should be fairly straight forward, only adding the new
timesources.
New in this release:
o acpi-pm is now shared w/ x86-64
o Fixed c3_tsc_compensation masking bug
o Fixed bug in tsc-interp found by Nish's soft-timer patch
Andrew, please consider for inclusion for testing into your tree (I'd like to target around end of July for possible inclusion into mainline).
thanks
-john
linux-2.6.12-rc5_timeofday-timesources-i386_B0.patch
====================================================
drivers/acpi/processor_idle.c (mode:100644) +5 -0
@@ -162,6 +162,7 @@ return; } +extern void tsc_c3_compensate(unsigned long usecs); static void acpi_processor_idle (void) {
@@ -309,6 +310,10 @@ t2 = inl(acpi_fadt.xpm_tmr_blk.address); /* Enable bus master arbitration */ acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_DO_NOT_LOCK); + + /* compensate for TSC pause */ + tsc_c3_compensate((((t2-t1)&0xFFFFFF)*286)>>10); + /* Re-enable interrupts */ local_irq_enable(); /* Compute time (ticks) that we were actually asleep */
drivers/timesource/Makefile (mode:100644) +7 -0
@@ -1 +1,8 @@ obj-y += jiffies.o + +obj-$(CONFIG_X86) += tsc.o +obj-$(CONFIG_X86) += i386_pit.o +obj-$(CONFIG_X86) += tsc-interp.o +obj-$(CONFIG_X86_CYCLONE_TIMER) += cyclone.o +obj-$(CONFIG_X86_PM_TIMER) += acpi_pm.o +obj-$(CONFIG_HPET_TIMER) += hpet.o
drivers/timesource/acpi_pm.c (mode:100644) renamed from dev/null (tree:6510fa520bd81763aadda4ba1d3c399aec279e36) +140 -0
140 lines not on this page · raw message
drivers/timesource/cyclone.c (mode:100644) renamed from dev/null (tree:6510fa520bd81763aadda4ba1d3c399aec279e36) +135 -0
135 lines not on this page · raw message
drivers/timesource/hpet.c (mode:100644) renamed from dev/null (tree:6510fa520bd81763aadda4ba1d3c399aec279e36) +59 -0
59 lines not on this page · raw message
drivers/timesource/i386_pit.c (mode:100644) renamed from dev/null (tree:6510fa520bd81763aadda4ba1d3c399aec279e36) +64 -0
64 lines not on this page · raw message
drivers/timesource/tsc-interp.c (mode:100644) renamed from dev/null (tree:6510fa520bd81763aadda4ba1d3c399aec279e36) +112 -0
112 lines not on this page · raw message
drivers/timesource/tsc.c (mode:100644) renamed from dev/null (tree:6510fa520bd81763aadda4ba1d3c399aec279e36) +95 -0
95 lines not on this page · raw message