On Fri, 2007-02-23 at 01:55 -0800, David Miller wrote:Yea. I actually have some in-progress patches from Peter Keilty that convert ia64 and sparc64 time_interpolators to clocksources, then removes the time_interpolator code. The ia64 conversion is more complicated due to the fsyscall asm, but I think the sparc64 conversion (below) is pretty straight forward. I've only built tested this, so I have no clue if it actually works. Any thoughts? thanks -john From: Peter Keilty <peter.keilty@hp.com> Initial sparc64 conversion to generic clocksource/timekeeping code. Signed-off-by: Peter Keilty <peter.keilty@hp.com> Signed-off-by: John Stultz <johnstul@us.ibm.com> Kconfig | 2 +- defconfig | 2 +- kernel/time.c | 34 +++++++++++++++++++++++----------- 3 files changed, 25 insertions(+), 13 deletions(-) linux-2.6.21-rc1_timeofday-arch-sparc64_C7.patch ============================================ diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index f75a686..13a4547 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig @@ -34,7 +34,7 @@ config LOCKDEP_SUPPORT bool default y -config TIME_INTERPOLATION +config GENERIC_TIME bool default y diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig index 0f44a6a..33e061a 100644 --- a/arch/sparc64/defconfig +++ b/arch/sparc64/defconfig @@ -9,7 +9,7 @@ CONFIG_64BIT=y CONFIG_MMU=y CONFIG_STACKTRACE_SUPPORT=y CONFIG_LOCKDEP_SUPPORT=y -CONFIG_TIME_INTERPOLATION=y +CONFIG_GENERIC_TIME=y CONFIG_ARCH_MAY_HAVE_PC_FDC=y # CONFIG_ARCH_HAS_ILOG2_U32 is not set # CONFIG_ARCH_HAS_ILOG2_U64 is not set diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c index f84da4f..497b29b 100644 --- a/arch/sparc64/kernel/time.c +++ b/arch/sparc64/kernel/time.c @@ -31,6 +31,7 @@ #include <linux/percpu.h> #include <linux/profile.h> #include <linux/miscdevice.h> #include <linux/rtc.h> +#include <linux/clocksource.h> #include <asm/oplib.h> #include <asm/mostek.h> @@ -620,7 +621,7 @@ #endif if (!mregs && !dregs) { prom_printf("Something wrong, clock regs not mapped yet.\n"); prom_halt(); - } + } if (mregs) { spin_lock_irq(&mostek_lock); @@ -820,7 +821,7 @@ #endif } set_system_time(); - + local_irq_restore(flags); return 0; @@ -975,22 +976,33 @@ static struct notifier_block sparc64_cpu #endif /* CONFIG_CPU_FREQ */ -static struct time_interpolator sparc64_cpu_interpolator = { - .source = TIME_SOURCE_CPU, - .shift = 16, - .mask = 0xffffffffffffffffLL +static cycle_t read_sparc64_cpuclock(void) +{ + return (cycle_t)get_cycles(); +} + +static struct clocksource clocksource_sparc64_cpuclock = { + .name = "sparc64_cpuclock", + .rating = 300, + .read = read_sparc64_cpuclock, + .mask = 0xffffffffffffffffLL, + .mult = 0, /*to be caluclated*/ + .shift = 16, + .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; + /* The quotient formula is taken from the IA64 port. */ #define SPARC64_NSEC_PER_CYC_SHIFT 10UL void __init time_init(void) { unsigned long clock = sparc64_init_timers(); - sparc64_cpu_interpolator.frequency = clock; - register_time_interpolator(&sparc64_cpu_interpolator); + clocksource_sparc64_cpuclock.mult = clocksource_hz2mult(clock, + clocksource_sparc64_cpuclock.shift); + clocksource_register(&clocksource_sparc64_cpuclock); - /* Now that the interpolator is registered, it is + /* Now that the clocksource is registered, it is * safe to start the timer ticking. */ sparc64_start_timers(); @@ -1025,11 +1037,11 @@ #endif unsigned long flags; u8 tmp; - /* + /* * Not having a register set can lead to trouble. * Also starfire doesn't have a tod clock. */ - if (!mregs && !dregs) + if (!mregs && !dregs) return -1; if (mregs) { -
| Jesse Barnes | Re: [stable] [BUG][PATCH] cpqphp: fix kernel NULL pointer dereference |
| Greg KH | [003/136] p54usb: add Zcomax XG-705A usbid |
| Magnus Damm | [PATCH 03/07] ARM: Use shared GIC entry macros on Realview |
| Oliver Neukum | Re: [Bug #13682] The webcam stopped working when upgrading from 2.6.29 to 2.6.30 |
| Martin Schwidefsky | Re: [PATCH] optimized ktime_get[_ts] for GENERIC_TIME=y |
git: | |
| Junio C Hamano | Re: Some advanced index playing |
| Jeff King | Re: confusion over the new branch and merge config |
| Robin Rosenberg | Re: cvs2svn conversion directly to git ready for experimentation |
| Linus Torvalds |
