Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 576094b7 authored by John Stultz's avatar John Stultz
Browse files

time: Introduce new GENERIC_TIME_VSYSCALL



Now that we moved everyone over to GENERIC_TIME_VSYSCALL_OLD,
introduce the new declaration and config option for the new
update_vsyscall method.

Cc: Tony Luck <tony.luck@intel.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Turner <pjt@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
parent 70639421
Loading
Loading
Loading
Loading
+29 −7
Original line number Diff line number Diff line
@@ -66,16 +66,38 @@ struct timekeeper {
	seqlock_t		lock;
};

static inline struct timespec tk_xtime(struct timekeeper *tk)
{
	struct timespec ts;

	ts.tv_sec = tk->xtime_sec;
	ts.tv_nsec = (long)(tk->xtime_nsec >> tk->shift);
	return ts;
}


#ifdef CONFIG_GENERIC_TIME_VSYSCALL

extern void update_vsyscall(struct timekeeper *tk);
extern void update_vsyscall_tz(void);

#ifdef CONFIG_GENERIC_TIME_VSYSCALL_OLD
extern void
update_vsyscall_old(struct timespec *ts, struct timespec *wtm,
#elif defined(CONFIG_GENERIC_TIME_VSYSCALL_OLD)

extern void update_vsyscall_old(struct timespec *ts, struct timespec *wtm,
				struct clocksource *c, u32 mult);
extern void update_vsyscall_tz(void);

static inline void update_vsyscall(struct timekeeper *tk)
{
	struct timespec xt;

	xt = tk_xtime(tk);
	update_vsyscall_old(&xt, &tk->wall_to_monotonic, tk->clock, tk->mult);
}

#else
static inline void
update_vsyscall_old(struct timespec *ts, struct timespec *wtm,
					struct clocksource *c, u32 mult)

static inline void update_vsyscall(struct timekeeper *tk)
{
}
static inline void update_vsyscall_tz(void)
+4 −0
Original line number Diff line number Diff line
@@ -12,6 +12,10 @@ config CLOCKSOURCE_WATCHDOG
config ARCH_CLOCKSOURCE_DATA
	bool

# Timekeeping vsyscall support
config GENERIC_TIME_VSYSCALL
	bool

# Timekeeping vsyscall support
config GENERIC_TIME_VSYSCALL_OLD
	bool
+1 −13
Original line number Diff line number Diff line
@@ -42,15 +42,6 @@ static inline void tk_normalize_xtime(struct timekeeper *tk)
	}
}

static struct timespec tk_xtime(struct timekeeper *tk)
{
	struct timespec ts;

	ts.tv_sec = tk->xtime_sec;
	ts.tv_nsec = (long)(tk->xtime_nsec >> tk->shift);
	return ts;
}

static void tk_set_xtime(struct timekeeper *tk, const struct timespec *ts)
{
	tk->xtime_sec = ts->tv_sec;
@@ -192,14 +183,11 @@ static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
/* must hold write on timekeeper.lock */
static void timekeeping_update(struct timekeeper *tk, bool clearntp)
{
	struct timespec xt;

	if (clearntp) {
		tk->ntp_error = 0;
		ntp_clear();
	}
	xt = tk_xtime(tk);
	update_vsyscall_old(&xt, &tk->wall_to_monotonic, tk->clock, tk->mult);
	update_vsyscall(tk);
}

/**