aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Tatashin <pasha.tatashin@oracle.com>2017-06-12 16:41:43 -0400
committerDavid S. Miller <davem@davemloft.net>2017-06-12 18:44:02 -0400
commitb5dd4d807f0fe7da67c5cc67b2ec681b60e4994b (patch)
tree37000602710190390a6ea209b17435fa3c3cdff3
parentb8a83fcb78c859b99807af4c8b0ab09f0f827a40 (diff)
sparc64: show time stamps from zero
On most platforms, time is shown from the beginning of boot. This patch is adding offset to sched_clock() for SPARC, to also show time from 0. This means we will have one more load, but we saved one in an ealier patch. Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com> Reviewed-by: Bob Picco <bob.picco@oracle.com> Reviewed-by: Steven Sistare <steven.sistare@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc/kernel/time_64.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index 6724bcbc3526..5f53b74dd493 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -392,6 +392,7 @@ static struct sparc64_tick_ops hbtick_operations __read_mostly = {
392}; 392};
393 393
394static unsigned long timer_ticks_per_nsec_quotient __read_mostly; 394static unsigned long timer_ticks_per_nsec_quotient __read_mostly;
395static unsigned long timer_offset __read_mostly;
395 396
396unsigned long cmos_regs; 397unsigned long cmos_regs;
397EXPORT_SYMBOL(cmos_regs); 398EXPORT_SYMBOL(cmos_regs);
@@ -786,6 +787,10 @@ void __init time_init(void)
786 timer_ticks_per_nsec_quotient = 787 timer_ticks_per_nsec_quotient =
787 clocksource_hz2mult(freq, SPARC64_NSEC_PER_CYC_SHIFT); 788 clocksource_hz2mult(freq, SPARC64_NSEC_PER_CYC_SHIFT);
788 789
790 timer_offset = (tick_operations.get_tick()
791 * timer_ticks_per_nsec_quotient)
792 >> SPARC64_NSEC_PER_CYC_SHIFT;
793
789 clocksource_tick.name = tick_operations.name; 794 clocksource_tick.name = tick_operations.name;
790 clocksource_tick.read = clocksource_tick_read; 795 clocksource_tick.read = clocksource_tick_read;
791 796
@@ -813,8 +818,9 @@ unsigned long long sched_clock(void)
813{ 818{
814 unsigned long ticks = tick_operations.get_tick(); 819 unsigned long ticks = tick_operations.get_tick();
815 820
816 return (ticks * timer_ticks_per_nsec_quotient) 821 return ((ticks * timer_ticks_per_nsec_quotient)
817 >> SPARC64_NSEC_PER_CYC_SHIFT; 822 >> SPARC64_NSEC_PER_CYC_SHIFT)
823 - timer_offset;
818} 824}
819 825
820int read_current_timer(unsigned long *timer_val) 826int read_current_timer(unsigned long *timer_val)