Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/rtas: Make timestamp related code y2038-safe

While we are here, let us make timestamp related code y2038-safe.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Hari Bathini and committed by
Michael Ellerman
e4a9616c f7618299

+10 -9
+2 -1
arch/powerpc/include/asm/rtas.h
··· 4 4 5 5 #include <linux/spinlock.h> 6 6 #include <asm/page.h> 7 + #include <linux/time.h> 7 8 8 9 /* 9 10 * Definitions for talking to the RTAS on CHRP machines. ··· 344 343 extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal); 345 344 346 345 #ifdef CONFIG_PPC_PSERIES 347 - extern unsigned long last_rtas_event; 346 + extern time64_t last_rtas_event; 348 347 extern int clobbering_unread_rtas_event(void); 349 348 extern int pseries_devicetree_update(s32 scope); 350 349 extern void post_mobility_fixup(void);
+3 -3
arch/powerpc/kernel/nvram_64.c
··· 376 376 } 377 377 oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION); 378 378 oops_hdr->report_length = cpu_to_be16(zipped_len); 379 - oops_hdr->timestamp = cpu_to_be64(get_seconds()); 379 + oops_hdr->timestamp = cpu_to_be64(ktime_get_real_seconds()); 380 380 return 0; 381 381 } 382 382 ··· 423 423 424 424 oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION); 425 425 oops_hdr->report_length = cpu_to_be16(size); 426 - oops_hdr->timestamp = cpu_to_be64(get_seconds()); 426 + oops_hdr->timestamp = cpu_to_be64(ktime_get_real_seconds()); 427 427 428 428 if (compressed) 429 429 err_type = ERR_TYPE_KERNEL_PANIC_GZ; ··· 721 721 err_type = ERR_TYPE_KERNEL_PANIC; 722 722 oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION); 723 723 oops_hdr->report_length = cpu_to_be16(text_len); 724 - oops_hdr->timestamp = cpu_to_be64(get_seconds()); 724 + oops_hdr->timestamp = cpu_to_be64(ktime_get_real_seconds()); 725 725 } 726 726 727 727 (void) nvram_write_os_partition(&oops_log_partition, oops_buf,
+5 -5
arch/powerpc/platforms/pseries/nvram.c
··· 36 36 37 37 /* See clobbering_unread_rtas_event() */ 38 38 #define NVRAM_RTAS_READ_TIMEOUT 5 /* seconds */ 39 - static unsigned long last_unread_rtas_event; /* timestamp */ 39 + static time64_t last_unread_rtas_event; /* timestamp */ 40 40 41 41 #ifdef CONFIG_PSTORE 42 - unsigned long last_rtas_event; 42 + time64_t last_rtas_event; 43 43 #endif 44 44 45 45 static ssize_t pSeries_nvram_read(char *buf, size_t count, loff_t *index) ··· 144 144 int rc = nvram_write_os_partition(&rtas_log_partition, buff, length, 145 145 err_type, error_log_cnt); 146 146 if (!rc) { 147 - last_unread_rtas_event = get_seconds(); 147 + last_unread_rtas_event = ktime_get_real_seconds(); 148 148 #ifdef CONFIG_PSTORE 149 - last_rtas_event = get_seconds(); 149 + last_rtas_event = ktime_get_real_seconds(); 150 150 #endif 151 151 } 152 152 ··· 200 200 { 201 201 return (oops_log_partition.index == rtas_log_partition.index 202 202 && last_unread_rtas_event 203 - && get_seconds() - last_unread_rtas_event <= 203 + && ktime_get_real_seconds() - last_unread_rtas_event <= 204 204 NVRAM_RTAS_READ_TIMEOUT); 205 205 } 206 206