@@ -69,8 +69,6 @@ unsigned char ptff_function_mask[16];
6969
7070static unsigned long lpar_offset ;
7171static unsigned long initial_leap_seconds ;
72- static unsigned long tod_steering_end ;
73- static long tod_steering_delta ;
7472
7573/*
7674 * Get time offsets with PTFF
@@ -80,9 +78,7 @@ void __init time_early_init(void)
8078 struct ptff_qto qto ;
8179 struct ptff_qui qui ;
8280
83- /* Initialize TOD steering parameters */
84- tod_steering_end = tod_clock_base .tod ;
85- vdso_k_time_data -> arch_data .tod_steering_end = tod_steering_end ;
81+ vdso_k_time_data -> arch_data .tod_delta = tod_clock_base .tod ;
8682
8783 if (!test_facility (28 ))
8884 return ;
@@ -226,21 +222,7 @@ void __init read_persistent_wall_and_boot_offset(struct timespec64 *wall_time,
226222
227223static u64 read_tod_clock (struct clocksource * cs )
228224{
229- unsigned long now , adj ;
230-
231- preempt_disable (); /* protect from changes to steering parameters */
232- now = get_tod_clock ();
233- adj = tod_steering_end - now ;
234- if (unlikely ((s64 ) adj > 0 ))
235- /*
236- * manually steer by 1 cycle every 2^16 cycles. This
237- * corresponds to shifting the tod delta by 15. 1s is
238- * therefore steered in ~9h. The adjust will decrease
239- * over time, until it finally reaches 0.
240- */
241- now += (tod_steering_delta < 0 ) ? (adj >> 15 ) : - (adj >> 15 );
242- preempt_enable ();
243- return now ;
225+ return get_tod_clock_monotonic ();
244226}
245227
246228static struct clocksource clocksource_tod = {
@@ -369,26 +351,11 @@ static inline int check_sync_clock(void)
369351 */
370352static void clock_sync_global (long delta )
371353{
372- unsigned long now , adj ;
373354 struct ptff_qto qto ;
374355
375356 /* Fixup the monotonic sched clock. */
376357 tod_clock_base .eitod += delta ;
377- /* Adjust TOD steering parameters. */
378- now = get_tod_clock ();
379- adj = tod_steering_end - now ;
380- if (unlikely ((s64 ) adj >= 0 ))
381- /* Calculate how much of the old adjustment is left. */
382- tod_steering_delta = (tod_steering_delta < 0 ) ?
383- - (adj >> 15 ) : (adj >> 15 );
384- tod_steering_delta += delta ;
385- if ((abs (tod_steering_delta ) >> 48 ) != 0 )
386- panic ("TOD clock sync offset %li is too large to drift\n" ,
387- tod_steering_delta );
388- tod_steering_end = now + (abs (tod_steering_delta ) << 15 );
389- vdso_k_time_data -> arch_data .tod_steering_end = tod_steering_end ;
390- vdso_k_time_data -> arch_data .tod_steering_delta = tod_steering_delta ;
391-
358+ vdso_k_time_data -> arch_data .tod_delta = tod_clock_base .tod ;
392359 /* Update LPAR offset. */
393360 if (ptff_query (PTFF_QTO ) && ptff (& qto , sizeof (qto ), PTFF_QTO ) == 0 )
394361 lpar_offset = qto .tod_epoch_difference ;
0 commit comments