|
@@ -181,10 +181,12 @@ static void cmci_discover(int banks)
|
|
|
unsigned long *owned = (void *)&__get_cpu_var(mce_banks_owned);
|
|
|
unsigned long flags;
|
|
|
int i;
|
|
|
+ int bios_wrong_thresh = 0;
|
|
|
|
|
|
raw_spin_lock_irqsave(&cmci_discover_lock, flags);
|
|
|
for (i = 0; i < banks; i++) {
|
|
|
u64 val;
|
|
|
+ int bios_zero_thresh = 0;
|
|
|
|
|
|
if (test_bit(i, owned))
|
|
|
continue;
|
|
@@ -198,8 +200,20 @@ static void cmci_discover(int banks)
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- val &= ~MCI_CTL2_CMCI_THRESHOLD_MASK;
|
|
|
- val |= MCI_CTL2_CMCI_EN | CMCI_THRESHOLD;
|
|
|
+ if (!mce_bios_cmci_threshold) {
|
|
|
+ val &= ~MCI_CTL2_CMCI_THRESHOLD_MASK;
|
|
|
+ val |= CMCI_THRESHOLD;
|
|
|
+ } else if (!(val & MCI_CTL2_CMCI_THRESHOLD_MASK)) {
|
|
|
+ /*
|
|
|
+ * If bios_cmci_threshold boot option was specified
|
|
|
+ * but the threshold is zero, we'll try to initialize
|
|
|
+ * it to 1.
|
|
|
+ */
|
|
|
+ bios_zero_thresh = 1;
|
|
|
+ val |= CMCI_THRESHOLD;
|
|
|
+ }
|
|
|
+
|
|
|
+ val |= MCI_CTL2_CMCI_EN;
|
|
|
wrmsrl(MSR_IA32_MCx_CTL2(i), val);
|
|
|
rdmsrl(MSR_IA32_MCx_CTL2(i), val);
|
|
|
|
|
@@ -207,11 +221,26 @@ static void cmci_discover(int banks)
|
|
|
if (val & MCI_CTL2_CMCI_EN) {
|
|
|
set_bit(i, owned);
|
|
|
__clear_bit(i, __get_cpu_var(mce_poll_banks));
|
|
|
+ /*
|
|
|
+ * We are able to set thresholds for some banks that
|
|
|
+ * had a threshold of 0. This means the BIOS has not
|
|
|
+ * set the thresholds properly or does not work with
|
|
|
+ * this boot option. Note down now and report later.
|
|
|
+ */
|
|
|
+ if (mce_bios_cmci_threshold && bios_zero_thresh &&
|
|
|
+ (val & MCI_CTL2_CMCI_THRESHOLD_MASK))
|
|
|
+ bios_wrong_thresh = 1;
|
|
|
} else {
|
|
|
WARN_ON(!test_bit(i, __get_cpu_var(mce_poll_banks)));
|
|
|
}
|
|
|
}
|
|
|
raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
|
|
|
+ if (mce_bios_cmci_threshold && bios_wrong_thresh) {
|
|
|
+ pr_info_once(
|
|
|
+ "bios_cmci_threshold: Some banks do not have valid thresholds set\n");
|
|
|
+ pr_info_once(
|
|
|
+ "bios_cmci_threshold: Make sure your BIOS supports this boot option\n");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -249,7 +278,7 @@ void cmci_clear(void)
|
|
|
continue;
|
|
|
/* Disable CMCI */
|
|
|
rdmsrl(MSR_IA32_MCx_CTL2(i), val);
|
|
|
- val &= ~(MCI_CTL2_CMCI_EN|MCI_CTL2_CMCI_THRESHOLD_MASK);
|
|
|
+ val &= ~MCI_CTL2_CMCI_EN;
|
|
|
wrmsrl(MSR_IA32_MCx_CTL2(i), val);
|
|
|
__clear_bit(i, __get_cpu_var(mce_banks_owned));
|
|
|
}
|