Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e27c4929 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Thomas Gleixner
Browse files

x86: Convert x86_platform_ops to timespec64



The x86 platform operations are fairly isolated, so it's easy to change
them from using timespec to timespec64. It has been checked that all the
users and callers are safe, and there is only one critical function that is
broken beyond 2106:

  pvclock_read_wallclock() uses a 32-bit number of seconds since the epoch
  to communicate the boot time between host and guest in a virtual
  environment. This will work until 2106, but fixing this is outside the
  scope of this change, Add a comment at least.

Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
Acked-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
Acked-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: jailhouse-dev@googlegroups.com
Cc: Borislav Petkov <bp@suse.de>
Cc: kvm@vger.kernel.org
Cc: y2038@lists.linaro.org
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: xen-devel@lists.xenproject.org
Cc: John Stultz <john.stultz@linaro.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Joao Martins <joao.m.martins@oracle.com>
Link: https://lkml.kernel.org/r/20180427201435.3194219-1-arnd@arndb.de
parent 06aa3769
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@

extern unsigned char vrtc_cmos_read(unsigned char reg);
extern void vrtc_cmos_write(unsigned char val, unsigned char reg);
extern void vrtc_get_time(struct timespec *now);
extern int vrtc_set_mmss(const struct timespec *now);
extern void vrtc_get_time(struct timespec64 *now);
extern int vrtc_set_mmss(const struct timespec64 *now);

#endif
+2 −2
Original line number Diff line number Diff line
@@ -95,8 +95,8 @@ static inline unsigned char current_lock_cmos_reg(void)
unsigned char rtc_cmos_read(unsigned char addr);
void rtc_cmos_write(unsigned char val, unsigned char addr);

extern int mach_set_rtc_mmss(const struct timespec *now);
extern void mach_get_cmos_time(struct timespec *now);
extern int mach_set_rtc_mmss(const struct timespec64 *now);
extern void mach_get_cmos_time(struct timespec64 *now);

#define RTC_IRQ 8

+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ void pvclock_set_flags(u8 flags);
unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src);
void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
			    struct pvclock_vcpu_time_info *vcpu,
			    struct timespec *ts);
			    struct timespec64 *ts);
void pvclock_resume(void);

void pvclock_touch_watchdogs(void);
+3 −3
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ struct x86_cpuinit_ops {
	void (*fixup_cpu_id)(struct cpuinfo_x86 *c, int node);
};

struct timespec;
struct timespec64;

/**
 * struct x86_legacy_devices - legacy x86 devices
@@ -264,8 +264,8 @@ struct x86_hyper_runtime {
struct x86_platform_ops {
	unsigned long (*calibrate_cpu)(void);
	unsigned long (*calibrate_tsc)(void);
	void (*get_wallclock)(struct timespec *ts);
	int (*set_wallclock)(const struct timespec *ts);
	void (*get_wallclock)(struct timespec64 *ts);
	int (*set_wallclock)(const struct timespec64 *ts);
	void (*iommu_shutdown)(void);
	bool (*is_untracked_pat_range)(u64 start, u64 end);
	void (*nmi_init)(void);
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ static uint32_t __init jailhouse_detect(void)
	return jailhouse_cpuid_base();
}

static void jailhouse_get_wallclock(struct timespec *now)
static void jailhouse_get_wallclock(struct timespec64 *now)
{
	memset(now, 0, sizeof(*now));
}
Loading