Skip to content

Commit b01cc1b

Browse files
John Stultzjohnstultz-work
authored andcommitted
x86: Convert remaining x86 clocksources to clocksource_register_hz/khz
This converts the remaining x86 clocksources to use clocksource_register_hz/khz. CC: jacob.jun.pan@intel.com CC: Glauber Costa <glommer@redhat.com> CC: Dimitri Sivanich <sivanich@sgi.com> CC: Rusty Russell <rusty@rustcorp.com.au> CC: Jeremy Fitzhardinge <jeremy@xensource.com> CC: Chris McDermott <lcm@us.ibm.com> CC: Thomas Gleixner <tglx@linutronix.de> Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> [xen] Signed-off-by: John Stultz <johnstul@us.ibm.com>
1 parent 36d8593 commit b01cc1b

7 files changed

Lines changed: 8 additions & 40 deletions

File tree

‎arch/x86/kernel/apb_timer.c‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ static struct clocksource clocksource_apbt = {
177177
.rating = APBT_CLOCKSOURCE_RATING,
178178
.read = apbt_read_clocksource,
179179
.mask = APBT_MASK,
180-
.shift = APBT_SHIFT,
181180
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
182181
.resume = apbt_restart_clocksource,
183182
};
@@ -595,14 +594,7 @@ static int apbt_clocksource_register(void)
595594
if (t1 == apbt_read_clocksource(&clocksource_apbt))
596595
panic("APBT counter not counting. APBT disabled\n");
597596

598-
/*
599-
* initialize and register APBT clocksource
600-
* convert that to ns/clock cycle
601-
* mult = (ns/c) * 2^APBT_SHIFT
602-
*/
603-
clocksource_apbt.mult = div_sc(MSEC_PER_SEC,
604-
(unsigned long) apbt_freq, APBT_SHIFT);
605-
clocksource_register(&clocksource_apbt);
597+
clocksource_register_khz(&clocksource_apbt, (u32)apbt_freq*1000);
606598

607599
return 0;
608600
}

‎arch/x86/kernel/i8253.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ static struct clocksource pit_cs = {
188188
.rating = 110,
189189
.read = pit_read,
190190
.mask = CLOCKSOURCE_MASK(32),
191-
.mult = 0,
192-
.shift = 20,
193191
};
194192

195193
static int __init init_pit_clocksource(void)
@@ -205,9 +203,7 @@ static int __init init_pit_clocksource(void)
205203
pit_ce.mode != CLOCK_EVT_MODE_PERIODIC)
206204
return 0;
207205

208-
pit_cs.mult = clocksource_hz2mult(CLOCK_TICK_RATE, pit_cs.shift);
209-
210-
return clocksource_register(&pit_cs);
206+
return clocksource_register_hz(&pit_cs, CLOCK_TICK_RATE);
211207
}
212208
arch_initcall(init_pit_clocksource);
213209

‎arch/x86/kernel/kvmclock.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#include <asm/x86_init.h>
2727
#include <asm/reboot.h>
2828

29-
#define KVM_SCALE 22
30-
3129
static int kvmclock = 1;
3230
static int msr_kvm_system_time = MSR_KVM_SYSTEM_TIME;
3331
static int msr_kvm_wall_clock = MSR_KVM_WALL_CLOCK;
@@ -120,8 +118,6 @@ static struct clocksource kvm_clock = {
120118
.read = kvm_clock_get_cycles,
121119
.rating = 400,
122120
.mask = CLOCKSOURCE_MASK(64),
123-
.mult = 1 << KVM_SCALE,
124-
.shift = KVM_SCALE,
125121
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
126122
};
127123

@@ -203,7 +199,7 @@ void __init kvmclock_init(void)
203199
machine_ops.crash_shutdown = kvm_crash_shutdown;
204200
#endif
205201
kvm_get_preset_lpj();
206-
clocksource_register(&kvm_clock);
202+
clocksource_register_hz(&kvm_clock, NSEC_PER_SEC);
207203
pv_info.paravirt_enabled = 1;
208204
pv_info.name = "KVM";
209205

‎arch/x86/lguest/boot.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,6 @@ static struct clocksource lguest_clock = {
913913
.rating = 200,
914914
.read = lguest_clock_read,
915915
.mask = CLOCKSOURCE_MASK(64),
916-
.mult = 1 << 22,
917-
.shift = 22,
918916
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
919917
};
920918

@@ -997,7 +995,7 @@ static void lguest_time_init(void)
997995
/* Set up the timer interrupt (0) to go to our simple timer routine */
998996
set_irq_handler(0, lguest_time_irq);
999997

1000-
clocksource_register(&lguest_clock);
998+
clocksource_register_hz(&lguest_clock, NSEC_PER_SEC);
1001999

10021000
/* We can't set cpumask in the initializer: damn C limitations! Set it
10031001
* here and register our timer device. */

‎arch/x86/platform/uv/uv_time.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ static struct clocksource clocksource_uv = {
4040
.rating = 400,
4141
.read = uv_read_rtc,
4242
.mask = (cycle_t)UVH_RTC_REAL_TIME_CLOCK_MASK,
43-
.shift = 10,
4443
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
4544
};
4645

@@ -372,14 +371,11 @@ static __init int uv_rtc_setup_clock(void)
372371
if (!is_uv_system())
373372
return -ENODEV;
374373

375-
clocksource_uv.mult = clocksource_hz2mult(sn_rtc_cycles_per_second,
376-
clocksource_uv.shift);
377-
378374
/* If single blade, prefer tsc */
379375
if (uv_num_possible_blades() == 1)
380376
clocksource_uv.rating = 250;
381377

382-
rc = clocksource_register(&clocksource_uv);
378+
rc = clocksource_register_hz(&clocksource_uv, sn_rtc_cycles_per_second);
383379
if (rc)
384380
printk(KERN_INFO "UV RTC clocksource failed rc %d\n", rc);
385381
else

‎arch/x86/xen/time.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
#include "xen-ops.h"
2828

29-
#define XEN_SHIFT 22
30-
3129
/* Xen may fire a timer up to this many ns early */
3230
#define TIMER_SLOP 100000
3331
#define NS_PER_TICK (1000000000LL / HZ)
@@ -211,8 +209,6 @@ static struct clocksource xen_clocksource __read_mostly = {
211209
.rating = 400,
212210
.read = xen_clocksource_get_cycles,
213211
.mask = ~0,
214-
.mult = 1<<XEN_SHIFT, /* time directly in nanoseconds */
215-
.shift = XEN_SHIFT,
216212
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
217213
};
218214

@@ -446,7 +442,7 @@ static __init void xen_time_init(void)
446442
int cpu = smp_processor_id();
447443
struct timespec tp;
448444

449-
clocksource_register(&xen_clocksource);
445+
clocksource_register_hz(&xen_clocksource, NSEC_PER_SEC);
450446

451447
if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL) == 0) {
452448
/* Successfully turned off 100Hz tick, so we have the

‎drivers/clocksource/cyclone.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ static struct clocksource clocksource_cyclone = {
2929
.rating = 250,
3030
.read = read_cyclone,
3131
.mask = CYCLONE_TIMER_MASK,
32-
.mult = 10,
33-
.shift = 0,
3432
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
3533
};
3634

@@ -108,12 +106,8 @@ static int __init init_cyclone_clocksource(void)
108106
}
109107
cyclone_ptr = cyclone_timer;
110108

111-
/* sort out mult/shift values: */
112-
clocksource_cyclone.shift = 22;
113-
clocksource_cyclone.mult = clocksource_hz2mult(CYCLONE_TIMER_FREQ,
114-
clocksource_cyclone.shift);
115-
116-
return clocksource_register(&clocksource_cyclone);
109+
return clocksource_register_hz(&clocksource_cyclone,
110+
CYCLONE_TIMER_FREQ);
117111
}
118112

119113
arch_initcall(init_cyclone_clocksource);

0 commit comments

Comments
 (0)