diff options
Diffstat (limited to 'arch/s390/kernel/time.c')
| -rw-r--r-- | arch/s390/kernel/time.c | 33 | 
1 files changed, 18 insertions, 15 deletions
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index 7fcd690d42c..876546b9cfa 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c @@ -63,7 +63,7 @@ static DEFINE_PER_CPU(struct clock_event_device, comparators);   */  unsigned long long notrace __kprobes sched_clock(void)  { -	return (get_clock_monotonic() * 125) >> 9; +	return tod_to_ns(get_tod_clock_monotonic());  }  /* @@ -120,6 +120,9 @@ static int s390_next_ktime(ktime_t expires,  	nsecs = ktime_to_ns(ktime_add(timespec_to_ktime(ts), expires));  	do_div(nsecs, 125);  	S390_lowcore.clock_comparator = sched_clock_base_cc + (nsecs << 9); +	/* Program the maximum value if we have an overflow (== year 2042) */ +	if (unlikely(S390_lowcore.clock_comparator < sched_clock_base_cc)) +		S390_lowcore.clock_comparator = -1ULL;  	set_clock_comparator(S390_lowcore.clock_comparator);  	return 0;  } @@ -168,7 +171,7 @@ static void clock_comparator_interrupt(struct ext_code ext_code,  				       unsigned int param32,  				       unsigned long param64)  { -	kstat_cpu(smp_processor_id()).irqs[EXTINT_CLK]++; +	inc_irq_stat(IRQEXT_CLK);  	if (S390_lowcore.clock_comparator == -1ULL)  		set_clock_comparator(S390_lowcore.clock_comparator);  } @@ -179,7 +182,7 @@ static void stp_timing_alert(struct stp_irq_parm *);  static void timing_alert_interrupt(struct ext_code ext_code,  				   unsigned int param32, unsigned long param64)  { -	kstat_cpu(smp_processor_id()).irqs[EXTINT_TLA]++; +	inc_irq_stat(IRQEXT_TLA);  	if (param32 & 0x00c40000)  		etr_timing_alert((struct etr_irq_parm *) ¶m32);  	if (param32 & 0x00038000) @@ -191,7 +194,7 @@ static void stp_reset(void);  void read_persistent_clock(struct timespec *ts)  { -	tod_to_timeval(get_clock() - TOD_UNIX_EPOCH, ts); +	tod_to_timeval(get_tod_clock() - TOD_UNIX_EPOCH, ts);  }  void read_boot_clock(struct timespec *ts) @@ -201,7 +204,7 @@ void read_boot_clock(struct timespec *ts)  static cycle_t read_tod_clock(struct clocksource *cs)  { -	return get_clock(); +	return get_tod_clock();  }  static struct clocksource clocksource_tod = { @@ -339,7 +342,7 @@ int get_sync_clock(unsigned long long *clock)  	sw_ptr = &get_cpu_var(clock_sync_word);  	sw0 = atomic_read(sw_ptr); -	*clock = get_clock(); +	*clock = get_tod_clock();  	sw1 = atomic_read(sw_ptr);  	put_cpu_var(clock_sync_word);  	if (sw0 == sw1 && (sw0 & 0x80000000U)) @@ -483,7 +486,7 @@ static void etr_reset(void)  		.p0 = 0, .p1 = 0, ._pad1 = 0, .ea = 0,  		.es = 0, .sl = 0 };  	if (etr_setr(&etr_eacr) == 0) { -		etr_tolec = get_clock(); +		etr_tolec = get_tod_clock();  		set_bit(CLOCK_SYNC_HAS_ETR, &clock_sync_flags);  		if (etr_port0_online && etr_port1_online)  			set_bit(CLOCK_SYNC_ETR, &clock_sync_flags); @@ -765,8 +768,8 @@ static int etr_sync_clock(void *data)  	__ctl_set_bit(14, 21);  	__ctl_set_bit(0, 29);  	clock = ((unsigned long long) (aib->edf2.etv + 1)) << 32; -	old_clock = get_clock(); -	if (set_clock(clock) == 0) { +	old_clock = get_tod_clock(); +	if (set_tod_clock(clock) == 0) {  		__udelay(1);	/* Wait for the clock to start. */  		__ctl_clear_bit(0, 29);  		__ctl_clear_bit(14, 21); @@ -842,7 +845,7 @@ static struct etr_eacr etr_handle_events(struct etr_eacr eacr)  			 * assume that this can have caused an stepping  			 * port switch.  			 */ -			etr_tolec = get_clock(); +			etr_tolec = get_tod_clock();  		eacr.p0 = etr_port0_online;  		if (!eacr.p0)  			eacr.e0 = 0; @@ -855,7 +858,7 @@ static struct etr_eacr etr_handle_events(struct etr_eacr eacr)  			 * assume that this can have caused an stepping  			 * port switch.  			 */ -			etr_tolec = get_clock(); +			etr_tolec = get_tod_clock();  		eacr.p1 = etr_port1_online;  		if (!eacr.p1)  			eacr.e1 = 0; @@ -971,7 +974,7 @@ static void etr_update_eacr(struct etr_eacr eacr)  	etr_eacr = eacr;  	etr_setr(&etr_eacr);  	if (dp_changed) -		etr_tolec = get_clock(); +		etr_tolec = get_tod_clock();  }  /* @@ -1009,7 +1012,7 @@ static void etr_work_fn(struct work_struct *work)  	/* Store aib to get the current ETR status word. */  	BUG_ON(etr_stetr(&aib) != 0);  	etr_port0.esw = etr_port1.esw = aib.esw;	/* Copy status word. */ -	now = get_clock(); +	now = get_tod_clock();  	/*  	 * Update the port information if the last stepping port change @@ -1534,10 +1537,10 @@ static int stp_sync_clock(void *data)  	if (stp_info.todoff[0] || stp_info.todoff[1] ||  	    stp_info.todoff[2] || stp_info.todoff[3] ||  	    stp_info.tmd != 2) { -		old_clock = get_clock(); +		old_clock = get_tod_clock();  		rc = chsc_sstpc(stp_page, STP_OP_SYNC, 0);  		if (rc == 0) { -			delta = adjust_time(old_clock, get_clock(), 0); +			delta = adjust_time(old_clock, get_tod_clock(), 0);  			fixup_clock_comparator(delta);  			rc = chsc_sstpi(stp_page, &stp_info,  					sizeof(struct stp_sstpi));  |