aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/platform
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@citrix.com>2013-05-13 13:56:06 -0400
committerJohn Stultz <john.stultz@linaro.org>2013-05-28 17:00:59 -0400
commit3565184ed0c1ea46bea5b792da5f72a83c43e49b (patch)
tree4846a589a6aa295634ef585e5637872f15c19993 /arch/x86/platform
parent0a0a7e66fa269de78975ea8d4e825a66d92b8d70 (diff)
x86: Increase precision of x86_platform.get/set_wallclock()
All the virtualized platforms (KVM, lguest and Xen) have persistent wallclocks that have more than one second of precision. read_persistent_wallclock() and update_persistent_wallclock() allow for nanosecond precision but their implementation on x86 with x86_platform.get/set_wallclock() only allows for one second precision. This means guests may see a wallclock time that is off by up to 1 second. Make set_wallclock() and get_wallclock() take a struct timespec parameter (which allows for nanosecond precision) so KVM and Xen guests may start with a more accurate wallclock time and a Xen dom0 can maintain a more accurate wallclock for guests. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'arch/x86/platform')
-rw-r--r--arch/x86/platform/efi/efi.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 55856b2310d3..dd3b82530145 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -352,8 +352,9 @@ static efi_status_t __init phys_efi_get_time(efi_time_t *tm,
352 return status; 352 return status;
353} 353}
354 354
355int efi_set_rtc_mmss(unsigned long nowtime) 355int efi_set_rtc_mmss(const struct timespec *now)
356{ 356{
357 unsigned long nowtime = now->tv_sec;
357 efi_status_t status; 358 efi_status_t status;
358 efi_time_t eft; 359 efi_time_t eft;
359 efi_time_cap_t cap; 360 efi_time_cap_t cap;
@@ -388,7 +389,7 @@ int efi_set_rtc_mmss(unsigned long nowtime)
388 return 0; 389 return 0;
389} 390}
390 391
391unsigned long efi_get_time(void) 392void efi_get_time(struct timespec *now)
392{ 393{
393 efi_status_t status; 394 efi_status_t status;
394 efi_time_t eft; 395 efi_time_t eft;
@@ -398,8 +399,9 @@ unsigned long efi_get_time(void)
398 if (status != EFI_SUCCESS) 399 if (status != EFI_SUCCESS)
399 pr_err("Oops: efitime: can't read time!\n"); 400 pr_err("Oops: efitime: can't read time!\n");
400 401
401 return mktime(eft.year, eft.month, eft.day, eft.hour, 402 now->tv_sec = mktime(eft.year, eft.month, eft.day, eft.hour,
402 eft.minute, eft.second); 403 eft.minute, eft.second);
404 now->tv_nsec = 0;
403} 405}
404 406
405/* 407/*