]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
x86/time: report correct frequency of Xen PV clocksource
authorIgor Druzhinin <igor.druzhinin@citrix.com>
Tue, 4 Feb 2020 21:49:37 +0000 (21:49 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 14 Feb 2020 18:01:52 +0000 (18:01 +0000)
The value of the counter represents the number of nanoseconds
since host boot. That means the correct frequency is always 1GHz.

This inconsistency caused time to go slower in PV shim on most
platforms.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/time.c

index 724321684f0ca3f71d13dbe02add3ade03d82373..1c86d49a0d853396fb1ee485e0cd0299a7f641e0 100644 (file)
@@ -588,9 +588,7 @@ static int64_t __init init_xen_timer(struct platform_timesource *pts)
     if ( !xen_guest )
         return 0;
 
-    pts->frequency = xen_timer_cpu_frequency();
-
-    return pts->frequency;
+    return xen_timer_cpu_frequency();
 }
 
 static always_inline uint64_t read_cycle(const struct vcpu_time_info *info,
@@ -644,6 +642,7 @@ static struct platform_timesource __initdata plt_xen_timer =
 {
     .id = "xen",
     .name = "XEN PV CLOCK",
+    .frequency = 1000000000ULL,
     .read_counter = read_xen_timer,
     .init = init_xen_timer,
     .resume = resume_xen_timer,