Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #ifndef _TICK_SCHED_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define _TICK_SCHED_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #include <linux/hrtimer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) enum tick_device_mode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 	TICKDEV_MODE_PERIODIC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 	TICKDEV_MODE_ONESHOT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) struct tick_device {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 	struct clock_event_device *evtdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 	enum tick_device_mode mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) enum tick_nohz_mode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	NOHZ_MODE_INACTIVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	NOHZ_MODE_LOWRES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	NOHZ_MODE_HIGHRES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * struct tick_sched - sched tick emulation and no idle tick control/stats
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * @sched_timer:	hrtimer to schedule the periodic tick in high
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  *			resolution mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * @check_clocks:	Notification mechanism about clocksource changes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * @nohz_mode:		Mode - one state of tick_nohz_mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * @inidle:		Indicator that the CPU is in the tick idle mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * @tick_stopped:	Indicator that the idle tick has been stopped
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * @idle_active:	Indicator that the CPU is actively in the tick idle mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  *			it is resetted during irq handling phases.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * @do_timer_lst:	CPU was the last one doing do_timer before going idle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * @got_idle_tick:	Tick timer function has run with @inidle set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  * @last_tick:		Store the last tick expiry time when the tick
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  *			timer is modified for nohz sleeps. This is necessary
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  *			to resume the tick timer operation in the timeline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  *			when the CPU returns from nohz sleep.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  * @next_tick:		Next tick to be fired when in dynticks mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * @idle_jiffies:	jiffies at the entry to idle for idle time accounting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  * @idle_calls:		Total number of idle calls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  * @idle_sleeps:	Number of idle calls, where the sched tick was stopped
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  * @idle_entrytime:	Time when the idle call was entered
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  * @idle_waketime:	Time when the idle was interrupted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  * @idle_exittime:	Time when the idle state was left
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  * @idle_sleeptime:	Sum of the time slept in idle with sched tick stopped
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  * @iowait_sleeptime:	Sum of the time slept in idle with sched tick stopped, with IO outstanding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * @timer_expires:	Anticipated timer expiration time (in case sched tick is stopped)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  * @timer_expires_base:	Base time clock monotonic for @timer_expires
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  * @next_timer:		Expiry time of next expiring timer for debugging purpose only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  * @tick_dep_mask:	Tick dependency mask - is set, if someone needs the tick
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) struct tick_sched {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	struct hrtimer			sched_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	unsigned long			check_clocks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	enum tick_nohz_mode		nohz_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	unsigned int			inidle		: 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	unsigned int			tick_stopped	: 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	unsigned int			idle_active	: 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	unsigned int			do_timer_last	: 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	unsigned int			got_idle_tick	: 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	ktime_t				last_tick;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	ktime_t				next_tick;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	unsigned long			idle_jiffies;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	unsigned long			idle_calls;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	unsigned long			idle_sleeps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	ktime_t				idle_entrytime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	ktime_t				idle_waketime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	ktime_t				idle_exittime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	ktime_t				idle_sleeptime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	ktime_t				iowait_sleeptime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	unsigned long			last_jiffies;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	u64				timer_expires;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	u64				timer_expires_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	u64				next_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	ktime_t				idle_expires;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	atomic_t			tick_dep_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) extern struct tick_sched *tick_get_tick_sched(int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) extern void tick_setup_sched_timer(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) #if defined CONFIG_NO_HZ_COMMON || defined CONFIG_HIGH_RES_TIMERS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) extern void tick_cancel_sched_timer(int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) static inline void tick_cancel_sched_timer(int cpu) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) extern int __tick_broadcast_oneshot_control(enum tick_broadcast_state state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) __tick_broadcast_oneshot_control(enum tick_broadcast_state state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #endif