diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/alarmtimer.h | 4 | ||||
| -rw-r--r-- | include/linux/clockchips.h | 5 | ||||
| -rw-r--r-- | include/linux/clocksource.h | 8 | ||||
| -rw-r--r-- | include/linux/dw_apb_timer.h | 1 | ||||
| -rw-r--r-- | include/linux/efi.h | 4 | ||||
| -rw-r--r-- | include/linux/ktime.h | 10 | ||||
| -rw-r--r-- | include/linux/posix-timers.h | 16 | ||||
| -rw-r--r-- | include/linux/pvclock_gtod.h | 7 | ||||
| -rw-r--r-- | include/linux/sched_clock.h | 21 |
9 files changed, 61 insertions, 15 deletions
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h index 9069694e70eb..a899402a5a0e 100644 --- a/include/linux/alarmtimer.h +++ b/include/linux/alarmtimer.h | |||
| @@ -44,10 +44,14 @@ struct alarm { | |||
| 44 | void alarm_init(struct alarm *alarm, enum alarmtimer_type type, | 44 | void alarm_init(struct alarm *alarm, enum alarmtimer_type type, |
| 45 | enum alarmtimer_restart (*function)(struct alarm *, ktime_t)); | 45 | enum alarmtimer_restart (*function)(struct alarm *, ktime_t)); |
| 46 | int alarm_start(struct alarm *alarm, ktime_t start); | 46 | int alarm_start(struct alarm *alarm, ktime_t start); |
| 47 | int alarm_start_relative(struct alarm *alarm, ktime_t start); | ||
| 48 | void alarm_restart(struct alarm *alarm); | ||
| 47 | int alarm_try_to_cancel(struct alarm *alarm); | 49 | int alarm_try_to_cancel(struct alarm *alarm); |
| 48 | int alarm_cancel(struct alarm *alarm); | 50 | int alarm_cancel(struct alarm *alarm); |
| 49 | 51 | ||
| 50 | u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval); | 52 | u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval); |
| 53 | u64 alarm_forward_now(struct alarm *alarm, ktime_t interval); | ||
| 54 | ktime_t alarm_expires_remaining(const struct alarm *alarm); | ||
| 51 | 55 | ||
| 52 | /* Provide way to access the rtc device being used by alarmtimers */ | 56 | /* Provide way to access the rtc device being used by alarmtimers */ |
| 53 | struct rtc_device *alarmtimer_get_rtcdev(void); | 57 | struct rtc_device *alarmtimer_get_rtcdev(void); |
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 963d71431388..0857922e8ad0 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h | |||
| @@ -30,6 +30,7 @@ enum clock_event_nofitiers { | |||
| 30 | #include <linux/notifier.h> | 30 | #include <linux/notifier.h> |
| 31 | 31 | ||
| 32 | struct clock_event_device; | 32 | struct clock_event_device; |
| 33 | struct module; | ||
| 33 | 34 | ||
| 34 | /* Clock event mode commands */ | 35 | /* Clock event mode commands */ |
| 35 | enum clock_event_mode { | 36 | enum clock_event_mode { |
| @@ -83,6 +84,7 @@ enum clock_event_mode { | |||
| 83 | * @irq: IRQ number (only for non CPU local devices) | 84 | * @irq: IRQ number (only for non CPU local devices) |
| 84 | * @cpumask: cpumask to indicate for which CPUs this device works | 85 | * @cpumask: cpumask to indicate for which CPUs this device works |
| 85 | * @list: list head for the management code | 86 | * @list: list head for the management code |
| 87 | * @owner: module reference | ||
| 86 | */ | 88 | */ |
| 87 | struct clock_event_device { | 89 | struct clock_event_device { |
| 88 | void (*event_handler)(struct clock_event_device *); | 90 | void (*event_handler)(struct clock_event_device *); |
| @@ -112,6 +114,7 @@ struct clock_event_device { | |||
| 112 | int irq; | 114 | int irq; |
| 113 | const struct cpumask *cpumask; | 115 | const struct cpumask *cpumask; |
| 114 | struct list_head list; | 116 | struct list_head list; |
| 117 | struct module *owner; | ||
| 115 | } ____cacheline_aligned; | 118 | } ____cacheline_aligned; |
| 116 | 119 | ||
| 117 | /* | 120 | /* |
| @@ -138,6 +141,7 @@ static inline unsigned long div_sc(unsigned long ticks, unsigned long nsec, | |||
| 138 | extern u64 clockevent_delta2ns(unsigned long latch, | 141 | extern u64 clockevent_delta2ns(unsigned long latch, |
| 139 | struct clock_event_device *evt); | 142 | struct clock_event_device *evt); |
| 140 | extern void clockevents_register_device(struct clock_event_device *dev); | 143 | extern void clockevents_register_device(struct clock_event_device *dev); |
| 144 | extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu); | ||
| 141 | 145 | ||
| 142 | extern void clockevents_config(struct clock_event_device *dev, u32 freq); | 146 | extern void clockevents_config(struct clock_event_device *dev, u32 freq); |
| 143 | extern void clockevents_config_and_register(struct clock_event_device *dev, | 147 | extern void clockevents_config_and_register(struct clock_event_device *dev, |
| @@ -150,7 +154,6 @@ extern void clockevents_exchange_device(struct clock_event_device *old, | |||
| 150 | struct clock_event_device *new); | 154 | struct clock_event_device *new); |
| 151 | extern void clockevents_set_mode(struct clock_event_device *dev, | 155 | extern void clockevents_set_mode(struct clock_event_device *dev, |
| 152 | enum clock_event_mode mode); | 156 | enum clock_event_mode mode); |
| 153 | extern int clockevents_register_notifier(struct notifier_block *nb); | ||
| 154 | extern int clockevents_program_event(struct clock_event_device *dev, | 157 | extern int clockevents_program_event(struct clock_event_device *dev, |
| 155 | ktime_t expires, bool force); | 158 | ktime_t expires, bool force); |
| 156 | 159 | ||
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 7279b94c01da..dbbf8aa7731b 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | /* clocksource cycle base type */ | 21 | /* clocksource cycle base type */ |
| 22 | typedef u64 cycle_t; | 22 | typedef u64 cycle_t; |
| 23 | struct clocksource; | 23 | struct clocksource; |
| 24 | struct module; | ||
| 24 | 25 | ||
| 25 | #ifdef CONFIG_ARCH_CLOCKSOURCE_DATA | 26 | #ifdef CONFIG_ARCH_CLOCKSOURCE_DATA |
| 26 | #include <asm/clocksource.h> | 27 | #include <asm/clocksource.h> |
| @@ -162,6 +163,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc, | |||
| 162 | * @suspend: suspend function for the clocksource, if necessary | 163 | * @suspend: suspend function for the clocksource, if necessary |
| 163 | * @resume: resume function for the clocksource, if necessary | 164 | * @resume: resume function for the clocksource, if necessary |
| 164 | * @cycle_last: most recent cycle counter value seen by ::read() | 165 | * @cycle_last: most recent cycle counter value seen by ::read() |
| 166 | * @owner: module reference, must be set by clocksource in modules | ||
| 165 | */ | 167 | */ |
| 166 | struct clocksource { | 168 | struct clocksource { |
| 167 | /* | 169 | /* |
| @@ -195,6 +197,7 @@ struct clocksource { | |||
| 195 | cycle_t cs_last; | 197 | cycle_t cs_last; |
| 196 | cycle_t wd_last; | 198 | cycle_t wd_last; |
| 197 | #endif | 199 | #endif |
| 200 | struct module *owner; | ||
| 198 | } ____cacheline_aligned; | 201 | } ____cacheline_aligned; |
| 199 | 202 | ||
| 200 | /* | 203 | /* |
| @@ -207,6 +210,7 @@ struct clocksource { | |||
| 207 | #define CLOCK_SOURCE_VALID_FOR_HRES 0x20 | 210 | #define CLOCK_SOURCE_VALID_FOR_HRES 0x20 |
| 208 | #define CLOCK_SOURCE_UNSTABLE 0x40 | 211 | #define CLOCK_SOURCE_UNSTABLE 0x40 |
| 209 | #define CLOCK_SOURCE_SUSPEND_NONSTOP 0x80 | 212 | #define CLOCK_SOURCE_SUSPEND_NONSTOP 0x80 |
| 213 | #define CLOCK_SOURCE_RESELECT 0x100 | ||
| 210 | 214 | ||
| 211 | /* simplify initialization of mask field */ | 215 | /* simplify initialization of mask field */ |
| 212 | #define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) | 216 | #define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) |
| @@ -279,7 +283,7 @@ static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift) | |||
| 279 | 283 | ||
| 280 | 284 | ||
| 281 | extern int clocksource_register(struct clocksource*); | 285 | extern int clocksource_register(struct clocksource*); |
| 282 | extern void clocksource_unregister(struct clocksource*); | 286 | extern int clocksource_unregister(struct clocksource*); |
| 283 | extern void clocksource_touch_watchdog(void); | 287 | extern void clocksource_touch_watchdog(void); |
| 284 | extern struct clocksource* clocksource_get_next(void); | 288 | extern struct clocksource* clocksource_get_next(void); |
| 285 | extern void clocksource_change_rating(struct clocksource *cs, int rating); | 289 | extern void clocksource_change_rating(struct clocksource *cs, int rating); |
| @@ -321,7 +325,7 @@ static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz) | |||
| 321 | } | 325 | } |
| 322 | 326 | ||
| 323 | 327 | ||
| 324 | extern void timekeeping_notify(struct clocksource *clock); | 328 | extern int timekeeping_notify(struct clocksource *clock); |
| 325 | 329 | ||
| 326 | extern cycle_t clocksource_mmio_readl_up(struct clocksource *); | 330 | extern cycle_t clocksource_mmio_readl_up(struct clocksource *); |
| 327 | extern cycle_t clocksource_mmio_readl_down(struct clocksource *); | 331 | extern cycle_t clocksource_mmio_readl_down(struct clocksource *); |
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h index 07261d52a6df..1f79b20918b1 100644 --- a/include/linux/dw_apb_timer.h +++ b/include/linux/dw_apb_timer.h | |||
| @@ -51,6 +51,5 @@ dw_apb_clocksource_init(unsigned rating, const char *name, void __iomem *base, | |||
| 51 | void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs); | 51 | void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs); |
| 52 | void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs); | 52 | void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs); |
| 53 | cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs); | 53 | cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs); |
| 54 | void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs); | ||
| 55 | 54 | ||
| 56 | #endif /* __DW_APB_TIMER_H__ */ | 55 | #endif /* __DW_APB_TIMER_H__ */ |
diff --git a/include/linux/efi.h b/include/linux/efi.h index 21ae6b3c0359..5f8f176154f7 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
| @@ -594,8 +594,8 @@ extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size); | |||
| 594 | extern int __init efi_uart_console_only (void); | 594 | extern int __init efi_uart_console_only (void); |
| 595 | extern void efi_initialize_iomem_resources(struct resource *code_resource, | 595 | extern void efi_initialize_iomem_resources(struct resource *code_resource, |
| 596 | struct resource *data_resource, struct resource *bss_resource); | 596 | struct resource *data_resource, struct resource *bss_resource); |
| 597 | extern unsigned long efi_get_time(void); | 597 | extern void efi_get_time(struct timespec *now); |
| 598 | extern int efi_set_rtc_mmss(unsigned long nowtime); | 598 | extern int efi_set_rtc_mmss(const struct timespec *now); |
| 599 | extern void efi_reserve_boot_services(void); | 599 | extern void efi_reserve_boot_services(void); |
| 600 | extern struct efi_memory_map memmap; | 600 | extern struct efi_memory_map memmap; |
| 601 | 601 | ||
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index bbca12804d12..fc66b301b648 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
| @@ -229,7 +229,8 @@ static inline ktime_t timespec_to_ktime(const struct timespec ts) | |||
| 229 | static inline ktime_t timeval_to_ktime(const struct timeval tv) | 229 | static inline ktime_t timeval_to_ktime(const struct timeval tv) |
| 230 | { | 230 | { |
| 231 | return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec, | 231 | return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec, |
| 232 | .nsec = (s32)tv.tv_usec * 1000 } }; | 232 | .nsec = (s32)(tv.tv_usec * |
| 233 | NSEC_PER_USEC) } }; | ||
| 233 | } | 234 | } |
| 234 | 235 | ||
| 235 | /** | 236 | /** |
| @@ -320,12 +321,12 @@ static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier) | |||
| 320 | 321 | ||
| 321 | static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec) | 322 | static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec) |
| 322 | { | 323 | { |
| 323 | return ktime_add_ns(kt, usec * 1000); | 324 | return ktime_add_ns(kt, usec * NSEC_PER_USEC); |
| 324 | } | 325 | } |
| 325 | 326 | ||
| 326 | static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec) | 327 | static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec) |
| 327 | { | 328 | { |
| 328 | return ktime_sub_ns(kt, usec * 1000); | 329 | return ktime_sub_ns(kt, usec * NSEC_PER_USEC); |
| 329 | } | 330 | } |
| 330 | 331 | ||
| 331 | extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); | 332 | extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); |
| @@ -338,7 +339,8 @@ extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); | |||
| 338 | * | 339 | * |
| 339 | * Returns true if there was a successful conversion, false if kt was 0. | 340 | * Returns true if there was a successful conversion, false if kt was 0. |
| 340 | */ | 341 | */ |
| 341 | static inline bool ktime_to_timespec_cond(const ktime_t kt, struct timespec *ts) | 342 | static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt, |
| 343 | struct timespec *ts) | ||
| 342 | { | 344 | { |
| 343 | if (kt.tv64) { | 345 | if (kt.tv64) { |
| 344 | *ts = ktime_to_timespec(kt); | 346 | *ts = ktime_to_timespec(kt); |
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 7794d75ed155..907f3fd191ac 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h | |||
| @@ -7,14 +7,20 @@ | |||
| 7 | #include <linux/timex.h> | 7 | #include <linux/timex.h> |
| 8 | #include <linux/alarmtimer.h> | 8 | #include <linux/alarmtimer.h> |
| 9 | 9 | ||
| 10 | union cpu_time_count { | 10 | |
| 11 | cputime_t cpu; | 11 | static inline unsigned long long cputime_to_expires(cputime_t expires) |
| 12 | unsigned long long sched; | 12 | { |
| 13 | }; | 13 | return (__force unsigned long long)expires; |
| 14 | } | ||
| 15 | |||
| 16 | static inline cputime_t expires_to_cputime(unsigned long long expires) | ||
| 17 | { | ||
| 18 | return (__force cputime_t)expires; | ||
| 19 | } | ||
| 14 | 20 | ||
| 15 | struct cpu_timer_list { | 21 | struct cpu_timer_list { |
| 16 | struct list_head entry; | 22 | struct list_head entry; |
| 17 | union cpu_time_count expires, incr; | 23 | unsigned long long expires, incr; |
| 18 | struct task_struct *task; | 24 | struct task_struct *task; |
| 19 | int firing; | 25 | int firing; |
| 20 | }; | 26 | }; |
diff --git a/include/linux/pvclock_gtod.h b/include/linux/pvclock_gtod.h index 0ca75825b60d..a71d2dbd3610 100644 --- a/include/linux/pvclock_gtod.h +++ b/include/linux/pvclock_gtod.h | |||
| @@ -3,6 +3,13 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/notifier.h> | 4 | #include <linux/notifier.h> |
| 5 | 5 | ||
| 6 | /* | ||
| 7 | * The pvclock gtod notifier is called when the system time is updated | ||
| 8 | * and is used to keep guest time synchronized with host time. | ||
| 9 | * | ||
| 10 | * The 'action' parameter in the notifier function is false (0), or | ||
| 11 | * true (non-zero) if system time was stepped. | ||
| 12 | */ | ||
| 6 | extern int pvclock_gtod_register_notifier(struct notifier_block *nb); | 13 | extern int pvclock_gtod_register_notifier(struct notifier_block *nb); |
| 7 | extern int pvclock_gtod_unregister_notifier(struct notifier_block *nb); | 14 | extern int pvclock_gtod_unregister_notifier(struct notifier_block *nb); |
| 8 | 15 | ||
diff --git a/include/linux/sched_clock.h b/include/linux/sched_clock.h new file mode 100644 index 000000000000..fa7922c80a41 --- /dev/null +++ b/include/linux/sched_clock.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* | ||
| 2 | * sched_clock.h: support for extending counters to full 64-bit ns counter | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License version 2 as | ||
| 6 | * published by the Free Software Foundation. | ||
| 7 | */ | ||
| 8 | #ifndef LINUX_SCHED_CLOCK | ||
| 9 | #define LINUX_SCHED_CLOCK | ||
| 10 | |||
| 11 | #ifdef CONFIG_GENERIC_SCHED_CLOCK | ||
| 12 | extern void sched_clock_postinit(void); | ||
| 13 | #else | ||
| 14 | static inline void sched_clock_postinit(void) { } | ||
| 15 | #endif | ||
| 16 | |||
| 17 | extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate); | ||
| 18 | |||
| 19 | extern unsigned long long (*sched_clock_func)(void); | ||
| 20 | |||
| 21 | #endif | ||
