diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/time/timekeeping.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index cbc6acb0db3f..8ed934601587 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -135,6 +135,20 @@ static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock) | |||
135 | } | 135 | } |
136 | 136 | ||
137 | /* Timekeeper helper functions. */ | 137 | /* Timekeeper helper functions. */ |
138 | |||
139 | #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET | ||
140 | u32 (*arch_gettimeoffset)(void); | ||
141 | |||
142 | u32 get_arch_timeoffset(void) | ||
143 | { | ||
144 | if (likely(arch_gettimeoffset)) | ||
145 | return arch_gettimeoffset(); | ||
146 | return 0; | ||
147 | } | ||
148 | #else | ||
149 | static inline u32 get_arch_timeoffset(void) { return 0; } | ||
150 | #endif | ||
151 | |||
138 | static inline s64 timekeeping_get_ns(struct timekeeper *tk) | 152 | static inline s64 timekeeping_get_ns(struct timekeeper *tk) |
139 | { | 153 | { |
140 | cycle_t cycle_now, cycle_delta; | 154 | cycle_t cycle_now, cycle_delta; |
@@ -151,8 +165,8 @@ static inline s64 timekeeping_get_ns(struct timekeeper *tk) | |||
151 | nsec = cycle_delta * tk->mult + tk->xtime_nsec; | 165 | nsec = cycle_delta * tk->mult + tk->xtime_nsec; |
152 | nsec >>= tk->shift; | 166 | nsec >>= tk->shift; |
153 | 167 | ||
154 | /* If arch requires, add in gettimeoffset() */ | 168 | /* If arch requires, add in get_arch_timeoffset() */ |
155 | return nsec + arch_gettimeoffset(); | 169 | return nsec + get_arch_timeoffset(); |
156 | } | 170 | } |
157 | 171 | ||
158 | static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk) | 172 | static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk) |
@@ -171,8 +185,8 @@ static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk) | |||
171 | /* convert delta to nanoseconds. */ | 185 | /* convert delta to nanoseconds. */ |
172 | nsec = clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift); | 186 | nsec = clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift); |
173 | 187 | ||
174 | /* If arch requires, add in gettimeoffset() */ | 188 | /* If arch requires, add in get_arch_timeoffset() */ |
175 | return nsec + arch_gettimeoffset(); | 189 | return nsec + get_arch_timeoffset(); |
176 | } | 190 | } |
177 | 191 | ||
178 | static RAW_NOTIFIER_HEAD(pvclock_gtod_chain); | 192 | static RAW_NOTIFIER_HEAD(pvclock_gtod_chain); |
@@ -254,8 +268,8 @@ static void timekeeping_forward_now(struct timekeeper *tk) | |||
254 | 268 | ||
255 | tk->xtime_nsec += cycle_delta * tk->mult; | 269 | tk->xtime_nsec += cycle_delta * tk->mult; |
256 | 270 | ||
257 | /* If arch requires, add in gettimeoffset() */ | 271 | /* If arch requires, add in get_arch_timeoffset() */ |
258 | tk->xtime_nsec += (u64)arch_gettimeoffset() << tk->shift; | 272 | tk->xtime_nsec += (u64)get_arch_timeoffset() << tk->shift; |
259 | 273 | ||
260 | tk_normalize_xtime(tk); | 274 | tk_normalize_xtime(tk); |
261 | 275 | ||