Commit 791a644a authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

uml: clocksource support

Add clocksource support.
Signed-off-by: default avatarJeff Dike <jdike@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 31ccc1f5
...@@ -97,6 +97,21 @@ static irqreturn_t um_timer(int irq, void *dev) ...@@ -97,6 +97,21 @@ static irqreturn_t um_timer(int irq, void *dev)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static cycle_t itimer_read(void)
{
return os_nsecs();
}
static struct clocksource itimer_clocksource = {
.name = "itimer",
.rating = 300,
.read = itimer_read,
.mask = CLOCKSOURCE_MASK(64),
.mult = 1,
.shift = 0,
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
static void __init setup_itimer(void) static void __init setup_itimer(void)
{ {
int err; int err;
...@@ -111,6 +126,11 @@ static void __init setup_itimer(void) ...@@ -111,6 +126,11 @@ static void __init setup_itimer(void)
clockevent_delta2ns(60 * HZ, &itimer_clockevent); clockevent_delta2ns(60 * HZ, &itimer_clockevent);
itimer_clockevent.min_delta_ns = itimer_clockevent.min_delta_ns =
clockevent_delta2ns(1, &itimer_clockevent); clockevent_delta2ns(1, &itimer_clockevent);
err = clocksource_register(&itimer_clocksource);
if (err) {
printk(KERN_ERR "clocksource_register returned %d\n", err);
return;
}
clockevents_register_device(&itimer_clockevent); clockevents_register_device(&itimer_clockevent);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment