12 #include <linux/sched.h>
14 #include <asm/processor.h>
35 #define CMCI_THRESHOLD 1
36 #define CMCI_POLL_INTERVAL (30 * HZ)
37 #define CMCI_STORM_INTERVAL (1 * HZ)
38 #define CMCI_STORM_THRESHOLD 15
52 static int cmci_supported(
int *
banks)
56 if (mce_cmci_disabled || mce_ignore_ce)
69 *banks =
min_t(
unsigned, MAX_NR_BANKS, cap & 0xff);
105 pr_notice(
"CMCI storm subsided: switching to interrupt mode\n");
129 static bool cmci_storm_detect(
void)
156 pr_notice(
"CMCI storm detected: switching to poll mode\n");
166 static void intel_threshold_interrupt(
void)
168 if (cmci_storm_detect())
179 static void cmci_discover(
int banks)
181 unsigned long *owned = (
void *)&
__get_cpu_var(mce_banks_owned);
184 int bios_wrong_thresh = 0;
187 for (i = 0; i <
banks; i++) {
189 int bios_zero_thresh = 0;
203 if (!mce_bios_cmci_threshold) {
212 bios_zero_thresh = 1;
221 if (val & MCI_CTL2_CMCI_EN) {
230 if (mce_bios_cmci_threshold && bios_zero_thresh &&
231 (val & MCI_CTL2_CMCI_THRESHOLD_MASK))
232 bios_wrong_thresh = 1;
238 if (mce_bios_cmci_threshold && bios_wrong_thresh) {
240 "bios_cmci_threshold: Some banks do not have valid thresholds set\n");
242 "bios_cmci_threshold: Make sure your BIOS supports this boot option\n");
273 if (!cmci_supported(&banks))
276 for (i = 0; i <
banks; i++) {
281 val &= ~MCI_CTL2_CMCI_EN;
288 static long cmci_rediscover_work_func(
void *
arg)
293 if (cmci_supported(&banks))
294 cmci_discover(banks);
307 if (!cmci_supported(&banks))
315 cmci_rediscover_work_func(
NULL);
319 work_on_cpu(cpu, cmci_rediscover_work_func,
NULL);
329 if (cmci_supported(&banks))
330 cmci_discover(banks);
333 static void intel_init_cmci(
void)
337 if (!cmci_supported(&banks))
341 cmci_discover(banks);