drm/ast: Only warn about unsupported TX chips on Gen4 and later
[drm/drm-misc.git] / include / linux / posix-timers_types.h
bloba4712c1008c97fbc3caa18541e77529d059b0fe3
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _linux_POSIX_TIMERS_TYPES_H
3 #define _linux_POSIX_TIMERS_TYPES_H
5 #include <linux/mutex_types.h>
6 #include <linux/timerqueue_types.h>
7 #include <linux/types.h>
9 /*
10 * Bit fields within a clockid:
12 * The most significant 29 bits hold either a pid or a file descriptor.
14 * Bit 2 indicates whether a cpu clock refers to a thread or a process.
16 * Bits 1 and 0 give the type: PROF=0, VIRT=1, SCHED=2, or FD=3.
18 * A clockid is invalid if bits 2, 1, and 0 are all set.
20 #define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3))
21 #define CPUCLOCK_PERTHREAD(clock) \
22 (((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0)
24 #define CPUCLOCK_PERTHREAD_MASK 4
25 #define CPUCLOCK_WHICH(clock) ((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK)
26 #define CPUCLOCK_CLOCK_MASK 3
27 #define CPUCLOCK_PROF 0
28 #define CPUCLOCK_VIRT 1
29 #define CPUCLOCK_SCHED 2
30 #define CPUCLOCK_MAX 3
31 #define CLOCKFD CPUCLOCK_MAX
32 #define CLOCKFD_MASK (CPUCLOCK_PERTHREAD_MASK|CPUCLOCK_CLOCK_MASK)
34 #ifdef CONFIG_POSIX_TIMERS
36 /**
37 * posix_cputimer_base - Container per posix CPU clock
38 * @nextevt: Earliest-expiration cache
39 * @tqhead: timerqueue head for cpu_timers
41 struct posix_cputimer_base {
42 u64 nextevt;
43 struct timerqueue_head tqhead;
46 /**
47 * posix_cputimers - Container for posix CPU timer related data
48 * @bases: Base container for posix CPU clocks
49 * @timers_active: Timers are queued.
50 * @expiry_active: Timer expiry is active. Used for
51 * process wide timers to avoid multiple
52 * task trying to handle expiry concurrently
54 * Used in task_struct and signal_struct
56 struct posix_cputimers {
57 struct posix_cputimer_base bases[CPUCLOCK_MAX];
58 unsigned int timers_active;
59 unsigned int expiry_active;
62 /**
63 * posix_cputimers_work - Container for task work based posix CPU timer expiry
64 * @work: The task work to be scheduled
65 * @mutex: Mutex held around expiry in context of this task work
66 * @scheduled: @work has been scheduled already, no further processing
68 struct posix_cputimers_work {
69 struct callback_head work;
70 struct mutex mutex;
71 unsigned int scheduled;
74 #else /* CONFIG_POSIX_TIMERS */
76 struct posix_cputimers { };
78 #endif /* CONFIG_POSIX_TIMERS */
80 #endif /* _linux_POSIX_TIMERS_TYPES_H */