aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/hrtimer.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/hrtimer.c')
-rw-r--r--kernel/hrtimer.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 031184e3d872..d6830d5ae730 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -83,6 +83,12 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =
83 .get_time = &ktime_get_boottime, 83 .get_time = &ktime_get_boottime,
84 .resolution = KTIME_LOW_RES, 84 .resolution = KTIME_LOW_RES,
85 }, 85 },
86 {
87 .index = HRTIMER_BASE_TAI,
88 .clockid = CLOCK_TAI,
89 .get_time = &ktime_get_clocktai,
90 .resolution = KTIME_LOW_RES,
91 },
86 } 92 }
87}; 93};
88 94
@@ -90,6 +96,7 @@ static const int hrtimer_clock_to_base_table[MAX_CLOCKS] = {
90 [CLOCK_REALTIME] = HRTIMER_BASE_REALTIME, 96 [CLOCK_REALTIME] = HRTIMER_BASE_REALTIME,
91 [CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC, 97 [CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC,
92 [CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME, 98 [CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME,
99 [CLOCK_TAI] = HRTIMER_BASE_TAI,
93}; 100};
94 101
95static inline int hrtimer_clockid_to_base(clockid_t clock_id) 102static inline int hrtimer_clockid_to_base(clockid_t clock_id)
@@ -106,8 +113,10 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
106{ 113{
107 ktime_t xtim, mono, boot; 114 ktime_t xtim, mono, boot;
108 struct timespec xts, tom, slp; 115 struct timespec xts, tom, slp;
116 s32 tai_offset;
109 117
110 get_xtime_and_monotonic_and_sleep_offset(&xts, &tom, &slp); 118 get_xtime_and_monotonic_and_sleep_offset(&xts, &tom, &slp);
119 tai_offset = timekeeping_get_tai_offset();
111 120
112 xtim = timespec_to_ktime(xts); 121 xtim = timespec_to_ktime(xts);
113 mono = ktime_add(xtim, timespec_to_ktime(tom)); 122 mono = ktime_add(xtim, timespec_to_ktime(tom));
@@ -115,6 +124,8 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
115 base->clock_base[HRTIMER_BASE_REALTIME].softirq_time = xtim; 124 base->clock_base[HRTIMER_BASE_REALTIME].softirq_time = xtim;
116 base->clock_base[HRTIMER_BASE_MONOTONIC].softirq_time = mono; 125 base->clock_base[HRTIMER_BASE_MONOTONIC].softirq_time = mono;
117 base->clock_base[HRTIMER_BASE_BOOTTIME].softirq_time = boot; 126 base->clock_base[HRTIMER_BASE_BOOTTIME].softirq_time = boot;
127 base->clock_base[HRTIMER_BASE_TAI].softirq_time =
128 ktime_add(xtim, ktime_set(tai_offset, 0));
118} 129}
119 130
120/* 131/*
@@ -651,8 +662,9 @@ static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base)
651{ 662{
652 ktime_t *offs_real = &base->clock_base[HRTIMER_BASE_REALTIME].offset; 663 ktime_t *offs_real = &base->clock_base[HRTIMER_BASE_REALTIME].offset;
653 ktime_t *offs_boot = &base->clock_base[HRTIMER_BASE_BOOTTIME].offset; 664 ktime_t *offs_boot = &base->clock_base[HRTIMER_BASE_BOOTTIME].offset;
665 ktime_t *offs_tai = &base->clock_base[HRTIMER_BASE_TAI].offset;
654 666
655 return ktime_get_update_offsets(offs_real, offs_boot); 667 return ktime_get_update_offsets(offs_real, offs_boot, offs_tai);
656} 668}
657 669
658/* 670/*