diff options
-rw-r--r-- | arch/x86/include/asm/paravirt.h | 10 | ||||
-rw-r--r-- | arch/x86/include/asm/paravirt_types.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/time.h | 50 | ||||
-rw-r--r-- | arch/x86/include/asm/x86_init.h | 4 | ||||
-rw-r--r-- | arch/x86/kernel/efi.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/kvmclock.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/paravirt.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/rtc.c | 12 | ||||
-rw-r--r-- | arch/x86/kernel/vmi_32.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/x86_init.c | 2 | ||||
-rw-r--r-- | arch/x86/lguest/boot.c | 4 | ||||
-rw-r--r-- | arch/x86/xen/enlighten.c | 4 |
12 files changed, 21 insertions, 83 deletions
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index 1e458a553303..a69ae87bd7d8 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h | |||
@@ -24,16 +24,6 @@ static inline void load_sp0(struct tss_struct *tss, | |||
24 | PVOP_VCALL2(pv_cpu_ops.load_sp0, tss, thread); | 24 | PVOP_VCALL2(pv_cpu_ops.load_sp0, tss, thread); |
25 | } | 25 | } |
26 | 26 | ||
27 | static inline unsigned long get_wallclock(void) | ||
28 | { | ||
29 | return PVOP_CALL0(unsigned long, pv_time_ops.get_wallclock); | ||
30 | } | ||
31 | |||
32 | static inline int set_wallclock(unsigned long nowtime) | ||
33 | { | ||
34 | return PVOP_CALL1(int, pv_time_ops.set_wallclock, nowtime); | ||
35 | } | ||
36 | |||
37 | /* The paravirtualized CPUID instruction. */ | 27 | /* The paravirtualized CPUID instruction. */ |
38 | static inline void __cpuid(unsigned int *eax, unsigned int *ebx, | 28 | static inline void __cpuid(unsigned int *eax, unsigned int *ebx, |
39 | unsigned int *ecx, unsigned int *edx) | 29 | unsigned int *ecx, unsigned int *edx) |
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index 0d812e592e3b..c25d5e3bdf9c 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h | |||
@@ -88,10 +88,6 @@ struct pv_lazy_ops { | |||
88 | }; | 88 | }; |
89 | 89 | ||
90 | struct pv_time_ops { | 90 | struct pv_time_ops { |
91 | /* Set and set time of day */ | ||
92 | unsigned long (*get_wallclock)(void); | ||
93 | int (*set_wallclock)(unsigned long); | ||
94 | |||
95 | unsigned long long (*sched_clock)(void); | 91 | unsigned long long (*sched_clock)(void); |
96 | unsigned long (*get_tsc_khz)(void); | 92 | unsigned long (*get_tsc_khz)(void); |
97 | }; | 93 | }; |
diff --git a/arch/x86/include/asm/time.h b/arch/x86/include/asm/time.h index 9c5608b21c27..7bdec4e9b739 100644 --- a/arch/x86/include/asm/time.h +++ b/arch/x86/include/asm/time.h | |||
@@ -4,57 +4,7 @@ | |||
4 | extern void hpet_time_init(void); | 4 | extern void hpet_time_init(void); |
5 | 5 | ||
6 | #include <asm/mc146818rtc.h> | 6 | #include <asm/mc146818rtc.h> |
7 | #ifdef CONFIG_X86_32 | ||
8 | #include <linux/efi.h> | ||
9 | |||
10 | static inline unsigned long native_get_wallclock(void) | ||
11 | { | ||
12 | unsigned long retval; | ||
13 | |||
14 | if (efi_enabled) | ||
15 | retval = efi_get_time(); | ||
16 | else | ||
17 | retval = mach_get_cmos_time(); | ||
18 | |||
19 | return retval; | ||
20 | } | ||
21 | |||
22 | static inline int native_set_wallclock(unsigned long nowtime) | ||
23 | { | ||
24 | int retval; | ||
25 | |||
26 | if (efi_enabled) | ||
27 | retval = efi_set_rtc_mmss(nowtime); | ||
28 | else | ||
29 | retval = mach_set_rtc_mmss(nowtime); | ||
30 | |||
31 | return retval; | ||
32 | } | ||
33 | |||
34 | #else | ||
35 | extern void native_time_init_hook(void); | ||
36 | |||
37 | static inline unsigned long native_get_wallclock(void) | ||
38 | { | ||
39 | return mach_get_cmos_time(); | ||
40 | } | ||
41 | |||
42 | static inline int native_set_wallclock(unsigned long nowtime) | ||
43 | { | ||
44 | return mach_set_rtc_mmss(nowtime); | ||
45 | } | ||
46 | |||
47 | #endif | ||
48 | 7 | ||
49 | extern void time_init(void); | 8 | extern void time_init(void); |
50 | 9 | ||
51 | #ifdef CONFIG_PARAVIRT | ||
52 | #include <asm/paravirt.h> | ||
53 | #else /* !CONFIG_PARAVIRT */ | ||
54 | |||
55 | #define get_wallclock() native_get_wallclock() | ||
56 | #define set_wallclock(x) native_set_wallclock(x) | ||
57 | |||
58 | #endif /* CONFIG_PARAVIRT */ | ||
59 | |||
60 | #endif /* _ASM_X86_TIME_H */ | 10 | #endif /* _ASM_X86_TIME_H */ |
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index b6c89428137d..2c756fd4ab0e 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h | |||
@@ -114,9 +114,13 @@ struct x86_cpuinit_ops { | |||
114 | /** | 114 | /** |
115 | * struct x86_platform_ops - platform specific runtime functions | 115 | * struct x86_platform_ops - platform specific runtime functions |
116 | * @calibrate_tsc: calibrate TSC | 116 | * @calibrate_tsc: calibrate TSC |
117 | * @get_wallclock: get time from HW clock like RTC etc. | ||
118 | * @set_wallclock: set time back to HW clock | ||
117 | */ | 119 | */ |
118 | struct x86_platform_ops { | 120 | struct x86_platform_ops { |
119 | unsigned long (*calibrate_tsc)(void); | 121 | unsigned long (*calibrate_tsc)(void); |
122 | unsigned long (*get_wallclock)(void); | ||
123 | int (*set_wallclock)(unsigned long nowtime); | ||
120 | }; | 124 | }; |
121 | 125 | ||
122 | extern struct x86_init_ops x86_init; | 126 | extern struct x86_init_ops x86_init; |
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c index fe26ba3e3451..ad5bd988fb79 100644 --- a/arch/x86/kernel/efi.c +++ b/arch/x86/kernel/efi.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <asm/time.h> | 42 | #include <asm/time.h> |
43 | #include <asm/cacheflush.h> | 43 | #include <asm/cacheflush.h> |
44 | #include <asm/tlbflush.h> | 44 | #include <asm/tlbflush.h> |
45 | #include <asm/x86_init.h> | ||
45 | 46 | ||
46 | #define EFI_DEBUG 1 | 47 | #define EFI_DEBUG 1 |
47 | #define PFX "EFI: " | 48 | #define PFX "EFI: " |
@@ -453,6 +454,9 @@ void __init efi_init(void) | |||
453 | if (add_efi_memmap) | 454 | if (add_efi_memmap) |
454 | do_add_efi_memmap(); | 455 | do_add_efi_memmap(); |
455 | 456 | ||
457 | x86_platform.get_wallclock = efi_get_time; | ||
458 | x86_platform.set_wallclock = efi_set_rtc_mmss; | ||
459 | |||
456 | /* Setup for EFI runtime service */ | 460 | /* Setup for EFI runtime service */ |
457 | reboot_type = BOOT_EFI; | 461 | reboot_type = BOOT_EFI; |
458 | 462 | ||
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 75a21b61b863..59ab94db12ea 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -184,10 +184,10 @@ void __init kvmclock_init(void) | |||
184 | if (kvmclock && kvm_para_has_feature(KVM_FEATURE_CLOCKSOURCE)) { | 184 | if (kvmclock && kvm_para_has_feature(KVM_FEATURE_CLOCKSOURCE)) { |
185 | if (kvm_register_clock("boot clock")) | 185 | if (kvm_register_clock("boot clock")) |
186 | return; | 186 | return; |
187 | pv_time_ops.get_wallclock = kvm_get_wallclock; | ||
188 | pv_time_ops.set_wallclock = kvm_set_wallclock; | ||
189 | pv_time_ops.sched_clock = kvm_clock_read; | 187 | pv_time_ops.sched_clock = kvm_clock_read; |
190 | x86_platform.calibrate_tsc = kvm_get_tsc_khz; | 188 | x86_platform.calibrate_tsc = kvm_get_tsc_khz; |
189 | x86_platform.get_wallclock = kvm_get_wallclock; | ||
190 | x86_platform.set_wallclock = kvm_set_wallclock; | ||
191 | #ifdef CONFIG_X86_LOCAL_APIC | 191 | #ifdef CONFIG_X86_LOCAL_APIC |
192 | x86_cpuinit.setup_percpu_clockev = | 192 | x86_cpuinit.setup_percpu_clockev = |
193 | kvm_setup_secondary_clock; | 193 | kvm_setup_secondary_clock; |
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 7cbf898d839b..c0fb85aed432 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -306,8 +306,6 @@ struct pv_init_ops pv_init_ops = { | |||
306 | }; | 306 | }; |
307 | 307 | ||
308 | struct pv_time_ops pv_time_ops = { | 308 | struct pv_time_ops pv_time_ops = { |
309 | .get_wallclock = native_get_wallclock, | ||
310 | .set_wallclock = native_set_wallclock, | ||
311 | .sched_clock = native_sched_clock, | 309 | .sched_clock = native_sched_clock, |
312 | }; | 310 | }; |
313 | 311 | ||
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c index 5d465b207e72..b8652f2e6855 100644 --- a/arch/x86/kernel/rtc.c +++ b/arch/x86/kernel/rtc.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/pnp.h> | 8 | #include <linux/pnp.h> |
9 | 9 | ||
10 | #include <asm/vsyscall.h> | 10 | #include <asm/vsyscall.h> |
11 | #include <asm/x86_init.h> | ||
11 | #include <asm/time.h> | 12 | #include <asm/time.h> |
12 | 13 | ||
13 | #ifdef CONFIG_X86_32 | 14 | #ifdef CONFIG_X86_32 |
@@ -165,13 +166,13 @@ void rtc_cmos_write(unsigned char val, unsigned char addr) | |||
165 | } | 166 | } |
166 | EXPORT_SYMBOL(rtc_cmos_write); | 167 | EXPORT_SYMBOL(rtc_cmos_write); |
167 | 168 | ||
168 | static int set_rtc_mmss(unsigned long nowtime) | 169 | int update_persistent_clock(struct timespec now) |
169 | { | 170 | { |
170 | unsigned long flags; | 171 | unsigned long flags; |
171 | int retval; | 172 | int retval; |
172 | 173 | ||
173 | spin_lock_irqsave(&rtc_lock, flags); | 174 | spin_lock_irqsave(&rtc_lock, flags); |
174 | retval = set_wallclock(nowtime); | 175 | retval = x86_platform.set_wallclock(now.tv_sec); |
175 | spin_unlock_irqrestore(&rtc_lock, flags); | 176 | spin_unlock_irqrestore(&rtc_lock, flags); |
176 | 177 | ||
177 | return retval; | 178 | return retval; |
@@ -183,17 +184,12 @@ unsigned long read_persistent_clock(void) | |||
183 | unsigned long retval, flags; | 184 | unsigned long retval, flags; |
184 | 185 | ||
185 | spin_lock_irqsave(&rtc_lock, flags); | 186 | spin_lock_irqsave(&rtc_lock, flags); |
186 | retval = get_wallclock(); | 187 | retval = x86_platform.get_wallclock(); |
187 | spin_unlock_irqrestore(&rtc_lock, flags); | 188 | spin_unlock_irqrestore(&rtc_lock, flags); |
188 | 189 | ||
189 | return retval; | 190 | return retval; |
190 | } | 191 | } |
191 | 192 | ||
192 | int update_persistent_clock(struct timespec now) | ||
193 | { | ||
194 | return set_rtc_mmss(now.tv_sec); | ||
195 | } | ||
196 | |||
197 | unsigned long long native_read_tsc(void) | 193 | unsigned long long native_read_tsc(void) |
198 | { | 194 | { |
199 | return __native_read_tsc(); | 195 | return __native_read_tsc(); |
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c index 052ae81ee08b..31e6f6cfe53e 100644 --- a/arch/x86/kernel/vmi_32.c +++ b/arch/x86/kernel/vmi_32.c | |||
@@ -818,14 +818,14 @@ static inline int __init activate_vmi(void) | |||
818 | vmi_timer_ops.cancel_alarm = | 818 | vmi_timer_ops.cancel_alarm = |
819 | vmi_get_function(VMI_CALL_CancelAlarm); | 819 | vmi_get_function(VMI_CALL_CancelAlarm); |
820 | x86_init.timers.timer_init = vmi_time_init; | 820 | x86_init.timers.timer_init = vmi_time_init; |
821 | pv_time_ops.get_wallclock = vmi_get_wallclock; | ||
822 | pv_time_ops.set_wallclock = vmi_set_wallclock; | ||
823 | #ifdef CONFIG_X86_LOCAL_APIC | 821 | #ifdef CONFIG_X86_LOCAL_APIC |
824 | x86_init.timers.setup_percpu_clockev = vmi_time_bsp_init; | 822 | x86_init.timers.setup_percpu_clockev = vmi_time_bsp_init; |
825 | x86_cpuinit.setup_percpu_clockev = vmi_time_ap_init; | 823 | x86_cpuinit.setup_percpu_clockev = vmi_time_ap_init; |
826 | #endif | 824 | #endif |
827 | pv_time_ops.sched_clock = vmi_sched_clock; | 825 | pv_time_ops.sched_clock = vmi_sched_clock; |
828 | x86_platform.calibrate_tsc = vmi_tsc_khz; | 826 | x86_platform.calibrate_tsc = vmi_tsc_khz; |
827 | x86_platform.get_wallclock = vmi_get_wallclock; | ||
828 | x86_platform.set_wallclock = vmi_set_wallclock; | ||
829 | 829 | ||
830 | /* We have true wallclock functions; disable CMOS clock sync */ | 830 | /* We have true wallclock functions; disable CMOS clock sync */ |
831 | no_sync_cmos_clock = 1; | 831 | no_sync_cmos_clock = 1; |
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index 68824c7be4e2..4449a4a2c2ed 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c | |||
@@ -70,4 +70,6 @@ struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = { | |||
70 | 70 | ||
71 | struct x86_platform_ops x86_platform = { | 71 | struct x86_platform_ops x86_platform = { |
72 | .calibrate_tsc = native_calibrate_tsc, | 72 | .calibrate_tsc = native_calibrate_tsc, |
73 | .get_wallclock = mach_get_cmos_time, | ||
74 | .set_wallclock = mach_set_rtc_mmss, | ||
73 | }; | 75 | }; |
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index fabe745513d9..4cb7d5d18b8e 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
@@ -1318,13 +1318,11 @@ __init void lguest_init(void) | |||
1318 | set_lguest_basic_apic_ops(); | 1318 | set_lguest_basic_apic_ops(); |
1319 | #endif | 1319 | #endif |
1320 | 1320 | ||
1321 | /* Time operations */ | ||
1322 | pv_time_ops.get_wallclock = lguest_get_wallclock; | ||
1323 | |||
1324 | x86_init.resources.memory_setup = lguest_memory_setup; | 1321 | x86_init.resources.memory_setup = lguest_memory_setup; |
1325 | x86_init.irqs.intr_init = lguest_init_IRQ; | 1322 | x86_init.irqs.intr_init = lguest_init_IRQ; |
1326 | x86_init.timers.timer_init = lguest_time_init; | 1323 | x86_init.timers.timer_init = lguest_time_init; |
1327 | x86_platform.calibrate_tsc = lguest_tsc_khz; | 1324 | x86_platform.calibrate_tsc = lguest_tsc_khz; |
1325 | x86_platform.get_wallclock = lguest_get_wallclock; | ||
1328 | 1326 | ||
1329 | /* | 1327 | /* |
1330 | * Now is a good time to look at the implementations of these functions | 1328 | * Now is a good time to look at the implementations of these functions |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index ee8cac77c8a4..b5bf8b9119a3 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -842,8 +842,6 @@ static const struct pv_init_ops xen_init_ops __initdata = { | |||
842 | }; | 842 | }; |
843 | 843 | ||
844 | static const struct pv_time_ops xen_time_ops __initdata = { | 844 | static const struct pv_time_ops xen_time_ops __initdata = { |
845 | .set_wallclock = xen_set_wallclock, | ||
846 | .get_wallclock = xen_get_wallclock, | ||
847 | .sched_clock = xen_sched_clock, | 845 | .sched_clock = xen_sched_clock, |
848 | }; | 846 | }; |
849 | 847 | ||
@@ -980,6 +978,8 @@ asmlinkage void __init xen_start_kernel(void) | |||
980 | x86_cpuinit.setup_percpu_clockev = x86_init_noop; | 978 | x86_cpuinit.setup_percpu_clockev = x86_init_noop; |
981 | 979 | ||
982 | x86_platform.calibrate_tsc = xen_tsc_khz; | 980 | x86_platform.calibrate_tsc = xen_tsc_khz; |
981 | x86_platform.get_wallclock = xen_get_wallclock; | ||
982 | x86_platform.set_wallclock = xen_set_wallclock; | ||
983 | 983 | ||
984 | #ifdef CONFIG_X86_64 | 984 | #ifdef CONFIG_X86_64 |
985 | /* | 985 | /* |