Skip to content

Commit 003d805

Browse files
jhovoldsuryasaimadhu
authored andcommitted
x86/apb_timer: Drop unused TSC calibration
Drop the APB-timer TSC calibration, which hasn't been used since the removal of Moorestown support by commit 1a8359e ("x86/mid: Remove Intel Moorestown"). Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent fd52a75 commit 003d805

File tree

2 files changed

+0
-55
lines changed

2 files changed

+0
-55
lines changed

arch/x86/include/asm/apb_timer.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#define APBT_DEV_USED 1
2929

3030
extern void apbt_time_init(void);
31-
extern unsigned long apbt_quick_calibrate(void);
3231
extern int arch_setup_apbt_irqs(int irq, int trigger, int mask, int cpu);
3332
extern void apbt_setup_secondary_clock(void);
3433

@@ -38,7 +37,6 @@ extern int sfi_mtimer_num;
3837

3938
#else /* CONFIG_APB_TIMER */
4039

41-
static inline unsigned long apbt_quick_calibrate(void) {return 0; }
4240
static inline void apbt_time_init(void) { }
4341

4442
#endif

arch/x86/kernel/apb_timer.c

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -345,56 +345,3 @@ void __init apbt_time_init(void)
345345
apb_timer_block_enabled = 0;
346346
panic("failed to enable APB timer\n");
347347
}
348-
349-
/* called before apb_timer_enable, use early map */
350-
unsigned long apbt_quick_calibrate(void)
351-
{
352-
int i, scale;
353-
u64 old, new;
354-
u64 t1, t2;
355-
unsigned long khz = 0;
356-
u32 loop, shift;
357-
358-
apbt_set_mapping();
359-
dw_apb_clocksource_start(clocksource_apbt);
360-
361-
/* check if the timer can count down, otherwise return */
362-
old = dw_apb_clocksource_read(clocksource_apbt);
363-
i = 10000;
364-
while (--i) {
365-
if (old != dw_apb_clocksource_read(clocksource_apbt))
366-
break;
367-
}
368-
if (!i)
369-
goto failed;
370-
371-
/* count 16 ms */
372-
loop = (apbt_freq / 1000) << 4;
373-
374-
/* restart the timer to ensure it won't get to 0 in the calibration */
375-
dw_apb_clocksource_start(clocksource_apbt);
376-
377-
old = dw_apb_clocksource_read(clocksource_apbt);
378-
old += loop;
379-
380-
t1 = rdtsc();
381-
382-
do {
383-
new = dw_apb_clocksource_read(clocksource_apbt);
384-
} while (new < old);
385-
386-
t2 = rdtsc();
387-
388-
shift = 5;
389-
if (unlikely(loop >> shift == 0)) {
390-
printk(KERN_INFO
391-
"APBT TSC calibration failed, not enough resolution\n");
392-
return 0;
393-
}
394-
scale = (int)div_u64((t2 - t1), loop >> shift);
395-
khz = (scale * (apbt_freq / 1000)) >> shift;
396-
printk(KERN_INFO "TSC freq calculated by APB timer is %lu khz\n", khz);
397-
return khz;
398-
failed:
399-
return 0;
400-
}

0 commit comments

Comments
 (0)