2006-10-19 15:19:18

by Guennadi Liakhovetski

[permalink] [raw]
Subject: [PATCH 0/3] Clean up dead code for 2.6.18-rt6

Hi Thomas, Ingo

In the following 3 email I am sending 3 patches, which remove code, that
becomes unused with the rt-patch.

Compile-tested for ARM (which has undergone most changes) (mainstone and
assabet configs) and i386 (defconfig and allmodconfig). Don't
have a possibility to compile it for other platforms (at least here at
work).

Thanks
Guennadi
---------------------------------
Guennadi Liakhovetski, Ph.D.
DSA Daten- und Systemtechnik GmbH
Pascalstr. 28
D-52076 Aachen
Germany


2006-10-19 15:19:37

by Guennadi Liakhovetski

[permalink] [raw]
Subject: [PATCH 2/3] Remove CONFIG_IS_TICK_BASED

Remove the CONFIG_IS_TICK_BASED macro - never set now.

Thanks
Guennadi
---------------------------------
Guennadi Liakhovetski, Ph.D.
DSA Daten- und Systemtechnik GmbH
Pascalstr. 28
D-52076 Aachen
Germany

Signed-off-by: G. Liakhovetski <[email protected]>

diff --exclude=CVS -ur linux-2.6.18-rt6/arch/arm/Kconfig linux-2.6.18-rt6-rmdead/arch/arm/Kconfig
--- linux-2.6.18-rt6/arch/arm/Kconfig 2006-10-19 15:45:37.639189355 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/Kconfig 2006-10-19 15:47:19.259176672 +0200
@@ -360,15 +360,6 @@

source "arch/arm/mach-netx/Kconfig"

-config IS_TICK_BASED
- bool
- depends on GENERIC_TIME
- default y
- help
- This is used on platforms that have not added a clocksource to
- support GENERIC_TIME. Platforms which have a clocksource
- should set this to 'n' in their mach-*/Kconfig.
-
# Definitions to make life easier
config ARCH_ACORN
bool
diff --exclude=CVS -ur linux-2.6.18-rt6/arch/arm/mach-ixp4xx/Kconfig linux-2.6.18-rt6-rmdead/arch/arm/mach-ixp4xx/Kconfig
--- linux-2.6.18-rt6/arch/arm/mach-ixp4xx/Kconfig 2006-10-19 12:29:12.434092798 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-ixp4xx/Kconfig 2006-10-19 15:41:15.375060531 +0200
@@ -1,9 +1,5 @@
if ARCH_IXP4XX

-config IS_TICK_BASED
- bool
- default n
-
config ARCH_SUPPORTS_BIG_ENDIAN
bool
default y
diff --exclude=CVS -ur linux-2.6.18-rt6/arch/arm/mach-versatile/Kconfig linux-2.6.18-rt6-rmdead/arch/arm/mach-versatile/Kconfig
--- linux-2.6.18-rt6/arch/arm/mach-versatile/Kconfig 2006-10-19 12:29:12.437092147 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-versatile/Kconfig 2006-10-19 15:41:29.527991395 +0200
@@ -1,10 +1,6 @@
menu "Versatile platform type"
depends on ARCH_VERSATILE

-config IS_TICK_BASED
- bool
- default n
-
config ARCH_VERSATILE_PB
bool "Support Versatile/PB platform"
default y

2006-10-19 15:19:49

by Guennadi Liakhovetski

[permalink] [raw]
Subject: [PATCH 1/3] Remove gettimeoffset artefacts

Remove now unused gettimeoffset functions. The centrally called
do_gettimeoffset() has disappeared, only a few arch-local users, which
just use their internal specific functions.

Thanks
Guennadi
---------------------------------
Guennadi Liakhovetski, Ph.D.
DSA Daten- und Systemtechnik GmbH
Pascalstr. 28
D-52076 Aachen
Germany

Signed-off-by: G. Liakhovetski <[email protected]>

diff -ur linux-2.6.18-rt6/arch/arm/common/time-acorn.c linux-2.6.18-rt6-rmdead/arch/arm/common/time-acorn.c
--- linux-2.6.18-rt6/arch/arm/common/time-acorn.c 2006-10-19 12:29:12.427094318 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/common/time-acorn.c 2006-10-19 14:29:12.059919944 +0200
@@ -24,41 +24,6 @@

#include <asm/mach/time.h>

-unsigned long ioc_timer_gettimeoffset(void)
-{
- unsigned int count1, count2, status;
- long offset;
-
- ioc_writeb (0, IOC_T0LATCH);
- barrier ();
- count1 = ioc_readb(IOC_T0CNTL) | (ioc_readb(IOC_T0CNTH) << 8);
- barrier ();
- status = ioc_readb(IOC_IRQREQA);
- barrier ();
- ioc_writeb (0, IOC_T0LATCH);
- barrier ();
- count2 = ioc_readb(IOC_T0CNTL) | (ioc_readb(IOC_T0CNTH) << 8);
-
- offset = count2;
- if (count2 < count1) {
- /*
- * We have not had an interrupt between reading count1
- * and count2.
- */
- if (status & (1 << 5))
- offset -= LATCH;
- } else if (count2 > count1) {
- /*
- * We have just had another interrupt between reading
- * count1 and count2.
- */
- offset -= LATCH;
- }
-
- offset = (LATCH - offset) * (tick_nsec / 1000);
- return (offset + LATCH/2) / LATCH;
-}
-
void __init ioctime_init(void)
{
ioc_writeb(LATCH & 255, IOC_T0LTCHL);
@@ -92,6 +57,5 @@

struct sys_timer ioc_timer = {
.init = ioc_timer_init,
- .offset = ioc_timer_gettimeoffset,
};

diff -ur linux-2.6.18-rt6/arch/arm/kernel/time.c linux-2.6.18-rt6-rmdead/arch/arm/kernel/time.c
--- linux-2.6.18-rt6/arch/arm/kernel/time.c 2006-10-19 12:29:12.431093450 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/kernel/time.c 2006-10-19 14:26:46.055617891 +0200
@@ -69,13 +69,6 @@
*/
int (*set_rtc)(void);

-#ifdef CONFIG_IS_TICK_BASED
-static unsigned long dummy_gettimeoffset(void)
-{
- return 0;
-}
-#endif
-
/*
* Scheduler clock - returns current time in nanosec units.
* This is the default implementation. Sub-architecture
@@ -415,10 +408,6 @@

void __init time_init(void)
{
-#ifdef CONFIG_IS_TICK_BASED
- if (system_timer->offset == NULL)
- system_timer->offset = dummy_gettimeoffset;
-#endif
system_timer->init();

#ifdef CONFIG_NO_IDLE_HZ
diff -ur linux-2.6.18-rt6/arch/arm/mach-aaec2000/core.c linux-2.6.18-rt6-rmdead/arch/arm/mach-aaec2000/core.c
--- linux-2.6.18-rt6/arch/arm/mach-aaec2000/core.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-aaec2000/core.c 2006-10-19 15:07:23.693075170 +0200
@@ -108,23 +108,6 @@
/*
* Time keeping
*/
-/* IRQs are disabled before entering here from do_gettimeofday() */
-static unsigned long aaec2000_gettimeoffset(void)
-{
- unsigned long ticks_to_match, elapsed, usec;
-
- /* Get ticks before next timer match */
- ticks_to_match = TIMER1_LOAD - TIMER1_VAL;
-
- /* We need elapsed ticks since last match */
- elapsed = LATCH - ticks_to_match;
-
- /* Now, convert them to usec */
- usec = (unsigned long)(elapsed * (tick_nsec / 1000))/LATCH;
-
- return usec;
-}
-
/* We enter here with IRQs enabled */
static irqreturn_t
aaec2000_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
@@ -166,7 +149,6 @@

struct sys_timer aaec2000_timer = {
.init = aaec2000_timer_init,
- .offset = aaec2000_gettimeoffset,
};

static struct clcd_panel mach_clcd_panel;
diff -ur linux-2.6.18-rt6/arch/arm/mach-at91rm9200/at91rm9200_time.c linux-2.6.18-rt6-rmdead/arch/arm/mach-at91rm9200/at91rm9200_time.c
--- linux-2.6.18-rt6/arch/arm/mach-at91rm9200/at91rm9200_time.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-at91rm9200/at91rm9200_time.c 2006-10-19 15:07:52.832737453 +0200
@@ -48,21 +48,6 @@
}

/*
- * Returns number of microseconds since last timer interrupt. Note that interrupts
- * will have been disabled by do_gettimeofday()
- * 'LATCH' is hwclock ticks (see CLOCK_TICK_RATE in timex.h) per jiffy.
- * 'tick' is usecs per jiffy (linux/timex.h).
- */
-static unsigned long at91rm9200_gettimeoffset(void)
-{
- unsigned long elapsed;
-
- elapsed = (read_CRTR() - last_crtr) & AT91_ST_ALMV;
-
- return (unsigned long)(elapsed * (tick_nsec / 1000)) / LATCH;
-}
-
-/*
* IRQ handler for the timer.
*/
static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
@@ -134,7 +119,6 @@

struct sys_timer at91rm9200_timer = {
.init = at91rm9200_timer_init,
- .offset = at91rm9200_gettimeoffset,
.suspend = at91rm9200_timer_suspend,
.resume = at91rm9200_timer_reset,
};
diff -ur linux-2.6.18-rt6/arch/arm/mach-clps711x/time.c linux-2.6.18-rt6-rmdead/arch/arm/mach-clps711x/time.c
--- linux-2.6.18-rt6/arch/arm/mach-clps711x/time.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-clps711x/time.c 2006-10-19 14:43:49.398037996 +0200
@@ -32,19 +32,6 @@


/*
- * gettimeoffset() returns time since last timer tick, in usecs.
- *
- * 'LATCH' is hwclock ticks (see CLOCK_TICK_RATE in timex.h) per jiffy.
- * 'tick' is usecs per jiffy.
- */
-static unsigned long clps711x_gettimeoffset(void)
-{
- unsigned long hwticks;
- hwticks = LATCH - (clps_readl(TC2D) & 0xffff); /* since last underflow */
- return (hwticks * (tick_nsec / 1000)) / LATCH;
-}
-
-/*
* IRQ handler for the timer
*/
static irqreturn_t
@@ -82,5 +69,4 @@

struct sys_timer clps711x_timer = {
.init = clps711x_timer_init,
- .offset = clps711x_gettimeoffset,
};
diff -ur linux-2.6.18-rt6/arch/arm/mach-clps7500/core.c linux-2.6.18-rt6-rmdead/arch/arm/mach-clps7500/core.c
--- linux-2.6.18-rt6/arch/arm/mach-clps7500/core.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-clps7500/core.c 2006-10-19 14:44:12.426016118 +0200
@@ -289,7 +289,6 @@
}

extern void ioctime_init(void);
-extern unsigned long ioc_timer_gettimeoffset(void);

static irqreturn_t
clps7500_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
@@ -331,7 +330,6 @@

static struct sys_timer clps7500_timer = {
.init = clps7500_timer_init,
- .offset = ioc_timer_gettimeoffset,
};

static struct plat_serial8250_port serial_platform_data[] = {
diff -ur linux-2.6.18-rt6/arch/arm/mach-ebsa110/core.c linux-2.6.18-rt6-rmdead/arch/arm/mach-ebsa110/core.c
--- linux-2.6.18-rt6/arch/arm/mach-ebsa110/core.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-ebsa110/core.c 2006-10-19 15:18:09.346791108 +0200
@@ -142,37 +142,6 @@
*/
#define COUNT ((CLKBY7 + (HZ / 2)) / HZ)

-/*
- * Get the time offset from the system PIT. Note that if we have missed an
- * interrupt, then the PIT counter will roll over (ie, be negative).
- * This actually works out to be convenient.
- */
-static unsigned long ebsa110_gettimeoffset(void)
-{
- unsigned long offset, count;
-
- __raw_writeb(0x40, PIT_CTRL);
- count = __raw_readb(PIT_T1);
- count |= __raw_readb(PIT_T1) << 8;
-
- /*
- * If count > COUNT, make the number negative.
- */
- if (count > COUNT)
- count |= 0xffff0000;
-
- offset = COUNT;
- offset -= count;
-
- /*
- * `offset' is in units of timer counts. Convert
- * offset to units of microseconds.
- */
- offset = offset * (1000000 / HZ) / COUNT;
-
- return offset;
-}
-
static irqreturn_t
ebsa110_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
@@ -220,7 +189,6 @@

static struct sys_timer ebsa110_timer = {
.init = ebsa110_timer_init,
- .offset = ebsa110_gettimeoffset,
};

static struct plat_serial8250_port serial_platform_data[] = {
diff -ur linux-2.6.18-rt6/arch/arm/mach-ep93xx/core.c linux-2.6.18-rt6-rmdead/arch/arm/mach-ep93xx/core.c
--- linux-2.6.18-rt6/arch/arm/mach-ep93xx/core.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-ep93xx/core.c 2006-10-19 14:45:44.727888699 +0200
@@ -133,19 +133,8 @@
setup_irq(IRQ_EP93XX_TIMER1, &ep93xx_timer_irq);
}

-static unsigned long ep93xx_gettimeoffset(void)
-{
- int offset;
-
- offset = __raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time;
-
- /* Calculate (1000000 / 983040) * offset. */
- return offset + (53 * offset / 3072);
-}
-
struct sys_timer ep93xx_timer = {
.init = ep93xx_timer_init,
- .offset = ep93xx_gettimeoffset,
};


diff -ur linux-2.6.18-rt6/arch/arm/mach-footbridge/dc21285-timer.c linux-2.6.18-rt6-rmdead/arch/arm/mach-footbridge/dc21285-timer.c
--- linux-2.6.18-rt6/arch/arm/mach-footbridge/dc21285-timer.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-footbridge/dc21285-timer.c 2006-10-19 14:46:09.807420250 +0200
@@ -20,13 +20,6 @@
*/
static unsigned long timer1_latch;

-static unsigned long timer1_gettimeoffset (void)
-{
- unsigned long value = timer1_latch - *CSR_TIMER1_VALUE;
-
- return ((tick_nsec / 1000) * value) / timer1_latch;
-}
-
static irqreturn_t
timer1_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
@@ -65,5 +58,4 @@

struct sys_timer footbridge_timer = {
.init = footbridge_timer_init,
- .offset = timer1_gettimeoffset,
};
diff -ur linux-2.6.18-rt6/arch/arm/mach-footbridge/isa-timer.c linux-2.6.18-rt6-rmdead/arch/arm/mach-footbridge/isa-timer.c
--- linux-2.6.18-rt6/arch/arm/mach-footbridge/isa-timer.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-footbridge/isa-timer.c 2006-10-19 14:46:36.984494641 +0200
@@ -20,47 +20,6 @@
*/
#define mSEC_10_from_14 ((14318180 + 100) / 200)

-static unsigned long isa_gettimeoffset(void)
-{
- int count;
-
- static int count_p = (mSEC_10_from_14/6); /* for the first call after boot */
- static unsigned long jiffies_p = 0;
-
- /*
- * cache volatile jiffies temporarily; we have IRQs turned off.
- */
- unsigned long jiffies_t;
-
- /* timer count may underflow right here */
- outb_p(0x00, 0x43); /* latch the count ASAP */
-
- count = inb_p(0x40); /* read the latched count */
-
- /*
- * We do this guaranteed double memory access instead of a _p
- * postfix in the previous port access. Wheee, hackady hack
- */
- jiffies_t = jiffies;
-
- count |= inb_p(0x40) << 8;
-
- /* Detect timer underflows. If we haven't had a timer tick since
- the last time we were called, and time is apparently going
- backwards, the counter must have wrapped during this routine. */
- if ((jiffies_t == jiffies_p) && (count > count_p))
- count -= (mSEC_10_from_14/6);
- else
- jiffies_p = jiffies_t;
-
- count_p = count;
-
- count = (((mSEC_10_from_14/6)-1) - count) * (tick_nsec / 1000);
- count = (count + (mSEC_10_from_14/6)/2) / (mSEC_10_from_14/6);
-
- return count;
-}
-
static irqreturn_t
isa_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
@@ -91,5 +50,4 @@

struct sys_timer isa_timer = {
.init = isa_timer_init,
- .offset = isa_gettimeoffset,
};
diff -ur linux-2.6.18-rt6/arch/arm/mach-h720x/common.c linux-2.6.18-rt6-rmdead/arch/arm/mach-h720x/common.c
--- linux-2.6.18-rt6/arch/arm/mach-h720x/common.c 2006-04-05 18:36:16.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-h720x/common.c 2006-10-19 14:47:16.012985340 +0200
@@ -42,15 +42,6 @@
}

/*
- * Return usecs since last timer reload
- * (timercount * (usecs perjiffie)) / (ticks per jiffie)
- */
-unsigned long h720x_gettimeoffset(void)
-{
- return (CPU_REG (TIMER_VIRT, TM0_COUNT) * tick_usec) / LATCH;
-}
-
-/*
* mask Global irq's
*/
static void mask_global_irq (unsigned int irq )
diff -ur linux-2.6.18-rt6/arch/arm/mach-h720x/common.h linux-2.6.18-rt6-rmdead/arch/arm/mach-h720x/common.h
--- linux-2.6.18-rt6/arch/arm/mach-h720x/common.h 2006-04-05 18:00:47.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-h720x/common.h 2006-10-19 15:28:40.784692787 +0200
@@ -13,7 +13,6 @@
*
*/

-extern unsigned long h720x_gettimeoffset(void);
extern void __init h720x_init_irq (void);
extern void __init h720x_map_io(void);

diff -ur linux-2.6.18-rt6/arch/arm/mach-h720x/cpu-h7201.c linux-2.6.18-rt6-rmdead/arch/arm/mach-h720x/cpu-h7201.c
--- linux-2.6.18-rt6/arch/arm/mach-h720x/cpu-h7201.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-h720x/cpu-h7201.c 2006-10-19 14:47:25.656882767 +0200
@@ -60,5 +60,4 @@

struct sys_timer h7201_timer = {
.init = h7201_init_time,
- .offset = h720x_gettimeoffset,
};
diff -ur linux-2.6.18-rt6/arch/arm/mach-h720x/cpu-h7202.c linux-2.6.18-rt6-rmdead/arch/arm/mach-h720x/cpu-h7202.c
--- linux-2.6.18-rt6/arch/arm/mach-h720x/cpu-h7202.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-h720x/cpu-h7202.c 2006-10-19 14:47:33.310214197 +0200
@@ -190,7 +190,6 @@

struct sys_timer h7202_timer = {
.init = h7202_init_time,
- .offset = h720x_gettimeoffset,
};

void __init h7202_init_irq (void)
diff -ur linux-2.6.18-rt6/arch/arm/mach-imx/time.c linux-2.6.18-rt6-rmdead/arch/arm/mach-imx/time.c
--- linux-2.6.18-rt6/arch/arm/mach-imx/time.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-imx/time.c 2006-10-19 14:48:02.768791819 +0200
@@ -25,34 +25,6 @@
#define TIMER_BASE IMX_TIM1_BASE

/*
- * Returns number of us since last clock interrupt. Note that interrupts
- * will have been disabled by do_gettimeoffset()
- */
-static unsigned long imx_gettimeoffset(void)
-{
- unsigned long ticks;
-
- /*
- * Get the current number of ticks. Note that there is a race
- * condition between us reading the timer and checking for
- * an interrupt. We get around this by ensuring that the
- * counter has not reloaded between our two reads.
- */
- ticks = IMX_TCN(TIMER_BASE);
-
- /*
- * Interrupt pending? If so, we've reloaded once already.
- */
- if (IMX_TSTAT(TIMER_BASE) & TSTAT_COMP)
- ticks += LATCH;
-
- /*
- * Convert the ticks to usecs
- */
- return (1000000 / CLK32) * ticks;
-}
-
-/*
* IRQ handler for the timer
*/
static irqreturn_t
@@ -97,5 +69,4 @@

struct sys_timer imx_timer = {
.init = imx_timer_init,
- .offset = imx_gettimeoffset,
};
diff -ur linux-2.6.18-rt6/arch/arm/mach-integrator/common.h linux-2.6.18-rt6-rmdead/arch/arm/mach-integrator/common.h
--- linux-2.6.18-rt6/arch/arm/mach-integrator/common.h 2006-04-05 18:00:47.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-integrator/common.h 2006-10-19 14:48:23.325310354 +0200
@@ -1,2 +1 @@
extern void integrator_time_init(unsigned long, unsigned int);
-extern unsigned long integrator_gettimeoffset(void);
diff -ur linux-2.6.18-rt6/arch/arm/mach-integrator/core.c linux-2.6.18-rt6-rmdead/arch/arm/mach-integrator/core.c
--- linux-2.6.18-rt6/arch/arm/mach-integrator/core.c 2006-10-19 12:29:12.433093016 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-integrator/core.c 2006-10-19 14:48:44.981589253 +0200
@@ -207,44 +207,6 @@
static unsigned long timer_reload;

/*
- * Returns number of ms since last clock interrupt. Note that interrupts
- * will have been disabled by do_gettimeoffset()
- */
-unsigned long integrator_gettimeoffset(void)
-{
- unsigned long ticks1, ticks2, status;
-
- /*
- * Get the current number of ticks. Note that there is a race
- * condition between us reading the timer and checking for
- * an interrupt. We get around this by ensuring that the
- * counter has not reloaded between our two reads.
- */
- ticks2 = readl(TIMER1_VA_BASE + TIMER_VALUE) & 0xffff;
- do {
- ticks1 = ticks2;
- status = __raw_readl(VA_IC_BASE + IRQ_RAW_STATUS);
- ticks2 = readl(TIMER1_VA_BASE + TIMER_VALUE) & 0xffff;
- } while (ticks2 > ticks1);
-
- /*
- * Number of ticks since last interrupt.
- */
- ticks1 = timer_reload - ticks2;
-
- /*
- * Interrupt pending? If so, we've reloaded once already.
- */
- if (status & (1 << IRQ_TIMERINT1))
- ticks1 += timer_reload;
-
- /*
- * Convert the ticks to usecs
- */
- return TICKS2USECS(ticks1);
-}
-
-/*
* IRQ handler for the timer
*/
static irqreturn_t
diff -ur linux-2.6.18-rt6/arch/arm/mach-integrator/integrator_ap.c linux-2.6.18-rt6-rmdead/arch/arm/mach-integrator/integrator_ap.c
--- linux-2.6.18-rt6/arch/arm/mach-integrator/integrator_ap.c 2006-09-25 15:59:04.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-integrator/integrator_ap.c 2006-10-19 14:48:52.783888370 +0200
@@ -341,7 +341,6 @@

static struct sys_timer ap_timer = {
.init = ap_init_timer,
- .offset = integrator_gettimeoffset,
};

MACHINE_START(INTEGRATOR, "ARM-Integrator")
diff -ur linux-2.6.18-rt6/arch/arm/mach-integrator/integrator_cp.c linux-2.6.18-rt6-rmdead/arch/arm/mach-integrator/integrator_cp.c
--- linux-2.6.18-rt6/arch/arm/mach-integrator/integrator_cp.c 2006-09-25 15:59:04.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-integrator/integrator_cp.c 2006-10-19 14:48:59.831352054 +0200
@@ -575,7 +575,6 @@

static struct sys_timer cp_timer = {
.init = intcp_timer_init,
- .offset = integrator_gettimeoffset,
};

MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
diff -ur linux-2.6.18-rt6/arch/arm/mach-iop3xx/iop321-time.c linux-2.6.18-rt6-rmdead/arch/arm/mach-iop3xx/iop321-time.c
--- linux-2.6.18-rt6/arch/arm/mach-iop3xx/iop321-time.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-iop3xx/iop321-time.c 2006-10-19 14:49:23.051290311 +0200
@@ -33,37 +33,6 @@
return LATCH - *IOP321_TU_TCR0;
}

-static unsigned long iop321_gettimeoffset(void)
-{
- unsigned long elapsed, usec;
- u32 tisr1, tisr2;
-
- /*
- * If an interrupt was pending before we read the timer,
- * we've already wrapped. Factor this into the time.
- * If an interrupt was pending after we read the timer,
- * it may have wrapped between checking the interrupt
- * status and reading the timer. Re-read the timer to
- * be sure its value is after the wrap.
- */
-
- asm volatile("mrc p6, 0, %0, c6, c1, 0" : "=r" (tisr1));
- elapsed = get_elapsed();
- asm volatile("mrc p6, 0, %0, c6, c1, 0" : "=r" (tisr2));
-
- if(tisr1 & 1)
- elapsed += LATCH;
- else if (tisr2 & 1)
- elapsed = LATCH + get_elapsed();
-
- /*
- * Now convert them to usec.
- */
- usec = (unsigned long)(elapsed / (CLOCK_TICK_RATE/1000000));
-
- return usec;
-}
-
static irqreturn_t
iop321_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
@@ -104,5 +73,4 @@

struct sys_timer iop321_timer = {
.init = &iop321_timer_init,
- .offset = iop321_gettimeoffset,
};
diff -ur linux-2.6.18-rt6/arch/arm/mach-iop3xx/iop331-time.c linux-2.6.18-rt6-rmdead/arch/arm/mach-iop3xx/iop331-time.c
--- linux-2.6.18-rt6/arch/arm/mach-iop3xx/iop331-time.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-iop3xx/iop331-time.c 2006-10-19 14:50:08.256436386 +0200
@@ -31,37 +31,6 @@
return LATCH - *IOP331_TU_TCR0;
}

-static unsigned long iop331_gettimeoffset(void)
-{
- unsigned long elapsed, usec;
- u32 tisr1, tisr2;
-
- /*
- * If an interrupt was pending before we read the timer,
- * we've already wrapped. Factor this into the time.
- * If an interrupt was pending after we read the timer,
- * it may have wrapped between checking the interrupt
- * status and reading the timer. Re-read the timer to
- * be sure its value is after the wrap.
- */
-
- asm volatile("mrc p6, 0, %0, c6, c1, 0" : "=r" (tisr1));
- elapsed = get_elapsed();
- asm volatile("mrc p6, 0, %0, c6, c1, 0" : "=r" (tisr2));
-
- if(tisr1 & 1)
- elapsed += LATCH;
- else if (tisr2 & 1)
- elapsed = LATCH + get_elapsed();
-
- /*
- * Now convert them to usec.
- */
- usec = (unsigned long)(elapsed / (CLOCK_TICK_RATE/1000000));
-
- return usec;
-}
-
static irqreturn_t
iop331_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
@@ -102,5 +71,4 @@

struct sys_timer iop331_timer = {
.init = iop331_timer_init,
- .offset = iop331_gettimeoffset,
};
diff -ur linux-2.6.18-rt6/arch/arm/mach-ixp2000/core.c linux-2.6.18-rt6-rmdead/arch/arm/mach-ixp2000/core.c
--- linux-2.6.18-rt6/arch/arm/mach-ixp2000/core.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-ixp2000/core.c 2006-10-19 14:50:35.495499009 +0200
@@ -195,15 +195,6 @@
static unsigned next_jiffy_time;
static volatile unsigned long *missing_jiffy_timer_csr;

-unsigned long ixp2000_gettimeoffset (void)
-{
- unsigned long offset;
-
- offset = next_jiffy_time - *missing_jiffy_timer_csr;
-
- return offset / ticks_per_usec;
-}
-
static int ixp2000_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
write_seqlock(&xtime_lock);
diff -ur linux-2.6.18-rt6/arch/arm/mach-ixp2000/enp2611.c linux-2.6.18-rt6-rmdead/arch/arm/mach-ixp2000/enp2611.c
--- linux-2.6.18-rt6/arch/arm/mach-ixp2000/enp2611.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-ixp2000/enp2611.c 2006-10-19 14:50:42.157047001 +0200
@@ -58,7 +58,6 @@

static struct sys_timer enp2611_timer = {
.init = enp2611_timer_init,
- .offset = ixp2000_gettimeoffset,
};


diff -ur linux-2.6.18-rt6/arch/arm/mach-ixp2000/ixdp2400.c linux-2.6.18-rt6-rmdead/arch/arm/mach-ixp2000/ixdp2400.c
--- linux-2.6.18-rt6/arch/arm/mach-ixp2000/ixdp2400.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-ixp2000/ixdp2400.c 2006-10-19 14:50:54.847280960 +0200
@@ -57,7 +57,6 @@

static struct sys_timer ixdp2400_timer = {
.init = ixdp2400_timer_init,
- .offset = ixp2000_gettimeoffset,
};

/*************************************************************************
diff -ur linux-2.6.18-rt6/arch/arm/mach-ixp2000/ixdp2800.c linux-2.6.18-rt6-rmdead/arch/arm/mach-ixp2000/ixdp2800.c
--- linux-2.6.18-rt6/arch/arm/mach-ixp2000/ixdp2800.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-ixp2000/ixdp2800.c 2006-10-19 14:51:04.340211852 +0200
@@ -52,7 +52,6 @@

static struct sys_timer ixdp2800_timer = {
.init = ixdp2800_timer_init,
- .offset = ixp2000_gettimeoffset,
};

/*************************************************************************
diff -ur linux-2.6.18-rt6/arch/arm/mach-ixp2000/ixdp2x01.c linux-2.6.18-rt6-rmdead/arch/arm/mach-ixp2000/ixdp2x01.c
--- linux-2.6.18-rt6/arch/arm/mach-ixp2000/ixdp2x01.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-ixp2000/ixdp2x01.c 2006-10-19 14:51:15.971676656 +0200
@@ -240,7 +240,6 @@

static struct sys_timer ixdp2x01_timer = {
.init = ixdp2x01_timer_init,
- .offset = ixp2000_gettimeoffset,
};

/*************************************************************************
diff -ur linux-2.6.18-rt6/arch/arm/mach-ixp23xx/core.c linux-2.6.18-rt6-rmdead/arch/arm/mach-ixp23xx/core.c
--- linux-2.6.18-rt6/arch/arm/mach-ixp23xx/core.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-ixp23xx/core.c 2006-10-19 14:52:07.662410549 +0200
@@ -337,16 +337,6 @@

static unsigned long next_jiffy_time;

-static unsigned long
-ixp23xx_gettimeoffset(void)
-{
- unsigned long elapsed;
-
- elapsed = *IXP23XX_TIMER_CONT - (next_jiffy_time - LATCH);
-
- return elapsed / CLOCK_TICKS_PER_USEC;
-}
-
static irqreturn_t
ixp23xx_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
@@ -384,7 +374,6 @@

struct sys_timer ixp23xx_timer = {
.init = ixp23xx_init_timer,
- .offset = ixp23xx_gettimeoffset,
};


diff -ur linux-2.6.18-rt6/arch/arm/mach-netx/time.c linux-2.6.18-rt6-rmdead/arch/arm/mach-netx/time.c
--- linux-2.6.18-rt6/arch/arm/mach-netx/time.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-netx/time.c 2006-10-19 14:52:33.803713256 +0200
@@ -26,15 +26,6 @@
#include <asm/arch/netx-regs.h>

/*
- * Returns number of us since last clock interrupt. Note that interrupts
- * will have been disabled by do_gettimeoffset()
- */
-static unsigned long netx_gettimeoffset(void)
-{
- return readl(NETX_GPIO_COUNTER_CURRENT(0)) / 100;
-}
-
-/*
* IRQ handler for the timer
*/
static irqreturn_t
@@ -84,5 +75,4 @@

struct sys_timer netx_timer = {
.init = netx_timer_init,
- .offset = netx_gettimeoffset,
};
diff -ur linux-2.6.18-rt6/arch/arm/mach-omap1/time.c linux-2.6.18-rt6-rmdead/arch/arm/mach-omap1/time.c
--- linux-2.6.18-rt6/arch/arm/mach-omap1/time.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-omap1/time.c 2006-10-19 14:53:28.981688206 +0200
@@ -145,17 +145,6 @@
static unsigned long omap_mpu_timer_last = 0;

/*
- * Returns elapsed usecs since last system timer interrupt
- */
-static unsigned long omap_mpu_timer_gettimeoffset(void)
-{
- unsigned long now = 0 - omap_mpu_timer_read(0);
- unsigned long elapsed = now - omap_mpu_timer_last;
-
- return omap_mpu_timer_ticks_to_usecs(elapsed);
-}
-
-/*
* Elapsed time between interrupts is calculated using timer0.
* Latency during the interrupt is calculated using timer1.
* Both timer0 and timer1 are counting at 6MHz (P2 6.5MHz).
@@ -198,7 +187,6 @@
static __init void omap_init_mpu_timer(void)
{
set_cyc2ns_scale(MPU_TICKS_PER_SEC / 1000);
- omap_timer.offset = omap_mpu_timer_gettimeoffset;
setup_irq(INT_TIMER1, &omap_mpu_timer1_irq);
setup_irq(INT_TIMER2, &omap_mpu_timer_irq);
omap_mpu_timer_start(0, 0xffffffff);
@@ -232,5 +220,4 @@

struct sys_timer omap_timer = {
.init = omap_timer_init,
- .offset = NULL, /* Initialized later */
};
diff -ur linux-2.6.18-rt6/arch/arm/mach-pnx4008/time.c linux-2.6.18-rt6-rmdead/arch/arm/mach-pnx4008/time.c
--- linux-2.6.18-rt6/arch/arm/mach-pnx4008/time.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-pnx4008/time.c 2006-10-19 15:19:56.104609385 +0200
@@ -34,18 +34,6 @@
/*! Note: all timers are UPCOUNTING */

/*!
- * Returns number of us since last clock interrupt. Note that interrupts
- * will have been disabled by do_gettimeoffset()
- */
-static unsigned long pnx4008_gettimeoffset(void)
-{
- u32 ticks_to_match =
- __raw_readl(HSTIM_MATCH0) - __raw_readl(HSTIM_COUNTER);
- u32 elapsed = LATCH - ticks_to_match;
- return (elapsed * (tick_nsec / 1000)) / LATCH;
-}
-
-/*!
* IRQ handler for the timer
*/
static irqreturn_t pnx4008_timer_interrupt(int irq, void *dev_id,
@@ -132,7 +120,6 @@

struct sys_timer pnx4008_timer = {
.init = pnx4008_setup_timer,
- .offset = pnx4008_gettimeoffset,
.suspend = pnx4008_timer_suspend,
.resume = pnx4008_timer_resume,
};
diff -ur linux-2.6.18-rt6/arch/arm/mach-pxa/time.c linux-2.6.18-rt6-rmdead/arch/arm/mach-pxa/time.c
--- linux-2.6.18-rt6/arch/arm/mach-pxa/time.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-pxa/time.c 2006-10-19 14:54:32.606828929 +0200
@@ -48,27 +48,6 @@
return 0;
}

-/* IRQs are disabled before entering here from do_gettimeofday() */
-static unsigned long pxa_gettimeoffset (void)
-{
- long ticks_to_match, elapsed, usec;
-
- /* Get ticks before next timer match */
- ticks_to_match = OSMR0 - OSCR;
-
- /* We need elapsed ticks since last match */
- elapsed = LATCH - ticks_to_match;
-
- /* don't get fooled by the workaround in pxa_timer_interrupt() */
- if (elapsed <= 0)
- return 0;
-
- /* Now convert them to usec */
- usec = (unsigned long)(elapsed * (tick_nsec / 1000))/LATCH;
-
- return usec;
-}
-
#ifdef CONFIG_NO_IDLE_HZ
static unsigned long initial_match;
static int match_posponed;
@@ -210,7 +189,6 @@
.init = pxa_timer_init,
.suspend = pxa_timer_suspend,
.resume = pxa_timer_resume,
- .offset = pxa_gettimeoffset,
#ifdef CONFIG_NO_IDLE_HZ
.dyn_tick = &pxa_dyn_tick,
#endif
diff -ur linux-2.6.18-rt6/arch/arm/mach-realview/core.c linux-2.6.18-rt6-rmdead/arch/arm/mach-realview/core.c
--- linux-2.6.18-rt6/arch/arm/mach-realview/core.c 2006-10-19 14:38:48.492672933 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-realview/core.c 2006-10-19 13:32:32.108305675 +0200
@@ -475,7 +475,7 @@
* Returns number of ms since last clock interrupt. Note that interrupts
* will have been disabled by do_gettimeoffset()
*/
-static unsigned long realview_gettimeoffset(void)
+unsigned long realview_gettimeoffset(void)
{
unsigned long ticks1, ticks2, status;

@@ -580,5 +580,4 @@

struct sys_timer realview_timer = {
.init = realview_timer_init,
- .offset = realview_gettimeoffset,
};
diff -ur linux-2.6.18-rt6/arch/arm/mach-realview/CVS/Entries linux-2.6.18-rt6-rmdead/arch/arm/mach-realview/CVS/Entries
--- linux-2.6.18-rt6/arch/arm/mach-realview/CVS/Entries 2006-10-19 14:39:44.670417102 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-realview/CVS/Entries 2006-10-19 12:24:41.227974314 +0200
@@ -3,11 +3,11 @@
/Makefile.boot/1.1.1.1/Wed Apr 5 16:36:16 2006/-ko/Tlinux-2_6_18
/clock.c/1.1.1.2/Wed Apr 5 16:44:00 2006/-ko/Tlinux-2_6_18
/clock.h/1.1.1.1/Wed Apr 5 16:36:16 2006/-ko/Tlinux-2_6_18
+/core.c/1.1.1.4/Tue Aug 15 07:21:18 2006/-ko/Tlinux-2_6_18
/core.h/1.1.1.2/Wed Apr 5 16:44:00 2006/-ko/Tlinux-2_6_18
/headsmp.S/1.1.1.1/Wed Apr 5 16:36:16 2006/-ko/Tlinux-2_6_18
/hotplug.c/1.1.1.1/Wed Apr 5 16:36:16 2006/-ko/Tlinux-2_6_18
+/localtimer.c/1.1.1.2/Wed Apr 5 16:44:00 2006/-ko/Tlinux-2_6_18
/platsmp.c/1.1.1.2/Wed Apr 5 16:44:00 2006/-ko/Tlinux-2_6_18
/realview_eb.c/1.1.1.4/Tue Aug 15 07:21:18 2006/-ko/Tlinux-2_6_18
-/core.c/1.1.1.4/Thu Oct 19 12:38:48 2006/-ko/Tlinux-2_6_18
-/localtimer.c/1.1.1.2/Thu Oct 19 12:39:44 2006/-ko/Tlinux-2_6_18
D
diff -ur linux-2.6.18-rt6/arch/arm/mach-realview/localtimer.c linux-2.6.18-rt6-rmdead/arch/arm/mach-realview/localtimer.c
--- linux-2.6.18-rt6/arch/arm/mach-realview/localtimer.c 2006-10-19 14:39:44.670417102 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-realview/localtimer.c 2006-10-19 15:21:12.397043382 +0200
@@ -27,6 +27,8 @@

static unsigned long mpcore_timer_rate;

+extern unsigned long realview_gettimeoffset(void);
+
/*
* local_timer_ack: checks for a local timer interrupt.
*
@@ -108,7 +110,7 @@
*
* so the multiply value will be less than 10^9 always.
*/
- load = (system_timer->offset() * (mpcore_timer_rate / 10000)) / 100;
+ load = (realview_gettimeoffset() * (mpcore_timer_rate / 10000)) / 100;

/* Add on our offset to get the load value */
load = (load + offset) % (mpcore_timer_rate / HZ);
diff -ur linux-2.6.18-rt6/arch/arm/mach-s3c2410/time.c linux-2.6.18-rt6-rmdead/arch/arm/mach-s3c2410/time.c
--- linux-2.6.18-rt6/arch/arm/mach-s3c2410/time.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-s3c2410/time.c 2006-10-19 15:29:01.616175635 +0200
@@ -85,44 +85,6 @@
return res >> TIMER_USEC_SHIFT;
}

-/***
- * Returns microsecond since last clock interrupt. Note that interrupts
- * will have been disabled by do_gettimeoffset()
- * IRQs are disabled before entering here from do_gettimeofday()
- */
-
-#define SRCPND_TIMER4 (1<<(IRQ_TIMER4 - IRQ_EINT0))
-
-static unsigned long s3c2410_gettimeoffset (void)
-{
- unsigned long tdone;
- unsigned long irqpend;
- unsigned long tval;
-
- /* work out how many ticks have gone since last timer interrupt */
-
- tval = __raw_readl(S3C2410_TCNTO(4));
- tdone = timer_startval - tval;
-
- /* check to see if there is an interrupt pending */
-
- irqpend = __raw_readl(S3C2410_SRCPND);
- if (irqpend & SRCPND_TIMER4) {
- /* re-read the timer, and try and fix up for the missed
- * interrupt. Note, the interrupt may go off before the
- * timer has re-loaded from wrapping.
- */
-
- tval = __raw_readl(S3C2410_TCNTO(4));
- tdone = timer_startval - tval;
-
- if (tval != 0)
- tdone += timer_startval;
- }
-
- return timer_ticks_to_usec(tdone);
-}
-

/*
* IRQ handler for the timer
@@ -257,6 +219,5 @@

struct sys_timer s3c24xx_timer = {
.init = s3c2410_timer_init,
- .offset = s3c2410_gettimeoffset,
.resume = s3c2410_timer_setup
};
diff -ur linux-2.6.18-rt6/arch/arm/mach-sa1100/time.c linux-2.6.18-rt6-rmdead/arch/arm/mach-sa1100/time.c
--- linux-2.6.18-rt6/arch/arm/mach-sa1100/time.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/mach-sa1100/time.c 2006-10-19 14:56:42.230621965 +0200
@@ -54,23 +54,6 @@
return 0;
}

-/* IRQs are disabled before entering here from do_gettimeofday() */
-static unsigned long sa1100_gettimeoffset (void)
-{
- unsigned long ticks_to_match, elapsed, usec;
-
- /* Get ticks before next timer match */
- ticks_to_match = OSMR0 - OSCR;
-
- /* We need elapsed ticks since last match */
- elapsed = LATCH - ticks_to_match;
-
- /* Now convert them to usec */
- usec = (unsigned long)(elapsed * (tick_nsec / 1000))/LATCH;
-
- return usec;
-}
-
#ifdef CONFIG_NO_IDLE_HZ
static unsigned long initial_match;
static int match_posponed;
@@ -205,7 +188,6 @@
.init = sa1100_timer_init,
.suspend = sa1100_timer_suspend,
.resume = sa1100_timer_resume,
- .offset = sa1100_gettimeoffset,
#ifdef CONFIG_NO_IDLE_HZ
.dyn_tick = &sa1100_dyn_tick,
#endif
diff -ur linux-2.6.18-rt6/arch/arm/plat-omap/timer32k.c linux-2.6.18-rt6-rmdead/arch/arm/plat-omap/timer32k.c
--- linux-2.6.18-rt6/arch/arm/plat-omap/timer32k.c 2006-08-15 09:21:18.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/arm/plat-omap/timer32k.c 2006-10-19 14:57:06.838267505 +0200
@@ -169,15 +169,6 @@
static unsigned long omap_32k_last_tick = 0;

/*
- * Returns elapsed usecs since last 32k timer interrupt
- */
-static unsigned long omap_32k_timer_gettimeoffset(void)
-{
- unsigned long now = omap_32k_sync_timer_read();
- return omap_32k_ticks_to_usecs(now - omap_32k_last_tick);
-}
-
-/*
* Returns current time from boot in nsecs. It's OK for this to wrap
* around for now, as it's just a relative time stamp.
*/
@@ -270,7 +261,6 @@

if (cpu_class_is_omap1())
setup_irq(INT_OS_TIMER, &omap_32k_timer_irq);
- omap_timer.offset = omap_32k_timer_gettimeoffset;
omap_32k_last_tick = omap_32k_sync_timer_read();

#ifdef CONFIG_ARCH_OMAP2
diff -ur linux-2.6.18-rt6/arch/mips/au1000/common/time.c linux-2.6.18-rt6-rmdead/arch/mips/au1000/common/time.c
--- linux-2.6.18-rt6/arch/mips/au1000/common/time.c 2006-08-15 09:21:21.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/mips/au1000/common/time.c 2006-10-19 13:59:46.496298726 +0200
@@ -313,76 +313,6 @@
return r0;
}

-static unsigned long do_fast_cp0_gettimeoffset(void)
-{
- u32 count;
- unsigned long res, tmp;
- unsigned long r0;
-
- /* Last jiffy when do_fast_gettimeoffset() was called. */
- static unsigned long last_jiffies=0;
- unsigned long quotient;
-
- /*
- * Cached "1/(clocks per usec)*2^32" value.
- * It has to be recalculated once each jiffy.
- */
- static unsigned long cached_quotient=0;
-
- tmp = jiffies;
-
- quotient = cached_quotient;
-
- if (tmp && last_jiffies != tmp) {
- last_jiffies = tmp;
- if (last_jiffies != 0) {
- r0 = div64_32(timerhi, timerlo, tmp);
- quotient = div64_32(USECS_PER_JIFFY, USECS_PER_JIFFY_FRAC, r0);
- cached_quotient = quotient;
- }
- }
-
- /* Get last timer tick in absolute kernel time */
- count = read_c0_count();
-
- /* .. relative to previous jiffy (32 bits is enough) */
- count -= timerlo;
-
- __asm__("multu\t%1,%2\n\t"
- "mfhi\t%0"
- : "=r" (res)
- : "r" (count), "r" (quotient)
- : "hi", "lo", GCC_REG_ACCUM);
-
- /*
- * Due to possible jiffies inconsistencies, we need to check
- * the result so that we'll get a timer that is monotonic.
- */
- if (res >= USECS_PER_JIFFY)
- res = USECS_PER_JIFFY-1;
-
- return res;
-}
-
-#ifdef CONFIG_PM
-static unsigned long do_fast_pm_gettimeoffset(void)
-{
- unsigned long pc0;
- unsigned long offset;
-
- pc0 = au_readl(SYS_TOYREAD);
- au_sync();
- offset = pc0 - last_pc0;
- if (offset > 2*MATCH20_INC) {
- printk("huge offset %x, last_pc0 %x last_match20 %x pc0 %x\n",
- (unsigned)offset, (unsigned)last_pc0,
- (unsigned)last_match20, (unsigned)pc0);
- }
- offset = (unsigned long)((offset * 305) / 10);
- return offset;
-}
-#endif
-
void __init plat_timer_setup(struct irqaction *irq)
{
unsigned int est_freq;
@@ -420,7 +350,6 @@
unsigned int c0_status;

printk("WARNING: no 32KHz clock found.\n");
- do_gettimeoffset = do_fast_cp0_gettimeoffset;

/* Ensure we get CPO_COUNTER interrupts.
*/
@@ -445,19 +374,10 @@
while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20);
startup_match20_interrupt(counter0_irq);

- do_gettimeoffset = do_fast_pm_gettimeoffset;
-
/* We can use the real 'wait' instruction.
*/
allow_au1k_wait = 1;
}
-
-#else
- /* We have to do this here instead of in timer_init because
- * the generic code in arch/mips/kernel/time.c will write
- * over our function pointer.
- */
- do_gettimeoffset = do_fast_cp0_gettimeoffset;
#endif
}

diff -ur linux-2.6.18-rt6/arch/mips/jmr3927/rbhma3100/setup.c linux-2.6.18-rt6-rmdead/arch/mips/jmr3927/rbhma3100/setup.c
--- linux-2.6.18-rt6/arch/mips/jmr3927/rbhma3100/setup.c 2006-08-15 09:21:21.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/mips/jmr3927/rbhma3100/setup.c 2006-10-19 15:31:43.797007590 +0200
@@ -183,12 +183,8 @@
#endif
}

-unsigned long jmr3927_do_gettimeoffset(void);
-
void __init plat_timer_setup(struct irqaction *irq)
{
- do_gettimeoffset = jmr3927_do_gettimeoffset;
-
jmr3927_tmrptr->cpra = JMR3927_TIMER_CLK / HZ;
jmr3927_tmrptr->itmr = TXx927_TMTITMR_TIIE | TXx927_TMTITMR_TZCE;
jmr3927_tmrptr->ccdr = JMR3927_TIMER_CCD;
@@ -200,34 +196,6 @@

#define USECS_PER_JIFFY (1000000/HZ)

-unsigned long jmr3927_do_gettimeoffset(void)
-{
- unsigned long count;
- unsigned long res = 0;
-
- /* MUST read TRR before TISR. */
- count = jmr3927_tmrptr->trr;
-
- if (jmr3927_tmrptr->tisr & TXx927_TMTISR_TIIS) {
- /* timer interrupt is pending. use Max value. */
- res = USECS_PER_JIFFY - 1;
- } else {
- /* convert to usec */
- /* res = count / (JMR3927_TIMER_CLK / 1000000); */
- res = (count << 7) / ((JMR3927_TIMER_CLK << 7) / 1000000);
-
- /*
- * Due to possible jiffies inconsistencies, we need to check
- * the result so that we'll get a timer that is monotonic.
- */
- if (res >= USECS_PER_JIFFY)
- res = USECS_PER_JIFFY-1;
- }
-
- return res;
-}
-
-
//#undef DO_WRITE_THROUGH
#define DO_WRITE_THROUGH
#define DO_ENABLE_CACHE
diff -ur linux-2.6.18-rt6/arch/mips/kernel/time.c linux-2.6.18-rt6-rmdead/arch/mips/kernel/time.c
--- linux-2.6.18-rt6/arch/mips/kernel/time.c 2006-10-19 12:29:12.498078907 +0200
+++ linux-2.6.18-rt6-rmdead/arch/mips/kernel/time.c 2006-10-19 15:33:46.664364165 +0200
@@ -219,163 +219,11 @@
void (*mips_hpt_init)(unsigned int);

/*
- * Gettimeoffset routines. These routines returns the time duration
- * since last timer interrupt in usecs.
- *
- * If the exact CPU counter frequency is known, use fixed_rate_gettimeoffset.
- * Otherwise use calibrate_gettimeoffset()
- *
- * If the CPU does not have the counter register, you can either supply
- * your own gettimeoffset() routine, or use null_gettimeoffset(), which
- * gives the same resolution as HZ.
- */
-
-static unsigned long null_gettimeoffset(void)
-{
- return 0;
-}
-
-/* The function pointer to one of the gettimeoffset funcs. */
-unsigned long (*do_gettimeoffset)(void) = null_gettimeoffset;
-
-static unsigned long fixed_rate_gettimeoffset(void)
-{
- u32 count;
- unsigned long res;
-
- /* Get last timer tick in absolute kernel time */
- count = mips_hpt_read();
-
- /* .. relative to previous jiffy (32 bits is enough) */
- count -= timerlo;
-
- __asm__("multu %1,%2"
- : "=h" (res)
- : "r" (count), "r" (sll32_usecs_per_cycle)
- : "lo", GCC_REG_ACCUM);
-
- /*
- * Due to possible jiffies inconsistencies, we need to check
- * the result so that we'll get a timer that is monotonic.
- */
- if (res >= USECS_PER_JIFFY)
- res = USECS_PER_JIFFY - 1;
-
- return res;
-}
-
-
-/*
* Cached "1/(clocks per usec) * 2^32" value.
* It has to be recalculated once each jiffy.
*/
static unsigned long cached_quotient;

-/* Last jiffy when calibrate_divXX_gettimeoffset() was called. */
-static unsigned long last_jiffies;
-
-/*
- * This is moved from dec/time.c:do_ioasic_gettimeoffset() by Maciej.
- */
-static unsigned long calibrate_div32_gettimeoffset(void)
-{
- u32 count;
- unsigned long res, tmp;
- unsigned long quotient;
-
- tmp = jiffies;
-
- quotient = cached_quotient;
-
- if (last_jiffies != tmp) {
- last_jiffies = tmp;
- if (last_jiffies != 0) {
- unsigned long r0;
- do_div64_32(r0, timerhi, timerlo, tmp);
- do_div64_32(quotient, USECS_PER_JIFFY,
- USECS_PER_JIFFY_FRAC, r0);
- cached_quotient = quotient;
- }
- }
-
- /* Get last timer tick in absolute kernel time */
- count = mips_hpt_read();
-
- /* .. relative to previous jiffy (32 bits is enough) */
- count -= timerlo;
-
- __asm__("multu %1,%2"
- : "=h" (res)
- : "r" (count), "r" (quotient)
- : "lo", GCC_REG_ACCUM);
-
- /*
- * Due to possible jiffies inconsistencies, we need to check
- * the result so that we'll get a timer that is monotonic.
- */
- if (res >= USECS_PER_JIFFY)
- res = USECS_PER_JIFFY - 1;
-
- return res;
-}
-
-static unsigned long calibrate_div64_gettimeoffset(void)
-{
- u32 count;
- unsigned long res, tmp;
- unsigned long quotient;
-
- tmp = jiffies;
-
- quotient = cached_quotient;
-
- if (last_jiffies != tmp) {
- last_jiffies = tmp;
- if (last_jiffies) {
- unsigned long r0;
- __asm__(".set push\n\t"
- ".set mips3\n\t"
- "lwu %0,%3\n\t"
- "dsll32 %1,%2,0\n\t"
- "or %1,%1,%0\n\t"
- "ddivu $0,%1,%4\n\t"
- "mflo %1\n\t"
- "dsll32 %0,%5,0\n\t"
- "or %0,%0,%6\n\t"
- "ddivu $0,%0,%1\n\t"
- "mflo %0\n\t"
- ".set pop"
- : "=&r" (quotient), "=&r" (r0)
- : "r" (timerhi), "m" (timerlo),
- "r" (tmp), "r" (USECS_PER_JIFFY),
- "r" (USECS_PER_JIFFY_FRAC)
- : "hi", "lo", GCC_REG_ACCUM);
- cached_quotient = quotient;
- }
- }
-
- /* Get last timer tick in absolute kernel time */
- count = mips_hpt_read();
-
- /* .. relative to previous jiffy (32 bits is enough) */
- count -= timerlo;
-
- __asm__("multu %1,%2"
- : "=h" (res)
- : "r" (count), "r" (quotient)
- : "lo", GCC_REG_ACCUM);
-
- /*
- * Due to possible jiffies inconsistencies, we need to check
- * the result so that we'll get a timer that is monotonic.
- */
- if (res >= USECS_PER_JIFFY)
- res = USECS_PER_JIFFY - 1;
-
- return res;
-}
-
-
/* last time when xtime and rtc are sync'ed up */
static long last_rtc_update;

@@ -589,9 +437,8 @@
* (only needed if you intended to use fixed_rate_gettimeoffset
* or use cpu counter as timer interrupt source)
* 2) setup xtime based on rtc_get_time().
- * 3) choose a appropriate gettimeoffset routine.
- * 4) calculate a couple of cached variables for later usage
- * 5) plat_timer_setup() -
+ * 3) calculate a couple of cached variables for later usage
+ * 4) plat_timer_setup() -
* a) (optional) over-write any choices made above by time_init().
* b) machine specific code should setup the timer irqaction.
* c) enable the timer interrupt
@@ -679,21 +526,6 @@
mips_hpt_read = c0_hpt_read;
mips_hpt_init = c0_hpt_init;
}
-
- if (cpu_has_mips32r1 || cpu_has_mips32r2 ||
- (current_cpu_data.isa_level == MIPS_CPU_ISA_I) ||
- (current_cpu_data.isa_level == MIPS_CPU_ISA_II))
- /*
- * We need to calibrate the counter but we don't have
- * 64-bit division.
- */
- do_gettimeoffset = calibrate_div32_gettimeoffset;
- else
- /*
- * We need to calibrate the counter but we *do* have
- * 64-bit division.
- */
- do_gettimeoffset = calibrate_div64_gettimeoffset;
} else {
/* We know counter frequency. Or we can get it. */
if (!mips_hpt_read) {
@@ -711,8 +543,6 @@
if (!mips_hpt_frequency)
mips_hpt_frequency = calibrate_hpt();

- do_gettimeoffset = fixed_rate_gettimeoffset;
-
/* Calculate cache parameters. */
cycles_per_jiffy = (mips_hpt_frequency + HZ / 2) / HZ;

diff -ur linux-2.6.18-rt6/arch/mips/sgi-ip27/ip27-timer.c linux-2.6.18-rt6-rmdead/arch/mips/sgi-ip27/ip27-timer.c
--- linux-2.6.18-rt6/arch/mips/sgi-ip27/ip27-timer.c 2006-08-15 09:21:22.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/mips/sgi-ip27/ip27-timer.c 2006-10-19 14:03:29.438886621 +0200
@@ -136,13 +136,6 @@
irq_exit();
}

-unsigned long ip27_do_gettimeoffset(void)
-{
- unsigned long ct_cur1;
- ct_cur1 = REMOTE_HUB_L(cputonasid(0), PI_RT_COUNT) + CYCLES_PER_JIFFY;
- return (ct_cur1 - ct_cur[0]) * NSEC_PER_CYCLE / 1000;
-}
-
/* Includes for ioc3_init(). */
#include <asm/sn/types.h>
#include <asm/sn/sn0/addrs.h>
@@ -254,8 +247,6 @@
{
xtime.tv_sec = get_m48t35_time();
xtime.tv_nsec = 0;
-
- do_gettimeoffset = ip27_do_gettimeoffset;
}

void __init cpu_time_init(void)
diff -ur linux-2.6.18-rt6/arch/mips/sibyte/bcm1480/time.c linux-2.6.18-rt6-rmdead/arch/mips/sibyte/bcm1480/time.c
--- linux-2.6.18-rt6/arch/mips/sibyte/bcm1480/time.c 2006-08-15 09:21:22.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/mips/sibyte/bcm1480/time.c 2006-10-19 14:04:06.323875657 +0200
@@ -60,11 +60,6 @@
BUG();
}

- if (!cpu) {
- /* Use our own gettimeoffset() routine */
- do_gettimeoffset = bcm1480_gettimeoffset;
- }
-
bcm1480_mask_irq(cpu, irq);

/* Map the timer interrupt to ip[4] of this cpu */
@@ -122,17 +117,3 @@
ll_local_timer_interrupt(irq, regs);
}
}
-
-/*
- * We use our own do_gettimeoffset() instead of the generic one,
- * because the generic one does not work for SMP case.
- * In addition, since we use general timer 0 for system time,
- * we can get accurate intra-jiffy offset without calibration.
- */
-unsigned long bcm1480_gettimeoffset(void)
-{
- unsigned long count =
- __raw_readq(IOADDR(A_SCD_TIMER_REGISTER(0, R_SCD_TIMER_CNT)));
-
- return 1000000/HZ - count;
-}
diff -ur linux-2.6.18-rt6/arch/ppc/amiga/config.c linux-2.6.18-rt6-rmdead/arch/ppc/amiga/config.c
--- linux-2.6.18-rt6/arch/ppc/amiga/config.c 2006-08-15 09:21:23.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/arch/ppc/amiga/config.c 2006-10-19 14:07:36.695187370 +0200
@@ -82,7 +82,6 @@
static void amiga_get_model(char *model);
static int amiga_get_hardware_list(char *buffer);
/* amiga specific timer functions */
-static unsigned long amiga_gettimeoffset (void);
static void a3000_gettod (int *, int *, int *, int *, int *, int *);
static void a2000_gettod (int *, int *, int *, int *, int *, int *);
static int amiga_hwclk (int, struct hwclk_time *);
@@ -389,7 +388,6 @@
#endif
mach_get_model = amiga_get_model;
mach_get_hardware_list = amiga_get_hardware_list;
- mach_gettimeoffset = amiga_gettimeoffset;
if (AMIGAHW_PRESENT(A3000_CLK)){
mach_gettod = a3000_gettod;
rtc_resource.name = "A3000 RTC";
@@ -494,35 +492,6 @@

extern unsigned char cia_get_irq_mask(unsigned int irq);

-/* This is always executed with interrupts disabled. */
-static unsigned long amiga_gettimeoffset (void)
-{
- unsigned short hi, lo, hi2;
- unsigned long ticks, offset = 0;
-
- /* read CIA B timer A current value */
- hi = ciab.tahi;
- lo = ciab.talo;
- hi2 = ciab.tahi;
-
- if (hi != hi2) {
- lo = ciab.talo;
- hi = hi2;
- }
-
- ticks = hi << 8 | lo;
-
- if (ticks > jiffy_ticks / 2)
- /* check for pending interrupt */
- if (cia_get_irq_mask(IRQ_AMIGA_CIAB) & CIA_ICR_TA)
- offset = 10000;
-
- ticks = jiffy_ticks - ticks;
- ticks = (10000 * ticks) / jiffy_ticks;
-
- return ticks + offset;
-}
-
static void a3000_gettod (int *yearp, int *monp, int *dayp,
int *hourp, int *minp, int *secp)
{
diff -ur linux-2.6.18-rt6/arch/ppc/platforms/apus_setup.c linux-2.6.18-rt6-rmdead/arch/ppc/platforms/apus_setup.c
--- linux-2.6.18-rt6/arch/ppc/platforms/apus_setup.c 2006-10-19 12:29:12.522073698 +0200
+++ linux-2.6.18-rt6-rmdead/arch/ppc/platforms/apus_setup.c 2006-10-19 14:07:54.462328850 +0200
@@ -46,7 +46,6 @@
int (*mach_get_irq_list) (struct seq_file *, void *) = NULL;
void (*mach_process_int) (int, struct pt_regs *) = NULL;
/* machine dependent timer functions */
-unsigned long (*mach_gettimeoffset) (void);
void (*mach_gettod) (int*, int*, int*, int*, int*, int*);
int (*mach_hwclk) (int, struct hwclk_time*) = NULL;
int (*mach_set_clock_mmss) (unsigned long) = NULL;
diff -ur linux-2.6.18-rt6/include/asm-arm/arch-ixp2000/platform.h linux-2.6.18-rt6-rmdead/include/asm-arm/arch-ixp2000/platform.h
--- linux-2.6.18-rt6/include/asm-arm/arch-ixp2000/platform.h 2006-04-05 18:36:31.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/include/asm-arm/arch-ixp2000/platform.h 2006-10-19 14:09:48.372591243 +0200
@@ -122,7 +122,6 @@
void ixp2000_uart_init(void);
void ixp2000_init_irq(void);
void ixp2000_init_time(unsigned long);
-unsigned long ixp2000_gettimeoffset(void);

struct pci_sys_data;

diff -ur linux-2.6.18-rt6/include/asm-arm/mach/time.h linux-2.6.18-rt6-rmdead/include/asm-arm/mach/time.h
--- linux-2.6.18-rt6/include/asm-arm/mach/time.h 2006-10-19 12:29:12.632049822 +0200
+++ linux-2.6.18-rt6-rmdead/include/asm-arm/mach/time.h 2006-10-19 13:35:07.016653879 +0200
@@ -28,10 +28,6 @@
* Resume the kernel jiffy timer source, if necessary. This
* is called with interrupts disabled before any normal devices
* are resumed. If no action is required, set this to NULL.
- * - offset
- * Return the timer offset in microseconds since the last timer
- * interrupt. Note: this must take account of any unprocessed
- * timer interrupt which may be pending.
*/
struct sys_timer {
struct sys_device dev;
@@ -39,10 +35,6 @@
void (*suspend)(void);
void (*resume)(void);

-#ifdef CONFIG_IS_TICK_BASED
- unsigned long (*offset)(void);
-#endif
-
#ifdef CONFIG_NO_IDLE_HZ
struct dyn_tick_timer *dyn_tick;
#endif
diff -ur linux-2.6.18-rt6/include/asm-i386/mach-default/do_timer.h linux-2.6.18-rt6-rmdead/include/asm-i386/mach-default/do_timer.h
--- linux-2.6.18-rt6/include/asm-i386/mach-default/do_timer.h 2006-10-19 12:29:12.638048520 +0200
+++ linux-2.6.18-rt6-rmdead/include/asm-i386/mach-default/do_timer.h 2006-10-19 14:11:03.998168305 +0200
@@ -65,7 +65,7 @@

count -= 256;
#else
- printk("do_slow_gettimeoffset(): hardware timer problem?\n");
+ printk("do_timer_overflow(): hardware timer problem?\n");
#endif
}
return count;
diff -ur linux-2.6.18-rt6/include/asm-i386/mach-visws/do_timer.h linux-2.6.18-rt6-rmdead/include/asm-i386/mach-visws/do_timer.h
--- linux-2.6.18-rt6/include/asm-i386/mach-visws/do_timer.h 2006-10-19 12:29:12.639048303 +0200
+++ linux-2.6.18-rt6-rmdead/include/asm-i386/mach-visws/do_timer.h 2006-10-19 14:12:31.833094415 +0200
@@ -50,7 +50,7 @@
*/
count -= LATCH;
} else {
- printk("do_slow_gettimeoffset(): hardware timer problem?\n");
+ printk("do_timer_overflow(): hardware timer problem?\n");
}
return count;
}
diff -ur linux-2.6.18-rt6/include/asm-mips/sibyte/sb1250.h linux-2.6.18-rt6-rmdead/include/asm-mips/sibyte/sb1250.h
--- linux-2.6.18-rt6/include/asm-mips/sibyte/sb1250.h 2006-04-05 18:44:17.000000000 +0200
+++ linux-2.6.18-rt6-rmdead/include/asm-mips/sibyte/sb1250.h 2006-10-19 14:14:19.154789479 +0200
@@ -52,7 +52,6 @@
extern void sb1250_smp_finish(void);

extern void bcm1480_time_init(void);
-extern unsigned long bcm1480_gettimeoffset(void);
extern void bcm1480_mask_irq(int cpu, int irq);
extern void bcm1480_unmask_irq(int cpu, int irq);
extern void bcm1480_smp_finish(void);
diff -ur linux-2.6.18-rt6/include/asm-mips/time.h linux-2.6.18-rt6-rmdead/include/asm-mips/time.h
--- linux-2.6.18-rt6/include/asm-mips/time.h 2006-10-19 12:29:12.654045047 +0200
+++ linux-2.6.18-rt6-rmdead/include/asm-mips/time.h 2006-10-19 14:14:00.579822990 +0200
@@ -58,13 +58,6 @@
extern void to_tm(unsigned long tim, struct rtc_time *tm);

/*
- * do_gettimeoffset(). By default, this func pointer points to
- * do_null_gettimeoffset(), which leads to the same resolution as HZ.
- * Higher resolution versions are available, which give ~1us resolution.
- */
-extern unsigned long (*do_gettimeoffset)(void);
-
-/*
* high-level timer interrupt routines.
*/
extern irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs);
diff -ur linux-2.6.18-rt6/include/asm-x86_64/proto.h linux-2.6.18-rt6-rmdead/include/asm-x86_64/proto.h
--- linux-2.6.18-rt6/include/asm-x86_64/proto.h 2006-10-19 12:29:12.662043310 +0200
+++ linux-2.6.18-rt6-rmdead/include/asm-x86_64/proto.h 2006-10-19 14:15:52.360550392 +0200
@@ -41,7 +41,6 @@
extern int pmtimer_mark_offset(void);
extern void pmtimer_resume(void);
extern void pmtimer_wait(unsigned);
-extern unsigned int do_gettimeoffset_pm(void);
#ifdef CONFIG_X86_PM_TIMER
extern u32 pmtmr_ioport;
#else

2006-10-19 15:19:58

by Guennadi Liakhovetski

[permalink] [raw]
Subject: [PATCH 3/3] Remove time-interpolators

Remove CONFIG_TIME_INTERPOLATION - never set either.

Thanks
Guennadi
---------------------------------
Guennadi Liakhovetski, Ph.D.
DSA Daten- und Systemtechnik GmbH
Pascalstr. 28
D-52076 Aachen
Germany

Signed-off-by: G. Liakhovetski <[email protected]>

diff --exclude=CVS -ur linux-2.6.18-rt6/arch/ia64/kernel/asm-offsets.c linux-2.6.18-rt6-rmdead/arch/ia64/kernel/asm-offsets.c
--- linux-2.6.18-rt6/arch/ia64/kernel/asm-offsets.c 2006-10-19 15:52:47.662033868 +0200
+++ linux-2.6.18-rt6-rmdead/arch/ia64/kernel/asm-offsets.c 2006-10-19 15:57:26.945526349 +0200
@@ -254,14 +254,4 @@
DEFINE(IA64_PMSA_XIP_OFFSET,
offsetof (struct pal_min_state_area_s, pmsa_xip));
BLANK();
-
-#ifdef CONFIG_TIME_INTERPOLATION
- /* used by fsys_gettimeofday in arch/ia64/kernel/fsys.S */
- DEFINE(IA64_TIMESPEC_TV_NSEC_OFFSET, offsetof (struct timespec, tv_nsec));
- DEFINE(IA64_CLOCKSOURCE_MASK_OFFSET, offsetof (struct clocksource, mask));
- DEFINE(IA64_CLOCKSOURCE_MULT_OFFSET, offsetof (struct clocksource, mult));
- DEFINE(IA64_CLOCKSOURCE_SHIFT_OFFSET, offsetof (struct clocksource, shift));
- DEFINE(IA64_CLOCKSOURCE_MMIO_PTR_OFFSET, offsetof (struct clocksource, fsys_mmio_ptr));
- DEFINE(IA64_CLOCKSOURCE_CYCLE_LAST_OFFSET, offsetof (struct clocksource, cycle_last));
-#endif
}
diff --exclude=CVS -ur linux-2.6.18-rt6/arch/ia64/kernel/fsys.S linux-2.6.18-rt6-rmdead/arch/ia64/kernel/fsys.S
--- linux-2.6.18-rt6/arch/ia64/kernel/fsys.S 2006-10-19 15:52:47.664033434 +0200
+++ linux-2.6.18-rt6-rmdead/arch/ia64/kernel/fsys.S 2006-10-19 15:59:09.069399735 +0200
@@ -24,319 +24,6 @@

#include "entry.h"

-#ifdef CONFIG_TIME_INTERPOLATION
-/*
- * See Documentation/ia64/fsys.txt for details on fsyscalls.
- *
- * On entry to an fsyscall handler:
- * r10 = 0 (i.e., defaults to "successful syscall return")
- * r11 = saved ar.pfs (a user-level value)
- * r15 = system call number
- * r16 = "current" task pointer (in normal kernel-mode, this is in r13)
- * r32-r39 = system call arguments
- * b6 = return address (a user-level value)
- * ar.pfs = previous frame-state (a user-level value)
- * PSR.be = cleared to zero (i.e., little-endian byte order is in effect)
- * all other registers may contain values passed in from user-mode
- *
- * On return from an fsyscall handler:
- * r11 = saved ar.pfs (as passed into the fsyscall handler)
- * r15 = system call number (as passed into the fsyscall handler)
- * r32-r39 = system call arguments (as passed into the fsyscall handler)
- * b6 = return address (as passed into the fsyscall handler)
- * ar.pfs = previous frame-state (as passed into the fsyscall handler)
- */
-
-ENTRY(fsys_ni_syscall)
- .prologue
- .altrp b6
- .body
- mov r8=ENOSYS
- mov r10=-1
- FSYS_RETURN
-END(fsys_ni_syscall)
-
-ENTRY(fsys_getpid)
- .prologue
- .altrp b6
- .body
- add r9=TI_FLAGS+IA64_TASK_SIZE,r16
- ;;
- ld4 r9=[r9]
- add r8=IA64_TASK_TGID_OFFSET,r16
- ;;
- and r9=TIF_ALLWORK_MASK,r9
- ld4 r8=[r8] // r8 = current->tgid
- ;;
- cmp.ne p8,p0=0,r9
-(p8) br.spnt.many fsys_fallback_syscall
- FSYS_RETURN
-END(fsys_getpid)
-
-ENTRY(fsys_getppid)
- .prologue
- .altrp b6
- .body
- add r17=IA64_TASK_GROUP_LEADER_OFFSET,r16
- ;;
- ld8 r17=[r17] // r17 = current->group_leader
- add r9=TI_FLAGS+IA64_TASK_SIZE,r16
- ;;
-
- ld4 r9=[r9]
- add r17=IA64_TASK_REAL_PARENT_OFFSET,r17 // r17 = &current->group_leader->real_parent
- ;;
- and r9=TIF_ALLWORK_MASK,r9
-
-1: ld8 r18=[r17] // r18 = current->group_leader->real_parent
- ;;
- cmp.ne p8,p0=0,r9
- add r8=IA64_TASK_TGID_OFFSET,r18 // r8 = &current->group_leader->real_parent->tgid
- ;;
-
- /*
- * The .acq is needed to ensure that the read of tgid has returned its data before
- * we re-check "real_parent".
- */
- ld4.acq r8=[r8] // r8 = current->group_leader->real_parent->tgid
-#ifdef CONFIG_SMP
- /*
- * Re-read current->group_leader->real_parent.
- */
- ld8 r19=[r17] // r19 = current->group_leader->real_parent
-(p8) br.spnt.many fsys_fallback_syscall
- ;;
- cmp.ne p6,p0=r18,r19 // did real_parent change?
- mov r19=0 // i must not leak kernel bits...
-(p6) br.cond.spnt.few 1b // yes -> redo the read of tgid and the check
- ;;
- mov r17=0 // i must not leak kernel bits...
- mov r18=0 // i must not leak kernel bits...
-#else
- mov r17=0 // i must not leak kernel bits...
- mov r18=0 // i must not leak kernel bits...
- mov r19=0 // i must not leak kernel bits...
-#endif
- FSYS_RETURN
-END(fsys_getppid)
-
-ENTRY(fsys_set_tid_address)
- .prologue
- .altrp b6
- .body
- add r9=TI_FLAGS+IA64_TASK_SIZE,r16
- ;;
- ld4 r9=[r9]
- tnat.z p6,p7=r32 // check argument register for being NaT
- ;;
- and r9=TIF_ALLWORK_MASK,r9
- add r8=IA64_TASK_PID_OFFSET,r16
- add r18=IA64_TASK_CLEAR_CHILD_TID_OFFSET,r16
- ;;
- ld4 r8=[r8]
- cmp.ne p8,p0=0,r9
- mov r17=-1
- ;;
-(p6) st8 [r18]=r32
-(p7) st8 [r18]=r17
-(p8) br.spnt.many fsys_fallback_syscall
- ;;
- mov r17=0 // i must not leak kernel bits...
- mov r18=0 // i must not leak kernel bits...
- FSYS_RETURN
-END(fsys_set_tid_address)
-
-#define CLOCK_REALTIME 0
-#define CLOCK_MONOTONIC 1
-#define CLOCK_DIVIDE_BY_1000 0x4000
-#define CLOCK_ADD_MONOTONIC 0x8000
-
-ENTRY(fsys_gettimeofday)
- .prologue
- .altrp b6
- .body
- mov r31 = r32
- tnat.nz p6,p0 = r33 // guard against NaT argument
-(p6) br.cond.spnt.few .fail_einval
- mov r30 = CLOCK_DIVIDE_BY_1000
- ;;
-.gettime:
- // Register map
- // Incoming r31 = pointer to address where to place result
- // r30 = flags determining how time is processed
- // r2,r3 = temp r4-r7 preserved
- // r8 = result nanoseconds
- // r9 = result seconds
- // r10 = temporary storage for clock difference
- // r11 = preserved: saved ar.pfs
- // r12 = preserved: memory stack
- // r13 = preserved: thread pointer
- // r14 = address of mask / mask value
- // r15 = preserved: system call number
- // r16 = preserved: current task pointer
- // r17 = wall to monotonic use
- // r19 = address of itc_lastcycle
- // r20 = struct clocksource / address of first element
- // r21 = shift value
- // r22 = address of itc_jitter/ wall_to_monotonic
- // r23 = address of shift
- // r24 = address mult factor / cycle_last value
- // r25 = itc_lastcycle value
- // r26 = address clocksource cycle_last
- // r27 = pointer to xtime
- // r28 = sequence number at the beginning of critcal section
- // r29 = address of seqlock
- // r30 = time processing flags / memory address
- // r31 = pointer to result
- // Predicates
- // p6,p7 short term use
- // p8 = timesource ar.itc
- // p9 = timesource mmio64
- // p10 = timesource mmio32 - not used
- // p11 = timesource not to be handled by asm code
- // p12 = memory time source ( = p9 | p10) - not used
- // p13 = do cmpxchg with time_interpolator_last_cycle
- // p14 = Divide by 1000
- // p15 = Add monotonic
- //
- // Note that instructions are optimized for McKinley. McKinley can process two
- // bundles simultaneously and therefore we continuously try to feed the CPU
- // two bundles and then a stop.
- tnat.nz p6,p0 = r31 // branch deferred since it does not fit into bundle structure
- mov pr = r30,0xc000 // Set predicates according to function
- add r2 = TI_FLAGS+IA64_TASK_SIZE,r16
- movl r20 = fsyscall_clock // load fsyscall clocksource address
- ;;
- add r10 = IA64_CLOCKSOURCE_MMIO_PTR_OFFSET,r20
- movl r29 = xtime_lock
- ld4 r2 = [r2] // process work pending flags
- movl r27 = xtime
- ;; // only one bundle here
- add r14 = IA64_CLOCKSOURCE_MASK_OFFSET,r20
- movl r22 = itc_jitter
- add r24 = IA64_CLOCKSOURCE_MULT_OFFSET,r20
- and r2 = TIF_ALLWORK_MASK,r2
-(p6) br.cond.spnt.few .fail_einval // deferred branch
- ;;
- ld8 r30 = [r10] // clocksource->mmio_ptr
- movl r19 = itc_lastcycle
- add r23 = IA64_CLOCKSOURCE_SHIFT_OFFSET,r20
- cmp.ne p6, p0 = 0, r2 // Fallback if work is scheduled
-(p6) br.cond.spnt.many fsys_fallback_syscall
- ;;
- ld8 r14 = [r14] // clocksource mask value
- ld4 r2 = [r22] // itc_jitter value
- add r26 = IA64_CLOCKSOURCE_CYCLE_LAST_OFFSET,r20 // clock fsyscall_cycle_last
- ld4 r3 = [r24] // clocksource->mult value
- cmp.eq p8,p9 = 0,r30 // Check for cpu timer, no mmio_ptr, set p8, clear p9
- ;;
- setf.sig f7 = r3 // Setup for mult scaling of counter
-(p15) movl r22 = wall_to_monotonic
- ld4 r21 = [r23] // shift value
-(p8) cmp.ne p13,p0 = r2,r0 // need jitter compensation, set p13
-(p9) cmp.eq p13,p0 = 0,r30 // if mmio_ptr, clear p13 jitter control
- ;;
-.time_redo:
- .pred.rel.mutex p8,p9,p10
- ld4.acq r28 = [r29] // xtime_lock.sequence. Must come first for locking purposes
-(p8) mov r2 = ar.itc // CPU_TIMER. 36 clocks latency!!!
-(p9) ld8 r2 = [r30] // readq(ti->address). Could also have latency issues..
-(p13) ld8 r25 = [r19] // get itc_lastcycle value
- ;; // could be removed by moving the last add upward
- ld8 r9 = [r27],IA64_TIMESPEC_TV_NSEC_OFFSET
- ld8 r24 = [r26] // get fsyscall_cycle_last value
-(p15) ld8 r17 = [r22],IA64_TIMESPEC_TV_NSEC_OFFSET
- ;;
- ld8 r8 = [r27],-IA64_TIMESPEC_TV_NSEC_OFFSET // xtime.tv_nsec
-(p13) sub r3 = r25,r2 // Diff needed before comparison (thanks davidm)
- ;;
-(p13) cmp.gt.unc p6,p7 = r3,r0 // check if it is less than last. p6,p7 cleared
- sub r10 = r2,r24 // current_counter - last_counter
- ;;
-(p6) sub r10 = r25,r24 // time we got was less than last_cycle
-(p7) mov ar.ccv = r25 // more than last_cycle. Prep for cmpxchg
- ;;
- and r10 = r10,r14 // Apply mask
- ;;
- setf.sig f8 = r10
- nop.i 123
- ;;
-(p7) cmpxchg8.rel r3 = [r19],r2,ar.ccv
-EX(.fail_efault, probe.w.fault r31, 3) // This takes 5 cycles and we have spare time
- xmpy.l f8 = f8,f7 // nsec_per_cyc*(counter-last_counter)
-(p15) add r9 = r9,r17 // Add wall to monotonic.secs to result secs
- ;;
-(p15) ld8 r17 = [r22],-IA64_TIMESPEC_TV_NSEC_OFFSET
-(p7) cmp.ne p7,p0 = r25,r3 // if cmpxchg not successful redo
- // simulate tbit.nz.or p7,p0 = r28,0
- and r28 = ~1,r28 // Make sequence even to force retry if odd
- getf.sig r2 = f8
- mf
- ;;
- ld4 r10 = [r29] // xtime_lock.sequence
-(p15) add r8 = r8, r17 // Add monotonic.nsecs to nsecs
- shr.u r2 = r2,r21 // shift by factor
- ;; // overloaded 3 bundles!
- // End critical section.
- add r8 = r8,r2 // Add xtime.nsecs
- cmp4.ne.or p7,p0 = r28,r10
-(p7) br.cond.dpnt.few .time_redo // sequence number changed ?
- // Now r8=tv->tv_nsec and r9=tv->tv_sec
- mov r10 = r0
- movl r2 = 1000000000
- add r23 = IA64_TIMESPEC_TV_NSEC_OFFSET, r31
-(p14) movl r3 = 2361183241434822607 // Prep for / 1000 hack
- ;;
-.time_normalize:
- mov r21 = r8
- cmp.ge p6,p0 = r8,r2
-(p14) shr.u r20 = r8, 3 // We can repeat this if necessary just wasting some time
- ;;
-(p14) setf.sig f8 = r20
-(p6) sub r8 = r8,r2
-(p6) add r9 = 1,r9 // two nops before the branch.
-(p14) setf.sig f7 = r3 // Chances for repeats are 1 in 10000 for gettod
-(p6) br.cond.dpnt.few .time_normalize
- ;;
- // Divided by 8 though shift. Now divide by 125
- // The compiler was able to do that with a multiply
- // and a shift and we do the same
-EX(.fail_efault, probe.w.fault r23, 3) // This also costs 5 cycles
-(p14) xmpy.hu f8 = f8, f7 // xmpy has 5 cycles latency so use it...
- ;;
- mov r8 = r0
-(p14) getf.sig r2 = f8
- ;;
-(p14) shr.u r21 = r2, 4
- ;;
-EX(.fail_efault, st8 [r31] = r9)
-EX(.fail_efault, st8 [r23] = r21)
- FSYS_RETURN
-.fail_einval:
- mov r8 = EINVAL
- mov r10 = -1
- FSYS_RETURN
-.fail_efault:
- mov r8 = EFAULT
- mov r10 = -1
- FSYS_RETURN
-END(fsys_gettimeofday)
-
-ENTRY(fsys_clock_gettime)
- .prologue
- .altrp b6
- .body
- cmp4.ltu p6, p0 = CLOCK_MONOTONIC, r32
- // Fallback if this is not CLOCK_REALTIME or CLOCK_MONOTONIC
-(p6) br.spnt.few fsys_fallback_syscall
- mov r31 = r33
- shl r30 = r32,15
- br.many .gettime
-END(fsys_clock_gettime)
-
-
-#else // !CONFIG_TIME_INTERPOLATION
-
# define fsys_gettimeofday 0
# define fsys_clock_gettime 0

@@ -350,9 +37,6 @@
mov r10 = -1
FSYS_RETURN

-#endif
-
-

/*
* long fsys_rt_sigprocmask (int how, sigset_t *set, sigset_t *oset, size_t sigsetsize).
diff --exclude=CVS -ur linux-2.6.18-rt6/arch/ia64/kernel/time.c linux-2.6.18-rt6-rmdead/arch/ia64/kernel/time.c
--- linux-2.6.18-rt6/arch/ia64/kernel/time.c 2006-10-19 15:52:47.675031052 +0200
+++ linux-2.6.18-rt6-rmdead/arch/ia64/kernel/time.c 2006-10-19 15:59:33.462114604 +0200
@@ -235,24 +235,6 @@
local_cpu_data->nsec_per_cyc = ((NSEC_PER_SEC<<IA64_NSEC_PER_CYC_SHIFT)
+ itc_freq/2)/itc_freq;

-#ifdef CONFIG_TIME_INTERPOLATION
- if (!(sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT)) {
-#ifdef CONFIG_SMP
- /* On IA64 in an SMP configuration ITCs are never accurately synchronized.
- * Jitter compensation requires a cmpxchg which may limit
- * the scalability of the syscalls for retrieving time.
- * The ITC synchronization is usually successful to within a few
- * ITC ticks but this is not a sure thing. If you need to improve
- * timer performance in SMP situations then boot the kernel with the
- * "nojitter" option. However, doing so may result in time fluctuating (maybe
- * even going backward) if the ITC offsets between the individual CPUs
- * are too large.
- */
- if (!nojitter) itc_jitter = 1;
-#endif
- }
-#endif
-
/* Setup the CPU local timer tick */
ia64_cpu_local_tick();

diff --exclude=CVS -ur linux-2.6.18-rt6/include/linux/timex.h linux-2.6.18-rt6-rmdead/include/linux/timex.h
--- linux-2.6.18-rt6/include/linux/timex.h 2006-10-19 15:52:47.893983617 +0200
+++ linux-2.6.18-rt6-rmdead/include/linux/timex.h 2006-10-19 16:05:14.451270841 +0200
@@ -224,66 +224,6 @@
__x < 0 ? -(-__x >> __s) : __x >> __s; \
})

-
-#ifdef CONFIG_TIME_INTERPOLATION
-
-#define TIME_SOURCE_CPU 0
-#define TIME_SOURCE_MMIO64 1
-#define TIME_SOURCE_MMIO32 2
-#define TIME_SOURCE_FUNCTION 3
-
-/* For proper operations time_interpolator clocks must run slightly slower
- * than the standard clock since the interpolator may only correct by having
- * time jump forward during a tick. A slower clock is usually a side effect
- * of the integer divide of the nanoseconds in a second by the frequency.
- * The accuracy of the division can be increased by specifying a shift.
- * However, this may cause the clock not to be slow enough.
- * The interpolator will self-tune the clock by slowing down if no
- * resets occur or speeding up if the time jumps per analysis cycle
- * become too high.
- *
- * Setting jitter compensates for a fluctuating timesource by comparing
- * to the last value read from the timesource to insure that an earlier value
- * is not returned by a later call. The price to pay
- * for the compensation is that the timer routines are not as scalable anymore.
- */
-
-struct time_interpolator {
- u16 source; /* time source flags */
- u8 shift; /* increases accuracy of multiply by shifting. */
- /* Note that bits may be lost if shift is set too high */
- u8 jitter; /* if set compensate for fluctuations */
- u32 nsec_per_cyc; /* set by register_time_interpolator() */
- void *addr; /* address of counter or function */
- u64 mask; /* mask the valid bits of the counter */
- unsigned long offset; /* nsec offset at last update of interpolator */
- u64 last_counter; /* counter value in units of the counter at last update */
- u64 last_cycle; /* Last timer value if TIME_SOURCE_JITTER is set */
- u64 frequency; /* frequency in counts/second */
- long drift; /* drift in parts-per-million (or -1) */
- unsigned long skips; /* skips forward */
- unsigned long ns_skipped; /* nanoseconds skipped */
- struct time_interpolator *next;
-};
-
-extern void register_time_interpolator(struct time_interpolator *);
-extern void unregister_time_interpolator(struct time_interpolator *);
-extern void time_interpolator_reset(void);
-extern unsigned long time_interpolator_get_offset(void);
-extern void time_interpolator_update(long delta_nsec);
-
-#else /* !CONFIG_TIME_INTERPOLATION */
-
-static inline void time_interpolator_reset(void)
-{
-}
-
-static inline void time_interpolator_update(long delta_nsec)
-{
-}
-
-#endif /* !CONFIG_TIME_INTERPOLATION */
-
#define TICK_LENGTH_SHIFT 32

/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */
diff --exclude=CVS -ur linux-2.6.18-rt6/kernel/time/ntp.c linux-2.6.18-rt6-rmdead/kernel/time/ntp.c
--- linux-2.6.18-rt6/kernel/time/ntp.c 2006-10-19 15:52:47.947971921 +0200
+++ linux-2.6.18-rt6-rmdead/kernel/time/ntp.c 2006-10-19 16:06:20.080065993 +0200
@@ -110,11 +110,6 @@
if (xtime.tv_sec % 86400 == 0) {
xtime.tv_sec--;
wall_to_monotonic.tv_sec++;
- /*
- * The timer interpolator will make time change
- * gradually instead of an immediate jump by one second
- */
- time_interpolator_update(-NSEC_PER_SEC);
time_state = TIME_OOP;
clock_was_set();
printk(KERN_NOTICE "Clock: inserting leap second "
@@ -125,11 +120,6 @@
if ((xtime.tv_sec + 1) % 86400 == 0) {
xtime.tv_sec++;
wall_to_monotonic.tv_sec--;
- /*
- * Use of time interpolator for a gradual change of
- * time
- */
- time_interpolator_update(NSEC_PER_SEC);
time_state = TIME_WAIT;
clock_was_set();
printk(KERN_NOTICE "Clock: deleting leap second "
diff --exclude=CVS -ur linux-2.6.18-rt6/kernel/time.c linux-2.6.18-rt6-rmdead/kernel/time.c
--- linux-2.6.18-rt6/kernel/time.c 2006-10-19 15:52:47.945972354 +0200
+++ linux-2.6.18-rt6-rmdead/kernel/time.c 2006-10-19 16:06:47.833058925 +0200
@@ -134,7 +134,6 @@
write_seqlock_irq(&xtime_lock);
wall_to_monotonic.tv_sec -= sys_tz.tz_minuteswest * 60;
xtime.tv_sec += sys_tz.tz_minuteswest * 60;
- time_interpolator_reset();
warp_check_clock_was_changed();
write_sequnlock_irq(&xtime_lock);
clock_was_set();
@@ -277,81 +276,6 @@
return t;
}
EXPORT_SYMBOL(timespec_trunc);
-
-#ifdef CONFIG_TIME_INTERPOLATION
-void getnstimeofday (struct timespec *tv)
-{
- unsigned long seq,sec,nsec;
-
- do {
- seq = read_seqbegin(&xtime_lock);
- sec = xtime.tv_sec;
- nsec = xtime.tv_nsec+time_interpolator_get_offset();
- } while (unlikely(read_seqretry(&xtime_lock, seq)));
-
- while (unlikely(nsec >= NSEC_PER_SEC)) {
- nsec -= NSEC_PER_SEC;
- ++sec;
- }
- tv->tv_sec = sec;
- tv->tv_nsec = nsec;
-}
-EXPORT_SYMBOL_GPL(getnstimeofday);
-
-int do_settimeofday (struct timespec *tv)
-{
- time_t wtm_sec, sec = tv->tv_sec;
- long wtm_nsec, nsec = tv->tv_nsec;
-
- if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
- return -EINVAL;
-
- write_seqlock_irq(&xtime_lock);
- {
- wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
- wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
-
- set_normalized_timespec(&xtime, sec, nsec);
- set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
-
- time_adjust = 0; /* stop active adjtime() */
- time_status |= STA_UNSYNC;
- time_maxerror = NTP_PHASE_LIMIT;
- time_esterror = NTP_PHASE_LIMIT;
- time_interpolator_reset();
- }
- warp_check_clock_was_changed();
- write_sequnlock_irq(&xtime_lock);
- clock_was_set();
- return 0;
-}
-EXPORT_SYMBOL(do_settimeofday);
-
-void do_gettimeofday (struct timeval *tv)
-{
- unsigned long seq, nsec, usec, sec, offset;
- do {
- seq = read_seqbegin(&xtime_lock);
- offset = time_interpolator_get_offset();
- sec = xtime.tv_sec;
- nsec = xtime.tv_nsec;
- } while (unlikely(read_seqretry(&xtime_lock, seq)));
-
- usec = (nsec + offset) / 1000;
-
- while (unlikely(usec >= USEC_PER_SEC)) {
- usec -= USEC_PER_SEC;
- ++sec;
- }
-
- tv->tv_sec = sec;
- tv->tv_usec = usec;
-}
-
-EXPORT_SYMBOL(do_gettimeofday);
-
-
-#else
#ifndef CONFIG_GENERIC_TIME
/*
* Simulate gettimeofday using do_gettimeofday which only allows a timeval
@@ -367,7 +291,6 @@
}
EXPORT_SYMBOL_GPL(getnstimeofday);
#endif
-#endif

/* Converts Gregorian date to seconds since 1970-01-01 00:00:00.
* Assumes input in normal date format, i.e. 1980-12-31 23:59:59
diff --exclude=CVS -ur linux-2.6.18-rt6/kernel/timer.c linux-2.6.18-rt6-rmdead/kernel/timer.c
--- linux-2.6.18-rt6/kernel/timer.c 2006-10-19 15:52:47.950971271 +0200
+++ linux-2.6.18-rt6-rmdead/kernel/timer.c 2006-10-19 16:06:55.523394356 +0200
@@ -1145,10 +1145,6 @@
second_overflow();
}

- /* interpolator bits */
- time_interpolator_update((clock->xtime_interval
- >> clock->shift)<<shift);
-
/* accumulate error between NTP and clock interval */
clock->error += current_tick_length() << shift;
clock->error -= (clock->xtime_interval
@@ -1736,194 +1732,6 @@
open_softirq(TIMER_SOFTIRQ, run_timer_softirq, NULL);
}

-#ifdef CONFIG_TIME_INTERPOLATION
-
-struct time_interpolator *time_interpolator __read_mostly;
-static struct time_interpolator *time_interpolator_list __read_mostly;
-static DEFINE_SPINLOCK(time_interpolator_lock);
-
-static inline u64 time_interpolator_get_cycles(unsigned int src)
-{
- unsigned long (*x)(void);
-
- switch (src)
- {
- case TIME_SOURCE_FUNCTION:
- x = time_interpolator->addr;
- return x();
-
- case TIME_SOURCE_MMIO64 :
- return readq_relaxed((void __iomem *)time_interpolator->addr);
-
- case TIME_SOURCE_MMIO32 :
- return readl_relaxed((void __iomem *)time_interpolator->addr);
-
- default: return get_cycles();
- }
-}
-
-static inline u64 time_interpolator_get_counter(int writelock)
-{
- unsigned int src = time_interpolator->source;
-
- if (time_interpolator->jitter)
- {
- u64 lcycle;
- u64 now;
-
- do {
- lcycle = time_interpolator->last_cycle;
- now = time_interpolator_get_cycles(src);
- if (lcycle && time_after(lcycle, now))
- return lcycle;
-
- /* When holding the xtime write lock, there's no need
- * to add the overhead of the cmpxchg. Readers are
- * force to retry until the write lock is released.
- */
- if (writelock) {
- time_interpolator->last_cycle = now;
- return now;
- }
- /* Keep track of the last timer value returned. The use of cmpxchg here
- * will cause contention in an SMP environment.
- */
- } while (unlikely(cmpxchg(&time_interpolator->last_cycle, lcycle, now) != lcycle));
- return now;
- }
- else
- return time_interpolator_get_cycles(src);
-}
-
-void time_interpolator_reset(void)
-{
- time_interpolator->offset = 0;
- time_interpolator->last_counter = time_interpolator_get_counter(1);
-}
-
-#define GET_TI_NSECS(count,i) (((((count) - i->last_counter) & (i)->mask) * (i)->nsec_per_cyc) >> (i)->shift)
-
-unsigned long time_interpolator_get_offset(void)
-{
- /* If we do not have a time interpolator set up then just return zero */
- if (!time_interpolator)
- return 0;
-
- return time_interpolator->offset +
- GET_TI_NSECS(time_interpolator_get_counter(0), time_interpolator);
-}
-
-#define INTERPOLATOR_ADJUST 65536
-#define INTERPOLATOR_MAX_SKIP 10*INTERPOLATOR_ADJUST
-
-void time_interpolator_update(long delta_nsec)
-{
- u64 counter;
- unsigned long offset;
-
- /* If there is no time interpolator set up then do nothing */
- if (!time_interpolator)
- return;
-
- /*
- * The interpolator compensates for late ticks by accumulating the late
- * time in time_interpolator->offset. A tick earlier than expected will
- * lead to a reset of the offset and a corresponding jump of the clock
- * forward. Again this only works if the interpolator clock is running
- * slightly slower than the regular clock and the tuning logic insures
- * that.
- */
-
- counter = time_interpolator_get_counter(1);
- offset = time_interpolator->offset +
- GET_TI_NSECS(counter, time_interpolator);
-
- if (delta_nsec < 0 || (unsigned long) delta_nsec < offset)
- time_interpolator->offset = offset - delta_nsec;
- else {
- time_interpolator->skips++;
- time_interpolator->ns_skipped += delta_nsec - offset;
- time_interpolator->offset = 0;
- }
- time_interpolator->last_counter = counter;
-
- /* Tuning logic for time interpolator invoked every minute or so.
- * Decrease interpolator clock speed if no skips occurred and an offset is carried.
- * Increase interpolator clock speed if we skip too much time.
- */
- if (jiffies % INTERPOLATOR_ADJUST == 0)
- {
- if (time_interpolator->skips == 0 && time_interpolator->offset > tick_nsec)
- time_interpolator->nsec_per_cyc--;
- if (time_interpolator->ns_skipped > INTERPOLATOR_MAX_SKIP && time_interpolator->offset == 0)
- time_interpolator->nsec_per_cyc++;
- time_interpolator->skips = 0;
- time_interpolator->ns_skipped = 0;
- }
-}
-
-static inline int
-is_better_time_interpolator(struct time_interpolator *new)
-{
- if (!time_interpolator)
- return 1;
- return new->frequency > 2*time_interpolator->frequency ||
- (unsigned long)new->drift < (unsigned long)time_interpolator->drift;
-}
-
-void
-register_time_interpolator(struct time_interpolator *ti)
-{
- unsigned long flags;
-
- /* Sanity check */
- BUG_ON(ti->frequency == 0 || ti->mask == 0);
-
- ti->nsec_per_cyc = ((u64)NSEC_PER_SEC << ti->shift) / ti->frequency;
- spin_lock(&time_interpolator_lock);
- write_seqlock_irqsave(&xtime_lock, flags);
- if (is_better_time_interpolator(ti)) {
- time_interpolator = ti;
- time_interpolator_reset();
- }
- write_sequnlock_irqrestore(&xtime_lock, flags);
-
- ti->next = time_interpolator_list;
- time_interpolator_list = ti;
- spin_unlock(&time_interpolator_lock);
-}
-
-void
-unregister_time_interpolator(struct time_interpolator *ti)
-{
- struct time_interpolator *curr, **prev;
- unsigned long flags;
-
- spin_lock(&time_interpolator_lock);
- prev = &time_interpolator_list;
- for (curr = *prev; curr; curr = curr->next) {
- if (curr == ti) {
- *prev = curr->next;
- break;
- }
- prev = &curr->next;
- }
-
- write_seqlock_irqsave(&xtime_lock, flags);
- if (ti == time_interpolator) {
- /* we lost the best time-interpolator: */
- time_interpolator = NULL;
- /* find the next-best interpolator */
- for (curr = time_interpolator_list; curr; curr = curr->next)
- if (is_better_time_interpolator(curr))
- time_interpolator = curr;
- time_interpolator_reset();
- }
- write_sequnlock_irqrestore(&xtime_lock, flags);
- spin_unlock(&time_interpolator_lock);
-}
-#endif /* CONFIG_TIME_INTERPOLATION */
-
/**
* msleep - sleep safely even with waitqueue interruptions
* @msecs: Time in milliseconds to sleep for