]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - kernel/time/tick-internal.h
x86: c1e_idle: don't mark TSC unstable if CPU has invariant TSC
[mirror_ubuntu-artful-kernel.git] / kernel / time / tick-internal.h
CommitLineData
f8381cba
TG
1/*
2 * tick internal variable and functions used by low/high res code
3 */
6441402b
TG
4
5#define TICK_DO_TIMER_NONE -1
6#define TICK_DO_TIMER_BOOT -2
7
f8381cba
TG
8DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
9extern spinlock_t tick_device_lock;
10extern ktime_t tick_next_period;
11extern ktime_t tick_period;
d3ed7824 12extern int tick_do_timer_cpu __read_mostly;
f8381cba
TG
13
14extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast);
15extern void tick_handle_periodic(struct clock_event_device *dev);
16
2344abbc
TG
17extern void clockevents_shutdown(struct clock_event_device *dev);
18
79bf2bb3
TG
19/*
20 * NO_HZ / high resolution timer shared code
21 */
22#ifdef CONFIG_TICK_ONESHOT
23extern void tick_setup_oneshot(struct clock_event_device *newdev,
24 void (*handler)(struct clock_event_device *),
25 ktime_t nextevt);
1fb9b7d2
TG
26extern int tick_dev_program_event(struct clock_event_device *dev,
27 ktime_t expires, int force);
79bf2bb3
TG
28extern int tick_program_event(ktime_t expires, int force);
29extern void tick_oneshot_notify(void);
30extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *));
cd05a1f8 31extern void tick_resume_oneshot(void);
79bf2bb3
TG
32# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
33extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
34extern void tick_broadcast_oneshot_control(unsigned long reason);
35extern void tick_broadcast_switch_to_oneshot(void);
36extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
cd05a1f8 37extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
27ce4cb4 38extern int tick_broadcast_oneshot_active(void);
79bf2bb3
TG
39# else /* BROADCAST */
40static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
41{
42 BUG();
43}
44static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
45static inline void tick_broadcast_switch_to_oneshot(void) { }
46static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
27ce4cb4 47static inline int tick_broadcast_oneshot_active(void) { return 0; }
79bf2bb3
TG
48# endif /* !BROADCAST */
49
50#else /* !ONESHOT */
51static inline
52void tick_setup_oneshot(struct clock_event_device *newdev,
53 void (*handler)(struct clock_event_device *),
54 ktime_t nextevt)
55{
56 BUG();
57}
cd05a1f8
TG
58static inline void tick_resume_oneshot(void)
59{
60 BUG();
61}
79bf2bb3
TG
62static inline int tick_program_event(ktime_t expires, int force)
63{
64 return 0;
65}
66static inline void tick_oneshot_notify(void) { }
67static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
68{
69 BUG();
70}
71static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
72static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
cd05a1f8
TG
73static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
74{
75 return 0;
76}
79bf2bb3
TG
77#endif /* !TICK_ONESHOT */
78
f8381cba
TG
79/*
80 * Broadcasting support
81 */
82#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
f8381cba
TG
83extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu);
84extern int tick_check_broadcast_device(struct clock_event_device *dev);
85extern int tick_is_broadcast_device(struct clock_event_device *dev);
86extern void tick_broadcast_on_off(unsigned long reason, int *oncpu);
87extern void tick_shutdown_broadcast(unsigned int *cpup);
6321dd60
TG
88extern void tick_suspend_broadcast(void);
89extern int tick_resume_broadcast(void);
f8381cba
TG
90
91extern void
92tick_set_periodic_handler(struct clock_event_device *dev, int broadcast);
93
94#else /* !BROADCAST */
95
96static inline int tick_check_broadcast_device(struct clock_event_device *dev)
97{
98 return 0;
99}
100
101static inline int tick_is_broadcast_device(struct clock_event_device *dev)
102{
103 return 0;
104}
105static inline int tick_device_uses_broadcast(struct clock_event_device *dev,
106 int cpu)
107{
108 return 0;
109}
110static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { }
111static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { }
112static inline void tick_shutdown_broadcast(unsigned int *cpup) { }
6321dd60
TG
113static inline void tick_suspend_broadcast(void) { }
114static inline int tick_resume_broadcast(void) { return 0; }
f8381cba
TG
115
116/*
117 * Set the periodic handler in non broadcast mode
118 */
119static inline void tick_set_periodic_handler(struct clock_event_device *dev,
120 int broadcast)
121{
122 dev->event_handler = tick_handle_periodic;
123}
124#endif /* !BROADCAST */
125
126/*
127 * Check, if the device is functional or a dummy for broadcast
128 */
129static inline int tick_device_is_functional(struct clock_event_device *dev)
130{
131 return !(dev->features & CLOCK_EVT_FEAT_DUMMY);
132}