@@ -83,13 +83,20 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =
8383 .get_time = & ktime_get_boottime ,
8484 .resolution = KTIME_LOW_RES ,
8585 },
86+ {
87+ .index = HRTIMER_BASE_TAI ,
88+ .clockid = CLOCK_TAI ,
89+ .get_time = & ktime_get_clocktai ,
90+ .resolution = KTIME_LOW_RES ,
91+ },
8692 }
8793};
8894
8995static const int hrtimer_clock_to_base_table [MAX_CLOCKS ] = {
9096 [CLOCK_REALTIME ] = HRTIMER_BASE_REALTIME ,
9197 [CLOCK_MONOTONIC ] = HRTIMER_BASE_MONOTONIC ,
9298 [CLOCK_BOOTTIME ] = HRTIMER_BASE_BOOTTIME ,
99+ [CLOCK_TAI ] = HRTIMER_BASE_TAI ,
93100};
94101
95102static inline int hrtimer_clockid_to_base (clockid_t clock_id )
@@ -106,15 +113,19 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
106113{
107114 ktime_t xtim , mono , boot ;
108115 struct timespec xts , tom , slp ;
116+ s32 tai_offset ;
109117
110118 get_xtime_and_monotonic_and_sleep_offset (& xts , & tom , & slp );
119+ tai_offset = timekeeping_get_tai_offset ();
111120
112121 xtim = timespec_to_ktime (xts );
113122 mono = ktime_add (xtim , timespec_to_ktime (tom ));
114123 boot = ktime_add (mono , timespec_to_ktime (slp ));
115124 base -> clock_base [HRTIMER_BASE_REALTIME ].softirq_time = xtim ;
116125 base -> clock_base [HRTIMER_BASE_MONOTONIC ].softirq_time = mono ;
117126 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 ));
118129}
119130
120131/*
@@ -651,8 +662,9 @@ static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base)
651662{
652663 ktime_t * offs_real = & base -> clock_base [HRTIMER_BASE_REALTIME ].offset ;
653664 ktime_t * offs_boot = & base -> clock_base [HRTIMER_BASE_BOOTTIME ].offset ;
665+ ktime_t * offs_tai = & base -> clock_base [HRTIMER_BASE_TAI ].offset ;
654666
655- return ktime_get_update_offsets (offs_real , offs_boot );
667+ return ktime_get_update_offsets (offs_real , offs_boot , offs_tai );
656668}
657669
658670/*
0 commit comments