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 <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Martin Schwidefsky <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
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)