Skip to content

Commit be2e0e4

Browse files
Pavel TatashinKAGA-KOKO
authored andcommitted
s390/time: Add read_persistent_wall_and_boot_offset()
read_persistent_wall_and_boot_offset() will replace read_boot_clock64() because on some architectures it is more convenient to read both sources as one may depend on the other. For s390, implementation is the same as read_boot_clock64() but also calling and returning value of read_persistent_clock64() Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: steven.sistare@oracle.com Cc: daniel.m.jordan@oracle.com Cc: linux@armlinux.org.uk Cc: heiko.carstens@de.ibm.com Cc: john.stultz@linaro.org Cc: sboyd@codeaurora.org Cc: hpa@zytor.com Cc: douly.fnst@cn.fujitsu.com Cc: peterz@infradead.org Cc: prarit@redhat.com Cc: feng.tang@intel.com Cc: pmladek@suse.com Cc: gnomes@lxorguk.ukuu.org.uk Cc: linux-s390@vger.kernel.org Cc: boris.ostrovsky@oracle.com Cc: jgross@suse.com Cc: pbonzini@redhat.com Link: https://lkml.kernel.org/r/20180719205545.16512-15-pasha.tatashin@oracle.com
1 parent 38669ba commit be2e0e4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

arch/s390/kernel/time.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,24 @@ void read_persistent_clock64(struct timespec64 *ts)
221221
ext_to_timespec64(clk, ts);
222222
}
223223

224+
void __init read_persistent_wall_and_boot_offset(struct timespec64 *wall_time,
225+
struct timespec64 *boot_offset)
226+
{
227+
unsigned char clk[STORE_CLOCK_EXT_SIZE];
228+
struct timespec64 boot_time;
229+
__u64 delta;
230+
231+
delta = initial_leap_seconds + TOD_UNIX_EPOCH;
232+
memcpy(clk, tod_clock_base, STORE_CLOCK_EXT_SIZE);
233+
*(__u64 *)&clk[1] -= delta;
234+
if (*(__u64 *)&clk[1] > delta)
235+
clk[0]--;
236+
ext_to_timespec64(clk, &boot_time);
237+
238+
read_persistent_clock64(wall_time);
239+
*boot_offset = timespec64_sub(*wall_time, boot_time);
240+
}
241+
224242
void read_boot_clock64(struct timespec64 *ts)
225243
{
226244
unsigned char clk[STORE_CLOCK_EXT_SIZE];

0 commit comments

Comments
 (0)