Commit 89b3b1f4 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Ingo Molnar

x86: apic_64 - make calibrate_APIC_clock to return error code

Make calibration_result to return error and check calibration_result
to be sufficient inside calibrate_APIC_clock.
Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: macro@linux-mips.org
Cc: yhlu.kernel@gmail.com
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 593f4a78
...@@ -314,7 +314,7 @@ static void setup_APIC_timer(void) ...@@ -314,7 +314,7 @@ static void setup_APIC_timer(void)
#define TICK_COUNT 100000000 #define TICK_COUNT 100000000
static void __init calibrate_APIC_clock(void) static int __init calibrate_APIC_clock(void)
{ {
unsigned apic, apic_start; unsigned apic, apic_start;
unsigned long tsc, tsc_start; unsigned long tsc, tsc_start;
...@@ -368,6 +368,17 @@ static void __init calibrate_APIC_clock(void) ...@@ -368,6 +368,17 @@ static void __init calibrate_APIC_clock(void)
clockevent_delta2ns(0xF, &lapic_clockevent); clockevent_delta2ns(0xF, &lapic_clockevent);
calibration_result = result / HZ; calibration_result = result / HZ;
/*
* Do a sanity check on the APIC calibration result
*/
if (calibration_result < (1000000 / HZ)) {
printk(KERN_WARNING
"APIC frequency too slow, disabling apic timer\n");
return -1;
}
return 0;
} }
/* /*
...@@ -394,14 +405,7 @@ void __init setup_boot_APIC_clock(void) ...@@ -394,14 +405,7 @@ void __init setup_boot_APIC_clock(void)
} }
printk(KERN_INFO "Using local APIC timer interrupts.\n"); printk(KERN_INFO "Using local APIC timer interrupts.\n");
calibrate_APIC_clock(); if (calibrate_APIC_clock()) {
/*
* Do a sanity check on the APIC calibration result
*/
if (calibration_result < (1000000 / HZ)) {
printk(KERN_WARNING
"APIC frequency too slow, disabling apic timer\n");
/* No broadcast on UP ! */ /* No broadcast on UP ! */
if (num_possible_cpus() > 1) if (num_possible_cpus() > 1)
setup_APIC_timer(); setup_APIC_timer();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment