Skip to content

Commit

Permalink
Merge pull request torvalds#272 from libos-nuse/fix-clock-init
Browse files Browse the repository at this point in the history
lkl: add read_persistent_clock() to override clock value
  • Loading branch information
thehajime authored Nov 22, 2016
2 parents cd6db0d + 20de77a commit b34b438
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions arch/lkl/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ void calibrate_delay(void)
{
}

void read_persistent_clock(struct timespec *ts)
{
*ts = ns_to_timespec(lkl_ops->time());
}

static cycle_t clock_read(struct clocksource *cs)
{
return lkl_ops->time();
Expand Down Expand Up @@ -103,8 +108,6 @@ static struct irqaction irq0 = {
void __init time_init(void)
{
int ret;
struct timespec ts;
unsigned long long time;

if (!lkl_ops->timer_alloc || !lkl_ops->timer_free ||
!lkl_ops->timer_set_oneshot || !lkl_ops->time) {
Expand All @@ -121,10 +124,5 @@ void __init time_init(void)

clockevents_config_and_register(&clockevent, NSEC_PER_SEC, 1, ULONG_MAX);

time = lkl_ops->time();
ts.tv_sec = time / NSEC_PER_SEC;
ts.tv_nsec = time % NSEC_PER_SEC;
do_settimeofday(&ts);

pr_info("lkl: time and timers initialized (irq%d)\n", timer_irq);
}

0 comments on commit b34b438

Please sign in to comment.