diff options
Diffstat (limited to 'arch/x86/kernel/tsc_msr.c')
-rw-r--r-- | arch/x86/kernel/tsc_msr.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/arch/x86/kernel/tsc_msr.c b/arch/x86/kernel/tsc_msr.c index 8b5434f4389f..92ae6acac8a7 100644 --- a/arch/x86/kernel/tsc_msr.c +++ b/arch/x86/kernel/tsc_msr.c | |||
@@ -53,7 +53,7 @@ static struct freq_desc freq_desc_tables[] = { | |||
53 | /* TNG */ | 53 | /* TNG */ |
54 | { 6, 0x4a, 1, { 0, FREQ_100, FREQ_133, 0, 0, 0, 0, 0 } }, | 54 | { 6, 0x4a, 1, { 0, FREQ_100, FREQ_133, 0, 0, 0, 0, 0 } }, |
55 | /* VLV2 */ | 55 | /* VLV2 */ |
56 | { 6, 0x37, 1, { 0, FREQ_100, FREQ_133, FREQ_166, 0, 0, 0, 0 } }, | 56 | { 6, 0x37, 1, { FREQ_83, FREQ_100, FREQ_133, FREQ_166, 0, 0, 0, 0 } }, |
57 | /* ANN */ | 57 | /* ANN */ |
58 | { 6, 0x5a, 1, { FREQ_83, FREQ_100, FREQ_133, FREQ_100, 0, 0, 0, 0 } }, | 58 | { 6, 0x5a, 1, { FREQ_83, FREQ_100, FREQ_133, FREQ_100, 0, 0, 0, 0 } }, |
59 | }; | 59 | }; |
@@ -77,21 +77,18 @@ static int match_cpu(u8 family, u8 model) | |||
77 | 77 | ||
78 | /* | 78 | /* |
79 | * Do MSR calibration only for known/supported CPUs. | 79 | * Do MSR calibration only for known/supported CPUs. |
80 | * Return values: | 80 | * |
81 | * -1: CPU is unknown/unsupported for MSR based calibration | 81 | * Returns the calibration value or 0 if MSR calibration failed. |
82 | * 0: CPU is known/supported, but calibration failed | ||
83 | * 1: CPU is known/supported, and calibration succeeded | ||
84 | */ | 82 | */ |
85 | int try_msr_calibrate_tsc(unsigned long *fast_calibrate) | 83 | unsigned long try_msr_calibrate_tsc(void) |
86 | { | 84 | { |
87 | int cpu_index; | ||
88 | u32 lo, hi, ratio, freq_id, freq; | 85 | u32 lo, hi, ratio, freq_id, freq; |
86 | unsigned long res; | ||
87 | int cpu_index; | ||
89 | 88 | ||
90 | cpu_index = match_cpu(boot_cpu_data.x86, boot_cpu_data.x86_model); | 89 | cpu_index = match_cpu(boot_cpu_data.x86, boot_cpu_data.x86_model); |
91 | if (cpu_index < 0) | 90 | if (cpu_index < 0) |
92 | return -1; | 91 | return 0; |
93 | |||
94 | *fast_calibrate = 0; | ||
95 | 92 | ||
96 | if (freq_desc_tables[cpu_index].msr_plat) { | 93 | if (freq_desc_tables[cpu_index].msr_plat) { |
97 | rdmsr(MSR_PLATFORM_INFO, lo, hi); | 94 | rdmsr(MSR_PLATFORM_INFO, lo, hi); |
@@ -103,7 +100,7 @@ int try_msr_calibrate_tsc(unsigned long *fast_calibrate) | |||
103 | pr_info("Maximum core-clock to bus-clock ratio: 0x%x\n", ratio); | 100 | pr_info("Maximum core-clock to bus-clock ratio: 0x%x\n", ratio); |
104 | 101 | ||
105 | if (!ratio) | 102 | if (!ratio) |
106 | return 0; | 103 | goto fail; |
107 | 104 | ||
108 | /* Get FSB FREQ ID */ | 105 | /* Get FSB FREQ ID */ |
109 | rdmsr(MSR_FSB_FREQ, lo, hi); | 106 | rdmsr(MSR_FSB_FREQ, lo, hi); |
@@ -112,16 +109,19 @@ int try_msr_calibrate_tsc(unsigned long *fast_calibrate) | |||
112 | pr_info("Resolved frequency ID: %u, frequency: %u KHz\n", | 109 | pr_info("Resolved frequency ID: %u, frequency: %u KHz\n", |
113 | freq_id, freq); | 110 | freq_id, freq); |
114 | if (!freq) | 111 | if (!freq) |
115 | return 0; | 112 | goto fail; |
116 | 113 | ||
117 | /* TSC frequency = maximum resolved freq * maximum resolved bus ratio */ | 114 | /* TSC frequency = maximum resolved freq * maximum resolved bus ratio */ |
118 | *fast_calibrate = freq * ratio; | 115 | res = freq * ratio; |
119 | pr_info("TSC runs at %lu KHz\n", *fast_calibrate); | 116 | pr_info("TSC runs at %lu KHz\n", res); |
120 | 117 | ||
121 | #ifdef CONFIG_X86_LOCAL_APIC | 118 | #ifdef CONFIG_X86_LOCAL_APIC |
122 | lapic_timer_frequency = (freq * 1000) / HZ; | 119 | lapic_timer_frequency = (freq * 1000) / HZ; |
123 | pr_info("lapic_timer_frequency = %d\n", lapic_timer_frequency); | 120 | pr_info("lapic_timer_frequency = %d\n", lapic_timer_frequency); |
124 | #endif | 121 | #endif |
122 | return res; | ||
125 | 123 | ||
126 | return 1; | 124 | fail: |
125 | pr_warn("Fast TSC calibration using MSR failed\n"); | ||
126 | return 0; | ||
127 | } | 127 | } |