#include <linux/cpu.h>
#include <linux/err.h>
#include <linux/hrtimer.h>
#include <linux/interrupt.h>
#include <linux/percpu.h>
#include <linux/profile.h>
#include <linux/sched.h>
#include <linux/smp.h>
#include <linux/module.h>
#include "tick-internal.h"
static struct tick_device tick_broadcast_device;
static cpumask_var_t tick_broadcast_mask __cpumask_var_read_mostly;
static cpumask_var_t tick_broadcast_on __cpumask_var_read_mostly;
static cpumask_var_t tmpmask __cpumask_var_read_mostly;
static int tick_broadcast_forced;
static __cacheline_aligned_in_smp DEFINE_RAW_SPINLOCK(tick_broadcast_lock);
#ifdef CONFIG_TICK_ONESHOT
static DEFINE_PER_CPU(struct clock_event_device *, tick_oneshot_wakeup_device);
static void tick_broadcast_setup_oneshot(struct clock_event_device *bc, bool from_periodic);
static void tick_broadcast_clear_oneshot(int cpu);
static void tick_resume_broadcast_oneshot(struct clock_event_device *bc);
# ifdef CONFIG_HOTPLUG_CPU
static void tick_broadcast_oneshot_offline(unsigned int cpu);
# endif
#else
static inline void
tick_broadcast_setup_oneshot(struct clock_event_device *bc, bool from_periodic) { BUG(); }
static inline void tick_broadcast_clear_oneshot(int cpu) { }
static inline void tick_resume_broadcast_oneshot(struct clock_event_device *bc) { }
# ifdef CONFIG_HOTPLUG_CPU
static inline void tick_broadcast_oneshot_offline(unsigned int cpu) { }
# endif
#endif
struct tick_device *tick_get_broadcast_device(void)
{ … }
struct cpumask *tick_get_broadcast_mask(void)
{ … }
static struct clock_event_device *tick_get_oneshot_wakeup_device(int cpu);
const struct clock_event_device *tick_get_wakeup_device(int cpu)
{ … }
static void tick_broadcast_start_periodic(struct clock_event_device *bc)
{ … }
static bool tick_check_broadcast_device(struct clock_event_device *curdev,
struct clock_event_device *newdev)
{ … }
#ifdef CONFIG_TICK_ONESHOT
static struct clock_event_device *tick_get_oneshot_wakeup_device(int cpu)
{ … }
static void tick_oneshot_wakeup_handler(struct clock_event_device *wd)
{ … }
static bool tick_set_oneshot_wakeup_device(struct clock_event_device *newdev,
int cpu)
{ … }
#else
static struct clock_event_device *tick_get_oneshot_wakeup_device(int cpu)
{
return NULL;
}
static bool tick_set_oneshot_wakeup_device(struct clock_event_device *newdev,
int cpu)
{
return false;
}
#endif
void tick_install_broadcast_device(struct clock_event_device *dev, int cpu)
{ … }
int tick_is_broadcast_device(struct clock_event_device *dev)
{ … }
int tick_broadcast_update_freq(struct clock_event_device *dev, u32 freq)
{ … }
static void err_broadcast(const struct cpumask *mask)
{ … }
static void tick_device_setup_broadcast_func(struct clock_event_device *dev)
{ … }
int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu)
{ … }
int tick_receive_broadcast(void)
{ … }
static bool tick_do_broadcast(struct cpumask *mask)
{ … }
static bool tick_do_periodic_broadcast(void)
{ … }
static void tick_handle_periodic_broadcast(struct clock_event_device *dev)
{ … }
void tick_broadcast_control(enum tick_broadcast_mode mode)
{ … }
EXPORT_SYMBOL_GPL(…);
void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast)
{ … }
#ifdef CONFIG_HOTPLUG_CPU
static void tick_shutdown_broadcast(void)
{ … }
void tick_broadcast_offline(unsigned int cpu)
{ … }
#endif
void tick_suspend_broadcast(void)
{ … }
bool tick_resume_check_broadcast(void)
{ … }
void tick_resume_broadcast(void)
{ … }
#ifdef CONFIG_TICK_ONESHOT
static cpumask_var_t tick_broadcast_oneshot_mask __cpumask_var_read_mostly;
static cpumask_var_t tick_broadcast_pending_mask __cpumask_var_read_mostly;
static cpumask_var_t tick_broadcast_force_mask __cpumask_var_read_mostly;
struct cpumask *tick_get_broadcast_oneshot_mask(void)
{ … }
noinstr int tick_check_broadcast_expired(void)
{ … }
static void tick_broadcast_set_affinity(struct clock_event_device *bc,
const struct cpumask *cpumask)
{ … }
static void tick_broadcast_set_event(struct clock_event_device *bc, int cpu,
ktime_t expires)
{ … }
static void tick_resume_broadcast_oneshot(struct clock_event_device *bc)
{ … }
void tick_check_oneshot_broadcast_this_cpu(void)
{ … }
static void tick_handle_oneshot_broadcast(struct clock_event_device *dev)
{ … }
static int broadcast_needs_cpu(struct clock_event_device *bc, int cpu)
{ … }
static void broadcast_shutdown_local(struct clock_event_device *bc,
struct clock_event_device *dev)
{ … }
static int ___tick_broadcast_oneshot_control(enum tick_broadcast_state state,
struct tick_device *td,
int cpu)
{ … }
static int tick_oneshot_wakeup_control(enum tick_broadcast_state state,
struct tick_device *td,
int cpu)
{ … }
int __tick_broadcast_oneshot_control(enum tick_broadcast_state state)
{ … }
static void tick_broadcast_clear_oneshot(int cpu)
{ … }
static void tick_broadcast_init_next_event(struct cpumask *mask,
ktime_t expires)
{ … }
static inline ktime_t tick_get_next_period(void)
{ … }
static void tick_broadcast_setup_oneshot(struct clock_event_device *bc,
bool from_periodic)
{ … }
void tick_broadcast_switch_to_oneshot(void)
{ … }
#ifdef CONFIG_HOTPLUG_CPU
void hotplug_cpu__broadcast_tick_pull(int deadcpu)
{ … }
static void tick_broadcast_oneshot_offline(unsigned int cpu)
{ … }
#endif
int tick_broadcast_oneshot_active(void)
{ … }
bool tick_broadcast_oneshot_available(void)
{ … }
#else
int __tick_broadcast_oneshot_control(enum tick_broadcast_state state)
{
struct clock_event_device *bc = tick_broadcast_device.evtdev;
if (!bc || (bc->features & CLOCK_EVT_FEAT_HRTIMER))
return -EBUSY;
return 0;
}
#endif
void __init tick_broadcast_init(void)
{ … }