aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-01 19:15:18 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-01 19:15:18 -0400
commit174ddfd5dfbfc2d91a45332f809977050ac3fdc5 (patch)
tree825625de29439389f50da2fc2f92f3a51dff5f2d /include
parent3cb6653552ddd0b5670a445032ecb9f162e950ff (diff)
parentb94bf594cf8ed67cdd0439e70fa939783471597a (diff)
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer updates from Thomas Gleixner: "The timer departement delivers: - more year 2038 rework - a massive rework of the arm achitected timer - preparatory patches to allow NTP correction of clock event devices to avoid early expiry - the usual pile of fixes and enhancements all over the place" * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (91 commits) timer/sysclt: Restrict timer migration sysctl values to 0 and 1 arm64/arch_timer: Mark errata handlers as __maybe_unused Clocksource/mips-gic: Remove redundant non devicetree init MIPS/Malta: Probe gic-timer via devicetree clocksource: Use GENMASK_ULL in definition of CLOCKSOURCE_MASK acpi/arm64: Add SBSA Generic Watchdog support in GTDT driver clocksource: arm_arch_timer: add GTDT support for memory-mapped timer acpi/arm64: Add memory-mapped timer support in GTDT driver clocksource: arm_arch_timer: simplify ACPI support code. acpi/arm64: Add GTDT table parse driver clocksource: arm_arch_timer: split MMIO timer probing. clocksource: arm_arch_timer: add structs to describe MMIO timer clocksource: arm_arch_timer: move arch_timer_needs_of_probing into DT init call clocksource: arm_arch_timer: refactor arch_timer_needs_probing clocksource: arm_arch_timer: split dt-only rate handling x86/uv/time: Set ->min_delta_ticks and ->max_delta_ticks unicore32/time: Set ->min_delta_ticks and ->max_delta_ticks um/time: Set ->min_delta_ticks and ->max_delta_ticks tile/time: Set ->min_delta_ticks and ->max_delta_ticks score/time: Set ->min_delta_ticks and ->max_delta_ticks ...
Diffstat (limited to 'include')
-rw-r--r--include/clocksource/arm_arch_timer.h34
-rw-r--r--include/linux/acpi.h7
-rw-r--r--include/linux/clockchips.h1
-rw-r--r--include/linux/clocksource.h2
-rw-r--r--include/linux/hrtimer.h6
-rw-r--r--include/linux/irqchip/mips-gic.h1
-rw-r--r--include/linux/posix-clock.h10
-rw-r--r--include/linux/posix-timers.h20
-rw-r--r--include/linux/timekeeping.h20
9 files changed, 63 insertions, 38 deletions
diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h
index caedb74c9210..cc805b72994a 100644
--- a/include/clocksource/arm_arch_timer.h
+++ b/include/clocksource/arm_arch_timer.h
@@ -16,9 +16,13 @@
16#ifndef __CLKSOURCE_ARM_ARCH_TIMER_H 16#ifndef __CLKSOURCE_ARM_ARCH_TIMER_H
17#define __CLKSOURCE_ARM_ARCH_TIMER_H 17#define __CLKSOURCE_ARM_ARCH_TIMER_H
18 18
19#include <linux/bitops.h>
19#include <linux/timecounter.h> 20#include <linux/timecounter.h>
20#include <linux/types.h> 21#include <linux/types.h>
21 22
23#define ARCH_TIMER_TYPE_CP15 BIT(0)
24#define ARCH_TIMER_TYPE_MEM BIT(1)
25
22#define ARCH_TIMER_CTRL_ENABLE (1 << 0) 26#define ARCH_TIMER_CTRL_ENABLE (1 << 0)
23#define ARCH_TIMER_CTRL_IT_MASK (1 << 1) 27#define ARCH_TIMER_CTRL_IT_MASK (1 << 1)
24#define ARCH_TIMER_CTRL_IT_STAT (1 << 2) 28#define ARCH_TIMER_CTRL_IT_STAT (1 << 2)
@@ -34,11 +38,27 @@ enum arch_timer_reg {
34 ARCH_TIMER_REG_TVAL, 38 ARCH_TIMER_REG_TVAL,
35}; 39};
36 40
41enum arch_timer_ppi_nr {
42 ARCH_TIMER_PHYS_SECURE_PPI,
43 ARCH_TIMER_PHYS_NONSECURE_PPI,
44 ARCH_TIMER_VIRT_PPI,
45 ARCH_TIMER_HYP_PPI,
46 ARCH_TIMER_MAX_TIMER_PPI
47};
48
49enum arch_timer_spi_nr {
50 ARCH_TIMER_PHYS_SPI,
51 ARCH_TIMER_VIRT_SPI,
52 ARCH_TIMER_MAX_TIMER_SPI
53};
54
37#define ARCH_TIMER_PHYS_ACCESS 0 55#define ARCH_TIMER_PHYS_ACCESS 0
38#define ARCH_TIMER_VIRT_ACCESS 1 56#define ARCH_TIMER_VIRT_ACCESS 1
39#define ARCH_TIMER_MEM_PHYS_ACCESS 2 57#define ARCH_TIMER_MEM_PHYS_ACCESS 2
40#define ARCH_TIMER_MEM_VIRT_ACCESS 3 58#define ARCH_TIMER_MEM_VIRT_ACCESS 3
41 59
60#define ARCH_TIMER_MEM_MAX_FRAMES 8
61
42#define ARCH_TIMER_USR_PCT_ACCESS_EN (1 << 0) /* physical counter */ 62#define ARCH_TIMER_USR_PCT_ACCESS_EN (1 << 0) /* physical counter */
43#define ARCH_TIMER_USR_VCT_ACCESS_EN (1 << 1) /* virtual counter */ 63#define ARCH_TIMER_USR_VCT_ACCESS_EN (1 << 1) /* virtual counter */
44#define ARCH_TIMER_VIRT_EVT_EN (1 << 2) 64#define ARCH_TIMER_VIRT_EVT_EN (1 << 2)
@@ -54,6 +74,20 @@ struct arch_timer_kvm_info {
54 int virtual_irq; 74 int virtual_irq;
55}; 75};
56 76
77struct arch_timer_mem_frame {
78 bool valid;
79 phys_addr_t cntbase;
80 size_t size;
81 int phys_irq;
82 int virt_irq;
83};
84
85struct arch_timer_mem {
86 phys_addr_t cntctlbase;
87 size_t size;
88 struct arch_timer_mem_frame frame[ARCH_TIMER_MEM_MAX_FRAMES];
89};
90
57#ifdef CONFIG_ARM_ARCH_TIMER 91#ifdef CONFIG_ARM_ARCH_TIMER
58 92
59extern u32 arch_timer_get_rate(void); 93extern u32 arch_timer_get_rate(void);
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 91407f2d549f..f729adaac18b 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -591,6 +591,13 @@ enum acpi_reconfig_event {
591int acpi_reconfig_notifier_register(struct notifier_block *nb); 591int acpi_reconfig_notifier_register(struct notifier_block *nb);
592int acpi_reconfig_notifier_unregister(struct notifier_block *nb); 592int acpi_reconfig_notifier_unregister(struct notifier_block *nb);
593 593
594#ifdef CONFIG_ACPI_GTDT
595int acpi_gtdt_init(struct acpi_table_header *table, int *platform_timer_count);
596int acpi_gtdt_map_ppi(int type);
597bool acpi_gtdt_c3stop(int type);
598int acpi_arch_timer_mem_init(struct arch_timer_mem *timer_mem, int *timer_count);
599#endif
600
594#else /* !CONFIG_ACPI */ 601#else /* !CONFIG_ACPI */
595 602
596#define acpi_disabled 1 603#define acpi_disabled 1
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 6d7edc3082f9..acc9ce05e5f0 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -182,7 +182,6 @@ extern u64 clockevent_delta2ns(unsigned long latch, struct clock_event_device *e
182extern void clockevents_register_device(struct clock_event_device *dev); 182extern void clockevents_register_device(struct clock_event_device *dev);
183extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu); 183extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu);
184 184
185extern void clockevents_config(struct clock_event_device *dev, u32 freq);
186extern void clockevents_config_and_register(struct clock_event_device *dev, 185extern void clockevents_config_and_register(struct clock_event_device *dev,
187 u32 freq, unsigned long min_delta, 186 u32 freq, unsigned long min_delta,
188 unsigned long max_delta); 187 unsigned long max_delta);
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index cfc75848a35d..f2b10d9ebd04 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -120,7 +120,7 @@ struct clocksource {
120#define CLOCK_SOURCE_RESELECT 0x100 120#define CLOCK_SOURCE_RESELECT 0x100
121 121
122/* simplify initialization of mask field */ 122/* simplify initialization of mask field */
123#define CLOCKSOURCE_MASK(bits) (u64)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) 123#define CLOCKSOURCE_MASK(bits) GENMASK_ULL((bits) - 1, 0)
124 124
125static inline u32 clocksource_freq2mult(u32 freq, u32 shift_constant, u64 from) 125static inline u32 clocksource_freq2mult(u32 freq, u32 shift_constant, u64 from)
126{ 126{
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 249e579ecd4c..8c5b10eb7265 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -276,8 +276,6 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
276 return timer->base->cpu_base->hres_active; 276 return timer->base->cpu_base->hres_active;
277} 277}
278 278
279extern void hrtimer_peek_ahead_timers(void);
280
281/* 279/*
282 * The resolution of the clocks. The resolution value is returned in 280 * The resolution of the clocks. The resolution value is returned in
283 * the clock_getres() system call to give application programmers an 281 * the clock_getres() system call to give application programmers an
@@ -300,8 +298,6 @@ extern unsigned int hrtimer_resolution;
300 298
301#define hrtimer_resolution (unsigned int)LOW_RES_NSEC 299#define hrtimer_resolution (unsigned int)LOW_RES_NSEC
302 300
303static inline void hrtimer_peek_ahead_timers(void) { }
304
305static inline int hrtimer_is_hres_active(struct hrtimer *timer) 301static inline int hrtimer_is_hres_active(struct hrtimer *timer)
306{ 302{
307 return 0; 303 return 0;
@@ -456,7 +452,7 @@ static inline u64 hrtimer_forward_now(struct hrtimer *timer,
456} 452}
457 453
458/* Precise sleep: */ 454/* Precise sleep: */
459extern long hrtimer_nanosleep(struct timespec *rqtp, 455extern long hrtimer_nanosleep(struct timespec64 *rqtp,
460 struct timespec __user *rmtp, 456 struct timespec __user *rmtp,
461 const enum hrtimer_mode mode, 457 const enum hrtimer_mode mode,
462 const clockid_t clockid); 458 const clockid_t clockid);
diff --git a/include/linux/irqchip/mips-gic.h b/include/linux/irqchip/mips-gic.h
index 7b49c71c968b..2b0e56619e53 100644
--- a/include/linux/irqchip/mips-gic.h
+++ b/include/linux/irqchip/mips-gic.h
@@ -258,7 +258,6 @@ extern unsigned int gic_present;
258extern void gic_init(unsigned long gic_base_addr, 258extern void gic_init(unsigned long gic_base_addr,
259 unsigned long gic_addrspace_size, unsigned int cpu_vec, 259 unsigned long gic_addrspace_size, unsigned int cpu_vec,
260 unsigned int irqbase); 260 unsigned int irqbase);
261extern void gic_clocksource_init(unsigned int);
262extern u64 gic_read_count(void); 261extern u64 gic_read_count(void);
263extern unsigned int gic_get_count_width(void); 262extern unsigned int gic_get_count_width(void);
264extern u64 gic_read_compare(void); 263extern u64 gic_read_compare(void);
diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h
index 34c4498b800f..83b22ae9ae12 100644
--- a/include/linux/posix-clock.h
+++ b/include/linux/posix-clock.h
@@ -59,23 +59,23 @@ struct posix_clock_operations {
59 59
60 int (*clock_adjtime)(struct posix_clock *pc, struct timex *tx); 60 int (*clock_adjtime)(struct posix_clock *pc, struct timex *tx);
61 61
62 int (*clock_gettime)(struct posix_clock *pc, struct timespec *ts); 62 int (*clock_gettime)(struct posix_clock *pc, struct timespec64 *ts);
63 63
64 int (*clock_getres) (struct posix_clock *pc, struct timespec *ts); 64 int (*clock_getres) (struct posix_clock *pc, struct timespec64 *ts);
65 65
66 int (*clock_settime)(struct posix_clock *pc, 66 int (*clock_settime)(struct posix_clock *pc,
67 const struct timespec *ts); 67 const struct timespec64 *ts);
68 68
69 int (*timer_create) (struct posix_clock *pc, struct k_itimer *kit); 69 int (*timer_create) (struct posix_clock *pc, struct k_itimer *kit);
70 70
71 int (*timer_delete) (struct posix_clock *pc, struct k_itimer *kit); 71 int (*timer_delete) (struct posix_clock *pc, struct k_itimer *kit);
72 72
73 void (*timer_gettime)(struct posix_clock *pc, 73 void (*timer_gettime)(struct posix_clock *pc,
74 struct k_itimer *kit, struct itimerspec *tsp); 74 struct k_itimer *kit, struct itimerspec64 *tsp);
75 75
76 int (*timer_settime)(struct posix_clock *pc, 76 int (*timer_settime)(struct posix_clock *pc,
77 struct k_itimer *kit, int flags, 77 struct k_itimer *kit, int flags,
78 struct itimerspec *tsp, struct itimerspec *old); 78 struct itimerspec64 *tsp, struct itimerspec64 *old);
79 /* 79 /*
80 * Optional character device methods: 80 * Optional character device methods:
81 */ 81 */
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 64aa189efe21..8c1e43ab14a9 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -87,22 +87,22 @@ struct k_itimer {
87}; 87};
88 88
89struct k_clock { 89struct k_clock {
90 int (*clock_getres) (const clockid_t which_clock, struct timespec *tp); 90 int (*clock_getres) (const clockid_t which_clock, struct timespec64 *tp);
91 int (*clock_set) (const clockid_t which_clock, 91 int (*clock_set) (const clockid_t which_clock,
92 const struct timespec *tp); 92 const struct timespec64 *tp);
93 int (*clock_get) (const clockid_t which_clock, struct timespec * tp); 93 int (*clock_get) (const clockid_t which_clock, struct timespec64 *tp);
94 int (*clock_adj) (const clockid_t which_clock, struct timex *tx); 94 int (*clock_adj) (const clockid_t which_clock, struct timex *tx);
95 int (*timer_create) (struct k_itimer *timer); 95 int (*timer_create) (struct k_itimer *timer);
96 int (*nsleep) (const clockid_t which_clock, int flags, 96 int (*nsleep) (const clockid_t which_clock, int flags,
97 struct timespec *, struct timespec __user *); 97 struct timespec64 *, struct timespec __user *);
98 long (*nsleep_restart) (struct restart_block *restart_block); 98 long (*nsleep_restart) (struct restart_block *restart_block);
99 int (*timer_set) (struct k_itimer * timr, int flags, 99 int (*timer_set) (struct k_itimer *timr, int flags,
100 struct itimerspec * new_setting, 100 struct itimerspec64 *new_setting,
101 struct itimerspec * old_setting); 101 struct itimerspec64 *old_setting);
102 int (*timer_del) (struct k_itimer * timr); 102 int (*timer_del) (struct k_itimer *timr);
103#define TIMER_RETRY 1 103#define TIMER_RETRY 1
104 void (*timer_get) (struct k_itimer * timr, 104 void (*timer_get) (struct k_itimer *timr,
105 struct itimerspec * cur_setting); 105 struct itimerspec64 *cur_setting);
106}; 106};
107 107
108extern struct k_clock clock_posix_cpu; 108extern struct k_clock clock_posix_cpu;
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index b598cbc7b576..ddc229ff6d1e 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -19,21 +19,6 @@ extern void do_gettimeofday(struct timeval *tv);
19extern int do_settimeofday64(const struct timespec64 *ts); 19extern int do_settimeofday64(const struct timespec64 *ts);
20extern int do_sys_settimeofday64(const struct timespec64 *tv, 20extern int do_sys_settimeofday64(const struct timespec64 *tv,
21 const struct timezone *tz); 21 const struct timezone *tz);
22static inline int do_sys_settimeofday(const struct timespec *tv,
23 const struct timezone *tz)
24{
25 struct timespec64 ts64;
26
27 if (!tv)
28 return do_sys_settimeofday64(NULL, tz);
29
30 if (!timespec_valid(tv))
31 return -EINVAL;
32
33 ts64 = timespec_to_timespec64(*tv);
34 return do_sys_settimeofday64(&ts64, tz);
35}
36
37/* 22/*
38 * Kernel time accessors 23 * Kernel time accessors
39 */ 24 */
@@ -273,6 +258,11 @@ static inline void timekeeping_clocktai(struct timespec *ts)
273 *ts = ktime_to_timespec(ktime_get_clocktai()); 258 *ts = ktime_to_timespec(ktime_get_clocktai());
274} 259}
275 260
261static inline void timekeeping_clocktai64(struct timespec64 *ts)
262{
263 *ts = ktime_to_timespec64(ktime_get_clocktai());
264}
265
276/* 266/*
277 * RTC specific 267 * RTC specific
278 */ 268 */